Commit | Line | Data |
---|---|---|
8c693660 KR |
1 | AC_PREREQ(2.3) |
2 | AC_INIT(libbfd.c) | |
3 | ||
4 | AC_ARG_ENABLE(64-bit-bfd, | |
e818c22e | 5 | [ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], |
8c693660 KR |
6 | [case "{$enableval}" in |
7 | yes) want64=true ;; | |
8 | no) want64=false ;; | |
9 | *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; | |
10 | esac],[want64=false])dnl | |
11 | AC_ARG_ENABLE(targets, | |
e818c22e | 12 | [ --enable-targets alternative target configurations], |
8c693660 KR |
13 | [case "${enableval}" in |
14 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') | |
15 | ;; | |
16 | no) enable_targets= ;; | |
17 | *) enable_targets=$enableval ;; | |
18 | esac])dnl | |
19 | ||
20 | AC_CONFIG_AUX_DIR(`cd $srcdir/..;pwd`) | |
21 | AC_CANONICAL_SYSTEM | |
22 | if test -z "$target" ; then | |
23 | AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) | |
24 | fi | |
25 | AC_ARG_PROGRAM | |
26 | ||
b32ae8e2 JK |
27 | host64=false |
28 | target64=false | |
21c9f626 | 29 | |
8c693660 | 30 | # host stuff: |
21c9f626 | 31 | |
5a5fa368 | 32 | . ${srcdir}/configure.host |
4dfe09da | 33 | |
8c693660 KR |
34 | AC_PROG_RANLIB |
35 | ||
5b2765bf | 36 | # Set up to make a link between the host's include file and "sysdep.h". |
8c693660 | 37 | files=hosts/${my_host}.h |
5b2765bf | 38 | |
8c693660 | 39 | if test ! -f ${srcdir}/${files} ; then |
0e238aa7 | 40 | files=../bfd/hosts/std-host.h |
8c693660 | 41 | AC_MSG_WARN(BFD has no specific support for host ${host} -- using std-host) |
21c9f626 RP |
42 | fi |
43 | ||
8c693660 KR |
44 | AC_LINK_FILES($files, sysdep.h) |
45 | ||
46 | if test -f ${srcdir}/config/${my_host}.mh ; then | |
47 | host_makefile_frag=$srcdir/config/${my_host}.mh | |
48 | else | |
49 | host_makefile_frag=/dev/null | |
5b2765bf | 50 | fi |
8c693660 | 51 | AC_SUBST_FILE(host_makefile_frag) |
4dfe09da | 52 | |
8c693660 | 53 | # target stuff: |
21c9f626 | 54 | |
180acef5 | 55 | # Canonicalize the secondary target names. |
8c693660 | 56 | if test -n "$enable_targets" ; then |
318b02b6 | 57 | for targ in `echo $enable_targets | sed 's/,/ /g'` |
180acef5 | 58 | do |
9525b61b | 59 | result=`$ac_config_sub $targ 2>/dev/null` |
8c693660 | 60 | if test -n "$result" ; then |
180acef5 DM |
61 | canon_targets="$canon_targets $result" |
62 | else | |
63 | # Allow targets that config.sub doesn't recognize, like "all". | |
64 | canon_targets="$canon_targets $targ" | |
65 | fi | |
66 | done | |
67 | fi | |
5f9a2245 DM |
68 | |
69 | all_targets=false | |
180acef5 DM |
70 | |
71 | for targ in $target $canon_targets | |
5f9a2245 | 72 | do |
ec35a1c2 | 73 | bfd_target=`${config_shell} $srcdir/config.bfd $targ` |
180acef5 | 74 | |
8c693660 | 75 | if test "x$bfd_target" = "xall" ; then |
5f9a2245 DM |
76 | all_targets=true |
77 | else | |
8c693660 KR |
78 | if test ! -f ${srcdir}/config/${bfd_target}.mt ; then |
79 | AC_MSG_ERROR(*** No file ${srcdir}/config/${bfd_target}.mt. | |
80 | *** BFD does not support target ${bfd_target}. | |
81 | *** Look in bfd/config.bfd for supported targets.) | |
5f9a2245 | 82 | exit 1 |
5b2765bf | 83 | fi |
4dfe09da | 84 | |
8c693660 | 85 | if test "x$targ" = "x$target" ; then |
180acef5 | 86 | target_makefile_frag=${srcdir}/config/${bfd_target}.mt |
5f9a2245 | 87 | else |
180acef5 | 88 | target_extra_frags="$target_extra_frags ${srcdir}/config/${bfd_target}.mt" |
5f9a2245 DM |
89 | fi |
90 | fi | |
91 | done | |
92 | ||
8c693660 KR |
93 | frags=$target_makefile_frag |
94 | if test $host_makefile_frag != /dev/null ; then | |
95 | frags="$frags $host_makefile_frag" | |
96 | fi | |
97 | AC_SUBST_FILE(target_makefile_frag) | |
98 | AC_SUBST(frags) | |
b32ae8e2 | 99 | |
ffe26398 KR |
100 | # This processing still needs to be done if we're to decide properly whether |
101 | # 64-bit support needs to be compiled in. Currently, it will be included if | |
102 | # the default or any other explicitly requested target requires it; it | |
103 | # will not be included on a 32-bit host if no 64-bit target is requested, and | |
104 | # no "--with-64-bit-bfd" option is given, even if "--with-targets=all" is | |
105 | # used. | |
106 | ||
8c693660 | 107 | changequote(,)dnl |
5f9a2245 DM |
108 | # The default vector in the primary target. |
109 | DEFAULT_VECTOR=`sed -n ' | |
110 | s/DEFAULT_VECTOR[ ]*=[ ]*\([^ ]*\)/\1/p | |
111 | ' $target_makefile_frag` | |
112 | ||
ffe26398 | 113 | allfrags="$target_makefile_frag $target_extra_frags" |
5f9a2245 | 114 | |
ffe26398 KR |
115 | # The default and selected vectors in all the configured targets. |
116 | SELECT_VECS=`sed -n ' | |
117 | s/DEFAULT_VECTOR[ ]*=[ ]*\([^ ]*\)/\1/p | |
118 | s/SELECT_VECS[ ]*=[ ]*\([^ ]*\)/\1/p | |
119 | ' $allfrags` | |
120 | # uniq the list. | |
121 | f="" | |
122 | for i in $SELECT_VECS ; do | |
123 | case " $f " in | |
124 | *" $i "*) ;; | |
125 | *) f="$f $i" ;; | |
126 | esac | |
127 | done | |
128 | SELECT_VECS="$f" | |
129 | ||
130 | # The architectures in all the configured targets. | |
131 | SELECT_ARCHITECTURES=`sed -n ' | |
132 | s/SELECT_ARCHITECTURES[ ]*=[ ]*//p | |
133 | ' $allfrags` | |
134 | # uniq the list. | |
135 | f="" | |
136 | for i in $SELECT_ARCHITECTURES ; do | |
137 | case " $f " in | |
138 | *" $i "*) ;; | |
139 | *) f="$f $i" ;; | |
140 | esac | |
141 | done | |
142 | SELECT_ARCHITECTURES="$f" | |
8c693660 | 143 | changequote([,])dnl |
5f9a2245 | 144 | |
ffe26398 KR |
145 | # Target backend .o files. |
146 | tb= | |
147 | ||
148 | for vec in $SELECT_VECS | |
149 | do | |
150 | case "$vec" in | |
151 | # This list is alphabetized to make it easy to compare | |
152 | # with the two vector lists in targets.c. | |
69645d10 | 153 | a29kcoff_big_vec) tb="$tb coff-a29k.o cofflink.o" ;; |
ffe26398 | 154 | a_out_adobe_vec) tb="$tb aout-adobe.o aout32.o stab-syms.o" ;; |
8c693660 KR |
155 | armpe_vec) tb="$tb pe-arm.o cofflink.o " ;; |
156 | armpei_vec) tb="$tb pei-arm.o cofflink.o " ;; | |
4f9617ca | 157 | aout0_big_vec) tb="$tb aout0.o aout32.o stab-syms.o" ;; |
8c693660 KR |
158 | aout_arm_big_vec) tb="$tb aout-arm.o aout32.o stab-syms.o" ;; |
159 | aout_arm_little_vec) tb="$tb aout-arm.o aout32.o stab-syms.o" ;; | |
ffe26398 KR |
160 | aout_mips_big_vec) tb="$tb mipsbsd.o aout32.o stab-syms.o" ;; |
161 | aout_mips_little_vec) tb="$tb mipsbsd.o aout32.o stab-syms.o" ;; | |
2487f88f | 162 | apollocoff_vec) tb="$tb coff-apollo.o" ;; |
ffe26398 KR |
163 | b_out_vec_big_host) tb="$tb bout.o aout32.o stab-syms.o" ;; |
164 | b_out_vec_little_host) tb="$tb bout.o aout32.o stab-syms.o" ;; | |
c7b44b04 MM |
165 | # start-sanitize-arc |
166 | bfd_elf32_littlearc_vec) tb="$tb elf32-arc.o elf32.o elf.o" ;; | |
167 | bfd_elf32_bigarc_vec) tb="$tb elf32-arc.o elf32.o elf.o" ;; | |
168 | # end-sanitize-arc | |
ffe26398 | 169 | bfd_elf32_big_generic_vec) tb="$tb elf32-gen.o elf32.o elf.o" ;; |
c7b44b04 | 170 | bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o elf.o ecofflink.o" ;; |
ffe26398 KR |
171 | bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o elf.o" ;; |
172 | bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o elf.o" ;; | |
173 | bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o elf.o" ;; | |
174 | bfd_elf32_little_generic_vec) tb="$tb elf32-gen.o elf32.o elf.o" ;; | |
c7b44b04 | 175 | bfd_elf32_littlemips_vec) tb="$tb elf32-mips.o elf32.o elf.o ecofflink.o" ;; |
ffe26398 KR |
176 | bfd_elf32_m68k_vec) tb="$tb elf32-m68k.o elf32.o elf.o" ;; |
177 | bfd_elf32_m88k_vec) tb="$tb elf32-m88k.o elf32.o elf.o" ;; | |
4f9617ca | 178 | bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.o elf32.o elf.o" ;; |
c7b44b04 | 179 | bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.o elf32.o elf.o" ;; |
ffe26398 KR |
180 | bfd_elf32_sparc_vec) tb="$tb elf32-sparc.o elf32.o elf.o" ;; |
181 | bfd_elf64_big_generic_vec) tb="$tb elf64-gen.o elf64.o elf.o" | |
7adbe989 | 182 | target64=true ;; |
ffe26398 | 183 | bfd_elf64_little_generic_vec) tb="$tb elf64-gen.o elf64.o elf.o" |
7adbe989 | 184 | target64=true ;; |
ffe26398 | 185 | bfd_elf64_sparc_vec) tb="$tb elf64-sparc.o elf64.o elf.o" |
7adbe989 | 186 | target64=true ;; |
4f9617ca | 187 | cisco_core_vec) tb="$tb cisco-core.o" ;; |
ffe26398 | 188 | demo_64_vec) tb="$tb demo64.o aout64.o stab-syms.o" |
7adbe989 | 189 | target64=true ;; |
318b02b6 KR |
190 | ecoff_big_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; |
191 | ecoff_little_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; | |
192 | ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o" | |
5dac2dd5 | 193 | target64=true ;; |
ffe26398 KR |
194 | h8300coff_vec) tb="$tb coff-h8300.o reloc16.o" ;; |
195 | h8500coff_vec) tb="$tb coff-h8500.o reloc16.o" ;; | |
196 | host_aout_vec) tb="$tb host-aout.o aout32.o stab-syms.o" ;; | |
197 | hp300bsd_vec) tb="$tb hp300bsd.o aout32.o stab-syms.o" ;; | |
198 | hp300hpux_vec) tb="$tb hp300hpux.o aout32.o stab-syms.o" ;; | |
ffe26398 KR |
199 | i386aout_vec) tb="$tb i386aout.o aout32.o stab-syms.o" ;; |
200 | i386bsd_vec) tb="$tb i386bsd.o aout32.o stab-syms.o" ;; | |
4f9617ca | 201 | i386dynix_vec) tb="$tb i386dynix.o aout32.o stab-syms.o" ;; |
bd23b552 | 202 | i386coff_vec) tb="$tb coff-i386.o cofflink.o" ;; |
c7b44b04 | 203 | i386msdos_vec) tb="$tb i386msdos.o" ;; |
8c693660 KR |
204 | i386pe_vec) tb="$tb pe-i386.o cofflink.o " ;; |
205 | i386pei_vec) tb="$tb pei-i386.o cofflink.o" ;; | |
ffe26398 | 206 | i386linux_vec) tb="$tb i386linux.o aout32.o stab-syms.o" ;; |
48ee0757 | 207 | i386lynx_aout_vec) tb="$tb i386lynx.o lynx-core.o aout32.o stab-syms.o" ;; |
bd23b552 | 208 | i386lynx_coff_vec) tb="$tb cf-i386lynx.o cofflink.o lynx-core.o stab-syms.o" ;; |
5dac2dd5 | 209 | i386mach3_vec) tb="$tb i386mach3.o aout32.o stab-syms.o" ;; |
a3f7a777 | 210 | i386netbsd_vec) tb="$tb i386netbsd.o aout32.o stab-syms.o" ;; |
85cc33c7 | 211 | i386os9k_vec) tb="$tb i386os9k.o aout32.o stab-syms.o" ;; |
ffe26398 KR |
212 | icoff_big_vec) tb="$tb coff-i960.o" ;; |
213 | icoff_little_vec) tb="$tb coff-i960.o" ;; | |
214 | ieee_vec) tb="$tb ieee.o" ;; | |
bd23b552 ILT |
215 | m68kcoff_vec) tb="$tb coff-m68k.o cofflink.o" ;; |
216 | m68kcoffun_vec) tb="$tb coff-u68k.o coff-m68k.o cofflink.o" ;; | |
48ee0757 | 217 | m68klynx_aout_vec) tb="$tb m68klynx.o lynx-core.o aout32.o stab-syms.o" ;; |
bd23b552 | 218 | m68klynx_coff_vec) tb="$tb cf-m68klynx.o coff-m68k.o cofflink.o lynx-core.o stab-syms.o" ;; |
ec35a1c2 | 219 | m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o stab-syms.o" ;; |
ffe26398 KR |
220 | m88kbcs_vec) tb="$tb coff-m88k.o" ;; |
221 | newsos3_vec) tb="$tb newsos3.o aout32.o stab-syms.o" ;; | |
ffe26398 | 222 | nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;; |
5dac2dd5 | 223 | nlm32_sparc_vec) tb="$tb nlm32-sparc.o nlm32.o nlm.o" ;; |
85cc33c7 | 224 | nlm32_alpha_vec) tb="$tb nlm32-alpha.o nlm32.o nlm.o" |
7adbe989 | 225 | target64=true ;; |
318b02b6 | 226 | riscix_vec) tb="$tb aout32.o riscix.o stab-syms.o" ;; |
4f9617ca | 227 | nlm32_powerpc_vec) tb="$tb nlm32-ppc.o nlm32.o nlm.o" ;; |
7a1d4567 | 228 | pc532netbsd_vec) tb="$tb ns32knetbsd.o aout-ns32k.o stab-syms.o" ;; |
318b02b6 | 229 | pc532machaout_vec) tb="$tb pc532-mach.o aout-ns32k.o stab-syms.o" ;; |
ffe26398 | 230 | rs6000coff_vec) tb="$tb coff-rs6000.o" ;; |
ec35a1c2 | 231 | shcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; |
03c4ce2f | 232 | # start-sanitize-rce |
fb870b50 | 233 | rce_aout_vec) tb="$tb aout-rce.o aout32.o stab-syms.o" ;; |
03c4ce2f | 234 | # end-sanitize-rce |
7a1d4567 | 235 | shlcoff_vec) tb="$tb coff-sh.o cofflink.o" ;; |
318b02b6 | 236 | som_vec) tb="$tb som.o" ;; |
c9368a3b SS |
237 | sparclynx_aout_vec) tb="$tb sparclynx.o lynx-core.o aout32.o stab-syms.o" ;; |
238 | sparclynx_coff_vec) tb="$tb cf-sparclynx.o lynx-core.o stab-syms.o" ;; | |
a3f7a777 | 239 | sparcnetbsd_vec) tb="$tb sparcnetbsd.o aout32.o stab-syms.o" ;; |
6a6676fb | 240 | sparccoff_vec) tb="$tb coff-sparc.o" ;; |
318b02b6 | 241 | srec_vec) tb="$tb srec.o" ;; |
ffe26398 | 242 | sunos_big_vec) tb="$tb sunos.o aout32.o stab-syms.o" ;; |
318b02b6 | 243 | symbolsrec_vec) tb="$tb srec.o" ;; |
ffe26398 KR |
244 | tekhex_vec) tb="$tb tekhex.o" ;; |
245 | we32kcoff_vec) tb="$tb coff-we32k.o" ;; | |
246 | z8kcoff_vec) tb="$tb coff-z8k.o reloc16.o" ;; | |
c7b44b04 | 247 | w65_vec) tb="$tb coff-w65.o reloc16.o" ;; |
8c693660 | 248 | versados_vec) tb="$tb versados.o" ;; |
ffe26398 | 249 | |
ffe26398 | 250 | "") ;; |
8c693660 | 251 | *) AC_MSG_ERROR(*** unknown target vector $vec) ;; |
ffe26398 KR |
252 | esac |
253 | done | |
5f9a2245 | 254 | |
ffe26398 KR |
255 | # Target architecture .o files. |
256 | ta=`echo $SELECT_ARCHITECTURES | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g` | |
5f9a2245 | 257 | |
ffe26398 KR |
258 | # Weed out duplicate .o files. |
259 | f="" | |
260 | for i in $tb ; do | |
261 | case " $f " in | |
262 | *" $i "*) ;; | |
263 | *) f="$f $i" ;; | |
264 | esac | |
265 | done | |
266 | tb="$f" | |
267 | ||
268 | f="" | |
269 | for i in $ta ; do | |
270 | case " $f " in | |
271 | *" $i "*) ;; | |
272 | *) f="$f $i" ;; | |
273 | esac | |
274 | done | |
275 | ta="$f" | |
5f9a2245 | 276 | |
ffe26398 KR |
277 | bfd_backends="$tb" |
278 | bfd_machines="$ta" | |
5f9a2245 | 279 | |
8c693660 | 280 | if test x${all_targets} = xtrue ; then |
ffe26398 KR |
281 | bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)' |
282 | bfd_machines="${bfd_machines}"' $(ALL_MACHINES)' | |
cede9731 PS |
283 | else # all_targets is true |
284 | # Only set these if they will be nonempty, for the clever echo. | |
285 | test -n "$SELECT_VECS" && | |
286 | selvecs=`echo $SELECT_VECS | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'` | |
287 | test -n "SELECT_ARCHITECTURES" && | |
288 | selarchs=`echo $SELECT_ARCHITECTURES | sed -e 's/ \(.\)/,\1/g'` | |
5f9a2245 DM |
289 | fi # all_targets is true |
290 | ||
7adbe989 KR |
291 | case ${host64}-${target64}-${want64} in |
292 | *true*) | |
293 | wordsize=64 | |
294 | all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)' | |
295 | ;; | |
296 | false-false-false) | |
297 | wordsize=32 | |
298 | all_backends='$(BFD32_BACKENDS)' | |
299 | ;; | |
300 | esac | |
301 | ||
8c693660 KR |
302 | AC_SUBST(wordsize) |
303 | AC_SUBST(all_backends) | |
304 | AC_SUBST(bfd_backends) | |
305 | AC_SUBST(bfd_machines) | |
7adbe989 | 306 | |
5f9a2245 DM |
307 | test -n "$DEFAULT_VECTOR" && defvec="$DEFAULT_VECTOR" |
308 | ||
8c693660 | 309 | tdefaults="" |
c7b44b04 MM |
310 | test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}" |
311 | test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'" | |
312 | test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'" | |
8c693660 | 313 | AC_SUBST(tdefaults) |
c812942f | 314 | |
8c693660 KR |
315 | rm -f doc/config.status |
316 | AC_OUTPUT(Makefile doc/Makefile) |