| 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.8.2) |
| 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 | AM_CYGWIN32 |
| 42 | AM_EXEEXT |
| 43 | |
| 44 | AC_PROG_YACC |
| 45 | AC_PROG_LEX |
| 46 | AC_DECL_YYTEXT |
| 47 | |
| 48 | AM_MAINTAINER_MODE |
| 49 | |
| 50 | . ${srcdir}/configure.host |
| 51 | |
| 52 | AC_SUBST(HDEFINES) |
| 53 | AC_SUBST(HOSTING_CRT0) |
| 54 | AC_SUBST(HOSTING_LIBS) |
| 55 | AC_SUBST(NATIVE_LIB_DIRS) |
| 56 | |
| 57 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) |
| 58 | AC_CHECK_FUNCS(sbrk) |
| 59 | AC_HEADER_DIRENT |
| 60 | |
| 61 | BFD_BINARY_FOPEN |
| 62 | |
| 63 | BFD_NEED_DECLARATION(strstr) |
| 64 | BFD_NEED_DECLARATION(free) |
| 65 | BFD_NEED_DECLARATION(sbrk) |
| 66 | BFD_NEED_DECLARATION(getenv) |
| 67 | |
| 68 | # target-specific stuff: |
| 69 | |
| 70 | all_targets= |
| 71 | EMUL= |
| 72 | all_emuls= |
| 73 | TDIRS= |
| 74 | |
| 75 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` |
| 76 | do |
| 77 | if test "$targ_alias" = "all"; then |
| 78 | all_targets=true |
| 79 | else |
| 80 | # Canonicalize the secondary target names. |
| 81 | result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null` |
| 82 | if test -n "$result"; then |
| 83 | targ=$result |
| 84 | else |
| 85 | targ=$targ_alias |
| 86 | fi |
| 87 | |
| 88 | . ${srcdir}/configure.tgt |
| 89 | |
| 90 | if test "$targ" = "$target"; then |
| 91 | EMUL=$targ_emul |
| 92 | fi |
| 93 | |
| 94 | for i in $targ_emul $targ_extra_emuls; do |
| 95 | case " $all_emuls " in |
| 96 | *" e${i}.o "*) ;; |
| 97 | *) |
| 98 | all_emuls="$all_emuls e${i}.o" |
| 99 | eval result=\$tdir_$i |
| 100 | test -z "$result" && result=$targ_alias |
| 101 | TDIRS="$TDIRS\\ |
| 102 | tdir_$i=$result" |
| 103 | ;; |
| 104 | esac |
| 105 | done |
| 106 | fi |
| 107 | done |
| 108 | |
| 109 | AC_SUBST(EMUL) |
| 110 | AC_SUBST(TDIRS) |
| 111 | |
| 112 | dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit |
| 113 | dnl target, and in those cases we should also build the 64 bit |
| 114 | dnl emulations. |
| 115 | if test x${all_targets} = xtrue; then |
| 116 | if test x${want64} = xtrue; then |
| 117 | EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' |
| 118 | else |
| 119 | EMULATION_OFILES='$(ALL_EMULATIONS)' |
| 120 | fi |
| 121 | else |
| 122 | EMULATION_OFILES=$all_emuls |
| 123 | fi |
| 124 | AC_SUBST(EMULATION_OFILES) |
| 125 | |
| 126 | AC_OUTPUT(Makefile) |