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