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