1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal && autoconf && autoheader && automake
7 # This works around the fact that libtool configuration may change LD
8 # for this particular configuration, but some shells, instead of
9 # keeping the changes in LD private, export them just because LD is
10 # exported. Only used at the end of this file.
11 ORIGINAL_LD_FOR_MULTILIBS=$LD
15 # For libtool versioning info, format is CURRENT:REVISION:AGE
17 AC_SUBST(libtool_VERSION)
19 GLIBCPP_TOPREL_CONFIGURE
21 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
23 # You will slowly go insane if you do not grok the following fact: when
24 # building v3 as part of the compiler, the top-level /target/ becomes the
25 # library's /host/. `configure' then causes --target to default to --host,
26 # exactly like any other package using autoconf. Therefore, 'target' and
27 # 'host' will always be the same. This makes sense both for native and
28 # cross compilers, just think about it for a little while. :-)
30 # Also, if v3 is being configured as part of a cross compiler, the top-level
31 # configure script will pass the "real" host as $with_cross_host.
33 # In AC 2.13 AC_CANONICAL_TARGET was known as AC_CANONICAL_SYSTEM.
36 # Runs configure.host, finds CC, CXX and assorted other critical bits.
37 # Must run this before the GLIBCPP_ENABLE_* macros below.
40 AM_INIT_AUTOMAKE($PACKAGE, $gcc_version)
41 AM_CONFIG_HEADER(config.h)
45 AC_SUBST(enable_shared)
46 AC_SUBST(enable_static)
48 # Check for c++ or library specific bits that don't require linking.
49 GLIBCPP_CHECK_GNU_MAKE
50 #GLIBCPP_CHECK_COMPILER_VERSION
53 # Enable all the variable C++ stuff. C_MBCHAR must come early.
55 GLIBCPP_ENABLE_CLOCALE
56 GLIBCPP_ENABLE_CHEADERS([$c_model])
57 GLIBCPP_ENABLE_C_MBCHAR([yes])
58 GLIBCPP_ENABLE_C99([yes])
59 GLIBCPP_ENABLE_LONG_LONG([yes])
60 GLIBCPP_ENABLE_THREADS
61 GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
62 GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
63 GLIBCPP_ENABLE_CONCEPT_CHECKS
64 GLIBCPP_ENABLE_CXX_FLAGS
65 GLIBCPP_ENABLE_DEBUG([no])
66 GLIBCPP_ENABLE_DEBUG_FLAGS([none])
68 # No surprises, no surprises...
69 if test $ATOMICITYH = cpu/generic ; then
70 AC_MSG_WARN([No native atomic operations are provided for this platform.])
71 if test $target_thread_file = single; then
72 AC_MSG_WARN([They cannot be faked when thread support is disabled.])
73 AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.])
75 AC_MSG_WARN([They will be faked using a mutex.])
76 AC_MSG_WARN([Performance of certain classes will degrade as a result.])
81 if test x"$build" != x"$host"; then
83 # We are being configured with some form of cross compiler.
84 GLIBCPP_IS_CROSS_COMPILING=true
86 # This lets us hard-code the functionality we know we'll have in the cross
87 # target environment. "Let" is a sugar-coated word placed on an especially
88 # dull and tedious hack, actually.
90 # Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros
91 # that involve linking, can't be used:
92 # "cannot open sim-crt0.o"
93 # "cannot open crt0.o"
94 # etc. All this is because there currently exists no unified, consistent
95 # way for top level CC information to be passed down to target directories:
96 # newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc.
97 # When all of that is done, all of this hokey, excessive AC_DEFINE junk for
98 # crosses can be removed.
100 # If Canadian cross, then don't pick up tools from the build directory.
101 # Used in GLIBCPP_EXPORT_INCLUDES (and nowhere else?).
102 if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host" \
103 && test x"$build" != x"$target"; then
109 # Construct crosses by hand, eliminating bits that need ld...
110 # GLIBCPP_CHECK_COMPILER_FEATURES
111 # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
112 # GLIBCPP_CHECK_MATH_SUPPORT
116 os_include_dir="os/bsd/freebsd"
117 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
118 machine/endian.h machine/param.h sys/machine.h sys/types.h \
119 fp.h locale.h float.h inttypes.h sys/resource.h sys/stat.h \
120 sys/time.h unistd.h])
121 SECTION_FLAGS='-ffunction-sections -fdata-sections'
122 AC_SUBST(SECTION_FLAGS)
123 GLIBCPP_CHECK_LINKER_FEATURES
124 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
125 GLIBCPP_CHECK_WCHAR_T_SUPPORT
126 AC_DEFINE(HAVE_LC_MESSAGES)
127 AC_DEFINE(HAVE_DRAND48)
128 AC_DEFINE(HAVE_GETPAGESIZE)
129 AC_DEFINE(HAVE_SETENV)
130 AC_DEFINE(HAVE_SIGSETJMP)
131 AC_DEFINE(HAVE_COPYSIGN)
132 AC_DEFINE(HAVE_COPYSIGNF)
133 AC_DEFINE(HAVE_FINITEF)
134 AC_DEFINE(HAVE_FINITE)
135 AC_DEFINE(HAVE_FREXPF)
136 AC_DEFINE(HAVE_HYPOT)
137 AC_DEFINE(HAVE_HYPOTF)
138 AC_DEFINE(HAVE_ISINF)
139 AC_DEFINE(HAVE_ISNAN)
140 AC_DEFINE(HAVE_ISNANF)
143 AC_DEFINE(HAVE_ACOSF)
144 AC_DEFINE(HAVE_ASINF)
145 AC_DEFINE(HAVE_ATAN2F)
146 AC_DEFINE(HAVE_ATANF)
147 AC_DEFINE(HAVE_CEILF)
148 AC_DEFINE(HAVE_COPYSIGN)
149 AC_DEFINE(HAVE_COPYSIGNF)
151 AC_DEFINE(HAVE_COSHF)
153 AC_DEFINE(HAVE_FABSF)
154 AC_DEFINE(HAVE_FLOORF)
155 AC_DEFINE(HAVE_FMODF)
156 AC_DEFINE(HAVE_FREXPF)
157 AC_DEFINE(HAVE_LDEXPF)
158 AC_DEFINE(HAVE_LOG10F)
160 AC_DEFINE(HAVE_MODFF)
163 AC_DEFINE(HAVE_SINHF)
164 AC_DEFINE(HAVE_SQRTF)
166 AC_DEFINE(HAVE_TANHF)
167 if test x"long_double_math_on_this_cpu" = x"yes"; then
168 AC_DEFINE(HAVE_FINITEL)
169 AC_DEFINE(HAVE_ISINFL)
170 AC_DEFINE(HAVE_ISNANL)
174 os_include_dir="os/hpux"
175 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
176 machine/endian.h machine/param.h sys/machine.h sys/types.h \
177 fp.h locale.h float.h inttypes.h])
178 SECTION_FLAGS='-ffunction-sections -fdata-sections'
179 AC_SUBST(SECTION_FLAGS)
180 GLIBCPP_CHECK_LINKER_FEATURES
181 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
182 GLIBCPP_CHECK_WCHAR_T_SUPPORT
183 AC_DEFINE(HAVE_COPYSIGN)
184 AC_DEFINE(HAVE_COPYSIGNF)
185 AC_DEFINE(HAVE_FREXPF)
186 AC_DEFINE(HAVE_HYPOT)
189 AC_DEFINE(HAVE_FINITE)
190 AC_DEFINE(HAVE_FINITEF)
191 AC_DEFINE(HAVE_ISINF)
192 AC_DEFINE(HAVE_ISINFF)
193 AC_DEFINE(HAVE_ISNAN)
194 AC_DEFINE(HAVE_ISNANF)
199 os_include_dir="os/gnu-linux"
200 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
201 machine/endian.h machine/param.h sys/machine.h sys/types.h \
202 fp.h locale.h float.h inttypes.h])
203 SECTION_FLAGS='-ffunction-sections -fdata-sections'
204 AC_SUBST(SECTION_FLAGS)
205 GLIBCPP_CHECK_LINKER_FEATURES
206 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
207 GLIBCPP_CHECK_WCHAR_T_SUPPORT
208 AC_DEFINE(HAVE_COPYSIGN)
209 AC_DEFINE(HAVE_COPYSIGNF)
210 AC_DEFINE(HAVE_FINITE)
211 AC_DEFINE(HAVE_FINITEF)
212 AC_DEFINE(HAVE_FREXPF)
213 AC_DEFINE(HAVE_HYPOTF)
214 AC_DEFINE(HAVE_ISINF)
215 AC_DEFINE(HAVE_ISINFF)
216 AC_DEFINE(HAVE_ISNAN)
217 AC_DEFINE(HAVE_ISNANF)
218 AC_DEFINE(HAVE_SINCOS)
219 AC_DEFINE(HAVE_SINCOSF)
220 if test x"long_double_math_on_this_cpu" = x"yes"; then
221 AC_DEFINE(HAVE_FINITEL)
222 AC_DEFINE(HAVE_HYPOTL)
223 AC_DEFINE(HAVE_ISINFL)
224 AC_DEFINE(HAVE_ISNANL)
228 os_include_dir="os/mingw32"
229 AC_CHECK_HEADERS([sys/types.h locale.h float.h])
230 GLIBCPP_CHECK_LINKER_FEATURES
231 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
232 GLIBCPP_CHECK_WCHAR_T_SUPPORT
235 os_include_dir="os/bsd/netbsd"
236 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
237 machine/endian.h machine/param.h sys/machine.h sys/types.h \
238 fp.h locale.h float.h inttypes.h])
239 SECTION_FLAGS='-ffunction-sections -fdata-sections'
240 AC_SUBST(SECTION_FLAGS)
241 GLIBCPP_CHECK_LINKER_FEATURES
242 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
243 GLIBCPP_CHECK_WCHAR_T_SUPPORT
244 AC_DEFINE(HAVE_COPYSIGN)
245 AC_DEFINE(HAVE_COPYSIGNF)
246 AC_DEFINE(HAVE_FINITEF)
247 AC_DEFINE(HAVE_FINITE)
248 AC_DEFINE(HAVE_FREXPF)
249 AC_DEFINE(HAVE_HYPOTF)
250 AC_DEFINE(HAVE_ISINF)
251 AC_DEFINE(HAVE_ISINFF)
252 AC_DEFINE(HAVE_ISNAN)
253 AC_DEFINE(HAVE_ISNANF)
254 if test x"long_double_math_on_this_cpu" = x"yes"; then
255 AC_DEFINE(HAVE_FINITEL)
256 AC_DEFINE(HAVE_ISINFL)
257 AC_DEFINE(HAVE_ISNANL)
260 *-qnx6.1* | *-qnx6.2*)
261 os_include_dir="os/qnx/qnx6.1"
262 SECTION_FLAGS='-ffunction-sections -fdata-sections'
263 AC_SUBST(SECTION_FLAGS)
264 GLIBCPP_CHECK_LINKER_FEATURES
265 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
266 GLIBCPP_CHECK_WCHAR_T_SUPPORT
269 AC_DEFINE(HAVE_COSHF)
270 AC_DEFINE(HAVE_COSHL)
273 AC_DEFINE(HAVE_LOG10F)
274 AC_DEFINE(HAVE_LOG10L)
277 AC_DEFINE(HAVE_SINHF)
278 AC_DEFINE(HAVE_SINHL)
283 os_include_dir="os/solaris/solaris2.5"
286 os_include_dir="os/solaris/solaris2.6"
288 *-solaris2.7 | *-solaris2.8 | *-solaris2.9)
289 os_include_dir="os/solaris/solaris2.7"
292 AC_DEFINE(HAVE_STRTOF)
293 AC_DEFINE(HAVE_STRTOLD)
295 AC_DEFINE(HAVE_COPYSIGN)
296 AC_DEFINE(HAVE_ISNAN)
297 AC_DEFINE(HAVE_ISNANF)
298 AC_DEFINE(HAVE_MODFF)
299 AC_DEFINE(HAVE_HYPOT)
302 os_include_dir="os/windiss"
303 AC_DEFINE(HAVE_ACOSF)
304 AC_DEFINE(HAVE_ASINF)
305 AC_DEFINE(HAVE_ATAN2F)
306 AC_DEFINE(HAVE_ATANF)
307 AC_DEFINE(HAVE_CEILF)
308 AC_DEFINE(HAVE_COPYSIGN)
309 AC_DEFINE(HAVE_COPYSIGNF)
311 AC_DEFINE(HAVE_COSHF)
313 AC_DEFINE(HAVE_FABSF)
314 AC_DEFINE(HAVE_FLOORF)
315 AC_DEFINE(HAVE_FMODF)
316 AC_DEFINE(HAVE_FREXPF)
317 AC_DEFINE(HAVE_LDEXPF)
318 AC_DEFINE(HAVE_LOG10F)
320 AC_DEFINE(HAVE_MODFF)
323 AC_DEFINE(HAVE_SINHF)
324 AC_DEFINE(HAVE_SQRTF)
326 AC_DEFINE(HAVE_TANHF)
329 if test "x${with_newlib}" = "xyes"; then
330 os_include_dir="os/newlib"
331 AC_DEFINE(HAVE_HYPOT)
333 # GLIBCPP_CHECK_STDLIB_SUPPORT
334 AC_DEFINE(HAVE_STRTOF)
335 AC_DEFINE(HAVE_STRTOLD)
339 AC_DEFINE(HAVE_ACOSF)
340 AC_DEFINE(HAVE_ASINF)
341 AC_DEFINE(HAVE_ATAN2F)
342 AC_DEFINE(HAVE_ATANF)
343 AC_DEFINE(HAVE_CEILF)
344 AC_DEFINE(HAVE_COPYSIGN)
345 AC_DEFINE(HAVE_COPYSIGNF)
347 AC_DEFINE(HAVE_COSHF)
349 AC_DEFINE(HAVE_FABSF)
350 AC_DEFINE(HAVE_FLOORF)
351 AC_DEFINE(HAVE_FMODF)
352 AC_DEFINE(HAVE_FREXPF)
353 AC_DEFINE(HAVE_LDEXPF)
354 AC_DEFINE(HAVE_LOG10F)
356 AC_DEFINE(HAVE_MODFF)
359 AC_DEFINE(HAVE_SINHF)
360 AC_DEFINE(HAVE_SQRTF)
362 AC_DEFINE(HAVE_TANHF)
364 AC_MSG_ERROR([No support for this host/target combination.])
369 # At some point, we should differentiate between architectures
370 # like x86, which have long double versions, and alpha/powerpc/etc.,
371 # which don't. For the time being, punt.
372 if test x"long_double_math_on_this_cpu" = x"yes"; then
373 AC_DEFINE(HAVE_ACOSL)
374 AC_DEFINE(HAVE_ASINL)
375 AC_DEFINE(HAVE_ATAN2L)
376 AC_DEFINE(HAVE_ATANL)
377 AC_DEFINE(HAVE_CEILL)
378 AC_DEFINE(HAVE_COPYSIGNL)
380 AC_DEFINE(HAVE_COSHL)
382 AC_DEFINE(HAVE_FABSL)
383 AC_DEFINE(HAVE_FLOORL)
384 AC_DEFINE(HAVE_FMODL)
385 AC_DEFINE(HAVE_FREXPL)
386 AC_DEFINE(HAVE_LDEXPL)
387 AC_DEFINE(HAVE_LOG10L)
389 AC_DEFINE(HAVE_MODFL)
391 AC_DEFINE(HAVE_SINCOSL)
393 AC_DEFINE(HAVE_SINHL)
394 AC_DEFINE(HAVE_SQRTL)
396 AC_DEFINE(HAVE_TANHL)
401 # We are being configured natively. We can do more elaborate tests
402 # that include AC_TRY_COMPILE now, as the linker is assumed to be
404 GLIBCPP_IS_CROSS_COMPILING=false
407 # Check for available headers.
408 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
409 machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h \
412 GLIBCPP_CHECK_COMPILER_FEATURES
413 GLIBCPP_CHECK_LINKER_FEATURES
414 GLIBCPP_CHECK_MATH_SUPPORT
415 GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
416 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
417 GLIBCPP_CHECK_WCHAR_T_SUPPORT
418 GLIBCPP_CHECK_STDLIB_SUPPORT
420 # For showmanyc_helper().
421 AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
423 GLIBCPP_CHECK_S_ISREG_OR_S_IFREG
429 ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
430 [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
436 # This depends on GLIBCPP_CHECK_LINKER_FEATURES, but without it assumes no.
437 GLIBCPP_ENABLE_SYMVERS([yes])
439 # This depends on GLIBCPP_ENABLE_SYMVERS and GLIBCPP_IS_CROSS_COMPILING.
440 GLIBCPP_CONFIGURE_TESTSUITE
442 # Propagate the target-specific source directories through the build chain.
443 # (Nothing currently uses cpu_include_dir directly; only ATOMICITYH
444 # uses it, and it only gets used in this file.)
445 OS_INC_SRCDIR=config/${os_include_dir}
446 ATOMICITY_INC_SRCDIR=config/${ATOMICITYH}
447 AC_SUBST(OS_INC_SRCDIR)
448 AC_SUBST(ATOMICITY_INC_SRCDIR)
450 # Determine cross-compile flags and all AM_CONDITIONALs.
451 AC_SUBST(GLIBCPP_IS_CROSS_COMPILING)
452 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
453 dnl from GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT:
454 AM_CONDITIONAL(GLIBCPP_BUILD_LIBMATH, test "$need_libmath" = yes)
458 if test "${multilib}" = "yes"; then
459 multilib_arg="--enable-multilib"
464 # Export all the install information
465 GLIBCPP_EXPORT_INSTALL_INFO
467 # Export all the include and flag information to Makefiles.
468 GLIBCPP_EXPORT_INCLUDES
471 if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
472 grep "enable shared" > /dev/null; then
473 LIBSUPCXX_PICFLAGS=-prefer-pic
477 AC_SUBST(LIBSUPCXX_PICFLAGS)
479 # Generate the various Makefiles, include files, and scripts.
480 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am,
481 # libsupc++/Makefile.am and testsuite/Makefile.am so that multilib installs
482 # will end up installed in the correct place. To work around this not being
483 # passed # down from config-ml.in -> top_srcdir/Makefile.am ->
484 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
486 include/Makefile src/Makefile \
487 libmath/Makefile libsupc++/Makefile \
488 po/Makefile testsuite/Makefile scripts/check_survey scripts/testsuite_flags,
489 [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
490 if test -n "$CONFIG_FILES"; then
491 if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
492 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
493 # Ony modify Makefiles that are just being created.
494 case " $CONFIG_FILES" in
496 ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
499 case $CONFIG_FILES in
501 grep '^MULTISUBDIR =' Makefile >> src/Makefile
504 case $CONFIG_FILES in
505 *libsupc++/Makefile*)
506 grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
509 case $CONFIG_FILES in
510 *testsuite/Makefile*)
511 grep '^MULTISUBDIR =' Makefile >> testsuite/Makefile
516 chmod +x scripts/check_survey
517 chmod +x scripts/testsuite_flags],
521 with_target_subdir=${with_target_subdir}
522 with_build_subdir=${with_build_subdir}
523 with_multisubdir=${with_multisubdir}
524 ac_configure_args="${multilib_arg} ${ac_configure_args}"
525 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
526 glibcpp_basedir=${glibcpp_basedir}
529 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
531 dnl In autoconf 2.5x, AC_OUTPUT is replaced by three AC_ macros:
532 dnl AC_CONFIG_FILES(Makefile \
533 dnl include/Makefile src/Makefile \
534 dnl libmath/Makefile libsupc++/Makefile \
535 dnl po/Makefile testsuite/Makefile \
536 dnl scripts/check_survey scripts/testsuite_flags)
537 dnl AC_CONFIG_COMMANDS([default],
538 dnl [if test -n "$CONFIG_FILES"; then
539 dnl # Ony modify Makefiles that are just being created.
540 dnl case " $CONFIG_FILES" in
542 dnl ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
545 dnl case $CONFIG_FILES in
547 dnl grep '^MULTISUBDIR =' Makefile >> src/Makefile
550 dnl case $CONFIG_FILES in
551 dnl *libsupc++/Makefile*)
552 dnl grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
555 dnl case $CONFIG_FILES in
556 dnl *testsuite/Makefile*)
557 dnl grep '^MULTISUBDIR =' Makefile >> testsuite/Makefile
561 dnl chmod +x scripts/check_survey
562 dnl chmod +x scripts/testsuite_flags
567 dnl with_multisubdir=${with_multisubdir}
568 dnl ac_configure_args="${multilib_arg} ${ac_configure_args}"
569 dnl CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
570 dnl glibcpp_basedir=${glibcpp_basedir}
577 # Sanity checking & User-visible messages.
578 # Checks down here, otherwise they get scrolled off before
579 # the user will notice.
581 # Trying to get more people to read documentation. Possibly remove
582 # check and warn all the time. There is no "informational" AC_MSG_
583 # macro, so these are going to be printed even when --quiet/--silent
585 if test ! -f stamp-sanity-warned; then
586 touch stamp-sanity-warned
588 echo "Please make certain that you read the installation information here:"
589 echo " faster => ${srcdir}/docs/html/install.html"
590 echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
592 echo "and the configuration information here:"
593 echo " faster => ${srcdir}/docs/html/configopts.html"
594 echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
596 echo "before proceeding with ${_cv_gnu_make_command}."