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