]> git.ipfire.org Git - thirdparty/glibc.git/blame - configure.in
PowerPC: Enable POWER8 platform sans hwcap bits.
[thirdparty/glibc.git] / configure.in
CommitLineData
f4017d20 1dnl Process this file with autoconf to produce a configure script.
f7934be8 2dnl Note we do not use AC_PREREQ here! See aclocal.m4 for what we use instead.
f318beb8 3AC_INIT([GNU C Library], [(see version.h)], [http://sourceware.org/bugzilla/], [glibc])
5d77b1da 4AC_CONFIG_SRCDIR([include/features.h])
6b7f6183
RM
5AC_CONFIG_HEADERS([config.h])
6AC_CONFIG_AUX_DIR([scripts])
28f540f4 7
8b748aed
JM
8ACX_PKGVERSION([GNU libc])
9ACX_BUGURL([http://www.gnu.org/software/libc/bugs.html])
10AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
11 [Package description])
12AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
13 [Bug reporting address])
14
918b5606
L
15# Glibc should not depend on any header files
16AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
17 [m4_divert_text([DEFAULTS],
18 [ac_includes_default='/* none */'])])
19
bb931195
TS
20# We require GCC, and by default use its preprocessor. Override AC_PROG_CPP
21# here to work around the Autoconf issue discussed in
22# <http://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
23AC_DEFUN([AC_PROG_CPP],
24[AC_REQUIRE([AC_PROG_CC])dnl
25AC_ARG_VAR([CPP], [C preprocessor])dnl
26_AC_ARG_VAR_CPPFLAGS()dnl
27# On Suns, sometimes $CPP names a directory.
28if test -n "$CPP" && test -d "$CPP"; then
29 CPP=
30fi
31if test -z "$CPP"; then
32 CPP="$CC -E"
33fi
34AC_SUBST(CPP)dnl
35])# AC_PROG_CPP
36
b5a5da23
TS
37# We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf
38# issue discussed in
39# <http://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
40AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
41
7967983f
RM
42dnl This is here so we can set $subdirs directly based on configure fragments.
43AC_CONFIG_SUBDIRS()
44
c16a054d
AS
45AC_CANONICAL_HOST
46
c0bac8b0
UD
47AC_PROG_CC
48if test $host != $build; then
49 AC_CHECK_PROGS(BUILD_CC, gcc cc)
50fi
51AC_SUBST(cross_compiling)
52AC_PROG_CPP
53# We need the C++ compiler only for testing.
54AC_PROG_CXX
0cae3f4b 55AC_CHECK_TOOL(READELF, readelf, false)
c0bac8b0 56
c72637d4
RM
57if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
58 AC_MSG_ERROR([you must configure in a separate build directory])
59fi
60
28f540f4
RM
61# This will get text that should go into config.make.
62config_vars=
63
c8f3e6db 64# Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
6b7f6183 65AC_ARG_WITH([gd],
77e8bddf
AS
66 AC_HELP_STRING([--with-gd=DIR],
67 [find libgd include dir and library with prefix DIR]),
c8f3e6db
UD
68 [dnl
69case "$with_gd" in
f5f7239f
UD
70yes|''|no) ;;
71*) libgd_include="-I$withval/include"
c8f3e6db
UD
72 libgd_ldflags="-L$withval/lib" ;;
73esac
74])
6b7f6183 75AC_ARG_WITH([gd-include],
77e8bddf
AS
76 AC_HELP_STRING([--with-gd-include=DIR],
77 [find libgd include files in DIR]),
78 [dnl
f5f7239f
UD
79case "$with_gd_include" in
80''|no) ;;
81*) libgd_include="-I$withval" ;;
82esac
83])
6b7f6183 84AC_ARG_WITH([gd-lib],
77e8bddf
AS
85 AC_HELP_STRING([--with-gd-lib=DIR],
86 [find libgd library files in DIR]),
87 [dnl
f5f7239f
UD
88case "$with_gd_lib" in
89''|no) ;;
90*) libgd_ldflags="-L$withval" ;;
91esac
92])
93
94if test -n "$libgd_include"; then
95 config_vars="$config_vars
cf90163d 96CFLAGS-memusagestat.c = $libgd_include"
f5f7239f
UD
97fi
98if test -n "$libgd_ldflags"; then
99 config_vars="$config_vars
100libgd-LDFLAGS = $libgd_ldflags"
101fi
28f540f4 102
ff3d7ed3 103dnl Arguments to specify presence of other packages/features.
6b7f6183 104AC_ARG_WITH([fp],
77e8bddf
AS
105 AC_HELP_STRING([--with-fp],
106 [if using floating-point hardware @<:@default=yes@:>@]),
6b7f6183
RM
107 [with_fp=$withval],
108 [with_fp=yes])
675322a5 109AC_SUBST(with_fp)
6b7f6183 110AC_ARG_WITH([binutils],
77e8bddf
AS
111 AC_HELP_STRING([--with-binutils=PATH],
112 [specify location of binutils (as and ld)]),
6b7f6183
RM
113 [path_binutils=$withval],
114 [path_binutils=''])
2fff3d93 115AC_ARG_WITH([selinux],
77e8bddf
AS
116 AC_HELP_STRING([--with-selinux],
117 [if building with SELinux support]),
2fff3d93
UD
118 [with_selinux=$withval],
119 [with_selinux=auto])
28f540f4 120
6b7f6183 121AC_ARG_WITH([headers],
77e8bddf
AS
122 AC_HELP_STRING([--with-headers=PATH],
123 [location of system headers to use
6b7f6183
RM
124 (for example /usr/src/linux/include)
125 @<:@default=compiler default@:>@]),
126 [sysheaders=$withval],
127 [sysheaders=''])
c91c505f 128AC_SUBST(sysheaders)
dbe7a0f5 129
f781ef40
RM
130AC_SUBST(use_default_link)
131AC_ARG_WITH([default-link],
132 AC_HELP_STRING([--with-default-link],
fd5e21c7 133 [do not use explicit linker scripts]),
f781ef40 134 [use_default_link=$withval],
fd5e21c7 135 [use_default_link=default])
f781ef40 136
6b7f6183 137AC_ARG_ENABLE([sanity-checks],
77e8bddf
AS
138 AC_HELP_STRING([--disable-sanity-checks],
139 [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
6b7f6183
RM
140 [enable_sanity=$enableval],
141 [enable_sanity=yes])
a18f587d 142
6b7f6183 143AC_ARG_ENABLE([shared],
77e8bddf 144 AC_HELP_STRING([--enable-shared],
a0da5fe1 145 [build shared library @<:@default=yes if GNU ld@:>@]),
6b7f6183 146 [shared=$enableval],
a0da5fe1 147 [shared=yes])
6b7f6183 148AC_ARG_ENABLE([profile],
77e8bddf
AS
149 AC_HELP_STRING([--enable-profile],
150 [build profiled library @<:@default=no@:>@]),
6b7f6183 151 [profile=$enableval],
11bf311e 152 [profile=no])
6b7f6183 153AC_ARG_ENABLE([versioning],
77e8bddf
AS
154 AC_HELP_STRING([--disable-versioning],
155 [do not include versioning information in the library objects @<:@default=yes if supported@:>@]),
6b7f6183
RM
156 [enable_versioning=$enableval],
157 [enable_versioning=yes])
158
159AC_ARG_ENABLE([oldest-abi],
77e8bddf
AS
160 AC_HELP_STRING([--enable-oldest-abi=ABI],
161 [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
6b7f6183
RM
162 [oldest_abi=$enableval],
163 [oldest_abi=no])
62ab42d6
UD
164if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
165 oldest_abi=default
166else
167 AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
168fi
169AC_SUBST(oldest_abi)
170
740b3dbe
L
171AC_ARG_ENABLE([hardcoded-path-in-tests],
172 AC_HELP_STRING([--enable-hardcoded-path-in-tests],
173 [hardcode newly built glibc path in tests @<:@default=no@:>@]),
174 [hardcoded_path_in_tests=$enableval],
175 [hardcoded_path_in_tests=no])
176AC_SUBST(hardcoded_path_in_tests)
177
35f1e827
UD
178AC_ARG_ENABLE([stackguard-randomization],
179 AC_HELP_STRING([--enable-stackguard-randomization],
180 [initialize __stack_chk_guard canary with a random number at program start]),
181 [enable_stackguard_randomize=$enableval],
182 [enable_stackguard_randomize=no])
183if test "$enable_stackguard_randomize" = yes; then
184 AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
185fi
186
6b3a2224 187dnl Generic infrastructure for drop-in additions to libc.
6b7f6183 188AC_ARG_ENABLE([add-ons],
77e8bddf
AS
189 AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
190 [configure and build add-ons in DIR1,DIR2,...
191 search for add-ons if no parameter given]),
e0a3ed4f 192 , [enable_add_ons=yes])
61952351 193
6b7f6183 194AC_ARG_ENABLE([hidden-plt],
77e8bddf
AS
195 AC_HELP_STRING([--disable-hidden-plt],
196 [do not hide internal function calls to avoid PLT]),
6b7f6183
RM
197 [hidden=$enableval],
198 [hidden=yes])
749a9a4f
RM
199if test "x$hidden" = xno; then
200 AC_DEFINE(NO_HIDDEN)
201fi
202
4df8c11d
UD
203AC_ARG_ENABLE([bind-now],
204 AC_HELP_STRING([--enable-bind-now],
205 [disable lazy relocations in DSOs]),
206 [bindnow=$enableval],
207 [bindnow=no])
208AC_SUBST(bindnow)
209
5107cf1d
UD
210dnl On some platforms we cannot use dynamic loading. We must provide
211dnl static NSS modules.
6b7f6183 212AC_ARG_ENABLE([static-nss],
77e8bddf
AS
213 AC_HELP_STRING([--enable-static-nss],
214 [build static NSS modules @<:@default=no@:>@]),
6b7f6183
RM
215 [static_nss=$enableval],
216 [static_nss=no])
834cef7c
UD
217dnl Enable static NSS also if we build no shared objects.
218if test x"$static_nss" = xyes || test x"$shared" = xno; then
3172f58f 219 static_nss=yes
5107cf1d
UD
220 AC_DEFINE(DO_STATIC_NSS)
221fi
222
6b7f6183 223AC_ARG_ENABLE([force-install],
77e8bddf
AS
224 AC_HELP_STRING([--disable-force-install],
225 [don't force installation of files from this package, even if they are older than the installed files]),
6b7f6183
RM
226 [force_install=$enableval],
227 [force_install=yes])
73237de3
UD
228AC_SUBST(force_install)
229
958f238f
UD
230dnl On some platforms we allow dropping compatibility with all kernel
231dnl versions.
6b7f6183 232AC_ARG_ENABLE([kernel],
77e8bddf
AS
233 AC_HELP_STRING([--enable-kernel=VERSION],
234 [compile for compatibility with kernel not older than VERSION]),
6b7f6183
RM
235 [minimum_kernel=$enableval],
236 [])
86cfe82d
UD
237dnl Prevent unreasonable values.
238if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
239 # Better nothing than this.
240 minimum_kernel=""
269e369f
UD
241else
242 if test "$minimum_kernel" = current; then
243 minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
244 fi
86cfe82d 245fi
958f238f 246
6cc7d725
UD
247dnl For the development we sometimes want gcc to issue even more warnings.
248dnl This is not the default since many of the extra warnings are not
249dnl appropriate.
6b7f6183
RM
250AC_ARG_ENABLE([all-warnings],
251 AC_HELP_STRING([--enable-all-warnings],
77e8bddf 252 [enable all useful warnings gcc can issue]),
6b7f6183
RM
253 [all_warnings=$enableval],
254 [])
6cc7d725
UD
255AC_SUBST(all_warnings)
256
425ce2ed
UD
257AC_ARG_ENABLE([multi-arch],
258 AC_HELP_STRING([--enable-multi-arch],
259 [enable single DSO with optimizations for multiple architectures]),
260 [multi_arch=$enableval],
6f89d2f3 261 [multi_arch=default])
425ce2ed 262
ff886b82
UD
263AC_ARG_ENABLE([nss-crypt],
264 AC_HELP_STRING([--enable-nss-crypt],
265 [enable libcrypt to use nss]),
266 [nss_crypt=$enableval],
267 [nss_crypt=no])
268if test x$nss_crypt = xyes; then
269 nss_includes=-I$(nss-config --includedir 2>/dev/null)
270 if test $? -ne 0; then
271 AC_MSG_ERROR([cannot find include directory with nss-config])
272 fi
273 old_CFLAGS="$CFLAGS"
274 CFLAGS="$CFLAGS $nss_includes"
b68e08db 275 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
ff886b82
UD
276#include <hasht.h>
277#include <nsslowhash.h>
b68e08db 278void f (void) { NSSLOW_Init (); }])],
ff886b82
UD
279 libc_cv_nss_crypt=yes,
280 AC_MSG_ERROR([
281cannot find NSS headers with lowlevel hash function interfaces]))
282 old_LIBS="$LIBS"
283 LIBS="$LIBS -lfreebl3"
284 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
285#include <hasht.h>
286#include <nsslowhash.h>],
287 [NSSLOW_Init();])],
288 libc_cv_nss_crypt=yes,
289 AC_MSG_ERROR([
290cannot link program using lowlevel NSS hash functions]))
291 CFLAGS="$old_CFLAGS"
292 LIBS="$old_LIBS"
293else
294 libc_cv_nss_crypt=no
295fi
296AC_SUBST(libc_cv_nss_crypt)
297
3a097cc7 298
021db4be
AJ
299AC_ARG_ENABLE([obsolete-rpc],
300 AC_HELP_STRING([--enable-obsolete-rpc],
301 [build and install the obsolete RPC code for link-time usage]),
302 [link_obsolete_rpc=$enableval],
303 [link_obsolete_rpc=no])
304AC_SUBST(link_obsolete_rpc)
305
306if test "$link_obsolete_rpc" = yes; then
307 AC_DEFINE(LINK_OBSOLETE_RPC)
308fi
309
3a097cc7
RM
310AC_ARG_ENABLE([systemtap],
311 [AS_HELP_STRING([--enable-systemtap],
312 [enable systemtap static probe points @<:@default=no@:>@])],
313 [systemtap=$enableval],
314 [systemtap=no])
315if test "x$systemtap" != xno; then
316 AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
317 old_CFLAGS="$CFLAGS"
318 CFLAGS="-std=gnu99 $CFLAGS"
0e3933b9 319 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
3a097cc7
RM
320void foo (int i, void *p)
321{
322 asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
323 :: STAP_PROBE_ASM_OPERANDS (2, i, p));
0e3933b9 324}]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
3a097cc7
RM
325 CFLAGS="$old_CFLAGS"])
326 if test $libc_cv_sdt = yes; then
327 AC_DEFINE([USE_STAP_PROBE])
328 elif test "x$systemtap" != xauto; then
329 AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
330 fi
331fi
332
c53d909c
RM
333AC_ARG_ENABLE([build-nscd],
334 [AS_HELP_STRING([--disable-build-nscd],
335 [disable building and installing the nscd daemon])],
336 [build_nscd=$enableval],
337 [build_nscd=default])
338AC_SUBST(build_nscd)
339
3cc3ef96
RM
340# Note the use of $use_nscd is near the bottom of the file.
341AC_ARG_ENABLE([nscd],
342 [AS_HELP_STRING([--disable-nscd],
343 [library functions will not contact the nscd daemon])],
344 [use_nscd=$enableval],
345 [use_nscd=yes])
346
8a523922
UD
347# The way shlib-versions is used to generate soversions.mk uses a
348# fairly simplistic model for name recognition that can't distinguish
349# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
350# of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
351# tell. This doesn't get used much beyond that, so it's fairly safe.
352case "$host_os" in
353linux*)
354 ;;
355gnu*)
356 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
357 ;;
358esac
359
28f540f4
RM
360# We keep the original values in `$config_*' and never modify them, so we
361# can write them unchanged into config.make. Everything else uses
362# $machine, $vendor, and $os, and changes them whenever convenient.
363config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
364
2f64b655
UD
365# Don't allow vendor == "unknown"
366test "$config_vendor" = unknown && config_vendor=
367config_os="`echo $config_os | sed 's/^unknown-//'`"
368
a2fe9c76 369# Some configurations imply other options.
0269750c 370elf=yes
a2fe9c76 371
8f73811b
RM
372# The configure fragment of an add-on port can modify these to supplement
373# or override the table in the case statement below. No fragment should
374# ever change the config_* variables, however.
28f540f4
RM
375machine=$config_machine
376vendor=$config_vendor
377os=$config_os
b22d21b3 378base_os=''
28f540f4 379
a808d541
UD
380# config.guess on some IBM machines says `rs6000' instead of `powerpc'.
381# Unify this here.
382if test "$machine" = rs6000; then
383 machine="powerpc"
384fi
385
f4b07664
RM
386# Braindead PowerPC box with absolutely no FPU.
387case "$machine-$host_os" in
388 powerpc*-*soft)
389 with_fp=no
390 ;;
391esac
392
2ceaa76a
RM
393submachine=
394AC_ARG_WITH([cpu],
395 AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
396 [dnl
397 case "$withval" in
398 yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
399 no) ;;
400 *) submachine="$withval" ;;
401 esac
402])
403
10a803e0
RM
404dnl Let sysdeps/*/preconfigure act here, like they can in add-ons.
405LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
406
e0a3ed4f 407# An add-on can set this when it wants to disable the sanity check below.
8f73811b
RM
408libc_config_ok=no
409
410dnl Having this here, though empty, makes sure that if add-ons' fragments
411dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
412dnl our AC_OUTPUT will actually use it.
413AC_CONFIG_SUBDIRS()
414
e0a3ed4f
RM
415case "$enable_add_ons" in
416''|no) add_ons= ;;
417yes|'*')
418 add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
419 sed 's@/[[^/]]*$@@' | sort | uniq`
420 add_ons_automatic=yes
421 ;;
422*) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
423 add_ons_automatic=no ;;
424esac
425
426configured_add_ons=
8f73811b
RM
427add_ons_sfx=
428add_ons_pfx=
429if test x"$add_ons" != x; then
430 for f in $add_ons; do
431 # Some sanity checks
432 case "$f" in
433 crypt)
434 AC_MSG_ERROR([
435*** It seems that you're using an old \`crypt' add-on. crypt is now
436*** part of glibc and using the old add-on will not work with this
437*** release. Start again with fresh sources and without the old
438*** \`crypt' add-on.])
439 ;;
440 localedata)
441 AC_MSG_ERROR([
442*** It seems that you're using an old \`localedata' add-on. localedata
443*** is now part of glibc and using the old add-on will not work with
444*** this release. Start again with fresh sources and without the old
445*** \`localedata' add-on.])
446 ;;
447 esac
8f73811b
RM
448 done
449
9382fcee 450 # Now source each add-on's configure fragment.
c80e931a
RM
451 # The fragments can use $srcdir/$libc_add_on to find themselves,
452 # and test $add_ons_automatic to see if they were explicitly requested.
453 # A fragment can clear (or even change) $libc_add_on to affect
454 # whether it goes into the list to be actually used in the build.
455 use_add_ons=
9382fcee 456 for libc_add_on in $add_ons; do
e0a3ed4f
RM
457 # Test whether such a directory really exists.
458 # It can be absolute, or relative to $srcdir, or relative to the build dir.
459 case "$libc_add_on" in
460 /*)
461 libc_add_on_srcdir=$libc_add_on
462 ;;
463 *)
464 test -d "$srcdir/$libc_add_on" || {
77e8bddf 465 if test -d "$libc_add_on"; then
e0a3ed4f
RM
466 libc_add_on="`pwd`/$libc_add_on"
467 else
468 AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
469 fi
470 }
471 libc_add_on_srcdir=$srcdir/$libc_add_on
472 ;;
473 esac
474
475 libc_add_on_frag=$libc_add_on_srcdir/configure
476 libc_add_on_canonical=
7967983f 477 libc_add_on_config_subdirs=
e0a3ed4f
RM
478 if test -r "$libc_add_on_frag"; then
479 AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
480 libc_add_on_canonical=unknown
481 libc_add_on_subdirs=
482 . "$libc_add_on_frag"
483 test -z "$libc_add_on" || {
77e8bddf 484 configured_add_ons="$configured_add_ons $libc_add_on"
e0a3ed4f
RM
485 if test "x$libc_add_on_canonical" = xunknown; then
486 AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
487 fi
488 for d in $libc_add_on_subdirs; do
489 case "$libc_add_on" in
490 /*) subdir_srcdir="$libc_add_on" ;;
491 *) subdir_srcdir="\$(..)$libc_add_on" ;;
492 esac
493 case "$d" in
494 .)
495 d="${libc_add_on_canonical:-$libc_add_on}"
496 ;;
497 /*)
498 subdir_srcdir="$d"
499 ;;
500 *)
501 subdir_srcdir="$subdir_srcdir/$d"
502 ;;
503 esac
504 d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
505 add_on_subdirs="$add_on_subdirs $d"
506 test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
507$d-srcdir = $subdir_srcdir"
508 done
7967983f
RM
509 for d in $libc_add_on_config_subdirs; do
510 case "$d" in
511 /*) AC_MSG_ERROR(dnl
512fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
513 esac
514 if test ! -d "$libc_add_on_srcdir/$d"; then
515 AC_MSG_ERROR(fragment wants to configure missing directory $d)
516 fi
517 case "$libc_add_on" in
518 /*) AC_MSG_ERROR(dnl
519relative path required for add-on using \$libc_add_on_config_subdirs) ;;
520 esac
521 subdirs="$subdirs $libc_add_on/$d"
522 done
e0a3ed4f 523 }
8f73811b 524 fi
619f9448 525 if test -n "$libc_add_on"; then
10a803e0 526 LIBC_PRECONFIGURE([$libc_add_on_srcdir], [add-on $libc_add_on for])
619f9448
RM
527 use_add_ons="$use_add_ons $libc_add_on"
528 add_ons_pfx="$add_ons_pfx $libc_add_on/"
e0a3ed4f
RM
529 test -z "$libc_add_on_canonical" ||
530 add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
619f9448 531 fi
8f73811b 532 done
c80e931a
RM
533 # Use echo to strip excess whitespace.
534 add_ons="`echo $use_add_ons`"
8f73811b
RM
535fi
536AC_SUBST(add_ons)
e0a3ed4f 537AC_SUBST(add_on_subdirs)
8f73811b
RM
538
539
bdc8eb03
UD
540###
541### I put this here to prevent those annoying emails from people who cannot
542### read and try to compile glibc on unsupported platforms. --drepper
543###
544### By using the undocumented --enable-hacker-mode option for configure
545### one can skip this test to make the configuration not fail for unsupported
546### platforms.
547###
8f73811b 548if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
bdc8eb03 549 case "$machine-$host_os" in
2ce4f015 550 *-linux* | *-gnu*)
bdc8eb03
UD
551 ;;
552 *)
553 echo "*** The GNU C library is currently not available for this platform."
554 echo "*** So far nobody cared to port it and if there is no volunteer it"
555 echo "*** might never happen. So, if you have interest to see glibc on"
556 echo "*** this platform visit"
557 echo "*** http://www.gnu.org/software/libc/porting.html"
558 echo "*** and join the group of porters"
559 exit 1
560 ;;
561 esac
562fi
563
28f540f4
RM
564dnl We need to use [ and ] for other purposes for a while now.
565changequote(,)dnl
566# Expand the configuration machine name into a subdirectory by architecture
8f73811b
RM
567# type and particular chip. If an add-on configure fragment already set
568# base_machine, we don't change it.
569test -n "$base_machine" || case "$machine" in
0f122b8d 570i[4567]86) base_machine=i386 machine=i386/$machine ;;
92b27c74
UD
571powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
572powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
136d4332
UD
573s390) base_machine=s390 machine=s390/s390-32 ;;
574s390x) base_machine=s390 machine=s390/s390-64 ;;
88615235
UD
575sh3*) base_machine=sh machine=sh/sh3 ;;
576sh4*) base_machine=sh machine=sh/sh4 ;;
ca34d7a7
UD
577sparc | sparcv[67])
578 base_machine=sparc machine=sparc/sparc32 ;;
579sparcv8 | supersparc | hypersparc)
580 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
ae6b8730
RH
581sparcv8plus | sparcv8plusa | sparcv9)
582 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
bb769ab6 583sparcv8plusb | sparcv9b)
10c6e709 584 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
2d73656b
RM
585sparcv9v)
586 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
46ae8850
JJ
587sparcv9v2)
588 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
b1ecbed2 589sparc64)
ca34d7a7 590 base_machine=sparc machine=sparc/sparc64 ;;
b1ecbed2 591sparc64b)
bb769ab6 592 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
2d73656b
RM
593sparc64v)
594 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
46ae8850
JJ
595sparc64v2)
596 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
3a2832a0 597*) base_machine=$machine ;;
28f540f4 598esac
f0523145
RM
599changequote([,])dnl
600AC_SUBST(base_machine)
28f540f4 601
dfd2257a
UD
602if test "$base_machine" = "i386"; then
603 AC_DEFINE(USE_REGPARMS)
604fi
605
0cae3f4b
MF
606# For the multi-arch option we need support in the assembler & linker.
607AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
608 libc_cv_ld_gnu_indirect_function, [dnl
786b0b67 609cat > conftest.S <<EOF
84b9230c 610.type foo,%gnu_indirect_function
0cae3f4b
MF
611foo:
612.globl _start
613_start:
614.globl __start
615__start:
616.data
786b0b67
AS
617#ifdef _LP64
618.quad foo
619#else
0cae3f4b 620.long foo
786b0b67 621#endif
84b9230c 622EOF
0cae3f4b
MF
623libc_cv_ld_gnu_indirect_function=no
624if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
625 -nostartfiles -nostdlib \
786b0b67 626 -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
0cae3f4b
MF
627 # Do a link to see if the backend supports IFUNC relocs.
628 $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
629 LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
630 libc_cv_ld_gnu_indirect_function=yes
631 }
84b9230c
MF
632fi
633rm -f conftest*])
634
635AC_MSG_CHECKING(whether .text pseudo-op must be used)
636AC_CACHE_VAL(libc_cv_dot_text, [dnl
637cat > conftest.s <<EOF
638.text
639EOF
640libc_cv_dot_text=
641if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
642 libc_cv_dot_text=.text
643fi
644rm -f conftest*])
645if test -z "$libc_cv_dot_text"; then
646 AC_MSG_RESULT(no)
647else
648 AC_MSG_RESULT(yes)
649fi
650
0cae3f4b 651if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
84b9230c
MF
652 if test x"$multi_arch" = xyes; then
653 AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
654 else
655 multi_arch=no
656 fi
657fi
6270516e 658multi_arch_d=
84b9230c
MF
659if test x"$multi_arch" != xno; then
660 multi_arch_d=/multiarch
661fi
662
f0523145 663# Compute the list of sysdep directories for this configuration.
f332db02 664# This can take a while to compute.
f0523145 665sysdep_dir=$srcdir/sysdeps
f332db02 666AC_MSG_CHECKING(sysdep dirs)
f0523145
RM
667dnl We need to use [ and ] for other purposes for a while now.
668changequote(,)dnl
28f540f4
RM
669# Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
670os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
671
b22d21b3 672test "x$base_os" != x || case "$os" in
28f540f4
RM
673gnu*)
674 base_os=mach/hurd ;;
2ce4f015 675linux*)
28f540f4 676 base_os=unix/sysv ;;
28f540f4
RM
677esac
678
679# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
680tail=$os
681ostry=$os
682while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
683 ostry="$ostry /$o"
684 tail=$o
75914335 685done
28f540f4
RM
686o=`echo $tail | sed 's/[0-9]*$//'`
687if test $o != $tail; then
688 ostry="$ostry /$o"
689fi
ec4b0518
UD
690# For linux-gnu, try linux-gnu, then linux.
691o=`echo $tail | sed 's/-.*$//'`
692if test $o != $tail; then
693 ostry="$ostry /$o"
694fi
28f540f4
RM
695
696# For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
697base=
698tail=$base_os
699while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
700 set $b
701 base="$base /$1"
702 tail="$2"
703done
704
ae6b8730 705# For sparc/sparc32, try sparc/sparc32 and then sparc.
28f540f4 706mach=
2ceaa76a 707tail=$machine${submachine:+/$submachine}
28f540f4
RM
708while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
709 set $m
10ceac89
RM
710 # Prepend the machine's FPU directory unless --without-fp.
711 if test "$with_fp" = yes; then
6270516e 712 maybe_fpu=/fpu
f4b07664 713 else
6270516e 714 maybe_fpu=/nofpu
82d00cab 715 fi
6270516e
RM
716 # For each machine term, try it with and then without /multiarch.
717 for try_fpu in $maybe_fpu ''; do
718 for try_multi in $multi_arch_d ''; do
719 mach="$mach /$1$try_fpu$try_multi"
720 done
721 done
28f540f4
RM
722 tail="$2"
723done
724
725dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
726changequote([,])dnl
727
728# Find what sysdep directories exist.
e0a3ed4f 729sysnames_add_ons=
28f540f4 730sysnames=
4b69abad
RM
731for b in $base ''; do
732 for m0 in $mach ''; do
733 for v in /$vendor ''; do
734 test "$v" = / && continue
735 for o in /$ostry ''; do
736 test "$o" = / && continue
6270516e 737 for m in $mach ''; do
4b69abad 738 for d in $add_ons_pfx ''; do
8f73811b 739 for a in $add_ons_sfx ''; do
1c9f1a02
RM
740 try_suffix="$m0$b$v$o$m"
741 if test -n "$try_suffix"; then
77e8bddf
AS
742 try_srcdir="${srcdir}/"
743 case "$d" in
e0a3ed4f
RM
744 /*) try_srcdir= ;;
745 esac
1c9f1a02 746 try="${d}sysdeps$try_suffix$a"
8f73811b
RM
747 test -n "$enable_debug_configure" &&
748 echo "$0 [DEBUG]: try $try" >&2
e0a3ed4f 749 if test -d "$try_srcdir$try"; then
8f73811b
RM
750 sysnames="$sysnames $try"
751 { test -n "$o" || test -n "$b"; } && os_used=t
752 { test -n "$m" || test -n "$m0"; } && machine_used=t
4b69abad
RM
753 case x${m0:-$m} in
754 x*/$submachine) submachine_used=t ;;
755 esac
e0a3ed4f
RM
756 if test -n "$d"; then
757 case "$sysnames_add_ons" in
758 *" $d "*) ;;
759 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
760 esac
761 fi
8f73811b 762 fi
57ba7bb4 763 fi
8f73811b 764 done
57ba7bb4 765 done
28f540f4
RM
766 done
767 done
768 done
769 done
4b69abad 770done
28f540f4 771
6f89d2f3
L
772# If the assembler supports gnu_indirect_function symbol type and the
773# architecture supports multi-arch, we enable multi-arch by default.
84b9230c
MF
774case $sysnames_add_ons$sysnames in
775*"$multi_arch_d"*)
776 ;;
777*)
77e8bddf 778 test x"$multi_arch" = xdefault && multi_arch=no
84b9230c
MF
779 ;;
780esac
781if test x"$multi_arch" != xno; then
6f89d2f3
L
782 AC_DEFINE(USE_MULTIARCH)
783fi
784AC_SUBST(multi_arch)
785
28f540f4
RM
786if test -z "$os_used" && test "$os" != none; then
787 AC_MSG_ERROR(Operating system $os is not supported.)
788fi
789if test -z "$machine_used" && test "$machine" != none; then
790 AC_MSG_ERROR(The $machine is not supported.)
791fi
2ceaa76a
RM
792if test -z "$submachine_used" && test -n "$submachine"; then
793 AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
794fi
795AC_SUBST(submachine)
28f540f4
RM
796
797# We have now validated the configuration.
798
28f540f4
RM
799# Expand the list of system names into a full list of directories
800# from each element's parent name and Implies file (if present).
801set $sysnames
e50ec9f9 802names=
28f540f4
RM
803while test $# -gt 0; do
804 name=$1
805 shift
806
e50ec9f9 807 case " $names " in *" $name "*)
f332db02
RM
808 # Already in the list.
809 continue
e50ec9f9 810 esac
f332db02
RM
811
812 # Report each name as we discover it, so there is no long pause in output.
0b4ee387 813 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
f332db02 814
57ba7bb4
UD
815 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
816
817 case $name in
818 /*) xsrcdir= ;;
819 *) xsrcdir=$srcdir/ ;;
820 esac
821 test -n "$enable_debug_configure" &&
822 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
823
ba75122d
RM
824 for implies_file in Implies Implies-before Implies-after; do
825 implies_type=`echo $implies_file | sed s/-/_/`
826 eval ${implies_type}=
827 if test -f $xsrcdir$name/$implies_file; then
828 # Collect more names from the `Implies' file (removing comments).
829 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
830 for x in $implied_candidate; do
831 found=no
832 if test -d $xsrcdir$name_base/$x; then
833 eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
636ccfc8 834 found=yes
ba75122d
RM
835 fi
836 for d in $add_ons_pfx ''; do
837 try="${d}sysdeps/$x"
838 case $d in
839 /*) try_srcdir= ;;
840 *) try_srcdir=$srcdir/ ;;
e0a3ed4f 841 esac
ba75122d
RM
842 test -n "$enable_debug_configure" &&
843 echo "[DEBUG]: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
844 if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
845 then
846 eval "${implies_type}=\"\$${implies_type} \$try\""
847 found=yes
848 case "$sysnames_add_ons" in
849 *" $d "*) ;;
850 *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
851 esac
852 fi
853 done
854 if test $found = no; then
855 AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
636ccfc8
UD
856 fi
857 done
ba75122d
RM
858 fi
859 done
28f540f4
RM
860
861 # Add NAME to the list of names.
862 names="$names $name"
863
864 # Find the parent of NAME, using the empty string if it has none.
865changequote(,)dnl
57ba7bb4 866 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
28f540f4
RM
867changequote([,])dnl
868
ba75122d
RM
869 test -n "$enable_debug_configure" &&
870 echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
57633811 871Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
ba75122d 872
28f540f4
RM
873 # Add the names implied by NAME, and NAME's parent (if it has one), to
874 # the list of names to be processed (the argument list). We prepend the
875 # implied names to the list and append the parent. We want implied
876 # directories to come before further directories inferred from the
877 # configuration components; this ensures that for sysv4, unix/common
878 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
879 # after sysv4).
ba75122d 880 sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
28f540f4
RM
881 test -n "$sysnames" && set $sysnames
882done
883
884# Add the default directories.
83ef87ba 885default_sysnames="sysdeps/generic"
ecdc196c 886sysnames="$names $default_sysnames"
f332db02
RM
887AC_SUBST(sysnames)
888# The other names were emitted during the scan.
ecdc196c 889AC_MSG_RESULT($default_sysnames)
28f540f4 890
e0a3ed4f
RM
891# Collect the list of add-ons that supply partial sysdeps trees.
892sysdeps_add_ons=
893for add_on in $add_ons; do
894 case "$add_on" in
895 /*) xsrcdir= ;;
896 *) xsrcdir="$srcdir/" ;;
897 esac
898
899 test -d "$xsrcdir$add_on/sysdeps" || {
900 case "$configured_add_ons " in
901 *" $add_on "*) ;;
902 *|'')
903 AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
904 ;;
905 esac
906 continue
907 }
908
909 sysdeps_add_ons="$sysdeps_add_ons $add_on"
910 case "$sysnames_add_ons" in
911 *" $add_on/ "*) ;;
912 *|'')
913 AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
914 continue ;;
915 esac
916
917 found=no
918 for d in $sysnames; do
919 case "$d" in
920 $add_on/sysdeps/*) ;;
921 *) continue ;;
922 esac
923 (cd "$xsrcdir$d" && for f in *[[!~]]; do
924 case "$f" in
925 sys|bits)
926 for ff in $f/*.h; do
927 test -d "$ff" || { test -e "$ff" && exit 88; }
928 done
929 ;;
930 *)
77e8bddf 931 test -d "$f" || { test -e "$f" && exit 88; }
e0a3ed4f
RM
932 ;;
933 esac
934 done)
935 if test $? -eq 88; then
936 found=yes
937 break
938 fi
939 done
940 if test $found = no; then
941 AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
942 fi
943done
944AC_SUBST(sysdeps_add_ons)
945
f332db02
RM
946
947### Locate tools.
28f540f4 948
28f540f4 949AC_PROG_INSTALL
2b80a372 950if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
28f540f4 951 # The makefiles need to use a different form to find it in $srcdir.
2b80a372 952 INSTALL='\$(..)./scripts/install-sh -c'
28f540f4 953fi
0e3426bb 954AC_PROG_LN_S
ae828bc6 955
4baa087a 956LIBC_PROG_BINUTILS
4baa087a 957
bec039bc 958# Accept binutils 2.20 or newer.
4baa087a
RM
959AC_CHECK_PROG_VER(AS, $AS, --version,
960 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
bec039bc 961 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
4baa087a
RM
962AC_CHECK_PROG_VER(LD, $LD, --version,
963 [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
bec039bc 964 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
4baa087a 965
63bda0c1 966# These programs are version sensitive.
3a12e572 967AC_CHECK_TOOL_PREFIX
4bca4c17 968AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
0e7727f7 969 [version \([egcygnustpi-]*[0-9.]*\)], [4.[3-9].* | 4.[1-9][0-9].* | [5-9].* ],
90d1d40b 970 critic_missing="$critic_missing gcc")
22e65f8f 971AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
8fc1e2ca 972 [GNU Make[^0-9]*\([0-9][0-9.]*\)],
6b4e880f 973 [3.79* | 3.[89]*], critic_missing="$critic_missing make")
63bda0c1 974
22e65f8f 975AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
bdd421cc 976 [GNU gettext.* \([0-9]*\.[0-9.]*\)],
aefdff34
RM
977 [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
978 MSGFMT=: aux_missing="$aux_missing msgfmt")
63bda0c1 979AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
8b7fb588 980 [GNU texinfo.* \([0-9][0-9.]*\)],
6a3951a0 981 [4.[5-9]*|4.[1-9][0-9]*|[5-9].*],
aefdff34 982 MAKEINFO=: aux_missing="$aux_missing makeinfo")
d6a97a28 983AC_CHECK_PROG_VER(SED, sed, --version,
07e51550 984 [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
aefdff34
RM
985 [3.0[2-9]*|3.[1-9]*|[4-9]*],
986 SED=: aux_missing="$aux_missing sed")
0786794f
AM
987AC_CHECK_PROG_VER(AWK, gawk, --version,
988 [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
12086fb4 989 [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
63bda0c1 990
30b99d79 991AC_CHECK_TOOL(NM, nm, false)
d30cf5bb 992
476e7d78
RM
993AC_CHECK_PROGS(AUTOCONF, autoconf, no)
994case "x$AUTOCONF" in
995xno|x|x:) AUTOCONF=no ;;
996*)
997 AC_CACHE_CHECK(dnl
1400de2e 998whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
476e7d78
RM
999 if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
1000 libc_cv_autoconf_works=yes
1001 else
1002 libc_cv_autoconf_works=no
1003 fi])
1004 test $libc_cv_autoconf_works = yes || AUTOCONF=no
1005 ;;
1006esac
92963737 1007if test "x$AUTOCONF" = xno; then
476e7d78 1008 aux_missing="$aux_missing autoconf"
14519931 1009fi
1400de2e 1010
32a448ed
RM
1011test -n "$critic_missing" && AC_MSG_ERROR([
1012*** These critical programs are missing or too old:$critic_missing
1013*** Check the INSTALL file for required versions.])
1014
4bca4c17 1015test -n "$aux_missing" && AC_MSG_WARN([
9c6fffc0 1016*** These auxiliary programs are missing or incompatible versions:$aux_missing
63bda0c1
UD
1017*** some features will be disabled.
1018*** Check the INSTALL file for required versions.])
28f540f4 1019
dbe7a0f5
UD
1020# if using special system headers, find out the compiler's sekrit
1021# header directory and add that to the list. NOTE: Only does the right
1022# thing on a system that doesn't need fixincludes. (Not presently a problem.)
1023if test -n "$sysheaders"; then
67fbfa5c
RM
1024 SYSINCLUDES=-nostdinc
1025 for d in include include-fixed; do
1026 i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1027 SYSINCLUDES="$SYSINCLUDES -isystem $i"
1028 done
1029 SYSINCLUDES="$SYSINCLUDES \
3d6ce23a 1030-isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
ef226fec 1031 if test -n "$CXX"; then
7872cfb0 1032 CXX_SYSINCLUDES=
67060746
AC
1033 for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1034 | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1035 test "x$cxxheaders" != x &&
1036 CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1037 done
ef226fec 1038 fi
dbe7a0f5
UD
1039fi
1040AC_SUBST(SYSINCLUDES)
ef226fec 1041AC_SUBST(CXX_SYSINCLUDES)
dbe7a0f5 1042
3911660e
UD
1043# Test if LD_LIBRARY_PATH contains the notation for the current directory
1044# since this would lead to problems installing/building glibc.
1045# LD_LIBRARY_PATH contains the current directory if one of the following
1046# is true:
1047# - one of the terminals (":" and ";") is the first or last sign
1048# - two terminals occur directly after each other
1049# - the path contains an element with a dot in it
1050AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1051changequote(,)dnl
1052case ${LD_LIBRARY_PATH} in
1053 [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
b3a86ae1 1054 ld_library_path_setting="contains current directory"
3911660e
UD
1055 ;;
1056 *)
1057 ld_library_path_setting="ok"
1058 ;;
1059esac
1060changequote([,])dnl
1061AC_MSG_RESULT($ld_library_path_setting)
1062if test "$ld_library_path_setting" != "ok"; then
63bda0c1
UD
1063AC_MSG_ERROR([
1064*** LD_LIBRARY_PATH shouldn't contain the current directory when
1065*** building glibc. Please change the environment variable
1066*** and run configure again.])
3911660e 1067fi
8e31cf7e 1068
74bd2300 1069AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
8175a253 1070if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
74bd2300
UD
1071 libc_cv_gcc_static_libgcc=
1072else
1073 libc_cv_gcc_static_libgcc=-static-libgcc
1074fi])
1075AC_SUBST(libc_cv_gcc_static_libgcc)
1076
26f56c1c
UD
1077AC_PATH_PROG(BASH_SHELL, bash, no)
1078if test "$BASH_SHELL" != no &&
1079 $BASH_SHELL -c 'test "$BASH_VERSINFO" \
6973fc01 1080 && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
84384f5b
UD
1081 libc_cv_have_bash2=yes
1082else
1083 libc_cv_have_bash2=no
1084fi
1085AC_SUBST(libc_cv_have_bash2)
1086
5290baf0 1087dnl We need a ksh compatible shell for tzselect.
26f56c1c 1088if test "$BASH_SHELL" = no; then
5290baf0
UD
1089 AC_PATH_PROG(KSH, ksh, no)
1090 if test "$KSH" = no; then
1091 libc_cv_have_ksh=no
1092 else
1093 libc_cv_have_ksh=yes
1094 fi
1095else
26f56c1c 1096 KSH="$BASH_SHELL"
5290baf0
UD
1097 AC_SUBST(KSH)
1098 libc_cv_have_ksh=yes
1099fi
1100AC_SUBST(libc_cv_have_ksh)
1101
c0016081 1102AC_PATH_PROG(PERL, perl, no)
2fd5d029
RM
1103if test "$PERL" != no &&
1104 (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1105 PERL=no
ecb06196 1106fi
2f512715
AS
1107AC_PATH_PROG(INSTALL_INFO, install-info, no,
1108 $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
2de00372
UD
1109AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1110
b8dc6a10 1111AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
28f540f4
RM
1112AC_TRY_COMPILE(dnl
1113[#define __need_size_t
1114#define __need_wchar_t
1115#include <stddef.h>
1116#define __need_NULL
1117#include <stddef.h>], [size_t size; wchar_t wchar;
1118#ifdef offsetof
1119#error stddef.h ignored __need_*
1120#endif
1121if (&size == NULL || &wchar == NULL) abort ();],
77e8bddf
AS
1122 libc_cv_friendly_stddef=yes,
1123 libc_cv_friendly_stddef=no)])
28f540f4
RM
1124if test $libc_cv_friendly_stddef = yes; then
1125 config_vars="$config_vars
1126override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1127fi
1128
b8dc6a10
RM
1129AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1130 libc_cv_need_minus_P, [dnl
28f540f4
RM
1131cat > conftest.S <<EOF
1132#include "confdefs.h"
1133/* Nothing whatsoever. */
1134EOF
3217788f 1135if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
28f540f4
RM
1136 libc_cv_need_minus_P=no
1137else
1138 libc_cv_need_minus_P=yes
1139fi
1140rm -f conftest*])
28f540f4
RM
1141if test $libc_cv_need_minus_P = yes; then
1142 config_vars="$config_vars
1143asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1144fi
1145
b8dc6a10 1146AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
9a70fcab 1147cat > conftest.s <<EOF
2293395f 1148${libc_cv_dot_text}
ae1025be 1149foo:
df2a0c93 1150.set glibc_conftest_frobozz,foo
7b8e0d49 1151.globl glibc_conftest_frobozz
e215c478 1152EOF
df2a0c93
RM
1153# The alpha-dec-osf1 assembler gives only a warning for `.set'
1154# (but it doesn't work), so we must do a linking check to be sure.
1155cat > conftest1.c <<\EOF
1156extern int glibc_conftest_frobozz;
640f0119 1157void _start() { glibc_conftest_frobozz = 1; }
df2a0c93
RM
1158EOF
1159if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
640f0119 1160 -nostartfiles -nostdlib \
0b4ee387 1161 -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
e215c478
RM
1162 libc_cv_asm_set_directive=yes
1163else
1164 libc_cv_asm_set_directive=no
1165fi
65b3cbcb 1166rm -f conftest*])
e215c478
RM
1167if test $libc_cv_asm_set_directive = yes; then
1168 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1169fi
1170
415ac3df
UD
1171AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1172 libc_cv_asm_unique_object, [dnl
1173cat > conftest.s <<EOF
1174${libc_cv_dot_text}
1175_sym:
b67e9372 1176.type _sym, %gnu_unique_object
415ac3df
UD
1177EOF
1178if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1179 libc_cv_asm_unique_object=yes
1180else
1181 libc_cv_asm_unique_object=no
1182fi
1183rm -f conftest*])
1184if test $libc_cv_asm_unique_object = yes; then
1185 AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1186fi
1187
377a515b
UD
1188AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1189[cat > conftest.s <<EOF
2293395f 1190${libc_cv_dot_text}
4cca6b86 1191_sym:
377a515b
UD
1192.symver _sym,sym@VERS
1193EOF
3217788f 1194if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
377a515b
UD
1195 libc_cv_asm_symver_directive=yes
1196else
1197 libc_cv_asm_symver_directive=no
1198fi
1199rm -f conftest*])
1200AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1201if test $libc_cv_asm_symver_directive = yes; then
1202 cat > conftest.s <<EOF
2293395f 1203${libc_cv_dot_text}
4cca6b86 1204_sym:
377a515b
UD
1205.symver _sym,sym@VERS
1206EOF
1207 cat > conftest.map <<EOF
f43ce637 1208VERS_1 {
377a515b
UD
1209 global: sym;
1210};
f43ce637
UD
1211
1212VERS_2 {
77e8bddf 1213 global: sym;
f43ce637 1214} VERS_1;
377a515b 1215EOF
3217788f
RM
1216 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1217 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1218 -o conftest.so conftest.o
1219 -nostartfiles -nostdlib
1220 -Wl,--version-script,conftest.map
c2f55635 1221 1>&AS_MESSAGE_LOG_FD]);
377a515b
UD
1222 then
1223 libc_cv_ld_version_script_option=yes
1224 else
1225 libc_cv_ld_version_script_option=no
1226 fi
1227 else
1228 libc_cv_ld_version_script_option=no
1229 fi
1230else
1231 libc_cv_ld_version_script_option=no
1232fi
1233rm -f conftest*])
7499a22a
RM
1234if test $shared != no &&
1235 test $libc_cv_asm_symver_directive = yes &&
650425ce
UD
1236 test $libc_cv_ld_version_script_option = yes &&
1237 test $enable_versioning = yes; then
377a515b
UD
1238 VERSIONING=yes
1239 AC_DEFINE(DO_VERSIONING)
1240else
1241 VERSIONING=no
1242fi
1243AC_SUBST(VERSIONING)
1244
a0da5fe1 1245if test $shared != no && test $VERSIONING = no; then
f43ce637 1246 echo "\
f4017d20 1247*** WARNING: You should not compile GNU libc without versioning. Not using
f43ce637
UD
1248*** versioning will introduce incompatibilities so that old binaries
1249*** will not run anymore.
50304ef0 1250*** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
f43ce637 1251fi
a0da5fe1
UD
1252AC_CACHE_CHECK(for .previous assembler directive,
1253 libc_cv_asm_previous_directive, [dnl
1254cat > conftest.s <<EOF
fd26970f
UD
1255.section foo_section
1256.previous
a0da5fe1
UD
1257EOF
1258if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1259 libc_cv_asm_previous_directive=yes
1260else
1261 libc_cv_asm_previous_directive=no
1262fi
1263rm -f conftest*])
1264if test $libc_cv_asm_previous_directive = yes; then
1265 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1266else
1267 AC_CACHE_CHECK(for .popsection assembler directive,
1268 libc_cv_asm_popsection_directive, [dnl
1269 cat > conftest.s <<EOF
1270.pushsection foo_section
1271.popsection
fd26970f 1272EOF
3217788f 1273 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
a0da5fe1 1274 libc_cv_asm_popsection_directive=yes
fd26970f 1275 else
a0da5fe1 1276 libc_cv_asm_popsection_directive=no
fd26970f
UD
1277 fi
1278 rm -f conftest*])
a0da5fe1
UD
1279 if test $libc_cv_asm_popsection_directive = yes; then
1280 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
fd26970f 1281 fi
a0da5fe1
UD
1282fi
1283AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1284 libc_cv_asm_protected_directive, [dnl
1285cat > conftest.s <<EOF
2d499f55
UD
1286.protected foo
1287foo:
1288.hidden bar
1289bar:
1290EOF
a0da5fe1
UD
1291if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1292 libc_cv_asm_protected_directive=yes
1293else
1294 AC_MSG_ERROR(assembler support for symbol visibility is required)
1295fi
1296rm -f conftest*])
0fb7851f 1297
a0da5fe1
UD
1298if test $libc_cv_asm_protected_directive = yes; then
1299 AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
0d01dace
UD
1300 libc_cv_visibility_attribute,
1301 [cat > conftest.c <<EOF
1302 int foo __attribute__ ((visibility ("hidden"))) = 1;
1303 int bar __attribute__ ((visibility ("protected"))) = 1;
1304EOF
1305 libc_cv_visibility_attribute=no
61cea1c3 1306 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
0d01dace
UD
1307 if grep '\.hidden.*foo' conftest.s >/dev/null; then
1308 if grep '\.protected.*bar' conftest.s >/dev/null; then
1309 libc_cv_visibility_attribute=yes
1310 fi
1311 fi
1312 fi
f7d82dc9 1313 rm -f conftest.{c,s}
0d01dace 1314 ])
a0da5fe1
UD
1315 if test $libc_cv_visibility_attribute != yes; then
1316 AC_MSG_ERROR(compiler support for visibility attribute is required)
0d01dace 1317 fi
a0da5fe1 1318fi
0d01dace 1319
a0da5fe1
UD
1320if test $libc_cv_visibility_attribute = yes; then
1321 AC_CACHE_CHECK(for broken __attribute__((visibility())),
37ba7d66
UD
1322 libc_cv_broken_visibility_attribute,
1323 [cat > conftest.c <<EOF
1324 int foo (int x);
1325 int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1326 int bar (int x) { return x; }
1327EOF
1328 libc_cv_broken_visibility_attribute=yes
f7d82dc9 1329 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
37ba7d66
UD
1330changequote(,)dnl
1331 if grep '\.hidden[ _]foo' conftest.s >/dev/null; then
1332changequote([,])dnl
1333 libc_cv_broken_visibility_attribute=no
1334 fi
1335 fi
1336 rm -f conftest.c conftest.s
1337 ])
a0da5fe1
UD
1338 if test $libc_cv_broken_visibility_attribute = yes; then
1339 AC_MSG_ERROR(working compiler support for visibility attribute is required)
37ba7d66 1340 fi
a0da5fe1 1341fi
37ba7d66 1342
a0da5fe1
UD
1343AC_CACHE_CHECK(for broken __attribute__((alias())),
1344 libc_cv_broken_alias_attribute,
1345 [cat > conftest.c <<EOF
1346 extern int foo (int x) __asm ("xyzzy");
1347 int bar (int x) { return x; }
1348 extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1349 extern int dfoo;
1350 extern __typeof (dfoo) dfoo __asm ("abccb");
1351 int dfoo = 1;
37ba7d66 1352EOF
a0da5fe1
UD
1353 libc_cv_broken_alias_attribute=yes
1354 if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1355 if grep 'xyzzy' conftest.s >/dev/null &&
1356 grep 'abccb' conftest.s >/dev/null; then
1357 libc_cv_broken_alias_attribute=no
1358 fi
1359 fi
1360 rm -f conftest.c conftest.s
1361 ])
1362if test $libc_cv_broken_alias_attribute = yes; then
1363 AC_MSG_ERROR(working alias attribute support required)
1364fi
1365
1366if test $libc_cv_visibility_attribute = yes; then
1367 AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
0d01dace
UD
1368 libc_cv_have_sdata_section,
1369 [echo "int i;" > conftest.c
1370 libc_cv_have_sdata_section=no
dbc92dc6 1371 if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
0d01dace
UD
1372 | grep '\.sdata' >/dev/null; then
1373 libc_cv_have_sdata_section=yes
1374 fi
1375 rm -f conftest.c conftest.so
1376 ])
a0da5fe1
UD
1377 if test $libc_cv_have_sdata_section = yes; then
1378 AC_DEFINE(HAVE_SDATA_SECTION)
0d01dace 1379 fi
a0da5fe1 1380fi
0d01dace 1381
a0da5fe1
UD
1382AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1383 libc_cv_initfini_array, [dnl
07037eeb 1384LIBC_TRY_LINK_STATIC([
5241882c 1385int foo (void) { return 1; }
2c617417 1386int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
07037eeb
JM
1387],
1388 [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
a0da5fe1 1389 libc_cv_initfini_array=yes
5241882c 1390 else
ce33ee7c 1391 libc_cv_initfini_array=no
07037eeb
JM
1392 fi],
1393 [libc_cv_initfini_array=no])
1394])
a0da5fe1
UD
1395if test $libc_cv_initfini_array != yes; then
1396 AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1397fi
62bede13 1398
a0da5fe1
UD
1399AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1400 libc_cv_ctors_header, [dnl
1401 libc_cv_ctors_header=yes
07037eeb
JM
1402 LIBC_TRY_LINK_STATIC([
1403__attribute__ ((constructor)) void ctor (void) { asm (""); }
1404__attribute__ ((destructor)) void dtor (void) { asm (""); }
113ddea4 1405],
a0da5fe1 1406 [dnl
113ddea4 1407 AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
92963737 1408 { gsub(/\@<:@ */, "@<:@") }
113ddea4
RM
1409 $2 == ".ctors" || $2 == ".dtors" {
1410 size = strtonum("0x" $6)
1411 align = strtonum("0x" $NF)
1412 seen@<:@$2@:>@ = 1
1413 stub@<:@$2@:>@ = size == align * 2
92963737 1414 }
113ddea4
RM
1415 END {
1416 ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1417 dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1418 exit ((ctors_ok && dtors_ok) ? 0 : 1)
1419 }
1420 '], [libc_cv_ctors_header=no])
1421 ], [dnl
1422 AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1423 ])
a0da5fe1
UD
1424])
1425if test $libc_cv_ctors_header = no; then
1426 AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1427fi
5241882c 1428
a0da5fe1
UD
1429AC_CACHE_CHECK(for libunwind-support in compiler,
1430 libc_cv_cc_with_libunwind, [
1431 cat > conftest.c <<EOF
cbdb12de
UD
1432int main (void) { return 0; }
1433EOF
a0da5fe1 1434 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
8175a253 1435 conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
a0da5fe1
UD
1436 libc_cv_cc_with_libunwind=yes
1437 else
1438 libc_cv_cc_with_libunwind=no
c776b3d7 1439 fi
a0da5fe1
UD
1440 rm -f conftest*])
1441AC_SUBST(libc_cv_cc_with_libunwind)
1442if test $libc_cv_cc_with_libunwind = yes; then
1443 AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1444fi
c776b3d7 1445
6bfea974
L
1446LIBC_LINKER_FEATURE([-z nodelete], [-Wl,--enable-new-dtags,-z,nodelete],
1447 [libc_cv_z_nodelete=yes],
1448 [AC_MSG_ERROR(linker with -z nodelete support required)])
2f54c82d 1449
6bfea974
L
1450LIBC_LINKER_FEATURE([-z nodlopen], [-Wl,--enable-new-dtags,-z,nodlopen],
1451 [libc_cv_z_nodlopen=yes],
1452 [AC_MSG_ERROR(linker with -z nodlopen support required)])
5d916713 1453
6bfea974
L
1454LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
1455 [libc_cv_z_initfirst=yes],
1456 [AC_MSG_ERROR(linker with -z initfirst support required)])
639c3248 1457
a0da5fe1
UD
1458# Add-on fragments can set these for other machines.
1459libc_commonpagesize=${libc_commonpagesize:-no}
1460libc_relro_required=${libc_relro_required:-no}
1461case "$base_machine" in
1462 i[[34567]]86 | x86_64 | powerpc* | s390*)
1463 libc_commonpagesize=0x1000
1464 libc_relro_required=yes
1465 ;;
1466 sparc*)
1467 libc_commonpagesize=0x2000
1468 libc_relro_required=yes
1469 ;;
a0da5fe1 1470esac
574920b4 1471
a0da5fe1
UD
1472if test $libc_commonpagesize != no; then
1473 AC_CACHE_CHECK(for -z relro option,
1474 libc_cv_z_relro, [dnl
1475 libc_cv_z_relro=no
1476 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
574920b4
RM
1477int _start (void) { return 42; }
1478extern void _exit (int);
9fa2c032
RM
1479/* Since these pointers are const, they should go in rodata.
1480 Since they refer to functions that have to be resolved by
1481 dynamic linking, they should instead go in RELRO data. */
defe9061 1482const void *const relro[] = { &_start, &_exit, 0 };
9fa2c032
RM
1483/* GNU ld fails to produce RELRO data when it's very small and there is no
1484 normal writable data following it, or if only uninitialized (.bss) data
1485 follows it, or only very small writable data. */
1486int data[0x10000] = { 1, };
574920b4 1487]])])
a0da5fe1 1488 cat > conftest.awk <<\EOF
574920b4
RM
1489BEGIN {
1490 result = "no"
1491 commonpagesize = strtonum(commonpagesize)
1492}
1493{ print "LINE:", $0 > "/dev/stderr" }
1494$1 == "GNU_RELRO" {
1495 vaddr = strtonum($3)
1496 memsz = strtonum($6)
1497 end = vaddr + memsz
1498 printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1499 vaddr, memsz, end, commonpagesize > "/dev/stderr"
1500 result = (end % commonpagesize == 0) ? "yes" : "broken"
1501}
1502END { print result }
1503EOF
a0da5fe1 1504 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
574920b4
RM
1505 -fPIC -shared -o conftest.so conftest.c
1506 -nostartfiles -nostdlib
1507 -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
a0da5fe1
UD
1508 AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1509 AC_TRY_COMMAND([
574920b4
RM
1510 $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1511 conftest.ph > conftest.cps
1512 ]) &&
a0da5fe1
UD
1513 libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1514 rm -f conftest*])
1515 if { test "x$libc_relro_required" = xyes &&
1516 test "x$libc_cv_z_relro" != xyes
1517 }
1518 then
1519 AC_MSG_ERROR(linker with -z relro support required)
574920b4 1520 fi
a0da5fe1
UD
1521else
1522 AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1523fi
ed20b3d9 1524
a0da5fe1
UD
1525AC_CACHE_CHECK(for -Bgroup option,
1526 libc_cv_Bgroup, [dnl
1527cat > conftest.c <<EOF
639c3248
UD
1528int _start (void) { return 42; }
1529EOF
a0da5fe1
UD
1530if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1531 -fPIC -shared -o conftest.so conftest.c
1532 -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1533then
1534 libc_cv_Bgroup=yes
1535else
1536 libc_cv_Bgroup=no
1537fi
1538rm -f conftest*])
1539AC_SUBST(libc_cv_Bgroup)
a711b01d 1540
a0da5fe1
UD
1541ASFLAGS_config=
1542AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1543 libc_cv_as_noexecstack, [dnl
1544cat > conftest.c <<EOF
35915ec8
UD
1545void foo (void) { }
1546EOF
a0da5fe1
UD
1547if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1548 -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
8175a253 1549 && grep .note.GNU-stack conftest.s >/dev/null \
a0da5fe1
UD
1550 && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1551 -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1552then
1553 libc_cv_as_noexecstack=yes
1554else
1555 libc_cv_as_noexecstack=no
1556fi
1557rm -f conftest*])
1558if test $libc_cv_as_noexecstack = yes; then
1559 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1560fi
1561AC_SUBST(ASFLAGS_config)
2abf9ff1 1562
a0da5fe1
UD
1563AC_CACHE_CHECK(for -z combreloc,
1564 libc_cv_z_combreloc, [dnl
1565cat > conftest.c <<EOF
d555194c
UD
1566extern int bar (int);
1567extern int mumble;
1568int foo (void) { return bar (mumble); }
a711b01d 1569EOF
a0da5fe1 1570if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
dbc92dc6 1571 -fPIC -shared -o conftest.so conftest.c
35cd3c97 1572 -nostdlib -nostartfiles
c2f55635 1573 -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
a0da5fe1 1574then
a711b01d
UD
1575dnl The following test is a bit weak. We must use a tool which can test
1576dnl cross-platform since the gcc used can be a cross compiler. Without
1577dnl introducing new options this is not easily doable. Instead use a tool
1578dnl which always is cross-platform: readelf. To detect whether -z combreloc
1579dnl look for a section named .rel.dyn.
a0da5fe1
UD
1580 if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1581 libc_cv_z_combreloc=yes
fdde8349
UD
1582 else
1583 libc_cv_z_combreloc=no
a711b01d 1584 fi
a0da5fe1
UD
1585else
1586 libc_cv_z_combreloc=no
1587fi
1588rm -f conftest*])
1589if test "$libc_cv_z_combreloc" = yes; then
1590 AC_DEFINE(HAVE_Z_COMBRELOC)
1591fi
1592AC_SUBST(libc_cv_z_combreloc)
2abf9ff1 1593
6bfea974
L
1594LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1595 [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
a0da5fe1 1596AC_SUBST(libc_cv_z_execstack)
c9c60884 1597
a0da5fe1 1598AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
4da0431d
JM
1599LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1600])
c9c60884 1601
a0da5fe1 1602AC_SUBST(libc_cv_fpie)
871b9158 1603
a0da5fe1
UD
1604AC_CACHE_CHECK(for --hash-style option,
1605 libc_cv_hashstyle, [dnl
1606cat > conftest.c <<EOF
871b9158
UD
1607int _start (void) { return 42; }
1608EOF
a0da5fe1
UD
1609if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1610 -fPIC -shared -o conftest.so conftest.c
1611 -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1612then
1613 libc_cv_hashstyle=yes
1614else
1615 libc_cv_hashstyle=no
1616fi
1617rm -f conftest*])
1618AC_SUBST(libc_cv_hashstyle)
1619
1620# The linker's default -shared behavior is good enough if it
1621# does these things that our custom linker scripts ensure that
1622# all allocated NOTE sections come first.
1623if test "$use_default_link" = default; then
1624 AC_CACHE_CHECK([for sufficient default -shared layout],
1625 libc_cv_use_default_link, [dnl
1626 libc_cv_use_default_link=no
1627 cat > conftest.s <<\EOF
fd5e21c7
RM
1628 .section .note.a,"a",%note
1629 .balign 4
1630 .long 4,4,9
1631 .string "GNU"
1632 .string "foo"
1633 .section .note.b,"a",%note
1634 .balign 4
1635 .long 4,4,9
1636 .string "GNU"
1637 .string "bar"
1638EOF
a0da5fe1 1639 if AC_TRY_COMMAND([dnl
fd5e21c7
RM
1640 ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1641 ac_try=`$READELF -S conftest.so | sed -n \
1642 ['${x;p;}
1643 s/^ *\[ *[1-9][0-9]*\] *\([^ ][^ ]*\) *\([^ ][^ ]*\) .*$/\2 \1/
1644 t a
1645 b
1646 : a
1647 H']`
a0da5fe1
UD
1648 then
1649 libc_seen_a=no libc_seen_b=no
1650 set -- $ac_try
1651 while test $# -ge 2 -a "$1" = NOTE; do
1652 case "$2" in
1653 .note.a) libc_seen_a=yes ;;
1654 .note.b) libc_seen_b=yes ;;
1655 esac
1656 shift 2
1657 done
1658 case "$libc_seen_a$libc_seen_b" in
1659 yesyes)
1660 libc_cv_use_default_link=yes
1661 ;;
1662 *)
1663 echo >&AS_MESSAGE_LOG_FD "\
fd5e21c7
RM
1664$libc_seen_a$libc_seen_b from:
1665$ac_try"
a0da5fe1
UD
1666 ;;
1667 esac
fd5e21c7 1668 fi
a0da5fe1
UD
1669 rm -f conftest*])
1670 use_default_link=$libc_cv_use_default_link
fd26970f 1671fi
49803108 1672
5c550700
RM
1673AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1674if libc_cv_output_format=`
1675${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1676then
1677 :
1678else
1679 libc_cv_output_format=
1680fi
1681test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1682AC_SUBST(libc_cv_output_format)
1683
22dca1ea 1684AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
49803108
AJ
1685cat > conftest.c <<EOF
1686int foo;
1687EOF
22dca1ea 1688if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
49803108
AJ
1689 conftest.c 1>&AS_MESSAGE_LOG_FD])
1690then
18e2ac6d 1691 libc_cv_fno_toplevel_reorder=yes
49803108 1692else
18e2ac6d 1693 libc_cv_fno_toplevel_reorder=no
49803108
AJ
1694fi
1695rm -f conftest*])
18e2ac6d 1696if test $libc_cv_fno_toplevel_reorder = yes; then
22dca1ea 1697 fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
18e2ac6d 1698else
49803108
AJ
1699 fno_unit_at_a_time=-fno-unit-at-a-time
1700fi
1701AC_SUBST(fno_unit_at_a_time)
fd26970f 1702
401a9ec9 1703AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
17228132
TS
1704LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
1705 [libc_cv_ssp=yes],
1706 [libc_cv_ssp=no])
1707])
401a9ec9
UD
1708AC_SUBST(libc_cv_ssp)
1709
b037a293
UD
1710AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1711cat > conftest.c <<EOF
1712int foo;
1713#ifdef __GNUC_GNU_INLINE__
1714main () { return 0;}
1715#else
1716#error
1717#endif
1718EOF
371f84a4
JJ
1719if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1720 -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
b037a293
UD
1721then
1722 libc_cv_gnu89_inline=yes
1723else
1724 libc_cv_gnu89_inline=no
1725fi
1726rm -f conftest*])
1727if test $libc_cv_gnu89_inline = yes; then
1c7570ff 1728 gnu89_inline=-fgnu89-inline
b037a293 1729else
1c7570ff 1730 gnu89_inline=
b037a293 1731fi
1c7570ff 1732AC_SUBST(gnu89_inline)
b037a293 1733
a0da5fe1
UD
1734AC_CACHE_CHECK(whether cc puts quotes around section names,
1735 libc_cv_have_section_quotes,
1736 [cat > conftest.c <<EOF
1737 static const int foo
1738 __attribute__ ((section ("bar"))) = 1;
e26dd47f 1739EOF
a0da5fe1
UD
1740 if ${CC-cc} -S conftest.c -o conftest.s; then
1741 if grep '\.section.*"bar"' conftest.s >/dev/null; then
1742 libc_cv_have_section_quotes=yes
e26dd47f 1743 else
a0da5fe1 1744 libc_cv_have_section_quotes=no
e26dd47f 1745 fi
a0da5fe1
UD
1746 else
1747 libc_cv_have_section_quotes=unknown
1748 fi
1749 rm -f conftest.{c,s}
1750 ])
1751if test $libc_cv_have_section_quotes = yes; then
1752 AC_DEFINE(HAVE_SECTION_QUOTES)
9a97d1f7
UD
1753fi
1754
1755AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
75d86c1f 1756 [dnl
c224a18a 1757cat > conftest.s <<EOF
2293395f 1758${libc_cv_dot_text}
7b8e0d49 1759.globl foo
ae1025be 1760foo:
c224a18a
RM
1761.weak foo
1762.weak bar; bar = foo
1763EOF
3217788f 1764if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
9a97d1f7
UD
1765 libc_cv_asm_weak_directive=yes
1766else
1767 libc_cv_asm_weak_directive=no
1768fi
1769rm -f conftest*])
c224a18a 1770
c8cf0b14 1771if test $libc_cv_asm_weak_directive = no; then
c224a18a
RM
1772 AC_CACHE_CHECK(for assembler .weakext directive,
1773 libc_cv_asm_weakext_directive,
1774 [dnl
1775cat > conftest.s <<EOF
2293395f 1776${libc_cv_dot_text}
7b8e0d49 1777.globl foo
ae1025be 1778foo:
f802accb
UD
1779.weakext bar foo
1780.weakext baz
7b8e0d49 1781.globl baz
9a97d1f7 1782baz:
c224a18a 1783EOF
3217788f 1784 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
c224a18a
RM
1785 libc_cv_asm_weakext_directive=yes
1786 else
1787 libc_cv_asm_weakext_directive=no
1788 fi
1789 rm -f conftest*])
1790
9a97d1f7 1791fi # no .weak
c224a18a 1792
ffcf9634 1793if test $libc_cv_asm_weak_directive = yes; then
c224a18a 1794 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
ffcf9634 1795elif test $libc_cv_asm_weakext_directive = yes; then
c224a18a
RM
1796 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1797fi
1798
50189569 1799AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
ced368f7
UD
1800case $machine in
1801 sparc/sparc64*) cfi_offset=2047;;
1802 *) cfi_offset=0;;
1803esac
50189569 1804cat > conftest.s <<EOF
77e8bddf
AS
1805 .text
1806 .type func,%function
50189569 1807func:
77e8bddf 1808 .cfi_startproc
f212e8dc 1809 .cfi_remember_state
ced368f7 1810 .cfi_rel_offset 1, $cfi_offset
77e8bddf 1811 .cfi_endproc
50189569
AJ
1812EOF
1813if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1814 libc_cv_asm_cfi_directives=yes
1815else
1816 libc_cv_asm_cfi_directives=no
1817fi
1818rm -f conftest*])
1819if test $libc_cv_asm_cfi_directives = yes; then
1820 AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
bcd5f356 1821fi
50189569 1822
a641835a
RM
1823AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1824cat > conftest.c <<\EOF
5f0e6fc7 1825_start () {}
dcf0671d
UD
1826int __eh_pc;
1827__throw () {}
a641835a 1828EOF
dcea62dd 1829dnl No \ in command here because it ends up inside ''.
3217788f 1830if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
dcea62dd 1831 -nostdlib -nostartfiles -Wl,--no-whole-archive
c2f55635 1832 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
a641835a
RM
1833 libc_cv_ld_no_whole_archive=yes
1834else
1835 libc_cv_ld_no_whole_archive=no
1836fi
1837rm -f conftest*])
3ce1f295
UD
1838if test $libc_cv_ld_no_whole_archive = no; then
1839 AC_MSG_ERROR([support for --no-whole-archive is needed])
b17277cf 1840fi
a641835a 1841
dff14448 1842AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
b236e99d
UD
1843cat > conftest.c <<\EOF
1844_start () {}
1845int __eh_pc;
1846__throw () {}
1847EOF
1848dnl No \ in command here because it ends up inside ''.
3217788f 1849if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
dff14448 1850 -nostdlib -nostartfiles -fexceptions
c2f55635 1851 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
dff14448 1852 libc_cv_gcc_exceptions=yes
b236e99d 1853else
dff14448 1854 libc_cv_gcc_exceptions=no
b236e99d
UD
1855fi
1856rm -f conftest*])
dff14448
UD
1857if test $libc_cv_gcc_exceptions = yes; then
1858 exceptions=-fexceptions
b17277cf 1859fi
dff14448 1860AC_SUBST(exceptions)dnl
b236e99d 1861
66000494
UD
1862if test "$host_cpu" = powerpc ; then
1863# Check for a bug present in at least versions 2.8.x of GCC
1864# and versions 1.0.x of EGCS.
1865AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
1866AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
1867 libc_cv_c_asmcr0_bug='no',
1868 libc_cv_c_asmcr0_bug='yes')])
1869if test "$libc_cv_c_asmcr0_bug" != 'no'; then
1870 AC_DEFINE(BROKEN_PPC_ASM_CR0)
1871fi
1872fi
1873
d555194c
UD
1874AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1875cat > conftest.c <<\EOF
1876void zero (void *x)
1877{
a52d1562 1878 __builtin_memset (x, 0, 1000);
d555194c
UD
1879}
1880EOF
1881dnl
1882if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1883then
1884 libc_cv_gcc_builtin_memset=no
1885else
1886 libc_cv_gcc_builtin_memset=yes
1887fi
1888rm -f conftest* ])
1889if test "$libc_cv_gcc_builtin_memset" = yes ; then
1890 AC_DEFINE(HAVE_BUILTIN_MEMSET)
1891fi
1892
85dd1003
UD
1893AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1894cat > conftest.c <<\EOF
1895extern char *strstr (const char *, const char *) __asm ("my_strstr");
1896char *foo (const char *a, const char *b)
1897{
1898 return __builtin_strstr (a, b);
1899}
1900EOF
1901dnl
1902if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
1903then
1904 libc_cv_gcc_builtin_redirection=yes
1905else
1906 libc_cv_gcc_builtin_redirection=no
1907fi
1908rm -f conftest* ])
3ce1f295
UD
1909if test "$libc_cv_gcc_builtin_redirection" = no; then
1910 AC_MSG_ERROR([support for the symbol redirection needed])
85dd1003
UD
1911fi
1912
739d440d 1913dnl Check whether the compiler supports the __thread keyword.
3ce1f295
UD
1914AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
1915[cat > conftest.c <<\EOF
fbb18522
RM
1916__thread int a = 42;
1917EOF
3ce1f295
UD
1918if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
1919 libc_cv_gcc___thread=yes
739d440d
UD
1920else
1921 libc_cv_gcc___thread=no
1922fi
3ce1f295
UD
1923rm -f conftest*])
1924if test "$libc_cv_gcc___thread" = no; then
1925 AC_MSG_ERROR([support for the __thread keyword is required])
1926fi
739d440d 1927
3ce1f295
UD
1928dnl Check whether the compiler supports the tls_model attribute.
1929AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
1930cat > conftest.c <<\EOF
9b21e6bc
RM
1931extern __thread int a __attribute__((tls_model ("initial-exec")));
1932EOF
3ce1f295
UD
1933if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
1934 libc_cv_gcc_tls_model_attr=yes
1935else
1936 libc_cv_gcc_tls_model_attr=no
1937fi
1938rm -f conftest*])
1939if test "$libc_cv_gcc_tls_model_attr" = no; then
1940 AC_MSG_ERROR([support for the tls_model attribute is required])
9b21e6bc 1941fi
739d440d 1942
7998fa78
AS
1943dnl Determine how to disable generation of FMA instructions.
1944AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1945 libc_cv_cc_nofma, [dnl
1946libc_cv_cc_nofma=
1947for opt in -ffp-contract=off -mno-fused-madd; do
1948 LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1949done])
bef0b507 1950AC_SUBST(libc_cv_cc_nofma)
7998fa78 1951
2cf9ad57
RM
1952if test -n "$submachine"; then
1953 AC_CACHE_CHECK([for compiler option for CPU variant],
f7d82dc9 1954 libc_cv_cc_submachine, [dnl
2cf9ad57
RM
1955 libc_cv_cc_submachine=no
1956 for opt in "-march=$submachine" "-mcpu=$submachine"; do
40b601fb 1957 LIBC_TRY_CC_OPTION([$opt], [
2cf9ad57 1958 libc_cv_cc_submachine="$opt"
40b601fb 1959 break], [])
2cf9ad57
RM
1960 done])
1961 if test "x$libc_cv_cc_submachine" = xno; then
1962 AC_MSG_ERROR([${CC-cc} does not support $submachine])
1963 fi
1964fi
1965AC_SUBST(libc_cv_cc_submachine)
1966
85c2e611
AZ
1967AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1968__attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1969cat > conftest.c <<EOF
1970void
1971__attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1972foo (void) {}
1973EOF
1974libc_cv_cc_loop_to_function=no
1975if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1976then
1977 libc_cv_cc_loop_to_function=yes
1978fi
1979rm -f conftest*])
1980if test $libc_cv_cc_loop_to_function = yes; then
1981 AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1982fi
1983AC_SUBST(libc_cv_cc_loop_to_function)
1984
c8f3e6db
UD
1985dnl Check whether we have the gd library available.
1986AC_MSG_CHECKING(for libgd)
6dab8688
UD
1987if test "$with_gd" != "no"; then
1988 old_CFLAGS="$CFLAGS"
1989 CFLAGS="$CFLAGS $libgd_include"
1990 old_LDFLAGS="$LDFLAGS"
1991 LDFLAGS="$LDFLAGS $libgd_ldflags"
1992 old_LIBS="$LIBS"
1993 LIBS="$LIBS -lgd -lpng -lz -lm"
1994 AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
1995 CFLAGS="$old_CFLAGS"
1996 LDFLAGS="$old_LDFLAGS"
1997 LIBS="$old_LIBS"
1998else
1999 LIBGD=no
2000fi
c8f3e6db
UD
2001AC_MSG_RESULT($LIBGD)
2002AC_SUBST(LIBGD)
3d558f4e 2003
2fff3d93
UD
2004# SELinux detection
2005if test x$with_selinux = xno ; then
2006 have_selinux=no;
2007else
2008 # See if we have the SELinux library
2009 AC_CHECK_LIB(selinux, is_selinux_enabled,
2010 have_selinux=yes, have_selinux=no)
2011 # See if we have the SELinux header with the NSCD permissions in it.
2012 if test x$have_selinux = xyes ; then
2013 AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2014 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2015 [#ifdef NSCD__SHMEMHOST
2016 return 0;
2017 #else
2018 #error NSCD__SHMEMHOST not defined
2019 #endif],
2020 have_selinux=yes, have_selinux=no)
2021 AC_MSG_RESULT($have_selinux)
2022 fi
2023
49155d51 2024 if test x$with_selinux = xyes ; then
2fff3d93 2025 if test x$have_selinux = xno ; then
49155d51 2026 AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2fff3d93
UD
2027 fi
2028 fi
2029fi
2030# Check if we're building with SELinux support.
2031if test "x$have_selinux" = xyes; then
943db9eb 2032 AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
ec23b9be
UD
2033
2034 # See if we have the libaudit library
943db9eb 2035 AC_CHECK_LIB(audit, audit_log_user_avc_message,
77e8bddf 2036 have_libaudit=yes, have_libaudit=no)
ec23b9be 2037 if test "x$have_libaudit" = xyes; then
943db9eb 2038 AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
ec23b9be
UD
2039 fi
2040 AC_SUBST(have_libaudit)
1f063dca
UD
2041
2042 # See if we have the libcap library
2043 AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2044 if test "x$have_libcap" = xyes; then
2045 AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2046 fi
2047 AC_SUBST(have_libcap)
2fff3d93
UD
2048fi
2049AC_SUBST(have_selinux)
2050
8ed1e7d5
GK
2051dnl check for the size of 'long double'.
2052AC_CHECK_SIZEOF(long double, 0)
2053sizeof_long_double=$ac_cv_sizeof_long_double
2054AC_SUBST(sizeof_long_double)
2055
61653dfb
RM
2056CPPUNDEFS=
2057dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
2058dnl Since we are building the implementations of the fortified functions here,
2059dnl having the macro defined interacts very badly.
2060AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
2061[AC_TRY_COMPILE([], [
2062#ifdef _FORTIFY_SOURCE
2063# error bogon
2064#endif],
2065 [libc_cv_predef_fortify_source=no],
2066 [libc_cv_predef_fortify_source=yes])])
2067if test $libc_cv_predef_fortify_source = yes; then
2068 CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
2069fi
2070AC_SUBST(CPPUNDEFS)
2071
30b99d79
RM
2072dnl Check for silly hacked compilers inserting -fstack-protector.
2073dnl This breaks badly for the early startup code we compile, since
2074dnl the compiled code can refer to a magic machine-dependent location
2075dnl for the canary value before we have sufficient setup for that to
2076dnl work. It's also questionable to build all of libc with this flag
2077dnl even when you're doing that for most applications you build, since
2078dnl libc's code is so heavily-used and performance-sensitive. If we
2079dnl ever really want to make that work, it should be enabled explicitly
2080dnl in the libc build, not inherited from implicit compiler settings.
2081AC_CACHE_CHECK([whether $CC implicitly enables -fstack-protector],
2082 libc_cv_predef_stack_protector, [
2083AC_TRY_COMPILE([extern void foobar (char *);],
2084 [char large_array[2048]; foobar (large_array);], [
2085libc_undefs=`$NM -u conftest.o |
2086 LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
2087 2>&AS_MESSAGE_LOG_FD` || {
2088 AC_MSG_ERROR([confusing output from $NM -u])
2089}
2090echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
59f0c22e
JM
2091# On some architectures, there are architecture-specific undefined
2092# symbols (resolved by the linker), so filter out unknown symbols.
2093# This will fail to produce the correct result if the compiler
2094# defaults to -fstack-protector but this produces an undefined symbol
2095# other than __stack_chk_fail. However, compilers like that have not
2096# been encountered in practice.
2097libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
30b99d79
RM
2098case "$libc_undefs" in
2099foobar) libc_cv_predef_stack_protector=no ;;
2100'__stack_chk_fail
2101foobar') libc_cv_predef_stack_protector=yes ;;
2102*) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
2103esac],
2104 [AC_MSG_ERROR([test compilation failed])])
2105])
2106libc_extra_cflags=
2107if test $libc_cv_predef_stack_protector = yes; then
2108 libc_extra_cflags=-fno-stack-protector
2109fi
2110AC_SUBST(libc_extra_cflags)
2111
c224a18a
RM
2112### End of automated tests.
2113### Now run sysdeps configure fragments.
2114
cb343854 2115# They also can set these variables.
591e1ffb 2116use_ldconfig=no
cb343854 2117ldd_rewrite_script=no
77259608 2118libc_cv_sysconfdir=$sysconfdir
4248b1b1 2119libc_cv_localstatedir=$localstatedir
74bd2300 2120libc_cv_gcc_unwind_find_fde=no
e2fd3cbe 2121libc_cv_idn=no
cb343854 2122
28f540f4 2123# Iterate over all the sysdep directories we will use, running their
09055553 2124# configure fragments.
28f540f4 2125for dir in $sysnames; do
57ba7bb4
UD
2126 case $dir in
2127 /*) dest=$dir ;;
2128 *) dest=$srcdir/$dir ;;
2129 esac
2130 if test -r $dest/configure; then
d1149385 2131 AC_MSG_RESULT(running configure fragment for $dir)
57ba7bb4 2132 . $dest/configure
28f540f4 2133 fi
28f540f4
RM
2134done
2135
74bd2300
UD
2136if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2137 AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2138fi
2139AC_SUBST(libc_cv_gcc_unwind_find_fde)
2140
6e6249d0
RM
2141# A sysdeps configure fragment can reset this if IFUNC is not actually
2142# usable even though the assembler knows how to generate the symbol type.
2143if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
2144 AC_DEFINE(HAVE_IFUNC)
2145fi
2146
3cc3ef96
RM
2147# This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
2148# configure fragment can override the value to prevent this AC_DEFINE.
2149AC_SUBST(use_nscd)
2150if test "x$use_nscd" != xno; then
2151 AC_DEFINE([USE_NSCD])
2152fi
c53d909c
RM
2153if test "x$build_nscd" = xdefault; then
2154 build_nscd=$use_nscd
2155fi
3cc3ef96 2156
a53bad16
UD
2157# Test for old glibc 2.0.x headers so that they can be removed properly
2158# Search only in includedir.
2159AC_MSG_CHECKING(for old glibc 2.0.x headers)
350eb336 2160if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
a53bad16
UD
2161then
2162 old_glibc_headers=yes
2163else
2164 old_glibc_headers=no
2165fi
2166AC_MSG_RESULT($old_glibc_headers)
2167if test ${old_glibc_headers} = yes; then
2168 AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2169 AC_MSG_WARN(*** be removed.)
2170fi
b195f6bc 2171AC_SUBST(old_glibc_headers)
26b4d766 2172
84384f5b 2173AC_SUBST(libc_cv_slibdir)
aaa8cb4b 2174AC_SUBST(libc_cv_rtlddir)
a1d84548 2175AC_SUBST(libc_cv_localedir)
77259608 2176AC_SUBST(libc_cv_sysconfdir)
4248b1b1 2177AC_SUBST(libc_cv_localstatedir)
1ef32c3d 2178AC_SUBST(libc_cv_rootsbindir)
bcd5f356 2179AC_SUBST(libc_cv_forced_unwind)
1ef32c3d 2180
f57f8055
RM
2181if test x$use_ldconfig = xyes; then
2182 AC_DEFINE(USE_LDCONFIG)
2183fi
591e1ffb 2184AC_SUBST(use_ldconfig)
cb343854 2185AC_SUBST(ldd_rewrite_script)
84384f5b 2186
650425ce 2187AC_SUBST(static)
ff3d7ed3 2188AC_SUBST(shared)
a334319f 2189
ff886b82
UD
2190AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2191[libc_cv_pic_default=yes
cc3fa755 2192cat > conftest.c <<EOF
9756dfe1 2193#if defined __PIC__ || defined __pic__ || defined PIC || defined pic
cc3fa755
UD
2194# error PIC is default.
2195#endif
2196EOF
0b4ee387 2197if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
ff886b82 2198 libc_cv_pic_default=no
cc3fa755
UD
2199fi
2200rm -f conftest.*])
ff886b82 2201AC_SUBST(libc_cv_pic_default)
cc3fa755 2202
ff3d7ed3 2203AC_SUBST(profile)
5107cf1d 2204AC_SUBST(static_nss)
ff3d7ed3 2205
edf5b2d7
UD
2206AC_SUBST(DEFINES)
2207
61c83c3f
RM
2208dnl See sysdeps/mach/configure.in for this variable.
2209AC_SUBST(mach_interface_list)
2210
ee74a442
UD
2211VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2212RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
df4ef2ab 2213AC_SUBST(VERSION)
ee74a442 2214AC_SUBST(RELEASE)
df4ef2ab 2215
728e272a 2216AC_CONFIG_FILES([config.make Makefile])
c118d634 2217AC_CONFIG_COMMANDS([default],[[
737547be
UD
2218case $CONFIG_FILES in *config.make*)
2219echo "$config_vars" >> config.make;;
2220esac
c118d634
RM
2221test -d bits || mkdir bits]],[[config_vars='$config_vars']])
2222AC_OUTPUT