1 dnl Process this file with autoconf to produce a configure script.
3 dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
5 dnl This file is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; see the file COPYING3. If not see
17 dnl <http://www.gnu.org/licenses/>.
23 AC_CONFIG_SRCDIR(gold.cc)
27 AM_INIT_AUTOMAKE([no-dist parallel-tests])
29 AM_CONFIG_HEADER(config.h:config.in)
31 AC_USE_SYSTEM_EXTENSIONS
34 AH_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). */
37 #if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
38 # error config.h must be #included before system headers
40 #define __CONFIG_H__ 1])
43 [ --with-sysroot[=DIR] search for usr/lib et al within DIR],
44 [sysroot=$withval], [sysroot=no])
46 if test "$sysroot" = "yes"; then
47 sysroot='${exec_prefix}/${target_alias}/sys-root'
48 elif test "$sysroot" = "no"; then
53 if test -n "$sysroot"; then
55 "${prefix}" | "${prefix}/"* | \
56 "${exec_prefix}" | "${exec_prefix}/"* | \
57 '${prefix}' | '${prefix}/'*| \
58 '${exec_prefix}' | '${exec_prefix}/'*)
64 AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot",
65 [System root for target files])
66 AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT_RELOCATABLE, $sysroot_relocatable,
67 [Whether the system root can be relocated])
69 dnl "install_as_default" is true if the linker to be installed as the
70 dnl default linker, ld.
71 dnl "installed_linker" is the installed gold linker name.
73 installed_linker=ld.gold
75 [[ --enable-gold[=ARG] build gold [ARG={default,yes,no}]]],
76 [case "${enableval}" in
78 install_as_default=yes
81 if test x${enable_ld} = xno; then
82 install_as_default=yes
86 [install_as_default=no])
87 AC_SUBST(install_as_default)
88 AC_SUBST(installed_linker)
90 dnl For now threads are a configure time option.
91 AC_ARG_ENABLE([threads],
92 [ --enable-threads multi-threaded linking],
93 [case "${enableval}" in
94 yes | "") threads=yes ;;
99 if test "$threads" = "yes"; then
100 AC_DEFINE(ENABLE_THREADS, 1,
101 [Define to do multi-threaded linking])
103 AM_CONDITIONAL(THREADS, test "$threads" = "yes")
106 if test "$plugins" = "yes"; then
107 AC_DEFINE(ENABLE_PLUGINS, 1,
108 [Define to enable linker plugins])
110 AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
112 # Decide if -z relro should be enabled in ELF linker by default.
113 ac_default_ld_z_relro=unset
114 # Provide a configure time option to override our default.
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 ;;
122 if test "${ac_default_ld_z_relro}" = unset; then
123 ac_default_ld_z_relro=1
125 AC_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.])
129 AC_ARG_ENABLE([targets],
130 [ --enable-targets alternative target configurations],
131 [case "${enableval}" in
133 AC_MSG_ERROR([--enable-targets option must specify target names or 'all'])
139 enable_targets=$enableval
142 [# For now, enable all targets by default
146 # Canonicalize the enabled targets.
147 if 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"
153 # Permit unrecognized target names, like "all".
154 canon_targets="$canon_targets $targ"
159 # Decide which "--hash-style" to use by default
160 # Provide a configure time option to override our default.
161 AC_ARG_ENABLE([default-hash-style],
162 AS_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]) ;;
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 ;;
175 AC_DEFINE_UNQUOTED([DEFAULT_HASH_STYLE],
176 ["${enable_default_hash_style}"],
177 [Set the default --hash-style value])
179 # See which specific instantiations we need.
185 default_osabi=ELFOSABI_NONE
190 for targ in $target $canon_targets; do
191 if test "$targ" = "all"; then
198 . ${srcdir}/configure.tgt
200 if test "$targ_obj" = "UNKNOWN"; then
201 AC_MSG_ERROR("unsupported target $targ")
203 targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)"
204 if test "$targ_extra_obj" != ""; then
205 targetobjs="$targetobjs ${targ_extra_obj}.\$(OBJEXT)"
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
212 if test "$targ_big_endian" = "false" \
213 -o "$targ_extra_big_endian" = "false"; then
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
222 if test "$targ_big_endian" = "false" \
223 -o "$targ_extra_big_endian" = "false"; then
228 if test "$target" = "$targ"; then
229 default_machine=$targ_machine
230 default_size=$targ_size
231 default_big_endian=$targ_big_endian
232 default_osabi=$targ_osabi
234 AM_CONDITIONAL(DEFAULT_TARGET_AARCH64, test "$targ_obj" = "aarch64")
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")
239 AM_CONDITIONAL(DEFAULT_TARGET_S390, test "$targ_obj" = "s390")
242 if test "$targ_obj" = "x86_64"; then
244 x86_64*-linux-gnux32)
253 AM_CONDITIONAL(DEFAULT_TARGET_X86_64, test "$target_x86_64" = "yes")
254 AM_CONDITIONAL(DEFAULT_TARGET_X32, test "$target_x32" = "yes")
255 AM_CONDITIONAL(DEFAULT_TARGET_X86_64_OR_X32,
256 test "$target_x86_64" = "yes" -o "$target_x32" = "yes")
257 AM_CONDITIONAL(DEFAULT_TARGET_TILEGX, test "$targ_obj" = "tilegx")
258 AM_CONDITIONAL(DEFAULT_TARGET_MIPS, test "$targ_obj" = "mips")
259 DEFAULT_TARGET=${targ_obj}
260 AC_SUBST(DEFAULT_TARGET)
266 # Remove any duplicates.
268 for t in $targetobjs; do
276 if test -n "$targ_32_little"; then
277 AC_DEFINE(HAVE_TARGET_32_LITTLE, 1,
278 [Define to support 32-bit little-endian targets])
280 if test -n "$targ_32_big"; then
281 AC_DEFINE(HAVE_TARGET_32_BIG, 1,
282 [Define to support 32-bit big-endian targets])
284 if test -n "$targ_64_little"; then
285 AC_DEFINE(HAVE_TARGET_64_LITTLE, 1,
286 [Define to support 64-bit little-endian targets])
288 if test -n "$targ_64_big"; then
289 AC_DEFINE(HAVE_TARGET_64_BIG, 1,
290 [Define to support 64-bit big-endian targets])
293 if test -n "$all_targets"; then
294 TARGETOBJS='$(ALL_TARGETOBJS)'
296 TARGETOBJS="$targetobjs"
300 AC_DEFINE_UNQUOTED(GOLD_DEFAULT_MACHINE, $default_machine,
301 [Default machine code])
302 AC_DEFINE_UNQUOTED(GOLD_DEFAULT_SIZE, $default_size,
303 [Default size (32 or 64)])
304 AC_DEFINE_UNQUOTED(GOLD_DEFAULT_BIG_ENDIAN, $default_big_endian,
305 [Default big endian (true or false)])
306 AC_DEFINE_UNQUOTED(GOLD_DEFAULT_OSABI, $default_osabi,
307 [Default OSABI code])
309 AC_ARG_WITH(lib-path,
310 [ --with-lib-path=dir1:dir2... set default LIB_PATH],
312 yes) LIB_PATH='"/lib:/usr/lib"' ;;
314 *) LIB_PATH='"'"$withval"'"' ;;
316 [LIB_PATH='"::DEFAULT::"'])
317 AC_DEFINE_UNQUOTED(LIB_PATH, $LIB_PATH,
318 [Default library search path])
319 if 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])
323 AC_CHECK_TOOL(NM, nm)
334 ZW_GNU_GETTEXT_SISTER_DIR
341 AM_CONDITIONAL(NATIVE_LINKER,
342 test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias")
343 AM_CONDITIONAL(GCC, test "$GCC" = yes)
345 AM_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")
348 dnl Test for whether static linking is supported. Some systems do not
349 dnl install static libraries. This only affects the set of tests that
351 AC_CACHE_CHECK([whether static linking works], [gold_cv_lib_static],
352 [LDFLAGS_hold=$LDFLAGS
353 LDFLAGS="$LDFLAGS -static"
355 AC_LANG_PROGRAM([[void f() { }]])],
356 [gold_cv_lib_static=yes], [gold_cv_lib_static=no])
357 LDFLAGS=$LDFLAGS_hold])
358 AM_CONDITIONAL(HAVE_STATIC, test "$gold_cv_lib_static" = "yes")
360 dnl Some architectures do not support taking pointers of functions
361 dnl defined in shared libraries except in -fPIC mode. We need to
362 dnl tell the unittest framework if we're compiling for one of those
363 dnl targets, so it doesn't try to run the tests that do that.
364 AM_CONDITIONAL(FN_PTRS_IN_SO_WITHOUT_PIC, [
373 dnl Test for gcc 4.1 or later. Full support for -mcmodel=medium is
374 dnl only available in gcc 4.1.
375 AC_CACHE_CHECK([for gcc >= 4.1], [gold_cv_prog_gcc41],
377 #if !defined __GNUC__
379 #elif __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
382 ], [gold_cv_prog_gcc41=yes], [gold_cv_prog_gcc41=no])])
384 save_CFLAGS="$CFLAGS"
385 CFLAGS="$CFLAGS -mcmodel=medium"
386 AC_COMPILE_IFELSE([int i;], [have_mcmodel_medium=yes], [have_mcmodel_medium=no])
387 CFLAGS="$save_CFLAGS"
388 dnl Whether we can test -mcmodel=medium.
389 AM_CONDITIONAL(MCMODEL_MEDIUM,
390 [test "$target_cpu" = "x86_64" -a "$have_mcmodel_medium" = "yes" -a "$gold_cv_prog_gcc41" = "yes"])
392 AC_CACHE_CHECK([whether $CC supports -fmerge-constants],
393 [gold_cv_merge_constants], [
394 save_CFLAGS="$CFLAGS"
395 CFLAGS="$CFLAGS -fmerge-constants"
396 AC_COMPILE_IFELSE([const char *s = "foo";],
397 [gold_cv_merge_constants=yes],
398 [gold_cv_merge_constants=no])
399 CFLAGS="$save_CFLAGS"])
400 AC_SUBST([MERGE_CONSTANTS_FLAG])
401 AS_IF([test "$gold_cv_merge_constants" = yes],
402 [MERGE_CONSTANTS_FLAG=-fmerge-constants],
403 [MERGE_CONSTANTS_FLAG=])
405 dnl Test for __thread support.
406 AC_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])])
410 AM_CONDITIONAL(TLS, test "$gold_cv_c_thread" = "yes")
412 dnl On GNU/Linux TLS in static programs only works when using glibc
414 AC_CACHE_CHECK([for glibc >= 2.4], [gold_cv_lib_glibc24],
416 #include <features.h>
417 #if !defined __GLIBC__
419 #elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4)
422 ], [gold_cv_lib_glibc24=yes], [gold_cv_lib_glibc24=no])])
424 AM_CONDITIONAL(STATIC_TLS, test "$gold_cv_lib_glibc24" = "yes")
426 dnl Test for #pragma omp threadprivate
427 AC_CACHE_CHECK([for omp support], [gold_cv_c_threadprivate],
428 [save_CFLAGS="$CFLAGS"
429 CFLAGS="$CFLAGS -fopenmp"
433 #pragma omp threadprivate (i)
434 ], [gold_cv_c_threadprivate=yes], [gold_cv_c_threadprivate=no])
435 CFLAGS="$save_CFLAGS"])
436 if test "$gold_cv_c_threadprivate" = "yes"; then
437 AC_DEFINE(HAVE_OMP_SUPPORT, 1,
438 [Define if compiler supports #pragma omp threadprivate])
440 AM_CONDITIONAL(OMP_SUPPORT, test "$gold_cv_c_threadprivate" = "yes")
442 dnl Test for the -ftls-dialect=gnu2 option.
443 dnl Use -Werror in case of compilers that make unknown -m options warnings.
444 dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS
445 dnl gets set later by default Autoconf magic to include -Werror. (We are
446 dnl assuming here that there is no compiler that groks -mtls-dialect=gnu2
447 dnl but does not grok -Werror.)
448 save_CFLAGS="$CFLAGS"
449 CFLAGS="$CFLAGS -Werror -fpic -mtls-dialect=gnu2"
456 ], [have_tls_gnu2=yes], [have_tls_gnu2=no])
457 CFLAGS="$save_CFLAGS"
458 AM_CONDITIONAL(TLS_GNU2_DIALECT, test "$have_tls_gnu2" = "yes")
460 dnl On GNU/Linux TLS descriptors are supported by the dynamic loader
461 dnl only with glibc 2.9 or later.
462 AC_CACHE_CHECK([for glibc >= 2.9], [gold_cv_lib_glibc29],
464 #include <features.h>
465 #if !defined __GLIBC__
467 #elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 9)
470 ], [gold_cv_lib_glibc29=yes], [gold_cv_lib_glibc29=no])])
472 AM_CONDITIONAL(TLS_DESCRIPTORS, test "$gold_cv_lib_glibc29" = "yes")
474 dnl Test for the -frandom-seed option.
475 AC_CACHE_CHECK([for -frandom-seed support], [gold_cv_c_random_seed],
476 [save_CFLAGS="$CFLAGS"
477 CFLAGS="$CFLAGS -frandom-seed=foo"
478 AC_COMPILE_IFELSE([int i;], [gold_cv_c_random_seed=yes],
479 [gold_cv_c_random_seed=no])
480 CFLAGS="$save_CFLAGS"])
481 if 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=\$@
486 AC_SUBST(RANDOM_SEED_CFLAGS)
488 dnl On GNU/Linux ifunc is supported by the dynamic linker in glibc
489 dnl 2.11 or later, and by binutils 2.20.1 or later.
490 AC_CACHE_CHECK([for glibc ifunc support], [gold_cv_lib_glibc_ifunc],
491 [save_LDFLAGS="$LDFLAGS"
492 LDFLAGS="$LDFLAGS -static"
493 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
494 #include <features.h>
495 #if !defined __GLIBC__
497 #elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 11)
502 __asm__(".type invoke, %gnu_indirect_function");
503 typedef void (*funcptr) (void);
504 funcptr dispatch (void) __asm__ ("invoke");
505 funcptr dispatch (void) { return &func; }]],
508 if ${NM} conftest$EXEEXT | grep "__rela\?_iplt_start" >/dev/null 2>&1; then
509 gold_cv_lib_glibc_ifunc=both
511 gold_cv_lib_glibc_ifunc=dyn
512 fi], [gold_cv_lib_glibc_ifunc=no])
513 LDFLAGS="$save_LDFLAGS"])
515 AM_CONDITIONAL(IFUNC, test "$gold_cv_lib_glibc_ifunc" != "no")
516 AM_CONDITIONAL(IFUNC_STATIC, test "$gold_cv_lib_glibc_ifunc" = "both")
520 WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'`
521 AC_SUBST(WARN_CXXFLAGS)
523 AC_ARG_WITH(gold-ldflags,
524 [ --with-gold-ldflags=FLAGS additional link flags for gold],
525 [if test "$withval" = "no" -o "$withval" = "yes"; then
528 GOLD_LDFLAGS=$withval
531 AC_SUBST(GOLD_LDFLAGS)
533 AC_ARG_WITH(gold-ldadd,
534 [ --with-gold-ldadd=LIBS additional libraries for gold],
535 [if test "$withval" = "no" -o "$withval" = "yes"; then
543 dnl Force support for large files by default. This may need to be
544 dnl host dependent. If build == host, we can check getconf LFS_CFLAGS.
545 LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
548 AC_CHECK_HEADERS(sys/mman.h)
549 AC_CHECK_FUNCS(chsize mmap)
550 AC_REPLACE_FUNCS(pread ftruncate ffsll)
552 AC_CACHE_CHECK([mremap with MREMAP_MAYMOVE], [gold_cv_lib_mremap_maymove],
555 #include <sys/mman.h>
556 void f() { mremap (0, 0, 0, MREMAP_MAYMOVE); }
557 ]])], [gold_cv_lib_mremap_maymove=yes], [gold_cv_lib_mremap_maymove=no])])
558 if 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])
565 # Link in zlib if we can. This allows us to write compressed sections.
568 dnl We have to check these in C, not C++, because autoconf generates
569 dnl tests which have no type information, and current glibc provides
570 dnl multiple declarations of functions like basename when compiling
572 AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])
574 dnl Check if gcc supports the -gpubnames option.
575 dnl Use -Werror in case of compilers that make unknown -g options warnings.
576 dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS
577 dnl gets set later by default Autoconf magic to include -Werror. (We are
578 dnl assuming here that there is no compiler that groks -gpubnames
579 dnl but does not grok -Werror.)
580 save_CFLAGS="$CFLAGS"
581 CFLAGS="$CFLAGS -Werror -gpubnames"
582 AC_COMPILE_IFELSE([int i;], [have_pubnames=yes], [have_pubnames=no])
583 CFLAGS="$save_CFLAGS"
584 AM_CONDITIONAL(HAVE_PUBNAMES, test "$have_pubnames" = "yes")
586 dnl Check if gcc supports the -fno-use-linker-plugin option.
587 save_CFLAGS="$CFLAGS"
588 CFLAGS="$CFLAGS -Werror -fno-use-linker-plugin"
589 AC_COMPILE_IFELSE([int i;], [have_no_use_linker_plugin=yes], [have_no_use_linker_plugin=no])
590 CFLAGS="$save_CFLAGS"
591 AM_CONDITIONAL(HAVE_NO_USE_LINKER_PLUGIN, test "$have_no_use_linker_plugin" = "yes")
595 AC_CHECK_HEADERS(unordered_set unordered_map)
596 AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map)
597 AC_CHECK_HEADERS(ext/hash_map ext/hash_set)
598 AC_CHECK_HEADERS(byteswap.h)
600 dnl When plugins enabled dynamic loader interface is required. Check headers
601 dnl which may provide this interface. Add the necessary library to link.
602 AC_CHECK_HEADERS(windows.h)
603 AC_CHECK_HEADERS(dlfcn.h)
604 AC_SEARCH_LIBS(dlopen, [dl dld])
605 case "$ac_cv_search_dlopen" in
606 no*) DLOPEN_LIBS="";;
607 *) DLOPEN_LIBS="$ac_cv_search_dlopen";;
609 AC_SUBST(DLOPEN_LIBS)
611 AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times)
612 AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem])
614 # Use of ::std::tr1::unordered_map::rehash causes undefined symbols
615 # at link time with some versions of GCC.
616 AC_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>
620 void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); }
621 ]])], [gold_cv_unordered_map_rehash=yes], [gold_cv_unordered_map_rehash=no])])
622 if 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])
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.
629 AC_CACHE_CHECK([whether std::tr1::hash<off_t> is defined],
630 [gold_cv_hash_off_t],
631 [CXXFLAGS_hold=$CXXFLAGS
632 CXXFLAGS="$CXXFLAGS $LFS_CFLAGS"
634 #include <sys/types.h>
635 #include <tr1/unordered_map>
636 std::tr1::hash<off_t> h;
638 [gold_cv_hash_off_t=yes],
639 [gold_cv_hash_off_t=no])
640 CXXFLAGS=$CXXFLAGS_hold])
641 if 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])
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.
649 AC_CACHE_CHECK([whether we can use attributes with template functions],
650 [gold_cv_template_attribute],
652 template<typename T> extern void foo(const char*, ...)
653 __attribute__ ((__format__ (__printf__, 1, 2)));
654 template<typename T> void foo(const char* format, ...) {}
655 void bar() { foo<int>("%s\n", "foo"); }
656 ], [gold_cv_template_attribute=yes], [gold_cv_template_attribute=no])])
657 if test "$gold_cv_template_attribute" = "yes"; then
658 AC_DEFINE(HAVE_TEMPLATE_ATTRIBUTES, 1,
659 [Define if attributes work on C++ templates])
662 dnl Check if the system has struct stat::st_mtim.
663 AC_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>
667 long 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])])
669 if 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])
676 AC_CHECK_HEADERS(locale.h)
677 AC_CHECK_FUNCS(setlocale)
682 AC_OUTPUT(Makefile testsuite/Makefile po/Makefile.in:po/Make-in)