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