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 if test -n "$with_cross_host" || test x"$build" != x"$host"; then
75 # We are being configured with some form of cross compiler.
76 GLIBCPP_IS_CROSS_COMPILING=1
78 # This lets us hard-code the functionality we know we'll have in the cross
79 # target environment. "Let" is a sugar-coated word placed on an especially
80 # dull and tedious hack, actually.
82 # Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros
83 # that involve linking, can't be used:
84 # "cannot open sim-crt0.o"
85 # "cannot open crt0.o"
86 # etc. All this is because there currently exists no unified, consistent
87 # way for top level CC information to be passed down to target directories:
88 # newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc.
89 # When all of that is done, all of this hokey, excessive AC_DEFINE junk for
90 # crosses can be removed.
92 # If Canadian cross, then don't pick up tools from the build directory.
93 # Used in GLIBCPP_EXPORT_INCLUDES (and nowhere else?).
94 if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then
100 # Construct crosses by hand, eliminating bits that need ld...
101 # GLIBCPP_CHECK_COMPILER_FEATURES
102 # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
103 # GLIBCPP_CHECK_MATH_SUPPORT
105 case "$target_alias" in
107 os_include_dir="os/gnu-linux"
108 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
109 machine/endian.h machine/param.h sys/machine.h sys/types.h \
110 fp.h locale.h float.h inttypes.h])
111 SECTION_FLAGS='-ffunction-sections -fdata-sections'
112 AC_SUBST(SECTION_FLAGS)
113 GLIBCPP_CHECK_LINKER_FEATURES
114 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
115 GLIBCPP_CHECK_WCHAR_T_SUPPORT
116 AC_DEFINE(HAVE_COPYSIGN)
117 AC_DEFINE(HAVE_COPYSIGNF)
118 AC_DEFINE(HAVE_FINITE)
119 AC_DEFINE(HAVE_FINITEF)
120 AC_DEFINE(HAVE_FREXPF)
121 AC_DEFINE(HAVE_HYPOTF)
122 AC_DEFINE(HAVE_ISINF)
123 AC_DEFINE(HAVE_ISINFF)
124 AC_DEFINE(HAVE_ISNAN)
125 AC_DEFINE(HAVE_ISNANF)
126 AC_DEFINE(HAVE_SINCOS)
127 AC_DEFINE(HAVE_SINCOSF)
128 if test x"long_double_math_on_this_cpu" = x"yes"; then
129 AC_DEFINE(HAVE_FINITEL)
130 AC_DEFINE(HAVE_HYPOTL)
131 AC_DEFINE(HAVE_ISINFL)
132 AC_DEFINE(HAVE_ISNANL)
136 # Check for available headers.
137 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
138 machine/endian.h machine/param.h sys/machine.h sys/types.h \
139 fp.h locale.h float.h inttypes.h])
140 SECTION_FLAGS='-ffunction-sections -fdata-sections'
141 AC_SUBST(SECTION_FLAGS)
142 GLIBCPP_CHECK_LINKER_FEATURES
143 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
144 GLIBCPP_CHECK_WCHAR_T_SUPPORT
145 os_include_dir="os/hpux"
146 AC_DEFINE(HAVE_COPYSIGN)
147 AC_DEFINE(HAVE_COPYSIGNF)
148 AC_DEFINE(HAVE_FREXPF)
149 AC_DEFINE(HAVE_HYPOT)
150 case "$target_alias" in
152 AC_DEFINE(HAVE_FINITE)
153 AC_DEFINE(HAVE_FINITEF)
154 AC_DEFINE(HAVE_ISINF)
155 AC_DEFINE(HAVE_ISINFF)
156 AC_DEFINE(HAVE_ISNAN)
157 AC_DEFINE(HAVE_ISNANF)
163 # Check for available headers.
164 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
165 machine/endian.h machine/param.h sys/machine.h sys/types.h \
166 fp.h locale.h float.h inttypes.h])
167 SECTION_FLAGS='-ffunction-sections -fdata-sections'
168 AC_SUBST(SECTION_FLAGS)
169 GLIBCPP_CHECK_LINKER_FEATURES
170 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
171 GLIBCPP_CHECK_WCHAR_T_SUPPORT
172 os_include_dir="os/bsd/netbsd"
173 AC_DEFINE(HAVE_COPYSIGN)
174 AC_DEFINE(HAVE_COPYSIGNF)
175 AC_DEFINE(HAVE_FINITEF)
176 AC_DEFINE(HAVE_FINITE)
177 AC_DEFINE(HAVE_FREXPF)
178 AC_DEFINE(HAVE_HYPOTF)
179 AC_DEFINE(HAVE_ISINF)
180 AC_DEFINE(HAVE_ISINFF)
181 AC_DEFINE(HAVE_ISNAN)
182 AC_DEFINE(HAVE_ISNANF)
183 if test x"long_double_math_on_this_cpu" = x"yes"; then
184 AC_DEFINE(HAVE_FINITEL)
185 AC_DEFINE(HAVE_ISINFL)
186 AC_DEFINE(HAVE_ISNANL)
190 AC_CHECK_HEADERS([sys/types.h locale.h float.h])
191 GLIBCPP_CHECK_LINKER_FEATURES
192 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
193 GLIBCPP_CHECK_WCHAR_T_SUPPORT
194 os_include_dir="os/mingw32"
197 os_include_dir="os/windiss"
202 SECTION_FLAGS='-ffunction-sections -fdata-sections'
203 AC_SUBST(SECTION_FLAGS)
204 GLIBCPP_CHECK_LINKER_FEATURES
205 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
206 GLIBCPP_CHECK_WCHAR_T_SUPPORT
207 os_include_dir="os/qnx/qnx6.1"
210 AC_DEFINE(HAVE_COSHF)
211 AC_DEFINE(HAVE_COSHL)
214 AC_DEFINE(HAVE_LOG10F)
215 AC_DEFINE(HAVE_LOG10L)
218 AC_DEFINE(HAVE_SINHF)
219 AC_DEFINE(HAVE_SINHL)
222 os_include_dir="os/newlib"
223 AC_DEFINE(HAVE_HYPOT)
227 case "$target_alias" in
231 AC_DEFINE(HAVE_ACOSF)
232 AC_DEFINE(HAVE_ASINF)
233 AC_DEFINE(HAVE_ATAN2F)
234 AC_DEFINE(HAVE_ATANF)
235 AC_DEFINE(HAVE_CEILF)
236 AC_DEFINE(HAVE_COPYSIGN)
237 AC_DEFINE(HAVE_COPYSIGNF)
239 AC_DEFINE(HAVE_COSHF)
241 AC_DEFINE(HAVE_FABSF)
242 AC_DEFINE(HAVE_FLOORF)
243 AC_DEFINE(HAVE_FMODF)
244 AC_DEFINE(HAVE_FREXPF)
245 AC_DEFINE(HAVE_LDEXPF)
246 AC_DEFINE(HAVE_LOG10F)
248 AC_DEFINE(HAVE_MODFF)
251 AC_DEFINE(HAVE_SINHF)
252 AC_DEFINE(HAVE_SQRTF)
254 AC_DEFINE(HAVE_TANHF)
257 # GLIBCPP_CHECK_STDLIB_SUPPORT
258 AC_DEFINE(HAVE_STRTOF)
259 AC_DEFINE(HAVE_STRTOLD)
263 AC_DEFINE(HAVE_ACOSF)
264 AC_DEFINE(HAVE_ASINF)
265 AC_DEFINE(HAVE_ATAN2F)
266 AC_DEFINE(HAVE_ATANF)
267 AC_DEFINE(HAVE_CEILF)
268 AC_DEFINE(HAVE_COPYSIGN)
269 AC_DEFINE(HAVE_COPYSIGNF)
271 AC_DEFINE(HAVE_COSHF)
273 AC_DEFINE(HAVE_FABSF)
274 AC_DEFINE(HAVE_FLOORF)
275 AC_DEFINE(HAVE_FMODF)
276 AC_DEFINE(HAVE_FREXPF)
277 AC_DEFINE(HAVE_LDEXPF)
278 AC_DEFINE(HAVE_LOG10F)
280 AC_DEFINE(HAVE_MODFF)
283 AC_DEFINE(HAVE_SINHF)
284 AC_DEFINE(HAVE_SQRTF)
286 AC_DEFINE(HAVE_TANHF)
290 # At some point, we should differentiate between architectures
291 # like x86, which have long double versions, and alpha/powerpc/etc.,
292 # which don't. For the time being, punt.
293 if test x"long_double_math_on_this_cpu" = x"yes"; then
294 AC_DEFINE(HAVE_ACOSL)
295 AC_DEFINE(HAVE_ASINL)
296 AC_DEFINE(HAVE_ATAN2L)
297 AC_DEFINE(HAVE_ATANL)
298 AC_DEFINE(HAVE_CEILL)
299 AC_DEFINE(HAVE_COPYSIGNL)
301 AC_DEFINE(HAVE_COSHL)
303 AC_DEFINE(HAVE_FABSL)
304 AC_DEFINE(HAVE_FLOORL)
305 AC_DEFINE(HAVE_FMODL)
306 AC_DEFINE(HAVE_FREXPL)
307 AC_DEFINE(HAVE_LDEXPL)
308 AC_DEFINE(HAVE_LOG10L)
310 AC_DEFINE(HAVE_MODFL)
312 AC_DEFINE(HAVE_SINCOSL)
314 AC_DEFINE(HAVE_SINHL)
315 AC_DEFINE(HAVE_SQRTL)
317 AC_DEFINE(HAVE_TANHL)
322 # We are being configured natively. We can do more elaborate tests
323 # that include AC_TRY_COMPILE now, as the linker is assumed to be
325 GLIBCPP_IS_CROSS_COMPILING=0
328 # Check for available headers.
329 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
330 machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h sys/types.h])
332 GLIBCPP_CHECK_COMPILER_FEATURES
333 GLIBCPP_CHECK_LINKER_FEATURES
334 GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
335 GLIBCPP_CHECK_MATH_SUPPORT
336 GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
337 GLIBCPP_CHECK_WCHAR_T_SUPPORT
338 GLIBCPP_CHECK_STDLIB_SUPPORT
343 ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
344 [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
349 # Establish limits on memory usage during 'make check'
350 GLIBCPP_CONFIGURE_TESTSUITE
353 # This depends on the possibly-skipped linker test above.
354 GLIBCPP_ENABLE_SYMVERS([yes])
356 # Propagate the target-specific source directories through the build chain.
357 # (Nothing currently uses cpu_include_dir directly; only ATOMICITYH and
358 # CPULIMITSH [might] use it, and they only get used here.)
359 OS_INC_SRCDIR=config/${os_include_dir}
360 ATOMICITY_INC_SRCDIR=config/${ATOMICITYH}
361 CPU_LIMITS_INC_SRCDIR=config/${CPULIMITSH}
362 AC_SUBST(OS_INC_SRCDIR)
363 AC_SUBST(ATOMICITY_INC_SRCDIR)
364 AC_SUBST(CPU_LIMITS_INC_SRCDIR)
366 # Set up cross-compile flags
367 AC_SUBST(GLIBCPP_IS_CROSS_COMPILING) dnl Unused so far.
368 AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
372 if test "${multilib}" = "yes"; then
373 multilib_arg="--enable-multilib"
378 # Export all the install information
379 GLIBCPP_EXPORT_INSTALL_INFO
381 # Export all the include and flag information to makefiles.
382 GLIBCPP_EXPORT_INCLUDES
385 if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
386 grep "enable shared" > /dev/null; then
387 LIBSUPCXX_PICFLAGS=-prefer-pic
391 AC_SUBST(LIBSUPCXX_PICFLAGS)
393 # Generate the various Makefiles, include files, and scripts.
394 # NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
395 # and libsupc++/Makefile.am so that multilib installs will end up
396 # installed in the correct place. To work around this not being passed
397 # down from config-ml.in -> top_srcdir/Makefile.am ->
398 # top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
400 include/Makefile src/Makefile \
401 libmath/Makefile libio/Makefile libsupc++/Makefile \
402 po/Makefile testsuite/Makefile mkcheck testsuite_flags,
403 [if test -n "$CONFIG_FILES"; then
404 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
405 ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
406 grep '^MULTISUBDIR =' Makefile >> src/Makefile
407 grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
410 chmod +x testsuite_flags
415 with_multisubdir=${with_multisubdir}
416 ac_configure_args="${multilib_arg} ${ac_configure_args}"
417 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
418 glibcpp_basedir=${glibcpp_basedir}
422 dnl In autoconf 2.5x, AC_OUTPUT is replaced by three AC_ macros:
423 dnl AC_CONFIG_FILES(Makefile \
424 dnl include/Makefile src/Makefile \
425 dnl libmath/Makefile libio/Makefile libsupc++/Makefile \
426 dnl po/Makefile testsuite/Makefile mkcheck testsuite_flags)
427 dnl AC_CONFIG_COMMANDS([default],
428 dnl [if test -n "$CONFIG_FILES"; then
429 dnl ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
430 dnl grep '^MULTISUBDIR =' Makefile >> src/Makefile
431 dnl grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
434 dnl chmod +x testsuite_flags
439 dnl with_multisubdir=${with_multisubdir}
440 dnl ac_configure_args="${multilib_arg} ${ac_configure_args}"
441 dnl CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
442 dnl glibcpp_basedir=${glibcpp_basedir}
449 # Sanity checking & User-visible messages.
450 # Checks down here, otherwise they get scrolled off before
451 # the user will notice.
453 # Trying to get more people to read documentation. Possibly remove
454 # check and warn all the time. There is no "informational" AC_MSG_
455 # macro, so these are going to be printed even when --quiet/--silent
457 if test ! -f stamp-sanity-warned; then
458 touch stamp-sanity-warned
460 echo "Please make certain that you read the installation information here:"
461 echo " faster => ${srcdir}/docs/html/install.html"
462 echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
464 echo "and the configuration information here:"
465 echo " faster => ${srcdir}/docs/html/configopts.html"
466 echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
468 echo "before proceeding with ${_cv_gnu_make_command}."