Reorganized setting of makefile variables so 64-bit stuff works again.
[binutils-gdb.git] / bfd / configure.in
1 # This file is a shell script that supplies the information necessary
2 # to tailor a template configure script into the configure script
3 # appropriate for this directory. For more information, check any
4 # existing configure script.
5
6 configdirs="doc"
7 srctrigger=libbfd.c
8 srcname="BFD"
9 target_dependent=true
10 host64=false
11 target64=false
12 want64=false
13
14 # per-host:
15
16 . ${srcdir}/configure.host
17
18 # Set up to make a link between the host's include file and "sysdep.h".
19 files="hosts/${my_host}.h"
20 links="sysdep.h"
21
22 if [ ! -f ${srcdir}/${files} ] ; then
23 files=../bfd/hosts/std-host.h
24 echo "[${srcname} has no specific support for host ${host} -- using std-host]"
25 fi
26
27 host_makefile_frag=
28 if [ -f ${srcdir}/config/${my_host}.mh ] ; then
29 host_makefile_frag=config/${my_host}.mh
30 fi
31
32 # per-target:
33
34 # Canonicalize the secondary target names.
35 if [ -n "$with_targets" ]; then
36 for targ in `echo $with_targets | sed 's/,/ /g'`
37 do
38 result=`$configsub $targ 2>/dev/null`
39 if [ -n "$result" ]; then
40 canon_targets="$canon_targets $result"
41 else
42 # Allow targets that config.sub doesn't recognize, like "all".
43 canon_targets="$canon_targets $targ"
44 fi
45 done
46 fi
47
48 all_targets=false
49
50 for targ in $target $canon_targets
51 do
52 bfd_target=`$srcdir/config.bfd $targ`
53
54 case "$targ" in
55 netbsd386) bfd_target=i386-netbsd ;;
56 esac
57
58 if [ "x$bfd_target" = "xall" ]; then
59 all_targets=true
60 else
61 if [ ! -f ${srcdir}/config/${bfd_target}.mt ] ; then
62 echo '***' No file ${srcdir}/config/${bfd_target}.mt 1>&2
63 echo '***' BFD does not support target ${bfd_target} 1>&2
64 echo '***' Look in bfd/config.bfd for supported targets 1>&2
65 exit 1
66 fi
67
68 if [ "x$targ" = "x$target" ]; then
69 target_makefile_frag=${srcdir}/config/${bfd_target}.mt
70 else
71 target_extra_frags="$target_extra_frags ${srcdir}/config/${bfd_target}.mt"
72 fi
73 fi
74 done
75
76 # We don't do any links based on the target system, just makefile config.
77
78 # post-target:
79
80 rm -f Makefile.tmp Makefile.2
81 mv Makefile Makefile.tmp
82
83 case ${with_64_bit_bfd} in
84 yes) want64=true ;;
85 no | "") want64=false ;;
86 *)
87 echo "*** bad value \"${with_64_bit_bfd}\" for 64-bit-bfd flag; ignored" 1>&2
88 ;;
89 esac
90
91 # The default vector in the primary target.
92 DEFAULT_VECTOR=`sed -n '
93 s/DEFAULT_VECTOR[ ]*=[ ]*\([^ ]*\)/\1/p
94 ' $target_makefile_frag`
95
96 if [ x${all_targets} = xfalse ]; then
97
98 allfrags="$target_makefile_frag $target_extra_frags"
99
100 # The default and selected vectors in all the configured targets.
101 SELECT_VECS=`sed -n '
102 s/DEFAULT_VECTOR[ ]*=[ ]*\([^ ]*\)/\1/p
103 s/SELECT_VECS[ ]*=[ ]*\([^ ]*\)/\1/p
104 ' $allfrags`
105 # uniq the list.
106 f=""
107 for i in $SELECT_VECS ; do
108 case " $f " in
109 *" $i "*) ;;
110 *) f="$f $i" ;;
111 esac
112 done
113 SELECT_VECS="$f"
114
115 # The architectures in all the configured targets.
116 SELECT_ARCHITECTURES=`sed -n '
117 s/SELECT_ARCHITECTURES[ ]*=[ ]*//p
118 ' $allfrags`
119 # uniq the list.
120 f=""
121 for i in $SELECT_ARCHITECTURES ; do
122 case " $f " in
123 *" $i "*) ;;
124 *) f="$f $i" ;;
125 esac
126 done
127 SELECT_ARCHITECTURES="$f"
128
129 # Target backend .o files.
130 tb=
131
132 for vec in $SELECT_VECS
133 do
134 case "$vec" in
135 # This list is alphabetized to make it easy to compare
136 # with the two vector lists in targets.c.
137 a29kcoff_big_vec) tb="$tb coff-a29k.o" ;;
138 a_out_adobe_vec) tb="$tb aout-adobe.o aout32.o stab-syms.o" ;;
139 aout_mips_big_vec) tb="$tb mipsbsd.o aout32.o stab-syms.o" ;;
140 aout_mips_little_vec) tb="$tb mipsbsd.o aout32.o stab-syms.o" ;;
141 b_out_vec_big_host) tb="$tb bout.o aout32.o stab-syms.o" ;;
142 b_out_vec_little_host) tb="$tb bout.o aout32.o stab-syms.o" ;;
143 bfd_elf32_big_generic_vec) tb="$tb elf32-gen.o elf32.o elf.o" ;;
144 bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o elf.o" ;;
145 bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o elf.o" ;;
146 bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o elf.o" ;;
147 bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o elf.o" ;;
148 bfd_elf32_little_generic_vec) tb="$tb elf32-gen.o elf32.o elf.o" ;;
149 bfd_elf32_littlemips_vec) tb="$tb elf32-mips.o elf32.o elf.o" ;;
150 bfd_elf32_m68k_vec) tb="$tb elf32-m68k.o elf32.o elf.o" ;;
151 bfd_elf32_m88k_vec) tb="$tb elf32-m88k.o elf32.o elf.o" ;;
152 bfd_elf32_sparc_vec) tb="$tb elf32-sparc.o elf32.o elf.o" ;;
153 bfd_elf64_big_generic_vec) tb="$tb elf64-gen.o elf64.o elf.o"
154 target64=true ;;
155 bfd_elf64_little_generic_vec) tb="$tb elf64-gen.o elf64.o elf.o"
156 target64=true ;;
157 # start-sanitize-v9
158 bfd_elf64_sparc_vec) tb="$tb elf64-sparc.o elf64.o elf.o"
159 target64=true ;;
160 # end-sanitize-v9
161 demo_64_vec) tb="$tb demo64.o aout64.o stab-syms.o"
162 target64=true ;;
163 ecoff_big_vec) tb="$tb coff-mips.o" ;;
164 ecoff_little_vec) tb="$tb coff-mips.o" ;;
165 ecoffalpha_little_vec) tb="$tb coff-alpha.o" ;;
166 h8300coff_vec) tb="$tb coff-h8300.o reloc16.o" ;;
167 h8500coff_vec) tb="$tb coff-h8500.o reloc16.o" ;;
168 host_aout_vec) tb="$tb host-aout.o aout32.o stab-syms.o" ;;
169 hp300bsd_vec) tb="$tb hp300bsd.o aout32.o stab-syms.o" ;;
170 hp300hpux_vec) tb="$tb hp300hpux.o aout32.o stab-syms.o" ;;
171 hppa_vec) tb="$tb som.o" ;;
172 i386aout_vec) tb="$tb i386aout.o aout32.o stab-syms.o" ;;
173 i386bsd_vec) tb="$tb i386bsd.o aout32.o stab-syms.o" ;;
174 netbsd386_vec) tb="$tb netbsd386.o aout32.o stab-syms.o" ;;
175 i386coff_vec) tb="$tb coff-i386.o" ;;
176 i386linux_vec) tb="$tb i386linux.o aout32.o stab-syms.o" ;;
177 i386lynx_vec) tb="$tb i386lynx.o aout32.o stab-syms.o" ;;
178 icoff_big_vec) tb="$tb coff-i960.o" ;;
179 icoff_little_vec) tb="$tb coff-i960.o" ;;
180 ieee_vec) tb="$tb ieee.o" ;;
181 m68kcoff_vec) tb="$tb coff-m68k.o" ;;
182 m68kcoffun_vec) tb="$tb coff-u68k.o coff-m68k.o" ;;
183 m88kbcs_vec) tb="$tb coff-m88k.o" ;;
184 newsos3_vec) tb="$tb newsos3.o aout32.o stab-syms.o" ;;
185 nlm32_big_generic_vec) tb="$tb nlm32-gen.o nlm32.o nlm.o" ;;
186 nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;;
187 nlm32_little_generic_vec) tb="$tb nlm32-gen.o nlm32.o nlm.o" ;;
188 nlm64_big_generic_vec) tb="$tb nlm64-gen.o nlm64.o nlm.o"
189 target64=true ;;
190 nlm64_little_generic_vec) tb="$tb nlm64-gen.o nlm64.o nlm.o"
191 target64=true ;;
192 rs6000coff_vec) tb="$tb coff-rs6000.o" ;;
193 shcoff_vec) tb="$tb coff-sh.o reloc16.o" ;;
194 sunos_big_vec) tb="$tb sunos.o aout32.o stab-syms.o" ;;
195 tekhex_vec) tb="$tb tekhex.o" ;;
196 we32kcoff_vec) tb="$tb coff-we32k.o" ;;
197 z8kcoff_vec) tb="$tb coff-z8k.o reloc16.o" ;;
198
199 srec_vec) tb="$tb srec.o" ;;
200 symbolsrec_vec) tb="$tb srec.o" ;;
201
202 "") ;;
203 *) echo "*** unknown target vector $vec" 1>&2; exit 1 ;;
204 esac
205 done
206
207 # Target architecture .o files.
208 ta=`echo $SELECT_ARCHITECTURES | sed -e s/bfd_/cpu-/g -e s/_arch/.o/g`
209
210 # Weed out duplicate .o files.
211 f=""
212 for i in $tb ; do
213 case " $f " in
214 *" $i "*) ;;
215 *) f="$f $i" ;;
216 esac
217 done
218 tb="$f"
219
220 f=""
221 for i in $ta ; do
222 case " $f " in
223 *" $i "*) ;;
224 *) f="$f $i" ;;
225 esac
226 done
227 ta="$f"
228
229 bfd_backends="$tb"
230 bfd_machines="$ta"
231
232 # Only set these if they will be nonempty, for the clever echo.
233 test -n "$SELECT_VECS" &&
234 selvecs=`echo $SELECT_VECS | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
235 test -n "SELECT_ARCHITECTURES" &&
236 selarchs=`echo $SELECT_ARCHITECTURES | sed -e 's/ \(.\)/,\1/g'`
237
238 else # all_targets is true
239 bfd_backends='$(ALL_BACKENDS)'
240 bfd_machines='$(ALL_MACHINES)'
241 fi # all_targets is true
242
243 case ${host64}-${target64}-${want64} in
244 *true*)
245 wordsize=64
246 all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
247 ;;
248 false-false-false)
249 wordsize=32
250 all_backends='$(BFD32_BACKENDS)'
251 ;;
252 esac
253
254 echo WORDSIZE=${wordsize} >> Makefile.2
255 echo ALL_BACKENDS=${all_backends} >> Makefile.2
256 echo BFD_BACKENDS=${bfd_backends} >> Makefile.2
257 echo BFD_MACHINES=${bfd_machines} >> Makefile.2
258
259 test -n "$DEFAULT_VECTOR" && defvec="$DEFAULT_VECTOR"
260
261 echo "TDEFAULTS = \
262 ${defvec+-DDEFAULT_VECTOR=$defvec} \
263 ${selvecs+-DSELECT_VECS='$selvecs'} \
264 ${selarchs+-DSELECT_ARCHITECTURES='$selarchs'}" \
265 >> Makefile.2
266
267 cat Makefile.tmp >> Makefile.2
268 rm -f Makefile.tmp
269 mv Makefile.2 Makefile