configure.ac 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl NB: The version here is not used. If gdb ever changes from generating its
  3. dnl version at build time to autoconf time (like bfd et al do), we can switch.
  4. AC_INIT([sim], [0],
  5. [https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim],
  6. [], [https://sourceware.org/gdb/wiki/Sim/])
  7. dnl Probably should unify PKGVERSION with PACKAGE_* settings from AC_INIT.
  8. ACX_PKGVERSION([SIM])
  9. AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
  10. dnl PACKAGE_BUGREPORT is provided by AC_INIT.
  11. ACX_BUGURL([$PACKAGE_BUGREPORT])
  12. AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
  13. AC_CONFIG_HEADERS([config.h])
  14. SIM_AC_TOOLCHAIN
  15. SIM_AC_PLATFORM
  16. AM_MAINTAINER_MODE
  17. AM_INIT_AUTOMAKE
  18. AM_SILENT_RULES([yes])
  19. # If a cpu ever has more than one simulator to choose from, use
  20. # --enable-sim=... to choose.
  21. AC_ARG_ENABLE(sim,
  22. [AS_HELP_STRING([--enable-sim], [Enable the GNU simulator])],
  23. [case "${enableval}" in
  24. yes | no) ;;
  25. *) AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;;
  26. esac])
  27. AC_ARG_ENABLE([example-sims],
  28. [AC_HELP_STRING([--enable-example-sims],
  29. [enable example GNU simulators])])
  30. AC_ARG_ENABLE(targets,
  31. [ --enable-targets alternative target configurations],
  32. [case "${enableval}" in
  33. yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
  34. ;;
  35. no) enable_targets= ;;
  36. *) enable_targets=$enableval ;;
  37. esac])
  38. dnl Used to keep track of which target (if any) is the default one. This is
  39. dnl used when installing files to see if they need to be suffixed.
  40. SIM_PRIMARY_TARGET=
  41. AC_SUBST(SIM_PRIMARY_TARGET)
  42. SIM_SUBDIRS=
  43. AC_SUBST(SIM_SUBDIRS)
  44. dnl Used by common/Make-common.in to see which configure script created it.
  45. SIM_COMMON_BUILD_TRUE=
  46. SIM_COMMON_BUILD_FALSE='#'
  47. AC_SUBST(SIM_COMMON_BUILD_TRUE)
  48. AC_SUBST(SIM_COMMON_BUILD_FALSE)
  49. AC_CONFIG_FILES(Make-common.sim:common/Make-common.in)
  50. dnl Build a particular arch subdir.
  51. dnl arg[1] is the arch subdir name.
  52. dnl arg[2] is whether the arch has a dedicated configure script.
  53. m4_define([SIM_BUILD_TARGET], [dnl
  54. m4_if($2, [true], [dnl
  55. AC_CONFIG_SUBDIRS($1)
  56. ], [dnl
  57. AC_CONFIG_FILES($1/.gdbinit:common/gdbinit.in)
  58. AC_CONFIG_FILES($1/Makefile.sim:$1/Makefile.in)
  59. AC_CONFIG_COMMANDS([$1/Makefile],
  60. [sed -n \
  61. -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ {
  62. /^srcdir = / s:$:/$1:
  63. p
  64. }' \
  65. <Make-common.sim >$1/Makesim1.tmp
  66. sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >$1/Makesim2.tmp
  67. sed -e '/^## COMMON_PRE_/ r $1/Makesim1.tmp' \
  68. -e '/^## COMMON_POST_/ r $1/Makesim2.tmp' \
  69. <$1/Makefile.sim >$1/Makefile
  70. rm -f $1/Makesim1.tmp $1/Makesim2.tmp
  71. ])
  72. AS_VAR_APPEND([SIM_SUBDIRS], [" $1"])
  73. ])
  74. dnl Create the depdirs for ports until we can convert them to automake.
  75. AC_CONFIG_COMMANDS([depdir-$1],
  76. [$SHELL $ac_aux_dir/mkinstalldirs $1/$DEPDIR],
  77. [ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
  78. ])
  79. dnl Enable a particular arch subdir.
  80. dnl arg[1] is the matching target triple.
  81. dnl arg[2] is the arch subdir name.
  82. dnl arg[3] is whether the arch has a dedicated configure script.
  83. dnl arg[4] is any additional shell code to run for this arch.
  84. m4_define([SIM_TARGET], [dnl
  85. sim_enable_arch_$2=false
  86. case "${targ}" in
  87. all|$1)
  88. if test "${targ}" = "${target}"; then
  89. SIM_PRIMARY_TARGET=$2
  90. fi
  91. SIM_BUILD_TARGET($2, $3)
  92. sim_enable_arch_$2=true
  93. $4
  94. ;;
  95. esac
  96. SIM_AC_TOOLCHAIN_FOR_TARGET($2)
  97. AM_CONDITIONAL([SIM_ENABLE_ARCH_$2], [${sim_enable_arch_$2}])
  98. ])
  99. dnl WHEN ADDING ENTRIES TO THIS MATRIX:
  100. dnl Make sure that the left side always has two dashes. Otherwise you can get
  101. dnl spurious matches. Even for unambiguous cases, do this as a convention, else
  102. dnl the table becomes a real mess to understand and maintain.
  103. dnl
  104. dnl NB: Target matching is aligned with gdb/configure.tgt. Changes must be kept
  105. dnl in sync with that file.
  106. if test "${enable_sim}" != no; then
  107. sim_igen=no
  108. for targ in `echo $target $enable_targets | sed 's/,/ /g'`
  109. do
  110. SIM_TARGET([aarch64*-*-*], [aarch64])
  111. SIM_TARGET([arm*-*-*], [arm])
  112. SIM_TARGET([avr*-*-*], [avr])
  113. SIM_TARGET([bfin-*-*], [bfin])
  114. SIM_TARGET([bpf-*-*], [bpf], [true])
  115. SIM_TARGET([cr16*-*-*], [cr16])
  116. SIM_TARGET([cris-*-* | crisv32-*-*], [cris])
  117. SIM_TARGET([d10v-*-*], [d10v])
  118. SIM_TARGET([frv-*-*], [frv])
  119. SIM_TARGET([ft32-*-*], [ft32])
  120. SIM_TARGET([h8300*-*-*], [h8300])
  121. SIM_TARGET([iq2000-*-*], [iq2000])
  122. SIM_TARGET([lm32-*-*], [lm32])
  123. SIM_TARGET([m32c-*-*], [m32c])
  124. SIM_TARGET([m32r-*-*], [m32r])
  125. SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11])
  126. SIM_TARGET([mcore-*-*], [mcore])
  127. SIM_TARGET([microblaze*-*-*], [microblaze])
  128. SIM_TARGET([mips*-*-*], [mips], [true], [sim_igen=yes])
  129. SIM_TARGET([mn10300*-*-*], [mn10300], [true], [sim_igen=yes])
  130. SIM_TARGET([moxie-*-*], [moxie])
  131. SIM_TARGET([msp430*-*-*], [msp430])
  132. SIM_TARGET([or1k*-*-*], [or1k], [true])
  133. SIM_TARGET([powerpc*-*-*], [ppc], [true])
  134. SIM_TARGET([pru*-*-*], [pru])
  135. SIM_TARGET([riscv*-*-*], [riscv], [true])
  136. SIM_TARGET([rl78-*-*], [rl78])
  137. SIM_TARGET([rx-*-*], [rx])
  138. SIM_TARGET([sh*-*-*], [sh])
  139. SIM_TARGET([sparc-*-*], [erc32])
  140. SIM_TARGET([v850*-*-*], [v850], [true], [sim_igen=yes])
  141. done
  142. if test "x${enable_example_sims}" = xyes; then
  143. SIM_AC_TOOLCHAIN_FOR_TARGET(example-synacor)
  144. SIM_BUILD_TARGET([example-synacor])
  145. fi
  146. fi
  147. AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
  148. AM_CONDITIONAL([ENABLE_SIM], [test -n "$SIM_SUBDIRS"])
  149. dnl Standard (and optional) simulator options.
  150. dnl Eventually all simulators will support these.
  151. SIM_AC_OPTION_ALIGNMENT
  152. SIM_AC_OPTION_ASSERT
  153. SIM_AC_OPTION_CGEN_MAINT
  154. SIM_AC_OPTION_DEBUG
  155. SIM_AC_OPTION_ENDIAN
  156. SIM_AC_OPTION_ENVIRONMENT
  157. SIM_AC_OPTION_HARDWARE
  158. SIM_AC_OPTION_INLINE
  159. SIM_AC_OPTION_PROFILE
  160. SIM_AC_OPTION_RESERVED_BITS
  161. SIM_AC_OPTION_SCACHE
  162. SIM_AC_OPTION_STDIO
  163. SIM_AC_OPTION_TRACE
  164. SIM_AC_OPTION_WARNINGS
  165. dnl These are unfortunate. They are conditionally called by other sim macros
  166. dnl but always used by common/Make-common.in. So we have to subst here even
  167. dnl when the rest of the code is in the respective macros. Once we merge the
  168. dnl respective SIM_AC_OPTION_xxx call above, we can drop these.
  169. AC_SUBST(sim_bitsize)
  170. AC_SUBST(sim_float)
  171. dnl Some arches have unique configure flags.
  172. m4_include([frv/acinclude.m4])
  173. m4_include([rx/acinclude.m4])
  174. AC_CONFIG_FILES([arch-subdir.mk Makefile .gdbinit:gdbinit.in])
  175. AC_OUTPUT