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