]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/configure.in
Add LM32 port.
[thirdparty/binutils-gdb.git] / gas / configure.in
CommitLineData
252b5132
RH
1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl And be careful when changing it! If you must add tests with square
4dnl brackets, be sure changequote invocations surround it.
5dnl
6dnl
7dnl v2.5 needed for --bindir et al
da594c4a
AM
8AC_PREREQ(2.59)
9AC_INIT
10AC_CONFIG_SRCDIR(as.h)
252b5132 11
13b2be9c
DJ
12dnl Autoconf 2.57 will find the aux dir without this. However, unless
13dnl we specify this explicitly, automake-1.7 will assume that ylwrap is in
14dnl gas/ instead of gas/../.
15AC_CONFIG_AUX_DIR(..)
da594c4a 16AC_CANONICAL_TARGET
5d64ca4e 17AC_ISC_POSIX
252b5132 18
27b7e12d
AM
19changequote(,)dnl
20BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ ]*\([^ ]*\)[ ]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
21changequote([,])dnl
22AM_INIT_AUTOMAKE(gas, ${BFD_VERSION})
252b5132 23
ce2cded5
L
24AC_PROG_CC
25AC_GNU_SOURCE
7357c5b6 26AC_USE_SYSTEM_EXTENSIONS
d053aef8 27AC_SYS_LARGEFILE
ce2cded5 28
da594c4a 29LT_INIT
252b5132 30
252b5132 31AC_ARG_ENABLE(targets,
241a6c40 32[ --enable-targets alternative target configurations besides the primary],
252b5132 33[case "${enableval}" in
da594c4a 34 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
252b5132
RH
35 ;;
36 no) enable_targets= ;;
37 *) enable_targets=$enableval ;;
38esac])dnl
c43a438d 39
252b5132
RH
40AC_ARG_ENABLE(commonbfdlib,
41[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
42[case "${enableval}" in
43 yes) commonbfdlib=true ;;
44 no) commonbfdlib=false ;;
45 *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
46esac])dnl
47
c43a438d
AM
48ac_checking=yes
49if grep '^RELEASE=y' ${srcdir}/../bfd/Makefile.am >/dev/null 2>/dev/null ; then
50 ac_checking=
51fi
52AC_ARG_ENABLE(checking,
53[ --enable-checking enable run-time checks],
54[case "${enableval}" in
55 no|none) ac_checking= ;;
56 *) ac_checking=yes ;;
57esac])dnl
58if test x$ac_checking != x ; then
59 AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
60fi
61
252b5132
RH
62using_cgen=no
63
9e9b66a9 64AM_BINUTILS_WARNINGS
a2d91340 65
252b5132 66# Generate a header file
da594c4a 67AC_CONFIG_HEADERS(config.h:config.in)
252b5132 68
76a27922
ILT
69# If we are on a DOS filesystem, we must use gdb.ini rather than
70# .gdbinit.
76a27922 71case "${host}" in
591d4689 72 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-windows*)
76a27922 73 GDBINIT="gdb.ini"
13b2be9c
DJ
74 AC_CONFIG_FILES(gdb.ini:gdbinit.in)
75 ;;
76 *)
77 GDBINIT=".gdbinit"
78 AC_CONFIG_FILES(.gdbinit:gdbinit.in)
76a27922
ILT
79 ;;
80esac
81AC_SUBST(GDBINIT)
82
44f2f9d2
AM
83#We need this for the host. BOUT header is in host order.
84AC_C_BIGENDIAN
85
252b5132
RH
86te_file=generic
87
88# Makefile target for installing gas in $(tooldir)/bin.
89install_tooldir=install-exec-tooldir
90
91canon_targets=""
15886821 92all_targets=no
252b5132
RH
93if test -n "$enable_targets" ; then
94 for t in `echo $enable_targets | sed 's/,/ /g'`; do
15886821
L
95 if test $t = "all"; then
96 all_targets=yes
97 continue
98 fi
6d83c84b 99 result=`$ac_config_sub $t 2>/dev/null`
252b5132
RH
100 if test -n "$result" ; then
101 canon_targets="$canon_targets $result"
102# else
103# # Permit "all", etc. We don't support it yet though.
104# canon_targets="$canon_targets $t"
105 fi
106 done
107 GAS_UNIQ(canon_targets)
108fi
109
110emulations=""
111
112for this_target in $target $canon_targets ; do
113
14ee9f48
ILT
114 targ=${this_target}
115 . ${srcdir}/configure.tgt
116
117 case ${target_cpu} in
118 crisv32)
119 AC_DEFINE_UNQUOTED(DEFAULT_CRIS_ARCH, $arch,
120 [Default CRIS architecture.])
121 ;;
252b5132
RH
122 esac
123
124 if test ${this_target} = $target ; then
125 target_cpu_type=${cpu_type}
126 elif test ${target_cpu_type} != ${cpu_type} ; then
127 continue
128 fi
129
14ee9f48 130 generic_target=${cpu_type}-${target_vendor}-${target_os}
252b5132 131 case ${generic_target} in
14ee9f48
ILT
132 i386-*-sco3.2v5*)
133 if test ${this_target} = $target; then
134 AC_DEFINE(SCO_ELF, 1, [Define if defaulting to ELF on SCO 5.])
135 fi
136 ;;
1fe1f39c 137
79500683
AM
138 i386-*-msdosdjgpp* \
139 | i386-*-go32* \
14ee9f48
ILT
140 | i386-go32-rtems*)
141 AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
142 ;;
79500683 143
14ee9f48
ILT
144 i860-*-*)
145 AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress)
146 ;;
79500683 147
14ee9f48
ILT
148 mips-sony-bsd*)
149 ;;
79500683 150 mips-*-bsd*)
14ee9f48
ILT
151 AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.)
152 ;;
4101eec8 153
14ee9f48
ILT
154 ppc-*-aix5.*)
155 AC_DEFINE(AIX_WEAK_SUPPORT, 1,
f8fc3443 156 [Define if using AIX 5.2 value for C_WEAKEXT.])
14ee9f48 157 ;;
ed84e695 158 ppc-*-linux-*)
14ee9f48
ILT
159 case "$endian" in
160 big) ;;
161 *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
162 esac
163 ;;
164 ppc-*-solaris*)
165 if test ${this_target} = $target; then
166 AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
167 [Define if default target is PowerPC Solaris.])
168 fi
169 if test x${endian} = xbig; then
170 AC_MSG_ERROR(Solaris must be configured little endian)
171 fi
172 ;;
173
174 sh*-*-symbianelf*)
175 AC_DEFINE(TARGET_SYMBIAN, 1, [Define if target is Symbian OS.])
176 ;;
252b5132
RH
177 esac
178
179 if test ${this_target} = $target ; then
180 endian_def=
181 if test x${endian} = xbig; then
182 endian_def=1
183 elif test x${endian} = xlittle; then
184 endian_def=0
185 fi
186 if test x${endian_def} != x; then
187 AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
188 [Define as 1 if big endian.])
189 fi
190 fi
191
252b5132
RH
192# Other random stuff.
193
316f5878
RS
194 case ${cpu_type} in
195 mips)
196 # Set mips_cpu to the name of the default CPU.
197 case ${target_cpu} in
198 mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el)
199 mips_cpu=from-abi
200 ;;
201 mipsisa32 | mipsisa32el)
202 mips_cpu=mips32
203 ;;
af7ee8bf
CD
204 mipsisa32r2 | mipsisa32r2el)
205 mips_cpu=mips32r2
206 ;;
316f5878
RS
207 mipsisa64 | mipsisa64el)
208 mips_cpu=mips64
209 ;;
5f74bc13
CD
210 mipsisa64r2 | mipsisa64r2el)
211 mips_cpu=mips64r2
212 ;;
316f5878
RS
213 mipstx39 | mipstx39el)
214 mips_cpu=r3900
215 ;;
8f6847cb
RS
216 mips64vr | mips64vrel)
217 mips_cpu=vr4100
218 ;;
5f74bc13 219 mipsisa32r2* | mipsisa64r2*)
af7ee8bf
CD
220changequote(,)dnl
221 mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r2//' -e 's/el$//'`
222changequote([,])dnl
223 ;;
316f5878
RS
224 mips64* | mipsisa64* | mipsisa32*)
225changequote(,)dnl
226 mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..//' -e 's/el$//'`
227changequote([,])dnl
228 ;;
229 *)
da594c4a 230 AC_MSG_ERROR($target_cpu isn't a supported MIPS CPU name)
316f5878
RS
231 ;;
232 esac
233 # See whether it's appropriate to set E_MIPS_ABI_O32 for o32
234 # binaries. It's a GNU extension that some OSes don't understand.
235 # The value only matters on ELF targets.
236 case ${target} in
237 *-*-irix*)
238 use_e_mips_abi_o32=0
239 ;;
240 *)
241 use_e_mips_abi_o32=1
242 ;;
243 esac
244 # Decide whether to generate 32-bit or 64-bit code by default.
245 # Used to resolve -march=from-abi when an embedded ABI is selected.
246 case ${target} in
247 mips64*-*-* | mipsisa64*-*-*)
248 mips_default_64bit=1
249 ;;
250 *)
251 mips_default_64bit=0
252 ;;
253 esac
cac012d6
AO
254 # Decide which ABI to target by default.
255 case ${target} in
256 mips64*-linux* | mips-sgi-irix6*)
257 mips_default_abi=N32_ABI
258 ;;
259 mips*-linux*)
260 mips_default_abi=O32_ABI
261 ;;
26eebcf5
MK
262 mips64*-openbsd*)
263 mips_default_abi=N64_ABI
264 ;;
cac012d6
AO
265 *)
266 mips_default_abi=NO_ABI
267 ;;
268 esac
316f5878
RS
269 AC_DEFINE_UNQUOTED(MIPS_CPU_STRING_DEFAULT, "$mips_cpu",
270 [Default CPU for MIPS targets. ])
271 AC_DEFINE_UNQUOTED(USE_E_MIPS_ABI_O32, $use_e_mips_abi_o32,
272 [Allow use of E_MIPS_ABI_O32 on MIPS targets. ])
273 AC_DEFINE_UNQUOTED(MIPS_DEFAULT_64BIT, $mips_default_64bit,
274 [Generate 64-bit code by default on MIPS targets. ])
cac012d6
AO
275 AC_DEFINE_UNQUOTED(MIPS_DEFAULT_ABI, $mips_default_abi,
276 [Choose a default ABI for MIPS targets. ])
316f5878
RS
277 ;;
278 esac
279
252b5132
RH
280 # Do we need the opcodes library?
281 case ${cpu_type} in
0b1cf022 282 vax | tic30)
252b5132
RH
283 ;;
284
285 *)
286 need_opcodes=yes
287
288 case "${enable_shared}" in
289 yes) shared_opcodes=true ;;
290 *opcodes*) shared_opcodes=true ;;
291 *) shared_opcodes=false ;;
292 esac
252b5132
RH
293 ;;
294 esac
295
296 # Any other special object files needed ?
297 case ${cpu_type} in
07c1b327
CM
298
299 bfin)
300 echo ${extra_objects} | grep -s "bfin-parse.o"
301 if test $? -ne 0 ; then
302 extra_objects="$extra_objects bfin-parse.o"
303 fi
304
305 echo ${extra_objects} | grep -s "bfin-lex.o"
306 if test $? -ne 0 ; then
307 extra_objects="$extra_objects bfin-lex.o"
308 fi
309 ;;
310
84e94c90 311 fr30 | ip2k | iq2000 | lm32 | m32r | openrisc)
252b5132
RH
312 using_cgen=yes
313 ;;
314
49f58d10
JB
315 m32c)
316 using_cgen=yes
317 ;;
0ebb9a87
DB
318 frv)
319 using_cgen=yes
320 ;;
252b5132
RH
321 m68k)
322 case ${extra_objects} in
323 *m68k-parse.o*) ;;
324 *) extra_objects="$extra_objects m68k-parse.o" ;;
325 esac
326 ;;
327
280d71bf
DB
328 mep)
329 using_cgen=yes
330 ;;
331
252b5132 332 mips)
12e64c2c 333 echo ${extra_objects} | grep -s "itbl-parse.o"
252b5132
RH
334 if test $? -ne 0 ; then
335 extra_objects="$extra_objects itbl-parse.o"
336 fi
337
12e64c2c 338 echo ${extra_objects} | grep -s "itbl-lex.o"
252b5132
RH
339 if test $? -ne 0 ; then
340 extra_objects="$extra_objects itbl-lex.o"
341 fi
342
12e64c2c 343 echo ${extra_objects} | grep -s "itbl-ops.o"
252b5132
RH
344 if test $? -ne 0 ; then
345 extra_objects="$extra_objects itbl-ops.o"
346 fi
347 ;;
348
4970f871 349 mt)
047af9ef
AH
350 using_cgen=yes
351 ;;
352
c1e4eef7 353 i386 | s390 | sparc)
252b5132
RH
354 if test $this_target = $target ; then
355 AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
356 fi
357 ;;
93fbbb04
GK
358
359 xstormy16)
360 using_cgen=yes
361 ;;
362
d70c5fc7
NC
363 xc16x)
364 using_cgen=yes
365 ;;
366
e0001a05
NC
367 xtensa)
368 echo ${extra_objects} | grep -s "xtensa-relax.o"
369 if test $? -ne 0 ; then
370 extra_objects="$extra_objects xtensa-relax.o"
371 fi
372 ;;
373
252b5132
RH
374 *)
375 ;;
376 esac
377
378 if test $using_cgen = yes ; then
379 case "x${extra_objects}" in
380 *cgen.o*) ;;
381 *) extra_objects="$extra_objects cgen.o" ;;
382 esac
383 fi
384
385# See if we really can support this configuration with the emulation code.
386
387 if test $this_target = $target ; then
252b5132
RH
388 obj_format=$fmt
389 te_file=$em
252b5132
RH
390 fi
391
392# From target name and format, produce a list of supported emulations.
393
394 case ${generic_target}-${fmt} in
395 mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
4008bd9b 396 mips*-*-linux*-*) case "$endian" in
df3bcd6f
L
397 big) emulation="mipsbelf mipslelf mipself" ;;
398 *) emulation="mipslelf mipsbelf mipself" ;;
252b5132
RH
399 esac ;;
400 mips-*-lnews*-ecoff) ;;
401 mips-*-*-ecoff) case "$endian" in
402 big) emulation="mipsbecoff mipslecoff mipsecoff" ;;
403 *) emulation="mipslecoff mipsbecoff mipsecoff" ;;
404 esac ;;
405 mips-*-*-elf) case "$endian" in
406 big) emulation="mipsbelf mipslelf mipself" ;;
407 *) emulation="mipslelf mipsbelf mipself" ;;
252b5132 408 esac ;;
906fac54 409 mips-*-sysv4*MP*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
119caedd
L
410 # i386-pc-pe-coff != i386-pc-coff.
411 i386-*-pe-coff) ;;
4c63da97
AM
412 # Uncommenting the next line will turn on support for i386 AOUT
413 # for the default linux configuration
414 # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
415 #
416 i386-*-aout) emulation="i386aout" ;;
4ca72d38 417 i386-*-coff) emulation="i386coff" ;;
4c63da97 418 i386-*-elf) emulation="i386elf" ;;
3bcbcc3d 419
f9c19112
HPN
420 # Always all formats. The first stated emulation becomes the default.
421 cris-*-*aout*) emulation="crisaout criself" ;;
422 cris-*-*) emulation="criself crisaout" ;;
252b5132
RH
423 esac
424
425 emulations="$emulations $emulation"
426
427done
428
15886821
L
429# Turn on all targets if possible
430if test ${all_targets} = "yes"; then
431 case ${target_cpu_type} in
432 i386)
433 case ${obj_format} in
434 aout)
435 emulations="$emulations i386coff i386elf"
436 ;;
437 coff)
438 emulations="$emulations i386aout i386elf"
439 ;;
440 elf)
441 emulations="$emulations i386aout i386coff"
442 ;;
443 esac
444 ;;
99ad8390
NC
445 x86_64)
446 case ${obj_format} in
447 aout)
448 emulations="$emulations i386coff i386elf"
449 ;;
450 coff)
451 emulations="$emulations i386aout i386elf"
452 ;;
453 elf)
454 emulations="$emulations i386aout i386coff"
455 ;;
456 esac
457 ;;
15886821
L
458 esac
459fi
460
252b5132
RH
461# Assign floating point type. Most processors with FP support
462# IEEE FP. On those that don't support FP at all, usually IEEE
463# is emulated.
464case ${target_cpu} in
12e64c2c 465 vax | pdp11 ) atof=vax ;;
252b5132
RH
466 *) atof=ieee ;;
467esac
468
469case "${obj_format}" in
470 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
471esac
472
473# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
474cgen_cpu_prefix=""
475if test $using_cgen = yes ; then
476 case ${target_cpu} in
477 *) cgen_cpu_prefix=${target_cpu} ;;
478 esac
479 AC_SUBST(cgen_cpu_prefix)
480 AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
481fi
482
483dnl
484dnl Make sure the desired support files exist.
485dnl
486
487if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
488 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
489fi
490
491if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
492 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
493fi
494
252b5132
RH
495# Some COFF configurations want these random other flags set.
496case ${obj_format} in
497 coff)
498 case ${target_cpu_type} in
499 i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
500 m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;;
501 m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;;
99ad8390 502 x86_64) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
252b5132
RH
503 esac
504 ;;
505esac
506
507# Getting this done right is going to be a bitch. Each configuration specified
7be1c489
AM
508# with --enable-targets=... should be checked for environment, format, cpu
509# setting.
252b5132
RH
510#
511# For each configuration, the necessary object file support code must be linked
512# in. This might be only one, it might be up to four. The necessary emulation
513# code needs to be provided, too.
514#
515# And then there's "--enable-targets=all"....
516#
517# For now, just always do it for MIPS ELF or ECOFF configurations. Sigh.
518
519formats="${obj_format}"
520emfiles=""
521EMULATIONS=""
522GAS_UNIQ(emulations)
523for em in . $emulations ; do
524 case $em in
525 .) continue ;;
97238fbd 526 mipsbelf | mipslelf | mipself)
252b5132 527 fmt=elf file=mipself ;;
97238fbd 528 mipsbecoff | mipslecoff | mipsecoff)
252b5132 529 fmt=ecoff file=mipsecoff ;;
0aa5d426
HPN
530 *coff)
531 fmt=coff file=$em ;;
532 *aout)
533 fmt=aout file=$em ;;
534 *elf)
535 fmt=elf file=$em ;;
252b5132
RH
536 esac
537 formats="$formats $fmt"
538 emfiles="$emfiles e-$file.o"
539 EMULATIONS="$EMULATIONS &$em,"
540done
541GAS_UNIQ(formats)
542GAS_UNIQ(emfiles)
543if test `set . $formats ; shift ; echo $#` -gt 1 ; then
544 for fmt in $formats ; do
545 case $fmt in
546 aout) AC_DEFINE(OBJ_MAYBE_AOUT, 1, [a.out support?]) ;;
547 bout) AC_DEFINE(OBJ_MAYBE_BOUT, 1, [b.out support?]) ;;
548 coff) AC_DEFINE(OBJ_MAYBE_COFF, 1, [COFF support?]) ;;
549 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF, 1, [ECOFF support?]) ;;
550 elf) AC_DEFINE(OBJ_MAYBE_ELF, 1, [ELF support?]) ;;
551 generic) AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
252b5132 552 som) AC_DEFINE(OBJ_MAYBE_SOM, 1, [SOM support?]) ;;
252b5132
RH
553 esac
554 extra_objects="$extra_objects obj-$fmt.o"
555 done
556 obj_format=multi
557fi
558if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
252b5132 559 DEFAULT_EMULATION=`set . $emulations ; echo $2`
4ca72d38
AM
560 # e-mips* has more than one emulation per file, e-i386* has just one at the
561 # moment. If only one emulation is specified, then don't define
562 # USE_EMULATIONS or include any of the e-files as they will only be bloat.
563 case "${obj_format}${emfiles}" in
564 multi* | *mips*)
4ca72d38
AM
565 extra_objects="$extra_objects $emfiles"
566 AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
567 esac
252b5132
RH
568fi
569AC_SUBST(extra_objects)
570AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
571AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
572 [Default emulation.])
573
252b5132
RH
574reject_dev_configs=yes
575
576case ${reject_dev_configs}-${dev} in
577 yes-yes) # Oops.
578 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
579 ;;
580esac
581
582AC_SUBST(target_cpu_type)
583AC_SUBST(obj_format)
584AC_SUBST(te_file)
585AC_SUBST(install_tooldir)
586AC_SUBST(atof)
587dnl AC_SUBST(emulation)
588
252b5132
RH
589# do we need the opcodes library?
590case "${need_opcodes}" in
591yes)
592 OPCODES_LIB=../opcodes/libopcodes.la
593 ;;
594esac
595
252b5132
RH
596AC_SUBST(OPCODES_LIB)
597
252b5132
RH
598AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}", [Target alias.])
599AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}", [Canonical target.])
600AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}", [Target CPU.])
601AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}", [Target vendor.])
602AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.])
603
252b5132
RH
604AC_PROG_YACC
605AM_PROG_LEX
606
8cc9115f 607ALL_LINGUAS="fr tr es rw id"
20e95c23
DJ
608ZW_GNU_GETTEXT_SISTER_DIR
609AM_PO_SUBDIRS
252b5132
RH
610
611AM_MAINTAINER_MODE
d5fbea21 612AM_CONDITIONAL(GENINSRC_NEVER, false)
252b5132
RH
613AC_EXEEXT
614
40fb9820 615AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h limits.h)
252b5132
RH
616
617# Put this here so that autoconf's "cross-compiling" message doesn't confuse
618# people who are not cross-compiling but are compiling cross-assemblers.
619AC_MSG_CHECKING(whether compiling a cross-assembler)
620if test "${host}" = "${target}"; then
621 cross_gas=no
622else
623 cross_gas=yes
624 AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
625fi
626AC_MSG_RESULT($cross_gas)
627
628dnl ansidecl.h will deal with const
da594c4a 629dnl AC_C_CONST
252b5132
RH
630AC_FUNC_ALLOCA
631AC_C_INLINE
632
633# VMS doesn't have unlink.
634AC_CHECK_FUNCS(unlink remove, break)
635
636# Some systems don't have sbrk().
637AC_CHECK_FUNCS(sbrk)
638
39bec121
TW
639# do we need the math library?
640case "${need_libm}" in
12e64c2c 641yes)
da594c4a 642 LT_LIB_M
39bec121
TW
643 AC_SUBST(LIBM)
644 ;;
645esac
646
252b5132
RH
647# Some non-ANSI preprocessors botch requoting inside strings. That's bad
648# enough, but on some of those systems, the assert macro relies on requoting
649# working properly!
650GAS_WORKING_ASSERT
651
652# On some systems, the system header files may not declare malloc, realloc,
653# and free. There are places where gas needs these functions to have been
654# declared -- such as when taking their addresses.
655gas_test_headers="
656#ifdef HAVE_MEMORY_H
657#include <memory.h>
658#endif
659#ifdef HAVE_STRING_H
660#include <string.h>
661#else
662#ifdef HAVE_STRINGS_H
663#include <strings.h>
664#endif
665#endif
666#ifdef HAVE_STDLIB_H
667#include <stdlib.h>
668#endif
669#ifdef HAVE_UNISTD_H
670#include <unistd.h>
671#endif
672"
252b5132
RH
673
674# Does errno.h declare errno, or do we have to add a separate declaration
675# for it?
676GAS_CHECK_DECL_NEEDED(errno, f, int f, [
677#ifdef HAVE_ERRNO_H
678#include <errno.h>
679#endif
680])
681
56f36663
NC
682AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
683AC_CACHE_VAL(gas_cv_decl_getopt_unistd_h,
da594c4a 684[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
56f36663
NC
685gas_cv_decl_getopt_unistd_h=yes, gas_cv_decl_getopt_unistd_h=no)])
686AC_MSG_RESULT($gas_cv_decl_getopt_unistd_h)
687if test $gas_cv_decl_getopt_unistd_h = yes; then
688 AC_DEFINE([HAVE_DECL_GETOPT], 1,
689 [Is the prototype for getopt in <unistd.h> in the expected format?])
690fi
691
e8a38df5
AL
692GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
693GAS_CHECK_DECL_NEEDED(ffs, f, int (*f)(int), $gas_test_headers)
694GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
695GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
696GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
697GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
698
6d74f28b
EB
699AC_CHECK_DECLS([vsnprintf])
700
c973bc5c
NC
701BFD_BINARY_FOPEN
702
108a6f8e
CD
703dnl Required for html and install-html targets.
704AC_SUBST(datarootdir)
705AC_SUBST(docdir)
706AC_SUBST(htmldir)
707
252b5132
RH
708dnl This must come last.
709
710dnl We used to make symlinks to files in the source directory, but now
711dnl we just use the right name for .c files, and create .h files in
712dnl the build directory which include the right .h file. Make sure
713dnl the old symlinks don't exist, so that a reconfigure in an existing
714dnl directory behaves reasonably.
715
13b2be9c
DJ
716AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
717AC_CONFIG_COMMANDS([default],
252b5132
RH
718[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
719 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
720 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
721 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
722 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
723 if test "x$cgen_cpu_prefix" != x ; then
724 echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
20e95c23 725 fi],
252b5132
RH
726[target_cpu_type=${target_cpu_type}
727 cgen_cpu_prefix=${cgen_cpu_prefix}
728 obj_format=${obj_format}
729 te_file=${te_file}])
13b2be9c
DJ
730
731AC_OUTPUT