]>
Commit | Line | Data |
---|---|---|
b7026657 | 1 | dnl Process this file with autoconf to produce a configure script. |
6bddc3e8 MF |
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 | ||
6dd65fc0 MF |
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]) | |
14 | ||
b15c5d7a MF |
15 | AC_CONFIG_HEADERS([config.h]) |
16 | ||
c2783492 | 17 | SIM_AC_TOOLCHAIN |
b15c5d7a | 18 | SIM_AC_PLATFORM |
6bddc3e8 | 19 | |
8c379db2 | 20 | AM_MAINTAINER_MODE |
6bddc3e8 | 21 | AM_INIT_AUTOMAKE |
fbe8d1cf | 22 | AM_SILENT_RULES([yes]) |
b7026657 | 23 | |
b7026657 AC |
24 | # If a cpu ever has more than one simulator to choose from, use |
25 | # --enable-sim=... to choose. | |
26 | AC_ARG_ENABLE(sim, | |
8d0978fb | 27 | [AS_HELP_STRING([--enable-sim], [Enable the GNU simulator])], |
b7026657 AC |
28 | [case "${enableval}" in |
29 | yes | no) ;; | |
30 | *) AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;; | |
31 | esac]) | |
32 | ||
26da232c MF |
33 | AC_ARG_ENABLE([example-sims], |
34 | [AC_HELP_STRING([--enable-example-sims], | |
35 | [enable example GNU simulators])]) | |
36 | ||
a0e674c1 MF |
37 | AC_ARG_ENABLE(targets, |
38 | [ --enable-targets alternative target configurations], | |
39 | [case "${enableval}" in | |
40 | yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all') | |
41 | ;; | |
42 | no) enable_targets= ;; | |
43 | *) enable_targets=$enableval ;; | |
44 | esac]) | |
45 | ||
46 | dnl Used to keep track of which target (if any) is the default one. This is | |
47 | dnl used when installing files to see if they need to be suffixed. | |
48 | SIM_PRIMARY_TARGET= | |
49 | AC_SUBST(SIM_PRIMARY_TARGET) | |
50 | ||
2ba09f42 | 51 | dnl Directories that we need to recurse into (i.e. add to $SUBDIRS). |
36bb57e4 MF |
52 | SIM_SUBDIRS= |
53 | AC_SUBST(SIM_SUBDIRS) | |
54 | ||
2ba09f42 MF |
55 | dnl List of enabled arch backends. |
56 | SIM_ENABLED_ARCHES= | |
57 | AC_SUBST(SIM_ENABLED_ARCHES) | |
58 | ||
36bb57e4 MF |
59 | dnl Used by common/Make-common.in to see which configure script created it. |
60 | SIM_COMMON_BUILD_TRUE= | |
61 | SIM_COMMON_BUILD_FALSE='#' | |
62 | AC_SUBST(SIM_COMMON_BUILD_TRUE) | |
63 | AC_SUBST(SIM_COMMON_BUILD_FALSE) | |
64 | ||
65 | AC_CONFIG_FILES(Make-common.sim:common/Make-common.in) | |
7c9a934c | 66 | ENABLE_SIM=no |
36bb57e4 MF |
67 | dnl Build a particular arch subdir. |
68 | dnl arg[1] is the arch subdir name. | |
69 | dnl arg[2] is whether the arch has a dedicated configure script. | |
bc56166f | 70 | m4_define([SIM_BUILD_TARGET], [dnl |
7c9a934c | 71 | ENABLE_SIM=yes |
2ba09f42 | 72 | AS_VAR_APPEND([SIM_ENABLED_ARCHES], [" $1"]) |
36bb57e4 MF |
73 | m4_if($2, [true], [dnl |
74 | AC_CONFIG_SUBDIRS($1) | |
75 | ], [dnl | |
76 | AC_CONFIG_FILES($1/Makefile.sim:$1/Makefile.in) | |
77 | AC_CONFIG_COMMANDS([$1/Makefile], | |
78 | [sed -n \ | |
79 | -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ { | |
b3408412 | 80 | /^srcdir = / s:$:/$1: |
36bb57e4 MF |
81 | p |
82 | }' \ | |
83 | <Make-common.sim >$1/Makesim1.tmp | |
84 | sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >$1/Makesim2.tmp | |
85 | sed -e '/^## COMMON_PRE_/ r $1/Makesim1.tmp' \ | |
86 | -e '/^## COMMON_POST_/ r $1/Makesim2.tmp' \ | |
87 | <$1/Makefile.sim >$1/Makefile | |
88 | rm -f $1/Makesim1.tmp $1/Makesim2.tmp | |
89 | ]) | |
90 | AS_VAR_APPEND([SIM_SUBDIRS], [" $1"]) | |
91 | ]) | |
23912acd | 92 | AC_CONFIG_FILES($1/.gdbinit:common/gdbinit.in) |
bc56166f MF |
93 | dnl Create the depdirs for ports until we can convert them to automake. |
94 | AC_CONFIG_COMMANDS([depdir-$1], | |
95 | [$SHELL $ac_aux_dir/mkinstalldirs $1/$DEPDIR], | |
96 | [ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR]) | |
97 | ]) | |
36bb57e4 MF |
98 | dnl Enable a particular arch subdir. |
99 | dnl arg[1] is the matching target triple. | |
100 | dnl arg[2] is the arch subdir name. | |
101 | dnl arg[3] is whether the arch has a dedicated configure script. | |
102 | dnl arg[4] is any additional shell code to run for this arch. | |
bc56166f | 103 | m4_define([SIM_TARGET], [dnl |
65dcce8f | 104 | sim_enable_arch_$2=false |
a0e674c1 MF |
105 | case "${targ}" in |
106 | all|$1) | |
107 | if test "${targ}" = "${target}"; then | |
108 | SIM_PRIMARY_TARGET=$2 | |
109 | fi | |
36bb57e4 | 110 | SIM_BUILD_TARGET($2, $3) |
65dcce8f | 111 | sim_enable_arch_$2=true |
36bb57e4 | 112 | $4 |
a0e674c1 MF |
113 | ;; |
114 | esac | |
8996c210 | 115 | SIM_AC_TOOLCHAIN_FOR_TARGET($2) |
65dcce8f | 116 | AM_CONDITIONAL([SIM_ENABLE_ARCH_$2], [${sim_enable_arch_$2}]) |
a0e674c1 MF |
117 | ]) |
118 | ||
3e8bb3e9 MF |
119 | dnl WHEN ADDING ENTRIES TO THIS MATRIX: |
120 | dnl Make sure that the left side always has two dashes. Otherwise you can get | |
121 | dnl spurious matches. Even for unambiguous cases, do this as a convention, else | |
122 | dnl the table becomes a real mess to understand and maintain. | |
99aedb62 MF |
123 | dnl |
124 | dnl NB: Target matching is aligned with gdb/configure.tgt. Changes must be kept | |
125 | dnl in sync with that file. | |
b7026657 | 126 | if test "${enable_sim}" != no; then |
3e8bb3e9 | 127 | sim_igen=no |
a0e674c1 MF |
128 | for targ in `echo $target $enable_targets | sed 's/,/ /g'` |
129 | do | |
130 | SIM_TARGET([aarch64*-*-*], [aarch64]) | |
131 | SIM_TARGET([arm*-*-*], [arm]) | |
132 | SIM_TARGET([avr*-*-*], [avr]) | |
d8b04da7 | 133 | SIM_TARGET([bfin-*-*], [bfin]) |
ee79c7df | 134 | SIM_TARGET([bpf-*-*], [bpf]) |
a0e674c1 | 135 | SIM_TARGET([cr16*-*-*], [cr16]) |
408a44aa | 136 | SIM_TARGET([cris-*-* | crisv32-*-*], [cris]) |
a0e674c1 | 137 | SIM_TARGET([d10v-*-*], [d10v]) |
408a44aa | 138 | SIM_TARGET([frv-*-*], [frv]) |
36bb57e4 | 139 | SIM_TARGET([ft32-*-*], [ft32]) |
a0e674c1 | 140 | SIM_TARGET([h8300*-*-*], [h8300]) |
408a44aa MF |
141 | SIM_TARGET([iq2000-*-*], [iq2000]) |
142 | SIM_TARGET([lm32-*-*], [lm32]) | |
a0e674c1 | 143 | SIM_TARGET([m32c-*-*], [m32c]) |
313c332f | 144 | SIM_TARGET([m32r-*-*], [m32r]) |
a0e674c1 MF |
145 | SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11]) |
146 | SIM_TARGET([mcore-*-*], [mcore]) | |
99aedb62 | 147 | SIM_TARGET([microblaze*-*-*], [microblaze]) |
abc494c6 | 148 | SIM_TARGET([mips*-*-*], [mips], [], [sim_igen=yes]) |
4cf83930 | 149 | SIM_TARGET([mn10300*-*-*], [mn10300], [], [sim_igen=yes]) |
a0e674c1 MF |
150 | SIM_TARGET([moxie-*-*], [moxie]) |
151 | SIM_TARGET([msp430*-*-*], [msp430]) | |
763b20ab | 152 | SIM_TARGET([or1k*-*-*], [or1k]) |
99aedb62 | 153 | SIM_TARGET([powerpc*-*-*], [ppc], [true]) |
a0e674c1 | 154 | SIM_TARGET([pru*-*-*], [pru]) |
1787fcc4 | 155 | SIM_TARGET([riscv*-*-*], [riscv]) |
a0e674c1 | 156 | SIM_TARGET([rl78-*-*], [rl78]) |
e173c80f | 157 | SIM_TARGET([rx-*-*], [rx]) |
a0e674c1 | 158 | SIM_TARGET([sh*-*-*], [sh]) |
99aedb62 | 159 | SIM_TARGET([sparc-*-*], [erc32]) |
871aa3b9 | 160 | SIM_TARGET([v850*-*-*], [v850], [], [sim_igen=yes]) |
a0e674c1 | 161 | done |
26da232c MF |
162 | |
163 | if test "x${enable_example_sims}" = xyes; then | |
8996c210 | 164 | SIM_AC_TOOLCHAIN_FOR_TARGET(example-synacor) |
bc56166f | 165 | SIM_BUILD_TARGET([example-synacor]) |
26da232c | 166 | fi |
c0c25232 | 167 | AM_CONDITIONAL([SIM_ENABLE_ARCH_examples], [test "${enable_example_sims}" = "yes"]) |
b7026657 | 168 | fi |
b6b1c790 | 169 | AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"]) |
7c9a934c | 170 | AM_CONDITIONAL([ENABLE_SIM], [test "$ENABLE_SIM" = "yes"]) |
b7026657 | 171 | |
04381273 MF |
172 | dnl Standard (and optional) simulator options. |
173 | dnl Eventually all simulators will support these. | |
ba307cdd | 174 | SIM_AC_OPTION_ALIGNMENT |
dba333c1 | 175 | SIM_AC_OPTION_ASSERT |
1bf5c342 | 176 | SIM_AC_OPTION_CGEN_MAINT |
04381273 | 177 | SIM_AC_OPTION_DEBUG |
f9a4d543 | 178 | SIM_AC_OPTION_ENDIAN |
5ea45474 | 179 | SIM_AC_OPTION_ENVIRONMENT |
456ef1c1 | 180 | SIM_AC_OPTION_HARDWARE |
d73f39ee | 181 | SIM_AC_OPTION_INLINE |
04381273 | 182 | SIM_AC_OPTION_PROFILE |
7eb1f99a | 183 | SIM_AC_OPTION_RESERVED_BITS |
b79efe26 | 184 | SIM_AC_OPTION_SCACHE |
20b579ba | 185 | SIM_AC_OPTION_SMP |
04381273 MF |
186 | SIM_AC_OPTION_STDIO |
187 | SIM_AC_OPTION_TRACE | |
47ce766a | 188 | SIM_AC_OPTION_WARNINGS |
dba333c1 | 189 | |
340aa4f6 TO |
190 | AC_MSG_CHECKING(for a known getopt prototype in unistd.h) |
191 | AC_CACHE_VAL(sim_cv_decl_getopt_unistd_h, | |
192 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])], | |
193 | sim_cv_decl_getopt_unistd_h=yes, sim_cv_decl_getopt_unistd_h=no)]) | |
194 | AC_MSG_RESULT($sim_cv_decl_getopt_unistd_h) | |
195 | if test $sim_cv_decl_getopt_unistd_h = yes; then | |
196 | AC_DEFINE([HAVE_DECL_GETOPT], 1, | |
197 | [Is the prototype for getopt in <unistd.h> in the expected format?]) | |
198 | fi | |
199 | ||
36bb57e4 MF |
200 | dnl These are unfortunate. They are conditionally called by other sim macros |
201 | dnl but always used by common/Make-common.in. So we have to subst here even | |
202 | dnl when the rest of the code is in the respective macros. Once we merge the | |
203 | dnl respective SIM_AC_OPTION_xxx call above, we can drop these. | |
204 | AC_SUBST(sim_bitsize) | |
205 | AC_SUBST(sim_float) | |
36bb57e4 | 206 | |
e173c80f | 207 | dnl Some arches have unique configure flags. |
408a44aa | 208 | m4_include([frv/acinclude.m4]) |
23ddbd2f | 209 | m4_include([mips/acinclude.m4]) |
1787fcc4 | 210 | m4_include([riscv/acinclude.m4]) |
e173c80f MF |
211 | m4_include([rx/acinclude.m4]) |
212 | ||
21672298 | 213 | AC_CONFIG_FILES([arch-subdir.mk Makefile .gdbinit:gdbinit.in]) |
bb3eddb5 | 214 | AC_OUTPUT |