| 1 | dnl Process this file with autoconf to produce a configure script |
| 2 | dnl |
| 3 | AC_PREREQ(2.13) |
| 4 | AC_INIT(ldmain.c) |
| 5 | |
| 6 | AC_CANONICAL_SYSTEM |
| 7 | AC_ISC_POSIX |
| 8 | |
| 9 | changequote(,)dnl |
| 10 | BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in` |
| 11 | changequote([,])dnl |
| 12 | AM_INIT_AUTOMAKE(ld, ${BFD_VERSION}) |
| 13 | |
| 14 | AM_PROG_LIBTOOL |
| 15 | |
| 16 | AC_ARG_ENABLE(targets, |
| 17 | [ --enable-targets alternative target configurations], |
| 18 | [case "${enableval}" in |
| 19 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') |
| 20 | ;; |
| 21 | no) enable_targets= ;; |
| 22 | *) enable_targets=$enableval ;; |
| 23 | esac])dnl |
| 24 | AC_ARG_ENABLE(64-bit-bfd, |
| 25 | [ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], |
| 26 | [case "${enableval}" in |
| 27 | yes) want64=true ;; |
| 28 | no) want64=false ;; |
| 29 | *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; |
| 30 | esac],[want64=false])dnl |
| 31 | |
| 32 | build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" |
| 33 | AC_ARG_ENABLE(build-warnings, |
| 34 | [ --enable-build-warnings Enable build-time compiler warnings if gcc is used], |
| 35 | [case "${enableval}" in |
| 36 | yes) ;; |
| 37 | no) build_warnings="-w";; |
| 38 | ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` |
| 39 | build_warnings="${build_warnings} ${t}";; |
| 40 | *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` |
| 41 | build_warnings="${t} ${build_warnings}";; |
| 42 | *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; |
| 43 | esac |
| 44 | if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then |
| 45 | echo "Setting warning flags = $build_warnings" 6>&1 |
| 46 | fi])dnl |
| 47 | WARN_CFLAGS="" |
| 48 | if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then |
| 49 | WARN_CFLAGS="${build_warnings}" |
| 50 | fi |
| 51 | AC_SUBST(WARN_CFLAGS) |
| 52 | |
| 53 | AM_CONFIG_HEADER(config.h:config.in) |
| 54 | |
| 55 | if test -z "$target" ; then |
| 56 | AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) |
| 57 | fi |
| 58 | if test -z "$host" ; then |
| 59 | AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) |
| 60 | fi |
| 61 | |
| 62 | # host-specific stuff: |
| 63 | |
| 64 | AC_PROG_CC |
| 65 | AC_PROG_INSTALL |
| 66 | |
| 67 | ALL_LINGUAS="fr sv tr es" |
| 68 | CY_GNU_GETTEXT |
| 69 | |
| 70 | AC_EXEEXT |
| 71 | |
| 72 | AC_PROG_YACC |
| 73 | AM_PROG_LEX |
| 74 | |
| 75 | AM_MAINTAINER_MODE |
| 76 | |
| 77 | . ${srcdir}/configure.host |
| 78 | |
| 79 | AC_SUBST(HDEFINES) |
| 80 | AC_SUBST(HOSTING_CRT0) |
| 81 | AC_SUBST(HOSTING_LIBS) |
| 82 | AC_SUBST(NATIVE_LIB_DIRS) |
| 83 | |
| 84 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) |
| 85 | AC_CHECK_FUNCS(sbrk) |
| 86 | AC_HEADER_DIRENT |
| 87 | |
| 88 | BFD_BINARY_FOPEN |
| 89 | |
| 90 | BFD_NEED_DECLARATION(strstr) |
| 91 | BFD_NEED_DECLARATION(free) |
| 92 | BFD_NEED_DECLARATION(sbrk) |
| 93 | BFD_NEED_DECLARATION(getenv) |
| 94 | BFD_NEED_DECLARATION(environ) |
| 95 | |
| 96 | # When converting linker scripts into strings for use in emulation |
| 97 | # files, use astring.sed if the compiler supports ANSI string |
| 98 | # concatenation, or ostring.sed otherwise. This is to support the |
| 99 | # broken Microsoft MSVC compiler, which limits the length of string |
| 100 | # constants, while still supporting pre-ANSI compilers which do not |
| 101 | # support string concatenation. |
| 102 | AC_MSG_CHECKING([whether ANSI C string concatenation works]) |
| 103 | AC_CACHE_VAL(ld_cv_string_concatenation, |
| 104 | [AC_TRY_COMPILE(,[char *a = "a" "a";], |
| 105 | [ld_cv_string_concatenation=yes], |
| 106 | [ld_cv_string_concatenation=no])]) |
| 107 | AC_MSG_RESULT($ld_cv_string_concatenation) |
| 108 | if test "$ld_cv_string_concatenation" = "yes"; then |
| 109 | STRINGIFY=astring.sed |
| 110 | else |
| 111 | STRINGIFY=ostring.sed |
| 112 | fi |
| 113 | AC_SUBST(STRINGIFY) |
| 114 | |
| 115 | # target-specific stuff: |
| 116 | |
| 117 | all_targets= |
| 118 | EMUL= |
| 119 | all_emuls= |
| 120 | all_emul_extras= |
| 121 | all_libpath= |
| 122 | |
| 123 | dnl We need to get an arbitrary number of tdir definitions into |
| 124 | dnl Makefile. We can't do it using AC_SUBST, because autoconf does |
| 125 | dnl not permit literal newlines in an AC_SUBST variables. So we use a |
| 126 | dnl file. |
| 127 | rm -f tdirs |
| 128 | |
| 129 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` |
| 130 | do |
| 131 | if test "$targ_alias" = "all"; then |
| 132 | all_targets=true |
| 133 | else |
| 134 | # Canonicalize the secondary target names. |
| 135 | result=`$ac_config_sub $targ_alias 2>/dev/null` |
| 136 | if test -n "$result"; then |
| 137 | targ=$result |
| 138 | else |
| 139 | targ=$targ_alias |
| 140 | fi |
| 141 | |
| 142 | . ${srcdir}/configure.tgt |
| 143 | |
| 144 | if test "$targ" = "$target"; then |
| 145 | EMUL=$targ_emul |
| 146 | fi |
| 147 | |
| 148 | for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do |
| 149 | case " $all_emuls " in |
| 150 | *" e${i}.o "*) ;; |
| 151 | *) |
| 152 | all_emuls="$all_emuls e${i}.o" |
| 153 | eval result=\$tdir_$i |
| 154 | test -z "$result" && result=$targ_alias |
| 155 | echo tdir_$i=$result >> tdirs |
| 156 | ;; |
| 157 | esac |
| 158 | done |
| 159 | |
| 160 | for i in $targ_emul $targ_extra_libpath; do |
| 161 | case " $all_libpath " in |
| 162 | *" ${i} "*) ;; |
| 163 | *) |
| 164 | if test -z "$all_libpath"; then |
| 165 | all_libpath=${i} |
| 166 | else |
| 167 | all_libpath="$all_libpath ${i}" |
| 168 | fi |
| 169 | ;; |
| 170 | esac |
| 171 | done |
| 172 | |
| 173 | for i in $targ_extra_ofiles; do |
| 174 | case " $all_emul_extras " in |
| 175 | *" ${i} "*) ;; |
| 176 | *) |
| 177 | all_emul_extras="$all_emul_extras ${i}" |
| 178 | ;; |
| 179 | esac |
| 180 | done |
| 181 | fi |
| 182 | done |
| 183 | |
| 184 | AC_SUBST(EMUL) |
| 185 | |
| 186 | TDIRS=tdirs |
| 187 | AC_SUBST_FILE(TDIRS) |
| 188 | |
| 189 | dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit |
| 190 | dnl target, and in those cases we should also build the 64 bit |
| 191 | dnl emulations. |
| 192 | if test x${all_targets} = xtrue; then |
| 193 | if test x${want64} = xtrue; then |
| 194 | EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' |
| 195 | else |
| 196 | EMULATION_OFILES='$(ALL_EMULATIONS)' |
| 197 | fi |
| 198 | EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)' |
| 199 | else |
| 200 | EMULATION_OFILES=$all_emuls |
| 201 | EMUL_EXTRA_OFILES=$all_emul_extras |
| 202 | fi |
| 203 | AC_SUBST(EMULATION_OFILES) |
| 204 | AC_SUBST(EMUL_EXTRA_OFILES) |
| 205 | |
| 206 | EMULATION_LIBPATH=$all_libpath |
| 207 | AC_SUBST(EMULATION_LIBPATH) |
| 208 | |
| 209 | if test x${enable_static} = xno; then |
| 210 | TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so" |
| 211 | else |
| 212 | TESTBFDLIB="../bfd/.libs/libbfd.a" |
| 213 | fi |
| 214 | AC_SUBST(TESTBFDLIB) |
| 215 | |
| 216 | target_vendor=${target_vendor=$host_vendor} |
| 217 | case "$target_vendor" in |
| 218 | hp) EXTRA_SHLIB_EXTENSION=".sl" ;; |
| 219 | *) EXTRA_SHLIB_EXTENSION= ;; |
| 220 | esac |
| 221 | if test x${EXTRA_SHLIB_EXTENSION} != x ; then |
| 222 | AC_DEFINE_UNQUOTED(EXTRA_SHLIB_EXTENSION, "$EXTRA_SHLIB_EXTENSION", |
| 223 | [Additional extension a shared object might have.]) |
| 224 | fi |
| 225 | |
| 226 | AC_OUTPUT(Makefile po/Makefile.in:po/Make-in, |
| 227 | [sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile]) |