12159047fSniklasdnl Process this file with autoconf to produce a configure script 22159047fSniklasdnl 3c074d1c9SdrahnAC_PREREQ(2.13) 42159047fSniklasAC_INIT(ldmain.c) 52159047fSniklas 6b305b0f1SespieAC_CANONICAL_SYSTEM 7b55d4692SfgschAC_ISC_POSIX 8b305b0f1Sespie 9b55d4692Sfgschchangequote(,)dnl 10b55d4692SfgschBFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in` 11b55d4692Sfgschchangequote([,])dnl 12b55d4692SfgschAM_INIT_AUTOMAKE(ld, ${BFD_VERSION}) 13b305b0f1Sespie 14b305b0f1SespieAM_PROG_LIBTOOL 15b305b0f1Sespie 16c074d1c9SdrahnAC_ARG_WITH(lib-path, [ --with-lib-path=dir1:dir2... set default LIB_PATH],LIB_PATH=$withval) 172159047fSniklasAC_ARG_ENABLE(targets, 182159047fSniklas[ --enable-targets alternative target configurations], 192159047fSniklas[case "${enableval}" in 202159047fSniklas yes | "") AC_ERROR(enable-targets option must specify target names or 'all') 212159047fSniklas ;; 222159047fSniklas no) enable_targets= ;; 232159047fSniklas *) enable_targets=$enableval ;; 242159047fSniklasesac])dnl 25e93f7393SniklasAC_ARG_ENABLE(64-bit-bfd, 26e93f7393Sniklas[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], 27e93f7393Sniklas[case "${enableval}" in 28e93f7393Sniklas yes) want64=true ;; 29e93f7393Sniklas no) want64=false ;; 30e93f7393Sniklas *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; 31e93f7393Sniklasesac],[want64=false])dnl 322159047fSniklas 33c074d1c9SdrahnAC_ARG_WITH(sysroot, 34c074d1c9Sdrahn[ --with-sysroot[=DIR] Search for usr/lib et al within DIR.], 35c074d1c9Sdrahn[ 36c074d1c9Sdrahn case ${with_sysroot} in 37c074d1c9Sdrahn yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;; 38c074d1c9Sdrahn *) TARGET_SYSTEM_ROOT=$with_sysroot ;; 39c074d1c9Sdrahn esac 40c074d1c9Sdrahn 41c074d1c9Sdrahn TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' 42c074d1c9Sdrahn use_sysroot=yes 43c074d1c9Sdrahn 44c074d1c9Sdrahn if test "x$exec_prefix" = xNONE; then 45c074d1c9Sdrahn if test "x$prefix" = xNONE; then 46c074d1c9Sdrahn test_prefix=/usr/local 47c074d1c9Sdrahn else 48c074d1c9Sdrahn test_prefix=$prefix 49c074d1c9Sdrahn fi 50c074d1c9Sdrahn else 51c074d1c9Sdrahn test_prefix=$exec_prefix 52c074d1c9Sdrahn fi 53c074d1c9Sdrahn case ${TARGET_SYSTEM_ROOT} in 54c074d1c9Sdrahn "${test_prefix}"|"${test_prefix}/"*|\ 55c074d1c9Sdrahn '${exec_prefix}'|'${exec_prefix}/'*) 56c074d1c9Sdrahn t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" 57c074d1c9Sdrahn TARGET_SYSTEM_ROOT_DEFINE="$t" 58c074d1c9Sdrahn ;; 59c074d1c9Sdrahn esac 60c074d1c9Sdrahn], [ 61c074d1c9Sdrahn use_sysroot=no 62c074d1c9Sdrahn TARGET_SYSTEM_ROOT= 63c074d1c9Sdrahn TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"' 64c074d1c9Sdrahn]) 65c074d1c9SdrahnAC_SUBST(use_sysroot) 66c074d1c9SdrahnAC_SUBST(TARGET_SYSTEM_ROOT) 67c074d1c9SdrahnAC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) 68c074d1c9Sdrahn 69c074d1c9Sdrahnbuild_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" 70b55d4692SfgschAC_ARG_ENABLE(build-warnings, 71c074d1c9Sdrahn[ --enable-build-warnings enable build-time compiler warnings if gcc is used], 72b55d4692Sfgsch[case "${enableval}" in 73b55d4692Sfgsch yes) ;; 74b55d4692Sfgsch no) build_warnings="-w";; 75b55d4692Sfgsch ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` 76b55d4692Sfgsch build_warnings="${build_warnings} ${t}";; 77b55d4692Sfgsch *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` 78b55d4692Sfgsch build_warnings="${t} ${build_warnings}";; 79b55d4692Sfgsch *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; 80b55d4692Sfgschesac 81b55d4692Sfgschif test x"$silent" != x"yes" && test x"$build_warnings" != x""; then 82b55d4692Sfgsch echo "Setting warning flags = $build_warnings" 6>&1 83b55d4692Sfgschfi])dnl 84b55d4692SfgschWARN_CFLAGS="" 85b55d4692Sfgschif test "x${build_warnings}" != x -a "x$GCC" = xyes ; then 86b55d4692Sfgsch WARN_CFLAGS="${build_warnings}" 87b55d4692Sfgschfi 88b55d4692SfgschAC_SUBST(WARN_CFLAGS) 89b55d4692Sfgsch 90b305b0f1SespieAM_CONFIG_HEADER(config.h:config.in) 912159047fSniklas 922159047fSniklasif test -z "$target" ; then 932159047fSniklas AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) 942159047fSniklasfi 952159047fSniklasif test -z "$host" ; then 962159047fSniklas AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) 972159047fSniklasfi 982159047fSniklas 992159047fSniklas# host-specific stuff: 1002159047fSniklas 101191aa565SniklasAC_PROG_CC 1020c6d0228SniklasAC_PROG_INSTALL 103191aa565Sniklas 104c074d1c9SdrahnALL_LINGUAS="fr sv tr es da" 105b305b0f1SespieCY_GNU_GETTEXT 106b305b0f1Sespie 107b305b0f1SespieAC_EXEEXT 108b305b0f1Sespie 109b305b0f1SespieAC_PROG_YACC 110b305b0f1SespieAM_PROG_LEX 111b305b0f1Sespie 112b305b0f1SespieAM_MAINTAINER_MODE 113b305b0f1Sespie 1142159047fSniklas. ${srcdir}/configure.host 1152159047fSniklas 1162159047fSniklasAC_SUBST(HDEFINES) 1172159047fSniklasAC_SUBST(HOSTING_CRT0) 1182159047fSniklasAC_SUBST(HOSTING_LIBS) 1192159047fSniklasAC_SUBST(NATIVE_LIB_DIRS) 1202159047fSniklas 1212159047fSniklasAC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) 122c074d1c9SdrahnAC_CHECK_FUNCS(sbrk realpath) 1232159047fSniklasAC_HEADER_DIRENT 1242159047fSniklas 1252159047fSniklasBFD_BINARY_FOPEN 1262159047fSniklas 1270c6d0228SniklasBFD_NEED_DECLARATION(strstr) 128191aa565SniklasBFD_NEED_DECLARATION(free) 1290c6d0228SniklasBFD_NEED_DECLARATION(sbrk) 130b305b0f1SespieBFD_NEED_DECLARATION(getenv) 131b305b0f1SespieBFD_NEED_DECLARATION(environ) 132b305b0f1Sespie 133b305b0f1Sespie# When converting linker scripts into strings for use in emulation 134b305b0f1Sespie# files, use astring.sed if the compiler supports ANSI string 135b305b0f1Sespie# concatenation, or ostring.sed otherwise. This is to support the 136b305b0f1Sespie# broken Microsoft MSVC compiler, which limits the length of string 137b305b0f1Sespie# constants, while still supporting pre-ANSI compilers which do not 138b305b0f1Sespie# support string concatenation. 139b305b0f1SespieAC_MSG_CHECKING([whether ANSI C string concatenation works]) 140b305b0f1SespieAC_CACHE_VAL(ld_cv_string_concatenation, 141b305b0f1Sespie[AC_TRY_COMPILE(,[char *a = "a" "a";], 142b305b0f1Sespie [ld_cv_string_concatenation=yes], 143b305b0f1Sespie [ld_cv_string_concatenation=no])]) 144b305b0f1SespieAC_MSG_RESULT($ld_cv_string_concatenation) 145b305b0f1Sespieif test "$ld_cv_string_concatenation" = "yes"; then 146b305b0f1Sespie STRINGIFY=astring.sed 147b305b0f1Sespieelse 148b305b0f1Sespie STRINGIFY=ostring.sed 149b305b0f1Sespiefi 150b305b0f1SespieAC_SUBST(STRINGIFY) 1512159047fSniklas 1522159047fSniklas# target-specific stuff: 1532159047fSniklas 154191aa565Sniklasall_targets= 1552159047fSniklasEMUL= 1562159047fSniklasall_emuls= 157b305b0f1Sespieall_emul_extras= 158b305b0f1Sespieall_libpath= 159b305b0f1Sespie 160b305b0f1Sespiednl We need to get an arbitrary number of tdir definitions into 161b305b0f1Sespiednl Makefile. We can't do it using AC_SUBST, because autoconf does 162b305b0f1Sespiednl not permit literal newlines in an AC_SUBST variables. So we use a 163b305b0f1Sespiednl file. 164b305b0f1Sespierm -f tdirs 1652159047fSniklas 166191aa565Sniklasfor targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` 1672159047fSniklasdo 168191aa565Sniklas if test "$targ_alias" = "all"; then 1692159047fSniklas all_targets=true 1702159047fSniklas else 171191aa565Sniklas # Canonicalize the secondary target names. 172*cad84230Skettenis result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null` 173191aa565Sniklas if test -n "$result"; then 174191aa565Sniklas targ=$result 175191aa565Sniklas else 176191aa565Sniklas targ=$targ_alias 1772159047fSniklas fi 1782159047fSniklas 179191aa565Sniklas . ${srcdir}/configure.tgt 180191aa565Sniklas 181191aa565Sniklas if test "$targ" = "$target"; then 182191aa565Sniklas EMUL=$targ_emul 183191aa565Sniklas fi 184191aa565Sniklas 185b305b0f1Sespie for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do 186191aa565Sniklas case " $all_emuls " in 187191aa565Sniklas *" e${i}.o "*) ;; 188191aa565Sniklas *) 189191aa565Sniklas all_emuls="$all_emuls e${i}.o" 190191aa565Sniklas eval result=\$tdir_$i 191191aa565Sniklas test -z "$result" && result=$targ_alias 192b305b0f1Sespie echo tdir_$i=$result >> tdirs 193b305b0f1Sespie ;; 194b305b0f1Sespie esac 195b305b0f1Sespie done 196b305b0f1Sespie 197b305b0f1Sespie for i in $targ_emul $targ_extra_libpath; do 198b305b0f1Sespie case " $all_libpath " in 199b305b0f1Sespie *" ${i} "*) ;; 200b305b0f1Sespie *) 201b305b0f1Sespie if test -z "$all_libpath"; then 202b305b0f1Sespie all_libpath=${i} 203b305b0f1Sespie else 204b305b0f1Sespie all_libpath="$all_libpath ${i}" 205b305b0f1Sespie fi 206b305b0f1Sespie ;; 207b305b0f1Sespie esac 208b305b0f1Sespie done 209b305b0f1Sespie 210b305b0f1Sespie for i in $targ_extra_ofiles; do 211b305b0f1Sespie case " $all_emul_extras " in 212b305b0f1Sespie *" ${i} "*) ;; 213b305b0f1Sespie *) 214b305b0f1Sespie all_emul_extras="$all_emul_extras ${i}" 215191aa565Sniklas ;; 216191aa565Sniklas esac 217191aa565Sniklas done 2182159047fSniklas fi 2192159047fSniklasdone 2202159047fSniklas 2212159047fSniklasAC_SUBST(EMUL) 222b305b0f1Sespie 223b305b0f1SespieTDIRS=tdirs 224b305b0f1SespieAC_SUBST_FILE(TDIRS) 2252159047fSniklas 226e93f7393Sniklasdnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit 227e93f7393Sniklasdnl target, and in those cases we should also build the 64 bit 228e93f7393Sniklasdnl emulations. 229191aa565Sniklasif test x${all_targets} = xtrue; then 230e93f7393Sniklas if test x${want64} = xtrue; then 231e93f7393Sniklas EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' 232e93f7393Sniklas else 2332159047fSniklas EMULATION_OFILES='$(ALL_EMULATIONS)' 234e93f7393Sniklas fi 235b305b0f1Sespie EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)' 236191aa565Sniklaselse 237191aa565Sniklas EMULATION_OFILES=$all_emuls 238b305b0f1Sespie EMUL_EXTRA_OFILES=$all_emul_extras 239191aa565Sniklasfi 2402159047fSniklasAC_SUBST(EMULATION_OFILES) 241b305b0f1SespieAC_SUBST(EMUL_EXTRA_OFILES) 242c074d1c9SdrahnAC_SUBST(LIB_PATH) 2432159047fSniklas 244b305b0f1SespieEMULATION_LIBPATH=$all_libpath 245b305b0f1SespieAC_SUBST(EMULATION_LIBPATH) 246b305b0f1Sespie 247b305b0f1Sespieif test x${enable_static} = xno; then 248b305b0f1Sespie TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so" 249b305b0f1Sespieelse 250b305b0f1Sespie TESTBFDLIB="../bfd/.libs/libbfd.a" 251b305b0f1Sespiefi 252b305b0f1SespieAC_SUBST(TESTBFDLIB) 253b305b0f1Sespie 254b305b0f1Sespietarget_vendor=${target_vendor=$host_vendor} 255b305b0f1Sespiecase "$target_vendor" in 256b305b0f1Sespie hp) EXTRA_SHLIB_EXTENSION=".sl" ;; 257b305b0f1Sespie *) EXTRA_SHLIB_EXTENSION= ;; 258b305b0f1Sespieesac 259b305b0f1Sespieif test x${EXTRA_SHLIB_EXTENSION} != x ; then 260b305b0f1Sespie AC_DEFINE_UNQUOTED(EXTRA_SHLIB_EXTENSION, "$EXTRA_SHLIB_EXTENSION", 261b305b0f1Sespie [Additional extension a shared object might have.]) 262b305b0f1Sespiefi 263b305b0f1Sespie 264b305b0f1SespieAC_OUTPUT(Makefile po/Makefile.in:po/Make-in, 265b305b0f1Sespie[sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile]) 266