Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/config/tools/configure.in @ 25

Last change on this file since 25 was 12, checked in by landauf, 18 years ago

added boost

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