configure.ac 23 KB

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