Remove path name from test case
[binutils-gdb.git] / sim / configure.ac
index ecf12b57a19baff59ec22ab46887880dc5816a99..ecda34a6b3fc7b9f66a4fc2d28dd0f0c58898fae 100644 (file)
@@ -5,6 +5,13 @@ AC_INIT([sim], [0],
   [https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim],
   [], [https://sourceware.org/gdb/wiki/Sim/])
 
+dnl Probably should unify PKGVERSION with PACKAGE_* settings from AC_INIT.
+ACX_PKGVERSION([SIM])
+AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
+dnl PACKAGE_BUGREPORT is provided by AC_INIT.
+ACX_BUGURL([$PACKAGE_BUGREPORT])
+AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
+
 AC_CONFIG_HEADERS([config.h])
 
 SIM_AC_TOOLCHAIN
@@ -12,6 +19,7 @@ SIM_AC_PLATFORM
 
 AM_MAINTAINER_MODE
 AM_INIT_AUTOMAKE
+AM_SILENT_RULES([yes])
 
 # If a cpu ever has more than one simulator to choose from, use
 # --enable-sim=... to choose.
@@ -40,24 +48,49 @@ dnl used when installing files to see if they need to be suffixed.
 SIM_PRIMARY_TARGET=
 AC_SUBST(SIM_PRIMARY_TARGET)
 
-m4_define([SIM_TARGET], [
+dnl List of enabled arch backends.
+SIM_ENABLED_ARCHES=
+AC_SUBST(SIM_ENABLED_ARCHES)
+
+ENABLE_SIM=no
+dnl Build a particular arch subdir.
+dnl arg[1] is the arch subdir name.
+dnl arg[2] is whether the arch has a dedicated configure script.
+m4_define([SIM_BUILD_TARGET], [dnl
+  ENABLE_SIM=yes
+  AS_VAR_APPEND([SIM_ENABLED_ARCHES], [" $1"])
+  m4_if($2, [true], [dnl
+    AC_CONFIG_SUBDIRS($1)
+  ])
+  AC_CONFIG_FILES($1/.gdbinit:common/gdbinit.in)
+])
+dnl Enable a particular arch subdir.
+dnl arg[1] is the matching target triple.
+dnl arg[2] is the arch subdir name.
+dnl arg[3] is whether the arch has a dedicated configure script.
+m4_define([SIM_TARGET], [dnl
+  sim_enable_arch_$2=false
   case "${targ}" in
     all|$1)
       if test "${targ}" = "${target}"; then
         SIM_PRIMARY_TARGET=$2
       fi
-      AC_CONFIG_SUBDIRS($2)
-      $3
+      SIM_BUILD_TARGET($2, $3)
+      sim_enable_arch_$2=true
       ;;
   esac
+  SIM_AC_TOOLCHAIN_FOR_TARGET($2)
+  AM_CONDITIONAL([SIM_ENABLE_ARCH_$2], [${sim_enable_arch_$2}])
 ])
 
 dnl WHEN ADDING ENTRIES TO THIS MATRIX:
 dnl Make sure that the left side always has two dashes.  Otherwise you can get
 dnl spurious matches.  Even for unambiguous cases, do this as a convention, else
 dnl the table becomes a real mess to understand and maintain.
+dnl
+dnl NB: Target matching is aligned with gdb/configure.tgt.  Changes must be kept
+dnl in sync with that file.
 if test "${enable_sim}" != no; then
-  sim_igen=no
   for targ in `echo $target $enable_targets | sed 's/,/ /g'`
   do
     SIM_TARGET([aarch64*-*-*], [aarch64])
@@ -69,6 +102,7 @@ if test "${enable_sim}" != no; then
     SIM_TARGET([cris-*-* | crisv32-*-*], [cris])
     SIM_TARGET([d10v-*-*], [d10v])
     SIM_TARGET([frv-*-*], [frv])
+    SIM_TARGET([ft32-*-*], [ft32])
     SIM_TARGET([h8300*-*-*], [h8300])
     SIM_TARGET([iq2000-*-*], [iq2000])
     SIM_TARGET([lm32-*-*], [lm32])
@@ -76,31 +110,53 @@ if test "${enable_sim}" != no; then
     SIM_TARGET([m32r-*-*], [m32r])
     SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11])
     SIM_TARGET([mcore-*-*], [mcore])
-    SIM_TARGET([microblaze-*-*], [microblaze])
-    SIM_TARGET([mips*-*-*], [mips], [sim_igen=yes])
-    SIM_TARGET([mn10300*-*-*], [mn10300], [sim_igen=yes])
+    SIM_TARGET([microblaze*-*-*], [microblaze])
+    SIM_TARGET([mips*-*-*], [mips])
+    SIM_TARGET([mn10300*-*-*], [mn10300])
     SIM_TARGET([moxie-*-*], [moxie])
     SIM_TARGET([msp430*-*-*], [msp430])
-    SIM_TARGET([or1k-*-* | or1knd-*-*], [or1k])
+    SIM_TARGET([or1k*-*-*], [or1k])
+    SIM_TARGET([powerpc*-*-*], [ppc], [true])
     SIM_TARGET([pru*-*-*], [pru])
     SIM_TARGET([riscv*-*-*], [riscv])
     SIM_TARGET([rl78-*-*], [rl78])
     SIM_TARGET([rx-*-*], [rx])
     SIM_TARGET([sh*-*-*], [sh])
-    SIM_TARGET([sparc-*-rtems*|sparc-*-elf*], [erc32])
-    SIM_TARGET([powerpc*-*-*], [ppc])
-    SIM_TARGET([ft32-*-*], [ft32])
-    SIM_TARGET([v850*-*-*], [v850], [sim_igen=yes])
+    SIM_TARGET([sparc-*-*], [erc32])
+    SIM_TARGET([v850*-*-*], [v850])
   done
 
   if test "x${enable_example_sims}" = xyes; then
-    AC_CONFIG_SUBDIRS(example-synacor)
+    SIM_AC_TOOLCHAIN_FOR_TARGET(example-synacor)
+    SIM_BUILD_TARGET([example-synacor])
   fi
+  AM_CONDITIONAL([SIM_ENABLE_ARCH_examples], [test "${enable_example_sims}" = "yes"])
 fi
-AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
+AM_CONDITIONAL([ENABLE_SIM], [test "$ENABLE_SIM" = "yes"])
 
+dnl Standard (and optional) simulator options.
+dnl Eventually all simulators will support these.
+SIM_AC_OPTION_ALIGNMENT
 SIM_AC_OPTION_ASSERT
+SIM_AC_OPTION_CGEN_MAINT
+SIM_AC_OPTION_DEBUG
+SIM_AC_OPTION_ENDIAN
 SIM_AC_OPTION_ENVIRONMENT
+SIM_AC_OPTION_HARDWARE
+SIM_AC_OPTION_INLINE
+SIM_AC_OPTION_PROFILE
+SIM_AC_OPTION_RESERVED_BITS
+SIM_AC_OPTION_SCACHE
+SIM_AC_OPTION_SMP
+SIM_AC_OPTION_STDIO
+SIM_AC_OPTION_TRACE
+SIM_AC_OPTION_WARNINGS
+
+dnl Some arches have unique configure flags.
+m4_include([frv/acinclude.m4])
+m4_include([mips/acinclude.m4])
+m4_include([riscv/acinclude.m4])
+m4_include([rx/acinclude.m4])
 
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([arch-subdir.mk Makefile .gdbinit:gdbinit.in])
 AC_OUTPUT