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