Commit | Line | Data |
---|---|---|
ef346f1a ILT |
1 | dnl Process this file with autoconf to produce a configure script |
2 | dnl | |
b9a5c27f | 3 | AC_PREREG(2.5) |
ef346f1a ILT |
4 | AC_INIT(ldmain.c) |
5 | ||
49c009b5 ILT |
6 | AC_CANONICAL_SYSTEM |
7 | ||
0d3e84dd | 8 | AM_INIT_AUTOMAKE(ld, 2.9.1) |
49c009b5 ILT |
9 | |
10 | AM_PROG_LIBTOOL | |
11 | ||
ef346f1a ILT |
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 | |
b9a5c27f RS |
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 | |
ef346f1a | 27 | |
49c009b5 | 28 | AM_CONFIG_HEADER(config.h:config.in) |
ef346f1a | 29 | |
ef346f1a ILT |
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 | |
02757e59 | 36 | |
ef346f1a | 37 | # host-specific stuff: |
02757e59 | 38 | |
7e19f60e | 39 | AC_PROG_CC |
49c009b5 ILT |
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 | |
7e19f60e | 49 | |
ef346f1a | 50 | . ${srcdir}/configure.host |
02757e59 | 51 | |
ef346f1a ILT |
52 | AC_SUBST(HDEFINES) |
53 | AC_SUBST(HOSTING_CRT0) | |
54 | AC_SUBST(HOSTING_LIBS) | |
55 | AC_SUBST(NATIVE_LIB_DIRS) | |
8ddef552 | 56 | |
ef346f1a ILT |
57 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) |
58 | AC_CHECK_FUNCS(sbrk) | |
2e598345 | 59 | AC_HEADER_DIRENT |
ab57b174 | 60 | |
ef346f1a | 61 | BFD_BINARY_FOPEN |
02757e59 | 62 | |
b9a5c27f | 63 | BFD_NEED_DECLARATION(strstr) |
2e598345 | 64 | BFD_NEED_DECLARATION(free) |
b9a5c27f RS |
65 | BFD_NEED_DECLARATION(sbrk) |
66 | BFD_NEED_DECLARATION(getenv) | |
2e598345 | 67 | |
ef346f1a | 68 | # target-specific stuff: |
02757e59 | 69 | |
95d31c3c | 70 | all_targets= |
ef346f1a ILT |
71 | EMUL= |
72 | all_emuls= | |
03abc2bd ILT |
73 | |
74 | dnl We need to get an arbitrary number of tdir definitions into | |
75 | dnl Makefile. We can't do it using AC_SUBST, because autoconf does | |
76 | dnl not permit literal newlines in an AC_SUBST variables. So we use a | |
77 | dnl file. | |
78 | rm -f tdirs | |
1c4b3cda | 79 | |
95d31c3c | 80 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` |
1c4b3cda | 81 | do |
95d31c3c ILT |
82 | if test "$targ_alias" = "all"; then |
83 | all_targets=true | |
84 | else | |
85 | # Canonicalize the secondary target names. | |
b9a5c27f | 86 | result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null` |
95d31c3c ILT |
87 | if test -n "$result"; then |
88 | targ=$result | |
1c4b3cda | 89 | else |
95d31c3c ILT |
90 | targ=$targ_alias |
91 | fi | |
7f2649bb | 92 | |
95d31c3c | 93 | . ${srcdir}/configure.tgt |
ef346f1a | 94 | |
95d31c3c ILT |
95 | if test "$targ" = "$target"; then |
96 | EMUL=$targ_emul | |
1c4b3cda | 97 | fi |
1c4b3cda | 98 | |
95d31c3c ILT |
99 | for i in $targ_emul $targ_extra_emuls; do |
100 | case " $all_emuls " in | |
101 | *" e${i}.o "*) ;; | |
102 | *) | |
103 | all_emuls="$all_emuls e${i}.o" | |
104 | eval result=\$tdir_$i | |
105 | test -z "$result" && result=$targ_alias | |
03abc2bd | 106 | echo tdir_$i=$result >> tdirs |
95d31c3c | 107 | ;; |
1c4b3cda ILT |
108 | esac |
109 | done | |
95d31c3c ILT |
110 | fi |
111 | done | |
1c4b3cda | 112 | |
95d31c3c | 113 | AC_SUBST(EMUL) |
03abc2bd ILT |
114 | |
115 | TDIRS=tdirs | |
116 | AC_SUBST_FILE(TDIRS) | |
1c4b3cda | 117 | |
b9a5c27f RS |
118 | dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit |
119 | dnl target, and in those cases we should also build the 64 bit | |
120 | dnl emulations. | |
95d31c3c | 121 | if test x${all_targets} = xtrue; then |
b9a5c27f RS |
122 | if test x${want64} = xtrue; then |
123 | EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' | |
124 | else | |
125 | EMULATION_OFILES='$(ALL_EMULATIONS)' | |
126 | fi | |
95d31c3c ILT |
127 | else |
128 | EMULATION_OFILES=$all_emuls | |
129 | fi | |
ef346f1a | 130 | AC_SUBST(EMULATION_OFILES) |
8ddef552 | 131 | |
49c009b5 | 132 | AC_OUTPUT(Makefile) |