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