| 1 | dnl Process this file with autoconf to produce a configure script |
| 2 | dnl |
| 3 | AC_PREREG(2.5) |
| 4 | AC_INIT(ldmain.c) |
| 5 | |
| 6 | AC_CANONICAL_SYSTEM |
| 7 | |
| 8 | AM_INIT_AUTOMAKE(ld, 2.9.1) |
| 9 | |
| 10 | AM_PROG_LIBTOOL |
| 11 | |
| 12 | AC_ARG_ENABLE(targets, |
| 13 | [ --enable-targets alternative target configurations], |
| 14 | [case "${enableval}" in |
| 15 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') |
| 16 | ;; |
| 17 | no) enable_targets= ;; |
| 18 | *) enable_targets=$enableval ;; |
| 19 | esac])dnl |
| 20 | AC_ARG_ENABLE(64-bit-bfd, |
| 21 | [ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], |
| 22 | [case "${enableval}" in |
| 23 | yes) want64=true ;; |
| 24 | no) want64=false ;; |
| 25 | *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; |
| 26 | esac],[want64=false])dnl |
| 27 | |
| 28 | AM_CONFIG_HEADER(config.h:config.in) |
| 29 | |
| 30 | if test -z "$target" ; then |
| 31 | AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) |
| 32 | fi |
| 33 | if test -z "$host" ; then |
| 34 | AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) |
| 35 | fi |
| 36 | |
| 37 | # host-specific stuff: |
| 38 | |
| 39 | AC_PROG_CC |
| 40 | AM_PROG_INSTALL |
| 41 | |
| 42 | ALL_LINGUAS= |
| 43 | CY_GNU_GETTEXT |
| 44 | |
| 45 | AM_CYGWIN32 |
| 46 | AM_EXEEXT |
| 47 | |
| 48 | AC_PROG_YACC |
| 49 | AM_PROG_LEX |
| 50 | |
| 51 | AM_MAINTAINER_MODE |
| 52 | |
| 53 | . ${srcdir}/configure.host |
| 54 | |
| 55 | AC_SUBST(HDEFINES) |
| 56 | AC_SUBST(HOSTING_CRT0) |
| 57 | AC_SUBST(HOSTING_LIBS) |
| 58 | AC_SUBST(NATIVE_LIB_DIRS) |
| 59 | |
| 60 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) |
| 61 | AC_CHECK_FUNCS(sbrk) |
| 62 | AC_HEADER_DIRENT |
| 63 | |
| 64 | BFD_BINARY_FOPEN |
| 65 | |
| 66 | BFD_NEED_DECLARATION(strstr) |
| 67 | BFD_NEED_DECLARATION(free) |
| 68 | BFD_NEED_DECLARATION(sbrk) |
| 69 | BFD_NEED_DECLARATION(getenv) |
| 70 | |
| 71 | # target-specific stuff: |
| 72 | |
| 73 | all_targets= |
| 74 | EMUL= |
| 75 | all_emuls= |
| 76 | |
| 77 | dnl We need to get an arbitrary number of tdir definitions into |
| 78 | dnl Makefile. We can't do it using AC_SUBST, because autoconf does |
| 79 | dnl not permit literal newlines in an AC_SUBST variables. So we use a |
| 80 | dnl file. |
| 81 | rm -f tdirs |
| 82 | |
| 83 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` |
| 84 | do |
| 85 | if test "$targ_alias" = "all"; then |
| 86 | all_targets=true |
| 87 | else |
| 88 | # Canonicalize the secondary target names. |
| 89 | result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null` |
| 90 | if test -n "$result"; then |
| 91 | targ=$result |
| 92 | else |
| 93 | targ=$targ_alias |
| 94 | fi |
| 95 | |
| 96 | . ${srcdir}/configure.tgt |
| 97 | |
| 98 | if test "$targ" = "$target"; then |
| 99 | EMUL=$targ_emul |
| 100 | fi |
| 101 | |
| 102 | for i in $targ_emul $targ_extra_emuls; do |
| 103 | case " $all_emuls " in |
| 104 | *" e${i}.o "*) ;; |
| 105 | *) |
| 106 | all_emuls="$all_emuls e${i}.o" |
| 107 | eval result=\$tdir_$i |
| 108 | test -z "$result" && result=$targ_alias |
| 109 | echo tdir_$i=$result >> tdirs |
| 110 | ;; |
| 111 | esac |
| 112 | done |
| 113 | fi |
| 114 | done |
| 115 | |
| 116 | AC_SUBST(EMUL) |
| 117 | |
| 118 | TDIRS=tdirs |
| 119 | AC_SUBST_FILE(TDIRS) |
| 120 | |
| 121 | dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit |
| 122 | dnl target, and in those cases we should also build the 64 bit |
| 123 | dnl emulations. |
| 124 | if test x${all_targets} = xtrue; then |
| 125 | if test x${want64} = xtrue; then |
| 126 | EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' |
| 127 | else |
| 128 | EMULATION_OFILES='$(ALL_EMULATIONS)' |
| 129 | fi |
| 130 | else |
| 131 | EMULATION_OFILES=$all_emuls |
| 132 | fi |
| 133 | AC_SUBST(EMULATION_OFILES) |
| 134 | |
| 135 | if test x${enable_static} = xno; then |
| 136 | TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so" |
| 137 | else |
| 138 | TESTBFDLIB="../bfd/.libs/libbfd.a" |
| 139 | fi |
| 140 | AC_SUBST(TESTBFDLIB) |
| 141 | |
| 142 | AC_OUTPUT(Makefile po/Makefile.in:po/Make-in, |
| 143 | [sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile]) |