Automatic date update in version.in
[binutils-gdb.git] / sim / configure.ac
blob125eaa5ea310182590158d7b14f259f4b8da0f60
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/])
8 dnl Probably should unify PKGVERSION with PACKAGE_* settings from AC_INIT.
9 ACX_PKGVERSION([SIM])
10 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
11 dnl PACKAGE_BUGREPORT is provided by AC_INIT.
12 ACX_BUGURL([$PACKAGE_BUGREPORT])
13 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
15 AC_CONFIG_HEADERS([config.h])
17 dnl Set the 'development' global before loading the SIM macros.
18 . $srcdir/../bfd/development.sh
20 SIM_AC_TOOLCHAIN
21 SIM_AC_PLATFORM
23 m4_include([../gdbsupport/libiberty.m4])
24 libiberty_INIT
26 AM_MAINTAINER_MODE
27 AM_INIT_AUTOMAKE
28 AM_SILENT_RULES([yes])
30 # If a cpu ever has more than one simulator to choose from, use
31 # --enable-sim=... to choose.
32 AC_ARG_ENABLE(sim,
33 [AS_HELP_STRING([--enable-sim], [Enable the GNU simulator])],
34 [case "${enableval}" in
35 yes | no) ;;
36 *)      AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;;
37 esac])
39 AC_ARG_ENABLE([example-sims],
40               [AC_HELP_STRING([--enable-example-sims],
41                               [enable example GNU simulators])])
43 AC_ARG_ENABLE(targets,
44 [  --enable-targets        alternative target configurations],
45 [case "${enableval}" in
46   yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
47             ;;
48   no)       enable_targets= ;;
49   *)        enable_targets=$enableval ;;
50 esac])
52 dnl Used to keep track of which target (if any) is the default one.  This is
53 dnl used when installing files to see if they need to be suffixed.
54 SIM_PRIMARY_TARGET=
55 AC_SUBST(SIM_PRIMARY_TARGET)
57 dnl List of enabled arch backends.
58 SIM_ENABLED_ARCHES=
59 AC_SUBST(SIM_ENABLED_ARCHES)
61 ENABLE_SIM=no
62 dnl Build a particular arch subdir.
63 dnl arg[1] is the arch subdir name.
64 m4_define([SIM_BUILD_TARGET], [dnl
65   ENABLE_SIM=yes
66   AS_VAR_APPEND([SIM_ENABLED_ARCHES], [" $1"])
67   AC_CONFIG_FILES($1/.gdbinit:common/gdbinit.in)
69 dnl Enable a particular arch subdir.
70 dnl arg[1] is the matching target triple.
71 dnl arg[2] is the arch subdir name.
72 m4_define([SIM_TARGET], [dnl
73   sim_enable_arch_$2=false
74   case "${targ}" in
75     all|$1)
76       if test "${targ}" = "${target}"; then
77         SIM_PRIMARY_TARGET=$2
78       fi
79       SIM_BUILD_TARGET($2)
80       sim_enable_arch_$2=true
81       ;;
82   esac
83   SIM_AC_TOOLCHAIN_FOR_TARGET($2)
84   AM_CONDITIONAL([SIM_ENABLE_ARCH_$2], [${sim_enable_arch_$2}])
87 dnl WHEN ADDING ENTRIES TO THIS MATRIX:
88 dnl Make sure that the left side always has two dashes.  Otherwise you can get
89 dnl spurious matches.  Even for unambiguous cases, do this as a convention, else
90 dnl the table becomes a real mess to understand and maintain.
91 dnl
92 dnl NB: Target matching is aligned with gdb/configure.tgt.  Changes must be kept
93 dnl in sync with that file.
94 if test "${enable_sim}" != no; then
95   for targ in `echo $target $enable_targets | sed 's/,/ /g'`
96   do
97     m4_map([SIM_TARGET], [
98       [[aarch64*-*-*], [aarch64]],
99       [[arm*-*-*], [arm]],
100       [[avr*-*-*], [avr]],
101       [[bfin-*-*], [bfin]],
102       [[bpf-*-*], [bpf]],
103       [[cr16*-*-*], [cr16]],
104       [[cris-*-* | crisv32-*-*], [cris]],
105       [[d10v-*-*], [d10v]],
106       [[frv-*-*], [frv]],
107       [[ft32-*-*], [ft32]],
108       [[h8300*-*-*], [h8300]],
109       [[iq2000-*-*], [iq2000]],
110       [[lm32-*-*], [lm32]],
111       [[m32c-*-*], [m32c]],
112       [[m32r-*-*], [m32r]],
113       [[m68hc11-*-*|m6811-*-*], [m68hc11]],
114       [[mcore-*-*], [mcore]],
115       [[microblaze*-*-*], [microblaze]],
116       [[mips*-*-*], [mips]],
117       [[mn10300*-*-*], [mn10300]],
118       [[moxie-*-*], [moxie]],
119       [[msp430*-*-*], [msp430]],
120       [[or1k*-*-*], [or1k]],
121       [[powerpc*-*-*], [ppc]],
122       [[pru*-*-*], [pru]],
123       [[riscv*-*-*], [riscv]],
124       [[rl78-*-*], [rl78]],
125       [[rx-*-*], [rx]],
126       [[sh*-*-*], [sh]],
127       [[sparc-*-*], [erc32]],
128       [[v850*-*-*], [v850]],
129     ])
130   done
132   if test "x${enable_example_sims}" = xyes; then
133     SIM_AC_TOOLCHAIN_FOR_TARGET(example-synacor)
134     SIM_BUILD_TARGET([example-synacor])
135   fi
136   AM_CONDITIONAL([SIM_ENABLE_ARCH_examples], [test "${enable_example_sims}" = "yes"])
138 AM_CONDITIONAL([ENABLE_SIM], [test "$ENABLE_SIM" = "yes"])
140 dnl Standard (and optional) simulator options.
141 dnl Eventually all simulators will support these.
142 SIM_AC_OPTION_ALIGNMENT
143 SIM_AC_OPTION_ASSERT
144 SIM_AC_OPTION_CGEN_MAINT
145 SIM_AC_OPTION_DEBUG
146 SIM_AC_OPTION_ENDIAN
147 SIM_AC_OPTION_ENVIRONMENT
148 SIM_AC_OPTION_HARDWARE
149 SIM_AC_OPTION_INLINE
150 SIM_AC_OPTION_PROFILE
151 SIM_AC_OPTION_RESERVED_BITS
152 SIM_AC_OPTION_SCACHE
153 SIM_AC_OPTION_SMP
154 SIM_AC_OPTION_STDIO
155 SIM_AC_OPTION_TRACE
156 SIM_AC_OPTION_WARNINGS
158 dnl Some arches have unique configure flags.
159 m4_include([frv/acinclude.m4])
160 m4_include([mips/acinclude.m4])
161 m4_include([ppc/acinclude.m4])
162 m4_include([riscv/acinclude.m4])
163 m4_include([rx/acinclude.m4])
165 AC_CONFIG_FILES([Makefile .gdbinit:gdbinit.in])
166 AC_OUTPUT