1 dnl Process this file with autoconf to produce a configure script. 2 dnl 3 dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. 4 dnl 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. 9 dnl 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. 14 dnl 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/>. 18 dnl 19 20 AC_PREREQ(2.59) 21 22 AC_INIT(gold, 0.1) 23 AC_CONFIG_SRCDIR(gold.cc) 24 25 AC_CANONICAL_TARGET 26 27 AM_INIT_AUTOMAKE([no-dist parallel-tests]) 28 29 AM_CONFIG_HEADER(config.h:config.in) 30 31 # PR 14072 32 AH_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 40 AC_ARG_WITH(sysroot, 41 [ --with-sysroot[=DIR] search for usr/lib et al within DIR], 42 [sysroot=$withval], [sysroot=no]) 43 44 if test "$sysroot" = "yes"; then 45 sysroot='${exec_prefix}/${target_alias}/sys-root' 46 elif test "$sysroot" = "no"; then 47 sysroot= 48 fi 49 50 sysroot_relocatable=0 51 if 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 60 fi 61 62 AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT, "$sysroot", 63 [System root for target files]) 64 AC_DEFINE_UNQUOTED(TARGET_SYSTEM_ROOT_RELOCATABLE, $sysroot_relocatable, 65 [Whether the system root can be relocated]) 66 67 dnl "install_as_default" is true if the linker to be installed as the 68 dnl default linker, ld. 69 dnl "installed_linker" is the installed gold linker name. 70 71 installed_linker=ld.gold 72 AC_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]) 85 AC_SUBST(install_as_default) 86 AC_SUBST(installed_linker) 87 88 dnl For now threads are a configure time option. 89 AC_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]) 97 if test "$threads" = "yes"; then 98 AC_DEFINE(ENABLE_THREADS, 1, 99 [Define to do multi-threaded linking]) 100 fi 101 AM_CONDITIONAL(THREADS, test "$threads" = "yes") 102 103 AC_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]) 111 if test "$plugins" = "yes"; then 112 AC_DEFINE(ENABLE_PLUGINS, 1, 113 [Define to enable linker plugins]) 114 fi 115 AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes") 116 117 AC_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 ;; 129 esac], 130 [# For now, enable all targets by default 131 enable_targets=all 132 ]) 133 134 # Canonicalize the enabled targets. 135 if 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 145 fi 146 147 AC_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 ;; 156 esac], 157 [if test "x$target_alias" = "x" -o "x$host_alias" = "x$target_alias"; then 158 test_as_native=yes 159 else 160 test_as_native=no 161 fi]) 162 163 164 # See which specific instantiations we need. 165 targetobjs= 166 all_targets= 167 default_machine= 168 default_size= 169 default_big_endian= 170 default_osabi=ELFOSABI_NONE 171 targ_32_little= 172 targ_32_big= 173 targ_64_little= 174 targ_64_big= 175 for 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 246 done 247 248 # Remove any duplicates. 249 to="" 250 for t in $targetobjs; do 251 case " $to " in 252 *" $t "*) ;; 253 *) to="$to $t" ;; 254 esac 255 done 256 targetobjs=$to 257 258 if test -n "$targ_32_little"; then 259 AC_DEFINE(HAVE_TARGET_32_LITTLE, 1, 260 [Define to support 32-bit little-endian targets]) 261 fi 262 if test -n "$targ_32_big"; then 263 AC_DEFINE(HAVE_TARGET_32_BIG, 1, 264 [Define to support 32-bit big-endian targets]) 265 fi 266 if test -n "$targ_64_little"; then 267 AC_DEFINE(HAVE_TARGET_64_LITTLE, 1, 268 [Define to support 64-bit little-endian targets]) 269 fi 270 if test -n "$targ_64_big"; then 271 AC_DEFINE(HAVE_TARGET_64_BIG, 1, 272 [Define to support 64-bit big-endian targets]) 273 fi 274 275 if test -n "$all_targets"; then 276 TARGETOBJS='$(ALL_TARGETOBJS)' 277 else 278 TARGETOBJS="$targetobjs" 279 fi 280 AC_SUBST(TARGETOBJS) 281 282 AC_DEFINE_UNQUOTED(GOLD_DEFAULT_MACHINE, $default_machine, 283 [Default machine code]) 284 AC_DEFINE_UNQUOTED(GOLD_DEFAULT_SIZE, $default_size, 285 [Default size (32 or 64)]) 286 AC_DEFINE_UNQUOTED(GOLD_DEFAULT_BIG_ENDIAN, $default_big_endian, 287 [Default big endian (true or false)]) 288 AC_DEFINE_UNQUOTED(GOLD_DEFAULT_OSABI, $default_osabi, 289 [Default OSABI code]) 290 291 AC_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::"']) 299 AC_DEFINE_UNQUOTED(LIB_PATH, $LIB_PATH, 300 [Default library search path]) 301 if 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]) 303 fi 304 305 AC_CHECK_TOOL(NM, nm) 306 307 AC_PROG_CC 308 AC_PROG_CXX 309 AC_PROG_YACC 310 AC_PROG_RANLIB 311 AC_PROG_INSTALL 312 AC_PROG_LN_S 313 314 AC_GNU_SOURCE 315 316 ZW_GNU_GETTEXT_SISTER_DIR 317 AM_PO_SUBDIRS 318 319 AC_C_BIGENDIAN 320 321 AC_EXEEXT 322 323 AM_CONDITIONAL(TEST_AS_NATIVE_LINKER, 324 test "x$test_as_native" = "xyes") 325 AM_CONDITIONAL(GCC, test "$GCC" = yes) 326 327 AM_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 330 dnl Test for whether static linking is supported. Some systems do not 331 dnl install static libraries. This only affects the set of tests that 332 dnl we run. 333 AC_CACHE_CHECK([whether static linking works], [gold_cv_lib_static], 334 [LDFLAGS_hold=$LDFLAGS 335 LDFLAGS="$LDFLAGS -static" 336 AC_LINK_IFELSE([ 337 AC_LANG_PROGRAM([[void f() { }]])], 338 [gold_cv_lib_static=yes], [gold_cv_lib_static=no]) 339 LDFLAGS=$LDFLAGS_hold]) 340 AM_CONDITIONAL(HAVE_STATIC, test "$gold_cv_lib_static" = "yes") 341 342 dnl Some architectures do not support taking pointers of functions 343 dnl defined in shared libraries except in -fPIC mode. We need to 344 dnl tell the unittest framework if we're compiling for one of those 345 dnl targets, so it doesn't try to run the tests that do that. 346 AM_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 354 dnl Test for gcc 4.1 or later. Full support for -mcmodel=medium is 355 dnl only available in gcc 4.1. 356 AC_CACHE_CHECK([for gcc >= 4.1], [gold_cv_prog_gcc41], 357 [AC_COMPILE_IFELSE([ 358 #if !defined __GNUC__ 359 error 360 #elif __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) 361 error 362 #endif 363 ], [gold_cv_prog_gcc41=yes], [gold_cv_prog_gcc41=no])]) 364 365 save_CFLAGS="$CFLAGS" 366 CFLAGS="$CFLAGS -mcmodel=medium" 367 AC_COMPILE_IFELSE([int i;], [have_mcmodel_medium=yes], [have_mcmodel_medium=no]) 368 CFLAGS="$save_CFLAGS" 369 dnl Whether we can test -mcmodel=medium. 370 AM_CONDITIONAL(MCMODEL_MEDIUM, 371 [test "$target_cpu" = "x86_64" -a "$have_mcmodel_medium" = "yes" -a "$gold_cv_prog_gcc41" = "yes"]) 372 373 AC_CACHE_CHECK([whether $CC supports -fmerge-constants], 374 [gold_cv_merge_constants], [ 375 save_CFLAGS="$CFLAGS" 376 CFLAGS="$CFLAGS -fmerge-constants" 377 AC_COMPILE_IFELSE([const char *s = "foo";], 378 [gold_cv_merge_constants=yes], 379 [gold_cv_merge_constants=no]) 380 CFLAGS="$save_CFLAGS"]) 381 AC_SUBST([MERGE_CONSTANTS_FLAG]) 382 AS_IF([test "$gold_cv_merge_constants" = yes], 383 [MERGE_CONSTANTS_FLAG=-fmerge-constants], 384 [MERGE_CONSTANTS_FLAG=]) 385 386 dnl Test for __thread support. 387 AC_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 391 AM_CONDITIONAL(TLS, test "$gold_cv_c_thread" = "yes") 392 393 dnl On GNU/Linux TLS in static programs only works when using glibc 394 dnl 2.4 or later. 395 AC_CACHE_CHECK([for glibc >= 2.4], [gold_cv_lib_glibc24], 396 [AC_COMPILE_IFELSE([ 397 #include <features.h> 398 #if !defined __GLIBC__ 399 error 400 #elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 4) 401 error 402 #endif 403 ], [gold_cv_lib_glibc24=yes], [gold_cv_lib_glibc24=no])]) 404 405 AM_CONDITIONAL(STATIC_TLS, test "$gold_cv_lib_glibc24" = "yes") 406 407 dnl Test for #pragma omp threadprivate 408 AC_CACHE_CHECK([for omp support], [gold_cv_c_threadprivate], 409 [save_CFLAGS="$CFLAGS" 410 CFLAGS="$CFLAGS -fopenmp" 411 AC_COMPILE_IFELSE([ 412 #include <omp.h> 413 int i; 414 #pragma omp threadprivate (i) 415 ], [gold_cv_c_threadprivate=yes], [gold_cv_c_threadprivate=no]) 416 CFLAGS="$save_CFLAGS"]) 417 if test "$gold_cv_c_threadprivate" = "yes"; then 418 AC_DEFINE(HAVE_OMP_SUPPORT, 1, 419 [Define if compiler supports #pragma omp threadprivate]) 420 fi 421 AM_CONDITIONAL(OMP_SUPPORT, test "$gold_cv_c_threadprivate" = "yes") 422 423 dnl Test for the -ftls-dialect=gnu2 option. 424 dnl Use -Werror in case of compilers that make unknown -m options warnings. 425 dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS 426 dnl gets set later by default Autoconf magic to include -Werror. (We are 427 dnl assuming here that there is no compiler that groks -mtls-dialect=gnu2 428 dnl but does not grok -Werror.) 429 save_CFLAGS="$CFLAGS" 430 CFLAGS="$CFLAGS -Werror -fpic -mtls-dialect=gnu2" 431 AC_COMPILE_IFELSE([ 432 __thread int i; 433 void foo (void) 434 { 435 i = 10; 436 } 437 ], [have_tls_gnu2=yes], [have_tls_gnu2=no]) 438 CFLAGS="$save_CFLAGS" 439 AM_CONDITIONAL(TLS_GNU2_DIALECT, test "$have_tls_gnu2" = "yes") 440 441 dnl On GNU/Linux TLS descriptors are supported by the dynamic loader 442 dnl only with glibc 2.9 or later. 443 AC_CACHE_CHECK([for glibc >= 2.9], [gold_cv_lib_glibc29], 444 [AC_COMPILE_IFELSE([ 445 #include <features.h> 446 #if !defined __GLIBC__ 447 error 448 #elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 9) 449 error 450 #endif 451 ], [gold_cv_lib_glibc29=yes], [gold_cv_lib_glibc29=no])]) 452 453 AM_CONDITIONAL(TLS_DESCRIPTORS, test "$gold_cv_lib_glibc29" = "yes") 454 455 dnl Test for the -frandom-seed option. 456 AC_CACHE_CHECK([for -frandom-seed support], [gold_cv_c_random_seed], 457 [save_CFLAGS="$CFLAGS" 458 CFLAGS="$CFLAGS -frandom-seed=foo" 459 AC_COMPILE_IFELSE([int i;], [gold_cv_c_random_seed=yes], 460 [gold_cv_c_random_seed=no]) 461 CFLAGS="$save_CFLAGS"]) 462 if 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=\$@ 466 fi 467 AC_SUBST(RANDOM_SEED_CFLAGS) 468 469 dnl On GNU/Linux ifunc is supported by the dynamic linker in glibc 470 dnl 2.11 or later, and by binutils 2.20.1 or later. 471 AC_CACHE_CHECK([for glibc ifunc support], [gold_cv_lib_glibc_ifunc], 472 [save_LDFLAGS="$LDFLAGS" 473 LDFLAGS="$LDFLAGS -static" 474 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 475 #include <features.h> 476 #if !defined __GLIBC__ 477 error 478 #elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 11) 479 error 480 #endif 481 void func (void) { } 482 void invoke (void); 483 __asm__(".type invoke, %gnu_indirect_function"); 484 typedef void (*funcptr) (void); 485 funcptr dispatch (void) __asm__ ("invoke"); 486 funcptr dispatch (void) { return &func; }]], 487 [[invoke();]]) 488 ], [ 489 if ${NM} conftest$EXEEXT | grep "__rela\?_iplt_start" >/dev/null 2>&1; then 490 gold_cv_lib_glibc_ifunc=both 491 else 492 gold_cv_lib_glibc_ifunc=dyn 493 fi], [gold_cv_lib_glibc_ifunc=no]) 494 LDFLAGS="$save_LDFLAGS"]) 495 496 AM_CONDITIONAL(IFUNC, test "$gold_cv_lib_glibc_ifunc" != "no") 497 AM_CONDITIONAL(IFUNC_STATIC, test "$gold_cv_lib_glibc_ifunc" = "both") 498 499 AM_BINUTILS_WARNINGS 500 501 WARN_CXXFLAGS=`echo ${WARN_CFLAGS} | sed -e 's/-Wstrict-prototypes//' -e 's/-Wmissing-prototypes//' -e 's/-Wshadow//'` 502 AC_SUBST(WARN_CXXFLAGS) 503 504 AC_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=]) 512 AC_SUBST(GOLD_LDFLAGS) 513 514 AC_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=]) 522 AC_SUBST(GOLD_LDADD) 523 524 dnl Force support for large files by default. This may need to be 525 dnl host dependent. If build == host, we can check getconf LFS_CFLAGS. 526 LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" 527 AC_SUBST(LFS_CFLAGS) 528 529 AC_CHECK_HEADERS(sys/mman.h) 530 AC_CHECK_FUNCS(chsize mmap) 531 AC_REPLACE_FUNCS(pread ftruncate ffsll) 532 533 AC_CACHE_CHECK([mremap with MREMAP_MAYMOVE], [gold_cv_lib_mremap_maymove], 534 [AC_LINK_IFELSE([ 535 AC_LANG_PROGRAM([[ 536 #include <sys/mman.h> 537 void f() { mremap (0, 0, 0, MREMAP_MAYMOVE); } 538 ]])], [gold_cv_lib_mremap_maymove=yes], [gold_cv_lib_mremap_maymove=no])]) 539 if 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]) 542 else 543 AC_LIBOBJ(mremap) 544 fi 545 546 # Link in zlib if we can. This allows us to write compressed sections. 547 AM_ZLIB 548 AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_header_zlib_h" = "yes") 549 550 dnl We have to check these in C, not C++, because autoconf generates 551 dnl tests which have no type information, and current glibc provides 552 dnl multiple declarations of functions like basename when compiling 553 dnl with C++. 554 AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp]) 555 556 dnl Check if gcc supports the -gpubnames option. 557 dnl Use -Werror in case of compilers that make unknown -g options warnings. 558 dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS 559 dnl gets set later by default Autoconf magic to include -Werror. (We are 560 dnl assuming here that there is no compiler that groks -gpubnames 561 dnl but does not grok -Werror.) 562 save_CFLAGS="$CFLAGS" 563 CFLAGS="$CFLAGS -Werror -gpubnames" 564 AC_COMPILE_IFELSE([int i;], [have_pubnames=yes], [have_pubnames=no]) 565 CFLAGS="$save_CFLAGS" 566 AM_CONDITIONAL(HAVE_PUBNAMES, test "$have_pubnames" = "yes") 567 568 dnl Check if gcc supports the -fno-use-linker-plugin option. 569 save_CFLAGS="$CFLAGS" 570 CFLAGS="$CFLAGS -Werror -fno-use-linker-plugin" 571 AC_COMPILE_IFELSE([int i;], [have_no_use_linker_plugin=yes], [have_no_use_linker_plugin=no]) 572 CFLAGS="$save_CFLAGS" 573 AM_CONDITIONAL(HAVE_NO_USE_LINKER_PLUGIN, test "$have_no_use_linker_plugin" = "yes") 574 575 AC_LANG_PUSH(C++) 576 577 AC_CHECK_HEADERS(unordered_set unordered_map) 578 AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map) 579 AC_CHECK_HEADERS(ext/hash_map ext/hash_set) 580 AC_CHECK_HEADERS(byteswap.h) 581 582 dnl When plugins enabled dynamic loader interface is required. Check headers 583 dnl which may provide this interface. Add the necessary library to link. 584 AC_CHECK_HEADERS(windows.h) 585 AC_CHECK_HEADERS(dlfcn.h) 586 AC_SEARCH_LIBS(dlopen, [dl dld]) 587 case "$ac_cv_search_dlopen" in 588 no*) DLOPEN_LIBS="";; 589 *) DLOPEN_LIBS="$ac_cv_search_dlopen";; 590 esac 591 AC_SUBST(DLOPEN_LIBS) 592 593 AC_CHECK_FUNCS(mallinfo posix_fallocate fallocate readv sysconf times) 594 AC_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. 598 AC_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> 602 void bar() { ::std::tr1::unordered_map<int, int> x; x.rehash(10); } 603 ]])], [gold_cv_unordered_map_rehash=yes], [gold_cv_unordered_map_rehash=no])]) 604 if 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]) 607 fi 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. 611 AC_CACHE_CHECK([whether std::tr1::hash<off_t> is defined], 612 [gold_cv_hash_off_t], 613 [CXXFLAGS_hold=$CXXFLAGS 614 CXXFLAGS="$CXXFLAGS $LFS_CFLAGS" 615 AC_COMPILE_IFELSE([ 616 #include <sys/types.h> 617 #include <tr1/unordered_map> 618 std::tr1::hash<off_t> h; 619 ], 620 [gold_cv_hash_off_t=yes], 621 [gold_cv_hash_off_t=no]) 622 CXXFLAGS=$CXXFLAGS_hold]) 623 if 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]) 626 fi 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. 631 AC_CACHE_CHECK([whether we can use attributes with template functions], 632 [gold_cv_template_attribute], 633 [AC_COMPILE_IFELSE([ 634 template<typename T> extern void foo(const char*, ...) 635 __attribute__ ((__format__ (__printf__, 1, 2))); 636 template<typename T> void foo(const char* format, ...) {} 637 void bar() { foo<int>("%s\n", "foo"); } 638 ], [gold_cv_template_attribute=yes], [gold_cv_template_attribute=no])]) 639 if test "$gold_cv_template_attribute" = "yes"; then 640 AC_DEFINE(HAVE_TEMPLATE_ATTRIBUTES, 1, 641 [Define if attributes work on C++ templates]) 642 fi 643 644 dnl Check if the system has struct stat::st_mtim. 645 AC_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> 649 long 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])]) 651 if 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]) 654 fi 655 656 AC_LANG_POP(C++) 657 658 AC_CHECK_HEADERS(locale.h) 659 AC_CHECK_FUNCS(setlocale) 660 AM_LC_MESSAGES 661 662 AM_MAINTAINER_MODE 663 664 AC_OUTPUT(Makefile testsuite/Makefile po/Makefile.in:po/Make-in) 665