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)
6 # the following variables contain our macro definitions:
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)
18 AC_ARG_ENABLE(test, --enable-test tests current settings rather than defining new ones)
20 if test "foo"$enable_test = "foo"; then
25 *** $0: boost configuration utility ***
27 Please stand by while exploring compiler capabilities...
28 Be patient - this could take some time...
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.
35 if test $enable_test = 'yes'; then
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
57 AC_ARG_ENABLE(extension,[--enable-extension=<ext>],
60 no) AC_MSG_RESULT(Info :.cpp used as extension for tests)
63 *) AC_MSG_RESULT(Argument : .$enableval used as extension)
67 [AC_MSG_RESULT(Info : .cpp used as extension for tests)
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 ? )
75 if test -f /bin/sed ; then
78 if test -f /usr/bin/sed ; then
85 dnl Set the boost main directory.
86 AC_MSG_CHECKING(for boost main tree)
89 AC_HELP_STRING([--with-boost=DIR],[path to the boost main tree]),
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
99 #echo "$boost_base/libs/config/configure" not found
102 #echo "$boost_base/boost/config.hpp" not found
109 if test "x$boost_base" = "x"; then
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
122 if test "x$boost_base" != "x"; then
123 AC_MSG_RESULT([$boost_base])
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.])
132 # Save that, as it is being redefined several times
140 OLD_CXXFLAGS="$CXXFLAGS"
143 if test $enable_test = 'yes'; then
144 CXXFLAGS="-I$boost_base -I$boost_base/libs/config/test $CXXFLAGS"
146 CXXFLAGS="-I$boost_base -I$boost_base/libs/config/test $CXXFLAGS -DBOOST_NO_CONFIG"
149 # add the -AA conformance option to CXXFLAGS for HP aCC only
150 if test $CXX = 'aCC'; then
151 CXXFLAGS="-AA $CXXFLAGS"
154 dnl check for some standard libraries
155 dnl without these some of the tests may fail:
157 AC_CHECK_LIB(pthread, pthread_exit)
159 AC_CHECK_LIB(rt, clock)
162 # enumerate test files and test each one:
164 for file in $boost_base/libs/config/test/boost_no*.ipp; do
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]]`
172 #echo basename = $basename
173 #echo macroname = $macroname
175 #echo namespace = $namespace
178 if test $enable_test = 'yes'; then
179 AC_MSG_CHECKING($title (pass expected) )
181 AC_MSG_CHECKING($title )
185 #include <boost/config.hpp>
188 #if !defined($macroname) || defined(BOOST_NO_CONFIG)
189 #include "boost_$basename.ipp"
191 namespace ${namespace} = empty_boost;
194 int main(){ return ${namespace}::test(); } ]
198 [AC_MSG_RESULT(Failed)
199 required_defs="$macroname $required_defs"]
202 if test $enable_test = 'yes'; then
205 AC_MSG_CHECKING($title (fail expected) )
208 #include <boost/config.hpp>
212 #include "boost_$basename.ipp"
214 #error "this file should not compile"
217 int main() { return ${namespace}::test(); }]
219 [AC_MSG_RESULT(failed)
220 required_undefs="$macroname $required_undefs"]
230 # enumerate optional test files and test each one:
232 for file in $boost_base/libs/config/test/boost_has*.ipp; do
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]]`
245 if test $enable_test = 'yes'; then
246 AC_MSG_CHECKING($title (pass expected) )
249 #include <boost/config.hpp>
253 #include "boost_$basename.ipp"
255 namespace ${namespace} = empty_boost;
258 int main(){ return ${namespace}::test(); }]
262 [AC_MSG_RESULT(Failed)
263 required_undefs="$macroname $required_undefs"]
266 AC_MSG_CHECKING($title (fail expected) )
269 #include <boost/config.hpp>
273 #include "boost_$basename.ipp"
275 #error "this file should not compile"
278 int main(){ return ${namespace}::test(); }]
281 AC_MSG_RESULT(failed)
282 required_defs="$macroname $required_defs"
293 AC_MSG_CHECKING($title)
296 #include <boost/config.hpp>
299 #include "boost_$basename.ipp"
301 int main(){ return ${namespace}::test(); }]
305 required_defs="$macroname $required_defs"
319 #echo $required_undefs
321 if test $enable_test = 'yes'; then
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
327 echo the following macros need to be defined
329 echo the following macros need to be defined >&5
330 echo $required_defs >&5
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
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
346 echo boost_base=$boost_base
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.
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:
359 // CXXFLAGS = ${CXXFLAGS}
360 // LDFLAGS = ${LDFLAGS}
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
369 #ifndef BOOST_NO_CONFIG
370 # define BOOST_NO_CONFIG
374 // define if you want to disable threading support, even
376 // #define BOOST_DISABLE_THREADS
378 // define if you want the regex library to use the C locale
380 // #define BOOST_REGEX_USE_C_LOCALE
382 // define this is you want the regex library to use the C++
384 // #define BOOST_REGEX_USE_CPP_LOCALE
388 // options added by configure:
392 for name in $required_defs; do
393 echo '#define '"$name" >> user.hpp
396 cat_conts=`cat user.hpp`
399 # post configuration step:
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
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
415 cat > user.hpp << EEEOF
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.
424 TREAT THIS FILE WITH CARE.
425 Autoconf generated options are not infallible!
430 cat_conts="$cat_conts"