configure.ac 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.64)dnl
  3. AC_INIT(Makefile.in)
  4. sinclude(../common/acinclude.m4)
  5. SIM_AC_COMMON
  6. dnl Options available in this module
  7. SIM_AC_OPTION_INLINE()
  8. SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
  9. SIM_AC_OPTION_HOSTENDIAN
  10. SIM_AC_OPTION_WARNINGS
  11. SIM_AC_OPTION_RESERVED_BITS(1)
  12. # DEPRECATED
  13. #
  14. # Instead of defining a `subtarget' macro, code should be checking
  15. # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
  16. # in question.
  17. #
  18. case "${target}" in
  19. mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
  20. mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
  21. mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
  22. mips*-mti-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
  23. mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
  24. mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
  25. *) SIM_SUBTARGET="";;
  26. esac
  27. AC_SUBST(SIM_SUBTARGET)
  28. #
  29. # Select the byte order of the target
  30. #
  31. mips_endian=
  32. default_endian=
  33. case "${target}" in
  34. mips64el*-*-*) mips_endian=LITTLE_ENDIAN ;;
  35. mips64vr*el-*-*) default_endian=LITTLE_ENDIAN ;;
  36. mips64*-*-*) default_endian=BIG_ENDIAN ;;
  37. mips16*-*-*) default_endian=BIG_ENDIAN ;;
  38. mipsisa32*-*-*) default_endian=BIG_ENDIAN ;;
  39. mipsisa64*-*-*) default_endian=BIG_ENDIAN ;;
  40. mips*-*-*) default_endian=BIG_ENDIAN ;;
  41. *) default_endian=BIG_ENDIAN ;;
  42. esac
  43. SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
  44. #
  45. # Select the bitsize of the target
  46. #
  47. mips_addr_bitsize=
  48. case "${target}" in
  49. mips*-sde-elf*) mips_bitsize=64 ; mips_msb=63 ;;
  50. mips*-mti-elf*) mips_bitsize=64 ; mips_msb=63 ;;
  51. mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
  52. mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
  53. mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
  54. mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
  55. mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
  56. *) mips_bitsize=64 ; mips_msb=63 ;;
  57. esac
  58. SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
  59. #
  60. # Select the floating hardware support of the target
  61. #
  62. mips_fpu=HARDWARE_FLOATING_POINT
  63. mips_fpu_bitsize=
  64. case "${target}" in
  65. mips*tx39*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
  66. mips*-sde-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
  67. mips*-mti-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
  68. mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
  69. mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
  70. mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
  71. mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
  72. mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
  73. *) mips_fpu=HARD_FLOATING_POINT ;;
  74. esac
  75. SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
  76. #
  77. # Select the level of SMP support
  78. #
  79. case "${target}" in
  80. *) mips_smp=0 ;;
  81. esac
  82. SIM_AC_OPTION_SMP($mips_smp)
  83. #
  84. # Select the IGEN architecture
  85. #
  86. sim_gen=IGEN
  87. sim_igen_machine="-M mipsIV"
  88. sim_m16_machine="-M mips16,mipsIII"
  89. sim_igen_filter="32,64,f"
  90. sim_m16_filter="16"
  91. sim_mach_default="mips8000"
  92. case "${target}" in
  93. mips*tx39*) sim_gen=IGEN
  94. sim_igen_filter="32,f"
  95. sim_igen_machine="-M r3900"
  96. ;;
  97. mips64vr43*-*-*) sim_gen=IGEN
  98. sim_igen_machine="-M mipsIV"
  99. sim_mach_default="mips8000"
  100. ;;
  101. mips64vr5*-*-*) sim_gen=IGEN
  102. sim_igen_machine="-M vr5000"
  103. sim_mach_default="mips5000"
  104. ;;
  105. mips64vr41*) sim_gen=M16
  106. sim_igen_machine="-M vr4100"
  107. sim_m16_machine="-M vr4100"
  108. sim_igen_filter="32,64,f"
  109. sim_m16_filter="16"
  110. sim_mach_default="mips4100"
  111. ;;
  112. mips64vr-*-* | mips64vrel-*-*)
  113. sim_gen=MULTI
  114. sim_multi_configs="\
  115. vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
  116. vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
  117. vr5000:mipsIV:32,64,f:mips4300,mips5000\
  118. vr5400:mipsIV,vr5400:32,64,f:mips5400\
  119. vr5500:mipsIV,vr5500:32,64,f:mips5500"
  120. sim_multi_default=mips5000
  121. ;;
  122. mips*-sde-elf* | mips*-mti-elf*)
  123. sim_gen=MULTI
  124. sim_multi_configs="\
  125. micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
  126. mips64r2:mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,64,f:mipsisa64r2"
  127. sim_multi_default=mipsisa64r2
  128. ;;
  129. mips64*-*-*) sim_igen_filter="32,64,f"
  130. sim_gen=IGEN
  131. ;;
  132. mips16*-*-*) sim_gen=M16
  133. sim_igen_filter="32,64,f"
  134. sim_m16_filter="16"
  135. ;;
  136. mipsisa32r2*-*-*) sim_gen=MULTI
  137. sim_multi_configs="\
  138. micromips:micromips32,micromipsdsp:32,f:mips_micromips\
  139. mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
  140. sim_multi_default=mipsisa32r2
  141. ;;
  142. mipsisa32*-*-*) sim_gen=M16
  143. sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
  144. sim_m16_machine="-M mips16,mips16e,mips32"
  145. sim_igen_filter="32,f"
  146. sim_mach_default="mipsisa32"
  147. ;;
  148. mipsisa64r2*-*-*) sim_gen=M16
  149. sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
  150. sim_m16_machine="-M mips16,mips16e,mips64r2"
  151. sim_igen_filter="32,64,f"
  152. sim_mach_default="mipsisa64r2"
  153. ;;
  154. mipsisa64sb1*-*-*) sim_gen=IGEN
  155. sim_igen_machine="-M mips64,mips3d,sb1"
  156. sim_igen_filter="32,64,f"
  157. sim_mach_default="mips_sb1"
  158. ;;
  159. mipsisa64*-*-*) sim_gen=M16
  160. sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
  161. sim_m16_machine="-M mips16,mips16e,mips64"
  162. sim_igen_filter="32,64,f"
  163. sim_mach_default="mipsisa64"
  164. ;;
  165. mips*lsi*) sim_gen=M16
  166. sim_igen_machine="-M mipsIII,mips16"
  167. sim_m16_machine="-M mips16,mipsIII"
  168. sim_igen_filter="32,f"
  169. sim_m16_filter="16"
  170. sim_mach_default="mips4000"
  171. ;;
  172. mips*-*-*) sim_gen=IGEN
  173. sim_igen_filter="32,f"
  174. ;;
  175. esac
  176. # The MULTI generator can combine several simulation engines into one.
  177. # executable. A configuration which uses the MULTI should set two
  178. # variables: ${sim_multi_configs} and ${sim_multi_default}.
  179. #
  180. # ${sim_multi_configs} is the list of engines to build. Each
  181. # space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
  182. # where:
  183. #
  184. # - NAME is a C-compatible prefix for the engine,
  185. # - MACHINE is a -M argument,
  186. # - FILTER is a -F argument, and
  187. # - BFDMACHS is a comma-separated list of bfd machines that the
  188. # simulator can run.
  189. #
  190. # Each entry will have a separate simulation engine whose prefix is
  191. # m32<NAME>. If the machine list includes "mips16", there will also
  192. # be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
  193. # generated using the same machine list as the 32-bit version,
  194. # but the filter will be "16" instead of FILTER.
  195. #
  196. # The simulator compares the bfd mach against BFDMACHS to decide
  197. # which engine to use. Entries in BFDMACHS should be bfd_mach
  198. # values with "bfd_mach_" removed. ${sim_multi_default} says
  199. # which entry should be the default.
  200. if test ${sim_gen} = MULTI; then
  201. # Simple sanity check.
  202. if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
  203. AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)
  204. fi
  205. # Start in a known state.
  206. rm -f multi-include.h multi-run.c
  207. sim_multi_flags=
  208. sim_multi_src=
  209. sim_multi_obj=
  210. sim_multi_igen_configs=
  211. sim_seen_default=no
  212. cat << __EOF__ > multi-run.c
  213. /* Main entry point for MULTI simulators.
  214. Copyright (C) 2003-2015 Free Software Foundation, Inc.
  215. This program is free software; you can redistribute it and/or modify
  216. it under the terms of the GNU General Public License as published by
  217. the Free Software Foundation; either version 3 of the License, or
  218. (at your option) any later version.
  219. This program is distributed in the hope that it will be useful,
  220. but WITHOUT ANY WARRANTY; without even the implied warranty of
  221. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  222. GNU General Public License for more details.
  223. You should have received a copy of the GNU General Public License
  224. along with this program. If not, see <http://www.gnu.org/licenses/>.
  225. --
  226. This file was generated by sim/mips/configure. */
  227. #include "sim-main.h"
  228. #include "multi-include.h"
  229. #include "elf-bfd.h"
  230. #include "elf/mips.h"
  231. #define SD sd
  232. #define CPU cpu
  233. void
  234. sim_engine_run (SIM_DESC sd,
  235. int next_cpu_nr,
  236. int nr_cpus,
  237. int signal) /* ignore */
  238. {
  239. int mach;
  240. if (STATE_ARCHITECTURE (sd) == NULL)
  241. mach = bfd_mach_${sim_multi_default};
  242. else if (elf_elfheader (sd->base.prog_bfd)->e_flags
  243. & EF_MIPS_ARCH_ASE_MICROMIPS)
  244. mach = bfd_mach_mips_micromips;
  245. else
  246. mach = STATE_ARCHITECTURE (SD)->mach;
  247. switch (mach)
  248. {
  249. __EOF__
  250. for fc in ${sim_multi_configs}; do
  251. # Split up the entry. ${c} contains the first three elements.
  252. # Note: outer sqaure brackets are m4 quotes.
  253. c=`echo ${fc} | sed ['s/:[^:]*$//']`
  254. bfdmachs=`echo ${fc} | sed 's/.*://'`
  255. name=`echo ${c} | sed 's/:.*//'`
  256. machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
  257. filter=`echo ${c} | sed 's/.*://'`
  258. # Build the following lists:
  259. #
  260. # sim_multi_flags: all -M and -F flags used by the simulator
  261. # sim_multi_src: all makefile-generated source files
  262. # sim_multi_obj: the objects for ${sim_multi_src}
  263. # sim_multi_igen_configs: igen configuration strings.
  264. #
  265. # Each entry in ${sim_multi_igen_configs} is a prefix (m32
  266. # or m16) followed by the NAME, MACHINE and FILTER part of
  267. # the ${sim_multi_configs} entry.
  268. sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
  269. # Check whether special handling is needed.
  270. case ${c} in
  271. *:*mips16*:*)
  272. # Run igen twice, once for normal mode and once for mips16.
  273. ws="m32 m16"
  274. # The top-level function for the mips16 simulator is
  275. # in a file m16${name}_run.c, generated by the
  276. # tmp-run-multi Makefile rule.
  277. sim_multi_src="${sim_multi_src} m16${name}_run.c"
  278. sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
  279. sim_multi_flags="${sim_multi_flags} -F 16"
  280. ;;
  281. *:*micromips32*:*)
  282. # Run igen thrice, once for micromips32, once for micromips16,
  283. # and once for m32.
  284. ws="micromips_m32 micromips16 micromips32"
  285. # The top-level function for the micromips simulator is
  286. # in a file micromips${name}_run.c, generated by the
  287. # tmp-run-multi Makefile rule.
  288. sim_multi_src="${sim_multi_src} micromips${name}_run.c"
  289. sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
  290. sim_multi_flags="${sim_multi_flags} -F 16,32"
  291. ;;
  292. *:*micromips64*:*)
  293. # Run igen thrice, once for micromips64, once for micromips16,
  294. # and once for m64.
  295. ws="micromips_m64 micromips16 micromips64"
  296. # The top-level function for the micromips simulator is
  297. # in a file micromips${name}_run.c, generated by the
  298. # tmp-run-multi Makefile rule.
  299. sim_multi_src="${sim_multi_src} micromips${name}_run.c"
  300. sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
  301. sim_multi_flags="${sim_multi_flags} -F 16,32,64"
  302. ;;
  303. *)
  304. ws=m32
  305. ;;
  306. esac
  307. # Now add the list of igen-generated files to ${sim_multi_src}
  308. # and ${sim_multi_obj}.
  309. for w in ${ws}; do
  310. for base in engine icache idecode model semantics support; do
  311. sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
  312. sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
  313. sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
  314. done
  315. sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
  316. done
  317. # Add an include for the engine.h file. This file declares the
  318. # top-level foo_engine_run() function.
  319. echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
  320. # Add case statements for this engine to sim_engine_run().
  321. for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
  322. echo " case bfd_mach_${mach}:" >> multi-run.c
  323. if test ${mach} = ${sim_multi_default}; then
  324. echo " default:" >> multi-run.c
  325. sim_seen_default=yes
  326. fi
  327. done
  328. echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
  329. >> multi-run.c
  330. echo " break;" >> multi-run.c
  331. done
  332. # Check whether we added a 'default:' label.
  333. if test ${sim_seen_default} = no; then
  334. AC_MSG_ERROR(Error in configure.ac: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
  335. fi
  336. cat << __EOF__ >> multi-run.c
  337. }
  338. }
  339. int
  340. mips_mach_multi (SIM_DESC sd)
  341. {
  342. if (STATE_ARCHITECTURE (sd) == NULL)
  343. return bfd_mach_${sim_multi_default};
  344. switch (STATE_ARCHITECTURE (SD)->mach)
  345. {
  346. __EOF__
  347. # Add case statements for this engine to mips_mach_multi().
  348. for fc in ${sim_multi_configs}; do
  349. # Split up the entry. ${c} contains the first three elements.
  350. # Note: outer sqaure brackets are m4 quotes.
  351. c=`echo ${fc} | sed ['s/:[^:]*$//']`
  352. bfdmachs=`echo ${fc} | sed 's/.*://'`
  353. for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
  354. echo " case bfd_mach_${mach}:" >> multi-run.c
  355. done
  356. done
  357. cat << __EOF__ >> multi-run.c
  358. return (STATE_ARCHITECTURE (SD)->mach);
  359. default:
  360. return bfd_mach_${sim_multi_default};
  361. }
  362. }
  363. __EOF__
  364. SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
  365. else
  366. # For clean-extra
  367. sim_multi_src=doesnt-exist.c
  368. if test x"${sim_mach_default}" = x""; then
  369. AC_MSG_ERROR(Error in configure.ac: \${sim_mach_default} not defined)
  370. fi
  371. SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
  372. fi
  373. sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
  374. sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
  375. sim_micromips16_flags=" -F ${sim_micromips16_filter} ${sim_micromips16_machine} ${sim_igen_smp}"
  376. sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${sim_igen_smp}"
  377. AC_SUBST(sim_igen_flags)
  378. AC_SUBST(sim_m16_flags)
  379. AC_SUBST(sim_micromips_flags)
  380. AC_SUBST(sim_micromips16_flags)
  381. AC_SUBST(sim_gen)
  382. AC_SUBST(sim_multi_flags)
  383. AC_SUBST(sim_multi_igen_configs)
  384. AC_SUBST(sim_multi_src)
  385. AC_SUBST(sim_multi_obj)
  386. #
  387. # Add simulated hardware devices
  388. #
  389. hw_enabled=no
  390. case "${target}" in
  391. mips*tx39*)
  392. hw_enabled=yes
  393. hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
  394. SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_TX3904=1"
  395. ;;
  396. *)
  397. ;;
  398. esac
  399. SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
  400. # Choose simulator engine
  401. case "${target}" in
  402. *) mips_igen_engine="engine.o"
  403. ;;
  404. esac
  405. AC_SUBST(mips_igen_engine)
  406. AC_PATH_X
  407. mips_extra_libs=""
  408. AC_SUBST(mips_extra_libs)
  409. AC_CHECK_LIB(m, fabs)
  410. AC_CHECK_FUNCS(aint anint sqrt)
  411. SIM_AC_OUTPUT