]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/configure.ac
sim: drop configure scripts for simple ports
[thirdparty/binutils-gdb.git] / sim / configure.ac
index dad245e3bd13a73f4ce46e80584e4447fcec3077..62dcdeedb4e131d6ceac75c1eaa60fd380b4bc64 100644 (file)
 dnl Process this file with autoconf to produce a configure script.
-m4_include([../config/override.m4])
-AC_PREREQ(2.59)dnl
-AC_INIT(Makefile.in)
-
-AC_PROG_CC
-AC_PROG_INSTALL
-AC_CHECK_TOOL(AR, ar)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-
-AC_CANONICAL_SYSTEM
-AC_ARG_PROGRAM
-AC_PROG_CC
-AC_SUBST(CFLAGS)
-AC_SUBST(HDEFINES)
-AR=${AR-ar}
-AC_SUBST(AR)
-AC_PROG_RANLIB
-
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test "x$cross_compiling" = "xno"; then
-  CC_FOR_BUILD='$(CC)'
-else
-  CC_FOR_BUILD=gcc
-fi
-AC_SUBST(CC_FOR_BUILD)
-CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
-AC_SUBST(CFLAGS_FOR_BUILD)
+dnl NB: The version here is not used.  If gdb ever changes from generating its
+dnl version at build time to autoconf time (like bfd et al do), we can switch.
+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
+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.
 AC_ARG_ENABLE(sim,
-[  --enable-sim ],
+[AS_HELP_STRING([--enable-sim], [Enable the GNU simulator])],
 [case "${enableval}" in
 yes | no) ;;
 *)     AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;;
 esac])
 
-# WHEN ADDING ENTRIES TO THIS MATRIX:
+AC_ARG_ENABLE([example-sims],
+             [AC_HELP_STRING([--enable-example-sims],
+                             [enable example GNU simulators])])
 
-# Make sure that the left side always has two dashes.  Otherwise you
-# can get spurious matches.  Even for unambiguous cases, do this as a
-# convention, else the table becomes a real mess to understand and
-# maintain.
+AC_ARG_ENABLE(targets,
+[  --enable-targets        alternative target configurations],
+[case "${enableval}" in
+  yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
+           ;;
+  no)       enable_targets= ;;
+  *)        enable_targets=$enableval ;;
+esac])
 
+dnl Used to keep track of which target (if any) is the default one.  This is
+dnl used when installing files to see if they need to be suffixed.
+SIM_PRIMARY_TARGET=
+AC_SUBST(SIM_PRIMARY_TARGET)
+
+SIM_SUBDIRS=
+AC_SUBST(SIM_SUBDIRS)
+
+dnl Used by common/Make-common.in to see which configure script created it.
+SIM_COMMON_BUILD_TRUE=
+SIM_COMMON_BUILD_FALSE='#'
+AC_SUBST(SIM_COMMON_BUILD_TRUE)
+AC_SUBST(SIM_COMMON_BUILD_FALSE)
+
+AC_CONFIG_FILES(Make-common.sim:common/Make-common.in)
+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
+  m4_if($2, [true], [dnl
+    AC_CONFIG_SUBDIRS($1)
+  ], [dnl
+    AC_CONFIG_FILES($1/Makefile.sim:$1/Makefile.in)
+    AC_CONFIG_COMMANDS([$1/Makefile],
+[sed -n \
+       -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ {
+               /^srcdir / { s:= := ../:; s:$:/$1:; }
+               p
+       }' \
+       <Make-common.sim >$1/Makesim1.tmp
+ sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >$1/Makesim2.tmp
+ sed -e '/^## COMMON_PRE_/ r $1/Makesim1.tmp' \
+       -e '/^## COMMON_POST_/ r $1/Makesim2.tmp' \
+       <$1/Makefile.sim >$1/Makefile
+ rm -f $1/Makesim1.tmp $1/Makesim2.tmp
+])
+    AS_VAR_APPEND([SIM_SUBDIRS], [" $1"])
+  ])
+  dnl Create the depdirs for ports until we can convert them to automake.
+  AC_CONFIG_COMMANDS([depdir-$1],
+                    [$SHELL $ac_aux_dir/mkinstalldirs $1/$DEPDIR],
+                    [ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
+])
+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.
+dnl arg[4] is any additional shell code to run for this arch.
+m4_define([SIM_TARGET], [dnl
+  case "${targ}" in
+    all|$1)
+      if test "${targ}" = "${target}"; then
+        SIM_PRIMARY_TARGET=$2
+      fi
+      SIM_BUILD_TARGET($2, $3)
+      $4
+      ;;
+  esac
+])
+
+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.
 if test "${enable_sim}" != no; then
