]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/configure.ac
c++: initializer_list<string> and EH [PR114935]
[thirdparty/gcc.git] / libstdc++-v3 / configure.ac
CommitLineData
3a24bf5d 1# Process this file with autoreconf to produce a configure script.
b2dad0e3 2
fbe057bb 3AC_INIT(package-unused, version-unused,, libstdc++)
8bae34da 4AC_CONFIG_SRCDIR(src/shared/hashtable-aux.cc)
ff66d28f 5AC_CONFIG_HEADER(config.h)
e2c20fae 6
6706f116
AO
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
2c839a4e 10# exported. Only used at the end of this file.
ff66d28f 11### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
6706f116 12
ff66d28f 13# Find the rest of the source tree framework.
076e5443 14AM_ENABLE_MULTILIB(, ..)
aebb8c22 15
58b08ac3 16# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
2c839a4e
PE
17#
18# You will slowly go insane if you do not grok the following fact: when
19# building v3 as part of the compiler, the top-level /target/ becomes the
ff66d28f 20# library's /host/. configure then causes --target to default to --host,
2c839a4e
PE
21# exactly like any other package using autoconf. Therefore, 'target' and
22# 'host' will always be the same. This makes sense both for native and
23# cross compilers, just think about it for a little while. :-)
24#
25# Also, if v3 is being configured as part of a cross compiler, the top-level
26# configure script will pass the "real" host as $with_cross_host.
27#
ff66d28f
PE
28# Do not delete or change the following two lines. For why, see
29# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
b2dad0e3 30AC_CANONICAL_SYSTEM
ff66d28f
PE
31target_alias=${target_alias-$host_alias}
32
33# Handy for debugging:
34#AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5
35
0df3f383
PE
36if test "$build" != "$host"; then
37 # We are being configured with some form of cross compiler.
38 GLIBCXX_IS_NATIVE=false
0646b059
GK
39 case "$host","$target" in
40 # Darwin crosses can use the host system's libraries and headers,
41 # because of the fat library support. Of course, it must be the
42 # same version of Darwin on both sides. Allow the user to
43 # just say --target=foo-darwin without a version number to mean
44 # "the version on this system".
45 *-*-darwin*,*-*-darwin*)
46 hostos=`echo $host | sed 's/.*-darwin/darwin/'`
47 targetos=`echo $target | sed 's/.*-darwin/darwin/'`
0ed5259c 48 if test $hostos = $targetos || test $targetos = darwin ; then
0646b059
GK
49 GLIBCXX_IS_NATIVE=true
50 fi
51 ;;
52
53 *)
54 GCC_NO_EXECUTABLES
55 ;;
56 esac
0df3f383
PE
57else
58 GLIBCXX_IS_NATIVE=true
59fi
60
bcb1f438
AA
61# In the case that we're building without headers, we won't have <stdio.h>
62# available. In these cases, we have to instruct autotools to never include
63# <stdio.h> as a part of default headers.
64m4_version_prereq([2.70], [], [
65if test "x$with_headers" = "xno"; then
66 ac_includes_default=`echo "$ac_includes_default" | sed '/^#include <stdio.h>$/d'`
67fi
68])
69
ff66d28f
PE
70# Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
71# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
72# 1.x: minimum required version
73# no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
74# of other PACKAGE_* variables will, however, and there's nothing
fbe057bb 75# we can do about that; they come from AC_INIT).
ff66d28f
PE
76# foreign: we don't follow the normal rules for GNU packages (no COPYING
77# file in the top srcdir, etc, etc), so stop complaining.
78# no-dependencies: turns off auto dependency generation (just for now)
13917ae3 79# no-dist: we don't want 'dist' and related rules.
2d52e9e3
PE
80# -Wall: turns on all automake warnings...
81# -Wno-portability: ...except this one, since GNU make is now required.
13917ae3 82AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dependencies no-dist -Wall -Wno-portability -Wno-override])
3a24bf5d
KC
83AH_TEMPLATE(PACKAGE, [Name of package])
84AH_TEMPLATE(VERSION, [Version number of package])
ff66d28f 85
ae66da3b
RW
86# -fno-builtin must be present here so that a non-conflicting form of
87# std::exit can be guessed by AC_PROG_CXX, and used in later tests.
88
ae66da3b
RW
89save_CXXFLAGS="$CXXFLAGS"
90CXXFLAGS="$CXXFLAGS -fno-builtin"
91AC_PROG_CC
92AC_PROG_CXX
93CXXFLAGS="$save_CXXFLAGS"
ae66da3b 94
2fc11587
JW
95AC_SYS_LARGEFILE
96
ae66da3b 97# Runs configure.host, and assorted other critical bits. Sets
ff66d28f
PE
98# up critical shell variables.
99GLIBCXX_CONFIGURE
100
ac6d1200 101# Libtool setup.
68c2e9e9
JW
102if test "x${with_newlib}" != "xyes" &&
103 test "x${with_avrlibc}" != "xyes" &&
104 test "x$with_headers" != "xno"; then
be95b355
BS
105 AC_LIBTOOL_DLOPEN
106fi
5780a46b 107AM_PROG_LIBTOOL
7de6ba7a 108ACX_LT_HOST_FLAGS
34791641
PE
109AC_SUBST(enable_shared)
110AC_SUBST(enable_static)
6a6d3817 111AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
1609fdff
IS
112os_is_darwin=no
113case ${host_os} in
114 darwin*) os_is_darwin=yes ;;
115 *) ;;
116esac
117AM_CONDITIONAL([OS_IS_DARWIN], [test x${os_is_darwin} = xyes])
04e78786 118
2077db1b
CT
119if test "$enable_vtable_verify" = yes; then
120 predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
121 postdep_objects_CXX="${postdep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_end.o"
122fi
123
124
ac6d1200
BK
125# libtool variables for C++ shared and position-independent compiles.
126#
127# Use glibcxx_lt_pic_flag to designate the automake variable
128# used to encapsulate the default libtool approach to creating objects
129# with position-independent code. Default: -prefer-pic.
130#
131# Use glibcxx_compiler_shared_flag to designate a compile-time flags for
132# creating shared objects. Default: -D_GLIBCXX_SHARED.
133#
134# Use glibcxx_compiler_pic_flag to designate a compile-time flags for
135# creating position-independent objects. This varies with the target
136# hardware and operating system, but is often: -DPIC -fPIC.
137if test "$enable_shared" = yes; then
138 glibcxx_lt_pic_flag="-prefer-pic"
139 glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX"
140 glibcxx_compiler_shared_flag="-D_GLIBCXX_SHARED"
141
142else
143 glibcxx_lt_pic_flag=
144 glibcxx_compiler_pic_flag=
145 glibcxx_compiler_shared_flag=
146fi
147AC_SUBST(glibcxx_lt_pic_flag)
148AC_SUBST(glibcxx_compiler_pic_flag)
149AC_SUBST(glibcxx_compiler_shared_flag)
150
151# Override the libtool's pic_flag and pic_mode.
152# Do this step after AM_PROG_LIBTOOL, but before AC_OUTPUT.
153# NB: this impacts --with-pic and --without-pic.
154lt_prog_compiler_pic_CXX="$glibcxx_compiler_pic_flag $glibcxx_compiler_shared_flag"
155pic_mode='default'
156
a6918ffd
RW
157# Eliminate -lstdc++ addition to postdeps for cross compiles.
158postdeps_CXX=`echo " $postdeps_CXX " | sed 's, -lstdc++ ,,g'`
159
92eabea2 160# Possibly disable most of the library.
347669a0 161## TODO: Consider skipping unncessary tests altogether in this case, rather
92eabea2
PE
162## than just ignoring the results. Faster /and/ more correct, win win.
163GLIBCXX_ENABLE_HOSTED
164
5a86d36f
SH
165# Enable descriptive messages to standard output on termination.
166GLIBCXX_ENABLE_VERBOSE
167
0646d8a3 168# Enable compiler support that doesn't require linking.
92eabea2 169GLIBCXX_ENABLE_PCH($is_hosted)
e55d0e35 170GLIBCXX_ENABLE_THREADS
f958e3ca 171GLIBCXX_ENABLE_ATOMIC_BUILTINS
da29d2a3 172GLIBCXX_ENABLE_LOCK_POLICY
4cdc8761 173GLIBCXX_ENABLE_DECIMAL_FLOAT
ad0a3be4 174GLIBCXX_ENABLE_FLOAT128
bb59f396
MG
175if test "$enable_float128" = yes; then
176 port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/abi/pre/float128.ver"
177fi
e55d0e35 178
b8c41c8e 179# Checks for compiler support that doesn't require linking.
e55d0e35 180GLIBCXX_CHECK_COMPILER_FEATURES
b2dad0e3 181
1894e4c5 182# Enable all the variable C++ runtime options that don't require linking.
3d7c150e
BK
183GLIBCXX_ENABLE_CSTDIO
184GLIBCXX_ENABLE_CLOCALE
8b0d6051 185GLIBCXX_ENABLE_ALLOCATOR
ff66d28f 186GLIBCXX_ENABLE_CHEADERS($c_model) dnl c_model from configure.host
3d7c150e 187GLIBCXX_ENABLE_LONG_LONG([yes])
347669a0 188GLIBCXX_ENABLE_WCHAR_T([yes])
8a9b2875 189GLIBCXX_ENABLE_C99([yes])
ff66d28f 190GLIBCXX_ENABLE_CONCEPT_CHECKS([no])
fe3e9780 191GLIBCXX_ENABLE_DEBUG_FLAGS(["-g3 -O0 -D_GLIBCXX_ASSERTIONS"])
3d7c150e 192GLIBCXX_ENABLE_DEBUG([no])
6995087d 193GLIBCXX_ENABLE_PARALLEL([yes])
ff66d28f 194GLIBCXX_ENABLE_CXX_FLAGS
1165dc50 195GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
ed4f96af 196GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes])
2a5d011c 197GLIBCXX_ENABLE_PYTHON
c3be340e 198GLIBCXX_ENABLE_WERROR([no])
2077db1b 199GLIBCXX_ENABLE_VTABLE_VERIFY([no])
b2dad0e3 200
b8c41c8e 201# Checks for operating systems support that doesn't require linking.
1b6ce36f 202GLIBCXX_CHECK_STDIO_PROTO
ef3a7506 203GLIBCXX_CHECK_MATH11_PROTO
20b5f0b3 204GLIBCXX_CHECK_UCHAR_H
974e336b 205
74745ec5
PC
206# For LFS support.
207GLIBCXX_CHECK_LFS
208
209# For showmanyc_helper().
210AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
211GLIBCXX_CHECK_POLL
212GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
213
214# For xsputn_2().
215AC_CHECK_HEADERS(sys/uio.h)
216GLIBCXX_CHECK_WRITEV
217
5e5f34bf
SE
218# Check for fenv.h and complex.h before GLIBCXX_CHECK_C99_TR1
219# so that the check is done with the C compiler (not C++).
220# Checking with C++ can break a canadian cross build if either
221# file does not exist in C but does in C++.
222AC_CHECK_HEADERS(fenv.h complex.h)
223
0f24e8de
PC
224# For C99 support to TR1.
225GLIBCXX_CHECK_C99_TR1
226
ddc9c40d
PC
227# For the EOF, SEEK_CUR, and SEEK_END integer constants.
228GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS
974e336b 229
610870b2
PC
230# For gettimeofday support.
231GLIBCXX_CHECK_GETTIMEOFDAY
232
959d14e1 233# For clock_gettime, nanosleep and sched_yield support.
88b1a025 234GLIBCXX_ENABLE_LIBSTDCXX_TIME
610870b2 235
7370b9df
BRF
236# Check for tmpnam which is obsolescent in POSIX.1-2008
237GLIBCXX_CHECK_TMPNAM
238
ad4d1d21
MC
239# For pthread_cond_clockwait
240GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT
241
3b2fb543
MC
242# For pthread_mutex_clocklock
243GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK
244
ab40695a
MC
245# For pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock
246GLIBCXX_CHECK_PTHREAD_RWLOCK_CLOCKLOCK
247
99bf8d16
PC
248AC_LC_MESSAGES
249
43653c33
JW
250# For hardware_concurrency
251AC_CHECK_HEADERS(sys/sysinfo.h)
252GLIBCXX_CHECK_GET_NPROCS
253AC_CHECK_HEADERS(unistd.h)
254GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
5ee360d0
JW
255GLIBCXX_CHECK_SC_NPROC_ONLN
256GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
257GLIBCXX_CHECK_SYSCTL_HW_NCPU
d74e340d 258GLIBCXX_CHECK_SDT_H
43653c33 259
74745ec5 260# Check for available headers.
a1360f57
SR
261AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
262locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
74745ec5 263strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \
d74e340d 264sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
dac867c9
UB
265wchar.h wctype.h linux/types.h])
266
267AC_CHECK_HEADERS([linux/random.h], [], [],
268[[#ifdef HAVE_LINUX_TYPES_H
269# include <linux/types.h>
270#endif
271]])
74745ec5 272
932fbc86
JW
273AC_CHECK_HEADERS([xlocale.h])
274
6995087d 275# Only do link tests if native. Else, hardcode.
000f8b9a 276if $GLIBCXX_IS_NATIVE; then
b2dad0e3 277
0df3f383
PE
278 # We can do more elaborate tests that assume a working linker.
279 CANADIAN=no
280
0df3f383
PE
281 GLIBCXX_CHECK_LINKER_FEATURES
282 GLIBCXX_CHECK_MATH_SUPPORT
0df3f383
PE
283 GLIBCXX_CHECK_STDLIB_SUPPORT
284
5ae2c32a
JW
285 # For /dev/random and /dev/urandom for std::random_device.
286 GLIBCXX_CHECK_DEV_RANDOM
d8bc9819 287
cddfb1c7
BK
288 # For TLS support.
289 GCC_CHECK_TLS
290
2a792efe 291 AC_CHECK_FUNCS(__cxa_thread_atexit_impl __cxa_thread_atexit)
af63ba4b 292 AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
b0292359 293 AC_CHECK_FUNCS(_wfopen)
3dbd4d94 294 AC_CHECK_FUNCS(secure_getenv)
bed152e3 295
a61ae535
JW
296 # C11 functions for C++17 library
297 AC_CHECK_FUNCS(timespec_get)
298
187fdaea
JW
299 # For Networking TS.
300 AC_CHECK_FUNCS(sockatmark)
301
932fbc86
JW
302 # Non-standard functions used by C++17 std::from_chars
303 AC_CHECK_FUNCS(uselocale)
304
5f34ed87
BK
305 # For iconv support.
306 AM_ICONV
307
000f8b9a 308else
eebc608e 309
2c839a4e
PE
310 # This lets us hard-code the functionality we know we'll have in the cross
311 # target environment. "Let" is a sugar-coated word placed on an especially
312 # dull and tedious hack, actually.
313 #
3d7c150e 314 # Here's why GLIBCXX_CHECK_MATH_SUPPORT, and other autoconf macros
2c839a4e
PE
315 # that involve linking, can't be used:
316 # "cannot open sim-crt0.o"
317 # "cannot open crt0.o"
318 # etc. All this is because there currently exists no unified, consistent
319 # way for top level CC information to be passed down to target directories:
320 # newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc.
321 # When all of that is done, all of this hokey, excessive AC_DEFINE junk for
322 # crosses can be removed.
323
324 # If Canadian cross, then don't pick up tools from the build directory.
0df3f383 325 # Used only in GLIBCXX_EXPORT_INCLUDES.
ff66d28f 326 if test -n "$with_cross_host" &&
f5cf58dd 327 test x"$build_alias" != x"$with_cross_host" &&
ff66d28f
PE
328 test x"$build" != x"$target";
329 then
b2dad0e3 330 CANADIAN=yes
b2dad0e3
BK
331 else
332 CANADIAN=no
b2dad0e3
BK
333 fi
334
75940b88 335 # Construct crosses by hand, eliminating bits that need ld...
3d7c150e 336 # GLIBCXX_CHECK_MATH_SUPPORT
75940b88 337
ff66d28f
PE
338 # First, test for "known" system libraries. We may be using newlib even
339 # on a hosted environment.
000f8b9a 340 if test "x${with_newlib}" = "xyes"; then
ff66d28f
PE
341 os_include_dir="os/newlib"
342 AC_DEFINE(HAVE_HYPOT)
343
344 # GLIBCXX_CHECK_STDLIB_SUPPORT
b25e6b79 345 AC_DEFINE(HAVE_STRTOF)
ff66d28f
PE
346
347 AC_DEFINE(HAVE_ACOSF)
348 AC_DEFINE(HAVE_ASINF)
349 AC_DEFINE(HAVE_ATAN2F)
350 AC_DEFINE(HAVE_ATANF)
351 AC_DEFINE(HAVE_CEILF)
ff66d28f
PE
352 AC_DEFINE(HAVE_COSF)
353 AC_DEFINE(HAVE_COSHF)
354 AC_DEFINE(HAVE_EXPF)
355 AC_DEFINE(HAVE_FABSF)
356 AC_DEFINE(HAVE_FLOORF)
357 AC_DEFINE(HAVE_FMODF)
358 AC_DEFINE(HAVE_FREXPF)
c6c42819 359 AC_DEFINE(HAVE_HYPOTF)
ff66d28f
PE
360 AC_DEFINE(HAVE_LDEXPF)
361 AC_DEFINE(HAVE_LOG10F)
362 AC_DEFINE(HAVE_LOGF)
363 AC_DEFINE(HAVE_MODFF)
364 AC_DEFINE(HAVE_POWF)
365 AC_DEFINE(HAVE_SINF)
366 AC_DEFINE(HAVE_SINHF)
367 AC_DEFINE(HAVE_SQRTF)
368 AC_DEFINE(HAVE_TANF)
369 AC_DEFINE(HAVE_TANHF)
517da0ce 370
c6c42819
JB
371dnl # Support for the long version of some math libraries depends on
372dnl # architecture and newlib version. So test for their availability
373dnl # rather than hardcoding that information.
374 GLIBCXX_CHECK_MATH_DECLS([
375 acosl asinl atan2l atanl ceill coshl cosl expl fabsl floorl fmodl
376 frexpl hypotl ldexpl log10l logl modfl powl sinhl sinl sqrtl
377 tanhl tanl])
378
5f34ed87 379 AC_DEFINE(HAVE_ICONV)
7be8d663 380 AC_DEFINE(HAVE_MEMALIGN)
e0466d32
SH
381
382 case "${target}" in
383 *-rtems*)
384 case "${target}" in
385 bfin* | lm32* | mips* | moxie* | or1k* | v850*)
386 ;;
387 *)
388 AC_DEFINE(HAVE_TLS)
389 ;;
390 esac
391 AC_DEFINE(HAVE_ALIGNED_ALLOC)
392 AC_DEFINE(HAVE_AT_QUICK_EXIT)
393 AC_DEFINE(HAVE_LINK)
e0466d32
SH
394 AC_DEFINE(HAVE_QUICK_EXIT)
395 AC_DEFINE(HAVE_READLINK)
396 AC_DEFINE(HAVE_SETENV)
397 AC_DEFINE(HAVE_SLEEP)
398 AC_DEFINE(HAVE_SOCKATMARK)
399 AC_DEFINE(HAVE_STRERROR_L)
400 AC_DEFINE(HAVE_SYMLINK)
401 AC_DEFINE(HAVE_TRUNCATE)
402 AC_DEFINE(HAVE_USLEEP)
403 ;;
404 esac
000f8b9a 405 elif test "x$with_headers" != "xno"; then
c41f82b2 406 GLIBCXX_CROSSCONFIG
000f8b9a 407 fi
75940b88
SE
408
409 # At some point, we should differentiate between architectures
410 # like x86, which have long double versions, and alpha/powerpc/etc.,
411 # which don't. For the time being, punt.
000f8b9a 412 if test x"long_double_math_on_this_cpu" = x"yes"; then
75940b88
SE
413 AC_DEFINE(HAVE_ACOSL)
414 AC_DEFINE(HAVE_ASINL)
415 AC_DEFINE(HAVE_ATAN2L)
416 AC_DEFINE(HAVE_ATANL)
417 AC_DEFINE(HAVE_CEILL)
75940b88
SE
418 AC_DEFINE(HAVE_COSL)
419 AC_DEFINE(HAVE_COSHL)
420 AC_DEFINE(HAVE_EXPL)
421 AC_DEFINE(HAVE_FABSL)
75940b88
SE
422 AC_DEFINE(HAVE_FLOORL)
423 AC_DEFINE(HAVE_FMODL)
424 AC_DEFINE(HAVE_FREXPL)
75940b88
SE
425 AC_DEFINE(HAVE_LDEXPL)
426 AC_DEFINE(HAVE_LOG10L)
427 AC_DEFINE(HAVE_LOGL)
428 AC_DEFINE(HAVE_MODFL)
429 AC_DEFINE(HAVE_POWL)
430 AC_DEFINE(HAVE_SINCOSL)
431 AC_DEFINE(HAVE_SINL)
432 AC_DEFINE(HAVE_SINHL)
433 AC_DEFINE(HAVE_SQRTL)
434 AC_DEFINE(HAVE_TANL)
435 AC_DEFINE(HAVE_TANHL)
000f8b9a
JW
436 fi
437fi
b2dad0e3 438
bc3f0248
SE
439# Check for _Unwind_GetIPInfo.
440GCC_CHECK_UNWIND_GETIPINFO
441
0f3e711e
JJ
442GCC_LINUX_FUTEX([AC_DEFINE(HAVE_LINUX_FUTEX, 1, [Define if futex syscall is available.])])
443
3d7c150e 444GLIBCXX_ENABLE_SYMVERS([yes])
2799d972
BK
445AC_SUBST(libtool_VERSION)
446
dbe17524 447GLIBCXX_ENABLE_LIBSTDCXX_VISIBILITY([yes])
fe413112 448
34a2b755
JW
449GLIBCXX_ENABLE_LIBSTDCXX_DUAL_ABI([yes])
450GLIBCXX_DEFAULT_ABI
375f837b 451
6defecc2 452ac_ldbl_compat=no
7c1e7eed
JW
453ac_ldbl_alt128_compat=no
454ac_ldbl_ieee128_default=no
6d49b790 455LONG_DOUBLE_COMPAT_FLAGS="-mlong-double-64"
7c1e7eed
JW
456LONG_DOUBLE_128_FLAGS=
457LONG_DOUBLE_ALT128_COMPAT_FLAGS=
6defecc2 458case "$target" in
f7cc5390 459 powerpc*-*-linux* | \
6defecc2
JJ
460 sparc*-*-linux* | \
461 s390*-*-linux* | \
462 alpha*-*-linux*)
463 AC_TRY_COMPILE(, [
464#if !defined __LONG_DOUBLE_128__ || (defined(__sparc__) && defined(__arch64__))
465#error no need for long double compatibility
466#endif
467 ], [ac_ldbl_compat=yes], [ac_ldbl_compat=no])
000f8b9a 468 if test "$ac_ldbl_compat" = yes; then
6defecc2
JJ
469 AC_DEFINE([_GLIBCXX_LONG_DOUBLE_COMPAT],1,
470 [Define if compatibility should be provided for -mlong-double-64.])
471 port_specific_symbol_files="\$(top_srcdir)/config/os/gnu-linux/ldbl-extra.ver"
6d49b790
AM
472 case "$target" in
473 powerpc*-*-linux*)
7c1e7eed
JW
474 LONG_DOUBLE_COMPAT_FLAGS="$LONG_DOUBLE_COMPAT_FLAGS -mno-gnu-attribute"
475 # Check for IEEE128 support in libm:
476 AC_CHECK_LIB(m, __frexpieee128,
477 [ac_ldbl_ieee128_in_libc=yes],
478 [ac_ldbl_ieee128_in_libc=no])
479 if test $ac_ldbl_ieee128_in_libc = yes; then
480 # Determine which long double format is the compiler's default:
481 AC_TRY_COMPILE(, [
482 #ifndef __LONG_DOUBLE_IEEE128__
483 #error compiler defaults to ibm128
484 #endif
485 ], [ac_ldbl_ieee128_default=yes], [ac_ldbl_ieee128_default=no])
486 # Library objects should use default long double format.
487 if test "$ac_ldbl_ieee128_default" = yes; then
488 LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute"
489 # Except for the ones that explicitly use these flags:
490 LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ibmlongdouble -mno-gnu-attribute -Wno-psabi"
491 else
492 LONG_DOUBLE_128_FLAGS="-mno-gnu-attribute"
493 LONG_DOUBLE_ALT128_COMPAT_FLAGS="-mabi=ieeelongdouble -mno-gnu-attribute -Wno-psabi"
494 fi
495 AC_DEFINE([_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT],1,
496 [Define if compatibility should be provided for alternative 128-bit long double formats.])
497 port_specific_symbol_files="$port_specific_symbol_files \$(top_srcdir)/config/os/gnu-linux/ldbl-ieee128-extra.ver"
498 ac_ldbl_alt128_compat=yes
499 else
500 ac_ldbl_alt128_compat=no
501 fi
502 ;;
6d49b790 503 esac
000f8b9a 504 fi
6defecc2 505esac
6d49b790 506AC_SUBST(LONG_DOUBLE_COMPAT_FLAGS)
7c1e7eed
JW
507AC_SUBST(LONG_DOUBLE_128_FLAGS)
508AC_SUBST(LONG_DOUBLE_ALT128_COMPAT_FLAGS)
6defecc2 509GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_COMPAT, test $ac_ldbl_compat = yes)
7c1e7eed 510GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_ALT128_COMPAT, test $ac_ldbl_alt128_compat = yes)
6defecc2 511
9520425b 512# Check if assembler supports disabling hardware capability support.
1ec62aa9 513GCC_CHECK_ASSEMBLER_HWCAP
9520425b 514
3ca6351d
UD
515# Check if assembler supports rdrand opcode.
516GLIBCXX_CHECK_X86_RDRAND
b0c0d878
JW
517# Check if assembler supports rdseed opcode.
518GLIBCXX_CHECK_X86_RDSEED
3ca6351d 519
3439657b
JW
520# Check for other random number APIs
521GLIBCXX_CHECK_GETENTROPY
522GLIBCXX_CHECK_ARC4RANDOM
523
ff66d28f 524# This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.
3d7c150e 525GLIBCXX_CONFIGURE_TESTSUITE
c4c064e7 526
bae868fb
RO
527# For gthread support. Depends on GLIBCXX_ENABLE_SYMVERS.
528GLIBCXX_CHECK_GTHREADS
529
0ca7ba9a 530# For Filesystem TS.
bf53e6a9 531AC_CHECK_HEADERS([fcntl.h dirent.h sys/statvfs.h utime.h])
0ca7ba9a
JW
532GLIBCXX_ENABLE_FILESYSTEM_TS
533GLIBCXX_CHECK_FILESYSTEM_DEPS
534
3acb929c
JW
535GLIBCXX_ENABLE_BACKTRACE
536
82a0f2fd
JW
537# For Networking TS.
538AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/socket.h sys/uio.h poll.h netdb.h arpa/inet.h netinet/in.h netinet/tcp.h])
1cacdef0
JW
539AC_CHECK_DECL(F_GETFL,,,[#include <fcntl.h>])
540AC_CHECK_DECL(F_SETFL,,,[#include <fcntl.h>])
541if test "$ac_cv_have_decl_F_GETFL$ac_cv_have_decl_F_SETFL" = yesyes ; then
542 AC_CHECK_DECL(O_NONBLOCK,,,[#include <fcntl.h>])
cd67d138 543fi
82a0f2fd 544
a04d5fc9
TR
545# For Transactional Memory TS
546GLIBCXX_CHECK_SIZE_T_MANGLING
547
ed3cb497
PN
548# Check which release added std::exception_ptr for the target
549GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER
550
637e3668
JW
551# For libsupc++/eh_alloc.cc defaults.
552GLIBCXX_EMERGENCY_EH_ALLOC
553
9fc61d45
JW
554# For src/c++20/tzdb.cc defaults.
555GLIBCXX_ZONEINFO_DIR
556
94a311ab
JW
557# For src/c++11/shared_ptr.cc alignment.
558GLIBCXX_CHECK_ALIGNAS_CACHELINE
559
fe2651af
JW
560# For using init_priority in ios_init.cc
561GLIBCXX_CHECK_INIT_PRIORITY
562
c4baeaec
JW
563# For __basic_file::native_handle()
564GLIBCXX_CHECK_FILEBUF_NATIVE_HANDLES
565
df0a668b
JW
566# For std::text_encoding
567GLIBCXX_CHECK_TEXT_ENCODING
568
b25e6b79
BK
569# Define documentation rules conditionally.
570
571# See if makeinfo has been installed and is modern enough
572# that we can use it.
573ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
574 [GNU texinfo.* \([0-9][0-9.]*\)],
575 [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
576AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
577
578# Check for doxygen
579AC_CHECK_PROG([DOXYGEN], doxygen, yes, no)
580AC_CHECK_PROG([DOT], dot, yes, no)
581
582# Check for docbook
a4395a84 583AC_CHECK_PROG([XMLCATALOG], xmlcatalog, yes, no)
b25e6b79
BK
584AC_CHECK_PROG([XSLTPROC], xsltproc, yes, no)
585AC_CHECK_PROG([XMLLINT], xmllint, yes, no)
b329dd10 586GLIBCXX_CONFIGURE_DOCBOOK
b25e6b79
BK
587
588# Check for xml/html dependencies.
589AM_CONDITIONAL(BUILD_XML,
590 test $ac_cv_prog_DOXYGEN = "yes" &&
591 test $ac_cv_prog_DOT = "yes" &&
592 test $ac_cv_prog_XSLTPROC = "yes" &&
593 test $ac_cv_prog_XMLLINT = "yes" &&
594 test $glibcxx_stylesheets = "yes")
595
596AM_CONDITIONAL(BUILD_HTML,
597 test $ac_cv_prog_DOXYGEN = "yes" &&
598 test $ac_cv_prog_DOT = "yes" &&
599 test $ac_cv_prog_XSLTPROC = "yes" &&
600 test $ac_cv_prog_XMLLINT = "yes" &&
601 test $glibcxx_stylesheets = "yes")
602
603# Check for man dependencies.
604AM_CONDITIONAL(BUILD_MAN,
605 test $ac_cv_prog_DOXYGEN = "yes" &&
606 test $ac_cv_prog_DOT = "yes")
607
43fe49ec 608# Check for pdf dependencies.
b25e6b79
BK
609AC_CHECK_PROG([DBLATEX], dblatex, yes, no)
610AC_CHECK_PROG([PDFLATEX], pdflatex, yes, no)
611AM_CONDITIONAL(BUILD_PDF,
758d7478
JW
612 test $ac_cv_prog_DOXYGEN = "yes" &&
613 test $ac_cv_prog_DOT = "yes" &&
614 test $ac_cv_prog_XSLTPROC = "yes" &&
615 test $ac_cv_prog_XMLLINT = "yes" &&
b25e6b79
BK
616 test $ac_cv_prog_DBLATEX = "yes" &&
617 test $ac_cv_prog_PDFLATEX = "yes")
618
51f174c0
JW
619case "$build" in
620 *-*-darwin* ) glibcxx_include_dir_notparallel=yes ;;
621 * ) glibcxx_include_dir_notparallel=no ;;
622esac
623AM_CONDITIONAL(INCLUDE_DIR_NOTPARALLEL,
624 test $glibcxx_include_dir_notparallel = "yes")
b25e6b79 625
4a9d5109 626# Propagate the target-specific source directories through the build chain.
2c5d0ae8
BK
627ATOMICITY_SRCDIR=config/${atomicity_dir}
628ATOMIC_WORD_SRCDIR=config/${atomic_word_dir}
c2ba9709 629ATOMIC_FLAGS=${atomic_flags}
4b90c838 630CPU_DEFINES_SRCDIR=config/${cpu_defines_dir}
cc5112c9 631OS_INC_SRCDIR=config/${os_include_dir}
e4bf5dfc 632ERROR_CONSTANTS_SRCDIR=config/${error_constants_dir}
1568430f 633ABI_TWEAKS_SRCDIR=config/${abi_tweaks_dir}
9bf714c2 634CPU_OPT_EXT_RANDOM=config/${cpu_opt_ext_random}
48c7b524 635CPU_OPT_BITS_RANDOM=config/${cpu_opt_bits_random}
2c5d0ae8
BK
636AC_SUBST(ATOMICITY_SRCDIR)
637AC_SUBST(ATOMIC_WORD_SRCDIR)
c2ba9709 638AC_SUBST(ATOMIC_FLAGS)
4b90c838 639AC_SUBST(CPU_DEFINES_SRCDIR)
1568430f 640AC_SUBST(ABI_TWEAKS_SRCDIR)
cc5112c9 641AC_SUBST(OS_INC_SRCDIR)
e4bf5dfc 642AC_SUBST(ERROR_CONSTANTS_SRCDIR)
9bf714c2 643AC_SUBST(CPU_OPT_EXT_RANDOM)
48c7b524 644AC_SUBST(CPU_OPT_BITS_RANDOM)
cc5112c9 645
47ddb895
DE
646# Conditionalize the makefile for this target machine.
647tmake_file_=
648for f in ${tmake_file}
649do
650 if test -f ${srcdir}/config/$f
651 then
652 tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
653 fi
654done
655tmake_file="${tmake_file_}"
656AC_SUBST(tmake_file)
9268b7cb 657
36101de9
IT
658# Add CET specific flags if Intel CET is enabled.
659GCC_CET_FLAGS(CET_FLAGS)
660EXTRA_CXX_FLAGS="$EXTRA_CXX_FLAGS $CET_FLAGS"
661EXTRA_CFLAGS="$EXTRA_CFLAGS $CET_FLAGS"
662AC_SUBST(EXTRA_CFLAGS)
663AC_SUBST(EXTRA_CXX_FLAGS)
664
ff66d28f
PE
665# Determine cross-compile flags and AM_CONDITIONALs.
666#AC_SUBST(GLIBCXX_IS_NATIVE)
0df3f383 667#AM_CONDITIONAL(CANADIAN, test $CANADIAN = yes)
92eabea2 668GLIBCXX_EVALUATE_CONDITIONALS
b25e6b79 669
5e53dba6 670AC_CACHE_SAVE
b2dad0e3 671
ff66d28f 672if test ${multilib} = yes; then
b2dad0e3
BK
673 multilib_arg="--enable-multilib"
674else
675 multilib_arg=
676fi
677
0df3f383 678# Export all the install information.
3d7c150e 679GLIBCXX_EXPORT_INSTALL_INFO
1fd2f510 680
6aa43d99 681# Export all the include and flag information to Makefiles.
3d7c150e
BK
682GLIBCXX_EXPORT_INCLUDES
683GLIBCXX_EXPORT_FLAGS
e466dc8a 684
3c36aa6b
JJ
685# Determine what GCC version number to use in filesystem paths.
686GCC_BASE_VER
687
ff66d28f
PE
688dnl In autoconf 2.5x, AC_OUTPUT is replaced by four AC_CONFIG_* macros,
689dnl which can all be called multiple times as needed, plus one (different)
65fc9769 690dnl AC_OUTPUT macro. This one lists the files to be created:
6330e1d9 691AC_CONFIG_FILES(Makefile)
ff66d28f 692AC_CONFIG_FILES([scripts/testsuite_flags],[chmod +x scripts/testsuite_flags])
e1208a57 693AC_CONFIG_FILES([scripts/extract_symvers],[chmod +x scripts/extract_symvers])
8d24c975 694AC_CONFIG_FILES([doc/xsl/customization.xsl])
3acb929c 695AC_CONFIG_FILES([src/libbacktrace/backtrace-supported.h])
ff66d28f 696
6330e1d9
RW
697# Multilibs need MULTISUBDIR defined correctly in certain makefiles so
698# that multilib installs will end up installed in the correct place.
699# The testsuite needs it for multilib-aware ABI baseline files.
700# To work around this not being passed down from config-ml.in ->
701# srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
702# append it here. Only modify Makefiles that have just been created.
703#
704# Also, get rid of this simulated-VPATH thing that automake does.
705AC_CONFIG_FILES(AC_FOREACH([DIR], glibcxx_SUBDIRS, [DIR/Makefile ]),
706 [cat > vpsed$$ << \_EOF
0df3f383
PE
707s!`test -f '$<' || echo '$(srcdir)/'`!!
708_EOF
6330e1d9 709 sed -f vpsed$$ $ac_file > tmp$$
6330e1d9
RW
710 mv tmp$$ $ac_file
711 rm vpsed$$
d4e0a1c0
L
712 echo 'MULTISUBDIR =' >> $ac_file
713 ml_norecursion=yes
714 . ${multi_basedir}/config-ml.in
715 AS_UNSET([ml_norecursion])
ff66d28f
PE
716])
717
6330e1d9
RW
718AC_CONFIG_COMMANDS([generate-headers],
719 [(cd include && ${MAKE-make} pch_build= )])
720
ff66d28f
PE
721dnl And this actually makes things happen:
722AC_OUTPUT