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