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