]>
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. |
02d35f06 PE |
3 | AC_INIT([GNU C Library], [(see version.h)], [https://sourceware.org/bugzilla/], |
4 | [glibc], [https://www.gnu.org/software/glibc/]) | |
5d77b1da | 5 | AC_CONFIG_SRCDIR([include/features.h]) |
6b7f6183 RM |
6 | AC_CONFIG_HEADERS([config.h]) |
7 | AC_CONFIG_AUX_DIR([scripts]) | |
28f540f4 | 8 | |
8b748aed | 9 | ACX_PKGVERSION([GNU libc]) |
5a82c748 | 10 | ACX_BUGURL([https://www.gnu.org/software/libc/bugs.html]) |
8b748aed JM |
11 | AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], |
12 | [Package description]) | |
13 | AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], | |
14 | [Bug reporting address]) | |
15 | ||
918b5606 L |
16 | # Glibc should not depend on any header files |
17 | AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS], | |
18 | [m4_divert_text([DEFAULTS], | |
19 | [ac_includes_default='/* none */'])]) | |
20 | ||
bb931195 TS |
21 | # We require GCC, and by default use its preprocessor. Override AC_PROG_CPP |
22 | # here to work around the Autoconf issue discussed in | |
a306c790 | 23 | # <https://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>. |
bb931195 TS |
24 | AC_DEFUN([AC_PROG_CPP], |
25 | [AC_REQUIRE([AC_PROG_CC])dnl | |
26 | AC_ARG_VAR([CPP], [C preprocessor])dnl | |
27 | _AC_ARG_VAR_CPPFLAGS()dnl | |
28 | # On Suns, sometimes $CPP names a directory. | |
29 | if test -n "$CPP" && test -d "$CPP"; then | |
30 | CPP= | |
31 | fi | |
32 | if test -z "$CPP"; then | |
33 | CPP="$CC -E" | |
34 | fi | |
35 | AC_SUBST(CPP)dnl | |
36 | ])# AC_PROG_CPP | |
37 | ||
b5a5da23 TS |
38 | # We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf |
39 | # issue discussed in | |
a306c790 | 40 | # <https://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>. |
b5a5da23 TS |
41 | AC_DEFUN([_AC_PROG_CC_C89], [[$1]]) |
42 | ||
7967983f RM |
43 | dnl This is here so we can set $subdirs directly based on configure fragments. |
44 | AC_CONFIG_SUBDIRS() | |
45 | ||
c16a054d AS |
46 | AC_CANONICAL_HOST |
47 | ||
c0bac8b0 UD |
48 | AC_PROG_CC |
49 | if test $host != $build; then | |
50 | AC_CHECK_PROGS(BUILD_CC, gcc cc) | |
51 | fi | |
52 | AC_SUBST(cross_compiling) | |
53 | AC_PROG_CPP | |
e4693aa7 | 54 | |
c0bac8b0 UD |
55 | # We need the C++ compiler only for testing. |
56 | AC_PROG_CXX | |
e4693aa7 RM |
57 | # It's useless to us if it can't link programs (e.g. missing -lstdc++). |
58 | AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl | |
59 | AC_LANG_PUSH([C++]) | |
d337ceb7 | 60 | # Default, dynamic case. |
e4693aa7 RM |
61 | AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
62 | [libc_cv_cxx_link_ok=yes], | |
63 | [libc_cv_cxx_link_ok=no]) | |
d337ceb7 FW |
64 | # Static case. |
65 | old_LDFLAGS="$LDFLAGS" | |
66 | LDFLAGS="$LDFLAGS -static" | |
67 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
68 | #include <iostream> | |
69 | ||
70 | int | |
71 | main() | |
72 | { | |
73 | std::cout << "Hello, world!"; | |
74 | return 0; | |
75 | } | |
76 | ])], | |
77 | [], | |
78 | [libc_cv_cxx_link_ok=no]) | |
79 | LDFLAGS="$old_LDFLAGS" | |
e4693aa7 RM |
80 | AC_LANG_POP([C++])]) |
81 | AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=]) | |
c0bac8b0 | 82 | |
db340c90 | 83 | if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then |
c72637d4 RM |
84 | AC_MSG_ERROR([you must configure in a separate build directory]) |
85 | fi | |
86 | ||
28f540f4 RM |
87 | # This will get text that should go into config.make. |
88 | config_vars= | |
89 | ||
c8f3e6db | 90 | # Check for a --with-gd argument and set libgd-LDFLAGS in config.make. |
6b7f6183 | 91 | AC_ARG_WITH([gd], |
83103074 | 92 | AS_HELP_STRING([--with-gd=DIR], |
77e8bddf | 93 | [find libgd include dir and library with prefix DIR]), |
c8f3e6db UD |
94 | [dnl |
95 | case "$with_gd" in | |
f5f7239f UD |
96 | yes|''|no) ;; |
97 | *) libgd_include="-I$withval/include" | |
c8f3e6db UD |
98 | libgd_ldflags="-L$withval/lib" ;; |
99 | esac | |
100 | ]) | |
6b7f6183 | 101 | AC_ARG_WITH([gd-include], |
83103074 | 102 | AS_HELP_STRING([--with-gd-include=DIR], |
77e8bddf AS |
103 | [find libgd include files in DIR]), |
104 | [dnl | |
f5f7239f UD |
105 | case "$with_gd_include" in |
106 | ''|no) ;; | |
107 | *) libgd_include="-I$withval" ;; | |
108 | esac | |
109 | ]) | |
6b7f6183 | 110 | AC_ARG_WITH([gd-lib], |
83103074 | 111 | AS_HELP_STRING([--with-gd-lib=DIR], |
77e8bddf AS |
112 | [find libgd library files in DIR]), |
113 | [dnl | |
f5f7239f UD |
114 | case "$with_gd_lib" in |
115 | ''|no) ;; | |
116 | *) libgd_ldflags="-L$withval" ;; | |
117 | esac | |
118 | ]) | |
119 | ||
120 | if test -n "$libgd_include"; then | |
121 | config_vars="$config_vars | |
cf90163d | 122 | CFLAGS-memusagestat.c = $libgd_include" |
f5f7239f UD |
123 | fi |
124 | if test -n "$libgd_ldflags"; then | |
125 | config_vars="$config_vars | |
126 | libgd-LDFLAGS = $libgd_ldflags" | |
127 | fi | |
28f540f4 | 128 | |
ff3d7ed3 | 129 | dnl Arguments to specify presence of other packages/features. |
6b7f6183 | 130 | AC_ARG_WITH([binutils], |
83103074 | 131 | AS_HELP_STRING([--with-binutils=PATH], |
77e8bddf | 132 | [specify location of binutils (as and ld)]), |
6b7f6183 RM |
133 | [path_binutils=$withval], |
134 | [path_binutils='']) | |
2fff3d93 | 135 | AC_ARG_WITH([selinux], |
83103074 | 136 | AS_HELP_STRING([--with-selinux], |
77e8bddf | 137 | [if building with SELinux support]), |
2fff3d93 UD |
138 | [with_selinux=$withval], |
139 | [with_selinux=auto]) | |
28f540f4 | 140 | |
6b7f6183 | 141 | AC_ARG_WITH([headers], |
83103074 | 142 | AS_HELP_STRING([--with-headers=PATH], |
77e8bddf | 143 | [location of system headers to use |
6b7f6183 RM |
144 | (for example /usr/src/linux/include) |
145 | @<:@default=compiler default@:>@]), | |
146 | [sysheaders=$withval], | |
147 | [sysheaders='']) | |
c91c505f | 148 | AC_SUBST(sysheaders) |
dbe7a0f5 | 149 | |
f781ef40 RM |
150 | AC_SUBST(use_default_link) |
151 | AC_ARG_WITH([default-link], | |
83103074 | 152 | AS_HELP_STRING([--with-default-link], |
fd5e21c7 | 153 | [do not use explicit linker scripts]), |
f781ef40 | 154 | [use_default_link=$withval], |
198abcbb | 155 | [use_default_link=no]) |
f781ef40 | 156 | |
6413fcde FW |
157 | dnl Additional build flags injection. |
158 | AC_ARG_WITH([nonshared-cflags], | |
83103074 | 159 | AS_HELP_STRING([--with-nonshared-cflags=CFLAGS], |
6413fcde FW |
160 | [build nonshared libraries with additional CFLAGS]), |
161 | [extra_nonshared_cflags=$withval], | |
162 | [extra_nonshared_cflags=]) | |
163 | AC_SUBST(extra_nonshared_cflags) | |
9ba202c7 FW |
164 | AC_ARG_WITH([rtld-early-cflags], |
165 | AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS], | |
166 | [build early initialization with additional CFLAGS]), | |
167 | [rtld_early_cflags=$withval], | |
168 | [rtld_early_cflags=]) | |
169 | AC_SUBST(rtld_early_cflags) | |
6413fcde | 170 | |
bada2e31 L |
171 | AC_ARG_WITH([timeoutfactor], |
172 | AS_HELP_STRING([--with-timeoutfactor=NUM], | |
173 | [specify an integer to scale the timeout]), | |
174 | [timeoutfactor=$withval], | |
175 | [timeoutfactor=1]) | |
176 | AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor) | |
177 | ||
6b7f6183 | 178 | AC_ARG_ENABLE([sanity-checks], |
83103074 | 179 | AS_HELP_STRING([--disable-sanity-checks], |
77e8bddf | 180 | [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]), |
6b7f6183 RM |
181 | [enable_sanity=$enableval], |
182 | [enable_sanity=yes]) | |
a18f587d | 183 | |
6b7f6183 | 184 | AC_ARG_ENABLE([shared], |
83103074 | 185 | AS_HELP_STRING([--enable-shared], |
a0da5fe1 | 186 | [build shared library @<:@default=yes if GNU ld@:>@]), |
6b7f6183 | 187 | [shared=$enableval], |
a0da5fe1 | 188 | [shared=yes]) |
6b7f6183 | 189 | AC_ARG_ENABLE([profile], |
83103074 | 190 | AS_HELP_STRING([--enable-profile], |
77e8bddf | 191 | [build profiled library @<:@default=no@:>@]), |
6b7f6183 | 192 | [profile=$enableval], |
11bf311e | 193 | [profile=no]) |
23645707 SP |
194 | AC_ARG_ENABLE([default-pie], |
195 | AS_HELP_STRING([--disable-default-pie], | |
196 | [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]), | |
197 | [default_pie=$enableval], | |
198 | [default_pie=yes]) | |
1cba4036 | 199 | AC_ARG_ENABLE([timezone-tools], |
83103074 | 200 | AS_HELP_STRING([--disable-timezone-tools], |
44f826e3 | 201 | [do not install timezone tools @<:@default=install@:>@]), |
1cba4036 MF |
202 | [enable_timezone_tools=$enableval], |
203 | [enable_timezone_tools=yes]) | |
204 | AC_SUBST(enable_timezone_tools) | |
6b7f6183 | 205 | |
740b3dbe | 206 | AC_ARG_ENABLE([hardcoded-path-in-tests], |
83103074 | 207 | AS_HELP_STRING([--enable-hardcoded-path-in-tests], |
740b3dbe L |
208 | [hardcode newly built glibc path in tests @<:@default=no@:>@]), |
209 | [hardcoded_path_in_tests=$enableval], | |
210 | [hardcoded_path_in_tests=no]) | |
211 | AC_SUBST(hardcoded_path_in_tests) | |
212 | ||
6b7f6183 | 213 | AC_ARG_ENABLE([hidden-plt], |
83103074 | 214 | AS_HELP_STRING([--disable-hidden-plt], |
77e8bddf | 215 | [do not hide internal function calls to avoid PLT]), |
6b7f6183 RM |
216 | [hidden=$enableval], |
217 | [hidden=yes]) | |
749a9a4f RM |
218 | if test "x$hidden" = xno; then |
219 | AC_DEFINE(NO_HIDDEN) | |
220 | fi | |
221 | ||
4df8c11d | 222 | AC_ARG_ENABLE([bind-now], |
83103074 | 223 | AS_HELP_STRING([--enable-bind-now], |
4df8c11d UD |
224 | [disable lazy relocations in DSOs]), |
225 | [bindnow=$enableval], | |
226 | [bindnow=no]) | |
227 | AC_SUBST(bindnow) | |
6901def6 L |
228 | if test "x$bindnow" = xyes; then |
229 | AC_DEFINE(BIND_NOW) | |
230 | fi | |
4df8c11d | 231 | |
03baef1c NA |
232 | dnl Build glibc with -fstack-protector, -fstack-protector-all, or |
233 | dnl -fstack-protector-strong. | |
234 | AC_ARG_ENABLE([stack-protector], | |
83103074 | 235 | AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@], |
03baef1c NA |
236 | [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]), |
237 | [enable_stack_protector=$enableval], | |
238 | [enable_stack_protector=no]) | |
239 | case "$enable_stack_protector" in | |
240 | all|yes|no|strong) ;; | |
241 | *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);; | |
242 | esac | |
243 | ||
5107cf1d UD |
244 | dnl On some platforms we cannot use dynamic loading. We must provide |
245 | dnl static NSS modules. | |
6b7f6183 | 246 | AC_ARG_ENABLE([static-nss], |
83103074 | 247 | AS_HELP_STRING([--enable-static-nss], |
77e8bddf | 248 | [build static NSS modules @<:@default=no@:>@]), |
6b7f6183 RM |
249 | [static_nss=$enableval], |
250 | [static_nss=no]) | |
834cef7c UD |
251 | dnl Enable static NSS also if we build no shared objects. |
252 | if test x"$static_nss" = xyes || test x"$shared" = xno; then | |
3172f58f | 253 | static_nss=yes |
5107cf1d UD |
254 | AC_DEFINE(DO_STATIC_NSS) |
255 | fi | |
256 | ||
6b7f6183 | 257 | AC_ARG_ENABLE([force-install], |
83103074 | 258 | AS_HELP_STRING([--disable-force-install], |
77e8bddf | 259 | [don't force installation of files from this package, even if they are older than the installed files]), |
6b7f6183 RM |
260 | [force_install=$enableval], |
261 | [force_install=yes]) | |
73237de3 UD |
262 | AC_SUBST(force_install) |
263 | ||
8894bad3 | 264 | AC_ARG_ENABLE([maintainer-mode], |
83103074 | 265 | AS_HELP_STRING([--enable-maintainer-mode], |
8894bad3 AM |
266 | [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]), |
267 | [maintainer=$enableval], | |
268 | [maintainer=no]) | |
269 | ||
958f238f UD |
270 | dnl On some platforms we allow dropping compatibility with all kernel |
271 | dnl versions. | |
6b7f6183 | 272 | AC_ARG_ENABLE([kernel], |
83103074 | 273 | AS_HELP_STRING([--enable-kernel=VERSION], |
77e8bddf | 274 | [compile for compatibility with kernel not older than VERSION]), |
6b7f6183 RM |
275 | [minimum_kernel=$enableval], |
276 | []) | |
86cfe82d UD |
277 | dnl Prevent unreasonable values. |
278 | if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then | |
279 | # Better nothing than this. | |
280 | minimum_kernel="" | |
269e369f UD |
281 | else |
282 | if test "$minimum_kernel" = current; then | |
283 | minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel= | |
284 | fi | |
86cfe82d | 285 | fi |
958f238f | 286 | |
6cc7d725 UD |
287 | dnl For the development we sometimes want gcc to issue even more warnings. |
288 | dnl This is not the default since many of the extra warnings are not | |
289 | dnl appropriate. | |
6b7f6183 | 290 | AC_ARG_ENABLE([all-warnings], |
83103074 | 291 | AS_HELP_STRING([--enable-all-warnings], |
77e8bddf | 292 | [enable all useful warnings gcc can issue]), |
6b7f6183 RM |
293 | [all_warnings=$enableval], |
294 | []) | |
6cc7d725 UD |
295 | AC_SUBST(all_warnings) |
296 | ||
a4ecc9eb | 297 | AC_ARG_ENABLE([werror], |
83103074 | 298 | AS_HELP_STRING([--disable-werror], |
a4ecc9eb JM |
299 | [do not build with -Werror]), |
300 | [enable_werror=$enableval], | |
301 | [enable_werror=yes]) | |
302 | AC_SUBST(enable_werror) | |
303 | ||
425ce2ed | 304 | AC_ARG_ENABLE([multi-arch], |
83103074 | 305 | AS_HELP_STRING([--enable-multi-arch], |
425ce2ed UD |
306 | [enable single DSO with optimizations for multiple architectures]), |
307 | [multi_arch=$enableval], | |
6f89d2f3 | 308 | [multi_arch=default]) |
425ce2ed | 309 | |
d5c3fafc | 310 | AC_ARG_ENABLE([experimental-malloc], |
83103074 | 311 | AS_HELP_STRING([--disable-experimental-malloc], |
d5c3fafc DD |
312 | [disable experimental malloc features]), |
313 | [experimental_malloc=$enableval], | |
314 | [experimental_malloc=yes]) | |
315 | AC_SUBST(experimental_malloc) | |
316 | ||
33784089 | 317 | AC_ARG_ENABLE([memory-tagging], |
83103074 | 318 | AS_HELP_STRING([--enable-memory-tagging], |
33784089 RE |
319 | [enable memory tagging if supported by the architecture @<:@default=no@:>@]), |
320 | [memory_tagging=$enableval], | |
321 | [memory_tagging=no]) | |
322 | if test "$memory_tagging" = yes; then | |
323 | # Only enable this on architectures that support it. | |
324 | case $host_cpu in | |
325 | aarch64) | |
326 | AC_DEFINE(USE_MTAG) | |
327 | ;; | |
328 | esac | |
329 | fi | |
330 | AC_SUBST(memory_tagging) | |
331 | ||
e69d994a | 332 | AC_ARG_ENABLE([crypt], |
83103074 | 333 | AS_HELP_STRING([--disable-crypt], |
e69d994a ZW |
334 | [do not build nor install the passphrase hashing library, libcrypt]), |
335 | [build_crypt=$enableval], | |
336 | [build_crypt=yes]) | |
337 | AC_SUBST(build_crypt) | |
338 | ||
ff886b82 | 339 | AC_ARG_ENABLE([nss-crypt], |
83103074 | 340 | AS_HELP_STRING([--enable-nss-crypt], |
ff886b82 UD |
341 | [enable libcrypt to use nss]), |
342 | [nss_crypt=$enableval], | |
343 | [nss_crypt=no]) | |
e69d994a ZW |
344 | if test x$build_libcrypt = xno && test x$nss_crypt = xyes; then |
345 | AC_MSG_WARN([--enable-nss-crypt has no effect when libcrypt is disabled]) | |
346 | nss_crypt=no | |
347 | fi | |
ff886b82 UD |
348 | if test x$nss_crypt = xyes; then |
349 | nss_includes=-I$(nss-config --includedir 2>/dev/null) | |
350 | if test $? -ne 0; then | |
351 | AC_MSG_ERROR([cannot find include directory with nss-config]) | |
352 | fi | |
57b4af19 GT |
353 | nspr_includes=-I$(nspr-config --includedir 2>/dev/null) |
354 | if test $? -ne 0; then | |
355 | AC_MSG_ERROR([cannot find include directory with nspr-config]) | |
356 | fi | |
ff886b82 | 357 | old_CFLAGS="$CFLAGS" |
57b4af19 | 358 | CFLAGS="$CFLAGS $nss_includes $nspr_includes" |
b68e08db | 359 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool; |
ff886b82 UD |
360 | #include <hasht.h> |
361 | #include <nsslowhash.h> | |
b68e08db | 362 | void f (void) { NSSLOW_Init (); }])], |
ff886b82 UD |
363 | libc_cv_nss_crypt=yes, |
364 | AC_MSG_ERROR([ | |
365 | cannot find NSS headers with lowlevel hash function interfaces])) | |
366 | old_LIBS="$LIBS" | |
84aa7516 | 367 | old_LDFLAGS="$LDFLAGS" |
ff886b82 UD |
368 | LIBS="$LIBS -lfreebl3" |
369 | AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool; | |
370 | #include <hasht.h> | |
371 | #include <nsslowhash.h>], | |
372 | [NSSLOW_Init();])], | |
373 | libc_cv_nss_crypt=yes, | |
374 | AC_MSG_ERROR([ | |
375 | cannot link program using lowlevel NSS hash functions])) | |
84aa7516 CD |
376 | # Check to see if there is a static NSS cryptographic library. |
377 | # If there isn't then we can't link anything with libcrypt.a, | |
378 | # and that might mean disabling some static tests. | |
379 | LDFLAGS="$LDFLAGS -static" | |
380 | AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool; | |
381 | #include <hasht.h> | |
382 | #include <nsslowhash.h>], | |
383 | [NSSLOW_Init();])], | |
384 | libc_cv_static_nss_crypt=yes, | |
385 | libc_cv_static_nss_crypt=no) | |
386 | LDFLAGS="$old_LDFLAGS" | |
ff886b82 UD |
387 | CFLAGS="$old_CFLAGS" |
388 | LIBS="$old_LIBS" | |
389 | else | |
390 | libc_cv_nss_crypt=no | |
84aa7516 | 391 | libc_cv_static_nss_crypt=no |
ff886b82 UD |
392 | fi |
393 | AC_SUBST(libc_cv_nss_crypt) | |
84aa7516 | 394 | AC_SUBST(libc_cv_static_nss_crypt) |
ff886b82 | 395 | |
3a097cc7 | 396 | |
3a097cc7 RM |
397 | AC_ARG_ENABLE([systemtap], |
398 | [AS_HELP_STRING([--enable-systemtap], | |
399 | [enable systemtap static probe points @<:@default=no@:>@])], | |
400 | [systemtap=$enableval], | |
401 | [systemtap=no]) | |
402 | if test "x$systemtap" != xno; then | |
403 | AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl | |
404 | old_CFLAGS="$CFLAGS" | |
783dd2d3 | 405 | CFLAGS="-std=gnu11 $CFLAGS" |
0e3933b9 | 406 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h> |
3a097cc7 RM |
407 | void foo (int i, void *p) |
408 | { | |
409 | asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) "" | |
410 | :: STAP_PROBE_ASM_OPERANDS (2, i, p)); | |
0e3933b9 | 411 | }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no]) |
3a097cc7 RM |
412 | CFLAGS="$old_CFLAGS"]) |
413 | if test $libc_cv_sdt = yes; then | |
414 | AC_DEFINE([USE_STAP_PROBE]) | |
415 | elif test "x$systemtap" != xauto; then | |
416 | AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support]) | |
417 | fi | |
418 | fi | |
419 | ||
c53d909c RM |
420 | AC_ARG_ENABLE([build-nscd], |
421 | [AS_HELP_STRING([--disable-build-nscd], | |
422 | [disable building and installing the nscd daemon])], | |
423 | [build_nscd=$enableval], | |
424 | [build_nscd=default]) | |
425 | AC_SUBST(build_nscd) | |
426 | ||
3cc3ef96 RM |
427 | # Note the use of $use_nscd is near the bottom of the file. |
428 | AC_ARG_ENABLE([nscd], | |
429 | [AS_HELP_STRING([--disable-nscd], | |
430 | [library functions will not contact the nscd daemon])], | |
431 | [use_nscd=$enableval], | |
432 | [use_nscd=yes]) | |
433 | ||
e4608715 CD |
434 | AC_ARG_ENABLE([pt_chown], |
435 | [AS_HELP_STRING([--enable-pt_chown], | |
436 | [Enable building and installing pt_chown])], | |
437 | [build_pt_chown=$enableval], | |
438 | [build_pt_chown=no]) | |
439 | AC_SUBST(build_pt_chown) | |
8c12f01d | 440 | if test "$build_pt_chown" = yes; then |
e4608715 CD |
441 | AC_DEFINE(HAVE_PT_CHOWN) |
442 | fi | |
443 | ||
67e58f39 SP |
444 | AC_ARG_ENABLE([tunables], |
445 | [AS_HELP_STRING([--enable-tunables], | |
6765d5d3 | 446 | [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])], |
67e58f39 | 447 | [have_tunables=$enableval], |
2c0b90ab | 448 | [have_tunables=yes]) |
67e58f39 SP |
449 | AC_SUBST(have_tunables) |
450 | if test "$have_tunables" = yes; then | |
451 | AC_DEFINE(HAVE_TUNABLES) | |
452 | fi | |
453 | ||
ebf27d12 ST |
454 | # The abi-tags file uses a fairly simplistic model for name recognition that |
455 | # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a | |
456 | # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell. | |
457 | # This doesn't get used much beyond that, so it's fairly safe. | |
458 | case "$host_os" in | |
459 | linux*) | |
460 | ;; | |
461 | gnu*) | |
462 | host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'` | |
463 | ;; | |
464 | esac | |
465 | ||
5695d46f AS |
466 | AC_ARG_ENABLE([mathvec], |
467 | [AS_HELP_STRING([--enable-mathvec], | |
468 | [Enable building and installing mathvec @<:@default depends on architecture@:>@])], | |
469 | [build_mathvec=$enableval], | |
470 | [build_mathvec=notset]) | |
471 | ||
b190bccc | 472 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[ |
9fb81390 FW |
473 | #ifndef __CET__ |
474 | # error no CET compiler support | |
b190bccc | 475 | #endif]])], |
9fb81390 FW |
476 | [libc_cv_compiler_default_cet=yes], |
477 | [libc_cv_compiler_default_cet=no]) | |
478 | ||
f753fa7d | 479 | AC_ARG_ENABLE([cet], |
83103074 | 480 | AS_HELP_STRING([--enable-cet], |
f753fa7d L |
481 | [enable Intel Control-flow Enforcement Technology (CET), x86 only]), |
482 | [enable_cet=$enableval], | |
9fb81390 | 483 | [enable_cet=$libc_cv_compiler_default_cet]) |
f753fa7d | 484 | |
ebae2f5a MC |
485 | AC_ARG_ENABLE([scv], |
486 | AC_HELP_STRING([--disable-scv], | |
487 | [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]), | |
488 | [use_scv=$enableval], | |
489 | [use_scv=yes]) | |
490 | ||
491 | AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)]) | |
492 | ||
28f540f4 RM |
493 | # We keep the original values in `$config_*' and never modify them, so we |
494 | # can write them unchanged into config.make. Everything else uses | |
495 | # $machine, $vendor, and $os, and changes them whenever convenient. | |
496 | config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os | |
497 | ||
2f64b655 UD |
498 | # Don't allow vendor == "unknown" |
499 | test "$config_vendor" = unknown && config_vendor= | |
500 | config_os="`echo $config_os | sed 's/^unknown-//'`" | |
501 | ||
a2fe9c76 | 502 | # Some configurations imply other options. |
0269750c | 503 | elf=yes |
a2fe9c76 | 504 | |
644d3857 | 505 | # The configure fragment of a port can modify these to supplement |
8f73811b RM |
506 | # or override the table in the case statement below. No fragment should |
507 | # ever change the config_* variables, however. | |
28f540f4 RM |
508 | machine=$config_machine |
509 | vendor=$config_vendor | |
510 | os=$config_os | |
b22d21b3 | 511 | base_os='' |
28f540f4 | 512 | |
2ceaa76a RM |
513 | submachine= |
514 | AC_ARG_WITH([cpu], | |
515 | AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]), | |
516 | [dnl | |
517 | case "$withval" in | |
518 | yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;; | |
519 | no) ;; | |
520 | *) submachine="$withval" ;; | |
521 | esac | |
522 | ]) | |
523 | ||
05439291 RM |
524 | # An preconfigure script can set this when it wants to disable the sanity |
525 | # check below. | |
526 | libc_config_ok=no | |
527 | ||
8df5d347 JM |
528 | # A preconfigure script for a system that may or may not use fpu |
529 | # sysdeps directories sets this to a preprocessor conditional for | |
530 | # whether to use such directories. | |
531 | with_fp_cond=1 | |
532 | ||
644d3857 | 533 | dnl Let sysdeps/*/preconfigure act here. |
10a803e0 RM |
534 | LIBC_PRECONFIGURE([$srcdir], [for sysdeps]) |
535 | ||
8f73811b | 536 | |
bdc8eb03 UD |
537 | ### |
538 | ### By using the undocumented --enable-hacker-mode option for configure | |
539 | ### one can skip this test to make the configuration not fail for unsupported | |
540 | ### platforms. | |
541 | ### | |
8f73811b | 542 | if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then |
bdc8eb03 | 543 | case "$machine-$host_os" in |
2ce4f015 | 544 | *-linux* | *-gnu*) |
bdc8eb03 UD |
545 | ;; |
546 | *) | |
4e58b648 MF |
547 | AC_MSG_ERROR([ |
548 | *** The GNU C library is currently unavailable for this platform. | |
549 | *** If you are interested in seeing glibc on this platform visit | |
550 | *** the "How to submit a new port" in the wiki: | |
551 | *** https://sourceware.org/glibc/wiki/#Development | |
552 | *** and join the community!]) | |
bdc8eb03 UD |
553 | ;; |
554 | esac | |
555 | fi | |
556 | ||
3e239be6 JM |
557 | # Set base_machine if not set by a preconfigure fragment. |
558 | test -n "$base_machine" || base_machine=$machine | |
f0523145 | 559 | AC_SUBST(base_machine) |
28f540f4 | 560 | |
43ecc41d AZ |
561 | ### Locate tools. |
562 | ||
563 | AC_PROG_INSTALL | |
564 | if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then | |
565 | # The makefiles need to use a different form to find it in $srcdir. | |
566 | INSTALL='\$(..)./scripts/install-sh -c' | |
567 | fi | |
568 | AC_PROG_LN_S | |
569 | ||
570 | LIBC_PROG_BINUTILS | |
571 | ||
572 | # Accept binutils 2.25 or newer. | |
43ecc41d AZ |
573 | libc_cv_with_lld=no |
574 | case $($LD --version) in | |
575 | "GNU gold"*) | |
576 | # Accept gold 1.14 or higher | |
577 | AC_CHECK_PROG_VER(LD, $LD, --version, | |
578 | [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)], | |
579 | [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*], | |
580 | LD=: critic_missing="$critic_missing GNU gold") | |
581 | ;; | |
582 | "LLD"*) | |
583 | # Accept LLD 13.0.0 or higher | |
584 | AC_CHECK_PROG_VER(LD, $LD, --version, | |
585 | [LLD.* \([0-9][0-9]*\.[0-9.]*\)], | |
586 | [1[3-9].*|[2-9][0-9].*], | |
587 | LD=: critic_missing="$critic_missing LLD") | |
588 | libc_cv_with_lld=yes | |
589 | ;; | |
590 | *) | |
591 | AC_CHECK_PROG_VER(LD, $LD, --version, | |
592 | [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)], | |
593 | [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*], | |
594 | LD=: critic_missing="$critic_missing GNU ld") | |
595 | ;; | |
596 | esac | |
597 | LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld]) | |
598 | ||
599 | # These programs are version sensitive. | |
600 | AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version, | |
601 | [GNU Make[^0-9]*\([0-9][0-9.]*\)], | |
602 | [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make") | |
603 | ||
604 | AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version, | |
605 | [GNU gettext.* \([0-9]*\.[0-9.]*\)], | |
606 | [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*], | |
607 | MSGFMT=: aux_missing="$aux_missing msgfmt") | |
608 | AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version, | |
609 | [GNU texinfo.* \([0-9][0-9.]*\)], | |
610 | [4.[7-9]*|4.[1-9][0-9]*|[5-9].*], | |
611 | MAKEINFO=: aux_missing="$aux_missing makeinfo") | |
612 | AC_CHECK_PROG_VER(SED, sed, --version, | |
613 | [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)], | |
614 | [3.0[2-9]*|3.[1-9]*|[4-9]*], | |
615 | SED=: aux_missing="$aux_missing sed") | |
616 | AC_CHECK_PROG_VER(AWK, gawk, --version, | |
617 | [GNU Awk[^0-9]*\([0-9][0-9.]*\)], | |
618 | [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk") | |
619 | AC_CHECK_PROG_VER(BISON, bison, --version, | |
620 | [bison (GNU Bison) \([0-9]*\.[0-9.]*\)], | |
621 | [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison") | |
622 | ||
623 | AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [ | |
624 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[ | |
625 | #if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2) | |
626 | #error insufficient compiler | |
627 | #endif]])], | |
628 | [libc_cv_compiler_ok=yes], | |
629 | [libc_cv_compiler_ok=no])]) | |
630 | AS_IF([test $libc_cv_compiler_ok != yes], | |
631 | [critic_missing="$critic_missing compiler"]) | |
632 | ||
43ecc41d AZ |
633 | if test "x$maintainer" = "xyes"; then |
634 | AC_CHECK_PROGS(AUTOCONF, autoconf, no) | |
635 | case "x$AUTOCONF" in | |
636 | xno|x|x:) AUTOCONF=no ;; | |
637 | *) | |
638 | AC_CACHE_CHECK(dnl | |
639 | whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl | |
640 | if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then | |
641 | libc_cv_autoconf_works=yes | |
642 | else | |
643 | libc_cv_autoconf_works=no | |
644 | fi]) | |
645 | test $libc_cv_autoconf_works = yes || AUTOCONF=no | |
646 | ;; | |
647 | esac | |
648 | if test "x$AUTOCONF" = xno; then | |
649 | aux_missing="$aux_missing autoconf" | |
650 | fi | |
651 | else | |
652 | AUTOCONF=no | |
653 | fi | |
654 | ||
655 | # Check for python3 if available, or else python. | |
656 | AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version, | |
657 | [Python \([0-9][0-9.]*\)], | |
658 | [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*], | |
659 | critic_missing="$critic_missing python") | |
660 | PYTHON="$PYTHON_PROG -B" | |
661 | AC_SUBST(PYTHON) | |
662 | ||
663 | test -n "$critic_missing" && AC_MSG_ERROR([ | |
664 | *** These critical programs are missing or too old:$critic_missing | |
665 | *** Check the INSTALL file for required versions.]) | |
666 | ||
667 | test -n "$aux_missing" && AC_MSG_WARN([ | |
668 | *** These auxiliary programs are missing or incompatible versions:$aux_missing | |
669 | *** some features or tests will be disabled. | |
670 | *** Check the INSTALL file for required versions.]) | |
671 | ||
672 | ||
8df5d347 JM |
673 | # Determine whether to use fpu or nofpu sysdeps directories. |
674 | AC_CACHE_CHECK([for use of fpu sysdeps directories], | |
675 | libc_cv_with_fp, [dnl | |
676 | cat > conftest.c <<EOF | |
677 | #if $with_fp_cond | |
678 | int dummy; | |
679 | #else | |
680 | # error "no hardware floating point" | |
681 | #endif | |
682 | EOF | |
683 | libc_cv_with_fp=no | |
684 | if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \ | |
685 | 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then | |
686 | libc_cv_with_fp=yes | |
687 | fi | |
688 | rm -f conftest*]) | |
689 | AC_SUBST(libc_cv_with_fp) | |
690 | ||
03baef1c NA |
691 | AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl |
692 | LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector], | |
693 | [libc_cv_ssp=yes], | |
694 | [libc_cv_ssp=no]) | |
695 | ]) | |
696 | ||
697 | AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl | |
698 | LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong], | |
699 | [libc_cv_ssp_strong=yes], | |
700 | [libc_cv_ssp_strong=no]) | |
701 | ]) | |
702 | ||
703 | AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl | |
704 | LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all], | |
705 | [libc_cv_ssp_all=yes], | |
706 | [libc_cv_ssp_all=no]) | |
707 | ]) | |
708 | ||
709 | stack_protector= | |
710 | no_stack_protector= | |
711 | if test "$libc_cv_ssp" = yes; then | |
712 | no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0" | |
de659123 | 713 | AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR) |
03baef1c NA |
714 | fi |
715 | ||
716 | if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then | |
717 | stack_protector="-fstack-protector" | |
718 | AC_DEFINE(STACK_PROTECTOR_LEVEL, 1) | |
719 | elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then | |
720 | stack_protector="-fstack-protector-all" | |
721 | AC_DEFINE(STACK_PROTECTOR_LEVEL, 2) | |
722 | elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then | |
723 | stack_protector="-fstack-protector-strong" | |
724 | AC_DEFINE(STACK_PROTECTOR_LEVEL, 3) | |
66a704c4 NA |
725 | else |
726 | stack_protector="-fno-stack-protector" | |
727 | AC_DEFINE(STACK_PROTECTOR_LEVEL, 0) | |
03baef1c NA |
728 | fi |
729 | AC_SUBST(libc_cv_ssp) | |
730 | AC_SUBST(stack_protector) | |
731 | AC_SUBST(no_stack_protector) | |
732 | ||
66a704c4 NA |
733 | if test -n "$stack_protector"; then |
734 | dnl Don't run configure tests with stack-protection on, to avoid problems with | |
735 | dnl bootstrapping. | |
736 | no_ssp=-fno-stack-protector | |
737 | else | |
738 | no_ssp= | |
739 | ||
740 | if test "$enable_stack_protector" != no; then | |
741 | AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.]) | |
742 | fi | |
743 | fi | |
744 | ||
0cae3f4b MF |
745 | # For the multi-arch option we need support in the assembler & linker. |
746 | AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support], | |
747 | libc_cv_ld_gnu_indirect_function, [dnl | |
786b0b67 | 748 | cat > conftest.S <<EOF |
84b9230c | 749 | .type foo,%gnu_indirect_function |
0cae3f4b MF |
750 | foo: |
751 | .globl _start | |
752 | _start: | |
753 | .globl __start | |
754 | __start: | |
755 | .data | |
786b0b67 AS |
756 | #ifdef _LP64 |
757 | .quad foo | |
758 | #else | |
0cae3f4b | 759 | .long foo |
786b0b67 | 760 | #endif |
84b9230c | 761 | EOF |
0cae3f4b MF |
762 | libc_cv_ld_gnu_indirect_function=no |
763 | if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ | |
66a704c4 | 764 | -nostartfiles -nostdlib $no_ssp \ |
786b0b67 | 765 | -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then |
0cae3f4b MF |
766 | # Do a link to see if the backend supports IFUNC relocs. |
767 | $READELF -r conftest 1>&AS_MESSAGE_LOG_FD | |
87a698a2 | 768 | LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && { |
0cae3f4b MF |
769 | libc_cv_ld_gnu_indirect_function=yes |
770 | } | |
84b9230c MF |
771 | fi |
772 | rm -f conftest*]) | |
773 | ||
022dfdce SL |
774 | # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro. |
775 | AC_CACHE_CHECK([for gcc attribute ifunc support], | |
776 | libc_cv_gcc_indirect_function, [dnl | |
777 | cat > conftest.c <<EOF | |
778 | extern int func (int); | |
779 | int used_func (int a) | |
780 | { | |
781 | return a; | |
782 | } | |
783 | static void *resolver () | |
784 | { | |
785 | return &used_func; | |
786 | } | |
787 | extern __typeof (func) func __attribute__ ((ifunc ("resolver"))); | |
788 | EOF | |
789 | libc_cv_gcc_indirect_function=no | |
790 | if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \ | |
791 | 2>&AS_MESSAGE_LOG_FD ; then | |
792 | if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then | |
793 | libc_cv_gcc_indirect_function=yes | |
794 | fi | |
795 | fi | |
796 | rm -f conftest*]) | |
797 | ||
b5c45e83 AZ |
798 | # Check if linker supports textrel relocation with ifunc (used on elf/tests). |
799 | # Note that it relies on libc_cv_ld_gnu_indirect_function test above. | |
800 | AC_CACHE_CHECK([whether the linker supports textrels along with ifunc], | |
801 | libc_cv_textrel_ifunc, [dnl | |
802 | cat > conftest.S <<EOF | |
803 | .type foo,%gnu_indirect_function | |
804 | foo: | |
805 | .globl _start | |
806 | _start: | |
807 | .globl __start | |
808 | __start: | |
809 | .data | |
810 | #ifdef _LP64 | |
811 | .quad foo | |
812 | #else | |
813 | .long foo | |
814 | #endif | |
815 | .text | |
816 | .globl address | |
817 | address: | |
818 | #ifdef _LP64 | |
819 | .quad address | |
820 | #else | |
821 | .long address | |
822 | #endif | |
823 | EOF | |
824 | libc_cv_textrel_ifunc=no | |
825 | if test $libc_cv_ld_gnu_indirect_function = yes; then | |
826 | if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then | |
827 | libc_cv_textrel_ifunc=yes | |
828 | fi | |
829 | fi | |
830 | rm -f conftest*]) | |
831 | AC_SUBST(libc_cv_textrel_ifunc) | |
832 | ||
cd6ae7ea FS |
833 | # Check if CC supports attribute retain as it is used in attribute_used_retain macro. |
834 | AC_CACHE_CHECK([for GNU attribute retain support], | |
835 | libc_cv_gnu_retain, [dnl | |
836 | cat > conftest.c <<EOF | |
837 | static int var __attribute__ ((used, retain, section ("__libc_atexit"))); | |
838 | EOF | |
839 | libc_cv_gnu_retain=no | |
840 | if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \ | |
841 | 2>&AS_MESSAGE_LOG_FD ; then | |
842 | libc_cv_gnu_retain=yes | |
843 | fi | |
844 | rm -f conftest*]) | |
845 | if test $libc_cv_gnu_retain = yes; then | |
846 | AC_DEFINE(HAVE_GNU_RETAIN) | |
847 | fi | |
848 | LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain]) | |
849 | ||
8f6f5362 AZ |
850 | # Check if gcc warns about alias for function with incompatible types. |
851 | AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types], | |
852 | libc_cv_gcc_incompatible_alias, [dnl | |
853 | cat > conftest.c <<EOF | |
854 | int __redirect_foo (const void *s, int c); | |
855 | ||
856 | __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo"); | |
857 | __typeof (__redirect_foo) *foo_impl (void) | |
858 | { | |
859 | return 0; | |
860 | } | |
861 | ||
862 | extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo"))); | |
863 | EOF | |
864 | libc_cv_gcc_incompatible_alias=yes | |
865 | if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then | |
866 | libc_cv_gcc_incompatible_alias=no | |
867 | fi | |
868 | rm -f conftest*]) | |
869 | ||
0cae3f4b | 870 | if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then |
84b9230c MF |
871 | if test x"$multi_arch" = xyes; then |
872 | AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support]) | |
873 | else | |
874 | multi_arch=no | |
875 | fi | |
876 | fi | |
8f6f5362 AZ |
877 | if test x"$libc_cv_gcc_indirect_function" != xyes; then |
878 | # GCC 8+ emits a warning for alias with incompatible types and it might | |
879 | # fail to build ifunc resolvers aliases to either weak or internal | |
880 | # symbols. Disables multiarch build in this case. | |
cb7b1c90 | 881 | if test x"$libc_cv_gcc_incompatible_alias" = xyes; then |
8f6f5362 AZ |
882 | AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types]) |
883 | if test x"$multi_arch" = xyes; then | |
884 | AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support]) | |
885 | fi | |
886 | AC_MSG_WARN([Multi-arch is disabled.]) | |
887 | multi_arch=no | |
888 | elif test x"$multi_arch" = xyes; then | |
889 | AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support. | |
022dfdce | 890 | Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function]) |
8f6f5362 | 891 | fi |
022dfdce | 892 | fi |
6270516e | 893 | multi_arch_d= |
84b9230c MF |
894 | if test x"$multi_arch" != xno; then |
895 | multi_arch_d=/multiarch | |
896 | fi | |
897 | ||
f0523145 | 898 | # Compute the list of sysdep directories for this configuration. |
f332db02 | 899 | # This can take a while to compute. |
f0523145 | 900 | sysdep_dir=$srcdir/sysdeps |
f332db02 | 901 | AC_MSG_CHECKING(sysdep dirs) |
f0523145 RM |
902 | dnl We need to use [ and ] for other purposes for a while now. |
903 | changequote(,)dnl | |
28f540f4 RM |
904 | # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1. |
905 | os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`" | |
906 | ||
b22d21b3 | 907 | test "x$base_os" != x || case "$os" in |
28f540f4 RM |
908 | gnu*) |
909 | base_os=mach/hurd ;; | |
2ce4f015 | 910 | linux*) |
28f540f4 | 911 | base_os=unix/sysv ;; |
28f540f4 RM |
912 | esac |
913 | ||
914 | # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos. | |
915 | tail=$os | |
916 | ostry=$os | |
917 | while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do | |
918 | ostry="$ostry /$o" | |
919 | tail=$o | |
75914335 | 920 | done |
28f540f4 RM |
921 | o=`echo $tail | sed 's/[0-9]*$//'` |
922 | if test $o != $tail; then | |
923 | ostry="$ostry /$o" | |
924 | fi | |
ec4b0518 UD |
925 | # For linux-gnu, try linux-gnu, then linux. |
926 | o=`echo $tail | sed 's/-.*$//'` | |
927 | if test $o != $tail; then | |
928 | ostry="$ostry /$o" | |
929 | fi | |
28f540f4 RM |
930 | |
931 | # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix. | |
932 | base= | |
933 | tail=$base_os | |
934 | while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do | |
935 | set $b | |
936 | base="$base /$1" | |
937 | tail="$2" | |
938 | done | |
939 | ||
ae6b8730 | 940 | # For sparc/sparc32, try sparc/sparc32 and then sparc. |
28f540f4 | 941 | mach= |
2ceaa76a | 942 | tail=$machine${submachine:+/$submachine} |
28f540f4 RM |
943 | while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do |
944 | set $m | |
a63189c0 AZ |
945 | # Prepend the machine's FPU directory unless the architecture specific |
946 | # preconfigure disables it. | |
8df5d347 | 947 | if test "$libc_cv_with_fp" = yes; then |
6270516e | 948 | maybe_fpu=/fpu |
f4b07664 | 949 | else |
6270516e | 950 | maybe_fpu=/nofpu |
82d00cab | 951 | fi |
6270516e RM |
952 | # For each machine term, try it with and then without /multiarch. |
953 | for try_fpu in $maybe_fpu ''; do | |
954 | for try_multi in $multi_arch_d ''; do | |
955 | mach="$mach /$1$try_fpu$try_multi" | |
956 | done | |
957 | done | |
28f540f4 RM |
958 | tail="$2" |
959 | done | |
960 | ||
961 | dnl We are done with glob and regexp uses of [ and ]; return to autoconf. | |
962 | changequote([,])dnl | |
963 | ||
964 | # Find what sysdep directories exist. | |
965 | sysnames= | |
4b69abad RM |
966 | for b in $base ''; do |
967 | for m0 in $mach ''; do | |
968 | for v in /$vendor ''; do | |
969 | test "$v" = / && continue | |
970 | for o in /$ostry ''; do | |
971 | test "$o" = / && continue | |
6270516e | 972 | for m in $mach ''; do |
644d3857 JM |
973 | try_suffix="$m0$b$v$o$m" |
974 | if test -n "$try_suffix"; then | |
975 | try_srcdir="${srcdir}/" | |
976 | try="sysdeps$try_suffix" | |
977 | test -n "$enable_debug_configure" && | |
978 | echo "$0 [DEBUG]: try $try" >&2 | |
979 | if test -d "$try_srcdir$try"; then | |
980 | sysnames="$sysnames $try" | |
981 | { test -n "$o" || test -n "$b"; } && os_used=t | |
982 | { test -n "$m" || test -n "$m0"; } && machine_used=t | |
983 | case x${m0:-$m} in | |
984 | x*/$submachine) submachine_used=t ;; | |
985 | esac | |
986 | fi | |
987 | fi | |
28f540f4 RM |
988 | done |
989 | done | |
990 | done | |
991 | done | |
4b69abad | 992 | done |
28f540f4 | 993 | |
6f89d2f3 L |
994 | # If the assembler supports gnu_indirect_function symbol type and the |
995 | # architecture supports multi-arch, we enable multi-arch by default. | |
644d3857 | 996 | case $sysnames in |
84b9230c MF |
997 | *"$multi_arch_d"*) |
998 | ;; | |
999 | *) | |
77e8bddf | 1000 | test x"$multi_arch" = xdefault && multi_arch=no |
84b9230c MF |
1001 | ;; |
1002 | esac | |
1003 | if test x"$multi_arch" != xno; then | |
6f89d2f3 L |
1004 | AC_DEFINE(USE_MULTIARCH) |
1005 | fi | |
1006 | AC_SUBST(multi_arch) | |
1007 | ||
28f540f4 RM |
1008 | if test -z "$os_used" && test "$os" != none; then |
1009 | AC_MSG_ERROR(Operating system $os is not supported.) | |
1010 | fi | |
1011 | if test -z "$machine_used" && test "$machine" != none; then | |
1012 | AC_MSG_ERROR(The $machine is not supported.) | |
1013 | fi | |
2ceaa76a RM |
1014 | if test -z "$submachine_used" && test -n "$submachine"; then |
1015 | AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.) | |
1016 | fi | |
1017 | AC_SUBST(submachine) | |
28f540f4 RM |
1018 | |
1019 | # We have now validated the configuration. | |
1020 | ||
28f540f4 RM |
1021 | # Expand the list of system names into a full list of directories |
1022 | # from each element's parent name and Implies file (if present). | |
1023 | set $sysnames | |
e50ec9f9 | 1024 | names= |
28f540f4 RM |
1025 | while test $# -gt 0; do |
1026 | name=$1 | |
1027 | shift | |
1028 | ||
e50ec9f9 | 1029 | case " $names " in *" $name "*) |
f332db02 RM |
1030 | # Already in the list. |
1031 | continue | |
e50ec9f9 | 1032 | esac |
f332db02 RM |
1033 | |
1034 | # Report each name as we discover it, so there is no long pause in output. | |
0b4ee387 | 1035 | echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD |
f332db02 | 1036 | |
57ba7bb4 UD |
1037 | name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'` |
1038 | ||
1039 | case $name in | |
1040 | /*) xsrcdir= ;; | |
1041 | *) xsrcdir=$srcdir/ ;; | |
1042 | esac | |
1043 | test -n "$enable_debug_configure" && | |
1044 | echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2 | |
1045 | ||
ba75122d RM |
1046 | for implies_file in Implies Implies-before Implies-after; do |
1047 | implies_type=`echo $implies_file | sed s/-/_/` | |
1048 | eval ${implies_type}= | |
1049 | if test -f $xsrcdir$name/$implies_file; then | |
1050 | # Collect more names from the `Implies' file (removing comments). | |
1051 | implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`" | |
1052 | for x in $implied_candidate; do | |
1053 | found=no | |
1054 | if test -d $xsrcdir$name_base/$x; then | |
1055 | eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\"" | |
636ccfc8 | 1056 | found=yes |
ba75122d | 1057 | fi |
644d3857 JM |
1058 | try="sysdeps/$x" |
1059 | try_srcdir=$srcdir/ | |
1060 | test -n "$enable_debug_configure" && | |
1061 | echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2 | |
1062 | if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try; | |
1063 | then | |
1064 | eval "${implies_type}=\"\$${implies_type} \$try\"" | |
1065 | found=yes | |
1066 | fi | |
ba75122d RM |
1067 | if test $found = no; then |
1068 | AC_MSG_WARN($name/$implies_file specifies nonexistent $x) | |
636ccfc8 UD |
1069 | fi |
1070 | done | |
ba75122d RM |
1071 | fi |
1072 | done | |
28f540f4 RM |
1073 | |
1074 | # Add NAME to the list of names. | |
1075 | names="$names $name" | |
1076 | ||
1077 | # Find the parent of NAME, using the empty string if it has none. | |
1078 | changequote(,)dnl | |
57ba7bb4 | 1079 | parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`" |
28f540f4 RM |
1080 | changequote([,])dnl |
1081 | ||
ba75122d RM |
1082 | test -n "$enable_debug_configure" && |
1083 | echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \ | |
57633811 | 1084 | Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2 |
ba75122d | 1085 | |
28f540f4 RM |
1086 | # Add the names implied by NAME, and NAME's parent (if it has one), to |
1087 | # the list of names to be processed (the argument list). We prepend the | |
1088 | # implied names to the list and append the parent. We want implied | |
1089 | # directories to come before further directories inferred from the | |
1090 | # configuration components; this ensures that for sysv4, unix/common | |
1091 | # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*) | |
1092 | # after sysv4). | |
ba75122d | 1093 | sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`" |
28f540f4 RM |
1094 | test -n "$sysnames" && set $sysnames |
1095 | done | |
1096 | ||
1097 | # Add the default directories. | |
83ef87ba | 1098 | default_sysnames="sysdeps/generic" |
ecdc196c | 1099 | sysnames="$names $default_sysnames" |
f332db02 RM |
1100 | AC_SUBST(sysnames) |
1101 | # The other names were emitted during the scan. | |
ecdc196c | 1102 | AC_MSG_RESULT($default_sysnames) |
28f540f4 | 1103 | |
dbe7a0f5 UD |
1104 | # if using special system headers, find out the compiler's sekrit |
1105 | # header directory and add that to the list. NOTE: Only does the right | |
1106 | # thing on a system that doesn't need fixincludes. (Not presently a problem.) | |
1107 | if test -n "$sysheaders"; then | |
67fbfa5c RM |
1108 | SYSINCLUDES=-nostdinc |
1109 | for d in include include-fixed; do | |
1110 | i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" && | |
1111 | SYSINCLUDES="$SYSINCLUDES -isystem $i" | |
1112 | done | |
1113 | SYSINCLUDES="$SYSINCLUDES \ | |
3d6ce23a | 1114 | -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`" |
ef226fec | 1115 | if test -n "$CXX"; then |
7872cfb0 | 1116 | CXX_SYSINCLUDES= |
67060746 AC |
1117 | for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \ |
1118 | | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do | |
1119 | test "x$cxxheaders" != x && | |
1120 | CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders" | |
1121 | done | |
ef226fec | 1122 | fi |
dbe7a0f5 UD |
1123 | fi |
1124 | AC_SUBST(SYSINCLUDES) | |
ef226fec | 1125 | AC_SUBST(CXX_SYSINCLUDES) |
dbe7a0f5 | 1126 | |
fc3e1337 FW |
1127 | # Obtain some C++ header file paths. This is used to make a local |
1128 | # copy of those headers in Makerules. | |
1129 | if test -n "$CXX"; then | |
1130 | find_cxx_header () { | |
596183a1 AZ |
1131 | echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \ |
1132 | | $AWK '$1 == "."{print $2}' | |
fc3e1337 FW |
1133 | } |
1134 | CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)" | |
1135 | CXX_CMATH_HEADER="$(find_cxx_header cmath)" | |
a65ea28d | 1136 | CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)" |
fc3e1337 FW |
1137 | fi |
1138 | AC_SUBST(CXX_CSTDLIB_HEADER) | |
1139 | AC_SUBST(CXX_CMATH_HEADER) | |
a65ea28d | 1140 | AC_SUBST(CXX_BITS_STD_ABS_H) |
fc3e1337 | 1141 | |
3911660e UD |
1142 | # Test if LD_LIBRARY_PATH contains the notation for the current directory |
1143 | # since this would lead to problems installing/building glibc. | |
1144 | # LD_LIBRARY_PATH contains the current directory if one of the following | |
1145 | # is true: | |
1146 | # - one of the terminals (":" and ";") is the first or last sign | |
1147 | # - two terminals occur directly after each other | |
1148 | # - the path contains an element with a dot in it | |
1149 | AC_MSG_CHECKING(LD_LIBRARY_PATH variable) | |
1150 | changequote(,)dnl | |
1151 | case ${LD_LIBRARY_PATH} in | |
1152 | [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) | |
b3a86ae1 | 1153 | ld_library_path_setting="contains current directory" |
3911660e UD |
1154 | ;; |
1155 | *) | |
1156 | ld_library_path_setting="ok" | |
1157 | ;; | |
1158 | esac | |
1159 | changequote([,])dnl | |
1160 | AC_MSG_RESULT($ld_library_path_setting) | |
1161 | if test "$ld_library_path_setting" != "ok"; then | |
63bda0c1 UD |
1162 | AC_MSG_ERROR([ |
1163 | *** LD_LIBRARY_PATH shouldn't contain the current directory when | |
1164 | *** building glibc. Please change the environment variable | |
1165 | *** and run configure again.]) | |
3911660e | 1166 | fi |
8e31cf7e | 1167 | |
26f56c1c | 1168 | AC_PATH_PROG(BASH_SHELL, bash, no) |
84384f5b | 1169 | |
c0016081 | 1170 | AC_PATH_PROG(PERL, perl, no) |
2fd5d029 RM |
1171 | if test "$PERL" != no && |
1172 | (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then | |
1173 | PERL=no | |
ecb06196 | 1174 | fi |
2f512715 AS |
1175 | AC_PATH_PROG(INSTALL_INFO, install-info, no, |
1176 | $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin) | |
2de00372 | 1177 | |
b8dc6a10 | 1178 | AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl |
9a70fcab | 1179 | cat > conftest.s <<EOF |
8c0c01db | 1180 | .text |
ae1025be | 1181 | foo: |
df2a0c93 | 1182 | .set glibc_conftest_frobozz,foo |
7b8e0d49 | 1183 | .globl glibc_conftest_frobozz |
e215c478 | 1184 | EOF |
df2a0c93 RM |
1185 | # The alpha-dec-osf1 assembler gives only a warning for `.set' |
1186 | # (but it doesn't work), so we must do a linking check to be sure. | |
1187 | cat > conftest1.c <<\EOF | |
1188 | extern int glibc_conftest_frobozz; | |
640f0119 | 1189 | void _start() { glibc_conftest_frobozz = 1; } |
df2a0c93 RM |
1190 | EOF |
1191 | if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ | |
66a704c4 | 1192 | -nostartfiles -nostdlib $no_ssp \ |
0b4ee387 | 1193 | -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then |
e215c478 RM |
1194 | libc_cv_asm_set_directive=yes |
1195 | else | |
1196 | libc_cv_asm_set_directive=no | |
1197 | fi | |
65b3cbcb | 1198 | rm -f conftest*]) |
e215c478 RM |
1199 | if test $libc_cv_asm_set_directive = yes; then |
1200 | AC_DEFINE(HAVE_ASM_SET_DIRECTIVE) | |
1201 | fi | |
1202 | ||
2a723ff6 JM |
1203 | AC_CACHE_CHECK(linker support for protected data symbol, |
1204 | libc_cv_protected_data, | |
1205 | [cat > conftest.c <<EOF | |
1206 | int bar __attribute__ ((visibility ("protected"))) = 1; | |
83569fb8 | 1207 | EOF |
2a723ff6 | 1208 | libc_cv_protected_data=no |
66a704c4 | 1209 | if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then |
2a723ff6 JM |
1210 | cat > conftest.c <<EOF |
1211 | extern int bar; | |
1212 | int main (void) { return bar; } | |
83569fb8 | 1213 | EOF |
66a704c4 | 1214 | if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then |
2a723ff6 | 1215 | libc_cv_protected_data=yes |
83569fb8 | 1216 | fi |
2a723ff6 JM |
1217 | fi |
1218 | rm -f conftest.* | |
1219 | ]) | |
83569fb8 L |
1220 | AC_SUBST(libc_cv_protected_data) |
1221 | ||
19f1a11e L |
1222 | AC_CACHE_CHECK(linker support for INSERT in linker script, |
1223 | libc_cv_insert, | |
1224 | [cat > conftest.c <<EOF | |
5f07d47e | 1225 | int __attribute__ ((section(".bar"))) bar = 0x12345678; |
19f1a11e L |
1226 | int test (void) { return bar; } |
1227 | EOF | |
1228 | cat > conftest.t <<EOF | |
1229 | SECTIONS | |
1230 | { | |
1231 | .bar : { *(.bar) } | |
1232 | } | |
1233 | INSERT AFTER .rela.dyn; | |
1234 | EOF | |
1235 | libc_cv_insert=no | |
1236 | if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then | |
1237 | libc_cv_insert=yes | |
1238 | fi | |
1239 | rm -f conftest.* | |
1240 | ]) | |
1241 | AC_SUBST(libc_cv_insert) | |
1242 | ||
a0da5fe1 UD |
1243 | AC_CACHE_CHECK(for broken __attribute__((alias())), |
1244 | libc_cv_broken_alias_attribute, | |
1245 | [cat > conftest.c <<EOF | |
1246 | extern int foo (int x) __asm ("xyzzy"); | |
1247 | int bar (int x) { return x; } | |
1248 | extern __typeof (bar) foo __attribute ((weak, alias ("bar"))); | |
1249 | extern int dfoo; | |
1250 | extern __typeof (dfoo) dfoo __asm ("abccb"); | |
1251 | int dfoo = 1; | |
37ba7d66 | 1252 | EOF |
a0da5fe1 UD |
1253 | libc_cv_broken_alias_attribute=yes |
1254 | if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then | |
1255 | if grep 'xyzzy' conftest.s >/dev/null && | |
1256 | grep 'abccb' conftest.s >/dev/null; then | |
1257 | libc_cv_broken_alias_attribute=no | |
1258 | fi | |
1259 | fi | |
1260 | rm -f conftest.c conftest.s | |
1261 | ]) | |
1262 | if test $libc_cv_broken_alias_attribute = yes; then | |
1263 | AC_MSG_ERROR(working alias attribute support required) | |
1264 | fi | |
1265 | ||
2a723ff6 JM |
1266 | AC_CACHE_CHECK(whether to put _rtld_local into .sdata section, |
1267 | libc_cv_have_sdata_section, | |
1268 | [echo "int i;" > conftest.c | |
1269 | libc_cv_have_sdata_section=no | |
1270 | if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \ | |
1271 | | grep '\.sdata' >/dev/null; then | |
1272 | libc_cv_have_sdata_section=yes | |
1273 | fi | |
1274 | rm -f conftest.c conftest.so | |
1275 | ]) | |
1276 | if test $libc_cv_have_sdata_section = yes; then | |
1277 | AC_DEFINE(HAVE_SDATA_SECTION) | |
a0da5fe1 | 1278 | fi |
0d01dace | 1279 | |
a0da5fe1 UD |
1280 | AC_CACHE_CHECK(for libunwind-support in compiler, |
1281 | libc_cv_cc_with_libunwind, [ | |
1282 | cat > conftest.c <<EOF | |
cbdb12de UD |
1283 | int main (void) { return 0; } |
1284 | EOF | |
a0da5fe1 | 1285 | if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \ |
8175a253 | 1286 | conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then |
a0da5fe1 UD |
1287 | libc_cv_cc_with_libunwind=yes |
1288 | else | |
1289 | libc_cv_cc_with_libunwind=no | |
c776b3d7 | 1290 | fi |
a0da5fe1 UD |
1291 | rm -f conftest*]) |
1292 | AC_SUBST(libc_cv_cc_with_libunwind) | |
1293 | if test $libc_cv_cc_with_libunwind = yes; then | |
1294 | AC_DEFINE(HAVE_CC_WITH_LIBUNWIND) | |
1295 | fi | |
c776b3d7 | 1296 | |
a0da5fe1 UD |
1297 | ASFLAGS_config= |
1298 | AC_CACHE_CHECK(whether --noexecstack is desirable for .S files, | |
1299 | libc_cv_as_noexecstack, [dnl | |
1300 | cat > conftest.c <<EOF | |
35915ec8 UD |
1301 | void foo (void) { } |
1302 | EOF | |
a0da5fe1 UD |
1303 | if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS |
1304 | -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \ | |
8175a253 | 1305 | && grep .note.GNU-stack conftest.s >/dev/null \ |
a0da5fe1 UD |
1306 | && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack |
1307 | -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD]) | |
1308 | then | |
1309 | libc_cv_as_noexecstack=yes | |
1310 | else | |
1311 | libc_cv_as_noexecstack=no | |
1312 | fi | |
1313 | rm -f conftest*]) | |
1314 | if test $libc_cv_as_noexecstack = yes; then | |
1315 | ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack" | |
1316 | fi | |
1317 | AC_SUBST(ASFLAGS_config) | |
2abf9ff1 | 1318 | |
6bfea974 L |
1319 | LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack], |
1320 | [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no]) | |
a0da5fe1 | 1321 | AC_SUBST(libc_cv_z_execstack) |
c9c60884 | 1322 | |
cd6ae7ea FS |
1323 | LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc], |
1324 | [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no]) | |
1325 | LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc]) | |
1326 | ||
9926f6e2 FS |
1327 | LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x], |
1328 | [libc_cv_depaudit=yes], [libc_cv_depaudit=no]) | |
1329 | LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit]) | |
1330 | ||
e895cff5 FS |
1331 | LIBC_LINKER_FEATURE([-z pack-relative-relocs], |
1332 | [-Wl,-z,pack-relative-relocs], | |
1333 | [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no]) | |
1334 | LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr]) | |
1335 | ||
9d7a3741 L |
1336 | LIBC_LINKER_FEATURE([--no-dynamic-linker], |
1337 | [-Wl,--no-dynamic-linker], | |
1338 | [libc_cv_no_dynamic_linker=yes], | |
1339 | [libc_cv_no_dynamic_linker=no]) | |
1340 | LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker]) | |
1341 | ||
1342 | AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl | |
1343 | LIBC_TRY_CC_OPTION([-static-pie], | |
1344 | [libc_cv_static_pie=yes], | |
1345 | [libc_cv_static_pie=no]) | |
1346 | ]) | |
1347 | LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie]) | |
1348 | ||
a0da5fe1 | 1349 | AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl |
4da0431d JM |
1350 | LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no]) |
1351 | ]) | |
c9c60884 | 1352 | |
a0da5fe1 | 1353 | AC_SUBST(libc_cv_fpie) |
871b9158 | 1354 | |
89569c8b L |
1355 | AC_CACHE_CHECK(for GLOB_DAT reloc, |
1356 | libc_cv_has_glob_dat, [dnl | |
1357 | cat > conftest.c <<EOF | |
1358 | extern int mumble; | |
1359 | int foo (void) { return mumble; } | |
1360 | EOF | |
1361 | if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS | |
1362 | -fPIC -shared -o conftest.so conftest.c | |
66a704c4 | 1363 | -nostdlib -nostartfiles $no_ssp |
89569c8b L |
1364 | 1>&AS_MESSAGE_LOG_FD]) |
1365 | then | |
1366 | dnl look for GLOB_DAT relocation. | |
1367 | if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then | |
1368 | libc_cv_has_glob_dat=yes | |
1369 | else | |
1370 | libc_cv_has_glob_dat=no | |
1371 | fi | |
1372 | else | |
1373 | libc_cv_has_glob_dat=no | |
1374 | fi | |
1375 | rm -f conftest*]) | |
1376 | AC_SUBST(libc_cv_has_glob_dat) | |
1377 | ||
61655555 L |
1378 | AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2, |
1379 | [dnl | |
1380 | cat > conftest.c <<EOF | |
1381 | __thread int i; | |
1382 | void foo (void) | |
1383 | { | |
1384 | i = 10; | |
1385 | } | |
1386 | EOF | |
04e8169f AZ |
1387 | if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles |
1388 | conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD]) | |
61655555 L |
1389 | then |
1390 | libc_cv_mtls_dialect_gnu2=yes | |
1391 | else | |
1392 | libc_cv_mtls_dialect_gnu2=no | |
1393 | fi | |
1394 | rm -f conftest*]) | |
1395 | AC_SUBST(libc_cv_mtls_dialect_gnu2) | |
1396 | LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2]) | |
1397 | ||
8d98c7c0 AZ |
1398 | dnl clang emits an warning for a double alias redirection, to warn the |
1399 | dnl original symbol is sed even when weak definition overriddes it. | |
1400 | dnl It is a usual pattern for weak_alias, where multiple alias point to | |
1401 | dnl same symbol. | |
1402 | AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases], | |
1403 | libc_cv_wno_ignored_attributes, [dnl | |
1404 | cat > conftest.c <<EOF | |
1405 | void __foo (void) | |
1406 | { | |
1407 | } | |
1408 | extern __typeof (__foo) foo __attribute__ ((weak, alias ("__foo"))); | |
1409 | extern __typeof (__foo) bar __attribute__ ((weak, alias ("foo"))); | |
1410 | EOF | |
1411 | libc_cv_wno_ignored_attributes="" | |
1412 | if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c]) | |
1413 | then | |
1414 | libc_cv_wno_ignored_attributes="-Wno-ignored-attributes" | |
1415 | fi | |
1416 | rm -f conftest*]) | |
1417 | LIBC_CONFIG_VAR([config-cflags-wno-ignored-attributes], | |
1418 | [$libc_cv_wno_ignored_attributes]) | |
1419 | ||
a0da5fe1 UD |
1420 | AC_CACHE_CHECK(whether cc puts quotes around section names, |
1421 | libc_cv_have_section_quotes, | |
1422 | [cat > conftest.c <<EOF | |
1423 | static const int foo | |
1424 | __attribute__ ((section ("bar"))) = 1; | |
e26dd47f | 1425 | EOF |
a0da5fe1 UD |
1426 | if ${CC-cc} -S conftest.c -o conftest.s; then |
1427 | if grep '\.section.*"bar"' conftest.s >/dev/null; then | |
1428 | libc_cv_have_section_quotes=yes | |
e26dd47f | 1429 | else |
a0da5fe1 | 1430 | libc_cv_have_section_quotes=no |
e26dd47f | 1431 | fi |
a0da5fe1 UD |
1432 | else |
1433 | libc_cv_have_section_quotes=unknown | |
1434 | fi | |
1435 | rm -f conftest.{c,s} | |
1436 | ]) | |
1437 | if test $libc_cv_have_section_quotes = yes; then | |
1438 | AC_DEFINE(HAVE_SECTION_QUOTES) | |
9a97d1f7 UD |
1439 | fi |
1440 | ||
d555194c UD |
1441 | AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl |
1442 | cat > conftest.c <<\EOF | |
1443 | void zero (void *x) | |
1444 | { | |
a52d1562 | 1445 | __builtin_memset (x, 0, 1000); |
d555194c UD |
1446 | } |
1447 | EOF | |
1448 | dnl | |
e37fc4aa | 1449 | if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]); |
d555194c UD |
1450 | then |
1451 | libc_cv_gcc_builtin_memset=no | |
1452 | else | |
1453 | libc_cv_gcc_builtin_memset=yes | |
1454 | fi | |
1455 | rm -f conftest* ]) | |
1456 | if test "$libc_cv_gcc_builtin_memset" = yes ; then | |
1457 | AC_DEFINE(HAVE_BUILTIN_MEMSET) | |
1458 | fi | |
1459 | ||
85dd1003 UD |
1460 | AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl |
1461 | cat > conftest.c <<\EOF | |
1462 | extern char *strstr (const char *, const char *) __asm ("my_strstr"); | |
1463 | char *foo (const char *a, const char *b) | |
1464 | { | |
1465 | return __builtin_strstr (a, b); | |
1466 | } | |
1467 | EOF | |
1468 | dnl | |
e37fc4aa | 1469 | if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]); |
85dd1003 UD |
1470 | then |
1471 | libc_cv_gcc_builtin_redirection=yes | |
1472 | else | |
1473 | libc_cv_gcc_builtin_redirection=no | |
1474 | fi | |
1475 | rm -f conftest* ]) | |
3ce1f295 UD |
1476 | if test "$libc_cv_gcc_builtin_redirection" = no; then |
1477 | AC_MSG_ERROR([support for the symbol redirection needed]) | |
85dd1003 UD |
1478 | fi |
1479 | ||
7998fa78 AS |
1480 | dnl Determine how to disable generation of FMA instructions. |
1481 | AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions], | |
1482 | libc_cv_cc_nofma, [dnl | |
1483 | libc_cv_cc_nofma= | |
1484 | for opt in -ffp-contract=off -mno-fused-madd; do | |
1485 | LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break]) | |
1486 | done]) | |
bef0b507 | 1487 | AC_SUBST(libc_cv_cc_nofma) |
7998fa78 | 1488 | |
2cf9ad57 RM |
1489 | if test -n "$submachine"; then |
1490 | AC_CACHE_CHECK([for compiler option for CPU variant], | |
f7d82dc9 | 1491 | libc_cv_cc_submachine, [dnl |
2cf9ad57 RM |
1492 | libc_cv_cc_submachine=no |
1493 | for opt in "-march=$submachine" "-mcpu=$submachine"; do | |
40b601fb | 1494 | LIBC_TRY_CC_OPTION([$opt], [ |
2cf9ad57 | 1495 | libc_cv_cc_submachine="$opt" |
40b601fb | 1496 | break], []) |
2cf9ad57 RM |
1497 | done]) |
1498 | if test "x$libc_cv_cc_submachine" = xno; then | |
1499 | AC_MSG_ERROR([${CC-cc} does not support $submachine]) | |
1500 | fi | |
1501 | fi | |
1502 | AC_SUBST(libc_cv_cc_submachine) | |
1503 | ||
5c5a8b99 AZ |
1504 | dnl Determine if compiler supports -fsignaling-nans |
1505 | AC_CACHE_CHECK([for compiler option that -fsignaling-nans], | |
1506 | libc_cv_cc_signaling_nans, [dnl | |
1507 | LIBC_TRY_CC_OPTION([-Werror -fsignaling-nans], | |
1508 | [libc_cv_cc_signaling_nans=-fsignaling-nans], | |
1509 | [libc_cv_cc_signaling_nans=]) | |
1510 | ]) | |
1511 | LIBC_CONFIG_VAR([config-cflags-signaling-nans], | |
1512 | [$libc_cv_cc_signaling_nans]) | |
1513 | ||
85c2e611 AZ |
1514 | AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \ |
1515 | __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl | |
1516 | cat > conftest.c <<EOF | |
1517 | void | |
1518 | __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns"))) | |
1519 | foo (void) {} | |
1520 | EOF | |
1521 | libc_cv_cc_loop_to_function=no | |
1522 | if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c]) | |
1523 | then | |
1524 | libc_cv_cc_loop_to_function=yes | |
1525 | fi | |
1526 | rm -f conftest*]) | |
1527 | if test $libc_cv_cc_loop_to_function = yes; then | |
1528 | AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL) | |
1529 | fi | |
1530 | AC_SUBST(libc_cv_cc_loop_to_function) | |
1531 | ||
c8f3e6db UD |
1532 | dnl Check whether we have the gd library available. |
1533 | AC_MSG_CHECKING(for libgd) | |
6dab8688 UD |
1534 | if test "$with_gd" != "no"; then |
1535 | old_CFLAGS="$CFLAGS" | |
1536 | CFLAGS="$CFLAGS $libgd_include" | |
1537 | old_LDFLAGS="$LDFLAGS" | |
1538 | LDFLAGS="$LDFLAGS $libgd_ldflags" | |
1539 | old_LIBS="$LIBS" | |
1540 | LIBS="$LIBS -lgd -lpng -lz -lm" | |
e9e7f245 NT |
1541 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])], |
1542 | [LIBGD=yes], [LIBGD=no]) | |
6dab8688 UD |
1543 | CFLAGS="$old_CFLAGS" |
1544 | LDFLAGS="$old_LDFLAGS" | |
1545 | LIBS="$old_LIBS" | |
1546 | else | |
1547 | LIBGD=no | |
1548 | fi | |
c8f3e6db UD |
1549 | AC_MSG_RESULT($LIBGD) |
1550 | AC_SUBST(LIBGD) | |
3d558f4e | 1551 | |
2fff3d93 UD |
1552 | # SELinux detection |
1553 | if test x$with_selinux = xno ; then | |
1554 | have_selinux=no; | |
1555 | else | |
1556 | # See if we have the SELinux library | |
1557 | AC_CHECK_LIB(selinux, is_selinux_enabled, | |
1558 | have_selinux=yes, have_selinux=no) | |
49155d51 | 1559 | if test x$with_selinux = xyes ; then |
2fff3d93 | 1560 | if test x$have_selinux = xno ; then |
0699f766 | 1561 | AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found]) |
2fff3d93 UD |
1562 | fi |
1563 | fi | |
1564 | fi | |
1565 | # Check if we're building with SELinux support. | |
1566 | if test "x$have_selinux" = xyes; then | |
943db9eb | 1567 | AC_DEFINE(HAVE_SELINUX, 1, [SELinux support]) |
ec23b9be UD |
1568 | |
1569 | # See if we have the libaudit library | |
943db9eb | 1570 | AC_CHECK_LIB(audit, audit_log_user_avc_message, |
77e8bddf | 1571 | have_libaudit=yes, have_libaudit=no) |
ec23b9be | 1572 | if test "x$have_libaudit" = xyes; then |
943db9eb | 1573 | AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support]) |
ec23b9be UD |
1574 | fi |
1575 | AC_SUBST(have_libaudit) | |
1f063dca UD |
1576 | |
1577 | # See if we have the libcap library | |
1578 | AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no) | |
1579 | if test "x$have_libcap" = xyes; then | |
1580 | AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support]) | |
1581 | fi | |
1582 | AC_SUBST(have_libcap) | |
2fff3d93 UD |
1583 | fi |
1584 | AC_SUBST(have_selinux) | |
1585 | ||
61653dfb RM |
1586 | CPPUNDEFS= |
1587 | dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE. | |
1588 | dnl Since we are building the implementations of the fortified functions here, | |
1589 | dnl having the macro defined interacts very badly. | |
b190bccc NT |
1590 | dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1) |
1591 | dnl and above (see "man FEATURE_TEST_MACROS"). | |
1592 | dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE. | |
61653dfb | 1593 | AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source, |
b190bccc | 1594 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ |
61653dfb RM |
1595 | #ifdef _FORTIFY_SOURCE |
1596 | # error bogon | |
b190bccc | 1597 | #endif]])], |
61653dfb RM |
1598 | [libc_cv_predef_fortify_source=no], |
1599 | [libc_cv_predef_fortify_source=yes])]) | |
1600 | if test $libc_cv_predef_fortify_source = yes; then | |
1601 | CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE" | |
1602 | fi | |
1603 | AC_SUBST(CPPUNDEFS) | |
1604 | ||
0923f74a FW |
1605 | dnl Starting with binutils 2.35, GAS can attach multiple symbol versions |
1606 | dnl to one symbol (PR 23840). | |
1607 | AC_CACHE_CHECK(whether the assembler requires one version per symbol, | |
1608 | libc_cv_symver_needs_alias, [dnl | |
1609 | cat > conftest.s <<EOF | |
1610 | .text | |
1611 | testfunc: | |
1612 | .globl testfunc | |
1613 | .symver testfunc, testfunc1@VERSION1 | |
1614 | .symver testfunc, testfunc1@VERSION2 | |
1615 | EOF | |
1616 | libc_cv_symver_needs_alias=no | |
1617 | if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then | |
1618 | libc_cv_symver_needs_alias=no | |
1619 | else | |
1620 | libc_cv_symver_needs_alias=yes | |
1621 | fi | |
1622 | rm conftest.* | |
1623 | ]) | |
1624 | if test "$libc_cv_symver_needs_alias" = yes; then | |
1625 | AC_DEFINE(SYMVER_NEEDS_ALIAS) | |
1626 | fi | |
1627 | ||
9fe7e787 RM |
1628 | AC_CACHE_CHECK(for __builtin_trap with no external dependencies, |
1629 | libc_cv_builtin_trap, [dnl | |
1630 | libc_cv_builtin_trap=no | |
b190bccc | 1631 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[ |
9fe7e787 RM |
1632 | libc_undefs=`$NM -u conftest.o | |
1633 | LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \ | |
1634 | 2>&AS_MESSAGE_LOG_FD` || { | |
1635 | AC_MSG_ERROR([confusing output from $NM -u]) | |
1636 | } | |
1637 | echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'" | |
1638 | if test -z "$libc_undefs"; then | |
1639 | libc_cv_builtin_trap=yes | |
b190bccc | 1640 | fi],[])]) |
9fe7e787 RM |
1641 | if test $libc_cv_builtin_trap = yes; then |
1642 | AC_DEFINE([HAVE_BUILTIN_TRAP]) | |
44c4e5d5 RM |
1643 | fi |
1644 | ||
99e1dc0a FW |
1645 | dnl C++ feature tests. |
1646 | AC_LANG_PUSH([C++]) | |
1647 | ||
1648 | AC_CACHE_CHECK([whether the C++ compiler supports thread_local], | |
1649 | libc_cv_cxx_thread_local, [ | |
1650 | old_CXXFLAGS="$CXXFLAGS" | |
1651 | CXXFLAGS="$CXXFLAGS -std=gnu++11" | |
1652 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([ | |
1653 | #include <thread> | |
1654 | ||
1655 | // Compiler support. | |
1656 | struct S | |
1657 | { | |
1658 | S (); | |
1659 | ~S (); | |
1660 | }; | |
1661 | thread_local S s; | |
1662 | S * get () { return &s; } | |
1663 | ||
1664 | // libstdc++ support. | |
1665 | #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL | |
1666 | #error __cxa_thread_atexit_impl not supported | |
1667 | #endif | |
1668 | ])], | |
1669 | [libc_cv_cxx_thread_local=yes], | |
1670 | [libc_cv_cxx_thread_local=no]) | |
1671 | CXXFLAGS="$old_CXXFLAGS" | |
1672 | ]) | |
1673 | AC_SUBST(libc_cv_cxx_thread_local) | |
1674 | ||
1675 | AC_LANG_POP([C++]) | |
1676 | dnl End of C++ feature tests. | |
1677 | ||
c224a18a RM |
1678 | ### End of automated tests. |
1679 | ### Now run sysdeps configure fragments. | |
1680 | ||
cb343854 | 1681 | # They also can set these variables. |
591e1ffb | 1682 | use_ldconfig=no |
cb343854 | 1683 | ldd_rewrite_script=no |
77259608 | 1684 | libc_cv_sysconfdir=$sysconfdir |
4248b1b1 | 1685 | libc_cv_localstatedir=$localstatedir |
74bd2300 | 1686 | libc_cv_gcc_unwind_find_fde=no |
e2fd3cbe | 1687 | libc_cv_idn=no |
ad201afe | 1688 | pthread_in_libc=yes |
cb343854 | 1689 | |
28f540f4 | 1690 | # Iterate over all the sysdep directories we will use, running their |
09055553 | 1691 | # configure fragments. |
28f540f4 | 1692 | for dir in $sysnames; do |
57ba7bb4 UD |
1693 | case $dir in |
1694 | /*) dest=$dir ;; | |
1695 | *) dest=$srcdir/$dir ;; | |
1696 | esac | |
1697 | if test -r $dest/configure; then | |
d1149385 | 1698 | AC_MSG_RESULT(running configure fragment for $dir) |
57ba7bb4 | 1699 | . $dest/configure |
28f540f4 | 1700 | fi |
28f540f4 RM |
1701 | done |
1702 | ||
5695d46f AS |
1703 | if test x"$build_mathvec" = xnotset; then |
1704 | build_mathvec=no | |
1705 | fi | |
1706 | LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec]) | |
1707 | ||
7ffa9423 AZ |
1708 | AC_SUBST(libc_extra_cflags) |
1709 | AC_SUBST(libc_extra_cppflags) | |
1710 | ||
74bd2300 UD |
1711 | if test x$libc_cv_gcc_unwind_find_fde = xyes; then |
1712 | AC_DEFINE(EXPORT_UNWIND_FIND_FDE) | |
1713 | fi | |
1714 | AC_SUBST(libc_cv_gcc_unwind_find_fde) | |
1715 | ||
6e6249d0 RM |
1716 | # A sysdeps configure fragment can reset this if IFUNC is not actually |
1717 | # usable even though the assembler knows how to generate the symbol type. | |
1718 | if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then | |
1719 | AC_DEFINE(HAVE_IFUNC) | |
1720 | fi | |
92ad88fe | 1721 | LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function]) |
6e6249d0 | 1722 | |
022dfdce SL |
1723 | if test x"$libc_cv_gcc_indirect_function" = xyes; then |
1724 | AC_DEFINE(HAVE_GCC_IFUNC) | |
1725 | fi | |
16b59780 | 1726 | LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function]) |
022dfdce | 1727 | |
3cc3ef96 RM |
1728 | # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps |
1729 | # configure fragment can override the value to prevent this AC_DEFINE. | |
1730 | AC_SUBST(use_nscd) | |
1731 | if test "x$use_nscd" != xno; then | |
1732 | AC_DEFINE([USE_NSCD]) | |
1733 | fi | |
c53d909c RM |
1734 | if test "x$build_nscd" = xdefault; then |
1735 | build_nscd=$use_nscd | |
1736 | fi | |
3cc3ef96 | 1737 | |
84384f5b | 1738 | AC_SUBST(libc_cv_slibdir) |
aaa8cb4b | 1739 | AC_SUBST(libc_cv_rtlddir) |
90fe682d | 1740 | AC_SUBST(libc_cv_complocaledir) |
77259608 | 1741 | AC_SUBST(libc_cv_sysconfdir) |
4248b1b1 | 1742 | AC_SUBST(libc_cv_localstatedir) |
1ef32c3d UD |
1743 | AC_SUBST(libc_cv_rootsbindir) |
1744 | ||
f57f8055 RM |
1745 | if test x$use_ldconfig = xyes; then |
1746 | AC_DEFINE(USE_LDCONFIG) | |
1747 | fi | |
591e1ffb | 1748 | AC_SUBST(use_ldconfig) |
cb343854 | 1749 | AC_SUBST(ldd_rewrite_script) |
84384f5b | 1750 | |
650425ce | 1751 | AC_SUBST(static) |
ff3d7ed3 | 1752 | AC_SUBST(shared) |
a334319f | 1753 | |
ff886b82 UD |
1754 | AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default, |
1755 | [libc_cv_pic_default=yes | |
cc3fa755 | 1756 | cat > conftest.c <<EOF |
9756dfe1 | 1757 | #if defined __PIC__ || defined __pic__ || defined PIC || defined pic |
cc3fa755 UD |
1758 | # error PIC is default. |
1759 | #endif | |
1760 | EOF | |
0b4ee387 | 1761 | if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then |
ff886b82 | 1762 | libc_cv_pic_default=no |
cc3fa755 UD |
1763 | fi |
1764 | rm -f conftest.*]) | |
23645707 | 1765 | LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default]) |
cc3fa755 | 1766 | |
00c714df L |
1767 | AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default, |
1768 | [libc_cv_cc_pie_default=yes | |
cc08749b L |
1769 | cat > conftest.c <<EOF |
1770 | #if defined __PIE__ || defined __pie__ || defined PIE || defined pie | |
1771 | # error PIE is default. | |
1772 | #endif | |
1773 | EOF | |
1774 | if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then | |
00c714df | 1775 | libc_cv_cc_pie_default=no |
cc08749b L |
1776 | fi |
1777 | rm -f conftest.*]) | |
23645707 SP |
1778 | LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default]) |
1779 | ||
1780 | AC_MSG_CHECKING(if we can build programs as PIE) | |
ded3aeb2 | 1781 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED |
23645707 | 1782 | # error PIE is not supported |
ded3aeb2 L |
1783 | #endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no]) |
1784 | AC_MSG_RESULT($libc_cv_pie_supported) | |
1785 | # Disable build-pie-default if target does not support it or glibc is | |
1786 | # configured with --disable-default-pie. | |
1787 | if test "x$default_pie" = xno; then | |
1788 | build_pie_default=no | |
1789 | else | |
1790 | build_pie_default=$libc_cv_pie_supported | |
23645707 | 1791 | fi |
ded3aeb2 | 1792 | LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default]) |
23645707 SP |
1793 | |
1794 | AC_MSG_CHECKING(if we can build static PIE programs) | |
ded3aeb2 L |
1795 | libc_cv_static_pie_supported=$libc_cv_pie_supported |
1796 | if test "x$libc_cv_pie_supported" != xno \ | |
23645707 | 1797 | -a "$libc_cv_no_dynamic_linker" = yes; then |
23645707 SP |
1798 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE |
1799 | # error static PIE is not supported | |
ded3aeb2 L |
1800 | #endif]])], [libc_cv_static_pie_supported=yes], |
1801 | [libc_cv_static_pie_supported=no]) | |
1802 | fi | |
1803 | AC_MSG_RESULT($libc_cv_static_pie_supported) | |
1804 | ||
1805 | # Enable static-pie only if it is available and glibc isn't configured | |
1806 | # with --disable-default-pie. | |
1807 | if test "x$default_pie" = xno; then | |
1808 | libc_cv_static_pie=no | |
1809 | else | |
1810 | libc_cv_static_pie=$libc_cv_static_pie_supported | |
1811 | fi | |
1812 | if test "$libc_cv_static_pie" = "yes"; then | |
1813 | AC_DEFINE(ENABLE_STATIC_PIE) | |
23645707 | 1814 | fi |
23645707 | 1815 | LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie]) |
cc08749b | 1816 | |
abcb584d L |
1817 | # Set the `multidir' variable by grabbing the variable from the compiler. |
1818 | # We do it once and save the result in a generated makefile. | |
1819 | libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory` | |
1820 | AC_SUBST(libc_cv_multidir) | |
1821 | ||
ff3d7ed3 | 1822 | AC_SUBST(profile) |
5107cf1d | 1823 | AC_SUBST(static_nss) |
ff3d7ed3 | 1824 | |
edf5b2d7 UD |
1825 | AC_SUBST(DEFINES) |
1826 | ||
cb8a6dbd | 1827 | dnl See sysdeps/mach/configure.ac for this variable. |
61c83c3f RM |
1828 | AC_SUBST(mach_interface_list) |
1829 | ||
ee74a442 UD |
1830 | VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h` |
1831 | RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h` | |
df4ef2ab | 1832 | AC_SUBST(VERSION) |
ee74a442 | 1833 | AC_SUBST(RELEASE) |
df4ef2ab | 1834 | |
ad201afe FW |
1835 | if test "$pthread_in_libc" = yes; then |
1836 | AC_DEFINE(PTHREAD_IN_LIBC) | |
1837 | fi | |
1838 | AC_SUBST(pthread_in_libc) | |
1839 | ||
728e272a | 1840 | AC_CONFIG_FILES([config.make Makefile]) |
c118d634 | 1841 | AC_CONFIG_COMMANDS([default],[[ |
737547be UD |
1842 | case $CONFIG_FILES in *config.make*) |
1843 | echo "$config_vars" >> config.make;; | |
1844 | esac | |
c118d634 RM |
1845 | test -d bits || mkdir bits]],[[config_vars='$config_vars']]) |
1846 | AC_OUTPUT |