* configure.in: For a native configuration, set COREFILE and
[binutils-gdb.git] / bfd / configure.in
1 AC_PREREQ(2.3)
2 AC_INIT(libbfd.c)
3
4 AC_ARG_ENABLE(64-bit-bfd,
5 [ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
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,
12 [ --enable-targets alternative target configurations],
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
27 host64=false
28 target64=false
29
30 # host stuff:
31
32 . ${srcdir}/configure.host
33
34 AC_PROG_RANLIB
35
36 # Set up to make a link between the host's include file and "sysdep.h".
37 files=hosts/${my_host}.h
38
39 if test ! -f ${srcdir}/${files} ; then
40 files=../bfd/hosts/std-host.h
41 AC_MSG_WARN(BFD has no specific support for host ${host} -- using std-host)
42 fi
43
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
50 fi
51 AC_SUBST_FILE(host_makefile_frag)
52
53 # If we are configured native, pick a core file support file.
54 COREFILE=
55 COREFLAG=
56 if test "${target}" = "${host}"; then
57 case "${host}" in
58 alpha-*-*) COREFILE=osf-core.o ;;
59 arm-*-riscix) COREFILE=trad-core.o ;;
60 hppa*-*-hpux*) COREFILE=hpux-core.o ;;
61 hppa*-*-hiux*) COREFILE=hpux-core.o ;;
62 hppa*-*-bsd*) COREFILE="hpux-core.o hppabsd-core.o"
63 COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
64 i[345]86-sequent-bsd*) COREFILE=trad-core.o ;;
65 i[345]86-sequent-sysv4*) ;;
66 i[345]86-sequent-sysv*) COREFILE=trad-core.o ;;
67 i[345]86-*-bsd*) COREFILE=trad-core.o ;;
68 i[345]86-*-freebsd*) COREFILE=trad-core.o ;;
69 i[345]86-*-netbsd*) COREFILE=trad-core.o ;;
70 i[345]86-esix-sysv3*) COREFILE=trad-core.o ;;
71 i[345]86-*-sco*) COREFILE=trad-core.o ;;
72 i[345]86-*-mach3*) COREFILE=trad-core.o ;;
73 i[345]86-*-linux*) COREFILE=trad-core.o ;;
74 i[345]86-*-isc*) COREFILE=trad-core.o ;;
75 i[345]86-*-aix*) COREFILE=aix386-core.o ;;
76 mips-dec-bsd*) COREFILE=trad-core.o ;;
77 mips-dec-mach3*) COREFILE=trad-core.o ;;
78 mips-dec-*) COREFILE=trad-core.o ;;
79 mips-sgi-irix4*) COREFILE=irix-core.o ;;
80 mips-sgi-irix5*) COREFILE=irix-core.o ;;
81 mips-*-mach3*) COREFILE=trad-core.o ;;
82 mips-*-sysv4*) ;;
83 mips-*-sysv*) COREFILE=trad-core.o ;;
84 mips-*-riscos*) COREFILE=trad-core.o ;;
85 mips-sony-bsd*) COREFILE=trad-core.o ;;
86 m68*-bull*-sysv*) COREFILE=trad-core.o ;;
87 m68*-hp-hpux*) COREFILE=hpux-core.o ;;
88 m68*-hp-bsd*) COREFILE=trad-core.o ;;
89 m68*-motorola-sysv*) COREFILE=ptrace-core.o ;;
90 m68*-sony-*) COREFILE=trad-core.o ;;
91 m88*-*-sysv4*) ;;
92 m88*-motorola-sysv*) COREFILE=trad-core.o ;;
93 m88*-*-mach3*) COREFILE=trad-core.o ;;
94 ns32k-pc532-mach) COREFILE=trad-core.o ;;
95 rs6000-*-lynx*) COREFILE=lynx-core.o ;;
96 rs6000-*-aix4*) COREFILE=rs6000-core.o
97 COREFLAG=-DALTERNATE_AIX_CORE_FORMAT ;;
98 rs6000-*-*) COREFILE=rs6000-core.o ;;
99 powerpc-*-aix4*) COREFILE=rs6000-core.o
100 COREFLAG=-DALTERNATE_AIX_CORE_FORMAT ;;
101 powerpc-*-aix*) COREFILE=rs6000-core.o ;;
102 tahoe-*-*) COREFILE=trad-core.o ;;
103 vax-*-ultrix2*) COREFILE=trad-core.o ;;
104 vax-*-ultrix*) COREFILE=trad-core.o ;;
105 vax-*-*) COREFILE=trad-core.o ;;
106 esac
107
108 case "$COREFILE" in
109 aix386-core.o) COREFLAG=-DAIX386_CORE ;;
110 hppabsd-core.o) COREFLAG=-DHPPABSD_CORE ;;
111 hpux-core.o) COREFLAG=-DHPUX_CORE ;;
112 irix-core.o) COREFLAG=-DIRIX_CORE ;;
113 lynx-core.o) COREFLAG=-DLYNX_CORE ;;
114 osf-core.o) COREFLAG=-DOSF_CORE ;;
115 ptrace-core.o) COREFLAG=-DPTRACE_CORE ;;
116 rs6000-core.o) COREFLAG="$COREFLAG -DAIX_CORE" ;;
117 trad-core.o) COREFLAG=-DTRAD_CORE ;;
118 esac
119 fi
120 AC_SUBST(COREFILE)
121 AC_SUBST(COREFLAG)
122
123 # target stuff:
124
125 # Canonicalize the secondary target names.
126 if test -n "$enable_targets" ; then
127 for targ in `echo $enable_targets | sed 's/,/ /g'`
128 do
129 result=`$ac_config_sub $targ 2>/dev/null`
130 if test -n "$result" ; then
131 canon_targets="$canon_targets $result"
132 else
133 # Allow targets that config.sub doesn't recognize, like "all".
134 canon_targets="$canon_targets $targ"
135 fi
136 done
137 fi
138
139 all_targets=false
140
141 for targ in $target $canon_targets
142 do
143 bfd_target=`${config_shell} $srcdir/config.bfd $targ`
144
145 if test "x$bfd_target" = "xall" ; then
146 all_targets=true
147 else
148 if test ! -f ${srcdir}/config/${bfd_target}.mt ; then
149 AC_MSG_ERROR(*** No file ${srcdir}/config/${bfd_target}.mt.
150 *** BFD does not support target ${bfd_target}.
151 *** Look in bfd/config.bfd for supported targets.)
152 exit 1
153 fi
154
155 if test "x$targ" = "x$target" ; then
156 target_makefile_frag=${srcdir}/config/${bfd_target}.mt
157 else
158 target_extra_frags="$target_extra_frags ${srcdir}/config/${bfd_target}.mt"
159 fi
160 fi
161 done
162
163 frags=$target_makefile_frag
164 if test $host_makefile_frag != /dev/null ; then
165 frags="$frags $host_makefile_frag"
166 fi
167 AC_SUBST_FILE(target_makefile_frag)
168 AC_SUBST(frags)
169
170 # This processing still needs to be done if we're to decide properly whether
171 # 64-bit support needs to be compiled in. Currently, it will be included if
172 # the default or any other explicitly requested target requires it; it
173 # will not be included on a 32-bit host if no 64-bit target is requested, and
174 # no "--with-64-bit-bfd" option is given, even if "--with-targets=all" is
175 # used.
176
177 changequote(,)dnl
178 # The default vector in the primary target.
179 DEFAULT_VECTOR=`sed -n '
180 s/DEFAULT_VECTOR[ ]*=[ ]*\([^ ]*\)/\1/p
181 ' $target_makefile_frag`
182
183 allfrags="$target_makefile_frag $target_extra_frags"
184
185 # The default and selected vectors in all the configured targets.
186 SELECT_VECS=`sed -n '
187 s/DEFAULT_VECTOR[ ]*=[ ]*\([^ ]*\)/\1/p
188 s/SELECT_VECS[ ]*=[ ]*\([^ ]*\)/\1/p
189 ' $allfrags`
190 # uniq the list.
191 f=""
192 for i in $SELECT_VECS ; do
193 case " $f " in
194 *" $i "*) ;;
195 *) f="$f $i" ;;
196 esac
197 done
198 SELECT_VECS="$f"
199
200 # The architectures in all the configured targets.
201 SELECT_ARCHITECTURES=`sed -n '
202 s/SELECT_ARCHITECTURES[ ]*=[ ]*//p
203 ' $allfrags`
204 # uniq the list.
205 f=""
206 for i in $SELECT_ARCHITECTURES ; do
207 case " $f " in
208 *" $i "*) ;;
209 *) f="$f $i" ;;
210 esac
211 done
212 SELECT_ARCHITECTURES="$f"
213 changequote([,])dnl
214
215 # Target backend .o files.
216 tb=
217
218 elf="elf.o elflink.o"
219
220 for vec in $SELECT_VECS
221 do
222 case "$vec" in
223 # This list is alphabetized to make it easy to compare
224 # with the two vector lists in targets.c.
225 a29kcoff_big_vec) tb="$tb coff-a29k.o cofflink.o" ;;
226 a_out_adobe_vec) tb="$tb aout-adobe.o aout32.o stab-syms.o" ;;
227 armpe_little_vec) tb="$tb pe-arm.o cofflink.o " ;;
228 armpe_big_vec) tb="$tb pe-arm.o cofflink.o " ;;
229 armpei_little_vec) tb="$tb pei-arm.o cofflink.o " ;;
230 armpei_big_vec) tb="$tb pei-arm.o cofflink.o " ;;
231 aout0_big_vec) tb="$tb aout0.o aout32.o stab-syms.o" ;;
232 aout_arm_big_vec) tb="$tb aout-arm.o aout32.o stab-syms.o" ;;
233 aout_arm_little_vec) tb="$tb aout-arm.o aout32.o stab-syms.o" ;;
234 aout_mips_big_vec) tb="$tb mipsbsd.o aout32.o stab-syms.o" ;;
235 aout_mips_little_vec) tb="$tb mipsbsd.o aout32.o stab-syms.o" ;;
236 apollocoff_vec) tb="$tb coff-apollo.o" ;;
237 b_out_vec_big_host) tb="$tb bout.o aout32.o stab-syms.o" ;;
238 b_out_vec_little_host) tb="$tb bout.o aout32.o stab-syms.o" ;;
239 # start-sanitize-arc
240 bfd_elf32_littlearc_vec) tb="$tb elf32-arc.o elf32.o $elf" ;;
241 bfd_elf32_bigarc_vec) tb="$tb elf32-arc.o elf32.o $elf" ;;
242 # end-sanitize-arc
243 bfd_elf32_big_generic_vec) tb="$tb elf32-gen.o elf32.o $elf" ;;
244 bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;;
245 bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o $elf" ;;
246 bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o $elf" ;;
247 bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o $elf" ;;
248 bfd_elf32_little_generic_vec) tb="$tb elf32-gen.o elf32.o $elf" ;;
249 bfd_elf32_littlemips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;;
250 bfd_elf32_m68k_vec) tb="$tb elf32-m68k.o elf32.o $elf" ;;
251 bfd_elf32_m88k_vec) tb="$tb elf32-m88k.o elf32.o $elf" ;;
252 bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;;
253 bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.o elf32.o $elf" ;;
254 bfd_elf32_sparc_vec) tb="$tb elf32-sparc.o elf32.o $elf" ;;
255 bfd_elf64_big_generic_vec) tb="$tb elf64-gen.o elf64.o $elf"
256 target64=true ;;
257 bfd_elf64_little_generic_vec) tb="$tb elf64-gen.o elf64.o $elf"
258 target64=true ;;
259 bfd_elf64_sparc_vec) tb="$tb elf64-sparc.o elf64.o $elf"
260 target64=true ;;
261 cisco_core_vec) tb="$tb cisco-core.o" ;;
262 demo_64_vec) tb="$tb demo64.o aout64.o stab-syms.o"
263 target64=true ;;
264 ecoff_big_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;;
265 ecoff_little_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;;
266 ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o"
267 target64=true ;;
268 h8300coff_vec) tb="$tb coff-h8300.o reloc16.o" ;;
269 h8500coff_vec) tb="$tb coff-h8500.o reloc16.o" ;;
270 host_aout_vec) tb="$tb host-aout.o aout32.o stab-syms.o" ;;
271 hp300bsd_vec) tb="$tb hp300bsd.o aout32.o stab-syms.o" ;;
272 hp300hpux_vec) tb="$tb hp300hpux.o aout32.o stab-syms.o" ;;
273 i386aout_vec) tb="$tb i386aout.o aout32.o stab-syms.o" ;;
274 i386bsd_vec) tb="$tb i386bsd.o aout32.o stab-syms.o" ;;
275 i386dynix_vec) tb="$tb i386dynix.o aout32.o stab-syms.o" ;;
276 i386coff_vec) tb="$tb coff-i386.o cofflink.o" ;;
277 i386msdos_vec) tb="$tb i386msdos.o" ;;
278 i386pe_vec) tb="$tb pe-i386.o cofflink.o " ;;
279 i386pei_vec) tb="$tb pei-i386.o cofflink.o" ;;
280 i386linux_vec) tb="$tb i386linux.o aout32.o stab-syms.o" ;;
281 i386lynx_aout_vec) tb="$tb i386lynx.o lynx-core.o aout32.o stab-syms.o" ;;
282 i386lynx_coff_vec) tb="$tb cf-i386lynx.o cofflink.o lynx-core.o stab-syms.o" ;;
283 i386mach3_vec) tb="$tb i386mach3.o aout32.o stab-syms.o" ;;
284 i386netbsd_vec) tb="$tb i386netbsd.o aout32.o stab-syms.o" ;;
285 i386os9k_vec) tb="$tb i386os9k.o aout32.o stab-syms.o" ;;
286 icoff_big_vec) tb="$tb coff-i960.o" ;;
287 icoff_little_vec) tb="$tb coff-i960.o" ;;
288 ieee_vec) tb="$tb ieee.o" ;;
289 m68kcoff_vec) tb="$tb coff-m68k.o cofflink.o" ;;
290 m68kcoffun_vec) tb="$tb coff-u68k.o coff-m68k.o cofflink.o" ;;
291 m68klynx_aout_vec) tb="$tb m68klynx.o lynx-core.o aout32.o stab-syms.o" ;;
292 m68klynx_coff_vec) tb="$tb cf-m68klynx.o coff-m68k.o cofflink.o lynx-core.o stab-syms.o" ;;
293 m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o stab-syms.o" ;;
294 m88kbcs_vec) tb="$tb coff-m88k.o" ;;
295 newsos3_vec) tb="$tb newsos3.o aout32.o stab-syms.o" ;;
296 nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;;
297 nlm32_sparc_vec) tb="$tb nlm32-sparc.o nlm32.o nlm.o" ;;
298 nlm32_alpha_vec) tb="$tb nlm32-alpha.o nlm32.o nlm.o"
299 target64=true ;;
300 riscix_vec) tb="$tb aout32.o riscix.o stab-syms.o" ;;
301 nlm32_powerpc_vec) tb="$tb nlm32-ppc.o nlm32.o nlm.o" ;;
302 pc532netbsd_vec) tb="$tb ns32knetbsd.o aout-ns32k.o stab-syms.o" ;;
303 pc532machaout_vec) tb="$tb pc532-mach.o aout-ns32k.o stab-syms.o" ;;
304 rs6000coff_vec) tb="$tb coff-rs6000.o" ;;
305 shcoff_vec) tb="$tb coff-sh.o cofflink.o" ;;
306 # start-sanitize-rce
307 rce_aout_vec) tb="$tb aout-rce.o aout32.o stab-syms.o" ;;
308 # end-sanitize-rce
309 shlcoff_vec) tb="$tb coff-sh.o cofflink.o" ;;
310 som_vec) tb="$tb som.o" ;;
311 sparclynx_aout_vec) tb="$tb sparclynx.o lynx-core.o aout32.o stab-syms.o" ;;
312 sparclynx_coff_vec) tb="$tb cf-sparclynx.o lynx-core.o stab-syms.o" ;;
313 sparcnetbsd_vec) tb="$tb sparcnetbsd.o aout32.o stab-syms.o" ;;
314 sparccoff_vec) tb="$tb coff-sparc.o" ;;
315 srec_vec) tb="$tb srec.o" ;;
316 sunos_big_vec) tb="$tb sunos.o aout32.o stab-syms.o" ;;
317 symbolsrec_vec) tb="$tb srec.o" ;;
318 tekhex_vec) tb="$tb tekhex.o" ;;
319 we32kcoff_vec) tb="$tb coff-we32k.o" ;;
320 z8kcoff_vec) tb="$tb coff-z8k.o reloc16.o" ;;
321 w65_vec) tb="$tb coff-w65.o reloc16.o" ;;
322 versados_vec) tb="$tb versados.o" ;;
323
324 "") ;;
325 *) AC_MSG_ERROR(*** unknown target vector $vec) ;;
326 esac
327 done
328
329 # Target architecture .o files.
330 ta=`echo $SELECT_ARCHITECTURES | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g`
331
332 # Weed out duplicate .o files.
333 f=""
334 for i in $tb ; do
335 case " $f " in
336 *" $i "*) ;;
337 *) f="$f $i" ;;
338 esac
339 done
340 tb="$f"
341
342 f=""
343 for i in $ta ; do
344 case " $f " in
345 *" $i "*) ;;
346 *) f="$f $i" ;;
347 esac
348 done
349 ta="$f"
350
351 bfd_backends="$tb"
352 bfd_machines="$ta"
353
354 if test x${all_targets} = xtrue ; then
355 bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)'
356 bfd_machines="${bfd_machines}"' $(ALL_MACHINES)'
357 else # all_targets is true
358 # Only set these if they will be nonempty, for the clever echo.
359 test -n "$SELECT_VECS" &&
360 selvecs=`echo $SELECT_VECS | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
361 test -n "SELECT_ARCHITECTURES" &&
362 selarchs=`echo $SELECT_ARCHITECTURES | sed -e 's/ \(.\)/,\1/g'`
363 fi # all_targets is true
364
365 case ${host64}-${target64}-${want64} in
366 *true*)
367 wordsize=64
368 all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
369 ;;
370 false-false-false)
371 wordsize=32
372 all_backends='$(BFD32_BACKENDS)'
373 ;;
374 esac
375
376 AC_SUBST(wordsize)
377 AC_SUBST(all_backends)
378 AC_SUBST(bfd_backends)
379 AC_SUBST(bfd_machines)
380
381 test -n "$DEFAULT_VECTOR" && defvec="$DEFAULT_VECTOR"
382
383 tdefaults=""
384 test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}"
385 test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'"
386 test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'"
387 AC_SUBST(tdefaults)
388
389 rm -f doc/config.status
390 AC_OUTPUT(Makefile doc/Makefile)