include: Sync with GCC
[deliverable/binutils-gdb.git] / gold / configure.ac
CommitLineData
bae7f79e 1dnl Process this file with autoconf to produce a configure script.
5bf135a7 2dnl
219d1afa 3dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
5bf135a7
NC
4dnl
5dnl This file is free software; you can redistribute it and/or modify
6dnl it under the terms of the GNU General Public License as published by
7dnl the Free Software Foundation; either version 3 of the License, or
8dnl (at your option) any later version.
2b64b551 9dnl
5bf135a7
NC
10dnl This program is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13dnl GNU General Public License for more details.
2b64b551 14dnl
5bf135a7
NC
15dnl You should have received a copy of the GNU General Public License
16dnl along with this program; see the file COPYING3. If not see
17dnl <http://www.gnu.org/licenses/>.
18dnl
bae7f79e
ILT
19
20AC_PREREQ(2.59)
8486ee48
ILT
21
22AC_INIT(gold, 0.1)
23AC_CONFIG_SRCDIR(gold.cc)
bae7f79e
ILT
24
25AC_CANONICAL_TARGET
26
6ea55b82 27AM_INIT_AUTOMAKE([no-dist parallel-tests])
bae7f79e
ILT
28
29AM_CONFIG_HEADER(config.h:config.in)
30
24538276
CC
31AC_USE_SYSTEM_EXTENSIONS
32
df7b86aa
NC
33# PR 14072
34AH_VERBATIM([00_CONFIG_H_CHECK],
35[/* Check that config.h is #included before system headers
36 (this works only for glibc, but that should be enough). */
0a6f1bf2 37#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
df7b86aa
NC
38# error config.h must be #included before system headers
39#endif
40#define __CONFIG_H__ 1])
41
ad2d6943
ILT
42AC_ARG_WITH(sysroot,
43[ --with-sysroot[=DIR] search for usr/lib et al within DIR],
44[sysroot=$withval], [sysroot=no])
45
46if test "$sysroot" = "yes"; then
47 sysroot='${exec_prefix}/${target_alias}/sys-root'
48elif test "$sysroot" = "no"; then
49 sysroot=
50fi
51
52sysroot_relocatable=0
53if test -n "$sysroot"; then
7a34932b 54 case "$sysroot" in
ad2d6943
ILT
55 "${prefix}" | "${prefix}/"* | \
56 "${exec_prefix}" | "${exec_prefix}/"* | \
57 '${prefix}' | '${prefix}/'*| \
58 '${exec_prefix}' | '${exec_prefix}/'*)
59 sysroot_relocatable=1
60 ;;
61 esac
62fi
63
64AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot",
65 [System root for target files])
66AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT_RELOCATABLE, $sysroot_relocatable,
67 [Whether the system root can be relocated])
68
4fda8867
NC
69dnl "install_as_default" is true if the linker to be installed as the
70dnl default linker, ld.
71dnl "installed_linker" is the installed gold linker name.
c7791212 72
f2a6224b 73installed_linker=ld.gold
c7791212
NC
74AC_ARG_ENABLE(gold,
75[[ --enable-gold[=ARG] build gold [ARG={default,yes,no}]]],
76[case "${enableval}" in
f2a6224b
L
77 default)
78 install_as_default=yes
79 ;;
80 yes)
81 if test x${enable_ld} = xno; then
c7791212
NC
82 install_as_default=yes
83 fi
4fda8867
NC
84 ;;
85 esac],
f2a6224b 86[install_as_default=no])
4fda8867
NC
87AC_SUBST(install_as_default)
88AC_SUBST(installed_linker)
89
fe9a4c12
ILT
90dnl For now threads are a configure time option.
91AC_ARG_ENABLE([threads],
92[ --enable-threads multi-threaded linking],
93[case "${enableval}" in
94 yes | "") threads=yes ;;
95 no) threads=no ;;
96 *) threads=yes ;;
97 esac],
98[threads=no])
99if test "$threads" = "yes"; then
100 AC_DEFINE(ENABLE_THREADS, 1,
101 [Define to do multi-threaded linking])
102fi
103AM_CONDITIONAL(THREADS, test "$threads" = "yes")
89fc3421 104
24538276 105AC_PLUGINS
89fc3421
CC
106if test "$plugins" = "yes"; then
107 AC_DEFINE(ENABLE_PLUGINS, 1,
108 [Define to enable linker plugins])
109fi
110AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
fe9a4c12 111
6b1edb94
L
112# Decide if -z relro should be enabled in ELF linker by default.
113ac_default_ld_z_relro=unset
114# Provide a configure time option to override our default.
115AC_ARG_ENABLE(relro,
116 AS_HELP_STRING([--enable-relro],
117 [enable -z relro in ELF linker by default]),
118[case "${enableval}" in
119 yes) ac_default_ld_z_relro=1 ;;
120 no) ac_default_ld_z_relro=0 ;;
121esac])dnl
122if test "${ac_default_ld_z_relro}" = unset; then
123 ac_default_ld_z_relro=1
124fi
125AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_RELRO,
126 $ac_default_ld_z_relro,
127 [Define to 1 if you want to enable -z relro in ELF linker by default.])
128
193a53d9
ILT
129AC_ARG_ENABLE([targets],
130[ --enable-targets alternative target configurations],
131[case "${enableval}" in
132 yes | "")
133 AC_MSG_ERROR([--enable-targets option must specify target names or 'all'])
134 ;;
135 no)
136 enable_targets=
137 ;;
138 *)
139 enable_targets=$enableval
140 ;;
141esac],
142[# For now, enable all targets by default
143 enable_targets=all
144])
145
146# Canonicalize the enabled targets.
147if test -n "$enable_targets"; then
148 for targ in `echo $enable_targets | sed -e 's/,/ /g'`; do
149 result=`$ac_config_sub $targ 2>/dev/null`
150 if test -n "$result"; then
151 canon_targets="$canon_targets $result"
152 else
153 # Permit unrecognized target names, like "all".
154 canon_targets="$canon_targets $targ"
155 fi
156 done
157fi
158
2760f24c
RG
159# Decide which "--hash-style" to use by default
160# Provide a configure time option to override our default.
161AC_ARG_ENABLE([default-hash-style],
162AS_HELP_STRING([--enable-default-hash-style={sysv,gnu,both}],
163 [use this default hash style]),
164[case "${enable_default_hash_style}" in
165 sysv | gnu | both) ;;
166 *) AC_MSG_ERROR([bad value ${enable_default_hash_style} for enable-default-hash-style option]) ;;
167esac],
168[case "${target}" in
169 # Enable gnu hash only on GNU targets, but not mips
170 mips*-*-*) enable_default_hash_style=sysv ;;
171 *-*-gnu* | *-*-linux* | *-*-nacl*) enable_default_hash_style=both ;;
172 *) enable_default_hash_style=sysv ;;
173esac])
174
175AC_DEFINE_UNQUOTED([DEFAULT_HASH_STYLE],
176 ["${enable_default_hash_style}"],
177 [Set the default --hash-style value])
178
193a53d9 179# See which specific instantiations we need.
6df6da4a
ILT
180targetobjs=
181all_targets=
fbfba508
ILT
182default_machine=
183default_size=
184default_big_endian=
36959681 185default_osabi=ELFOSABI_NONE
fbfba508
ILT
186targ_32_little=
187targ_32_big=
188targ_64_little=
189targ_64_big=
193a53d9 190for targ in $target $canon_targets; do
193a53d9
ILT
191 if test "$targ" = "all"; then
192 targ_32_little=yes
193 targ_32_big=yes
194 targ_64_little=yes
195 targ_64_big=yes
6df6da4a 196 all_targets=yes
193a53d9 197 else
fbfba508
ILT
198 . ${srcdir}/configure.tgt
199
200 if test "$targ_obj" = "UNKNOWN"; then
6df6da4a 201 AC_MSG_ERROR("unsupported target $targ")
fbfba508
ILT
202 else
203 targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
60b2b4e7
ILT
204 if test "$targ_extra_obj" != ""; then
205 targetobjs="$targetobjs ${targ_extra_obj}.\$(OBJEXT)"
206 fi
f5314dd5
DM
207 if test "$targ_size" = "32" -o "$targ_extra_size" = "32"; then
208 if test "$targ_big_endian" = "true" \
209 -o "$targ_extra_big_endian" = "true"; then
210 targ_32_big=yes
211 fi
212 if test "$targ_big_endian" = "false" \
213 -o "$targ_extra_big_endian" = "false"; then
214 targ_32_little=yes
215 fi
216 fi
217 if test "$targ_size" = "64" -o "$targ_extra_size" = "64"; then
218 if test "$targ_big_endian" = "true" \
219 -o "$targ_extra_big_endian" = "true"; then
220 targ_64_big=yes
221 fi
222 if test "$targ_big_endian" = "false" \
223 -o "$targ_extra_big_endian" = "false"; then
224 targ_64_little=yes
225 fi
fbfba508
ILT
226 fi
227
228 if test "$target" = "$targ"; then
229 default_machine=$targ_machine
230 default_size=$targ_size
231 default_big_endian=$targ_big_endian
36959681 232 default_osabi=$targ_osabi
364c7fa5 233
053a4d68 234 AM_CONDITIONAL(DEFAULT_TARGET_AARCH64, test "$targ_obj" = "aarch64")
364c7fa5
ILT
235 AM_CONDITIONAL(DEFAULT_TARGET_ARM, test "$targ_obj" = "arm")
236 AM_CONDITIONAL(DEFAULT_TARGET_I386, test "$targ_obj" = "i386")
237 AM_CONDITIONAL(DEFAULT_TARGET_POWERPC, test "$targ_obj" = "powerpc")
238 AM_CONDITIONAL(DEFAULT_TARGET_SPARC, test "$targ_obj" = "sparc")
e79a4bad 239 AM_CONDITIONAL(DEFAULT_TARGET_S390, test "$targ_obj" = "s390")
4fc1b9d4
L
240 target_x86_64=no
241 target_x32=no
242 if test "$targ_obj" = "x86_64"; then
243 case "$target" in
244 x86_64*-linux-gnux32)
245 target_x32=yes
be66981e 246 default_size=32
4fc1b9d4
L
247 ;;
248 *)
249 target_x86_64=yes
250 ;;
251 esac
252 fi
253 AM_CONDITIONAL(DEFAULT_TARGET_X86_64, test "$target_x86_64" = "yes")
254 AM_CONDITIONAL(DEFAULT_TARGET_X32, test "$target_x32" = "yes")
ad961eab
L
255 AM_CONDITIONAL(DEFAULT_TARGET_X86_64_OR_X32,
256 test "$target_x86_64" = "yes" -o "$target_x32" = "yes")
5c0b3823 257 AM_CONDITIONAL(DEFAULT_TARGET_TILEGX, test "$targ_obj" = "tilegx")
9810d34d 258 AM_CONDITIONAL(DEFAULT_TARGET_MIPS, test "$targ_obj" = "mips")
9df9de2c
CC
259 DEFAULT_TARGET=${targ_obj}
260 AC_SUBST(DEFAULT_TARGET)
fbfba508
ILT
261 fi
262 fi
193a53d9
ILT
263 fi
264done
265
6cfaf60b 266# Remove any duplicates.
9109c078
ILT
267to=""
268for t in $targetobjs; do
269 case " $to " in
270 *" $t "*) ;;
271 *) to="$to $t" ;;
272 esac
273done
274targetobjs=$to
6cfaf60b 275
193a53d9
ILT
276if test -n "$targ_32_little"; then
277 AC_DEFINE(HAVE_TARGET_32_LITTLE, 1,
278 [Define to support 32-bit little-endian targets])
279fi
280if test -n "$targ_32_big"; then
281 AC_DEFINE(HAVE_TARGET_32_BIG, 1,
282 [Define to support 32-bit big-endian targets])
283fi
284if test -n "$targ_64_little"; then
285 AC_DEFINE(HAVE_TARGET_64_LITTLE, 1,
286 [Define to support 64-bit little-endian targets])
287fi
288if test -n "$targ_64_big"; then
289 AC_DEFINE(HAVE_TARGET_64_BIG, 1,
290 [Define to support 64-bit big-endian targets])
291fi
292
6df6da4a
ILT
293if test -n "$all_targets"; then
294 TARGETOBJS='$(ALL_TARGETOBJS)'
295else
296 TARGETOBJS="$targetobjs"
297fi
298AC_SUBST(TARGETOBJS)
299
fbfba508
ILT
300AC_DEFINE_UNQUOTED(GOLD_DEFAULT_MACHINE, $default_machine,
301 [Default machine code])
302AC_DEFINE_UNQUOTED(GOLD_DEFAULT_SIZE, $default_size,
303 [Default size (32 or 64)])
304AC_DEFINE_UNQUOTED(GOLD_DEFAULT_BIG_ENDIAN, $default_big_endian,
305 [Default big endian (true or false)])
36959681
ILT
306AC_DEFINE_UNQUOTED(GOLD_DEFAULT_OSABI, $default_osabi,
307 [Default OSABI code])
fbfba508 308
3f3cddf1
ILT
309AC_ARG_WITH(lib-path,
310[ --with-lib-path=dir1:dir2... set default LIB_PATH],
311[case "$withval" in
312 yes) LIB_PATH='"/lib:/usr/lib"' ;;
313 no) LIB_PATH='""' ;;
314 *) LIB_PATH='"'"$withval"'"' ;;
315 esac],
316[LIB_PATH='"::DEFAULT::"'])
317AC_DEFINE_UNQUOTED(LIB_PATH, $LIB_PATH,
318 [Default library search path])
319if test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias"; then
320 AC_DEFINE(NATIVE_LINKER, 1, [Whether configured as a native linker])
321fi
322
ebb300b2
CC
323AC_CHECK_TOOL(NM, nm)
324
bae7f79e
ILT
325AC_PROG_CC
326AC_PROG_CXX
dbe717ef 327AC_PROG_YACC
5a6f7e2d 328AC_PROG_RANLIB
bae7f79e 329AC_PROG_INSTALL
537b5f51 330AC_PROG_LN_S
fa99aa09
ILT
331
332AC_GNU_SOURCE
333
bae7f79e
ILT
334ZW_GNU_GETTEXT_SISTER_DIR
335AM_PO_SUBDIRS
336
92e059d8
ILT
337AC_C_BIGENDIAN
338
bae7f79e
ILT
339AC_EXEEXT
340
537b5f51
ILT
341AM_CONDITIONAL(NATIVE_LINKER,
342 test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias")
343AM_CONDITIONAL(GCC, test "$GCC" = yes)
344
eb373049
ILT
345AM_CONDITIONAL(NATIVE_OR_CROSS_LINKER,
346 test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias" -o "x$host_alias" = "x$build_alias")
347
328c7c2f
ILT
348dnl Test for whether static linking is supported. Some systems do not
349dnl install static libraries. This only affects the set of tests that
350dnl we run.
351AC_CACHE_CHECK([whether static linking works], [gold_cv_lib_static],
dd7af074 352[LDFLAGS_hold=$LDFLAGS
328c7c2f 353LDFLAGS="$LDFLAGS -static"
dd7af074 354AC_LINK_IFELSE([
328c7c2f 355AC_LANG_PROGRAM([[void f() { }]])],
dd7af074
ILT
356[gold_cv_lib_static=yes], [gold_cv_lib_static=no])
357LDFLAGS=$LDFLAGS_hold])
328c7c2f
ILT
358AM_CONDITIONAL(HAVE_STATIC, test "$gold_cv_lib_static" = "yes")
359
63402fe4
ILT
360dnl Some architectures do not support taking pointers of functions
361dnl defined in shared libraries except in -fPIC mode. We need to
362dnl tell the unittest framework if we're compiling for one of those
363dnl targets, so it doesn't try to run the tests that do that.
364AM_CONDITIONAL(FN_PTRS_IN_SO_WITHOUT_PIC, [
365 case $target_cpu in
864a1b56 366 powerpc*) false;;
63402fe4 367 x86_64) false;;
11936fb1 368 sparc64) false;;
e79a4bad 369 s390x) false;;
63402fe4
ILT
370 *) true;;
371 esac])
372
084e2665
ILT
373dnl Test for gcc 4.1 or later. Full support for -mcmodel=medium is
374dnl only available in gcc 4.1.
375AC_CACHE_CHECK([for gcc >= 4.1], [gold_cv_prog_gcc41],
376[AC_COMPILE_IFELSE([
377#if !defined __GNUC__
378error
379#elif __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
380error
381#endif
382], [gold_cv_prog_gcc41=yes], [gold_cv_prog_gcc41=no])])
383
24482ca0
L
384save_CFLAGS="$CFLAGS"
385CFLAGS="$CFLAGS -mcmodel=medium"
386AC_COMPILE_IFELSE([int i;], [have_mcmodel_medium=yes], [have_mcmodel_medium=no])
387CFLAGS="$save_CFLAGS"
8a5e3e08 388dnl Whether we can test -mcmodel=medium.
084e2665 389AM_CONDITIONAL(MCMODEL_MEDIUM,
24482ca0 390[test "$target_cpu" = "x86_64" -a "$have_mcmodel_medium" = "yes" -a "$gold_cv_prog_gcc41" = "yes"])
8a5e3e08 391
2b64b551
RM
392AC_CACHE_CHECK([whether $CC supports -fmerge-constants],
393 [gold_cv_merge_constants], [
394save_CFLAGS="$CFLAGS"
395CFLAGS="$CFLAGS -fmerge-constants"
396AC_COMPILE_IFELSE([const char *s = "foo";],
2500c017
CC
397 [gold_cv_merge_constants=yes],
398 [gold_cv_merge_constants=no])
2b64b551
RM
399CFLAGS="$save_CFLAGS"])
400AC_SUBST([MERGE_CONSTANTS_FLAG])
401AS_IF([test "$gold_cv_merge_constants" = yes],
402 [MERGE_CONSTANTS_FLAG=-fmerge-constants],
403 [MERGE_CONSTANTS_FLAG=])
404
6eee141f 405dnl Test for __thread support.
097ec620
ILT
406AC_CACHE_CHECK([for thread support], [gold_cv_c_thread],
407[AC_COMPILE_IFELSE([__thread int i = 1;],
408[gold_cv_c_thread=yes], [gold_cv_c_thread=no])])
409
410AM_CONDITIONAL(TLS, test "$gold_cv_c_thread" = "yes")
411
412dnl On GNU/Linux TLS in static programs only works when using glibc
413dnl 2.4 or later.
414AC_CACHE_CHECK([for glibc >= 2.4], [gold_cv_lib_glibc24],
415[AC_COMPILE_IFELSE([
416#include <features.h>
417#if !defined __GLIBC__
418error
419#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4)
420error
421#endif
422], [gold_cv_lib_glibc24=yes], [gold_cv_lib_glibc24=no])])
423
424AM_CONDITIONAL(STATIC_TLS, test "$gold_cv_lib_glibc24" = "yes")
6eee141f 425
155a0dd7
ILT
426dnl Test for #pragma omp threadprivate
427AC_CACHE_CHECK([for omp support], [gold_cv_c_threadprivate],
428[save_CFLAGS="$CFLAGS"
429CFLAGS="$CFLAGS -fopenmp"
430AC_COMPILE_IFELSE([
431#include <omp.h>
432int i;
433#pragma omp threadprivate (i)
434], [gold_cv_c_threadprivate=yes], [gold_cv_c_threadprivate=no])
435CFLAGS="$save_CFLAGS"])
436if test "$gold_cv_c_threadprivate" = "yes"; then
437 AC_DEFINE(HAVE_OMP_SUPPORT, 1,
438 [Define if compiler supports #pragma omp threadprivate])
439fi
440AM_CONDITIONAL(OMP_SUPPORT, test "$gold_cv_c_threadprivate" = "yes")
441
c2b45e22 442dnl Test for the -ftls-dialect=gnu2 option.
13323c49
RM
443dnl Use -Werror in case of compilers that make unknown -m options warnings.
444dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS
445dnl gets set later by default Autoconf magic to include -Werror. (We are
446dnl assuming here that there is no compiler that groks -mtls-dialect=gnu2
447dnl but does not grok -Werror.)
c2b45e22 448save_CFLAGS="$CFLAGS"
13323c49 449CFLAGS="$CFLAGS -Werror -fpic -mtls-dialect=gnu2"
63887f3d
L
450AC_COMPILE_IFELSE([
451__thread int i;
452void foo (void)
453{
454 i = 10;
455}
456], [have_tls_gnu2=yes], [have_tls_gnu2=no])
c2b45e22
CC
457CFLAGS="$save_CFLAGS"
458AM_CONDITIONAL(TLS_GNU2_DIALECT, test "$have_tls_gnu2" = "yes")
459
460dnl On GNU/Linux TLS descriptors are supported by the dynamic loader
b0074644
ILT
461dnl only with glibc 2.9 or later.
462AC_CACHE_CHECK([for glibc >= 2.9], [gold_cv_lib_glibc29],
c2b45e22
CC
463[AC_COMPILE_IFELSE([
464#include <features.h>
465#if !defined __GLIBC__
466error
b0074644 467#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 9)
c2b45e22
CC
468error
469#endif
b0074644 470], [gold_cv_lib_glibc29=yes], [gold_cv_lib_glibc29=no])])
c2b45e22 471
b0074644 472AM_CONDITIONAL(TLS_DESCRIPTORS, test "$gold_cv_lib_glibc29" = "yes")
c2b45e22 473
1d1f116d
CD
474dnl Test for the -frandom-seed option.
475AC_CACHE_CHECK([for -frandom-seed support], [gold_cv_c_random_seed],
476[save_CFLAGS="$CFLAGS"
477CFLAGS="$CFLAGS -frandom-seed=foo"
478AC_COMPILE_IFELSE([int i;], [gold_cv_c_random_seed=yes],
479[gold_cv_c_random_seed=no])
480CFLAGS="$save_CFLAGS"])
481if test "$gold_cv_c_random_seed" = "yes"; then
482 # In Makefile, '$@' will be expanded to be the name of the file
483 # being built, providing a unique seed for each file.
484 RANDOM_SEED_CFLAGS=-frandom-seed=\$@
485fi
486AC_SUBST(RANDOM_SEED_CFLAGS)
487
7223e9ca 488dnl On GNU/Linux ifunc is supported by the dynamic linker in glibc
d0773f31 489dnl 2.11 or later, and by binutils 2.20.1 or later.
ebb300b2
CC
490AC_CACHE_CHECK([for glibc ifunc support], [gold_cv_lib_glibc_ifunc],
491[save_LDFLAGS="$LDFLAGS"
492LDFLAGS="$LDFLAGS -static"
493AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7223e9ca
ILT
494#include <features.h>
495#if !defined __GLIBC__
496error
497#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 11)
498error
499#endif
ebb300b2
CC
500void func (void) { }
501void invoke (void);
502__asm__(".type invoke, %gnu_indirect_function");
503typedef void (*funcptr) (void);
504funcptr dispatch (void) __asm__ ("invoke");
505funcptr dispatch (void) { return &func; }]],
506[[invoke();]])
507], [
508if ${NM} conftest$EXEEXT | grep "__rela\?_iplt_start" >/dev/null 2>&1; then
509 gold_cv_lib_glibc_ifunc=both
510else
511 gold_cv_lib_glibc_ifunc=dyn
512fi], [gold_cv_lib_glibc_ifunc=no])
513LDFLAGS="$save_LDFLAGS"])
7223e9ca 514
ebb300b2
CC
515AM_CONDITIONAL(IFUNC, test "$gold_cv_lib_glibc_ifunc" != "no")
516AM_CONDITIONAL(IFUNC_STATIC, test "$gold_cv_lib_glibc_ifunc" = "both")
7223e9ca 517
bae7f79e
ILT
518AM_BINUTILS_WARNINGS
519
2ea97941 520WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'`
bae7f79e
ILT
521AC_SUBST(WARN_CXXFLAGS)
522
dc87f620
ILT
523AC_ARG_WITH(gold-ldflags,
524[ --with-gold-ldflags=FLAGS additional link flags for gold],
525[if test "$withval" = "no" -o "$withval" = "yes"; then
526 GOLD_LDFLAGS=
527 else
528 GOLD_LDFLAGS=$withval
529 fi],
530[GOLD_LDFLAGS=])
531AC_SUBST(GOLD_LDFLAGS)
532
533AC_ARG_WITH(gold-ldadd,
534[ --with-gold-ldadd=LIBS additional libraries for gold],
535[if test "$withval" = "no" -o "$withval" = "yes"; then
536 GOLD_LDADD=
537 else
538 GOLD_LDADD=$withval
539 fi],
540[GOLD_LDADD=])
541AC_SUBST(GOLD_LDADD)
542
bae7f79e
ILT
543dnl Force support for large files by default. This may need to be
544dnl host dependent. If build == host, we can check getconf LFS_CFLAGS.
494e05f4
ILT
545LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
546AC_SUBST(LFS_CFLAGS)
bae7f79e 547
88597d34
ILT
548AC_CHECK_HEADERS(sys/mman.h)
549AC_CHECK_FUNCS(chsize mmap)
550AC_REPLACE_FUNCS(pread ftruncate ffsll)
551
552AC_CACHE_CHECK([mremap with MREMAP_MAYMOVE], [gold_cv_lib_mremap_maymove],
553[AC_LINK_IFELSE([
554AC_LANG_PROGRAM([[
555#include <sys/mman.h>
556void f() { mremap (0, 0, 0, MREMAP_MAYMOVE); }
557]])], [gold_cv_lib_mremap_maymove=yes], [gold_cv_lib_mremap_maymove=no])])
558if test "$gold_cv_lib_mremap_maymove" = "yes"; then
559 AC_DEFINE(HAVE_MREMAP, 1,
560 [Define to 1 if you have the mremap function with MREMAP_MAYMOVE support])
561else
562 AC_LIBOBJ(mremap)
563fi
82dcae9d 564
9a0910c3 565# Link in zlib if we can. This allows us to write compressed sections.
ae2eea65 566AM_ZLIB
9a0910c3 567
0639a6f6
ILT
568dnl We have to check these in C, not C++, because autoconf generates
569dnl tests which have no type information, and current glibc provides
570dnl multiple declarations of functions like basename when compiling
571dnl with C++.
572AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])
573
ae447ddd
CC
574dnl Check if gcc supports the -gpubnames option.
575dnl Use -Werror in case of compilers that make unknown -g options warnings.
576dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS
577dnl gets set later by default Autoconf magic to include -Werror. (We are
578dnl assuming here that there is no compiler that groks -gpubnames
579dnl but does not grok -Werror.)
580save_CFLAGS="$CFLAGS"
581CFLAGS="$CFLAGS -Werror -gpubnames"
582AC_COMPILE_IFELSE([int i;], [have_pubnames=yes], [have_pubnames=no])
583CFLAGS="$save_CFLAGS"
584AM_CONDITIONAL(HAVE_PUBNAMES, test "$have_pubnames" = "yes")
585
586dnl Check if gcc supports the -fno-use-linker-plugin option.
587save_CFLAGS="$CFLAGS"
588CFLAGS="$CFLAGS -Werror -fno-use-linker-plugin"
589AC_COMPILE_IFELSE([int i;], [have_no_use_linker_plugin=yes], [have_no_use_linker_plugin=no])
590CFLAGS="$save_CFLAGS"
591AM_CONDITIONAL(HAVE_NO_USE_LINKER_PLUGIN, test "$have_no_use_linker_plugin" = "yes")
592
54dc6425 593AC_LANG_PUSH(C++)
d288e464 594
8356f2d0 595AC_CHECK_HEADERS(unordered_set unordered_map)
54dc6425
ILT
596AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map)
597AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
15d5fa16 598AC_CHECK_HEADERS(byteswap.h)
0bf402d5
ILT
599
600dnl When plugins enabled dynamic loader interface is required. Check headers
6632e8cc 601dnl which may provide this interface. Add the necessary library to link.
0bf402d5 602AC_CHECK_HEADERS(windows.h)
6632e8cc
CC
603AC_CHECK_HEADERS(dlfcn.h)
604AC_SEARCH_LIBS(dlopen, [dl dld])
605case "$ac_cv_search_dlopen" in
606 no*) DLOPEN_LIBS="";;
607 *) DLOPEN_LIBS="$ac_cv_search_dlopen";;
608esac
0bf402d5
ILT
609AC_SUBST(DLOPEN_LIBS)
610
7c0640fa 611AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times)
3d857b98 612AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem])
d288e464 613
40fde488
CD
614# Use of ::std::tr1::unordered_map::rehash causes undefined symbols
615# at link time with some versions of GCC.
616AC_CACHE_CHECK([whether ::std::tr1::unordered_map::rehash is usable.],
617[gold_cv_unordered_map_rehash],
618[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
619#include <tr1/unordered_map>
620void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); }
621]])], [gold_cv_unordered_map_rehash=yes], [gold_cv_unordered_map_rehash=no])])
622if test "$gold_cv_unordered_map_rehash" = "yes"; then
623 AC_DEFINE(HAVE_TR1_UNORDERED_MAP_REHASH, 1,
624 [Define if ::std::tr1::unordered_map::rehash is usable])
625fi
626
81c82a68
ILT
627# Use of tr1/unordered_map with off_t as a key is not supported on GCC
628# 4.1.xx when compiling in 32-bit mode with a 64-bit off_t type.
629AC_CACHE_CHECK([whether std::tr1::hash<off_t> is defined],
630[gold_cv_hash_off_t],
631[CXXFLAGS_hold=$CXXFLAGS
632CXXFLAGS="$CXXFLAGS $LFS_CFLAGS"
633AC_COMPILE_IFELSE([
634#include <sys/types.h>
635#include <tr1/unordered_map>
636std::tr1::hash<off_t> h;
637],
638[gold_cv_hash_off_t=yes],
639[gold_cv_hash_off_t=no])
26e4ef59 640CXXFLAGS=$CXXFLAGS_hold])
81c82a68
ILT
641if test "$gold_cv_hash_off_t" = "yes"; then
642 AC_DEFINE(HAVE_TR1_HASH_OFF_T, 1,
643 [Define if std::tr1::hash<off_t> is usable])
644fi
645
04bf7072
ILT
646# gcc 4.3.0 doesn't recognize the printf attribute on a template
647# function. Check for that. This is gcc bug 35546. This test can
648# probably be removed after the bug has been fixed for a while.
649AC_CACHE_CHECK([whether we can use attributes with template functions],
650[gold_cv_template_attribute],
651[AC_COMPILE_IFELSE([
652template<typename T> extern void foo(const char*, ...)
653 __attribute__ ((__format__ (__printf__, 1, 2)));
654template<typename T> void foo(const char* format, ...) {}
655void bar() { foo<int>("%s\n", "foo"); }
656], [gold_cv_template_attribute=yes], [gold_cv_template_attribute=no])])
657if test "$gold_cv_template_attribute" = "yes"; then
658 AC_DEFINE(HAVE_TEMPLATE_ATTRIBUTES, 1,
659 [Define if attributes work on C++ templates])
660fi
661
5d329b7d
ILT
662dnl Check if the system has struct stat::st_mtim.
663AC_CACHE_CHECK([for struct stat::st_mtim.],
664[gold_cv_stat_st_mtim],
665[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
666#include <sys/stat.h>
667long bar() { struct stat s; return (long)(s.st_mtim.tv_sec + s.st_mtim.tv_sec);}
668]])], [gold_cv_stat_st_mtim=yes], [gold_cv_stat_st_mtim=no])])
669if test "$gold_cv_stat_st_mtim" = "yes"; then
670 AC_DEFINE(HAVE_STAT_ST_MTIM, 1,
671 [Define if struct stat has a field st_mtim with timespec for mtime])
672fi
673
54dc6425
ILT
674AC_LANG_POP(C++)
675
58797674 676AC_CHECK_HEADERS(locale.h)
44350750
NC
677AC_CHECK_FUNCS(setlocale)
678AM_LC_MESSAGES
679
bae7f79e
ILT
680AM_MAINTAINER_MODE
681
5a6f7e2d 682AC_OUTPUT(Makefile testsuite/Makefile po/Makefile.in:po/Make-in)
This page took 0.510738 seconds and 4 git commands to generate.