configure.ac 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.59)dnl
  3. AC_INIT(Makefile.in)
  4. sinclude(../common/acinclude.m4)
  5. AC_PROG_INSTALL
  6. AC_PROG_CC
  7. # Put a plausible default for CC_FOR_BUILD in Makefile.
  8. if test "x$cross_compiling" = "xno"; then
  9. CC_FOR_BUILD='$(CC)'
  10. else
  11. CC_FOR_BUILD=gcc
  12. fi
  13. CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
  14. dnl We don't use gettext, but bfd does. So we do the appropriate checks
  15. dnl to see if there are intl libraries we should link against.
  16. ALL_LINGUAS=
  17. ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
  18. AC_ARG_ENABLE(sim-alignment,
  19. [ --enable-sim-alignment=align Specify strict or nonstrict alignment.],
  20. [case "${enableval}" in
  21. yes | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
  22. no | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
  23. 0 | default | DEFAULT) sim_alignment="-DWITH_ALIGNMENT=0";;
  24. *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
  25. esac
  26. if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
  27. echo "Setting alignment flags = $sim_alignment" 6>&1
  28. fi],[sim_alignment=""])dnl
  29. AC_ARG_ENABLE(sim-assert,
  30. [ --enable-sim-assert Specify whether to perform random assertions.],
  31. [case "${enableval}" in
  32. yes) sim_assert="-DWITH_ASSERT=1";;
  33. no) sim_assert="-DWITH_ASSERT=0";;
  34. *) AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
  35. esac
  36. if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
  37. echo "Setting assert flags = $sim_assert" 6>&1
  38. fi],[sim_assert=""])dnl
  39. AC_ARG_ENABLE(sim-bitsize,
  40. [ --enable-sim-bitsize=n Specify target bitsize (32 or 64).],
  41. [case "${enableval}" in
  42. 32|64) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=$enableval";;
  43. *) AC_MSG_ERROR("--enable-sim-bitsize was given $enableval. Expected 32 or 64"); sim_bitsize="";;
  44. esac
  45. if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
  46. echo "Setting bitsize flags = $sim_bitsize" 6>&1
  47. fi],[sim_bitsize=""])dnl
  48. AC_ARG_ENABLE(sim-bswap,
  49. [ --enable-sim-bswap Use the BSWAP instruction on Intel 486s and Pentiums.],
  50. [case "${enableval}" in
  51. yes) sim_bswap="-DWITH_BSWAP=1";;
  52. no) sim_bswap="-DWITH_BSWAP=0";;
  53. *) AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
  54. esac
  55. if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
  56. echo "Setting bswap flags = $sim_bswap" 6>&1
  57. fi],[sim_bswap=""])dnl
  58. AC_ARG_ENABLE(sim-cflags,
  59. [ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator],
  60. [case "${enableval}" in
  61. yes) sim_cflags="-O2 -fomit-frame-pointer";;
  62. no) sim_cflags="";;
  63. *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
  64. esac
  65. if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
  66. echo "Setting sim cflags = $sim_cflags" 6>&1
  67. fi],[sim_cflags=""])dnl
  68. AC_ARG_ENABLE(sim-config,
  69. [ --enable-sim-config=file Override default config file],
  70. [case "${enableval}" in
  71. yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-config=file");;
  72. *) if test -f "${srcdir}/${enableval}"; then
  73. sim_config="${enableval}";
  74. elif test -f "${srcdir}/${enableval}-config.h"; then
  75. sim_config="${enableval}-config.h"
  76. else
  77. AC_MSG_ERROR("Config file $enableval was not found");
  78. sim_config=std-config.h
  79. fi;;
  80. esac
  81. if test x"$silent" != x"yes" && test x"$sim_config" != x""; then
  82. echo "Setting config flags = $sim_config" 6>&1
  83. fi],[sim_config="std-config.h"
  84. if test x"$silent" != x"yes"; then
  85. echo "Setting config flags = $sim_config" 6>&1
  86. fi])dnl
  87. AC_ARG_ENABLE(sim-decode-mechanism,
  88. [ --enable-sim-decode-mechanism=which Specify the instruction decode mechanism.],
  89. [case "${enableval}" in
  90. yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-decode-mechanism=file");;
  91. array|switch|padded-switch|goto-switch) sim_decode_mechanism="-T ${enableval}";;
  92. *) AC_MSG_ERROR("File $enableval is not an opcode rules file");
  93. sim_decode_mechanism="switch";;
  94. esac
  95. if test x"$silent" != x"yes" && test x"$sim_decode_mechanism" != x""; then
  96. echo "Setting decode mechanism flags = $sim_decode_mechanism" 6>&1
  97. fi],[sim_decode_mechanism=""
  98. if test x"$silent" != x"yes"; then
  99. echo "Setting decode mechanism flags = $sim_decode_mechanism"
  100. fi])dnl
  101. AC_ARG_ENABLE(sim-default-model,
  102. [ --enable-sim-default-model=which Specify default PowerPC to model.],
  103. [case "${enableval}" in
  104. yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-default-model=model");;
  105. *) sim_default_model="-DWITH_DEFAULT_MODEL=${enableval}";;
  106. esac
  107. if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
  108. echo "Setting default-model flags = $sim_default_model" 6>&1
  109. fi],[sim_default_model=""])dnl
  110. AC_ARG_ENABLE(sim-duplicate,
  111. [ --enable-sim-duplicate Expand (duplicate) semantic functions.],
  112. [case "${enableval}" in
  113. yes) sim_dup="-E";;
  114. no) sim_dup="";;
  115. *) AC_MSG_ERROR("--enable-sim-duplicate does not take a value"); sim_dup="";;
  116. esac
  117. if test x"$silent" != x"yes" && test x"$sim_dup" != x""; then
  118. echo "Setting duplicate flags = $sim_dup" 6>&1
  119. fi],[sim_dup="-E"
  120. if test x"$silent" != x"yes"; then
  121. echo "Setting duplicate flags = $sim_dup" 6>&1
  122. fi])dnl
  123. AC_ARG_ENABLE(sim-endian,
  124. [ --enable-sim-endian=endian Specify target byte endian orientation.],
  125. [case "${enableval}" in
  126. yes) case "$target" in
  127. *powerpc-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
  128. *powerpcle-*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
  129. *) echo "Unknown target $target" 1>&6; sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
  130. esac;;
  131. no) sim_endian="-DWITH_TARGET_BYTE_ORDER=0";;
  132. b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
  133. l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
  134. *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
  135. esac
  136. if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
  137. echo "Setting endian flags = $sim_endian" 6>&1
  138. fi],[sim_endian=""])dnl
  139. AC_ARG_ENABLE(sim-env,
  140. [ --enable-sim-env=env Specify target environment (operating, virtual, user).],
  141. [case "${enableval}" in
  142. operating | os | oea) sim_env="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
  143. virtual | vea) sim_env="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
  144. user | uea) sim_env="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
  145. no) sim_env="-DWITH_ENVIRONMENT=0";;
  146. *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-env"); sim_env="";;
  147. esac
  148. if test x"$silent" != x"yes" && test x"$sim_env" != x""; then
  149. echo "Setting env flags = $sim_env" 6>&1
  150. fi],[sim_env=""])dnl
  151. AC_ARG_ENABLE(sim-filter,
  152. [ --enable-sim-filter=rule Specify filter rules.],
  153. [case "${enableval}" in
  154. yes) AC_MSG_ERROR("--enable-sim-filter must be specified with a rule to filter or no"); sim_filter="";;
  155. no) sim_filter="";;
  156. *) sim_filter="-F $enableval";;
  157. esac
  158. if test x"$silent" != x"yes" && test x"$sim_filter" != x""; then
  159. echo "Setting filter flags = $sim_filter" 6>&1
  160. fi],[sim_filter="-F 32,f,o"
  161. if test x"$silent" != x"yes"; then
  162. echo "Setting filter flags = $sim_filter" 6>&1
  163. fi])dnl
  164. AC_ARG_ENABLE(sim-float,
  165. [ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
  166. [case "${enableval}" in
  167. yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
  168. no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
  169. altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
  170. *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
  171. *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
  172. esac
  173. if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
  174. echo "Setting float flags = $sim_float" 6>&1
  175. fi],[
  176. case "${target}" in
  177. *altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
  178. *spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
  179. *) sim_float=""
  180. esac
  181. ])dnl
  182. AC_CACHE_CHECK([if union semun defined],
  183. ac_cv_HAS_UNION_SEMUN,
  184. [AC_TRY_COMPILE([
  185. #include <sys/types.h>
  186. #include <sys/ipc.h>
  187. #include <sys/sem.h>],
  188. [union semun arg ;],
  189. [ac_cv_has_union_semun="yes"],
  190. [ac_cv_has_union_semun="no"])
  191. AC_MSG_RESULT($ac_cv_has_union_semun)
  192. ])
  193. if test "$ac_cv_has_union_semun" = "yes"; then
  194. AC_CACHE_CHECK(whether System V semaphores are supported,
  195. ac_cv_sysv_sem,
  196. [
  197. AC_TRY_RUN(
  198. [
  199. #include <sys/types.h>
  200. #include <sys/ipc.h>
  201. #include <sys/sem.h>
  202. int main () {
  203. union semun arg ;
  204. int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
  205. if (id == -1)
  206. exit(1);
  207. arg.val = 0; /* avoid implicit type cast to union */
  208. if (semctl(id, 0, IPC_RMID, arg) == -1)
  209. exit(1);
  210. exit(0);
  211. }
  212. ],
  213. ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
  214. ])
  215. else # semun is not defined
  216. AC_CACHE_CHECK(whether System V semaphores are supported,
  217. ac_cv_sysv_sem,
  218. [
  219. AC_TRY_RUN(
  220. [
  221. #include <sys/types.h>
  222. #include <sys/ipc.h>
  223. #include <sys/sem.h>
  224. union semun {
  225. int val;
  226. struct semid_ds *buf;
  227. ushort *array;
  228. };
  229. int main () {
  230. union semun arg ;
  231. int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
  232. if (id == -1)
  233. exit(1);
  234. arg.val = 0; /* avoid implicit type cast to union */
  235. if (semctl(id, 0, IPC_RMID, arg) == -1)
  236. exit(1);
  237. exit(0);
  238. }
  239. ],
  240. ac_cv_sysv_sem="yes", ac_cv_sysv_sem="no", :)
  241. ])
  242. fi
  243. AC_CACHE_CHECK(whether System V shared memory is supported,
  244. ac_cv_sysv_shm,
  245. [
  246. AC_TRY_RUN([
  247. #include <sys/types.h>
  248. #include <sys/ipc.h>
  249. #include <sys/shm.h>
  250. int main () {
  251. int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
  252. if (id == -1)
  253. exit(1);
  254. if (shmctl(id, IPC_RMID, 0) == -1)
  255. exit(1);
  256. exit(0);
  257. }
  258. ],
  259. ac_cv_sysv_shm="yes", ac_cv_sysv_shm="no", :)
  260. ])
  261. if test x"$ac_cv_sysv_shm" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
  262. sim_sysv_ipc_hw=",sem,shm";
  263. else
  264. sim_sysv_ipc_hw="";
  265. fi
  266. if test x"$ac_cv_has_union_semun" = x"yes" -a x"$ac_cv_sysv_sem" = x"yes" ; then
  267. AC_DEFINE(HAVE_UNION_SEMUN, 1,
  268. [Define if union semun is defined in <sys/sem.h>])
  269. fi
  270. AC_ARG_ENABLE(sim-hardware,
  271. [ --enable-sim-hardware=list Specify the hardware to be included in the build.],
  272. [hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
  273. case "${enableval}" in
  274. yes) ;;
  275. no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
  276. ,*) hardware="${hardware}${enableval}";;
  277. *,) hardware="${enableval}${hardware}";;
  278. *) hardware="${enableval}"'';;
  279. esac
  280. sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
  281. sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
  282. if test x"$silent" != x"yes" && test x"$hardware" != x""; then
  283. echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
  284. fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide${sim_sysv_ipc_hw}"
  285. sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
  286. sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
  287. if test x"$silent" != x"yes"; then
  288. echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
  289. fi])dnl
  290. AC_ARG_ENABLE(sim-hostbitsize,
  291. [ --enable-sim-hostbitsize=32|64 Specify host bitsize (32 or 64).],
  292. [case "${enableval}" in
  293. 32|64) sim_hostbitsize="-DWITH_HOST_WORD_BITSIZE=$enableval";;
  294. *) AC_MSG_ERROR("--enable-sim-hostbitsize was given $enableval. Expected 32 or 64"); sim_hostbitsize="";;
  295. esac
  296. if test x"$silent" != x"yes" && test x"$sim_hostbitsize" != x""; then
  297. echo "Setting hostbitsize flags = $sim_hostbitsize" 6>&1
  298. fi],[sim_hostbitsize=""])dnl
  299. AC_ARG_ENABLE(sim-hostendian,
  300. [ --enable-sim-hostendian=end Specify host byte endian orientation.],
  301. [case "${enableval}" in
  302. no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
  303. b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
  304. l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
  305. *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
  306. esac
  307. if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
  308. echo "Setting hostendian flags = $sim_hostendian" 6>&1
  309. fi],[
  310. if test "x$cross_compiling" = "xno"; then
  311. AC_C_BIGENDIAN
  312. if test $ac_cv_c_bigendian = yes; then
  313. sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
  314. else
  315. sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
  316. fi
  317. else
  318. sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
  319. fi])dnl
  320. AC_ARG_ENABLE(sim-icache,
  321. [ --enable-sim-icache=size Specify instruction-decode cache size and type.],
  322. [icache="-R"
  323. case "${enableval}" in
  324. yes) icache="1024"; sim_icache="-I $icache";;
  325. no) sim_icache="-R";;
  326. *) icache=1024
  327. sim_icache="-"
  328. for x in `echo "${enableval}" | sed -e "s/,/ /g"`; do
  329. case "$x" in
  330. define) sim_icache="${sim_icache}R";;
  331. semantic) sim_icache="${sim_icache}C";;
  332. insn) sim_icache="${sim_icache}S";;
  333. 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;;
  334. *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";;
  335. esac
  336. done
  337. sim_icache="${sim_icache}I $icache";;
  338. esac
  339. if test x"$silent" != x"yes" && test x"$icache" != x""; then
  340. echo "Setting instruction cache size to $icache ($sim_icache)"
  341. fi],[sim_icache="-CSRI 1024"
  342. if test x"$silent" != x"yes"; then
  343. echo "Setting instruction cache size to 1024 ($sim_icache)"
  344. fi])dnl
  345. AC_ARG_ENABLE(sim-inline,
  346. [ --enable-sim-inline=inlines Specify which functions should be inlined.],
  347. [sim_inline=""
  348. case "$enableval" in
  349. no) sim_inline="-DDEFAULT_INLINE=0";;
  350. 0) sim_inline="-DDEFAULT_INLINE=0";;
  351. yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";;
  352. 1) sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS";;
  353. *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
  354. new_flag=""
  355. case "$x" in
  356. *_INLINE=*) new_flag="-D$x";;
  357. *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
  358. *_INLINE) new_flag="-D$x=ALL_INLINE";;
  359. *) new_flag="-D$x""_INLINE=ALL_INLINE";;
  360. esac
  361. if test x"$sim_inline" = x""; then
  362. sim_inline="$new_flag"
  363. else
  364. sim_inline="$sim_inline $new_flag"
  365. fi
  366. done;;
  367. esac
  368. if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
  369. echo "Setting inline flags = $sim_inline" 6>&1
  370. fi],[if test x"$GCC" != ""; then
  371. sim_inline="-DDEFAULT_INLINE=PSIM_INLINE_LOCALS"
  372. if test x"$silent" != x"yes"; then
  373. echo "Setting inline flags = $sim_inline" 6>&1
  374. fi
  375. else
  376. sim_inline=""
  377. fi])dnl
  378. AC_ARG_ENABLE(sim-jump,
  379. [ --enable-sim-jump Jump between semantic code (instead of call/return).],
  380. [case "${enableval}" in
  381. yes) sim_jump="-J";;
  382. no) sim_jump="";;
  383. *) AC_MSG_ERROR("--enable-sim-jump does not take a value"); sim_jump="";;
  384. esac
  385. if test x"$silent" != x"yes" && test x"$sim_jump" != x""; then
  386. echo "Setting jump flag = $sim_jump" 6>&1
  387. fi],[sim_jump=""
  388. if test x"$silent" != x"yes"; then
  389. echo "Setting jump flag = $sim_jump" 6>&1
  390. fi])dnl
  391. AC_ARG_ENABLE(sim-line-nr,
  392. [ --enable-sim-line-nr=opts Generate extra CPP code that references source rather than generated code],
  393. [case "${enableval}" in
  394. yes) sim_line_nr="";;
  395. no) sim_line_nr="-L";;
  396. *) AC_MSG_ERROR("--enable-sim-line-nr does not take a value"); sim_line_nr="";;
  397. esac
  398. if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then
  399. echo "Setting warning flags = $sim_line_nr" 6>&1
  400. fi],[sim_line_nr=""])dnl
  401. AC_ARG_ENABLE(sim-model,
  402. [ --enable-sim-model=which Specify PowerPC to model.],
  403. [case "${enableval}" in
  404. yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-model=model");;
  405. *) sim_model="-DWITH_MODEL=${enableval}";;
  406. esac
  407. if test x"$silent" != x"yes" && test x"$sim_model" != x""; then
  408. echo "Setting model flags = $sim_model" 6>&1
  409. fi],[sim_model=""])dnl
  410. AC_ARG_ENABLE(sim-model-issue,
  411. [ --enable-sim-model-issue Specify whether to simulate model specific actions],
  412. [case "${enableval}" in
  413. yes) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_PROCESS";;
  414. no) sim_model_issue="-DWITH_MODEL_ISSUE=MODEL_ISSUE_IGNORE";;
  415. *) AC_MSG_ERROR("--enable-sim-model-issue does not take a value"); sim_model_issue="";;
  416. esac
  417. if test x"$silent" != x"yes"; then
  418. echo "Setting model-issue flags = $sim_model_issue" 6>&1
  419. fi],[sim_model_issue=""])dnl
  420. AC_ARG_ENABLE(sim-monitor,
  421. [ --enable-sim-monitor=mon Specify whether to enable monitoring events.],
  422. [case "${enableval}" in
  423. yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";;
  424. no) sim_monitor="-DWITH_MON=0";;
  425. instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
  426. memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
  427. *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon"); sim_env="";;
  428. esac
  429. if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
  430. echo "Setting monitor flags = $sim_monitor" 6>&1
  431. fi],[sim_monitor=""])dnl
  432. AC_ARG_ENABLE(sim-opcode,
  433. [ --enable-sim-opcode=which Override default opcode lookup.],
  434. [case "${enableval}" in
  435. yes|no) AC_MSG_ERROR("No value supplied for --enable-sim-opcode=file");;
  436. *) if test -f "${srcdir}/${enableval}"; then
  437. sim_opcode="${enableval}"
  438. elif test -f "${srcdir}/dc-${enableval}"; then
  439. sim_opcode="dc-${enableval}"
  440. else
  441. AC_MSG_ERROR("File $enableval is not an opcode rules file");
  442. sim_opcode="dc-complex"
  443. fi;;
  444. esac
  445. if test x"$silent" != x"yes" && test x"$sim_opcode" != x""; then
  446. echo "Setting opcode flags = $sim_opcode" 6>&1
  447. fi],[sim_opcode="dc-complex"
  448. if test x"$silent" != x"yes"; then
  449. echo "Setting opcode flags = $sim_opcode"
  450. fi])dnl
  451. AC_ARG_ENABLE(sim-packages,
  452. [ --enable-sim-packages=list Specify the packages to be included in the build.],
  453. [packages=disklabel
  454. case "${enableval}" in
  455. yes) ;;
  456. no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
  457. ,*) packages="${packages}${enableval}";;
  458. *,) packages="${enableval}${packages}";;
  459. *) packages="${enableval}"'';;
  460. esac
  461. sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
  462. sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
  463. if test x"$silent" != x"yes" && test x"$packages" != x""; then
  464. echo "Setting packages to $sim_pk_src, $sim_pk_obj"
  465. fi],[packages=disklabel
  466. sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
  467. sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
  468. if test x"$silent" != x"yes"; then
  469. echo "Setting packages to $sim_pk_src, $sim_pk_obj"
  470. fi])dnl
  471. AC_ARG_ENABLE(sim-regparm,
  472. [ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.],
  473. [case "${enableval}" in
  474. 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
  475. no) sim_regparm="" ;;
  476. yes) sim_regparm="-DWITH_REGPARM=3";;
  477. *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
  478. esac
  479. if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
  480. echo "Setting regparm flags = $sim_regparm" 6>&1
  481. fi],[sim_regparm=""])dnl
  482. AC_ARG_ENABLE(sim-reserved-bits,
  483. [ --enable-sim-reserved-bits Specify whether to check reserved bits in instruction.],
  484. [case "${enableval}" in
  485. yes) sim_reserved="-DWITH_RESERVED_BITS=1";;
  486. no) sim_reserved="-DWITH_RESERVED_BITS=0";;
  487. *) AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved="";;
  488. esac
  489. if test x"$silent" != x"yes" && test x"$sim_reserved" != x""; then
  490. echo "Setting reserved flags = $sim_reserved" 6>&1
  491. fi],[sim_reserved=""])dnl
  492. AC_ARG_ENABLE(sim-smp,
  493. [ --enable-sim-smp=n Specify number of processors to configure for.],
  494. [case "${enableval}" in
  495. yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
  496. no) sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
  497. *) sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
  498. esac
  499. if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
  500. echo "Setting smp flags = $sim_smp" 6>&1
  501. fi],[sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5"
  502. if test x"$silent" != x"yes"; then
  503. echo "Setting smp flags = $sim_smp" 6>&1
  504. fi])dnl
  505. AC_ARG_ENABLE(sim-stdcall,
  506. [ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.],
  507. [case "${enableval}" in
  508. no) sim_stdcall="" ;;
  509. std*) sim_stdcall="-DWITH_STDCALL=1";;
  510. yes) sim_stdcall="-DWITH_STDCALL=1";;
  511. *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
  512. esac
  513. if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
  514. echo "Setting function call flags = $sim_stdcall" 6>&1
  515. fi],[sim_stdcall=""])dnl
  516. AC_ARG_ENABLE(sim-stdio,
  517. [ --enable-sim-stdio Specify whether to use stdio for console input/output.],
  518. [case "${enableval}" in
  519. yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
  520. no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
  521. *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
  522. esac
  523. if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
  524. echo "Setting stdio flags = $sim_stdio" 6>&1
  525. fi],[sim_stdio=""])dnl
  526. AC_ARG_ENABLE(sim-switch,
  527. [ --enable-sim-switch Use a switch instead of a table for instruction call.],
  528. [case "${enableval}" in
  529. yes) sim_switch="-s";;
  530. no) sim_switch="";;
  531. *) AC_MSG_ERROR("--enable-sim-switch does not take a value"); sim_switch="";;
  532. esac
  533. if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then
  534. echo "Setting switch flags = $sim_switch" 6>&1
  535. fi],[sim_switch="";
  536. if test x"$silent" != x"yes"; then
  537. echo "Setting switch flags = $sim_switch" 6>&1
  538. fi])dnl
  539. AC_ARG_ENABLE(sim-timebase,
  540. [ --enable-sim-timebase Specify whether the PPC timebase is supported.],
  541. [case "${enableval}" in
  542. yes) sim_timebase="-DWITH_TIME_BASE=1";;
  543. no) sim_timebase="-DWITH_TIME_BASE=0";;
  544. *) AC_MSG_ERROR("--enable-sim-timebase does not take a value"); sim_timebase="";;
  545. esac
  546. if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
  547. echo "Setting timebase flags = $sim_timebase" 6>&1
  548. fi],[sim_timebase=""])dnl
  549. AC_ARG_ENABLE(sim-trace,
  550. [ --enable-sim-trace Specify whether tracing is supported.],
  551. [case "${enableval}" in
  552. yes) sim_trace="-DWITH_TRACE=1";;
  553. no) sim_trace="-DWITH_TRACE=0";;
  554. *) AC_MSG_ERROR("--enable-sim-trace does not take a value"); sim_trace="";;
  555. esac
  556. if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
  557. echo "Setting trace flags = $sim_trace" 6>&1
  558. fi],[sim_trace=""])dnl
  559. AC_ARG_ENABLE(sim-warnings,
  560. [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o],
  561. [case "${enableval}" in
  562. yes) sim_warnings="-Werror -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations ";;
  563. no) sim_warnings="-w";;
  564. *) sim_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
  565. esac
  566. if test x"$silent" != x"yes" && test x"$sim_warnings" != x""; then
  567. echo "Setting warning flags = $sim_warnings" 6>&1
  568. fi],[sim_warnings=""])dnl
  569. AC_ARG_ENABLE(sim-xor-endian,
  570. [ --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8).],
  571. [case "${enableval}" in
  572. yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
  573. no) sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
  574. *) sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
  575. esac
  576. if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
  577. echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
  578. fi],[sim_xor_endian=""])dnl
  579. ACX_PKGVERSION([GDB])
  580. ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
  581. AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
  582. AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
  583. AC_CANONICAL_SYSTEM
  584. AC_ARG_PROGRAM
  585. # BFD conditionally uses zlib, so we must link it in if libbfd does, by
  586. # using the same condition.
  587. AM_ZLIB
  588. # BFD uses libdl when when plugins enabled.
  589. AC_PLUGINS
  590. . ${srcdir}/../../bfd/configure.host
  591. case ${host} in
  592. *mingw32*)
  593. AC_DEFINE(USE_WIN32API, 1,
  594. [Define if we should use the Windows API, instead of the
  595. POSIX API. On Windows, we use the Windows API when
  596. building for MinGW, but the POSIX API when building
  597. for Cygwin.])
  598. ;;
  599. esac
  600. AC_CONFIG_HEADER(config.h:config.in)
  601. AC_STRUCT_ST_BLKSIZE
  602. AC_STRUCT_ST_BLOCKS
  603. AC_STRUCT_ST_RDEV
  604. AC_STRUCT_TIMEZONE
  605. AC_TYPE_GETGROUPS
  606. AC_TYPE_MODE_T
  607. AC_TYPE_OFF_T
  608. AC_TYPE_PID_T
  609. AC_TYPE_SIGNAL
  610. AC_TYPE_SIZE_T
  611. AC_TYPE_UID_T
  612. AC_CHECK_FUNCS(access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink)
  613. AC_CHECK_HEADERS(fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h time.h unistd.h sys/vfs.h sys/statfs.h)
  614. AC_HEADER_DIRENT
  615. dnl Figure out what type of termio/termios support there is
  616. sim_termio=""
  617. AC_MSG_CHECKING(for struct termios)
  618. AC_CACHE_VAL(ac_cv_termios_struct,
  619. [AC_TRY_COMPILE([#include <sys/types.h>
  620. #include <sys/termios.h>],
  621. [static struct termios x;
  622. x.c_iflag = 0;
  623. x.c_oflag = 0;
  624. x.c_cflag = 0;
  625. x.c_lflag = 0;
  626. x.c_cc[NCCS] = 0;],
  627. ac_cv_termios_struct=yes, ac_cv_termios_struct=no)])
  628. AC_MSG_RESULT($ac_cv_termios_struct)
  629. if test $ac_cv_termios_struct = yes; then
  630. sim_termio="$sim_termio -DHAVE_TERMIOS_STRUCTURE"
  631. fi
  632. if test "$ac_cv_termios_struct" = "yes"; then
  633. AC_MSG_CHECKING(for c_line field in struct termios)
  634. AC_CACHE_VAL(ac_cv_termios_cline,
  635. [AC_TRY_COMPILE([#include <sys/types.h>
  636. #include <sys/termios.h>],
  637. [static struct termios x; x.c_line = 0;],
  638. ac_cv_termios_cline=yes, ac_cv_termios_cline=no)])
  639. AC_MSG_RESULT($ac_cv_termios_cline)
  640. if test $ac_cv_termios_cline = yes; then
  641. sim_termio="$sim_termio -DHAVE_TERMIOS_CLINE"
  642. fi
  643. else
  644. ac_cv_termios_cline=no
  645. fi
  646. if test "$ac_cv_termios_struct" != "yes"; then
  647. AC_MSG_CHECKING(for struct termio)
  648. AC_CACHE_VAL(ac_cv_termio_struct,
  649. [AC_TRY_COMPILE([#include <sys/types.h>
  650. #include <sys/termio.h>],
  651. [static struct termio x;
  652. x.c_iflag = 0;
  653. x.c_oflag = 0;
  654. x.c_cflag = 0;
  655. x.c_lflag = 0;
  656. x.c_cc[NCC] = 0;],
  657. ac_cv_termio_struct=yes, ac_cv_termio_struct=no)])
  658. AC_MSG_RESULT($ac_cv_termio_struct)
  659. if test $ac_cv_termio_struct = yes; then
  660. sim_termio="$sim_termio -DHAVE_TERMIO_STRUCTURE"
  661. fi
  662. else
  663. ac_cv_termio_struct=no
  664. fi
  665. if test "$ac_cv_termio_struct" = "yes"; then
  666. AC_MSG_CHECKING(for c_line field in struct termio)
  667. AC_CACHE_VAL(ac_cv_termio_cline,
  668. [AC_TRY_COMPILE([#include <sys/types.h>
  669. #include <sys/termio.h>],
  670. [static struct termio x; x.c_line = 0;],
  671. ac_cv_termio_cline=yes, ac_cv_termio_cline=no)])
  672. AC_MSG_RESULT($ac_cv_termio_cline)
  673. if test $ac_cv_termio_cline = yes; then
  674. sim_termio="$sim_termio -DHAVE_TERMIO_CLINE"
  675. fi
  676. else
  677. ac_cv_termio_cline=no
  678. fi
  679. dnl Check for struct statfs
  680. AC_MSG_CHECKING(for struct statfs)
  681. AC_CACHE_VAL(ac_cv_struct_statfs,
  682. [AC_TRY_COMPILE([#include <sys/types.h>
  683. #ifdef HAVE_SYS_PARAM_H
  684. #include <sys/param.h>
  685. #endif
  686. #ifdef HAVE_SYS_MOUNT_H
  687. #include <sys/mount.h>
  688. #endif
  689. #ifdef HAVE_SYS_VFS_H
  690. #include <sys/vfs.h>
  691. #endif
  692. #ifdef HAVE_SYS_STATFS_H
  693. #include <sys/statfs.h>
  694. #endif],
  695. [static struct statfs s;],
  696. ac_cv_struct_statfs=yes, ac_cv_struct_statfs=no)])
  697. AC_MSG_RESULT($ac_cv_struct_statfs)
  698. if test $ac_cv_struct_statfs = yes; then
  699. AC_DEFINE(HAVE_STRUCT_STATFS, 1,
  700. [Define if struct statfs is defined in <sys/mount.h>])
  701. fi
  702. AC_CHECK_TYPES(long long)
  703. dnl Figure out if /dev/zero exists or not
  704. sim_devzero=""
  705. AC_MSG_CHECKING(for /dev/zero)
  706. AC_CACHE_VAL(ac_cv_devzero,
  707. [AC_TRY_RUN([#include <fcntl.h>
  708. main () {
  709. char buf[2048];
  710. int i;
  711. int fd = open ("/dev/zero", O_RDONLY);
  712. if (fd < 0)
  713. return 1;
  714. for (i = 0; i < sizeof (buf); i++)
  715. buf[i] = 1;
  716. if (read (fd, buf, sizeof (buf)) != sizeof (buf))
  717. return 1;
  718. for (i = 0; i < sizeof (buf); i++)
  719. if (buf[i])
  720. return 1;
  721. return 0;
  722. }],[ac_cv_devzero=yes],[ac_cv_devzero=no],[ac_cv_devzero=no])])
  723. AC_MSG_RESULT($ac_cv_devzero)
  724. if test $ac_cv_devzero = yes; then
  725. sim_devzero="-DHAVE_DEVZERO"
  726. else
  727. sim_devzero=""
  728. fi
  729. dnl Figure out if we are in the new Cygnus tree with a common directory or not
  730. AC_MSG_CHECKING(for common simulator directory)
  731. if test -f "${srcdir}/../common/callback.c"; then
  732. AC_MSG_RESULT(yes)
  733. sim_callback="callback.o targ-map.o"
  734. sim_targ_vals="targ-vals.h targ-map.c targ-vals.def"
  735. else
  736. AC_MSG_RESULT(no)
  737. sim_callback=""
  738. sim_targ_vals=""
  739. fi
  740. AC_MSG_CHECKING(for common simulator directory fpu implementation)
  741. if test -f "${srcdir}/../common/sim-fpu.c"; then
  742. AC_MSG_RESULT(yes)
  743. sim_fpu_cflags="-DHAVE_COMMON_FPU -I../common -I${srcdir}/../common"
  744. sim_fpu="sim-fpu.o"
  745. else
  746. AC_MSG_RESULT(no)
  747. sim_fpu_cflags=
  748. sim_fpu=
  749. fi
  750. # Since we run commands on the build system, we have to create a
  751. # separate config header for the build system if build != host.
  752. if test x$host = x$build; then
  753. AC_CONFIG_COMMANDS([build-config.h],[cp config.h build-config.h])
  754. else
  755. tempdir=build.$$
  756. rm -rf $tempdir
  757. mkdir $tempdir
  758. cd $tempdir
  759. case ${srcdir} in
  760. /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
  761. *) realsrcdir=../${srcdir};;
  762. esac
  763. saved_CFLAGS="${CFLAGS}"
  764. CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
  765. LDFLAGS="${LDFLAGS_FOR_BUILD}" \
  766. ${realsrcdir}/configure \
  767. --enable-languages=${enable_languages-all} \
  768. --target=$target_alias --host=$build_alias --build=$build_alias
  769. CFLAGS="${saved_CFLAGS}"
  770. mv config.h ../build-config.h
  771. cd ..
  772. rm -rf $tempdir
  773. fi
  774. dnl Check for exe extension
  775. AC_EXEEXT
  776. AC_SUBST(CC_FOR_BUILD)
  777. AC_SUBST(CFLAGS_FOR_BUILD)
  778. AC_SUBST(CFLAGS)
  779. AC_SUBST(HDEFINES)
  780. AR=${AR-ar}
  781. AC_SUBST(AR)
  782. AC_PROG_RANLIB
  783. AC_SUBST(sim_cflags)
  784. AC_SUBST(sim_warnings)
  785. AC_SUBST(sim_line_nr)
  786. AC_SUBST(sim_config)
  787. AC_SUBST(sim_opcode)
  788. AC_SUBST(sim_switch)
  789. AC_SUBST(sim_dup)
  790. AC_SUBST(sim_decode_mechanism)
  791. AC_SUBST(sim_jump)
  792. AC_SUBST(sim_filter)
  793. AC_SUBST(sim_icache)
  794. AC_SUBST(sim_hw_src)
  795. AC_SUBST(sim_hw_obj)
  796. AC_SUBST(sim_pk_src)
  797. AC_SUBST(sim_pk_obj)
  798. AC_SUBST(sim_inline)
  799. AC_SUBST(sim_bswap)
  800. AC_SUBST(sim_endian)
  801. AC_SUBST(sim_regparm)
  802. AC_SUBST(sim_stdcall)
  803. AC_SUBST(sim_xor_endian)
  804. AC_SUBST(sim_hostendian)
  805. AC_SUBST(sim_smp)
  806. AC_SUBST(sim_igen_smp)
  807. AC_SUBST(sim_bitsize)
  808. AC_SUBST(sim_hostbitsize)
  809. AC_SUBST(sim_env)
  810. AC_SUBST(sim_timebase)
  811. AC_SUBST(sim_alignment)
  812. AC_SUBST(sim_float)
  813. AC_SUBST(sim_trace)
  814. AC_SUBST(sim_assert)
  815. AC_SUBST(sim_reserved)
  816. AC_SUBST(sim_monitor)
  817. AC_SUBST(sim_model)
  818. AC_SUBST(sim_default_model)
  819. AC_SUBST(sim_model_issue)
  820. AC_SUBST(sim_stdio)
  821. AC_SUBST(sim_termio)
  822. AC_SUBST(sim_devzero)
  823. AC_SUBST(sim_callback)
  824. AC_SUBST(sim_targ_vals)
  825. AC_SUBST(sim_fpu_cflags)
  826. AC_SUBST(sim_fpu)
  827. AC_OUTPUT(Makefile,
  828. [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])