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 # AC 2.5x sets target_alias iff the user specified --target, but we use it
34 # everywhere, so we set it here just to be sure. In AC 2.13
35 # AC_CANONICAL_TARGET was known as AC_CANONICAL_SYSTEM.
37 target_alias=${target_alias-$target}
38 AC_SUBST(target_alias)
40 # Runs configure.target, finds CC, CXX and assorted other critical bits.
41 # Must run this before the GLIBCPP_ENABLE_* macros below.
44 AM_INIT_AUTOMAKE($PACKAGE, $gcc_version)
45 AM_CONFIG_HEADER(config.h)
49 AC_SUBST(enable_shared)
50 AC_SUBST(enable_static)
52 # Check for c++ or library specific bits that don't require linking.
53 #GLIBCPP_CHECK_COMPILER_VERSION
54 GLIBCPP_CHECK_GNU_MAKE
56 # Enable all the variable C++ stuff. C_MBCHAR must come early.
57 GLIBCPP_ENABLE_DEBUG($USE_MAINTAINER_MODE)
59 GLIBCPP_ENABLE_CLOCALE
60 GLIBCPP_ENABLE_C_MBCHAR([yes])
61 GLIBCPP_ENABLE_C99([yes])
62 GLIBCPP_ENABLE_LONG_LONG([yes])
63 GLIBCPP_ENABLE_CHEADERS([$c_model])
64 GLIBCPP_ENABLE_THREADS
65 GLIBCPP_ENABLE_CXX_FLAGS([none])
66 GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
67 GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
68 GLIBCPP_ENABLE_CONCEPT_CHECKS
70 # Check for headers necessary for libsupc++ using dyn-string.c/cxa_demangle.c
71 AC_CHECK_HEADERS(string.h stdlib.h)
73 # No surprises, no surprises...
74 if test $ATOMICITYH = cpu/generic ; then
75 AC_MSG_WARN([No native atomic operations are provided yet for this platform.])
76 if test $target_thread_file = single; then
77 AC_MSG_WARN([They cannot be faked when thread support is disabled.])
78 AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.])
80 AC_MSG_WARN([They will be faked using a mutex.])
81 AC_MSG_WARN([Performance of certain classes will degrade as a result.])
86 if test -n "$with_cross_host" || test x"$build" != x"$host"; then
88 # We are being configured with some form of cross compiler.
89 GLIBCPP_IS_CROSS_COMPILING=1
91 # This lets us hard-code the functionality we know we'll have in the cross
92 # target environment. "Let" is a sugar-coated word placed on an especially
93 # dull and tedious hack, actually.
95 # Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros
96 # that involve linking, can't be used:
97 # "cannot open sim-crt0.o"
98 # "cannot open crt0.o"
99 # etc. All this is because there currently exists no unified, consistent
100 # way for top level CC information to be passed down to target directories:
101 # newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc.
102 # When all of that is done, all of this hokey, excessive AC_DEFINE junk for
103 # crosses can be removed.
105 # If Canadian cross, then don't pick up tools from the build directory.
106 # Used in GLIBCPP_EXPORT_INCLUDES (and nowhere else?).
107 if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then
113 # Construct crosses by hand, eliminating bits that need ld...
114 # GLIBCPP_CHECK_COMPILER_FEATURES
115 # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
116 # GLIBCPP_CHECK_MATH_SUPPORT
120 os_include_dir="os/gnu-linux"
121 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
122 machine/endian.h machine/param.h sys/machine.h sys/types.h \
123 fp.h locale.h float.h inttypes.h])
124 SECTION_FLAGS='-ffunction-sections -fdata-sections'
125 AC_SUBST(SECTION_FLAGS)
126 GLIBCPP_CHECK_LINKER_FEATURES
127 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
128 GLIBCPP_CHECK_WCHAR_T_SUPPORT
129 AC_DEFINE(HAVE_COPYSIGN)
130 AC_DEFINE(HAVE_COPYSIGNF)
131 AC_DEFINE(HAVE_FINITE)
132 AC_DEFINE(HAVE_FINITEF)
133 AC_DEFINE(HAVE_FREXPF)
134 AC_DEFINE(HAVE_HYPOTF)
135 AC_DEFINE(HAVE_ISINF)
136 AC_DEFINE(HAVE_ISINFF)
137 AC_DEFINE(HAVE_ISNAN)
138 AC_DEFINE(HAVE_ISNANF)
139 AC_DEFINE(HAVE_SINCOS)
140 AC_DEFINE(HAVE_SINCOSF)
141 if test x"long_double_math_on_this_cpu" = x"yes"; then
142 AC_DEFINE(HAVE_FINITEL)
143 AC_DEFINE(HAVE_HYPOTL)
144 AC_DEFINE(HAVE_ISINFL)
145 AC_DEFINE(HAVE_ISNANL)
149 # Check for available headers.
150 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
151 machine/endian.h machine/param.h sys/machine.h sys/types.h \
152 fp.h locale.h float.h inttypes.h])
153 SECTION_FLAGS='-ffunction-sections -fdata-sections'
154 AC_SUBST(SECTION_FLAGS)
155 GLIBCPP_CHECK_LINKER_FEATURES
156 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
157 GLIBCPP_CHECK_WCHAR_T_SUPPORT
158 os_include_dir="os/hpux"
159 AC_DEFINE(HAVE_COPYSIGN)
160 AC_DEFINE(HAVE_COPYSIGNF)
161 AC_DEFINE(HAVE_FREXPF)
162 AC_DEFINE(HAVE_HYPOT)
165 AC_DEFINE(HAVE_FINITE)
166 AC_DEFINE(HAVE_FINITEF)
167 AC_DEFINE(HAVE_ISINF)
168 AC_DEFINE(HAVE_ISINFF)
169 AC_DEFINE(HAVE_ISNAN)
170 AC_DEFINE(HAVE_ISNANF)
176 # Check for available headers.
177 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
178 machine/endian.h machine/param.h sys/machine.h sys/types.h \
179 fp.h locale.h float.h inttypes.h])
180 SECTION_FLAGS='-ffunction-sections -fdata-sections'
181 AC_SUBST(SECTION_FLAGS)
182 GLIBCPP_CHECK_LINKER_FEATURES
183 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
184 GLIBCPP_CHECK_WCHAR_T_SUPPORT
185 os_include_dir="os/bsd/netbsd"
186 AC_DEFINE(HAVE_COPYSIGN)
187 AC_DEFINE(HAVE_COPYSIGNF)
188 AC_DEFINE(HAVE_FINITEF)
189 AC_DEFINE(HAVE_FINITE)
190 AC_DEFINE(HAVE_FREXPF)
191 AC_DEFINE(HAVE_HYPOTF)
192 AC_DEFINE(HAVE_ISINF)
193 AC_DEFINE(HAVE_ISINFF)
194 AC_DEFINE(HAVE_ISNAN)
195 AC_DEFINE(HAVE_ISNANF)
196 if test x"long_double_math_on_this_cpu" = x"yes"; then
197 AC_DEFINE(HAVE_FINITEL)
198 AC_DEFINE(HAVE_ISINFL)
199 AC_DEFINE(HAVE_ISNANL)
203 # Check for available headers.
204 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
205 machine/endian.h machine/param.h sys/machine.h sys/types.h \
206 fp.h locale.h float.h inttypes.h sys/resource.h sys/stat.h \
207 sys/time.h unistd.h])
208 SECTION_FLAGS='-ffunction-sections -fdata-sections'
209 AC_SUBST(SECTION_FLAGS)
210 GLIBCPP_CHECK_LINKER_FEATURES
211 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
212 GLIBCPP_CHECK_WCHAR_T_SUPPORT
213 os_include_dir="os/bsd/freebsd"
214 AC_DEFINE(HAVE_LC_MESSAGES)
215 AC_DEFINE(HAVE_DRAND48)
216 AC_DEFINE(HAVE_GETPAGESIZE)
217 AC_DEFINE(HAVE_SETENV)
218 AC_DEFINE(HAVE_SIGSETJMP)
219 AC_DEFINE(HAVE_COPYSIGN)
220 AC_DEFINE(HAVE_COPYSIGNF)
221 AC_DEFINE(HAVE_FINITEF)
222 AC_DEFINE(HAVE_FINITE)
223 AC_DEFINE(HAVE_FREXPF)
224 AC_DEFINE(HAVE_HYPOT)
225 AC_DEFINE(HAVE_HYPOTF)
226 AC_DEFINE(HAVE_ISINF)
227 AC_DEFINE(HAVE_ISNAN)
228 AC_DEFINE(HAVE_ISNANF)
229 if test x"long_double_math_on_this_cpu" = x"yes"; then
230 AC_DEFINE(HAVE_FINITEL)
231 AC_DEFINE(HAVE_ISINFL)
232 AC_DEFINE(HAVE_ISNANL)
236 AC_CHECK_HEADERS([sys/types.h locale.h float.h])
237 GLIBCPP_CHECK_LINKER_FEATURES
238 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
239 GLIBCPP_CHECK_WCHAR_T_SUPPORT
240 os_include_dir="os/mingw32"
243 os_include_dir="os/windiss"
248 SECTION_FLAGS='-ffunction-sections -fdata-sections'
249 AC_SUBST(SECTION_FLAGS)
250 GLIBCPP_CHECK_LINKER_FEATURES
251 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
252 GLIBCPP_CHECK_WCHAR_T_SUPPORT
253 os_include_dir="os/qnx/qnx6.1"
256 AC_DEFINE(HAVE_COSHF)
257 AC_DEFINE(HAVE_COSHL)
260 AC_DEFINE(HAVE_LOG10F)
261 AC_DEFINE(HAVE_LOG10L)
264 AC_DEFINE(HAVE_SINHF)
265 AC_DEFINE(HAVE_SINHL)
268 os_include_dir="os/newlib"
269 AC_DEFINE(HAVE_HYPOT)
277 AC_DEFINE(HAVE_ACOSF)
278 AC_DEFINE(HAVE_ASINF)
279 AC_DEFINE(HAVE_ATAN2F)
280 AC_DEFINE(HAVE_ATANF)
281 AC_DEFINE(HAVE_CEILF)
282 AC_DEFINE(HAVE_COPYSIGN)
283 AC_DEFINE(HAVE_COPYSIGNF)
285 AC_DEFINE(HAVE_COSHF)
287 AC_DEFINE(HAVE_FABSF)
288 AC_DEFINE(HAVE_FLOORF)
289 AC_DEFINE(HAVE_FMODF)
290 AC_DEFINE(HAVE_FREXPF)
291 AC_DEFINE(HAVE_LDEXPF)
292 AC_DEFINE(HAVE_LOG10F)
294 AC_DEFINE(HAVE_MODFF)
297 AC_DEFINE(HAVE_SINHF)
298 AC_DEFINE(HAVE_SQRTF)
300 AC_DEFINE(HAVE_TANHF)
303 # Must replicate generic section since we don't have strtof or strtold.
305 AC_DEFINE(HAVE_ACOSF)
306 AC_DEFINE(HAVE_ASINF)
307 AC_DEFINE(HAVE_ATAN2F)
308 AC_DEFINE(HAVE_ATANF)
309 AC_DEFINE(HAVE_CEILF)
310 AC_DEFINE(HAVE_COPYSIGN)
311 AC_DEFINE(HAVE_COPYSIGNF)
313 AC_DEFINE(HAVE_COSHF)
315 AC_DEFINE(HAVE_FABSF)
316 AC_DEFINE(HAVE_FLOORF)
317 AC_DEFINE(HAVE_FMODF)
318 AC_DEFINE(HAVE_FREXPF)
319 AC_DEFINE(HAVE_LDEXPF)
320 AC_DEFINE(HAVE_LOG10F)
322 AC_DEFINE(HAVE_MODFF)
325 AC_DEFINE(HAVE_SINHF)
326 AC_DEFINE(HAVE_SQRTF)
328 AC_DEFINE(HAVE_TANHF)
331 # GLIBCPP_CHECK_STDLIB_SUPPORT
332 AC_DEFINE(HAVE_STRTOF)
333 AC_DEFINE(HAVE_STRTOLD)
337 AC_DEFINE(HAVE_ACOSF)
338 AC_DEFINE(HAVE_ASINF)
339 AC_DEFINE(HAVE_ATAN2F)
340 AC_DEFINE(HAVE_ATANF)
341 AC_DEFINE(HAVE_CEILF)
342 AC_DEFINE(HAVE_COPYSIGN)
343 AC_DEFINE(HAVE_COPYSIGNF)
345 AC_DEFINE(HAVE_COSHF)
347 AC_DEFINE(HAVE_FABSF)
348 AC_DEFINE(HAVE_FLOORF)
349 AC_DEFINE(HAVE_FMODF)
350 AC_DEFINE(HAVE_FREXPF)
351 AC_DEFINE(HAVE_LDEXPF)
352 AC_DEFINE(HAVE_LOG10F)
354 AC_DEFINE(HAVE_MODFF)
357 AC_DEFINE(HAVE_SINHF)
358 AC_DEFINE(HAVE_SQRTF)
360 AC_DEFINE(HAVE_TANHF)
364 # At some point, we should differentiate between architectures
365 # like x86, which have long double versions, and alpha/powerpc/etc.,
366 # which don't. For the time being, punt.
367 if test x"long_double_math_on_this_cpu" = x"yes"; then
368 AC_DEFINE(HAVE_ACOSL)
369 AC_DEFINE(HAVE_ASINL)
370 AC_DEFINE(HAVE_ATAN2L)
371 AC_DEFINE(HAVE_ATANL)
372 AC_DEFINE(HAVE_CEILL)
373 AC_DEFINE(HAVE_COPYSIGNL)
375 AC_DEFINE(HAVE_COSHL)
377 AC_DEFINE(HAVE_FABSL)
378 AC_DEFINE(HAVE_FLOORL)
379 AC_DEFINE(HAVE_FMODL)
380 AC_DEFINE(HAVE_FREXPL)
381 AC_DEFINE(HAVE_LDEXPL)
382 AC_DEFINE(HAVE_LOG10L)
384 AC_DEFINE(HAVE_MODFL)
386 AC_DEFINE(HAVE_SINCOSL)
388 AC_DEFINE(HAVE_SINHL)
389 AC_DEFINE(HAVE_SQRTL)
391 AC_DEFINE(HAVE_TANHL)
396 # We are being configured natively. We can do more elaborate tests
397 # that include AC_TRY_COMPILE now, as the linker is assumed to be
399 GLIBCPP_IS_CROSS_COMPILING=0
402 # Check for available headers.
403 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
404 machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h sys/types.h])
406 GLIBCPP_CHECK_COMPILER_FEATURES
407 GLIBCPP_CHECK_LINKER_FEATURES
408 GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
409 GLIBCPP_CHECK_MATH_SUPPORT
410 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
411 GLIBCPP_CHECK_WCHAR_T_SUPPORT
412 GLIBCPP_CHECK_STDLIB_SUPPORT
413 GLIBCPP_CHECK_UNISTD_SUPPORT
418 ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
419 [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
424 # Establish limits on memory usage during 'make check'
425 GLIBCPP_CONFIGURE_TESTSUITE
428 # This depends on the possibly-skipped linker test above.
429 GLIBCPP_ENABLE_SYMVERS([yes])
431 # Propagate the target-specific source directories through the build chain.
432 # (Nothing currently uses cpu_include_dir directly; only ATOMICITYH
433 # uses it, and it only gets used in this file.)
434 OS_INC_SRCDIR=config/${os_include_dir}
435 ATOMICITY_INC_SRCDIR=config/${ATOMICITYH}
436 AC_SUBST(OS_INC_SRCDIR)
437 AC_SUBST(ATOMICITY_INC_SRCDIR)
439 # Set up cross-compile flags
440 AC_SUBST(GLIBCPP_IS_CROSS_COMPILING) dnl Unused so far.
441 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
445 if test "${multilib}" = "yes"; then
446 multilib_arg="--enable-multilib"
451 # Export all the install information
452 GLIBCPP_EXPORT_INSTALL_INFO
454 # Export all the include and flag information to makefiles.
455 GLIBCPP_EXPORT_INCLUDES
458 if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
459 grep "enable shared" > /dev/null; then
460 LIBSUPCXX_PICFLAGS=-prefer-pic
464 AC_SUBST(LIBSUPCXX_PICFLAGS)
466 # Generate the various Makefiles, include files, and scripts.
467 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
468 # and libsupc++/Makefile.am so that multilib installs will end up
469 # installed in the correct place. To work around this not being passed
470 # down from config-ml.in -> top_srcdir/Makefile.am ->
471 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
473 include/Makefile src/Makefile \
474 libmath/Makefile libio/Makefile libsupc++/Makefile \
475 po/Makefile testsuite/Makefile mkcheck testsuite_flags,
476 [if test -n "$CONFIG_FILES"; then
477 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
478 ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
479 grep '^MULTISUBDIR =' Makefile >> src/Makefile
480 grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
483 chmod +x testsuite_flags
488 with_multisubdir=${with_multisubdir}
489 ac_configure_args="${multilib_arg} ${ac_configure_args}"
490 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
491 glibcpp_basedir=${glibcpp_basedir}
495 dnl In autoconf 2.5x, AC_OUTPUT is replaced by three AC_ macros:
496 dnl AC_CONFIG_FILES(Makefile \
497 dnl include/Makefile src/Makefile \
498 dnl libmath/Makefile libio/Makefile libsupc++/Makefile \
499 dnl po/Makefile testsuite/Makefile mkcheck testsuite_flags)
500 dnl AC_CONFIG_COMMANDS([default],
501 dnl [if test -n "$CONFIG_FILES"; then
502 dnl ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
503 dnl grep '^MULTISUBDIR =' Makefile >> src/Makefile
504 dnl grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
507 dnl chmod +x testsuite_flags
512 dnl with_multisubdir=${with_multisubdir}
513 dnl ac_configure_args="${multilib_arg} ${ac_configure_args}"
514 dnl CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
515 dnl glibcpp_basedir=${glibcpp_basedir}
522 # Sanity checking & User-visible messages.
523 # Checks down here, otherwise they get scrolled off before
524 # the user will notice.
526 # Trying to get more people to read documentation. Possibly remove
527 # check and warn all the time. There is no "informational" AC_MSG_
528 # macro, so these are going to be printed even when --quiet/--silent
530 if test ! -f stamp-sanity-warned; then
531 touch stamp-sanity-warned
533 echo "Please make certain that you read the installation information here:"
534 echo " faster => ${srcdir}/docs/html/install.html"
535 echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
537 echo "and the configuration information here:"
538 echo " faster => ${srcdir}/docs/html/configopts.html"
539 echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
541 echo "before proceeding with ${_cv_gnu_make_command}."