1dnl Process this file with autoconf to produce a configure script. 2dnl 3dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. 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. 9dnl 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. 14dnl 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 19 20AC_PREREQ(2.59) 21 22AC_INIT(gold, 0.1) 23AC_CONFIG_SRCDIR(gold.cc) 24 25AC_CANONICAL_TARGET 26 27AM_INIT_AUTOMAKE([no-dist parallel-tests]) 28 29AM_CONFIG_HEADER(config.h:config.in) 30 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). */ 35#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__) 36# error config.h must be #included before system headers 37#endif 38#define __CONFIG_H__ 1]) 39 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 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. 70 71installed_linker=ld.gold 72AC_ARG_ENABLE(gold, 73[[ --enable-gold[=ARG] build gold [ARG={default,yes,no}]]], 74[case "${enableval}" in 75 default) 76 install_as_default=yes 77 ;; 78 yes) 79 if test x${enable_ld} = xno; then 80 install_as_default=yes 81 fi 82 ;; 83 esac], 84[install_as_default=no]) 85AC_SUBST(install_as_default) 86AC_SUBST(installed_linker) 87 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") 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") 116 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 147AC_ARG_ENABLE([test-as-native], 148[ --enable-test-as-native test as though linker is native], 149[case "${enableval}" in 150 no) 151 test_as_native=no 152 ;; 153 *) 154 test_as_native=yes 155 ;; 156esac], 157[if test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias"; then 158 test_as_native=yes 159else 160 test_as_native=no 161fi]) 162 163 164# See which specific instantiations we need. 165targetobjs= 166all_targets= 167default_machine= 168default_size= 169default_big_endian= 170default_osabi=ELFOSABI_NONE 171targ_32_little= 172targ_32_big= 173targ_64_little= 174targ_64_big= 175for targ in $target $canon_targets; do 176 if test "$targ" = "all"; then 177 targ_32_little=yes 178 targ_32_big=yes 179 targ_64_little=yes 180 targ_64_big=yes 181 all_targets=yes 182 else 183 . ${srcdir}/configure.tgt 184 185 if test "$targ_obj" = "UNKNOWN"; then 186 AC_MSG_ERROR("unsupported target $targ") 187 else 188 targetobjs="$targetobjs ${targ_obj}.\$(OBJEXT)" 189 if test "$targ_extra_obj" != ""; then 190 targetobjs="$targetobjs ${targ_extra_obj}.\$(OBJEXT)" 191 fi 192 if test "$targ_size" = "32" -o "$targ_extra_size" = "32"; then 193 if test "$targ_big_endian" = "true" \ 194 -o "$targ_extra_big_endian" = "true"; then 195 targ_32_big=yes 196 fi 197 if test "$targ_big_endian" = "false" \ 198 -o "$targ_extra_big_endian" = "false"; then 199 targ_32_little=yes 200 fi 201 fi 202 if test "$targ_size" = "64" -o "$targ_extra_size" = "64"; then 203 if test "$targ_big_endian" = "true" \ 204 -o "$targ_extra_big_endian" = "true"; then 205 targ_64_big=yes 206 fi 207 if test "$targ_big_endian" = "false" \ 208 -o "$targ_extra_big_endian" = "false"; then 209 targ_64_little=yes 210 fi 211 fi 212 213 if test "$target" = "$targ"; then 214 default_machine=$targ_machine 215 default_size=$targ_size 216 default_big_endian=$targ_big_endian 217 default_osabi=$targ_osabi 218 219 AM_CONDITIONAL(DEFAULT_TARGET_AARCH64, test "$targ_obj" = "aarch64") 220 AM_CONDITIONAL(DEFAULT_TARGET_ARM, test "$targ_obj" = "arm") 221 AM_CONDITIONAL(DEFAULT_TARGET_I386, test "$targ_obj" = "i386") 222 AM_CONDITIONAL(DEFAULT_TARGET_POWERPC, test "$targ_obj" = "powerpc") 223 AM_CONDITIONAL(DEFAULT_TARGET_SPARC, test "$targ_obj" = "sparc") 224 target_x86_64=no 225 target_x32=no 226 if test "$targ_obj" = "x86_64"; then 227 case "$target" in 228 x86_64*-linux-gnux32) 229 target_x32=yes 230 default_size=32 231 ;; 232 *) 233 target_x86_64=yes 234 ;; 235 esac 236 fi 237 AM_CONDITIONAL(DEFAULT_TARGET_X86_64, test "$target_x86_64" = "yes") 238 AM_CONDITIONAL(DEFAULT_TARGET_X32, test "$target_x32" = "yes") 239 AM_CONDITIONAL(DEFAULT_TARGET_TILEGX, test "$targ_obj" = "tilegx") 240 AM_CONDITIONAL(DEFAULT_TARGET_MIPS, test "$targ_obj" = "mips") 241 DEFAULT_TARGET=${targ_obj} 242 AC_SUBST(DEFAULT_TARGET) 243 fi 244 fi 245 fi 246done 247 248# Remove any duplicates. 249to="" 250for t in $targetobjs; do 251 case " $to " in 252 *" $t "*) ;; 253 *) to="$to $t" ;; 254 esac 255done 256targetobjs=$to 257 258if test -n "$targ_32_little"; then 259 AC_DEFINE(HAVE_TARGET_32_LITTLE, 1, 260 [Define to support 32-bit little-endian targets]) 261fi 262if test -n "$targ_32_big"; then 263 AC_DEFINE(HAVE_TARGET_32_BIG, 1, 264 [Define to support 32-bit big-endian targets]) 265fi 266if test -n "$targ_64_little"; then 267 AC_DEFINE(HAVE_TARGET_64_LITTLE, 1, 268 [Define to support 64-bit little-endian targets]) 269fi 270if test -n "$targ_64_big"; then 271 AC_DEFINE(HAVE_TARGET_64_BIG, 1, 272 [Define to support 64-bit big-endian targets]) 273fi 274 275if test -n "$all_targets"; then 276 TARGETOBJS='$(ALL_TARGETOBJS)' 277else 278 TARGETOBJS="$targetobjs" 279fi 280AC_SUBST(TARGETOBJS) 281 282AC_DEFINE_UNQUOTED(GOLD_DEFAULT_MACHINE, $default_machine, 283 [Default machine code]) 284AC_DEFINE_UNQUOTED(GOLD_DEFAULT_SIZE, $default_size, 285 [Default size (32 or 64)]) 286AC_DEFINE_UNQUOTED(GOLD_DEFAULT_BIG_ENDIAN, $default_big_endian, 287 [Default big endian (true or false)]) 288AC_DEFINE_UNQUOTED(GOLD_DEFAULT_OSABI, $default_osabi, 289 [Default OSABI code]) 290 291AC_ARG_WITH(lib-path, 292[ --with-lib-path=dir1:dir2... set default LIB_PATH], 293[case "$withval" in 294 yes) LIB_PATH='"/lib:/usr/lib"' ;; 295 no) LIB_PATH='""' ;; 296 *) LIB_PATH='"'"$withval"'"' ;; 297 esac], 298[LIB_PATH='"::DEFAULT::"']) 299AC_DEFINE_UNQUOTED(LIB_PATH, $LIB_PATH, 300 [Default library search path]) 301if test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias"; then 302 AC_DEFINE(NATIVE_LINKER, 1, [Whether configured as a native linker]) 303fi 304 305AC_CHECK_TOOL(NM, nm) 306 307AC_PROG_CC 308AC_PROG_CXX 309AC_PROG_YACC 310AC_PROG_RANLIB 311AC_PROG_INSTALL 312AC_PROG_LN_S 313 314AC_GNU_SOURCE 315 316ZW_GNU_GETTEXT_SISTER_DIR 317AM_PO_SUBDIRS 318 319AC_C_BIGENDIAN 320 321AC_EXEEXT 322 323AM_CONDITIONAL(TEST_AS_NATIVE_LINKER, 324 test "x$test_as_native" = "xyes") 325AM_CONDITIONAL(GCC, test "$GCC" = yes) 326 327AM_CONDITIONAL(NATIVE_OR_CROSS_LINKER, 328 test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias" -o "x$host_alias" = "x$build_alias") 329 330dnl Test for whether static linking is supported. Some systems do not 331dnl install static libraries. This only affects the set of tests that 332dnl we run. 333AC_CACHE_CHECK([whether static linking works], [gold_cv_lib_static], 334[LDFLAGS_hold=$LDFLAGS 335LDFLAGS="$LDFLAGS -static" 336AC_LINK_IFELSE([ 337AC_LANG_PROGRAM([[void f() { }]])], 338[gold_cv_lib_static=yes], [gold_cv_lib_static=no]) 339LDFLAGS=$LDFLAGS_hold]) 340AM_CONDITIONAL(HAVE_STATIC, test "$gold_cv_lib_static" = "yes") 341 342dnl Some architectures do not support taking pointers of functions 343dnl defined in shared libraries except in -fPIC mode. We need to 344dnl tell the unittest framework if we're compiling for one of those 345dnl targets, so it doesn't try to run the tests that do that. 346AM_CONDITIONAL(FN_PTRS_IN_SO_WITHOUT_PIC, [ 347 case $target_cpu in 348 powerpc*) false;; 349 x86_64) false;; 350 sparc64) false;; 351 *) true;; 352 esac]) 353 354dnl Test for gcc 4.1 or later. Full support for -mcmodel=medium is 355dnl only available in gcc 4.1. 356AC_CACHE_CHECK([for gcc >= 4.1], [gold_cv_prog_gcc41], 357[AC_COMPILE_IFELSE([ 358#if !defined __GNUC__ 359error 360#elif __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) 361error 362#endif 363], [gold_cv_prog_gcc41=yes], [gold_cv_prog_gcc41=no])]) 364 365save_CFLAGS="$CFLAGS" 366CFLAGS="$CFLAGS -mcmodel=medium" 367AC_COMPILE_IFELSE([int i;], [have_mcmodel_medium=yes], [have_mcmodel_medium=no]) 368CFLAGS="$save_CFLAGS" 369dnl Whether we can test -mcmodel=medium. 370AM_CONDITIONAL(MCMODEL_MEDIUM, 371[test "$target_cpu" = "x86_64" -a "$have_mcmodel_medium" = "yes" -a "$gold_cv_prog_gcc41" = "yes"]) 372 373AC_CACHE_CHECK([whether $CC supports -fmerge-constants], 374 [gold_cv_merge_constants], [ 375save_CFLAGS="$CFLAGS" 376CFLAGS="$CFLAGS -fmerge-constants" 377AC_COMPILE_IFELSE([const char *s = "foo";], 378 [gold_cv_merge_constants=yes], 379 [gold_cv_merge_constants=no]) 380CFLAGS="$save_CFLAGS"]) 381AC_SUBST([MERGE_CONSTANTS_FLAG]) 382AS_IF([test "$gold_cv_merge_constants" = yes], 383 [MERGE_CONSTANTS_FLAG=-fmerge-constants], 384 [MERGE_CONSTANTS_FLAG=]) 385 386dnl Test for __thread support. 387AC_CACHE_CHECK([for thread support], [gold_cv_c_thread], 388[AC_COMPILE_IFELSE([__thread int i = 1;], 389[gold_cv_c_thread=yes], [gold_cv_c_thread=no])]) 390 391AM_CONDITIONAL(TLS, test "$gold_cv_c_thread" = "yes") 392 393dnl On GNU/Linux TLS in static programs only works when using glibc 394dnl 2.4 or later. 395AC_CACHE_CHECK([for glibc >= 2.4], [gold_cv_lib_glibc24], 396[AC_COMPILE_IFELSE([ 397#include <features.h> 398#if !defined __GLIBC__ 399error 400#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4) 401error 402#endif 403], [gold_cv_lib_glibc24=yes], [gold_cv_lib_glibc24=no])]) 404 405AM_CONDITIONAL(STATIC_TLS, test "$gold_cv_lib_glibc24" = "yes") 406 407dnl Test for #pragma omp threadprivate 408AC_CACHE_CHECK([for omp support], [gold_cv_c_threadprivate], 409[save_CFLAGS="$CFLAGS" 410CFLAGS="$CFLAGS -fopenmp" 411AC_COMPILE_IFELSE([ 412#include <omp.h> 413int i; 414#pragma omp threadprivate (i) 415], [gold_cv_c_threadprivate=yes], [gold_cv_c_threadprivate=no]) 416CFLAGS="$save_CFLAGS"]) 417if test "$gold_cv_c_threadprivate" = "yes"; then 418 AC_DEFINE(HAVE_OMP_SUPPORT, 1, 419 [Define if compiler supports #pragma omp threadprivate]) 420fi 421AM_CONDITIONAL(OMP_SUPPORT, test "$gold_cv_c_threadprivate" = "yes") 422 423dnl Test for the -ftls-dialect=gnu2 option. 424dnl Use -Werror in case of compilers that make unknown -m options warnings. 425dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS 426dnl gets set later by default Autoconf magic to include -Werror. (We are 427dnl assuming here that there is no compiler that groks -mtls-dialect=gnu2 428dnl but does not grok -Werror.) 429save_CFLAGS="$CFLAGS" 430CFLAGS="$CFLAGS -Werror -fpic -mtls-dialect=gnu2" 431AC_COMPILE_IFELSE([ 432__thread int i; 433void foo (void) 434{ 435 i = 10; 436} 437], [have_tls_gnu2=yes], [have_tls_gnu2=no]) 438CFLAGS="$save_CFLAGS" 439AM_CONDITIONAL(TLS_GNU2_DIALECT, test "$have_tls_gnu2" = "yes") 440 441dnl On GNU/Linux TLS descriptors are supported by the dynamic loader 442dnl only with glibc 2.9 or later. 443AC_CACHE_CHECK([for glibc >= 2.9], [gold_cv_lib_glibc29], 444[AC_COMPILE_IFELSE([ 445#include <features.h> 446#if !defined __GLIBC__ 447error 448#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 9) 449error 450#endif 451], [gold_cv_lib_glibc29=yes], [gold_cv_lib_glibc29=no])]) 452 453AM_CONDITIONAL(TLS_DESCRIPTORS, test "$gold_cv_lib_glibc29" = "yes") 454 455dnl Test for the -frandom-seed option. 456AC_CACHE_CHECK([for -frandom-seed support], [gold_cv_c_random_seed], 457[save_CFLAGS="$CFLAGS" 458CFLAGS="$CFLAGS -frandom-seed=foo" 459AC_COMPILE_IFELSE([int i;], [gold_cv_c_random_seed=yes], 460[gold_cv_c_random_seed=no]) 461CFLAGS="$save_CFLAGS"]) 462if test "$gold_cv_c_random_seed" = "yes"; then 463 # In Makefile, '$@' will be expanded to be the name of the file 464 # being built, providing a unique seed for each file. 465 RANDOM_SEED_CFLAGS=-frandom-seed=\$@ 466fi 467AC_SUBST(RANDOM_SEED_CFLAGS) 468 469dnl On GNU/Linux ifunc is supported by the dynamic linker in glibc 470dnl 2.11 or later, and by binutils 2.20.1 or later. 471AC_CACHE_CHECK([for glibc ifunc support], [gold_cv_lib_glibc_ifunc], 472[save_LDFLAGS="$LDFLAGS" 473LDFLAGS="$LDFLAGS -static" 474AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 475#include <features.h> 476#if !defined __GLIBC__ 477error 478#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 11) 479error 480#endif 481void func (void) { } 482void invoke (void); 483__asm__(".type invoke, %gnu_indirect_function"); 484typedef void (*funcptr) (void); 485funcptr dispatch (void) __asm__ ("invoke"); 486funcptr dispatch (void) { return &func; }]], 487[[invoke();]]) 488], [ 489if ${NM} conftest$EXEEXT | grep "__rela\?_iplt_start" >/dev/null 2>&1; then 490 gold_cv_lib_glibc_ifunc=both 491else 492 gold_cv_lib_glibc_ifunc=dyn 493fi], [gold_cv_lib_glibc_ifunc=no]) 494LDFLAGS="$save_LDFLAGS"]) 495 496AM_CONDITIONAL(IFUNC, test "$gold_cv_lib_glibc_ifunc" != "no") 497AM_CONDITIONAL(IFUNC_STATIC, test "$gold_cv_lib_glibc_ifunc" = "both") 498 499AM_BINUTILS_WARNINGS 500 501WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'` 502AC_SUBST(WARN_CXXFLAGS) 503 504AC_ARG_WITH(gold-ldflags, 505[ --with-gold-ldflags=FLAGS additional link flags for gold], 506[if test "$withval" = "no" -o "$withval" = "yes"; then 507 GOLD_LDFLAGS= 508 else 509 GOLD_LDFLAGS=$withval 510 fi], 511[GOLD_LDFLAGS=]) 512AC_SUBST(GOLD_LDFLAGS) 513 514AC_ARG_WITH(gold-ldadd, 515[ --with-gold-ldadd=LIBS additional libraries for gold], 516[if test "$withval" = "no" -o "$withval" = "yes"; then 517 GOLD_LDADD= 518 else 519 GOLD_LDADD=$withval 520 fi], 521[GOLD_LDADD=]) 522AC_SUBST(GOLD_LDADD) 523 524dnl Force support for large files by default. This may need to be 525dnl host dependent. If build == host, we can check getconf LFS_CFLAGS. 526LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" 527AC_SUBST(LFS_CFLAGS) 528 529AC_CHECK_HEADERS(sys/mman.h) 530AC_CHECK_FUNCS(chsize mmap) 531AC_REPLACE_FUNCS(pread ftruncate ffsll) 532 533AC_CACHE_CHECK([mremap with MREMAP_MAYMOVE], [gold_cv_lib_mremap_maymove], 534[AC_LINK_IFELSE([ 535AC_LANG_PROGRAM([[ 536#include <sys/mman.h> 537void f() { mremap (0, 0, 0, MREMAP_MAYMOVE); } 538]])], [gold_cv_lib_mremap_maymove=yes], [gold_cv_lib_mremap_maymove=no])]) 539if test "$gold_cv_lib_mremap_maymove" = "yes"; then 540 AC_DEFINE(HAVE_MREMAP, 1, 541 [Define to 1 if you have the mremap function with MREMAP_MAYMOVE support]) 542else 543 AC_LIBOBJ(mremap) 544fi 545 546# Link in zlib if we can. This allows us to write compressed sections. 547AM_ZLIB 548AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_header_zlib_h" = "yes") 549 550dnl We have to check these in C, not C++, because autoconf generates 551dnl tests which have no type information, and current glibc provides 552dnl multiple declarations of functions like basename when compiling 553dnl with C++. 554AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp]) 555 556dnl Check if gcc supports the -gpubnames option. 557dnl Use -Werror in case of compilers that make unknown -g options warnings. 558dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS 559dnl gets set later by default Autoconf magic to include -Werror. (We are 560dnl assuming here that there is no compiler that groks -gpubnames 561dnl but does not grok -Werror.) 562save_CFLAGS="$CFLAGS" 563CFLAGS="$CFLAGS -Werror -gpubnames" 564AC_COMPILE_IFELSE([int i;], [have_pubnames=yes], [have_pubnames=no]) 565CFLAGS="$save_CFLAGS" 566AM_CONDITIONAL(HAVE_PUBNAMES, test "$have_pubnames" = "yes") 567 568dnl Check if gcc supports the -fno-use-linker-plugin option. 569save_CFLAGS="$CFLAGS" 570CFLAGS="$CFLAGS -Werror -fno-use-linker-plugin" 571AC_COMPILE_IFELSE([int i;], [have_no_use_linker_plugin=yes], [have_no_use_linker_plugin=no]) 572CFLAGS="$save_CFLAGS" 573AM_CONDITIONAL(HAVE_NO_USE_LINKER_PLUGIN, test "$have_no_use_linker_plugin" = "yes") 574 575AC_LANG_PUSH(C++) 576 577AC_CHECK_HEADERS(unordered_set unordered_map) 578AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map) 579AC_CHECK_HEADERS(ext/hash_map ext/hash_set) 580AC_CHECK_HEADERS(byteswap.h) 581 582dnl When plugins enabled dynamic loader interface is required. Check headers 583dnl which may provide this interface. Add the necessary library to link. 584AC_CHECK_HEADERS(windows.h) 585AC_CHECK_HEADERS(dlfcn.h) 586AC_SEARCH_LIBS(dlopen, [dl dld]) 587case "$ac_cv_search_dlopen" in 588 no*) DLOPEN_LIBS="";; 589 *) DLOPEN_LIBS="$ac_cv_search_dlopen";; 590esac 591AC_SUBST(DLOPEN_LIBS) 592 593AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times) 594AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp, strndup, memmem]) 595 596# Use of ::std::tr1::unordered_map::rehash causes undefined symbols 597# at link time with some versions of GCC. 598AC_CACHE_CHECK([whether ::std::tr1::unordered_map::rehash is usable.], 599[gold_cv_unordered_map_rehash], 600[AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 601#include <tr1/unordered_map> 602void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); } 603]])], [gold_cv_unordered_map_rehash=yes], [gold_cv_unordered_map_rehash=no])]) 604if test "$gold_cv_unordered_map_rehash" = "yes"; then 605 AC_DEFINE(HAVE_TR1_UNORDERED_MAP_REHASH, 1, 606 [Define if ::std::tr1::unordered_map::rehash is usable]) 607fi 608 609# Use of tr1/unordered_map with off_t as a key is not supported on GCC 610# 4.1.xx when compiling in 32-bit mode with a 64-bit off_t type. 611AC_CACHE_CHECK([whether std::tr1::hash<off_t> is defined], 612[gold_cv_hash_off_t], 613[CXXFLAGS_hold=$CXXFLAGS 614CXXFLAGS="$CXXFLAGS $LFS_CFLAGS" 615AC_COMPILE_IFELSE([ 616#include <sys/types.h> 617#include <tr1/unordered_map> 618std::tr1::hash<off_t> h; 619], 620[gold_cv_hash_off_t=yes], 621[gold_cv_hash_off_t=no]) 622CXXFLAGS=$CXXFLAGS_hold]) 623if test "$gold_cv_hash_off_t" = "yes"; then 624 AC_DEFINE(HAVE_TR1_HASH_OFF_T, 1, 625 [Define if std::tr1::hash<off_t> is usable]) 626fi 627 628# gcc 4.3.0 doesn't recognize the printf attribute on a template 629# function. Check for that. This is gcc bug 35546. This test can 630# probably be removed after the bug has been fixed for a while. 631AC_CACHE_CHECK([whether we can use attributes with template functions], 632[gold_cv_template_attribute], 633[AC_COMPILE_IFELSE([ 634template<typename T> extern void foo(const char*, ...) 635 __attribute__ ((__format__ (__printf__, 1, 2))); 636template<typename T> void foo(const char* format, ...) {} 637void bar() { foo<int>("%s\n", "foo"); } 638], [gold_cv_template_attribute=yes], [gold_cv_template_attribute=no])]) 639if test "$gold_cv_template_attribute" = "yes"; then 640 AC_DEFINE(HAVE_TEMPLATE_ATTRIBUTES, 1, 641 [Define if attributes work on C++ templates]) 642fi 643 644dnl Check if the system has struct stat::st_mtim. 645AC_CACHE_CHECK([for struct stat::st_mtim.], 646[gold_cv_stat_st_mtim], 647[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 648#include <sys/stat.h> 649long bar() { struct stat s; return (long)(s.st_mtim.tv_sec + s.st_mtim.tv_sec);} 650]])], [gold_cv_stat_st_mtim=yes], [gold_cv_stat_st_mtim=no])]) 651if test "$gold_cv_stat_st_mtim" = "yes"; then 652 AC_DEFINE(HAVE_STAT_ST_MTIM, 1, 653 [Define if struct stat has a field st_mtim with timespec for mtime]) 654fi 655 656AC_LANG_POP(C++) 657 658AC_CHECK_HEADERS(locale.h) 659AC_CHECK_FUNCS(setlocale) 660AM_LC_MESSAGES 661 662AM_MAINTAINER_MODE 663 664AC_OUTPUT(Makefile testsuite/Makefile po/Makefile.in:po/Make-in) 665