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