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# 8required_defs="" 9required_undefs="" 10 11dnl Process this file with autoconf to produce a configure script. 12dnl disable cache processing, it has no effect here: 13define([AC_CACHE_LOAD], )dnl 14define([AC_CACHE_SAVE], )dnl 15AC_INIT(./tools/configure.in) 16 17 18AC_ARG_ENABLE(test, --enable-test tests current settings rather than defining new ones) 19 20if test "foo"$enable_test = "foo"; then 21 enable_test="no" 22fi 23 24cat << EOF 25*** $0: boost configuration utility *** 26 27Please stand by while exploring compiler capabilities... 28Be patient - this could take some time... 29 30Note that this test script only gives an approximate 31configuration - you will need to test the results carefully 32using the boost regression test suite before using the results. 33EOF 34 35if test $enable_test = 'yes'; then 36 37cat << EOF 38 39This script reports only the difference between the detected 40configuration, and the existing boost configuration. Its 41primary aim is to quickly report how well boost is configured 42for one compiler. 43 44*** 45 46EOF 47 48else 49 50cat << EOF 51 52*** 53 54EOF 55fi 56 57AC_ARG_ENABLE(extension,[--enable-extension=<ext>], 58[ 59case "$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 65esac 66], 67[AC_MSG_RESULT(Info : .cpp used as extension for tests) 68 ac_ext=cpp 69] 70) 71 72dnl figure out which version of sed to use, on some platforms 73dnl the version in the path is not Unix conforming (MacOS X ? ) 74 75if test -f /bin/sed ; then 76 SED=/bin/sed 77else 78 if test -f /usr/bin/sed ; then 79 SED=/usr/bin/sed 80 else 81 SED=sed 82 fi 83fi 84 85dnl Set the boost main directory. 86AC_MSG_CHECKING(for boost main tree) 87boost_base= 88AC_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) 109if 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 121fi 122if test "x$boost_base" != "x"; then 123 AC_MSG_RESULT([$boost_base]) 124else 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.]) 128fi 129 130 131 132# Save that, as it is being redefined several times 133use_ac_ext=$ac_ext 134 135AC_PROG_CXX 136ac_ext=$use_ac_ext 137 138AC_LANG_CPLUSPLUS 139 140OLD_CXXFLAGS="$CXXFLAGS" 141 142 143if test $enable_test = 'yes'; then 144 CXXFLAGS="-I$boost_base -I$boost_base/libs/config/test $CXXFLAGS" 145else 146 CXXFLAGS="-I$boost_base -I$boost_base/libs/config/test $CXXFLAGS -DBOOST_NO_CONFIG" 147fi 148 149# add the -AA conformance option to CXXFLAGS for HP aCC only 150if test $CXX = 'aCC'; then 151 CXXFLAGS="-AA $CXXFLAGS" 152fi 153 154dnl check for some standard libraries 155dnl without these some of the tests may fail: 156 157AC_CHECK_LIB(pthread, pthread_exit) 158AC_CHECK_LIB(m, cos) 159AC_CHECK_LIB(rt, clock) 160 161# 162# enumerate test files and test each one: 163# 164for 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 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` 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 191namespace ${namespace} = empty_boost; 192#endif 193 194int 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 217int 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 227done 228 229# 230# enumerate optional test files and test each one: 231# 232for 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 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` 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 255namespace ${namespace} = empty_boost; 256#endif 257 258int 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 278int 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 301int 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 315done 316 317 318#echo $required_defs 319#echo $required_undefs 320 321if test $enable_test = 'yes'; then 322 323if test "$required_defs" = ""; then 324echo no boost macros need to be defined 325echo no boost macros need to be defined >&5 326else 327echo the following macros need to be defined 328echo $required_defs 329echo the following macros need to be defined >&5 330echo $required_defs >&5 331fi 332if test "$required_undefs" = ""; then 333echo no boost macros need to be undefined 334echo no boost macros need to be undefined >&5 335else 336echo "the following macros need to be undef'ed" 337echo $required_undefs 338echo "the following macros need to be undef'ed" >&5 339echo $required_undefs >&5 340fi 341 342else 343 344date_string=`date` 345 346echo boost_base=$boost_base 347 348cat > 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// 390EOF 391 392for name in $required_defs; do 393echo '#define '"$name" >> user.hpp 394done 395 396cat_conts=`cat user.hpp` 397 398# 399# post configuration step: 400# 401AC_MSG_CHECKING(original configuration ) 402rm -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 405AC_MSG_RESULT(done) 406AC_MSG_CHECKING(new configuration ) 407rm -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 410AC_MSG_RESULT(done) 411 412AC_OUTPUT( 413[], 414[ 415cat > user.hpp << EEEOF 416${cat_conts} 417EEEOF 418cat << EEEOF 419 420Adjustments to boost configuration have been written to 421user.hpp. Copy this to boost/config/user.hpp to use "as is", 422or define BOOST_SITE_CONFIG to point to its location. 423 424TREAT THIS FILE WITH CARE. 425Autoconf generated options are not infallible! 426 427EEEOF 428], 429[ 430cat_conts="$cat_conts" 431] 432) 433 434fi 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 464