-   testsuite=no
-   common=yes
-   igen=no
-   case "${target}" in
-       arm*-*-* | thumb*-*-* | strongarm*-*-* | xscale-*-*)
-           AC_CONFIG_SUBDIRS(arm)
-          testsuite=yes
-          ;;
-       avr*-*-*)
-           AC_CONFIG_SUBDIRS(avr)
-          ;;
-       cr16*-*-*)
-          AC_CONFIG_SUBDIRS(cr16)
-          testsuite=yes
-          ;;
-       cris-*-* | crisv32-*-*)
-          AC_CONFIG_SUBDIRS(cris)
-          testsuite=yes
-          ;;
-       d10v-*-*)
-           AC_CONFIG_SUBDIRS(d10v)
-          ;;
-       frv-*-*)
-           AC_CONFIG_SUBDIRS(frv)
-          testsuite=yes
-          ;;
-       h8300*-*-*)
-           AC_CONFIG_SUBDIRS(h8300)
-          testsuite=yes
-          ;;
-       iq2000-*-*)
-           AC_CONFIG_SUBDIRS(iq2000)
-          testsuite=yes
-          ;;
-       lm32-*-*)
-           AC_CONFIG_SUBDIRS(lm32)
-          testsuite=yes
-           ;;
-       m32c-*-*)
-           AC_CONFIG_SUBDIRS(m32c)
-           ;;
-       m32r-*-*)
-           AC_CONFIG_SUBDIRS(m32r)
-          testsuite=yes
-          ;;
-       m68hc11-*-*|m6811-*-*)
-           AC_CONFIG_SUBDIRS(m68hc11)
-          testsuite=yes
-          ;;
-       mcore-*-*)
-           AC_CONFIG_SUBDIRS(mcore)
-          testsuite=yes
-          ;;
-       microblaze-*-*)
-           AC_CONFIG_SUBDIRS(microblaze)
-          testsuite=yes
-          ;;
-       mips*-*-*)
-           AC_CONFIG_SUBDIRS(mips)
-          testsuite=yes
-          igen=yes
-          ;;
-       mn10300*-*-*)
-           AC_CONFIG_SUBDIRS(mn10300)
-          igen=yes
-          ;;
-       moxie-*-*)
-          AC_CONFIG_SUBDIRS(moxie)
-          testsuite=yes
-          ;;
-       rx-*-*)
-           AC_CONFIG_SUBDIRS(rx)
-          ;;
-       sh64*-*-*)
-           AC_CONFIG_SUBDIRS(sh64)
-          testsuite=yes
-          ;;
-       sh*-*-*)
-           AC_CONFIG_SUBDIRS(sh)
-          testsuite=yes
-          ;;
-       sparc-*-rtems*|sparc-*-elf*)
-          AC_CONFIG_SUBDIRS(erc32)
-          testsuite=yes
-          ;;
-       powerpc*-*-* )
-           AC_CONFIG_SUBDIRS(ppc)
-          ;;
-       v850*-*-* )
-           AC_CONFIG_SUBDIRS(v850)
-          igen=yes
-          testsuite=yes
-          ;;
-       *)
-          # No simulator subdir, so the subdir "common" isn't needed.
-          common=no
-          ;;
-   esac
-   if test "$testsuite" = yes; then
-      AC_CONFIG_SUBDIRS(testsuite)
-   fi
-   if test "$common" = yes; then
-      AC_CONFIG_SUBDIRS(common)
-   fi
-   if test "$igen" = yes; then
-      AC_CONFIG_SUBDIRS(igen)
-   fi
+  sim_igen=no
+  for targ in `echo $target $enable_targets | sed 's/,/ /g'`
+  do
+    SIM_TARGET([aarch64*-*-*], [aarch64])
+    SIM_TARGET([arm*-*-*], [arm])
+    SIM_TARGET([avr*-*-*], [avr])
+    SIM_TARGET([bfin-*-*], [bfin], [true])
+    SIM_TARGET([bpf-*-*], [bpf], [true])
+    SIM_TARGET([cr16*-*-*], [cr16])
+    SIM_TARGET([cris-*-* | crisv32-*-*], [cris], [true])
+    SIM_TARGET([d10v-*-*], [d10v])
+    SIM_TARGET([frv-*-*], [frv], [true])
+    SIM_TARGET([ft32-*-*], [ft32])
+    SIM_TARGET([h8300*-*-*], [h8300])
+    SIM_TARGET([iq2000-*-*], [iq2000], [true])
+    SIM_TARGET([lm32-*-*], [lm32], [true])
+    SIM_TARGET([m32c-*-*], [m32c])
+    SIM_TARGET([m32r-*-*], [m32r], [true])
+    SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11])
+    SIM_TARGET([mcore-*-*], [mcore])
+    SIM_TARGET([microblaze-*-*], [microblaze])
+    SIM_TARGET([mips*-*-*], [mips], [true], [sim_igen=yes])
+    SIM_TARGET([mn10300*-*-*], [mn10300], [true], [sim_igen=yes])
+    SIM_TARGET([moxie-*-*], [moxie])
+    SIM_TARGET([msp430*-*-*], [msp430])
+    SIM_TARGET([or1k-*-* | or1knd-*-*], [or1k], [true])
+    SIM_TARGET([pru*-*-*], [pru])
+    SIM_TARGET([riscv*-*-*], [riscv], [true])
+    SIM_TARGET([rl78-*-*], [rl78])
+    SIM_TARGET([rx-*-*], [rx], [true])
+    SIM_TARGET([sh*-*-*], [sh])
+    SIM_TARGET([sparc-*-rtems*|sparc-*-elf*], [erc32], [true])
+    SIM_TARGET([powerpc*-*-*], [ppc], [true])
+    SIM_TARGET([v850*-*-*], [v850], [true], [sim_igen=yes])
+  done
+
+  if test "x${enable_example_sims}" = xyes; then
+    SIM_BUILD_TARGET([example-synacor])
+  fi
 fi
+AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "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_STDIO
+SIM_AC_OPTION_TRACE
+SIM_AC_OPTION_WARNINGS
 
-AC_OUTPUT(Makefile)
+dnl These are unfortunate.  They are conditionally called by other sim macros
+dnl but always used by common/Make-common.in.  So we have to subst here even
+dnl when the rest of the code is in the respective macros.  Once we merge the
+dnl respective SIM_AC_OPTION_xxx call above, we can drop these.
+AC_SUBST(sim_bitsize)
+AC_SUBST(sim_float)
+AC_SUBST(sim_scache)
+AC_SUBST(sim_default_model)
+AC_SUBST(sim_reserved_bits)
 
-exit 0
+AC_CONFIG_FILES([arch-subdir.mk Makefile])
+AC_OUTPUT