]>
Commit | Line | Data |
---|---|---|
f4017d20 | 1 | dnl Process this file with autoconf to produce a configure script. |
ff3d7ed3 | 2 | AC_REVISION([$CVSid$]) |
3a12e572 | 3 | AC_PREREQ(2.53)dnl dnl Minimum Autoconf version required. |
5d77b1da RM |
4 | AC_INIT([GNU C Library], [(see version.h)], [glibc]) |
5 | AC_CONFIG_SRCDIR([include/features.h]) | |
6b7f6183 RM |
6 | AC_CONFIG_HEADERS([config.h]) |
7 | AC_CONFIG_AUX_DIR([scripts]) | |
28f540f4 | 8 | |
7967983f RM |
9 | dnl This is here so we can set $subdirs directly based on configure fragments. |
10 | AC_CONFIG_SUBDIRS() | |
11 | ||
c16a054d AS |
12 | AC_CANONICAL_HOST |
13 | ||
c0bac8b0 UD |
14 | AC_PROG_CC |
15 | if test $host != $build; then | |
16 | AC_CHECK_PROGS(BUILD_CC, gcc cc) | |
17 | fi | |
18 | AC_SUBST(cross_compiling) | |
19 | AC_PROG_CPP | |
20 | # We need the C++ compiler only for testing. | |
21 | AC_PROG_CXX | |
22 | ||
c72637d4 RM |
23 | if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then |
24 | AC_MSG_ERROR([you must configure in a separate build directory]) | |
25 | fi | |
26 | ||
28f540f4 RM |
27 | # This will get text that should go into config.make. |
28 | config_vars= | |
29 | ||
c8f3e6db | 30 | # Check for a --with-gd argument and set libgd-LDFLAGS in config.make. |
6b7f6183 | 31 | AC_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 |
35 | case "$with_gd" in | |
f5f7239f UD |
36 | yes|''|no) ;; |
37 | *) libgd_include="-I$withval/include" | |
c8f3e6db UD |
38 | libgd_ldflags="-L$withval/lib" ;; |
39 | esac | |
40 | ]) | |
6b7f6183 | 41 | AC_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 |
45 | case "$with_gd_include" in |
46 | ''|no) ;; | |
47 | *) libgd_include="-I$withval" ;; | |
48 | esac | |
49 | ]) | |
6b7f6183 | 50 | AC_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 |
54 | case "$with_gd_lib" in |
55 | ''|no) ;; | |
56 | *) libgd_ldflags="-L$withval" ;; | |
57 | esac | |
58 | ]) | |
59 | ||
60 | if test -n "$libgd_include"; then | |
61 | config_vars="$config_vars | |
cf90163d | 62 | CFLAGS-memusagestat.c = $libgd_include" |
f5f7239f UD |
63 | fi |
64 | if test -n "$libgd_ldflags"; then | |
65 | config_vars="$config_vars | |
66 | libgd-LDFLAGS = $libgd_ldflags" | |
67 | fi | |
28f540f4 | 68 | |
ff3d7ed3 | 69 | dnl Arguments to specify presence of other packages/features. |
6b7f6183 | 70 | AC_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 | 75 | AC_SUBST(with_fp) |
6b7f6183 | 76 | AC_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='']) | |
81 | AC_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 | 86 | AC_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 | 91 | AC_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 | 97 | AC_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 |
105 | AC_SUBST(use_default_link) |
106 | AC_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 | 112 | AC_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 |
118 | AC_SUBST(enable_check_abi) |
119 | AC_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 |
126 | dnl Arguments to enable or disable building the static, shared, profiled, |
127 | dnl and -fomit-frame-pointer libraries. | |
b38bb8ca UD |
128 | dnl I've disabled this for now since we cannot build glibc without static |
129 | dnl libraries built in the moment. | |
6b7f6183 RM |
130 | dnl AC_ARG_ENABLE([static], |
131 | dnl AC_HELP_STRING([--enable-static], | |
132 | dnl [build static library @<:@default=yes@:>@]), | |
133 | dnl [static=$enableval], | |
134 | dnl [static=yes]) | |
5c2a0669 | 135 | static=yes |
6b7f6183 | 136 | AC_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]) | |
141 | AC_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 | 146 | AC_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]) | |
151 | AC_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]) | |
156 | AC_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 | ||
162 | AC_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 |
167 | if test "$oldest_abi" = yes || test "$oldest_abi" = no; then |
168 | oldest_abi=default | |
169 | else | |
170 | AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi") | |
171 | fi | |
172 | AC_SUBST(oldest_abi) | |
173 | ||
35f1e827 UD |
174 | AC_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]) | |
179 | if test "$enable_stackguard_randomize" = yes; then | |
180 | AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE) | |
181 | fi | |
182 | ||
6b3a2224 | 183 | dnl Generic infrastructure for drop-in additions to libc. |
6b7f6183 | 184 | AC_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 | 190 | dnl Let the user avoid using TLS. Don't know why but... |
6b7f6183 | 191 | AC_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 | 197 | AC_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 | 203 | AC_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 |
208 | if test "x$hidden" = xno; then |
209 | AC_DEFINE(NO_HIDDEN) | |
210 | fi | |
211 | ||
4df8c11d UD |
212 | AC_ARG_ENABLE([bind-now], |
213 | AC_HELP_STRING([--enable-bind-now], | |
214 | [disable lazy relocations in DSOs]), | |
215 | [bindnow=$enableval], | |
216 | [bindnow=no]) | |
217 | AC_SUBST(bindnow) | |
218 | ||
5107cf1d UD |
219 | dnl On some platforms we cannot use dynamic loading. We must provide |
220 | dnl static NSS modules. | |
6b7f6183 | 221 | AC_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 |
226 | dnl Enable static NSS also if we build no shared objects. |
227 | if test x"$static_nss" = xyes || test x"$shared" = xno; then | |
3172f58f | 228 | static_nss=yes |
5107cf1d UD |
229 | AC_DEFINE(DO_STATIC_NSS) |
230 | fi | |
231 | ||
6b7f6183 | 232 | AC_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 |
237 | AC_SUBST(force_install) |
238 | ||
958f238f UD |
239 | dnl On some platforms we allow dropping compatibility with all kernel |
240 | dnl versions. | |
6b7f6183 | 241 | AC_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 |
246 | dnl Prevent unreasonable values. |
247 | if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then | |
248 | # Better nothing than this. | |
249 | minimum_kernel="" | |
269e369f UD |
250 | else |
251 | if test "$minimum_kernel" = current; then | |
252 | minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel= | |
253 | fi | |
86cfe82d | 254 | fi |
958f238f | 255 | |
6cc7d725 UD |
256 | dnl For the development we sometimes want gcc to issue even more warnings. |
257 | dnl This is not the default since many of the extra warnings are not | |
258 | dnl appropriate. | |
6b7f6183 RM |
259 | AC_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 |
264 | AC_SUBST(all_warnings) |
265 | ||
425ce2ed UD |
266 | AC_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 |
272 | AC_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]) | |
277 | if 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 | 287 | void f (void) { NSSLOW_Init (); }])], |
ff886b82 UD |
288 | libc_cv_nss_crypt=yes, |
289 | AC_MSG_ERROR([ | |
290 | cannot 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([ | |
299 | cannot link program using lowlevel NSS hash functions])) | |
300 | CFLAGS="$old_CFLAGS" | |
301 | LIBS="$old_LIBS" | |
302 | else | |
303 | libc_cv_nss_crypt=no | |
304 | fi | |
305 | AC_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. | |
312 | case "$host_os" in | |
313 | linux*) | |
314 | ;; | |
315 | gnu*) | |
316 | host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'` | |
317 | ;; | |
318 | esac | |
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. | |
323 | config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os | |
324 | ||
2f64b655 UD |
325 | # Don't allow vendor == "unknown" |
326 | test "$config_vendor" = unknown && config_vendor= | |
327 | config_os="`echo $config_os | sed 's/^unknown-//'`" | |
328 | ||
a2fe9c76 RM |
329 | # Some configurations imply other options. |
330 | case "$host_os" in | |
7799b7b3 UD |
331 | # i586-linuxaout is mangled into i586-pc-linux-gnuaout |
332 | linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*) | |
3776d592 | 333 | ;; |
ffa8d2a0 | 334 | gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*) |
3776d592 RM |
335 | # These systems (almost) always use the ELF format. |
336 | elf=yes | |
84724245 | 337 | ;; |
5af3245a UD |
338 | aix*) |
339 | # These systems are always xcoff | |
340 | xcoff=yes | |
a711b01d | 341 | elf=no |
5af3245a | 342 | ;; |
a2fe9c76 RM |
343 | esac |
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 |
348 | machine=$config_machine |
349 | vendor=$config_vendor | |
350 | os=$config_os | |
b22d21b3 | 351 | base_os='' |
28f540f4 | 352 | |
a808d541 UD |
353 | # config.guess on some IBM machines says `rs6000' instead of `powerpc'. |
354 | # Unify this here. | |
355 | if test "$machine" = rs6000; then | |
356 | machine="powerpc" | |
357 | fi | |
358 | ||
f4b07664 RM |
359 | # Braindead PowerPC box with absolutely no FPU. |
360 | case "$machine-$host_os" in | |
361 | powerpc*-*soft) | |
362 | with_fp=no | |
363 | ;; | |
364 | esac | |
365 | ||
2ceaa76a RM |
366 | submachine= |
367 | AC_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 |
378 | libc_config_ok=no |
379 | ||
380 | dnl Having this here, though empty, makes sure that if add-ons' fragments | |
381 | dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then | |
382 | dnl our AC_OUTPUT will actually use it. | |
383 | AC_CONFIG_SUBDIRS() | |
384 | ||
e0a3ed4f RM |
385 | case "$enable_add_ons" in |
386 | ''|no) add_ons= ;; | |
387 | yes|'*') | |
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 ;; | |
394 | esac | |
395 | ||
396 | configured_add_ons= | |
8f73811b RM |
397 | add_ons_sfx= |
398 | add_ons_pfx= | |
399 | if 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 | |
482 | fragment 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 | |
489 | relative 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 |
514 | fi |
515 | AC_SUBST(add_ons) | |
e0a3ed4f | 516 | AC_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 | 527 | if 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 | |
541 | fi | |
542 | ||
28f540f4 RM |
543 | dnl We need to use [ and ] for other purposes for a while now. |
544 | changequote(,)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. | |
548 | test -n "$base_machine" || case "$machine" in | |
f0523145 | 549 | a29k | am29000) base_machine=a29k machine=a29k ;; |
60c96635 UD |
550 | c3[012]) base_machine=cx0 machine=cx0/c30 ;; |
551 | c4[04]) base_machine=cx0 machine=cx0/c40 ;; | |
0b755dc4 | 552 | i[34567]86) base_machine=i386 machine=i386/$machine ;; |
d64e704c | 553 | ia64) base_machine=ia64 machine=ia64 ;; |
f0523145 RM |
554 | m88???) base_machine=m88k machine=m88k/$machine ;; |
555 | m88k) base_machine=m88k machine=m88k/m88100 ;; | |
92b27c74 UD |
556 | powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;; |
557 | powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;; | |
136d4332 UD |
558 | s390) base_machine=s390 machine=s390/s390-32 ;; |
559 | s390x) base_machine=s390 machine=s390/s390-64 ;; | |
88615235 UD |
560 | sh3*) base_machine=sh machine=sh/sh3 ;; |
561 | sh4*) base_machine=sh machine=sh/sh4 ;; | |
ca34d7a7 UD |
562 | sparc | sparcv[67]) |
563 | base_machine=sparc machine=sparc/sparc32 ;; | |
564 | sparcv8 | supersparc | hypersparc) | |
565 | base_machine=sparc machine=sparc/sparc32/sparcv8 ;; | |
ae6b8730 RH |
566 | sparcv8plus | sparcv8plusa | sparcv9) |
567 | base_machine=sparc machine=sparc/sparc32/sparcv9 ;; | |
bb769ab6 | 568 | sparcv8plusb | sparcv9b) |
10c6e709 | 569 | base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;; |
2d73656b RM |
570 | sparcv9v) |
571 | base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;; | |
46ae8850 JJ |
572 | sparcv9v2) |
573 | base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;; | |
b1ecbed2 | 574 | sparc64) |
ca34d7a7 | 575 | base_machine=sparc machine=sparc/sparc64 ;; |
b1ecbed2 | 576 | sparc64b) |
bb769ab6 | 577 | base_machine=sparc machine=sparc/sparc64/sparcv9b ;; |
2d73656b RM |
578 | sparc64v) |
579 | base_machine=sparc machine=sparc/sparc64/sparcv9v ;; | |
46ae8850 JJ |
580 | sparc64v2) |
581 | base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;; | |
3a2832a0 | 582 | *) base_machine=$machine ;; |
28f540f4 | 583 | esac |
f0523145 RM |
584 | changequote([,])dnl |
585 | AC_SUBST(base_machine) | |
28f540f4 | 586 | |
dfd2257a UD |
587 | if test "$base_machine" = "i386"; then |
588 | AC_DEFINE(USE_REGPARMS) | |
589 | fi | |
590 | ||
84b9230c MF |
591 | # For the multi-arch option we need support in the assembler. |
592 | AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support], | |
77e8bddf | 593 | libc_cv_asm_gnu_indirect_function, [dnl |
84b9230c MF |
594 | cat > conftest.s <<EOF |
595 | .type foo,%gnu_indirect_function | |
596 | EOF | |
597 | if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; | |
598 | then | |
599 | libc_cv_asm_gnu_indirect_function=yes | |
600 | else | |
601 | libc_cv_asm_gnu_indirect_function=no | |
602 | fi | |
603 | rm -f conftest*]) | |
604 | ||
605 | AC_MSG_CHECKING(whether .text pseudo-op must be used) | |
606 | AC_CACHE_VAL(libc_cv_dot_text, [dnl | |
607 | cat > conftest.s <<EOF | |
608 | .text | |
609 | EOF | |
610 | libc_cv_dot_text= | |
611 | if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then | |
612 | libc_cv_dot_text=.text | |
613 | fi | |
614 | rm -f conftest*]) | |
615 | if test -z "$libc_cv_dot_text"; then | |
616 | AC_MSG_RESULT(no) | |
617 | else | |
618 | AC_MSG_RESULT(yes) | |
619 | fi | |
620 | ||
621 | AC_CACHE_CHECK(for assembler global-symbol directive, | |
622 | libc_cv_asm_global_directive, [dnl | |
623 | libc_cv_asm_global_directive=UNKNOWN | |
624 | for ac_globl in .globl .global .EXPORT; do | |
625 | cat > conftest.s <<EOF | |
626 | ${libc_cv_dot_text} | |
627 | ${ac_globl} foo | |
628 | foo: | |
629 | EOF | |
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 | |
635 | done]) | |
636 | if test $libc_cv_asm_global_directive = UNKNOWN; then | |
637 | AC_MSG_ERROR(cannot determine asm global directive) | |
638 | else | |
639 | AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive}) | |
640 | fi | |
641 | ||
642 | AC_CACHE_CHECK(for assembler .type directive prefix, | |
643 | libc_cv_asm_type_prefix, [dnl | |
644 | libc_cv_asm_type_prefix=no | |
645 | for 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 | |
651 | foo: | |
652 | .byte 1 | |
653 | EOF | |
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 | |
659 | done]) | |
660 | if test "x$libc_cv_asm_type_prefix" != xno; then | |
661 | AC_DEFINE_UNQUOTED(ASM_TYPE_DIRECTIVE_PREFIX, ${libc_cv_asm_type_prefix}) | |
662 | fi | |
663 | ||
664 | if 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 | |
670 | fi | |
671 | if test x"$multi_arch" != xno; then | |
672 | multi_arch_d=/multiarch | |
673 | fi | |
674 | ||
f0523145 | 675 | # Compute the list of sysdep directories for this configuration. |
f332db02 | 676 | # This can take a while to compute. |
f0523145 | 677 | sysdep_dir=$srcdir/sysdeps |
f332db02 | 678 | AC_MSG_CHECKING(sysdep dirs) |
f0523145 RM |
679 | dnl We need to use [ and ] for other purposes for a while now. |
680 | changequote(,)dnl | |
28f540f4 RM |
681 | # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1. |
682 | os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`" | |
683 | ||
b22d21b3 | 684 | test "x$base_os" != x || case "$os" in |
28f540f4 RM |
685 | gnu*) |
686 | base_os=mach/hurd ;; | |
883bc19b | 687 | netbsd* | 386bsd* | freebsd* | bsdi*) |
28f540f4 | 688 | base_os=unix/bsd/bsd4.4 ;; |
222c4e71 | 689 | osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*) |
28f540f4 | 690 | base_os=unix/bsd ;; |
d586354e | 691 | sysv* | isc* | esix* | sco* | minix* | irix4* | linux*) |
28f540f4 | 692 | base_os=unix/sysv ;; |
f802accb UD |
693 | irix6*) |
694 | base_os=unix/sysv/irix6/$os ;; | |
d586354e | 695 | solaris[2-9]*) |
28f540f4 | 696 | base_os=unix/sysv/sysv4 ;; |
908c3d5b UD |
697 | hpux*) |
698 | base_os=unix/sysv/hpux/$os ;; | |
75d86c1f UD |
699 | aix4.3*) |
700 | base_os=unix/sysv/aix/aix4.3 ;; | |
28f540f4 RM |
701 | none) |
702 | base_os=standalone ;; | |
28f540f4 RM |
703 | esac |
704 | ||
705 | # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos. | |
706 | tail=$os | |
707 | ostry=$os | |
708 | while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do | |
709 | ostry="$ostry /$o" | |
710 | tail=$o | |
75914335 | 711 | done |
28f540f4 RM |
712 | o=`echo $tail | sed 's/[0-9]*$//'` |
713 | if test $o != $tail; then | |
714 | ostry="$ostry /$o" | |
715 | fi | |
ec4b0518 UD |
716 | # For linux-gnu, try linux-gnu, then linux. |
717 | o=`echo $tail | sed 's/-.*$//'` | |
718 | if test $o != $tail; then | |
719 | ostry="$ostry /$o" | |
720 | fi | |
28f540f4 RM |
721 | |
722 | # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix. | |
723 | base= | |
724 | tail=$base_os | |
725 | while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do | |
726 | set $b | |
727 | base="$base /$1" | |
728 | tail="$2" | |
729 | done | |
730 | ||
ae6b8730 | 731 | # For sparc/sparc32, try sparc/sparc32 and then sparc. |
28f540f4 | 732 | mach= |
2ceaa76a | 733 | tail=$machine${submachine:+/$submachine} |
28f540f4 RM |
734 | while 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" | |
744 | done | |
745 | ||
746 | dnl We are done with glob and regexp uses of [ and ]; return to autoconf. | |
747 | changequote([,])dnl | |
748 | ||
749 | # Find what sysdep directories exist. | |
e0a3ed4f | 750 | sysnames_add_ons= |
28f540f4 | 751 | sysnames= |
4b69abad RM |
752 | for 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 | 790 | done |
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 |
794 | case $sysnames_add_ons$sysnames in |
795 | *"$multi_arch_d"*) | |
796 | ;; | |
797 | *) | |
77e8bddf | 798 | test x"$multi_arch" = xdefault && multi_arch=no |
84b9230c MF |
799 | ;; |
800 | esac | |
801 | if test x"$multi_arch" != xno; then | |
6f89d2f3 L |
802 | AC_DEFINE(USE_MULTIARCH) |
803 | fi | |
804 | AC_SUBST(multi_arch) | |
805 | ||
28f540f4 RM |
806 | if test -z "$os_used" && test "$os" != none; then |
807 | AC_MSG_ERROR(Operating system $os is not supported.) | |
808 | fi | |
809 | if test -z "$machine_used" && test "$machine" != none; then | |
810 | AC_MSG_ERROR(The $machine is not supported.) | |
811 | fi | |
2ceaa76a RM |
812 | if test -z "$submachine_used" && test -n "$submachine"; then |
813 | AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.) | |
814 | fi | |
815 | AC_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?). | |
825 | if 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 |
835 | fi |
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). | |
840 | set $sysnames | |
e50ec9f9 | 841 | names= |
28f540f4 RM |
842 | while 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. | |
903 | changequote(,)dnl | |
57ba7bb4 | 904 | parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`" |
28f540f4 RM |
905 | changequote([,])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 | |
916 | done | |
917 | ||
918 | # Add the default directories. | |
ecdc196c | 919 | default_sysnames=sysdeps/generic |
2de7874e | 920 | if test "$elf" = yes; then |
ecdc196c | 921 | default_sysnames="sysdeps/generic/elf $default_sysnames" |
2de7874e | 922 | fi |
ecdc196c | 923 | sysnames="$names $default_sysnames" |
f332db02 RM |
924 | AC_SUBST(sysnames) |
925 | # The other names were emitted during the scan. | |
ecdc196c | 926 | AC_MSG_RESULT($default_sysnames) |
28f540f4 | 927 | |
e0a3ed4f RM |
928 | # Collect the list of add-ons that supply partial sysdeps trees. |
929 | sysdeps_add_ons= | |
930 | for 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 | |
980 | done | |
981 | AC_SUBST(sysdeps_add_ons) | |
982 | ||
f332db02 RM |
983 | |
984 | ### Locate tools. | |
28f540f4 | 985 | |
28f540f4 | 986 | AC_PROG_INSTALL |
2b80a372 | 987 | if 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 | 990 | fi |
0e3426bb | 991 | AC_PROG_LN_S |
ae828bc6 | 992 | |
4baa087a RM |
993 | LIBC_PROG_BINUTILS |
994 | AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in | |
995 | ||
996 | # Accept binutils 2.13 or newer. | |
997 | AC_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 |
1000 | AC_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. | |
1009 | AC_PATH_PROG(PWD_P, pwd, no) | |
1010 | if test "$PWD_P" = no; then | |
1011 | AC_MSG_ERROR(*** A pwd binary could not be found.) | |
1012 | fi | |
1013 | ||
63bda0c1 | 1014 | # These programs are version sensitive. |
3a12e572 | 1015 | AC_CHECK_TOOL_PREFIX |
4bca4c17 | 1016 | AC_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 | 1019 | AC_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 | 1023 | AC_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 | 1027 | AC_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 | 1031 | AC_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 |
1036 | AC_CHECK_TOOL(READELF, readelf, false) |
1037 | ||
476e7d78 RM |
1038 | AC_CHECK_PROGS(AUTOCONF, autoconf, no) |
1039 | case "x$AUTOCONF" in | |
1040 | xno|x|x:) AUTOCONF=no ;; | |
1041 | *) | |
1042 | AC_CACHE_CHECK(dnl | |
1400de2e | 1043 | whether $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 | ;; | |
1051 | esac | |
92963737 | 1052 | if test "x$AUTOCONF" = xno; then |
476e7d78 | 1053 | aux_missing="$aux_missing autoconf" |
14519931 | 1054 | fi |
1400de2e | 1055 | |
32a448ed RM |
1056 | test -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 | 1060 | test -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.) | |
1068 | if 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 |
1083 | fi |
1084 | AC_SUBST(SYSINCLUDES) | |
ef226fec | 1085 | AC_SUBST(CXX_SYSINCLUDES) |
dbe7a0f5 | 1086 | |
e9433893 UD |
1087 | # ranlib is never necessary on Linux and Hurd systems |
1088 | RANLIB=: | |
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 | |
1097 | AC_MSG_CHECKING(LD_LIBRARY_PATH variable) | |
1098 | changequote(,)dnl | |
1099 | case ${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 | ;; | |
1106 | esac | |
1107 | changequote([,])dnl | |
1108 | AC_MSG_RESULT($ld_library_path_setting) | |
1109 | if test "$ld_library_path_setting" != "ok"; then | |
63bda0c1 UD |
1110 | AC_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 | 1114 | fi |
8e31cf7e | 1115 | |
74bd2300 UD |
1116 | AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl |
1117 | if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then | |
1118 | libc_cv_gcc_static_libgcc= | |
1119 | else | |
1120 | libc_cv_gcc_static_libgcc=-static-libgcc | |
1121 | fi]) | |
1122 | AC_SUBST(libc_cv_gcc_static_libgcc) | |
1123 | ||
26f56c1c UD |
1124 | AC_PATH_PROG(BASH_SHELL, bash, no) |
1125 | if 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 |
1129 | else | |
1130 | libc_cv_have_bash2=no | |
1131 | fi | |
1132 | AC_SUBST(libc_cv_have_bash2) | |
1133 | ||
5290baf0 | 1134 | dnl We need a ksh compatible shell for tzselect. |
26f56c1c | 1135 | if 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 | |
1142 | else | |
26f56c1c | 1143 | KSH="$BASH_SHELL" |
5290baf0 UD |
1144 | AC_SUBST(KSH) |
1145 | libc_cv_have_ksh=yes | |
1146 | fi | |
1147 | AC_SUBST(libc_cv_have_ksh) | |
1148 | ||
5aa8ff62 | 1149 | AC_PROG_AWK |
c0016081 | 1150 | AC_PATH_PROG(PERL, perl, no) |
2fd5d029 RM |
1151 | if test "$PERL" != no && |
1152 | (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then | |
1153 | PERL=no | |
ecb06196 | 1154 | fi |
2f512715 AS |
1155 | AC_PATH_PROG(INSTALL_INFO, install-info, no, |
1156 | $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin) | |
2de00372 UD |
1157 | AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin) |
1158 | ||
b8dc6a10 | 1159 | AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl |
28f540f4 RM |
1160 | echo '#include <stddef.h> |
1161 | FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c | |
1162 | if eval "$ac_cpp conftest.c 2>/dev/null" \ | |
1163 | | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then | |
1164 | libc_cv_signed_size_t=no | |
1165 | else | |
1166 | libc_cv_signed_size_t=yes | |
1167 | fi | |
1168 | rm -f conftest*]) | |
28f540f4 RM |
1169 | if 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 | |
1174 | EOF | |
1175 | fi | |
1176 | ||
b8dc6a10 | 1177 | AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl |
28f540f4 RM |
1178 | AC_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 | |
1187 | if (&size == NULL || &wchar == NULL) abort ();], | |
77e8bddf AS |
1188 | libc_cv_friendly_stddef=yes, |
1189 | libc_cv_friendly_stddef=no)]) | |
28f540f4 RM |
1190 | if test $libc_cv_friendly_stddef = yes; then |
1191 | config_vars="$config_vars | |
1192 | override stddef.h = # The installed <stddef.h> seems to be libc-friendly." | |
1193 | fi | |
1194 | ||
b8dc6a10 RM |
1195 | AC_CACHE_CHECK(whether we need to use -P to assemble .S files, |
1196 | libc_cv_need_minus_P, [dnl | |
28f540f4 RM |
1197 | cat > conftest.S <<EOF |
1198 | #include "confdefs.h" | |
1199 | /* Nothing whatsoever. */ | |
1200 | EOF | |
3217788f | 1201 | if 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 |
1203 | else | |
1204 | libc_cv_need_minus_P=yes | |
1205 | fi | |
1206 | rm -f conftest*]) | |
28f540f4 RM |
1207 | if test $libc_cv_need_minus_P = yes; then |
1208 | config_vars="$config_vars | |
1209 | asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives." | |
1210 | fi | |
1211 | ||
b8dc6a10 | 1212 | AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl |
9a70fcab | 1213 | cat > conftest.s <<EOF |
2293395f | 1214 | ${libc_cv_dot_text} |
ae1025be | 1215 | foo: |
df2a0c93 | 1216 | .set glibc_conftest_frobozz,foo |
9a70fcab | 1217 | $libc_cv_asm_global_directive glibc_conftest_frobozz |
e215c478 | 1218 | EOF |
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. | |
1221 | cat > conftest1.c <<\EOF | |
1222 | extern int glibc_conftest_frobozz; | |
640f0119 | 1223 | void _start() { glibc_conftest_frobozz = 1; } |
df2a0c93 RM |
1224 | EOF |
1225 | if ${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 |
1229 | else | |
1230 | libc_cv_asm_set_directive=no | |
1231 | fi | |
65b3cbcb | 1232 | rm -f conftest*]) |
e215c478 RM |
1233 | if test $libc_cv_asm_set_directive = yes; then |
1234 | AC_DEFINE(HAVE_ASM_SET_DIRECTIVE) | |
1235 | fi | |
1236 | ||
415ac3df UD |
1237 | AC_CACHE_CHECK(for assembler gnu_unique_object symbol type, |
1238 | libc_cv_asm_unique_object, [dnl | |
1239 | cat > conftest.s <<EOF | |
1240 | ${libc_cv_dot_text} | |
1241 | _sym: | |
1242 | .type _sym, ${libc_cv_asm_type_prefix}gnu_unique_object | |
1243 | EOF | |
1244 | if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then | |
1245 | libc_cv_asm_unique_object=yes | |
1246 | else | |
1247 | libc_cv_asm_unique_object=no | |
1248 | fi | |
1249 | rm -f conftest*]) | |
1250 | if test $libc_cv_asm_unique_object = yes; then | |
1251 | AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT) | |
1252 | fi | |
1253 | ||
377a515b UD |
1254 | AC_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 |
1259 | EOF | |
3217788f | 1260 | if ${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 |
1262 | else | |
1263 | libc_cv_asm_symver_directive=no | |
1264 | fi | |
1265 | rm -f conftest*]) | |
1266 | AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl | |
1267 | if 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 |
1272 | EOF | |
1273 | cat > conftest.map <<EOF | |
f43ce637 | 1274 | VERS_1 { |
377a515b UD |
1275 | global: sym; |
1276 | }; | |
f43ce637 UD |
1277 | |
1278 | VERS_2 { | |
77e8bddf | 1279 | global: sym; |
f43ce637 | 1280 | } VERS_1; |
377a515b | 1281 | EOF |
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 | |
1296 | else | |
1297 | libc_cv_ld_version_script_option=no | |
1298 | fi | |
1299 | rm -f conftest*]) | |
7499a22a RM |
1300 | if 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) | |
1306 | else | |
1307 | VERSIONING=no | |
1308 | fi | |
1309 | AC_SUBST(VERSIONING) | |
1310 | ||
102a3e8f | 1311 | if 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 | 1317 | fi |
fd26970f UD |
1318 | if 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 | |
1324 | EOF | |
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 | |
1339 | EOF | |
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 | |
1354 | foo: | |
1355 | .hidden bar | |
1356 | bar: | |
1357 | EOF | |
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; | |
1371 | EOF | |
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; } | |
1394 | EOF | |
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 |
1397 | changequote(,)dnl |
1398 | if grep '\.hidden[ _]foo' conftest.s >/dev/null; then | |
1399 | changequote([,])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 |
1419 | EOF |
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 |
1452 | int _start (void) { return 0; } | |
1453 | int __start (void) { return 0; } | |
1454 | int foo (void) { return 1; } | |
2c617417 | 1455 | int (*fp) (void) __attribute__ ((section (".init_array"))) = foo; |
5241882c | 1456 | EOF |
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 | |
1506 | int main (void) { return 0; } | |
1507 | EOF | |
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 | |
1523 | int _start (void) { return 42; } | |
1524 | EOF | |
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 | |
1539 | int _start (void) { return 42; } | |
1540 | EOF | |
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 | |
1555 | int _start (void) { return 42; } | |
1556 | EOF | |
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([[ | |
1594 | int _start (void) { return 42; } | |
1595 | extern 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 | 1599 | const 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. */ | |
1603 | int data[0x10000] = { 1, }; | |
574920b4 RM |
1604 | ]])]) |
1605 | cat > conftest.awk <<\EOF | |
1606 | BEGIN { | |
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 | } | |
1619 | END { print result } | |
1620 | EOF | |
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 | |
1645 | int _start (void) { return 42; } | |
1646 | EOF | |
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 | |
1661 | int main (void) { return 0; } | |
1662 | EOF | |
1663 | changequote(,)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'` | |
1668 | changequote([,])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 | |
1675 | int main (void) { return 0; } | |
1676 | EOF | |
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 | |
1693 | void foo (void) { } | |
1694 | EOF | |
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 |
1714 | extern int bar (int); |
1715 | extern int mumble; | |
1716 | int foo (void) { return bar (mumble); } | |
a711b01d | 1717 | EOF |
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 |
1723 | dnl The following test is a bit weak. We must use a tool which can test | |
1724 | dnl cross-platform since the gcc used can be a cross compiler. Without | |
1725 | dnl introducing new options this is not easily doable. Instead use a tool | |
1726 | dnl which always is cross-platform: readelf. To detect whether -z combreloc | |
1727 | dnl 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 | |
1745 | int _start (void) { return 42; } | |
1746 | EOF | |
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 | |
1761 | int foo; | |
49803108 | 1762 | main () { return 0;} |
c9c60884 UD |
1763 | EOF |
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 | |
1778 | int _start (void) { return 42; } | |
1779 | EOF | |
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" | |
1809 | EOF | |
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 | 1843 | fi |
49803108 | 1844 | |
5c550700 RM |
1845 | AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl |
1846 | if libc_cv_output_format=` | |
1847 | ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD` | |
1848 | then | |
1849 | : | |
1850 | else | |
1851 | libc_cv_output_format= | |
1852 | fi | |
1853 | test -n "$libc_cv_output_format" || libc_cv_output_format=unknown]) | |
1854 | AC_SUBST(libc_cv_output_format) | |
1855 | ||
22dca1ea | 1856 | AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl |
49803108 AJ |
1857 | cat > conftest.c <<EOF |
1858 | int foo; | |
1859 | EOF | |
22dca1ea | 1860 | if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors |
49803108 AJ |
1861 | conftest.c 1>&AS_MESSAGE_LOG_FD]) |
1862 | then | |
18e2ac6d | 1863 | libc_cv_fno_toplevel_reorder=yes |
49803108 | 1864 | else |
18e2ac6d | 1865 | libc_cv_fno_toplevel_reorder=no |
49803108 AJ |
1866 | fi |
1867 | rm -f conftest*]) | |
18e2ac6d | 1868 | if test $libc_cv_fno_toplevel_reorder = yes; then |
22dca1ea | 1869 | fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors" |
18e2ac6d | 1870 | else |
49803108 AJ |
1871 | fno_unit_at_a_time=-fno-unit-at-a-time |
1872 | fi | |
1873 | AC_SUBST(fno_unit_at_a_time) | |
fd26970f | 1874 | |
401a9ec9 UD |
1875 | AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl |
1876 | cat > conftest.c <<EOF | |
1877 | int foo; | |
1878 | main () { return 0;} | |
1879 | EOF | |
a40fbc8d | 1880 | if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector |
401a9ec9 UD |
1881 | -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]) |
1882 | then | |
1883 | libc_cv_ssp=yes | |
1884 | else | |
1885 | libc_cv_ssp=no | |
1886 | fi | |
1887 | rm -f conftest*]) | |
1888 | AC_SUBST(libc_cv_ssp) | |
1889 | ||
b037a293 UD |
1890 | AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl |
1891 | cat > conftest.c <<EOF | |
1892 | int foo; | |
1893 | #ifdef __GNUC_GNU_INLINE__ | |
1894 | main () { return 0;} | |
1895 | #else | |
1896 | #error | |
1897 | #endif | |
1898 | EOF | |
371f84a4 JJ |
1899 | if 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 |
1901 | then |
1902 | libc_cv_gnu89_inline=yes | |
1903 | else | |
1904 | libc_cv_gnu89_inline=no | |
1905 | fi | |
1906 | rm -f conftest*]) | |
1907 | if test $libc_cv_gnu89_inline = yes; then | |
1c7570ff | 1908 | gnu89_inline=-fgnu89-inline |
b037a293 | 1909 | else |
1c7570ff | 1910 | gnu89_inline= |
b037a293 | 1911 | fi |
1c7570ff | 1912 | AC_SUBST(gnu89_inline) |
b037a293 | 1913 | |
b8dc6a10 RM |
1914 | if 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 | |
1925 | fi | |
e215c478 | 1926 | |
57d44131 | 1927 | if 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; | |
1933 | EOF | |
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 | |
1948 | fi | |
1949 | ||
9a0a462c UD |
1950 | dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) |
1951 | AC_DEFUN(AC_CHECK_ASM_UNDERSCORE, | |
1952 | [cat > conftest.$ac_ext <<EOF | |
1953 | dnl This sometimes fails to find confdefs.h, for some reason. | |
85dd1003 UD |
1954 | dnl [#]line $LINENO "[$]0" |
1955 | [#]line $LINENO "configure" | |
9a0a462c UD |
1956 | #include "confdefs.h" |
1957 | void underscore_test(void) { | |
1958 | return; } | |
1959 | EOF | |
1960 | if 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 | |
1968 | else | |
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]) | |
1973 | fi | |
1974 | rm -f conftest*]) | |
1975 | ||
c224a18a RM |
1976 | if test $elf = yes; then |
1977 | libc_cv_asm_underscores=no | |
1978 | else | |
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 |
1989 | fi |
1990 | if test $libc_cv_asm_underscores = no; then | |
1991 | AC_DEFINE(NO_UNDERSCORES) | |
1992 | fi | |
1993 | ||
1994 | if test $elf = yes; then | |
1995 | libc_cv_weak_symbols=yes | |
9a97d1f7 UD |
1996 | fi |
1997 | ||
1998 | AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive, | |
75d86c1f | 1999 | [dnl |
c224a18a | 2000 | cat > conftest.s <<EOF |
2293395f | 2001 | ${libc_cv_dot_text} |
c224a18a | 2002 | ${libc_cv_asm_global_directive} foo |
ae1025be | 2003 | foo: |
c224a18a RM |
2004 | .weak foo |
2005 | .weak bar; bar = foo | |
2006 | EOF | |
3217788f | 2007 | if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then |
9a97d1f7 UD |
2008 | libc_cv_asm_weak_directive=yes |
2009 | else | |
2010 | libc_cv_asm_weak_directive=no | |
2011 | fi | |
2012 | rm -f conftest*]) | |
c224a18a | 2013 | |
c8cf0b14 | 2014 | if 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 | |
2018 | cat > conftest.s <<EOF | |
2293395f | 2019 | ${libc_cv_dot_text} |
c224a18a | 2020 | ${libc_cv_asm_global_directive} foo |
ae1025be | 2021 | foo: |
f802accb UD |
2022 | .weakext bar foo |
2023 | .weakext baz | |
2024 | ${libc_cv_asm_global_directive} baz | |
9a97d1f7 | 2025 | baz: |
c224a18a | 2026 | EOF |
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 | 2034 | fi # no .weak |
c224a18a | 2035 | |
ffcf9634 | 2036 | if test $libc_cv_asm_weak_directive = yes; then |
c224a18a | 2037 | AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE) |
ffcf9634 | 2038 | elif test $libc_cv_asm_weakext_directive = yes; then |
c224a18a RM |
2039 | AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE) |
2040 | fi | |
2041 | ||
50189569 | 2042 | AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl |
ced368f7 UD |
2043 | case $machine in |
2044 | sparc/sparc64*) cfi_offset=2047;; | |
2045 | *) cfi_offset=0;; | |
2046 | esac | |
50189569 | 2047 | cat > conftest.s <<EOF |
77e8bddf AS |
2048 | .text |
2049 | .type func,%function | |
50189569 | 2050 | func: |
77e8bddf | 2051 | .cfi_startproc |
f212e8dc | 2052 | .cfi_remember_state |
ced368f7 | 2053 | .cfi_rel_offset 1, $cfi_offset |
77e8bddf | 2054 | .cfi_endproc |
50189569 AJ |
2055 | EOF |
2056 | if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then | |
2057 | libc_cv_asm_cfi_directives=yes | |
2058 | else | |
2059 | libc_cv_asm_cfi_directives=no | |
2060 | fi | |
2061 | rm -f conftest*]) | |
2062 | if test $libc_cv_asm_cfi_directives = yes; then | |
2063 | AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES) | |
bcd5f356 | 2064 | fi |
50189569 | 2065 | |
a641835a RM |
2066 | AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl |
2067 | cat > conftest.c <<\EOF | |
5f0e6fc7 | 2068 | _start () {} |
dcf0671d UD |
2069 | int __eh_pc; |
2070 | __throw () {} | |
a641835a | 2071 | EOF |
dcea62dd | 2072 | dnl No \ in command here because it ends up inside ''. |
3217788f | 2073 | if 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 |
2077 | else | |
2078 | libc_cv_ld_no_whole_archive=no | |
2079 | fi | |
2080 | rm -f conftest*]) | |
b17277cf UD |
2081 | if test $libc_cv_ld_no_whole_archive = yes; then |
2082 | no_whole_archive=-Wl,--no-whole-archive | |
2083 | fi | |
2084 | AC_SUBST(no_whole_archive)dnl | |
a641835a | 2085 | |
dff14448 | 2086 | AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl |
b236e99d UD |
2087 | cat > conftest.c <<\EOF |
2088 | _start () {} | |
2089 | int __eh_pc; | |
2090 | __throw () {} | |
2091 | EOF | |
2092 | dnl No \ in command here because it ends up inside ''. | |
3217788f | 2093 | if 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 | 2097 | else |
dff14448 | 2098 | libc_cv_gcc_exceptions=no |
b236e99d UD |
2099 | fi |
2100 | rm -f conftest*]) | |
dff14448 UD |
2101 | if test $libc_cv_gcc_exceptions = yes; then |
2102 | exceptions=-fexceptions | |
b17277cf | 2103 | fi |
dff14448 | 2104 | AC_SUBST(exceptions)dnl |
b236e99d | 2105 | |
66000494 UD |
2106 | if 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. | |
2109 | AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl | |
2110 | AC_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')]) | |
2113 | if test "$libc_cv_c_asmcr0_bug" != 'no'; then | |
2114 | AC_DEFINE(BROKEN_PPC_ASM_CR0) | |
2115 | fi | |
2116 | fi | |
2117 | ||
a8eab8b1 UD |
2118 | dnl Check whether compiler understands __builtin_expect. |
2119 | AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect, | |
2120 | [cat > conftest.c <<EOF | |
85dd1003 | 2121 | #line $LINENO "configure" |
a8eab8b1 UD |
2122 | int foo (int a) |
2123 | { | |
2124 | a = __builtin_expect (a, 10); | |
2125 | return a == 10 ? 0 : 1; | |
2126 | } | |
2127 | EOF | |
2128 | dnl No \ in command here because it ends up inside ''. | |
3217788f | 2129 | if 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 |
2132 | else | |
2133 | libc_cv_gcc_builtin_expect=no | |
2134 | fi | |
2135 | rm -f conftest*]) | |
2136 | if test "$libc_cv_gcc_builtin_expect" = yes; then | |
2137 | AC_DEFINE(HAVE_BUILTIN_EXPECT) | |
2138 | fi | |
2139 | ||
d555194c UD |
2140 | AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl |
2141 | cat > conftest.c <<\EOF | |
2142 | void zero (void *x) | |
2143 | { | |
a52d1562 | 2144 | __builtin_memset (x, 0, 1000); |
d555194c UD |
2145 | } |
2146 | EOF | |
2147 | dnl | |
2148 | if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]); | |
2149 | then | |
2150 | libc_cv_gcc_builtin_memset=no | |
2151 | else | |
2152 | libc_cv_gcc_builtin_memset=yes | |
2153 | fi | |
2154 | rm -f conftest* ]) | |
2155 | if test "$libc_cv_gcc_builtin_memset" = yes ; then | |
2156 | AC_DEFINE(HAVE_BUILTIN_MEMSET) | |
2157 | fi | |
2158 | ||
85dd1003 UD |
2159 | AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl |
2160 | cat > conftest.c <<\EOF | |
2161 | extern char *strstr (const char *, const char *) __asm ("my_strstr"); | |
2162 | char *foo (const char *a, const char *b) | |
2163 | { | |
2164 | return __builtin_strstr (a, b); | |
2165 | } | |
2166 | EOF | |
2167 | dnl | |
2168 | if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]); | |
2169 | then | |
2170 | libc_cv_gcc_builtin_redirection=yes | |
2171 | else | |
2172 | libc_cv_gcc_builtin_redirection=no | |
2173 | fi | |
2174 | rm -f conftest* ]) | |
2175 | if test "$libc_cv_gcc_builtin_redirection" = yes ; then | |
2176 | AC_DEFINE(HAVE_BUILTIN_REDIRECTION) | |
2177 | fi | |
2178 | ||
739d440d | 2179 | dnl Check whether the compiler supports the __thread keyword. |
5b8f26b4 RM |
2180 | if 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; |
2184 | EOF | |
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 |
2194 | else |
2195 | libc_cv_gcc___thread=no | |
2196 | fi | |
739d440d | 2197 | |
9b21e6bc RM |
2198 | if 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 | |
2202 | extern __thread int a __attribute__((tls_model ("initial-exec"))); | |
2203 | EOF | |
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 | |
2213 | fi | |
739d440d | 2214 | |
2cf9ad57 RM |
2215 | if 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 | |
2228 | fi | |
2229 | AC_SUBST(libc_cv_cc_submachine) | |
2230 | ||
c8f3e6db UD |
2231 | dnl Check whether we have the gd library available. |
2232 | AC_MSG_CHECKING(for libgd) | |
6dab8688 UD |
2233 | if 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" | |
2244 | else | |
2245 | LIBGD=no | |
2246 | fi | |
c8f3e6db UD |
2247 | AC_MSG_RESULT($LIBGD) |
2248 | AC_SUBST(LIBGD) | |
3d558f4e | 2249 | |
2fff3d93 UD |
2250 | # SELinux detection |
2251 | if test x$with_selinux = xno ; then | |
2252 | have_selinux=no; | |
2253 | else | |
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 | |
2275 | fi | |
2276 | # Check if we're building with SELinux support. | |
2277 | if 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 |
2294 | fi |
2295 | AC_SUBST(have_selinux) | |
2296 | ||
8ed1e7d5 GK |
2297 | dnl check for the size of 'long double'. |
2298 | AC_CHECK_SIZEOF(long double, 0) | |
2299 | sizeof_long_double=$ac_cv_sizeof_long_double | |
2300 | AC_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 | 2306 | use_ldconfig=no |
cb343854 | 2307 | ldd_rewrite_script=no |
77259608 | 2308 | libc_cv_sysconfdir=$sysconfdir |
74bd2300 | 2309 | libc_cv_gcc_unwind_find_fde=no |
e2fd3cbe | 2310 | libc_cv_idn=no |
cb343854 | 2311 | |
28f540f4 | 2312 | # Iterate over all the sysdep directories we will use, running their |
09055553 | 2313 | # configure fragments. |
28f540f4 | 2314 | for 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 |
2323 | done |
2324 | ||
74bd2300 UD |
2325 | if test x$libc_cv_gcc_unwind_find_fde = xyes; then |
2326 | AC_DEFINE(EXPORT_UNWIND_FIND_FDE) | |
2327 | fi | |
2328 | AC_SUBST(libc_cv_gcc_unwind_find_fde) | |
2329 | ||
a8c01776 RM |
2330 | dnl This is tested by existing code and it's simpler to avoid changing it. |
2331 | AC_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. | |
2335 | AC_MSG_CHECKING(for old glibc 2.0.x headers) | |
350eb336 | 2336 | if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h" |
a53bad16 UD |
2337 | then |
2338 | old_glibc_headers=yes | |
2339 | else | |
2340 | old_glibc_headers=no | |
2341 | fi | |
2342 | AC_MSG_RESULT($old_glibc_headers) | |
2343 | if 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.) | |
2346 | fi | |
b195f6bc | 2347 | AC_SUBST(old_glibc_headers) |
26b4d766 | 2348 | |
84384f5b | 2349 | AC_SUBST(libc_cv_slibdir) |
a1d84548 | 2350 | AC_SUBST(libc_cv_localedir) |
77259608 | 2351 | AC_SUBST(libc_cv_sysconfdir) |
1ef32c3d | 2352 | AC_SUBST(libc_cv_rootsbindir) |
bcd5f356 | 2353 | AC_SUBST(libc_cv_forced_unwind) |
1ef32c3d | 2354 | |
58a4b51a RM |
2355 | dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests |
2356 | AC_SUBST(libc_cv_cpp_asm_debuginfo) | |
06e51c8f | 2357 | AC_SUBST(libc_cv_cc_sse4) |
b0ecde3a | 2358 | AC_SUBST(libc_cv_cc_avx) |
091023f5 | 2359 | AC_SUBST(libc_cv_cc_novzeroupper) |
01f1f5ee | 2360 | AC_SUBST(libc_cv_as_i686) |
58a4b51a | 2361 | |
591e1ffb | 2362 | AC_SUBST(use_ldconfig) |
cb343854 | 2363 | AC_SUBST(ldd_rewrite_script) |
84384f5b | 2364 | |
d0b2cbf8 | 2365 | AC_SUBST(elf) AC_SUBST(xcoff) |
28f540f4 RM |
2366 | if test $elf = yes; then |
2367 | AC_DEFINE(HAVE_ELF) | |
2368 | fi | |
5af3245a UD |
2369 | if test $xcoff = yes; then |
2370 | AC_DEFINE(HAVE_XCOFF) | |
2371 | fi | |
28f540f4 | 2372 | |
650425ce | 2373 | AC_SUBST(static) |
ff3d7ed3 RM |
2374 | AC_SUBST(shared) |
2375 | if test $shared = default; then | |
57d44131 | 2376 | shared=$elf |
a334319f UD |
2377 | fi |
2378 | ||
ff886b82 UD |
2379 | AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default, |
2380 | [libc_cv_pic_default=yes | |
cc3fa755 | 2381 | cat > conftest.c <<EOF |
9756dfe1 | 2382 | #if defined __PIC__ || defined __pic__ || defined PIC || defined pic |
cc3fa755 UD |
2383 | # error PIC is default. |
2384 | #endif | |
2385 | EOF | |
0b4ee387 | 2386 | if 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 |
2388 | fi |
2389 | rm -f conftest.*]) | |
ff886b82 | 2390 | AC_SUBST(libc_cv_pic_default) |
cc3fa755 | 2391 | |
ff3d7ed3 RM |
2392 | AC_SUBST(profile) |
2393 | AC_SUBST(omitfp) | |
5a97622d | 2394 | AC_SUBST(bounded) |
5107cf1d | 2395 | AC_SUBST(static_nss) |
5ae3e846 | 2396 | AC_SUBST(nopic_initfini) |
ff3d7ed3 | 2397 | |
edf5b2d7 UD |
2398 | AC_SUBST(DEFINES) |
2399 | ||
61c83c3f RM |
2400 | dnl See sysdeps/mach/configure.in for this variable. |
2401 | AC_SUBST(mach_interface_list) | |
2402 | ||
28f540f4 RM |
2403 | if test "`(cd $srcdir; pwd)`" = "`pwd`"; then |
2404 | config_makefile= | |
2405 | else | |
2406 | config_makefile=Makefile | |
2407 | fi | |
2408 | ||
ee74a442 UD |
2409 | VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h` |
2410 | RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h` | |
df4ef2ab | 2411 | AC_SUBST(VERSION) |
ee74a442 | 2412 | AC_SUBST(RELEASE) |
df4ef2ab | 2413 | |
09055553 | 2414 | AC_CONFIG_FILES([config.make ${config_makefile}]) |
c118d634 | 2415 | AC_CONFIG_COMMANDS([default],[[ |
737547be UD |
2416 | case $CONFIG_FILES in *config.make*) |
2417 | echo "$config_vars" >> config.make;; | |
2418 | esac | |
c118d634 RM |
2419 | test -d bits || mkdir bits]],[[config_vars='$config_vars']]) |
2420 | AC_OUTPUT |