]> git.ipfire.org Git - thirdparty/glibc.git/blob - configure.ac
configure: Move nm, objdump, and readelf to LIBC_PROG_BINUTILS
[thirdparty/glibc.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 dnl Note we do not use AC_PREREQ here! See aclocal.m4 for what we use instead.
3 AC_INIT([GNU C Library], [(see version.h)], [https://sourceware.org/bugzilla/],
4 [glibc], [https://www.gnu.org/software/glibc/])
5 AC_CONFIG_SRCDIR([include/features.h])
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_AUX_DIR([scripts])
8
9 ACX_PKGVERSION([GNU libc])
10 ACX_BUGURL([https://www.gnu.org/software/libc/bugs.html])
11 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
12 [Package description])
13 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
14 [Bug reporting address])
15
16 # Glibc should not depend on any header files
17 AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
18 [m4_divert_text([DEFAULTS],
19 [ac_includes_default='/* none */'])])
20
21 # We require GCC, and by default use its preprocessor. Override AC_PROG_CPP
22 # here to work around the Autoconf issue discussed in
23 # <https://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
24 AC_DEFUN([AC_PROG_CPP],
25 [AC_REQUIRE([AC_PROG_CC])dnl
26 AC_ARG_VAR([CPP], [C preprocessor])dnl
27 _AC_ARG_VAR_CPPFLAGS()dnl
28 # On Suns, sometimes $CPP names a directory.
29 if test -n "$CPP" && test -d "$CPP"; then
30 CPP=
31 fi
32 if test -z "$CPP"; then
33 CPP="$CC -E"
34 fi
35 AC_SUBST(CPP)dnl
36 ])# AC_PROG_CPP
37
38 # We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf
39 # issue discussed in
40 # <https://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
41 AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
42
43 dnl This is here so we can set $subdirs directly based on configure fragments.
44 AC_CONFIG_SUBDIRS()
45
46 AC_CANONICAL_HOST
47
48 AC_PROG_CC
49 if test $host != $build; then
50 AC_CHECK_PROGS(BUILD_CC, gcc cc)
51 fi
52 AC_SUBST(cross_compiling)
53 AC_PROG_CPP
54
55 # We need the C++ compiler only for testing.
56 AC_PROG_CXX
57 # It's useless to us if it can't link programs (e.g. missing -lstdc++).
58 AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
59 AC_LANG_PUSH([C++])
60 # Default, dynamic case.
61 AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
62 [libc_cv_cxx_link_ok=yes],
63 [libc_cv_cxx_link_ok=no])
64 # Static case.
65 old_LDFLAGS="$LDFLAGS"
66 LDFLAGS="$LDFLAGS -static"
67 AC_LINK_IFELSE([AC_LANG_SOURCE([
68 #include <iostream>
69
70 int
71 main()
72 {
73 std::cout << "Hello, world!";
74 return 0;
75 }
76 ])],
77 [],
78 [libc_cv_cxx_link_ok=no])
79 LDFLAGS="$old_LDFLAGS"
80 AC_LANG_POP([C++])])
81 AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
82
83 if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
84 AC_MSG_ERROR([you must configure in a separate build directory])
85 fi
86
87 # This will get text that should go into config.make.
88 config_vars=
89
90 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
91 AC_ARG_WITH([gd],
92 AS_HELP_STRING([--with-gd=DIR],
93 [find libgd include dir and library with prefix DIR]),
94 [dnl
95 case "$with_gd" in
96 yes|''|no) ;;
97 *) libgd_include="-I$withval/include"
98 libgd_ldflags="-L$withval/lib" ;;
99 esac
100 ])
101 AC_ARG_WITH([gd-include],
102 AS_HELP_STRING([--with-gd-include=DIR],
103 [find libgd include files in DIR]),
104 [dnl
105 case "$with_gd_include" in
106 ''|no) ;;
107 *) libgd_include="-I$withval" ;;
108 esac
109 ])
110 AC_ARG_WITH([gd-lib],
111 AS_HELP_STRING([--with-gd-lib=DIR],
112 [find libgd library files in DIR]),
113 [dnl
114 case "$with_gd_lib" in
115 ''|no) ;;
116 *) libgd_ldflags="-L$withval" ;;
117 esac
118 ])
119
120 if test -n "$libgd_include"; then
121 config_vars="$config_vars
122 CFLAGS-memusagestat.c = $libgd_include"
123 fi
124 if test -n "$libgd_ldflags"; then
125 config_vars="$config_vars
126 libgd-LDFLAGS = $libgd_ldflags"
127 fi
128
129 dnl Arguments to specify presence of other packages/features.
130 AC_ARG_WITH([binutils],
131 AS_HELP_STRING([--with-binutils=PATH],
132 [specify location of binutils (as and ld)]),
133 [path_binutils=$withval],
134 [path_binutils=''])
135 AC_ARG_WITH([selinux],
136 AS_HELP_STRING([--with-selinux],
137 [if building with SELinux support]),
138 [with_selinux=$withval],
139 [with_selinux=auto])
140
141 AC_ARG_WITH([headers],
142 AS_HELP_STRING([--with-headers=PATH],
143 [location of system headers to use
144 (for example /usr/src/linux/include)
145 @<:@default=compiler default@:>@]),
146 [sysheaders=$withval],
147 [sysheaders=''])
148 AC_SUBST(sysheaders)
149
150 AC_SUBST(use_default_link)
151 AC_ARG_WITH([default-link],
152 AS_HELP_STRING([--with-default-link],
153 [do not use explicit linker scripts]),
154 [use_default_link=$withval],
155 [use_default_link=no])
156
157 dnl Additional build flags injection.
158 AC_ARG_WITH([nonshared-cflags],
159 AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
160 [build nonshared libraries with additional CFLAGS]),
161 [extra_nonshared_cflags=$withval],
162 [extra_nonshared_cflags=])
163 AC_SUBST(extra_nonshared_cflags)
164 AC_ARG_WITH([rtld-early-cflags],
165 AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS],
166 [build early initialization with additional CFLAGS]),
167 [rtld_early_cflags=$withval],
168 [rtld_early_cflags=])
169 AC_SUBST(rtld_early_cflags)
170
171 AC_ARG_WITH([timeoutfactor],
172 AS_HELP_STRING([--with-timeoutfactor=NUM],
173 [specify an integer to scale the timeout]),
174 [timeoutfactor=$withval],
175 [timeoutfactor=1])
176 AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
177
178 AC_ARG_ENABLE([sanity-checks],
179 AS_HELP_STRING([--disable-sanity-checks],
180 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
181 [enable_sanity=$enableval],
182 [enable_sanity=yes])
183
184 AC_ARG_ENABLE([shared],
185 AS_HELP_STRING([--enable-shared],
186 [build shared library @<:@default=yes if GNU ld@:>@]),
187 [shared=$enableval],
188 [shared=yes])
189 AC_ARG_ENABLE([profile],
190 AS_HELP_STRING([--enable-profile],
191 [build profiled library @<:@default=no@:>@]),
192 [profile=$enableval],
193 [profile=no])
194 AC_ARG_ENABLE([default-pie],
195 AS_HELP_STRING([--disable-default-pie],
196 [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
197 [default_pie=$enableval],
198 [default_pie=yes])
199 AC_ARG_ENABLE([timezone-tools],
200 AS_HELP_STRING([--disable-timezone-tools],
201 [do not install timezone tools @<:@default=install@:>@]),
202 [enable_timezone_tools=$enableval],
203 [enable_timezone_tools=yes])
204 AC_SUBST(enable_timezone_tools)
205
206 AC_ARG_ENABLE([hardcoded-path-in-tests],
207 AS_HELP_STRING([--enable-hardcoded-path-in-tests],
208 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
209 [hardcoded_path_in_tests=$enableval],
210 [hardcoded_path_in_tests=no])
211 AC_SUBST(hardcoded_path_in_tests)
212
213 AC_ARG_ENABLE([hidden-plt],
214 AS_HELP_STRING([--disable-hidden-plt],
215 [do not hide internal function calls to avoid PLT]),
216 [hidden=$enableval],
217 [hidden=yes])
218 if test "x$hidden" = xno; then
219 AC_DEFINE(NO_HIDDEN)
220 fi
221
222 AC_ARG_ENABLE([bind-now],
223 AS_HELP_STRING([--enable-bind-now],
224 [disable lazy relocations in DSOs]),
225 [bindnow=$enableval],
226 [bindnow=no])
227 AC_SUBST(bindnow)
228 if test "x$bindnow" = xyes; then
229 AC_DEFINE(BIND_NOW)
230 fi
231
232 dnl Build glibc with -fstack-protector, -fstack-protector-all, or
233 dnl -fstack-protector-strong.
234 AC_ARG_ENABLE([stack-protector],
235 AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
236 [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
237 [enable_stack_protector=$enableval],
238 [enable_stack_protector=no])
239 case "$enable_stack_protector" in
240 all|yes|no|strong) ;;
241 *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
242 esac
243
244 dnl On some platforms we cannot use dynamic loading. We must provide
245 dnl static NSS modules.
246 AC_ARG_ENABLE([static-nss],
247 AS_HELP_STRING([--enable-static-nss],
248 [build static NSS modules @<:@default=no@:>@]),
249 [static_nss=$enableval],
250 [static_nss=no])
251 dnl Enable static NSS also if we build no shared objects.
252 if test x"$static_nss" = xyes || test x"$shared" = xno; then
253 static_nss=yes
254 AC_DEFINE(DO_STATIC_NSS)
255 fi
256
257 AC_ARG_ENABLE([force-install],
258 AS_HELP_STRING([--disable-force-install],
259 [don't force installation of files from this package, even if they are older than the installed files]),
260 [force_install=$enableval],
261 [force_install=yes])
262 AC_SUBST(force_install)
263
264 AC_ARG_ENABLE([maintainer-mode],
265 AS_HELP_STRING([--enable-maintainer-mode],
266 [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
267 [maintainer=$enableval],
268 [maintainer=no])
269
270 dnl On some platforms we allow dropping compatibility with all kernel
271 dnl versions.
272 AC_ARG_ENABLE([kernel],
273 AS_HELP_STRING([--enable-kernel=VERSION],
274 [compile for compatibility with kernel not older than VERSION]),
275 [minimum_kernel=$enableval],
276 [])
277 dnl Prevent unreasonable values.
278 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
279 # Better nothing than this.
280 minimum_kernel=""
281 else
282 if test "$minimum_kernel" = current; then
283 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
284 fi
285 fi
286
287 dnl For the development we sometimes want gcc to issue even more warnings.
288 dnl This is not the default since many of the extra warnings are not
289 dnl appropriate.
290 AC_ARG_ENABLE([all-warnings],
291 AS_HELP_STRING([--enable-all-warnings],
292 [enable all useful warnings gcc can issue]),
293 [all_warnings=$enableval],
294 [])
295 AC_SUBST(all_warnings)
296
297 AC_ARG_ENABLE([werror],
298 AS_HELP_STRING([--disable-werror],
299 [do not build with -Werror]),
300 [enable_werror=$enableval],
301 [enable_werror=yes])
302 AC_SUBST(enable_werror)
303
304 AC_ARG_ENABLE([multi-arch],
305 AS_HELP_STRING([--enable-multi-arch],
306 [enable single DSO with optimizations for multiple architectures]),
307 [multi_arch=$enableval],
308 [multi_arch=default])
309
310 AC_ARG_ENABLE([experimental-malloc],
311 AS_HELP_STRING([--disable-experimental-malloc],
312 [disable experimental malloc features]),
313 [experimental_malloc=$enableval],
314 [experimental_malloc=yes])
315 AC_SUBST(experimental_malloc)
316
317 AC_ARG_ENABLE([memory-tagging],
318 AS_HELP_STRING([--enable-memory-tagging],
319 [enable memory tagging if supported by the architecture @<:@default=no@:>@]),
320 [memory_tagging=$enableval],
321 [memory_tagging=no])
322 if test "$memory_tagging" = yes; then
323 # Only enable this on architectures that support it.
324 case $host_cpu in
325 aarch64)
326 AC_DEFINE(USE_MTAG)
327 ;;
328 esac
329 fi
330 AC_SUBST(memory_tagging)
331
332 AC_ARG_ENABLE([crypt],
333 AS_HELP_STRING([--disable-crypt],
334 [do not build nor install the passphrase hashing library, libcrypt]),
335 [build_crypt=$enableval],
336 [build_crypt=yes])
337 AC_SUBST(build_crypt)
338
339 AC_ARG_ENABLE([nss-crypt],
340 AS_HELP_STRING([--enable-nss-crypt],
341 [enable libcrypt to use nss]),
342 [nss_crypt=$enableval],
343 [nss_crypt=no])
344 if test x$build_libcrypt = xno && test x$nss_crypt = xyes; then
345 AC_MSG_WARN([--enable-nss-crypt has no effect when libcrypt is disabled])
346 nss_crypt=no
347 fi
348 if test x$nss_crypt = xyes; then
349 nss_includes=-I$(nss-config --includedir 2>/dev/null)
350 if test $? -ne 0; then
351 AC_MSG_ERROR([cannot find include directory with nss-config])
352 fi
353 nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
354 if test $? -ne 0; then
355 AC_MSG_ERROR([cannot find include directory with nspr-config])
356 fi
357 old_CFLAGS="$CFLAGS"
358 CFLAGS="$CFLAGS $nss_includes $nspr_includes"
359 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
360 #include <hasht.h>
361 #include <nsslowhash.h>
362 void f (void) { NSSLOW_Init (); }])],
363 libc_cv_nss_crypt=yes,
364 AC_MSG_ERROR([
365 cannot find NSS headers with lowlevel hash function interfaces]))
366 old_LIBS="$LIBS"
367 old_LDFLAGS="$LDFLAGS"
368 LIBS="$LIBS -lfreebl3"
369 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
370 #include <hasht.h>
371 #include <nsslowhash.h>],
372 [NSSLOW_Init();])],
373 libc_cv_nss_crypt=yes,
374 AC_MSG_ERROR([
375 cannot link program using lowlevel NSS hash functions]))
376 # Check to see if there is a static NSS cryptographic library.
377 # If there isn't then we can't link anything with libcrypt.a,
378 # and that might mean disabling some static tests.
379 LDFLAGS="$LDFLAGS -static"
380 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
381 #include <hasht.h>
382 #include <nsslowhash.h>],
383 [NSSLOW_Init();])],
384 libc_cv_static_nss_crypt=yes,
385 libc_cv_static_nss_crypt=no)
386 LDFLAGS="$old_LDFLAGS"
387 CFLAGS="$old_CFLAGS"
388 LIBS="$old_LIBS"
389 else
390 libc_cv_nss_crypt=no
391 libc_cv_static_nss_crypt=no
392 fi
393 AC_SUBST(libc_cv_nss_crypt)
394 AC_SUBST(libc_cv_static_nss_crypt)
395
396
397 AC_ARG_ENABLE([systemtap],
398 [AS_HELP_STRING([--enable-systemtap],
399 [enable systemtap static probe points @<:@default=no@:>@])],
400 [systemtap=$enableval],
401 [systemtap=no])
402 if test "x$systemtap" != xno; then
403 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
404 old_CFLAGS="$CFLAGS"
405 CFLAGS="-std=gnu11 $CFLAGS"
406 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
407 void foo (int i, void *p)
408 {
409 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
410 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
411 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
412 CFLAGS="$old_CFLAGS"])
413 if test $libc_cv_sdt = yes; then
414 AC_DEFINE([USE_STAP_PROBE])
415 elif test "x$systemtap" != xauto; then
416 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
417 fi
418 fi
419
420 AC_ARG_ENABLE([build-nscd],
421 [AS_HELP_STRING([--disable-build-nscd],
422 [disable building and installing the nscd daemon])],
423 [build_nscd=$enableval],
424 [build_nscd=default])
425 AC_SUBST(build_nscd)
426
427 # Note the use of $use_nscd is near the bottom of the file.
428 AC_ARG_ENABLE([nscd],
429 [AS_HELP_STRING([--disable-nscd],
430 [library functions will not contact the nscd daemon])],
431 [use_nscd=$enableval],
432 [use_nscd=yes])
433
434 AC_ARG_ENABLE([pt_chown],
435 [AS_HELP_STRING([--enable-pt_chown],
436 [Enable building and installing pt_chown])],
437 [build_pt_chown=$enableval],
438 [build_pt_chown=no])
439 AC_SUBST(build_pt_chown)
440 if test "$build_pt_chown" = yes; then
441 AC_DEFINE(HAVE_PT_CHOWN)
442 fi
443
444 AC_ARG_ENABLE([tunables],
445 [AS_HELP_STRING([--enable-tunables],
446 [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
447 [have_tunables=$enableval],
448 [have_tunables=yes])
449 AC_SUBST(have_tunables)
450 if test "$have_tunables" = yes; then
451 AC_DEFINE(HAVE_TUNABLES)
452 fi
453
454 # The abi-tags file uses a fairly simplistic model for name recognition that
455 # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
456 # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
457 # This doesn't get used much beyond that, so it's fairly safe.
458 case "$host_os" in
459 linux*)
460 ;;
461 gnu*)
462 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
463 ;;
464 esac
465
466 AC_ARG_ENABLE([mathvec],
467 [AS_HELP_STRING([--enable-mathvec],
468 [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
469 [build_mathvec=$enableval],
470 [build_mathvec=notset])
471
472 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
473 #ifndef __CET__
474 # error no CET compiler support
475 #endif]])],
476 [libc_cv_compiler_default_cet=yes],
477 [libc_cv_compiler_default_cet=no])
478
479 AC_ARG_ENABLE([cet],
480 AS_HELP_STRING([--enable-cet],
481 [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
482 [enable_cet=$enableval],
483 [enable_cet=$libc_cv_compiler_default_cet])
484
485 AC_ARG_ENABLE([scv],
486 AC_HELP_STRING([--disable-scv],
487 [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
488 [use_scv=$enableval],
489 [use_scv=yes])
490
491 AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
492
493 # We keep the original values in `$config_*' and never modify them, so we
494 # can write them unchanged into config.make. Everything else uses
495 # $machine, $vendor, and $os, and changes them whenever convenient.
496 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
497
498 # Don't allow vendor == "unknown"
499 test "$config_vendor" = unknown && config_vendor=
500 config_os="`echo $config_os | sed 's/^unknown-//'`"
501
502 # Some configurations imply other options.
503 elf=yes
504
505 # The configure fragment of a port can modify these to supplement
506 # or override the table in the case statement below. No fragment should
507 # ever change the config_* variables, however.
508 machine=$config_machine
509 vendor=$config_vendor
510 os=$config_os
511 base_os=''
512
513 submachine=
514 AC_ARG_WITH([cpu],
515 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
516 [dnl
517 case "$withval" in
518 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
519 no) ;;
520 *) submachine="$withval" ;;
521 esac
522 ])
523
524 # An preconfigure script can set this when it wants to disable the sanity
525 # check below.
526 libc_config_ok=no
527
528 # A preconfigure script for a system that may or may not use fpu
529 # sysdeps directories sets this to a preprocessor conditional for
530 # whether to use such directories.
531 with_fp_cond=1
532
533 dnl Let sysdeps/*/preconfigure act here.
534 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
535
536
537 ###
538 ### By using the undocumented --enable-hacker-mode option for configure
539 ### one can skip this test to make the configuration not fail for unsupported
540 ### platforms.
541 ###
542 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
543 case "$machine-$host_os" in
544 *-linux* | *-gnu*)
545 ;;
546 *)
547 AC_MSG_ERROR([
548 *** The GNU C library is currently unavailable for this platform.
549 *** If you are interested in seeing glibc on this platform visit
550 *** the "How to submit a new port" in the wiki:
551 *** https://sourceware.org/glibc/wiki/#Development
552 *** and join the community!])
553 ;;
554 esac
555 fi
556
557 # Set base_machine if not set by a preconfigure fragment.
558 test -n "$base_machine" || base_machine=$machine
559 AC_SUBST(base_machine)
560
561 ### Locate tools.
562
563 AC_PROG_INSTALL
564 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
565 # The makefiles need to use a different form to find it in $srcdir.
566 INSTALL='\$(..)./scripts/install-sh -c'
567 fi
568 AC_PROG_LN_S
569
570 LIBC_PROG_BINUTILS
571
572 # Accept binutils 2.25 or newer.
573 libc_cv_with_lld=no
574 case $($LD --version) in
575 "GNU gold"*)
576 # Accept gold 1.14 or higher
577 AC_CHECK_PROG_VER(LD, $LD, --version,
578 [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
579 [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
580 LD=: critic_missing="$critic_missing GNU gold")
581 ;;
582 "LLD"*)
583 # Accept LLD 13.0.0 or higher
584 AC_CHECK_PROG_VER(LD, $LD, --version,
585 [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
586 [1[3-9].*|[2-9][0-9].*],
587 LD=: critic_missing="$critic_missing LLD")
588 libc_cv_with_lld=yes
589 ;;
590 *)
591 AC_CHECK_PROG_VER(LD, $LD, --version,
592 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
593 [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
594 LD=: critic_missing="$critic_missing GNU ld")
595 ;;
596 esac
597 LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
598
599 # These programs are version sensitive.
600 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
601 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
602 [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
603
604 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
605 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
606 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
607 MSGFMT=: aux_missing="$aux_missing msgfmt")
608 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
609 [GNU texinfo.* \([0-9][0-9.]*\)],
610 [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
611 MAKEINFO=: aux_missing="$aux_missing makeinfo")
612 AC_CHECK_PROG_VER(SED, sed, --version,
613 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
614 [3.0[2-9]*|3.[1-9]*|[4-9]*],
615 SED=: aux_missing="$aux_missing sed")
616 AC_CHECK_PROG_VER(AWK, gawk, --version,
617 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
618 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
619 AC_CHECK_PROG_VER(BISON, bison, --version,
620 [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
621 [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
622
623 AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
624 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
625 #if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
626 #error insufficient compiler
627 #endif]])],
628 [libc_cv_compiler_ok=yes],
629 [libc_cv_compiler_ok=no])])
630 AS_IF([test $libc_cv_compiler_ok != yes],
631 [critic_missing="$critic_missing compiler"])
632
633 if test "x$maintainer" = "xyes"; then
634 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
635 case "x$AUTOCONF" in
636 xno|x|x:) AUTOCONF=no ;;
637 *)
638 AC_CACHE_CHECK(dnl
639 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
640 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
641 libc_cv_autoconf_works=yes
642 else
643 libc_cv_autoconf_works=no
644 fi])
645 test $libc_cv_autoconf_works = yes || AUTOCONF=no
646 ;;
647 esac
648 if test "x$AUTOCONF" = xno; then
649 aux_missing="$aux_missing autoconf"
650 fi
651 else
652 AUTOCONF=no
653 fi
654
655 # Check for python3 if available, or else python.
656 AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
657 [Python \([0-9][0-9.]*\)],
658 [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
659 critic_missing="$critic_missing python")
660 PYTHON="$PYTHON_PROG -B"
661 AC_SUBST(PYTHON)
662
663 test -n "$critic_missing" && AC_MSG_ERROR([
664 *** These critical programs are missing or too old:$critic_missing
665 *** Check the INSTALL file for required versions.])
666
667 test -n "$aux_missing" && AC_MSG_WARN([
668 *** These auxiliary programs are missing or incompatible versions:$aux_missing
669 *** some features or tests will be disabled.
670 *** Check the INSTALL file for required versions.])
671
672
673 # Determine whether to use fpu or nofpu sysdeps directories.
674 AC_CACHE_CHECK([for use of fpu sysdeps directories],
675 libc_cv_with_fp, [dnl
676 cat > conftest.c <<EOF
677 #if $with_fp_cond
678 int dummy;
679 #else
680 # error "no hardware floating point"
681 #endif
682 EOF
683 libc_cv_with_fp=no
684 if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
685 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
686 libc_cv_with_fp=yes
687 fi
688 rm -f conftest*])
689 AC_SUBST(libc_cv_with_fp)
690
691 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
692 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
693 [libc_cv_ssp=yes],
694 [libc_cv_ssp=no])
695 ])
696
697 AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
698 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
699 [libc_cv_ssp_strong=yes],
700 [libc_cv_ssp_strong=no])
701 ])
702
703 AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
704 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
705 [libc_cv_ssp_all=yes],
706 [libc_cv_ssp_all=no])
707 ])
708
709 stack_protector=
710 no_stack_protector=
711 if test "$libc_cv_ssp" = yes; then
712 no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
713 AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
714 fi
715
716 if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
717 stack_protector="-fstack-protector"
718 AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
719 elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
720 stack_protector="-fstack-protector-all"
721 AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
722 elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
723 stack_protector="-fstack-protector-strong"
724 AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
725 else
726 stack_protector="-fno-stack-protector"
727 AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
728 fi
729 AC_SUBST(libc_cv_ssp)
730 AC_SUBST(stack_protector)
731 AC_SUBST(no_stack_protector)
732
733 if test -n "$stack_protector"; then
734 dnl Don't run configure tests with stack-protection on, to avoid problems with
735 dnl bootstrapping.
736 no_ssp=-fno-stack-protector
737 else
738 no_ssp=
739
740 if test "$enable_stack_protector" != no; then
741 AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
742 fi
743 fi
744
745 # For the multi-arch option we need support in the assembler & linker.
746 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
747 libc_cv_ld_gnu_indirect_function, [dnl
748 cat > conftest.S <<EOF
749 .type foo,%gnu_indirect_function
750 foo:
751 .globl _start
752 _start:
753 .globl __start
754 __start:
755 .data
756 #ifdef _LP64
757 .quad foo
758 #else
759 .long foo
760 #endif
761 EOF
762 libc_cv_ld_gnu_indirect_function=no
763 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
764 -nostartfiles -nostdlib $no_ssp \
765 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
766 # Do a link to see if the backend supports IFUNC relocs.
767 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
768 LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
769 libc_cv_ld_gnu_indirect_function=yes
770 }
771 fi
772 rm -f conftest*])
773
774 # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
775 AC_CACHE_CHECK([for gcc attribute ifunc support],
776 libc_cv_gcc_indirect_function, [dnl
777 cat > conftest.c <<EOF
778 extern int func (int);
779 int used_func (int a)
780 {
781 return a;
782 }
783 static void *resolver ()
784 {
785 return &used_func;
786 }
787 extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
788 EOF
789 libc_cv_gcc_indirect_function=no
790 if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
791 2>&AS_MESSAGE_LOG_FD ; then
792 if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
793 libc_cv_gcc_indirect_function=yes
794 fi
795 fi
796 rm -f conftest*])
797
798 # Check if linker supports textrel relocation with ifunc (used on elf/tests).
799 # Note that it relies on libc_cv_ld_gnu_indirect_function test above.
800 AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
801 libc_cv_textrel_ifunc, [dnl
802 cat > conftest.S <<EOF
803 .type foo,%gnu_indirect_function
804 foo:
805 .globl _start
806 _start:
807 .globl __start
808 __start:
809 .data
810 #ifdef _LP64
811 .quad foo
812 #else
813 .long foo
814 #endif
815 .text
816 .globl address
817 address:
818 #ifdef _LP64
819 .quad address
820 #else
821 .long address
822 #endif
823 EOF
824 libc_cv_textrel_ifunc=no
825 if test $libc_cv_ld_gnu_indirect_function = yes; then
826 if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
827 libc_cv_textrel_ifunc=yes
828 fi
829 fi
830 rm -f conftest*])
831 AC_SUBST(libc_cv_textrel_ifunc)
832
833 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
834 AC_CACHE_CHECK([for GNU attribute retain support],
835 libc_cv_gnu_retain, [dnl
836 cat > conftest.c <<EOF
837 static int var __attribute__ ((used, retain, section ("__libc_atexit")));
838 EOF
839 libc_cv_gnu_retain=no
840 if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
841 2>&AS_MESSAGE_LOG_FD ; then
842 libc_cv_gnu_retain=yes
843 fi
844 rm -f conftest*])
845 if test $libc_cv_gnu_retain = yes; then
846 AC_DEFINE(HAVE_GNU_RETAIN)
847 fi
848 LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
849
850 # Check if gcc warns about alias for function with incompatible types.
851 AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
852 libc_cv_gcc_incompatible_alias, [dnl
853 cat > conftest.c <<EOF
854 int __redirect_foo (const void *s, int c);
855
856 __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
857 __typeof (__redirect_foo) *foo_impl (void)
858 {
859 return 0;
860 }
861
862 extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
863 EOF
864 libc_cv_gcc_incompatible_alias=yes
865 if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
866 libc_cv_gcc_incompatible_alias=no
867 fi
868 rm -f conftest*])
869
870 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
871 if test x"$multi_arch" = xyes; then
872 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
873 else
874 multi_arch=no
875 fi
876 fi
877 if test x"$libc_cv_gcc_indirect_function" != xyes; then
878 # GCC 8+ emits a warning for alias with incompatible types and it might
879 # fail to build ifunc resolvers aliases to either weak or internal
880 # symbols. Disables multiarch build in this case.
881 if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
882 AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
883 if test x"$multi_arch" = xyes; then
884 AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
885 fi
886 AC_MSG_WARN([Multi-arch is disabled.])
887 multi_arch=no
888 elif test x"$multi_arch" = xyes; then
889 AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
890 Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
891 fi
892 fi
893 multi_arch_d=
894 if test x"$multi_arch" != xno; then
895 multi_arch_d=/multiarch
896 fi
897
898 # Compute the list of sysdep directories for this configuration.
899 # This can take a while to compute.
900 sysdep_dir=$srcdir/sysdeps
901 AC_MSG_CHECKING(sysdep dirs)
902 dnl We need to use [ and ] for other purposes for a while now.
903 changequote(,)dnl
904 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
905 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
906
907 test "x$base_os" != x || case "$os" in
908 gnu*)
909 base_os=mach/hurd ;;
910 linux*)
911 base_os=unix/sysv ;;
912 esac
913
914 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
915 tail=$os
916 ostry=$os
917 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
918 ostry="$ostry /$o"
919 tail=$o
920 done
921 o=`echo $tail | sed 's/[0-9]*$//'`
922 if test $o != $tail; then
923 ostry="$ostry /$o"
924 fi
925 # For linux-gnu, try linux-gnu, then linux.
926 o=`echo $tail | sed 's/-.*$//'`
927 if test $o != $tail; then
928 ostry="$ostry /$o"
929 fi
930
931 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
932 base=
933 tail=$base_os
934 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
935 set $b
936 base="$base /$1"
937 tail="$2"
938 done
939
940 # For sparc/sparc32, try sparc/sparc32 and then sparc.
941 mach=
942 tail=$machine${submachine:+/$submachine}
943 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
944 set $m
945 # Prepend the machine's FPU directory unless the architecture specific
946 # preconfigure disables it.
947 if test "$libc_cv_with_fp" = yes; then
948 maybe_fpu=/fpu
949 else
950 maybe_fpu=/nofpu
951 fi
952 # For each machine term, try it with and then without /multiarch.
953 for try_fpu in $maybe_fpu ''; do
954 for try_multi in $multi_arch_d ''; do
955 mach="$mach /$1$try_fpu$try_multi"
956 done
957 done
958 tail="$2"
959 done
960
961 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
962 changequote([,])dnl
963
964 # Find what sysdep directories exist.
965 sysnames=
966 for b in $base ''; do
967 for m0 in $mach ''; do
968 for v in /$vendor ''; do
969 test "$v" = / && continue
970 for o in /$ostry ''; do
971 test "$o" = / && continue
972 for m in $mach ''; do
973 try_suffix="$m0$b$v$o$m"
974 if test -n "$try_suffix"; then
975 try_srcdir="${srcdir}/"
976 try="sysdeps$try_suffix"
977 test -n "$enable_debug_configure" &&
978 echo "$0 [DEBUG]: try $try" >&2
979 if test -d "$try_srcdir$try"; then
980 sysnames="$sysnames $try"
981 { test -n "$o" || test -n "$b"; } && os_used=t
982 { test -n "$m" || test -n "$m0"; } && machine_used=t
983 case x${m0:-$m} in
984 x*/$submachine) submachine_used=t ;;
985 esac
986 fi
987 fi
988 done
989 done
990 done
991 done
992 done
993
994 # If the assembler supports gnu_indirect_function symbol type and the
995 # architecture supports multi-arch, we enable multi-arch by default.
996 case $sysnames in
997 *"$multi_arch_d"*)
998 ;;
999 *)
1000 test x"$multi_arch" = xdefault && multi_arch=no
1001 ;;
1002 esac
1003 if test x"$multi_arch" != xno; then
1004 AC_DEFINE(USE_MULTIARCH)
1005 fi
1006 AC_SUBST(multi_arch)
1007
1008 if test -z "$os_used" && test "$os" != none; then
1009 AC_MSG_ERROR(Operating system $os is not supported.)
1010 fi
1011 if test -z "$machine_used" && test "$machine" != none; then
1012 AC_MSG_ERROR(The $machine is not supported.)
1013 fi
1014 if test -z "$submachine_used" && test -n "$submachine"; then
1015 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
1016 fi
1017 AC_SUBST(submachine)
1018
1019 # We have now validated the configuration.
1020
1021 # Expand the list of system names into a full list of directories
1022 # from each element's parent name and Implies file (if present).
1023 set $sysnames
1024 names=
1025 while test $# -gt 0; do
1026 name=$1
1027 shift
1028
1029 case " $names " in *" $name "*)
1030 # Already in the list.
1031 continue
1032 esac
1033
1034 # Report each name as we discover it, so there is no long pause in output.
1035 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
1036
1037 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
1038
1039 case $name in
1040 /*) xsrcdir= ;;
1041 *) xsrcdir=$srcdir/ ;;
1042 esac
1043 test -n "$enable_debug_configure" &&
1044 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
1045
1046 for implies_file in Implies Implies-before Implies-after; do
1047 implies_type=`echo $implies_file | sed s/-/_/`
1048 eval ${implies_type}=
1049 if test -f $xsrcdir$name/$implies_file; then
1050 # Collect more names from the `Implies' file (removing comments).
1051 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
1052 for x in $implied_candidate; do
1053 found=no
1054 if test -d $xsrcdir$name_base/$x; then
1055 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
1056 found=yes
1057 fi
1058 try="sysdeps/$x"
1059 try_srcdir=$srcdir/
1060 test -n "$enable_debug_configure" &&
1061 echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
1062 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
1063 then
1064 eval "${implies_type}=\"\$${implies_type} \$try\""
1065 found=yes
1066 fi
1067 if test $found = no; then
1068 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
1069 fi
1070 done
1071 fi
1072 done
1073
1074 # Add NAME to the list of names.
1075 names="$names $name"
1076
1077 # Find the parent of NAME, using the empty string if it has none.
1078 changequote(,)dnl
1079 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
1080 changequote([,])dnl
1081
1082 test -n "$enable_debug_configure" &&
1083 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
1084 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
1085
1086 # Add the names implied by NAME, and NAME's parent (if it has one), to
1087 # the list of names to be processed (the argument list). We prepend the
1088 # implied names to the list and append the parent. We want implied
1089 # directories to come before further directories inferred from the
1090 # configuration components; this ensures that for sysv4, unix/common
1091 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
1092 # after sysv4).
1093 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
1094 test -n "$sysnames" && set $sysnames
1095 done
1096
1097 # Add the default directories.
1098 default_sysnames="sysdeps/generic"
1099 sysnames="$names $default_sysnames"
1100 AC_SUBST(sysnames)
1101 # The other names were emitted during the scan.
1102 AC_MSG_RESULT($default_sysnames)
1103
1104 # if using special system headers, find out the compiler's sekrit
1105 # header directory and add that to the list. NOTE: Only does the right
1106 # thing on a system that doesn't need fixincludes. (Not presently a problem.)
1107 if test -n "$sysheaders"; then
1108 SYSINCLUDES=-nostdinc
1109 for d in include include-fixed; do
1110 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1111 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1112 done
1113 SYSINCLUDES="$SYSINCLUDES \
1114 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1115 if test -n "$CXX"; then
1116 CXX_SYSINCLUDES=
1117 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1118 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1119 test "x$cxxheaders" != x &&
1120 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1121 done
1122 fi
1123 fi
1124 AC_SUBST(SYSINCLUDES)
1125 AC_SUBST(CXX_SYSINCLUDES)
1126
1127 # Obtain some C++ header file paths. This is used to make a local
1128 # copy of those headers in Makerules.
1129 if test -n "$CXX"; then
1130 find_cxx_header () {
1131 echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
1132 | $AWK '$1 == "."{print $2}'
1133 }
1134 CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
1135 CXX_CMATH_HEADER="$(find_cxx_header cmath)"
1136 CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
1137 fi
1138 AC_SUBST(CXX_CSTDLIB_HEADER)
1139 AC_SUBST(CXX_CMATH_HEADER)
1140 AC_SUBST(CXX_BITS_STD_ABS_H)
1141
1142 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1143 # since this would lead to problems installing/building glibc.
1144 # LD_LIBRARY_PATH contains the current directory if one of the following
1145 # is true:
1146 # - one of the terminals (":" and ";") is the first or last sign
1147 # - two terminals occur directly after each other
1148 # - the path contains an element with a dot in it
1149 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1150 changequote(,)dnl
1151 case ${LD_LIBRARY_PATH} in
1152 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1153 ld_library_path_setting="contains current directory"
1154 ;;
1155 *)
1156 ld_library_path_setting="ok"
1157 ;;
1158 esac
1159 changequote([,])dnl
1160 AC_MSG_RESULT($ld_library_path_setting)
1161 if test "$ld_library_path_setting" != "ok"; then
1162 AC_MSG_ERROR([
1163 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1164 *** building glibc. Please change the environment variable
1165 *** and run configure again.])
1166 fi
1167
1168 AC_PATH_PROG(BASH_SHELL, bash, no)
1169
1170 AC_PATH_PROG(PERL, perl, no)
1171 if test "$PERL" != no &&
1172 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1173 PERL=no
1174 fi
1175 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1176 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1177
1178 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1179 cat > conftest.s <<EOF
1180 .text
1181 foo:
1182 .set glibc_conftest_frobozz,foo
1183 .globl glibc_conftest_frobozz
1184 EOF
1185 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1186 # (but it doesn't work), so we must do a linking check to be sure.
1187 cat > conftest1.c <<\EOF
1188 extern int glibc_conftest_frobozz;
1189 void _start() { glibc_conftest_frobozz = 1; }
1190 EOF
1191 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1192 -nostartfiles -nostdlib $no_ssp \
1193 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1194 libc_cv_asm_set_directive=yes
1195 else
1196 libc_cv_asm_set_directive=no
1197 fi
1198 rm -f conftest*])
1199 if test $libc_cv_asm_set_directive = yes; then
1200 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1201 fi
1202
1203 AC_CACHE_CHECK(linker support for protected data symbol,
1204 libc_cv_protected_data,
1205 [cat > conftest.c <<EOF
1206 int bar __attribute__ ((visibility ("protected"))) = 1;
1207 EOF
1208 libc_cv_protected_data=no
1209 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
1210 cat > conftest.c <<EOF
1211 extern int bar;
1212 int main (void) { return bar; }
1213 EOF
1214 if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
1215 libc_cv_protected_data=yes
1216 fi
1217 fi
1218 rm -f conftest.*
1219 ])
1220 AC_SUBST(libc_cv_protected_data)
1221
1222 AC_CACHE_CHECK(linker support for INSERT in linker script,
1223 libc_cv_insert,
1224 [cat > conftest.c <<EOF
1225 int __attribute__ ((section(".bar"))) bar = 0x12345678;
1226 int test (void) { return bar; }
1227 EOF
1228 cat > conftest.t <<EOF
1229 SECTIONS
1230 {
1231 .bar : { *(.bar) }
1232 }
1233 INSERT AFTER .rela.dyn;
1234 EOF
1235 libc_cv_insert=no
1236 if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
1237 libc_cv_insert=yes
1238 fi
1239 rm -f conftest.*
1240 ])
1241 AC_SUBST(libc_cv_insert)
1242
1243 AC_CACHE_CHECK(for broken __attribute__((alias())),
1244 libc_cv_broken_alias_attribute,
1245 [cat > conftest.c <<EOF
1246 extern int foo (int x) __asm ("xyzzy");
1247 int bar (int x) { return x; }
1248 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1249 extern int dfoo;
1250 extern __typeof (dfoo) dfoo __asm ("abccb");
1251 int dfoo = 1;
1252 EOF
1253 libc_cv_broken_alias_attribute=yes
1254 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1255 if grep 'xyzzy' conftest.s >/dev/null &&
1256 grep 'abccb' conftest.s >/dev/null; then
1257 libc_cv_broken_alias_attribute=no
1258 fi
1259 fi
1260 rm -f conftest.c conftest.s
1261 ])
1262 if test $libc_cv_broken_alias_attribute = yes; then
1263 AC_MSG_ERROR(working alias attribute support required)
1264 fi
1265
1266 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1267 libc_cv_have_sdata_section,
1268 [echo "int i;" > conftest.c
1269 libc_cv_have_sdata_section=no
1270 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1271 | grep '\.sdata' >/dev/null; then
1272 libc_cv_have_sdata_section=yes
1273 fi
1274 rm -f conftest.c conftest.so
1275 ])
1276 if test $libc_cv_have_sdata_section = yes; then
1277 AC_DEFINE(HAVE_SDATA_SECTION)
1278 fi
1279
1280 AC_CACHE_CHECK(for libunwind-support in compiler,
1281 libc_cv_cc_with_libunwind, [
1282 cat > conftest.c <<EOF
1283 int main (void) { return 0; }
1284 EOF
1285 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1286 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1287 libc_cv_cc_with_libunwind=yes
1288 else
1289 libc_cv_cc_with_libunwind=no
1290 fi
1291 rm -f conftest*])
1292 AC_SUBST(libc_cv_cc_with_libunwind)
1293 if test $libc_cv_cc_with_libunwind = yes; then
1294 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1295 fi
1296
1297 ASFLAGS_config=
1298 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1299 libc_cv_as_noexecstack, [dnl
1300 cat > conftest.c <<EOF
1301 void foo (void) { }
1302 EOF
1303 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1304 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1305 && grep .note.GNU-stack conftest.s >/dev/null \
1306 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1307 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1308 then
1309 libc_cv_as_noexecstack=yes
1310 else
1311 libc_cv_as_noexecstack=no
1312 fi
1313 rm -f conftest*])
1314 if test $libc_cv_as_noexecstack = yes; then
1315 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1316 fi
1317 AC_SUBST(ASFLAGS_config)
1318
1319 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1320 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1321 AC_SUBST(libc_cv_z_execstack)
1322
1323 LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
1324 [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
1325 LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
1326
1327 LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
1328 [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
1329 LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
1330
1331 LIBC_LINKER_FEATURE([-z pack-relative-relocs],
1332 [-Wl,-z,pack-relative-relocs],
1333 [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
1334 LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
1335
1336 LIBC_LINKER_FEATURE([--no-dynamic-linker],
1337 [-Wl,--no-dynamic-linker],
1338 [libc_cv_no_dynamic_linker=yes],
1339 [libc_cv_no_dynamic_linker=no])
1340 LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
1341
1342 AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
1343 LIBC_TRY_CC_OPTION([-static-pie],
1344 [libc_cv_static_pie=yes],
1345 [libc_cv_static_pie=no])
1346 ])
1347 LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
1348
1349 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1350 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1351 ])
1352
1353 AC_SUBST(libc_cv_fpie)
1354
1355 AC_CACHE_CHECK(for GLOB_DAT reloc,
1356 libc_cv_has_glob_dat, [dnl
1357 cat > conftest.c <<EOF
1358 extern int mumble;
1359 int foo (void) { return mumble; }
1360 EOF
1361 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1362 -fPIC -shared -o conftest.so conftest.c
1363 -nostdlib -nostartfiles $no_ssp
1364 1>&AS_MESSAGE_LOG_FD])
1365 then
1366 dnl look for GLOB_DAT relocation.
1367 if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
1368 libc_cv_has_glob_dat=yes
1369 else
1370 libc_cv_has_glob_dat=no
1371 fi
1372 else
1373 libc_cv_has_glob_dat=no
1374 fi
1375 rm -f conftest*])
1376 AC_SUBST(libc_cv_has_glob_dat)
1377
1378 AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
1379 [dnl
1380 cat > conftest.c <<EOF
1381 __thread int i;
1382 void foo (void)
1383 {
1384 i = 10;
1385 }
1386 EOF
1387 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
1388 conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
1389 then
1390 libc_cv_mtls_dialect_gnu2=yes
1391 else
1392 libc_cv_mtls_dialect_gnu2=no
1393 fi
1394 rm -f conftest*])
1395 AC_SUBST(libc_cv_mtls_dialect_gnu2)
1396 LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
1397
1398 dnl clang emits an warning for a double alias redirection, to warn the
1399 dnl original symbol is sed even when weak definition overriddes it.
1400 dnl It is a usual pattern for weak_alias, where multiple alias point to
1401 dnl same symbol.
1402 AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases],
1403 libc_cv_wno_ignored_attributes, [dnl
1404 cat > conftest.c <<EOF
1405 void __foo (void)
1406 {
1407 }
1408 extern __typeof (__foo) foo __attribute__ ((weak, alias ("__foo")));
1409 extern __typeof (__foo) bar __attribute__ ((weak, alias ("foo")));
1410 EOF
1411 libc_cv_wno_ignored_attributes=""
1412 if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c])
1413 then
1414 libc_cv_wno_ignored_attributes="-Wno-ignored-attributes"
1415 fi
1416 rm -f conftest*])
1417 LIBC_CONFIG_VAR([config-cflags-wno-ignored-attributes],
1418 [$libc_cv_wno_ignored_attributes])
1419
1420 AC_CACHE_CHECK(whether cc puts quotes around section names,
1421 libc_cv_have_section_quotes,
1422 [cat > conftest.c <<EOF
1423 static const int foo
1424 __attribute__ ((section ("bar"))) = 1;
1425 EOF
1426 if ${CC-cc} -S conftest.c -o conftest.s; then
1427 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1428 libc_cv_have_section_quotes=yes
1429 else
1430 libc_cv_have_section_quotes=no
1431 fi
1432 else
1433 libc_cv_have_section_quotes=unknown
1434 fi
1435 rm -f conftest.{c,s}
1436 ])
1437 if test $libc_cv_have_section_quotes = yes; then
1438 AC_DEFINE(HAVE_SECTION_QUOTES)
1439 fi
1440
1441 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1442 cat > conftest.c <<\EOF
1443 void zero (void *x)
1444 {
1445 __builtin_memset (x, 0, 1000);
1446 }
1447 EOF
1448 dnl
1449 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
1450 then
1451 libc_cv_gcc_builtin_memset=no
1452 else
1453 libc_cv_gcc_builtin_memset=yes
1454 fi
1455 rm -f conftest* ])
1456 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1457 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1458 fi
1459
1460 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1461 cat > conftest.c <<\EOF
1462 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1463 char *foo (const char *a, const char *b)
1464 {
1465 return __builtin_strstr (a, b);
1466 }
1467 EOF
1468 dnl
1469 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
1470 then
1471 libc_cv_gcc_builtin_redirection=yes
1472 else
1473 libc_cv_gcc_builtin_redirection=no
1474 fi
1475 rm -f conftest* ])
1476 if test "$libc_cv_gcc_builtin_redirection" = no; then
1477 AC_MSG_ERROR([support for the symbol redirection needed])
1478 fi
1479
1480 dnl Determine how to disable generation of FMA instructions.
1481 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1482 libc_cv_cc_nofma, [dnl
1483 libc_cv_cc_nofma=
1484 for opt in -ffp-contract=off -mno-fused-madd; do
1485 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1486 done])
1487 AC_SUBST(libc_cv_cc_nofma)
1488
1489 if test -n "$submachine"; then
1490 AC_CACHE_CHECK([for compiler option for CPU variant],
1491 libc_cv_cc_submachine, [dnl
1492 libc_cv_cc_submachine=no
1493 for opt in "-march=$submachine" "-mcpu=$submachine"; do
1494 LIBC_TRY_CC_OPTION([$opt], [
1495 libc_cv_cc_submachine="$opt"
1496 break], [])
1497 done])
1498 if test "x$libc_cv_cc_submachine" = xno; then
1499 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1500 fi
1501 fi
1502 AC_SUBST(libc_cv_cc_submachine)
1503
1504 dnl Determine if compiler supports -fsignaling-nans
1505 AC_CACHE_CHECK([for compiler option that -fsignaling-nans],
1506 libc_cv_cc_signaling_nans, [dnl
1507 LIBC_TRY_CC_OPTION([-Werror -fsignaling-nans],
1508 [libc_cv_cc_signaling_nans=-fsignaling-nans],
1509 [libc_cv_cc_signaling_nans=])
1510 ])
1511 LIBC_CONFIG_VAR([config-cflags-signaling-nans],
1512 [$libc_cv_cc_signaling_nans])
1513
1514 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1515 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1516 cat > conftest.c <<EOF
1517 void
1518 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1519 foo (void) {}
1520 EOF
1521 libc_cv_cc_loop_to_function=no
1522 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1523 then
1524 libc_cv_cc_loop_to_function=yes
1525 fi
1526 rm -f conftest*])
1527 if test $libc_cv_cc_loop_to_function = yes; then
1528 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1529 fi
1530 AC_SUBST(libc_cv_cc_loop_to_function)
1531
1532 dnl Check whether we have the gd library available.
1533 AC_MSG_CHECKING(for libgd)
1534 if test "$with_gd" != "no"; then
1535 old_CFLAGS="$CFLAGS"
1536 CFLAGS="$CFLAGS $libgd_include"
1537 old_LDFLAGS="$LDFLAGS"
1538 LDFLAGS="$LDFLAGS $libgd_ldflags"
1539 old_LIBS="$LIBS"
1540 LIBS="$LIBS -lgd -lpng -lz -lm"
1541 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])],
1542 [LIBGD=yes], [LIBGD=no])
1543 CFLAGS="$old_CFLAGS"
1544 LDFLAGS="$old_LDFLAGS"
1545 LIBS="$old_LIBS"
1546 else
1547 LIBGD=no
1548 fi
1549 AC_MSG_RESULT($LIBGD)
1550 AC_SUBST(LIBGD)
1551
1552 # SELinux detection
1553 if test x$with_selinux = xno ; then
1554 have_selinux=no;
1555 else
1556 # See if we have the SELinux library
1557 AC_CHECK_LIB(selinux, is_selinux_enabled,
1558 have_selinux=yes, have_selinux=no)
1559 if test x$with_selinux = xyes ; then
1560 if test x$have_selinux = xno ; then
1561 AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
1562 fi
1563 fi
1564 fi
1565 # Check if we're building with SELinux support.
1566 if test "x$have_selinux" = xyes; then
1567 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
1568
1569 # See if we have the libaudit library
1570 AC_CHECK_LIB(audit, audit_log_user_avc_message,
1571 have_libaudit=yes, have_libaudit=no)
1572 if test "x$have_libaudit" = xyes; then
1573 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
1574 fi
1575 AC_SUBST(have_libaudit)
1576
1577 # See if we have the libcap library
1578 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
1579 if test "x$have_libcap" = xyes; then
1580 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
1581 fi
1582 AC_SUBST(have_libcap)
1583 fi
1584 AC_SUBST(have_selinux)
1585
1586 CPPUNDEFS=
1587 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
1588 dnl Since we are building the implementations of the fortified functions here,
1589 dnl having the macro defined interacts very badly.
1590 dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1)
1591 dnl and above (see "man FEATURE_TEST_MACROS").
1592 dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE.
1593 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
1594 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1595 #ifdef _FORTIFY_SOURCE
1596 # error bogon
1597 #endif]])],
1598 [libc_cv_predef_fortify_source=no],
1599 [libc_cv_predef_fortify_source=yes])])
1600 if test $libc_cv_predef_fortify_source = yes; then
1601 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
1602 fi
1603 AC_SUBST(CPPUNDEFS)
1604
1605 dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
1606 dnl to one symbol (PR 23840).
1607 AC_CACHE_CHECK(whether the assembler requires one version per symbol,
1608 libc_cv_symver_needs_alias, [dnl
1609 cat > conftest.s <<EOF
1610 .text
1611 testfunc:
1612 .globl testfunc
1613 .symver testfunc, testfunc1@VERSION1
1614 .symver testfunc, testfunc1@VERSION2
1615 EOF
1616 libc_cv_symver_needs_alias=no
1617 if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then
1618 libc_cv_symver_needs_alias=no
1619 else
1620 libc_cv_symver_needs_alias=yes
1621 fi
1622 rm conftest.*
1623 ])
1624 if test "$libc_cv_symver_needs_alias" = yes; then
1625 AC_DEFINE(SYMVER_NEEDS_ALIAS)
1626 fi
1627
1628 AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
1629 libc_cv_builtin_trap, [dnl
1630 libc_cv_builtin_trap=no
1631 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[
1632 libc_undefs=`$NM -u conftest.o |
1633 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
1634 2>&AS_MESSAGE_LOG_FD` || {
1635 AC_MSG_ERROR([confusing output from $NM -u])
1636 }
1637 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
1638 if test -z "$libc_undefs"; then
1639 libc_cv_builtin_trap=yes
1640 fi],[])])
1641 if test $libc_cv_builtin_trap = yes; then
1642 AC_DEFINE([HAVE_BUILTIN_TRAP])
1643 fi
1644
1645 dnl C++ feature tests.
1646 AC_LANG_PUSH([C++])
1647
1648 AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
1649 libc_cv_cxx_thread_local, [
1650 old_CXXFLAGS="$CXXFLAGS"
1651 CXXFLAGS="$CXXFLAGS -std=gnu++11"
1652 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1653 #include <thread>
1654
1655 // Compiler support.
1656 struct S
1657 {
1658 S ();
1659 ~S ();
1660 };
1661 thread_local S s;
1662 S * get () { return &s; }
1663
1664 // libstdc++ support.
1665 #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
1666 #error __cxa_thread_atexit_impl not supported
1667 #endif
1668 ])],
1669 [libc_cv_cxx_thread_local=yes],
1670 [libc_cv_cxx_thread_local=no])
1671 CXXFLAGS="$old_CXXFLAGS"
1672 ])
1673 AC_SUBST(libc_cv_cxx_thread_local)
1674
1675 AC_LANG_POP([C++])
1676 dnl End of C++ feature tests.
1677
1678 ### End of automated tests.
1679 ### Now run sysdeps configure fragments.
1680
1681 # They also can set these variables.
1682 use_ldconfig=no
1683 ldd_rewrite_script=no
1684 libc_cv_sysconfdir=$sysconfdir
1685 libc_cv_localstatedir=$localstatedir
1686 libc_cv_gcc_unwind_find_fde=no
1687 libc_cv_idn=no
1688 pthread_in_libc=yes
1689
1690 # Iterate over all the sysdep directories we will use, running their
1691 # configure fragments.
1692 for dir in $sysnames; do
1693 case $dir in
1694 /*) dest=$dir ;;
1695 *) dest=$srcdir/$dir ;;
1696 esac
1697 if test -r $dest/configure; then
1698 AC_MSG_RESULT(running configure fragment for $dir)
1699 . $dest/configure
1700 fi
1701 done
1702
1703 if test x"$build_mathvec" = xnotset; then
1704 build_mathvec=no
1705 fi
1706 LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
1707
1708 AC_SUBST(libc_extra_cflags)
1709 AC_SUBST(libc_extra_cppflags)
1710
1711 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
1712 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
1713 fi
1714 AC_SUBST(libc_cv_gcc_unwind_find_fde)
1715
1716 # A sysdeps configure fragment can reset this if IFUNC is not actually
1717 # usable even though the assembler knows how to generate the symbol type.
1718 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
1719 AC_DEFINE(HAVE_IFUNC)
1720 fi
1721 LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
1722
1723 if test x"$libc_cv_gcc_indirect_function" = xyes; then
1724 AC_DEFINE(HAVE_GCC_IFUNC)
1725 fi
1726 LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
1727
1728 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
1729 # configure fragment can override the value to prevent this AC_DEFINE.
1730 AC_SUBST(use_nscd)
1731 if test "x$use_nscd" != xno; then
1732 AC_DEFINE([USE_NSCD])
1733 fi
1734 if test "x$build_nscd" = xdefault; then
1735 build_nscd=$use_nscd
1736 fi
1737
1738 AC_SUBST(libc_cv_slibdir)
1739 AC_SUBST(libc_cv_rtlddir)
1740 AC_SUBST(libc_cv_complocaledir)
1741 AC_SUBST(libc_cv_sysconfdir)
1742 AC_SUBST(libc_cv_localstatedir)
1743 AC_SUBST(libc_cv_rootsbindir)
1744
1745 if test x$use_ldconfig = xyes; then
1746 AC_DEFINE(USE_LDCONFIG)
1747 fi
1748 AC_SUBST(use_ldconfig)
1749 AC_SUBST(ldd_rewrite_script)
1750
1751 AC_SUBST(static)
1752 AC_SUBST(shared)
1753
1754 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
1755 [libc_cv_pic_default=yes
1756 cat > conftest.c <<EOF
1757 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
1758 # error PIC is default.
1759 #endif
1760 EOF
1761 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1762 libc_cv_pic_default=no
1763 fi
1764 rm -f conftest.*])
1765 LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
1766
1767 AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
1768 [libc_cv_cc_pie_default=yes
1769 cat > conftest.c <<EOF
1770 #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
1771 # error PIE is default.
1772 #endif
1773 EOF
1774 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
1775 libc_cv_cc_pie_default=no
1776 fi
1777 rm -f conftest.*])
1778 LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
1779
1780 AC_MSG_CHECKING(if we can build programs as PIE)
1781 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
1782 # error PIE is not supported
1783 #endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no])
1784 AC_MSG_RESULT($libc_cv_pie_supported)
1785 # Disable build-pie-default if target does not support it or glibc is
1786 # configured with --disable-default-pie.
1787 if test "x$default_pie" = xno; then
1788 build_pie_default=no
1789 else
1790 build_pie_default=$libc_cv_pie_supported
1791 fi
1792 LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default])
1793
1794 AC_MSG_CHECKING(if we can build static PIE programs)
1795 libc_cv_static_pie_supported=$libc_cv_pie_supported
1796 if test "x$libc_cv_pie_supported" != xno \
1797 -a "$libc_cv_no_dynamic_linker" = yes; then
1798 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
1799 # error static PIE is not supported
1800 #endif]])], [libc_cv_static_pie_supported=yes],
1801 [libc_cv_static_pie_supported=no])
1802 fi
1803 AC_MSG_RESULT($libc_cv_static_pie_supported)
1804
1805 # Enable static-pie only if it is available and glibc isn't configured
1806 # with --disable-default-pie.
1807 if test "x$default_pie" = xno; then
1808 libc_cv_static_pie=no
1809 else
1810 libc_cv_static_pie=$libc_cv_static_pie_supported
1811 fi
1812 if test "$libc_cv_static_pie" = "yes"; then
1813 AC_DEFINE(ENABLE_STATIC_PIE)
1814 fi
1815 LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
1816
1817 # Set the `multidir' variable by grabbing the variable from the compiler.
1818 # We do it once and save the result in a generated makefile.
1819 libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
1820 AC_SUBST(libc_cv_multidir)
1821
1822 AC_SUBST(profile)
1823 AC_SUBST(static_nss)
1824
1825 AC_SUBST(DEFINES)
1826
1827 dnl See sysdeps/mach/configure.ac for this variable.
1828 AC_SUBST(mach_interface_list)
1829
1830 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
1831 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
1832 AC_SUBST(VERSION)
1833 AC_SUBST(RELEASE)
1834
1835 if test "$pthread_in_libc" = yes; then
1836 AC_DEFINE(PTHREAD_IN_LIBC)
1837 fi
1838 AC_SUBST(pthread_in_libc)
1839
1840 AC_CONFIG_FILES([config.make Makefile])
1841 AC_CONFIG_COMMANDS([default],[[
1842 case $CONFIG_FILES in *config.make*)
1843 echo "$config_vars" >> config.make;;
1844 esac
1845 test -d bits || mkdir bits]],[[config_vars='$config_vars']])
1846 AC_OUTPUT