]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/config/tools/configure.in
8c69620e852d2682bb9ad1357f7deada29c61d66
[ceph.git] / ceph / src / boost / libs / config / tools / configure.in
1 # copyright John Maddock 2003
2 # Use, modification and distribution are subject to the
3 # Boost Software License, Version 1.0. (See accompanying file
4 # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #
6 # the following variables contain our macro definitions:
7 #
8 required_defs=""
9 required_undefs=""
10
11 dnl Process this file with autoconf to produce a configure script.
12 dnl disable cache processing, it has no effect here:
13 define([AC_CACHE_LOAD], )dnl
14 define([AC_CACHE_SAVE], )dnl
15 AC_INIT(./tools/configure.in)
16
17
18 AC_ARG_ENABLE(test, --enable-test tests current settings rather than defining new ones)
19
20 if test "foo"$enable_test = "foo"; then
21 enable_test="no"
22 fi
23
24 cat << EOF
25 *** $0: boost configuration utility ***
26
27 Please stand by while exploring compiler capabilities...
28 Be patient - this could take some time...
29
30 Note that this test script only gives an approximate
31 configuration - you will need to test the results carefully
32 using the boost regression test suite before using the results.
33 EOF
34
35 if test $enable_test = 'yes'; then
36
37 cat << EOF
38
39 This script reports only the difference between the detected
40 configuration, and the existing boost configuration. Its
41 primary aim is to quickly report how well boost is configured
42 for one compiler.
43
44 ***
45
46 EOF
47
48 else
49
50 cat << EOF
51
52 ***
53
54 EOF
55 fi
56
57 AC_ARG_ENABLE(extension,[--enable-extension=<ext>],
58 [
59 case "$enableval" in
60 no) AC_MSG_RESULT(Info :.cpp used as extension for tests)
61 ac_ext=cpp
62 ;;
63 *) AC_MSG_RESULT(Argument : .$enableval used as extension)
64 ac_ext=$enableval
65 esac
66 ],
67 [AC_MSG_RESULT(Info : .cpp used as extension for tests)
68 ac_ext=cpp
69 ]
70 )
71
72 dnl figure out which version of sed to use, on some platforms
73 dnl the version in the path is not Unix conforming (MacOS X ? )
74
75 if test -f /bin/sed ; then
76 SED=/bin/sed
77 else
78 if test -f /usr/bin/sed ; then
79 SED=/usr/bin/sed
80 else
81 SED=sed
82 fi
83 fi
84
85 dnl Set the boost main directory.
86 AC_MSG_CHECKING(for boost main tree)
87 boost_base=
88 AC_ARG_WITH(boost,
89 AC_HELP_STRING([--with-boost=DIR],[path to the boost main tree]),
90 [
91 #echo "--with boost is set"
92 if test "x$withval" != "x"; then
93 if test "x$withval" != no; then
94 boost_base=`echo "$withval" | $SED 's,//*,/,g' | $SED 's,/$,,'`
95 #echo boost_base=$boost_base
96 if test -f "$boost_base/boost/config.hpp"; then
97 if test -f "$boost_base/libs/config/configure"; then :; else
98 boost_base=
99 #echo "$boost_base/libs/config/configure" not found
100 fi
101 else
102 #echo "$boost_base/boost/config.hpp" not found
103 boost_base=
104 fi
105 fi
106 fi
107 ]
108 )
109 if test "x$boost_base" = "x"; then
110 #echo '$0 = ' $0
111 boost_base=`expr "x$0" : 'x\(.*\)/@<:@/@:>@*' \| '.'`
112 boost_base="$boost_base/../.."
113 #echo boost_base=$boost_base
114 if test -f "$boost_base/boost/config.hpp"; then
115 if test -f "$boost_base/libs/config/configure"; then :; else
116 boost_base=
117 fi
118 else
119 boost_base=
120 fi
121 fi
122 if test "x$boost_base" != "x"; then
123 AC_MSG_RESULT([$boost_base])
124 else
125 AC_MSG_RESULT([not found])
126 AC_MSG_ERROR([The boost main tree was not found.
127 Specify its location by the --with-boost option.])
128 fi
129
130
131
132 # Save that, as it is being redefined several times
133 use_ac_ext=$ac_ext
134
135 AC_PROG_CXX
136 ac_ext=$use_ac_ext
137
138 AC_LANG_CPLUSPLUS
139
140 OLD_CXXFLAGS="$CXXFLAGS"
141
142
143 if test $enable_test = 'yes'; then
144 CXXFLAGS="-I$boost_base -I$boost_base/libs/config/test $CXXFLAGS"
145 else
146 CXXFLAGS="-I$boost_base -I$boost_base/libs/config/test $CXXFLAGS -DBOOST_NO_CONFIG"
147 fi
148
149 # add the -AA conformance option to CXXFLAGS for HP aCC only
150 if test $CXX = 'aCC'; then
151 CXXFLAGS="-AA $CXXFLAGS"
152 fi
153
154 dnl check for some standard libraries
155 dnl without these some of the tests may fail:
156
157 AC_CHECK_LIB(pthread, pthread_exit)
158 AC_CHECK_LIB(m, cos)
159 AC_CHECK_LIB(rt, clock)
160
161 #
162 # enumerate test files and test each one:
163 #
164 for file in $boost_base/libs/config/test/boost_no*.ipp; do
165
166 basename=`echo $file | $SED 's/.*boost_\(.*\)\.ipp/\1/'`
167 macroname=`cat $file | grep '^//[[ ]]*MACRO:' | $SED 's/.*MACRO:[[ ]]*\([[_A-Z0-9]]*\).*/\1/'`
168 title=`cat $file | grep '^//[[ ]]*TITLE:' | $SED 's/.*TITLE:[[ ]]*\([[^ ]].*\)/\1/'`
169 namespace=`echo $macroname | tr [[A-Z]] [[a-z]]`
170
171 #echo file = $file
172 #echo basename = $basename
173 #echo macroname = $macroname
174 #echo title = $title
175 #echo namespace = $namespace
176
177 ac_ext=$use_ac_ext
178 if test $enable_test = 'yes'; then
179 AC_MSG_CHECKING($title (pass expected) )
180 else
181 AC_MSG_CHECKING($title )
182 fi
183 AC_TRY_RUN(
184 [
185 #include <boost/config.hpp>
186 #include "test.hpp"
187
188 #if !defined($macroname) || defined(BOOST_NO_CONFIG)
189 #include "boost_$basename.ipp"
190 #else
191 namespace ${namespace} = empty_boost;
192 #endif
193
194 int main(){ return ${namespace}::test(); } ]
195 ,
196 [AC_MSG_RESULT(OK)]
197 ,
198 [AC_MSG_RESULT(Failed)
199 required_defs="$macroname $required_defs"]
200 )
201
202 if test $enable_test = 'yes'; then
203
204 ac_ext=$use_ac_ext
205 AC_MSG_CHECKING($title (fail expected) )
206 AC_TRY_RUN(
207 [
208 #include <boost/config.hpp>
209 #include "test.hpp"
210
211 #ifdef $macroname
212 #include "boost_$basename.ipp"
213 #else
214 #error "this file should not compile"
215 #endif
216
217 int main() { return ${namespace}::test(); }]
218 ,
219 [AC_MSG_RESULT(failed)
220 required_undefs="$macroname $required_undefs"]
221 ,
222 [AC_MSG_RESULT(OK)]
223 )
224
225 fi
226
227 done
228
229 #
230 # enumerate optional test files and test each one:
231 #
232 for file in $boost_base/libs/config/test/boost_has*.ipp; do
233
234 basename=`echo $file | $SED 's/.*boost_\(.*\)\.ipp/\1/'`
235 macroname=`cat $file | grep '^//[[ ]]*MACRO:' | $SED 's/.*MACRO:[[ ]]*\([[_A-Z0-9]]*\).*/\1/'`
236 title=`cat $file | grep '^//[[ ]]*TITLE:' | $SED 's/.*TITLE:[[ ]]*\([[^ ]].*\)/\1/'`
237 namespace=`echo $macroname | tr [[A-Z]] [[a-z]]`
238
239 # echo $file
240 # echo $basename
241 # echo $macroname
242 # echo $title
243
244 ac_ext=$use_ac_ext
245 if test $enable_test = 'yes'; then
246 AC_MSG_CHECKING($title (pass expected) )
247 AC_TRY_RUN(
248 [
249 #include <boost/config.hpp>
250 #include "test.hpp"
251
252 #ifdef $macroname
253 #include "boost_$basename.ipp"
254 #else
255 namespace ${namespace} = empty_boost;
256 #endif
257
258 int main(){ return ${namespace}::test(); }]
259 ,
260 [AC_MSG_RESULT(OK)]
261 ,
262 [AC_MSG_RESULT(Failed)
263 required_undefs="$macroname $required_undefs"]
264 )
265
266 AC_MSG_CHECKING($title (fail expected) )
267 AC_TRY_RUN(
268 [
269 #include <boost/config.hpp>
270 #include "test.hpp"
271
272 #ifndef $macroname
273 #include "boost_$basename.ipp"
274 #else
275 #error "this file should not compile"
276 #endif
277
278 int main(){ return ${namespace}::test(); }]
279 ,
280 [
281 AC_MSG_RESULT(failed)
282 required_defs="$macroname $required_defs"
283 ]
284 ,
285 [
286 AC_MSG_RESULT(OK)
287 ]
288 )
289
290 else
291
292 ac_ext=$use_ac_ext
293 AC_MSG_CHECKING($title)
294 AC_TRY_RUN(
295 [
296 #include <boost/config.hpp>
297 #include "test.hpp"
298
299 #include "boost_$basename.ipp"
300
301 int main(){ return ${namespace}::test(); }]
302 ,
303 [
304 AC_MSG_RESULT(Yes)
305 required_defs="$macroname $required_defs"
306 ]
307 ,
308 [
309 AC_MSG_RESULT(no)
310 ]
311 )
312
313 fi
314
315 done
316
317
318 #echo $required_defs
319 #echo $required_undefs
320
321 if test $enable_test = 'yes'; then
322
323 if test "$required_defs" = ""; then
324 echo no boost macros need to be defined
325 echo no boost macros need to be defined >&5
326 else
327 echo the following macros need to be defined
328 echo $required_defs
329 echo the following macros need to be defined >&5
330 echo $required_defs >&5
331 fi
332 if test "$required_undefs" = ""; then
333 echo no boost macros need to be undefined
334 echo no boost macros need to be undefined >&5
335 else
336 echo "the following macros need to be undef'ed"
337 echo $required_undefs
338 echo "the following macros need to be undef'ed" >&5
339 echo $required_undefs >&5
340 fi
341
342 else
343
344 date_string=`date`
345
346 echo boost_base=$boost_base
347
348 cat > user.hpp << EOF
349 // (C) Copyright Boost.org 2001.
350 // Do not check in modified versions of this file,
351 // This file may be customised by the end user, but not by boost.
352
353 //
354 // Use this file to define a site and compiler specific
355 // configuration policy, this version was auto-generated by
356 // configure on ${date_string}
357 // With the following options:
358 // CXX = ${CXX}
359 // CXXFLAGS = ${CXXFLAGS}
360 // LDFLAGS = ${LDFLAGS}
361 // LIBS = ${LIBS}
362 //
363
364 // define this to disable all config options,
365 // excluding the user config. Use if your
366 // setup is fully ISO complient, and has no
367 // useful extentions, or for autoconf generated
368 // setups:
369 #ifndef BOOST_NO_CONFIG
370 # define BOOST_NO_CONFIG
371 #endif
372
373
374 // define if you want to disable threading support, even
375 // when available:
376 // #define BOOST_DISABLE_THREADS
377
378 // define if you want the regex library to use the C locale
379 // even on Win32:
380 // #define BOOST_REGEX_USE_C_LOCALE
381
382 // define this is you want the regex library to use the C++
383 // locale:
384 // #define BOOST_REGEX_USE_CPP_LOCALE
385
386
387 //
388 // options added by configure:
389 //
390 EOF
391
392 for name in $required_defs; do
393 echo '#define '"$name" >> user.hpp
394 done
395
396 cat_conts=`cat user.hpp`
397
398 #
399 # post configuration step:
400 #
401 AC_MSG_CHECKING(original configuration )
402 rm -f conftest$ac_exeext
403 $CXX -I$boost_base $OLD_CXXFLAGS -DBOOST_NO_USER_CONFIG -o conftest$ac_exeext $LDFLAGS $boost_base/libs/config/test/config_info.cpp $LIBS >&5 2>&1
404 ./conftest >&5 2>&1
405 AC_MSG_RESULT(done)
406 AC_MSG_CHECKING(new configuration )
407 rm -f conftest$ac_exeext
408 $CXX -I$boost_base -I$boost_base/libs/config $OLD_CXXFLAGS -DBOOST_USER_CONFIG='"user.hpp"' -o conftest$ac_exeext $LDFLAGS $boost_base/libs/config/test/config_info.cpp $LIBS >&5 2>&1
409 ./conftest >&5 2>&1
410 AC_MSG_RESULT(done)
411
412 AC_OUTPUT(
413 [],
414 [
415 cat > user.hpp << EEEOF
416 ${cat_conts}
417 EEEOF
418 cat << EEEOF
419
420 Adjustments to boost configuration have been written to
421 user.hpp. Copy this to boost/config/user.hpp to use "as is",
422 or define BOOST_SITE_CONFIG to point to its location.
423
424 TREAT THIS FILE WITH CARE.
425 Autoconf generated options are not infallible!
426
427 EEEOF
428 ],
429 [
430 cat_conts="$cat_conts"
431 ]
432 )
433
434 fi
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463