Automatic date update in version.in
[deliverable/binutils-gdb.git] / gas / configure.ac
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
6f2750fe 6dnl Copyright (C) 2012-2016 Free Software Foundation, Inc.
5bf135a7
NC
7dnl
8dnl This file is free software; you can redistribute it and/or modify
9dnl it under the terms of the GNU General Public License as published by
10dnl the Free Software Foundation; either version 3 of the License, or
11dnl (at your option) any later version.
3739860c 12dnl
5bf135a7
NC
13dnl This program is distributed in the hope that it will be useful,
14dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16dnl GNU General Public License for more details.
3739860c 17dnl
5bf135a7
NC
18dnl You should have received a copy of the GNU General Public License
19dnl along with this program; see the file COPYING3. If not see
20dnl <http://www.gnu.org/licenses/>.
252b5132
RH
21dnl
22dnl v2.5 needed for --bindir et al
da594c4a 23AC_PREREQ(2.59)
2e98a7bd
AM
24m4_include([../bfd/version.m4])
25AC_INIT([gas], BFD_VERSION)
da594c4a 26AC_CONFIG_SRCDIR(as.h)
252b5132 27
13b2be9c
DJ
28dnl Autoconf 2.57 will find the aux dir without this. However, unless
29dnl we specify this explicitly, automake-1.7 will assume that ylwrap is in
30dnl gas/ instead of gas/../.
31AC_CONFIG_AUX_DIR(..)
da594c4a 32AC_CANONICAL_TARGET
5d64ca4e 33AC_ISC_POSIX
252b5132 34
2e98a7bd 35AM_INIT_AUTOMAKE
252b5132 36
ce2cded5
L
37AC_PROG_CC
38AC_GNU_SOURCE
7357c5b6 39AC_USE_SYSTEM_EXTENSIONS
ce2cded5 40
da594c4a 41LT_INIT
b879806f 42ACX_LARGEFILE
252b5132 43
252b5132 44AC_ARG_ENABLE(targets,
241a6c40 45[ --enable-targets alternative target configurations besides the primary],
252b5132 46[case "${enableval}" in
da594c4a 47 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
252b5132
RH
48 ;;
49 no) enable_targets= ;;
50 *) enable_targets=$enableval ;;
51esac])dnl
c43a438d 52
c43a438d
AM
53ac_checking=yes
54if grep '^RELEASE=y' ${srcdir}/../bfd/Makefile.am >/dev/null 2>/dev/null ; then
55 ac_checking=
56fi
57AC_ARG_ENABLE(checking,
58[ --enable-checking enable run-time checks],
59[case "${enableval}" in
60 no|none) ac_checking= ;;
61 *) ac_checking=yes ;;
62esac])dnl
63if test x$ac_checking != x ; then
64 AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
65fi
66
6c3bc0f8
NC
67# PR gas/19109
68# Decide the default method for compressing debug sections.
69ac_default_compressed_debug_sections=unset
70# Provide a configure time option to override our default.
71AC_ARG_ENABLE(compressed_debug_sections,
4894d80b 72 AS_HELP_STRING([--enable-compressed-debug-sections={all,gas,none}],
27ba7c94 73 [compress debug sections by default]),
4894d80b 74[case ,"${enableval}", in
9b4c123c 75 ,yes, | ,all, | *,gas,*) ac_default_compressed_debug_sections=yes ;;
4894d80b 76 ,no, | ,none,) ac_default_compressed_debug_sections=no ;;
6c3bc0f8
NC
77 *) ac_default_compressed_debug_sections=unset ;;
78esac])dnl
79
0cb4071e
L
80# PR gas/19520
81# Decide if x86 assembler should generate relax relocations.
82ac_default_x86_relax_relocations=unset
83# Provide a configure time option to override our default.
84AC_ARG_ENABLE(x86_relax_relocations,
85 AS_HELP_STRING([--enable-x86-relax-relocations],
86 [generate x86 relax relocations by default]),
87[case "${enableval}" in
88 no) ac_default_x86_relax_relocations=0 ;;
89esac])dnl
90
b8871f35
L
91# Decide if ELF assembler should generate common symbols with the
92# STT_COMMON type.
93ac_default_elf_stt_common=unset
94# Provide a configure time option to override our default.
95AC_ARG_ENABLE(elf_stt_common,
96 AS_HELP_STRING([--enable-elf-stt-common],
97 [generate ELF common symbols with STT_COMMON type by default]),
98[case "${enableval}" in
99 yes) ac_default_elf_stt_common=1 ;;
100esac])dnl
101
252b5132
RH
102using_cgen=no
103
9e9b66a9 104AM_BINUTILS_WARNINGS
a2d91340 105
252b5132 106# Generate a header file
da594c4a 107AC_CONFIG_HEADERS(config.h:config.in)
252b5132 108
9004b6bd
AB
109dnl Option --with-cpu=TYPE allows configure type control of the default
110dnl cpu type within the assembler. Currently only the ARC target
111dnl supports this feature, but others may be added in the future.
112AC_ARG_WITH(cpu,
113 AS_HELP_STRING([--with-cpu=CPU],
114 [default cpu variant is CPU (currently only supported on ARC)]),
115 [AC_DEFINE_UNQUOTED(TARGET_WITH_CPU,
116 "${with_cpu}",
117 [Target specific CPU.])],
118 [])
119
df7b86aa
NC
120# PR 14072
121AH_VERBATIM([00_CONFIG_H_CHECK],
122[/* Check that config.h is #included before system headers
123 (this works only for glibc, but that should be enough). */
d17dce55 124#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
df7b86aa
NC
125# error config.h must be #included before system headers
126#endif
127#define __CONFIG_H__ 1])
128
76a27922
ILT
129# If we are on a DOS filesystem, we must use gdb.ini rather than
130# .gdbinit.
76a27922 131case "${host}" in
591d4689 132 *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-windows*)
76a27922 133 GDBINIT="gdb.ini"
13b2be9c
DJ
134 AC_CONFIG_FILES(gdb.ini:gdbinit.in)
135 ;;
136 *)
137 GDBINIT=".gdbinit"
138 AC_CONFIG_FILES(.gdbinit:gdbinit.in)
76a27922
ILT
139 ;;
140esac
141AC_SUBST(GDBINIT)
142
44f2f9d2
AM
143#We need this for the host. BOUT header is in host order.
144AC_C_BIGENDIAN
145
252b5132
RH
146te_file=generic
147
148# Makefile target for installing gas in $(tooldir)/bin.
149install_tooldir=install-exec-tooldir
150
151canon_targets=""
15886821 152all_targets=no
252b5132
RH
153if test -n "$enable_targets" ; then
154 for t in `echo $enable_targets | sed 's/,/ /g'`; do
15886821
L
155 if test $t = "all"; then
156 all_targets=yes
157 continue
158 fi
6d83c84b 159 result=`$ac_config_sub $t 2>/dev/null`
252b5132
RH
160 if test -n "$result" ; then
161 canon_targets="$canon_targets $result"
162# else
163# # Permit "all", etc. We don't support it yet though.
164# canon_targets="$canon_targets $t"
165 fi
166 done
167 GAS_UNIQ(canon_targets)
168fi
169
170emulations=""
171
172for this_target in $target $canon_targets ; do
173
14ee9f48
ILT
174 targ=${this_target}
175 . ${srcdir}/configure.tgt
176
177 case ${target_cpu} in
178 crisv32)
179 AC_DEFINE_UNQUOTED(DEFAULT_CRIS_ARCH, $arch,
180 [Default CRIS architecture.])
181 ;;
252b5132
RH
182 esac
183
184 if test ${this_target} = $target ; then
185 target_cpu_type=${cpu_type}
186 elif test ${target_cpu_type} != ${cpu_type} ; then
187 continue
188 fi
189
14ee9f48 190 generic_target=${cpu_type}-${target_vendor}-${target_os}
252b5132 191 case ${generic_target} in
14ee9f48
ILT
192 i386-*-sco3.2v5*)
193 if test ${this_target} = $target; then
194 AC_DEFINE(SCO_ELF, 1, [Define if defaulting to ELF on SCO 5.])
195 fi
196 ;;
1fe1f39c 197
79500683
AM
198 i386-*-msdosdjgpp* \
199 | i386-*-go32* \
14ee9f48
ILT
200 | i386-go32-rtems*)
201 AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
202 ;;
79500683 203
0cb4071e
L
204 i386-*-solaris2 \
205 | x86_64-*-solaris2 \
206 | i386-*-solaris2.[[0-9]] \
207 | i386-*-solaris2.1[[01]] \
208 | x86_64-*-solaris2.1[[01]])
209 if test ${this_target} = $target \
210 && test ${ac_default_x86_relax_relocations} = unset; then
211 ac_default_x86_relax_relocations=0
212 fi
213 ;;
214
14ee9f48
ILT
215 i860-*-*)
216 AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress)
217 ;;
79500683 218
7ba29e2a
NC
219 microblaze*)
220 ;;
221
e5231592
RS
222changequote(,)dnl
223 ppc-*-aix[5-9].*)
224changequote([,])dnl
14ee9f48 225 AC_DEFINE(AIX_WEAK_SUPPORT, 1,
f8fc3443 226 [Define if using AIX 5.2 value for C_WEAKEXT.])
14ee9f48 227 ;;
14ee9f48
ILT
228 ppc-*-solaris*)
229 if test ${this_target} = $target; then
230 AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
231 [Define if default target is PowerPC Solaris.])
232 fi
233 if test x${endian} = xbig; then
234 AC_MSG_ERROR(Solaris must be configured little endian)
235 fi
236 ;;
237
238 sh*-*-symbianelf*)
239 AC_DEFINE(TARGET_SYMBIAN, 1, [Define if target is Symbian OS.])
240 ;;
252b5132
RH
241 esac
242
243 if test ${this_target} = $target ; then
244 endian_def=
245 if test x${endian} = xbig; then
246 endian_def=1
247 elif test x${endian} = xlittle; then
248 endian_def=0
249 fi
250 if test x${endian_def} != x; then
251 AC_DEFINE_UNQUOTED(TARGET_BYTES_BIG_ENDIAN, $endian_def,
252 [Define as 1 if big endian.])
253 fi
254 fi
255
252b5132
RH
256# Other random stuff.
257
316f5878
RS
258 case ${cpu_type} in
259 mips)
260 # Set mips_cpu to the name of the default CPU.
261 case ${target_cpu} in
262 mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el)
263 mips_cpu=from-abi
264 ;;
265 mipsisa32 | mipsisa32el)
266 mips_cpu=mips32
267 ;;
af7ee8bf
CD
268 mipsisa32r2 | mipsisa32r2el)
269 mips_cpu=mips32r2
270 ;;
ae52f483
AB
271 mipsisa32r3 | mipsisa32r3el)
272 mips_cpu=mips32r3
273 ;;
274 mipsisa32r5 | mipsisa32r5el)
275 mips_cpu=mips32r5
276 ;;
7361da2c
AB
277 mipsisa32r6 | mipsisa32r6el)
278 mips_cpu=mips32r6
279 ;;
316f5878
RS
280 mipsisa64 | mipsisa64el)
281 mips_cpu=mips64
282 ;;
5f74bc13
CD
283 mipsisa64r2 | mipsisa64r2el)
284 mips_cpu=mips64r2
285 ;;
ae52f483
AB
286 mipsisa64r3 | mipsisa64r3el)
287 mips_cpu=mips64r3
288 ;;
289 mipsisa64r5 | mipsisa64r5el)
290 mips_cpu=mips64r5
291 ;;
7361da2c
AB
292 mipsisa64r6 | mipsisa64r6el)
293 mips_cpu=mips64r6
294 ;;
316f5878
RS
295 mipstx39 | mipstx39el)
296 mips_cpu=r3900
297 ;;
8f6847cb
RS
298 mips64vr | mips64vrel)
299 mips_cpu=vr4100
300 ;;
5f74bc13 301 mipsisa32r2* | mipsisa64r2*)
af7ee8bf
CD
302changequote(,)dnl
303 mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r2//' -e 's/el$//'`
7361da2c
AB
304changequote([,])dnl
305 ;;
306 mipsisa32r6* | mipsisa64r6*)
307changequote(,)dnl
308 mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r6//' -e 's/el$//'`
af7ee8bf
CD
309changequote([,])dnl
310 ;;
316f5878
RS
311 mips64* | mipsisa64* | mipsisa32*)
312changequote(,)dnl
313 mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..//' -e 's/el$//'`
e407c74b
NC
314changequote([,])dnl
315 ;;
316 mips*)
317changequote(,)dnl
318 mips_cpu=`echo $target_cpu | sed -e 's/^mips//' -e 's/el$//'`
316f5878
RS
319changequote([,])dnl
320 ;;
321 *)
da594c4a 322 AC_MSG_ERROR($target_cpu isn't a supported MIPS CPU name)
316f5878
RS
323 ;;
324 esac
325 # See whether it's appropriate to set E_MIPS_ABI_O32 for o32
326 # binaries. It's a GNU extension that some OSes don't understand.
316f5878
RS
327 case ${target} in
328 *-*-irix*)
329 use_e_mips_abi_o32=0
330 ;;
331 *)
332 use_e_mips_abi_o32=1
333 ;;
334 esac
335 # Decide whether to generate 32-bit or 64-bit code by default.
336 # Used to resolve -march=from-abi when an embedded ABI is selected.
337 case ${target} in
338 mips64*-*-* | mipsisa64*-*-*)
339 mips_default_64bit=1
340 ;;
341 *)
342 mips_default_64bit=0
343 ;;
344 esac
cac012d6
AO
345 # Decide which ABI to target by default.
346 case ${target} in
aeffff67 347 mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* | mips64*-kfreebsd*-gnu)
cac012d6
AO
348 mips_default_abi=N32_ABI
349 ;;
aeffff67 350 mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu)
cac012d6
AO
351 mips_default_abi=O32_ABI
352 ;;
26eebcf5
MK
353 mips64*-openbsd*)
354 mips_default_abi=N64_ABI
355 ;;
cac012d6
AO
356 *)
357 mips_default_abi=NO_ABI
358 ;;
359 esac
316f5878
RS
360 AC_DEFINE_UNQUOTED(MIPS_CPU_STRING_DEFAULT, "$mips_cpu",
361 [Default CPU for MIPS targets. ])
362 AC_DEFINE_UNQUOTED(USE_E_MIPS_ABI_O32, $use_e_mips_abi_o32,
363 [Allow use of E_MIPS_ABI_O32 on MIPS targets. ])
364 AC_DEFINE_UNQUOTED(MIPS_DEFAULT_64BIT, $mips_default_64bit,
365 [Generate 64-bit code by default on MIPS targets. ])
cac012d6
AO
366 AC_DEFINE_UNQUOTED(MIPS_DEFAULT_ABI, $mips_default_abi,
367 [Choose a default ABI for MIPS targets. ])
316f5878
RS
368 ;;
369 esac
370
252b5132
RH
371 # Do we need the opcodes library?
372 case ${cpu_type} in
0b1cf022 373 vax | tic30)
252b5132
RH
374 ;;
375
376 *)
377 need_opcodes=yes
378
379 case "${enable_shared}" in
380 yes) shared_opcodes=true ;;
381 *opcodes*) shared_opcodes=true ;;
382 *) shared_opcodes=false ;;
383 esac
252b5132
RH
384 ;;
385 esac
386
387 # Any other special object files needed ?
388 case ${cpu_type} in
07c1b327
CM
389
390 bfin)
391 echo ${extra_objects} | grep -s "bfin-parse.o"
392 if test $? -ne 0 ; then
393 extra_objects="$extra_objects bfin-parse.o"
394 fi
395
df7b86aa 396 echo ${extra_objects} | grep -s "bfin-lex-wrapper.o"
07c1b327 397 if test $? -ne 0 ; then
df7b86aa 398 extra_objects="$extra_objects bfin-lex-wrapper.o"
07c1b327
CM
399 fi
400 ;;
401
73589c9d 402 epiphany | fr30 | ip2k | iq2000 | lm32 | m32r | or1k)
252b5132
RH
403 using_cgen=yes
404 ;;
405
49f58d10
JB
406 m32c)
407 using_cgen=yes
408 ;;
0ebb9a87
DB
409 frv)
410 using_cgen=yes
411 ;;
252b5132
RH
412 m68k)
413 case ${extra_objects} in
414 *m68k-parse.o*) ;;
415 *) extra_objects="$extra_objects m68k-parse.o" ;;
416 esac
417 ;;
418
280d71bf
DB
419 mep)
420 using_cgen=yes
421 ;;
422
252b5132 423 mips)
12e64c2c 424 echo ${extra_objects} | grep -s "itbl-parse.o"
252b5132
RH
425 if test $? -ne 0 ; then
426 extra_objects="$extra_objects itbl-parse.o"
427 fi
428
df7b86aa 429 echo ${extra_objects} | grep -s "itbl-lex-wrapper.o"
252b5132 430 if test $? -ne 0 ; then
df7b86aa 431 extra_objects="$extra_objects itbl-lex-wrapper.o"
252b5132
RH
432 fi
433
12e64c2c 434 echo ${extra_objects} | grep -s "itbl-ops.o"
252b5132
RH
435 if test $? -ne 0 ; then
436 extra_objects="$extra_objects itbl-ops.o"
437 fi
438 ;;
439
4970f871 440 mt)
047af9ef
AH
441 using_cgen=yes
442 ;;
443
35c08157
KLC
444 nds32)
445 # Decide BASELINE, REDUCED_REGS, FPU_DP_EXT, FPU_SP_EXT features
446 # based on arch_name.
447 AC_MSG_CHECKING(for default configuration of --with-arch)
448 if test "x${with_arch}" != x; then
449 case ${with_arch} in
450 v2j | v2s | v2f | v2 | v3m | v3j | v3s | v3f | v3 )
451 AC_DEFINE_UNQUOTED(NDS32_DEFAULT_ARCH_NAME, "$with_arch",
452 [Define value for nds32_arch_name])
453 ;;
454 *)
455 AC_MSG_ERROR(This kind of arch name does *NOT* exist!)
456 ;;
457 esac
458 fi
459 AC_MSG_RESULT($with_arch)
460
461 # Decide features one by one.
462 AC_MSG_CHECKING(for default configuration of --enable-dx-regs)
6cd8405e 463 if test "x${enable_dx_regs}" = xyes; then
35c08157
KLC
464 AC_DEFINE(NDS32_DEFAULT_DX_REGS, 1,
465 [Define value for nds32_dx_regs])
466 else
467 AC_DEFINE(NDS32_DEFAULT_DX_REGS, 0,
468 [Define default value for nds32_dx_regs])
469 fi
470 AC_MSG_RESULT($enable_dx_regs)
471
472 AC_MSG_CHECKING(for default configuration of --enable-perf-ext)
6cd8405e 473 if test "x${enable_perf_ext}" = xno; then
35c08157
KLC
474 AC_DEFINE(NDS32_DEFAULT_PERF_EXT, 0,
475 [Define value for nds32_perf_ext])
476 else
477 AC_DEFINE(NDS32_DEFAULT_PERF_EXT, 1,
478 [Define default value for nds32_perf_ext])
479 fi
480 AC_MSG_RESULT($enable_perf_ext)
481
482 AC_MSG_CHECKING(for default configuration of --enable-perf-ext2)
6cd8405e 483 if test "x${enable_perf_ext2}" = xno; then
35c08157
KLC
484 AC_DEFINE(NDS32_DEFAULT_PERF_EXT2, 0,
485 [Define value for nds32_perf_ext2])
486 else
487 AC_DEFINE(NDS32_DEFAULT_PERF_EXT2, 1,
488 [Define default value for nds32_perf_ext2])
489 fi
490 AC_MSG_RESULT($enable_perf_ext2)
491
492 AC_MSG_CHECKING(for default configuration of --enable-string-ext)
6cd8405e 493 if test "x${enable_string_ext}" = xno; then
35c08157
KLC
494 AC_DEFINE(NDS32_DEFAULT_STRING_EXT, 0,
495 [Define value for nds32_string_ext])
496 else
497 AC_DEFINE(NDS32_DEFAULT_STRING_EXT, 1,
498 [Define default value for nds32_string_ext])
499 fi
500 AC_MSG_RESULT($enable_string_ext)
501
502 AC_MSG_CHECKING(for default configuration of --enable-audio-ext)
6cd8405e 503 if test "x${enable_audio_ext}" = xno; then
35c08157
KLC
504 AC_DEFINE(NDS32_DEFAULT_AUDIO_EXT, 0,
505 [Define value for nds32_audio_ext])
506 else
507 AC_DEFINE(NDS32_DEFAULT_AUDIO_EXT, 1,
508 [Define default value for nds32_audio_ext])
509 fi
510 AC_MSG_RESULT($enable_audio_ext)
511 ;;
512
e23eba97 513 i386 | riscv | s390 | sparc)
252b5132
RH
514 if test $this_target = $target ; then
515 AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
516 fi
517 ;;
93fbbb04 518
99c513f6
DD
519 rl78)
520 echo ${extra_objects} | grep -s "rl78-parse.o"
521 if test $? -ne 0 ; then
522 extra_objects="$extra_objects rl78-parse.o"
523 fi
524 ;;
525
c7927a3c
NC
526 rx)
527 echo ${extra_objects} | grep -s "rx-parse.o"
528 if test $? -ne 0 ; then
529 extra_objects="$extra_objects rx-parse.o"
530 fi
531 ;;
532
93fbbb04
GK
533 xstormy16)
534 using_cgen=yes
535 ;;
536
d70c5fc7
NC
537 xc16x)
538 using_cgen=yes
539 ;;
540
e0001a05
NC
541 xtensa)
542 echo ${extra_objects} | grep -s "xtensa-relax.o"
543 if test $? -ne 0 ; then
544 extra_objects="$extra_objects xtensa-relax.o"
545 fi
546 ;;
547
252b5132
RH
548 *)
549 ;;
550 esac
551
552 if test $using_cgen = yes ; then
553 case "x${extra_objects}" in
554 *cgen.o*) ;;
555 *) extra_objects="$extra_objects cgen.o" ;;
556 esac
557 fi
558
559# See if we really can support this configuration with the emulation code.
560
561 if test $this_target = $target ; then
252b5132
RH
562 obj_format=$fmt
563 te_file=$em
252b5132
RH
564 fi
565
b11d79f2
TG
566 case ${te_file} in
567 vms) extra_objects="$extra_objects te-vms.o" ;;
568 esac
58797674 569
252b5132
RH
570# From target name and format, produce a list of supported emulations.
571
572 case ${generic_target}-${fmt} in
e8044f35 573 mips-*-*-*) case "$endian" in
252b5132
RH
574 big) emulation="mipsbelf mipslelf mipself" ;;
575 *) emulation="mipslelf mipsbelf mipself" ;;
252b5132 576 esac ;;
119caedd
L
577 # i386-pc-pe-coff != i386-pc-coff.
578 i386-*-pe-coff) ;;
4c63da97
AM
579 # Uncommenting the next line will turn on support for i386 AOUT
580 # for the default linux configuration
581 # i386-*-linux*-elf) emulation="i386elf i386aout" ;;
582 #
583 i386-*-aout) emulation="i386aout" ;;
4ca72d38 584 i386-*-coff) emulation="i386coff" ;;
4c63da97 585 i386-*-elf) emulation="i386elf" ;;
3bcbcc3d 586
f9c19112
HPN
587 # Always all formats. The first stated emulation becomes the default.
588 cris-*-*aout*) emulation="crisaout criself" ;;
589 cris-*-*) emulation="criself crisaout" ;;
252b5132
RH
590 esac
591
592 emulations="$emulations $emulation"
593
594done
595
0cb4071e
L
596if test ${ac_default_x86_relax_relocations} = unset; then
597 ac_default_x86_relax_relocations=1
598fi
599AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_X86_RELAX_RELOCATIONS,
600 $ac_default_x86_relax_relocations,
601 [Define to 1 if you want to generate x86 relax relocations by default.])
602
b8871f35
L
603if test ${ac_default_elf_stt_common} = unset; then
604 ac_default_elf_stt_common=0
605fi
606AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_ELF_STT_COMMON,
607 $ac_default_elf_stt_common,
608 [Define to 1 if you want to generate ELF common symbols with the
609 STT_COMMON type by default.])
610
348ef89a 611if test x$ac_default_compressed_debug_sections = xyes ; then
6c3bc0f8
NC
612 AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.])
613fi
e12fe555 614
15886821
L
615# Turn on all targets if possible
616if test ${all_targets} = "yes"; then
617 case ${target_cpu_type} in
618 i386)
619 case ${obj_format} in
620 aout)
621 emulations="$emulations i386coff i386elf"
622 ;;
623 coff)
624 emulations="$emulations i386aout i386elf"
625 ;;
626 elf)
627 emulations="$emulations i386aout i386coff"
628 ;;
629 esac
630 ;;
99ad8390
NC
631 x86_64)
632 case ${obj_format} in
633 aout)
634 emulations="$emulations i386coff i386elf"
635 ;;
636 coff)
637 emulations="$emulations i386aout i386elf"
638 ;;
639 elf)
640 emulations="$emulations i386aout i386coff"
641 ;;
642 esac
643 ;;
15886821
L
644 esac
645fi
646
39871c07
AM
647# PE code has way too many macros tweaking behaviour
648case ${te_file} in
649 pe*) emulations="" ;;
650esac
651
252b5132
RH
652# Assign floating point type. Most processors with FP support
653# IEEE FP. On those that don't support FP at all, usually IEEE
654# is emulated.
655case ${target_cpu} in
12e64c2c 656 vax | pdp11 ) atof=vax ;;
252b5132
RH
657 *) atof=ieee ;;
658esac
659
660case "${obj_format}" in
661 "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;;
662esac
663
664# Unfortunately the cpu in cpu-opc.h file isn't always $(TARGET_CPU).
665cgen_cpu_prefix=""
666if test $using_cgen = yes ; then
667 case ${target_cpu} in
73589c9d
CS
668 or1knd)
669 cgen_cpu_prefix=or1k ;;
252b5132
RH
670 *) cgen_cpu_prefix=${target_cpu} ;;
671 esac
672 AC_SUBST(cgen_cpu_prefix)
673 AC_DEFINE(USING_CGEN, 1, [Using cgen code?])
674fi
675
676dnl
677dnl Make sure the desired support files exist.
678dnl
679
680if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then
681 AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type})
682fi
683
684if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
685 AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
686fi
687
252b5132
RH
688# Some COFF configurations want these random other flags set.
689case ${obj_format} in
690 coff)
691 case ${target_cpu_type} in
692 i386) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
693 m68k) AC_DEFINE(M68KCOFF, 1, [Using m68k COFF?]) ;;
694 m88k) AC_DEFINE(M88KCOFF, 1, [Using m88k COFF?]) ;;
99ad8390 695 x86_64) AC_DEFINE(I386COFF, 1, [Using i386 COFF?]) ;;
252b5132
RH
696 esac
697 ;;
698esac
699
700# Getting this done right is going to be a bitch. Each configuration specified
7be1c489
AM
701# with --enable-targets=... should be checked for environment, format, cpu
702# setting.
252b5132
RH
703#
704# For each configuration, the necessary object file support code must be linked
705# in. This might be only one, it might be up to four. The necessary emulation
706# code needs to be provided, too.
707#
708# And then there's "--enable-targets=all"....
709#
e8044f35 710# For now, just always do it for MIPS ELF configurations. Sigh.
252b5132
RH
711
712formats="${obj_format}"
713emfiles=""
714EMULATIONS=""
715GAS_UNIQ(emulations)
716for em in . $emulations ; do
717 case $em in
718 .) continue ;;
97238fbd 719 mipsbelf | mipslelf | mipself)
252b5132 720 fmt=elf file=mipself ;;
0aa5d426
HPN
721 *coff)
722 fmt=coff file=$em ;;
723 *aout)
724 fmt=aout file=$em ;;
725 *elf)
726 fmt=elf file=$em ;;
252b5132
RH
727 esac
728 formats="$formats $fmt"
729 emfiles="$emfiles e-$file.o"
730 EMULATIONS="$EMULATIONS &$em,"
731done
732GAS_UNIQ(formats)
733GAS_UNIQ(emfiles)
734if test `set . $formats ; shift ; echo $#` -gt 1 ; then
735 for fmt in $formats ; do
736 case $fmt in
737 aout) AC_DEFINE(OBJ_MAYBE_AOUT, 1, [a.out support?]) ;;
738 bout) AC_DEFINE(OBJ_MAYBE_BOUT, 1, [b.out support?]) ;;
739 coff) AC_DEFINE(OBJ_MAYBE_COFF, 1, [COFF support?]) ;;
740 ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF, 1, [ECOFF support?]) ;;
741 elf) AC_DEFINE(OBJ_MAYBE_ELF, 1, [ELF support?]) ;;
742 generic) AC_DEFINE(OBJ_MAYBE_GENERIC, 1, [generic support?]) ;;
252b5132 743 som) AC_DEFINE(OBJ_MAYBE_SOM, 1, [SOM support?]) ;;
252b5132
RH
744 esac
745 extra_objects="$extra_objects obj-$fmt.o"
746 done
747 obj_format=multi
748fi
749if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then
252b5132 750 DEFAULT_EMULATION=`set . $emulations ; echo $2`
e8044f35 751 # e-mipself has more than one emulation per file, e-i386* has just one at the
4ca72d38
AM
752 # moment. If only one emulation is specified, then don't define
753 # USE_EMULATIONS or include any of the e-files as they will only be bloat.
754 case "${obj_format}${emfiles}" in
e8044f35 755 multi* | *mipself*)
4ca72d38
AM
756 extra_objects="$extra_objects $emfiles"
757 AC_DEFINE(USE_EMULATIONS, 1, [Use emulation support?]) ;;
758 esac
252b5132
RH
759fi
760AC_SUBST(extra_objects)
761AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS, [Supported emulations.])
762AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION",
763 [Default emulation.])
764
252b5132
RH
765reject_dev_configs=yes
766
767case ${reject_dev_configs}-${dev} in
768 yes-yes) # Oops.
769 AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.)
770 ;;
771esac
772
773AC_SUBST(target_cpu_type)
774AC_SUBST(obj_format)
775AC_SUBST(te_file)
776AC_SUBST(install_tooldir)
777AC_SUBST(atof)
778dnl AC_SUBST(emulation)
779
252b5132
RH
780# do we need the opcodes library?
781case "${need_opcodes}" in
782yes)
783 OPCODES_LIB=../opcodes/libopcodes.la
784 ;;
785esac
786
252b5132
RH
787AC_SUBST(OPCODES_LIB)
788
252b5132
RH
789AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}", [Target alias.])
790AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}", [Canonical target.])
791AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}", [Target CPU.])
792AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}", [Target vendor.])
793AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.])
794
252b5132
RH
795AC_PROG_YACC
796AM_PROG_LEX
797
f8c2a965 798ALL_LINGUAS="fr tr es rw id ru fi ja zh_CN"
20e95c23
DJ
799ZW_GNU_GETTEXT_SISTER_DIR
800AM_PO_SUBDIRS
252b5132
RH
801
802AM_MAINTAINER_MODE
d5fbea21 803AM_CONDITIONAL(GENINSRC_NEVER, false)
252b5132
RH
804AC_EXEEXT
805
58797674 806AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h errno.h sys/types.h limits.h locale.h time.h sys/stat.h)
208a4923 807ACX_HEADER_STRING
252b5132
RH
808
809# Put this here so that autoconf's "cross-compiling" message doesn't confuse
810# people who are not cross-compiling but are compiling cross-assemblers.
811AC_MSG_CHECKING(whether compiling a cross-assembler)
812if test "${host}" = "${target}"; then
813 cross_gas=no
814else
815 cross_gas=yes
816 AC_DEFINE(CROSS_COMPILE, 1, [Compiling cross-assembler?])
817fi
818AC_MSG_RESULT($cross_gas)
819
820dnl ansidecl.h will deal with const
da594c4a 821dnl AC_C_CONST
252b5132
RH
822AC_FUNC_ALLOCA
823AC_C_INLINE
824
825# VMS doesn't have unlink.
826AC_CHECK_FUNCS(unlink remove, break)
4b0296ce 827AC_CHECK_FUNCS(sbrk setlocale)
252b5132 828
44350750
NC
829AM_LC_MESSAGES
830
39bec121
TW
831# do we need the math library?
832case "${need_libm}" in
12e64c2c 833yes)
da594c4a 834 LT_LIB_M
39bec121
TW
835 AC_SUBST(LIBM)
836 ;;
837esac
838
252b5132
RH
839# Some non-ANSI preprocessors botch requoting inside strings. That's bad
840# enough, but on some of those systems, the assert macro relies on requoting
841# working properly!
842GAS_WORKING_ASSERT
843
844# On some systems, the system header files may not declare malloc, realloc,
845# and free. There are places where gas needs these functions to have been
846# declared -- such as when taking their addresses.
847gas_test_headers="
848#ifdef HAVE_MEMORY_H
849#include <memory.h>
850#endif
851#ifdef HAVE_STRING_H
852#include <string.h>
853#else
854#ifdef HAVE_STRINGS_H
855#include <strings.h>
856#endif
857#endif
858#ifdef HAVE_STDLIB_H
859#include <stdlib.h>
860#endif
861#ifdef HAVE_UNISTD_H
862#include <unistd.h>
863#endif
864"
252b5132
RH
865
866# Does errno.h declare errno, or do we have to add a separate declaration
867# for it?
868GAS_CHECK_DECL_NEEDED(errno, f, int f, [
869#ifdef HAVE_ERRNO_H
870#include <errno.h>
871#endif
872])
873
56f36663
NC
874AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
875AC_CACHE_VAL(gas_cv_decl_getopt_unistd_h,
da594c4a 876[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
56f36663
NC
877gas_cv_decl_getopt_unistd_h=yes, gas_cv_decl_getopt_unistd_h=no)])
878AC_MSG_RESULT($gas_cv_decl_getopt_unistd_h)
879if test $gas_cv_decl_getopt_unistd_h = yes; then
880 AC_DEFINE([HAVE_DECL_GETOPT], 1,
881 [Is the prototype for getopt in <unistd.h> in the expected format?])
882fi
883
e8a38df5
AL
884GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
885GAS_CHECK_DECL_NEEDED(ffs, f, int (*f)(int), $gas_test_headers)
886GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)
887GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers)
888GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers)
889GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers)
890
2a7f4fa9 891AC_CHECK_DECLS([free, getenv, malloc, mempcpy, realloc, stpcpy, strstr, vsnprintf, asprintf])
6d74f28b 892
c973bc5c
NC
893BFD_BINARY_FOPEN
894
543b7933
L
895# Link in zlib if we can. This allows us to write compressed debug sections.
896AM_ZLIB
0acf065b 897
b11d79f2
TG
898# Support for VMS timestamps via cross compile
899
900if test "$ac_cv_header_time_h" = yes; then
901 GAS_HAVE_TIME_TYPE_MEMBER(struct tm, tm_gmtoff)
902fi
903
904if test "$ac_cv_header_sys_stat_h" = yes; then
905 GAS_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_sec)
906 GAS_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_nsec)
907fi
908
909
31dd3154 910dnl Required for html, pdf, install-pdf and install-html targets.
108a6f8e
CD
911AC_SUBST(datarootdir)
912AC_SUBST(docdir)
913AC_SUBST(htmldir)
31dd3154 914AC_SUBST(pdfdir)
108a6f8e 915
252b5132
RH
916dnl This must come last.
917
918dnl We used to make symlinks to files in the source directory, but now
919dnl we just use the right name for .c files, and create .h files in
920dnl the build directory which include the right .h file. Make sure
921dnl the old symlinks don't exist, so that a reconfigure in an existing
922dnl directory behaves reasonably.
923
13b2be9c
DJ
924AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
925AC_CONFIG_COMMANDS([default],
252b5132
RH
926[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
927 echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
928 echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
929 echo '#include "te-'"${te_file}"'.h"' > targ-env.h
930 echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h
931 if test "x$cgen_cpu_prefix" != x ; then
932 echo '#include "opcodes/'"${cgen_cpu_prefix}"'-desc.h"' > cgen-desc.h
20e95c23 933 fi],
252b5132
RH
934[target_cpu_type=${target_cpu_type}
935 cgen_cpu_prefix=${cgen_cpu_prefix}
936 obj_format=${obj_format}
937 te_file=${te_file}])
13b2be9c
DJ
938
939AC_OUTPUT
This page took 1.176667 seconds and 4 git commands to generate.