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