]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/configure.ac
0c14b1da79e24ef44afb59bb11802c91949b3a6b
[thirdparty/binutils-gdb.git] / sim / configure.ac
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
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
15 AC_CONFIG_HEADERS([config.h])
16
17 SIM_AC_TOOLCHAIN
18 SIM_AC_PLATFORM
19
20 AM_MAINTAINER_MODE
21 AM_INIT_AUTOMAKE
22 AM_SILENT_RULES([yes])
23
24 # If a cpu ever has more than one simulator to choose from, use
25 # --enable-sim=... to choose.
26 AC_ARG_ENABLE(sim,
27 [AS_HELP_STRING([--enable-sim], [Enable the GNU simulator])],
28 [case "${enableval}" in
29 yes | no) ;;
30 *) AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;;
31 esac])
32
33 AC_ARG_ENABLE([example-sims],
34 [AC_HELP_STRING([--enable-example-sims],
35 [enable example GNU simulators])])
36
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
51 SIM_SUBDIRS=
52 AC_SUBST(SIM_SUBDIRS)
53
54 dnl Used by common/Make-common.in to see which configure script created it.
55 SIM_COMMON_BUILD_TRUE=
56 SIM_COMMON_BUILD_FALSE='#'
57 AC_SUBST(SIM_COMMON_BUILD_TRUE)
58 AC_SUBST(SIM_COMMON_BUILD_FALSE)
59
60 AC_CONFIG_FILES(Make-common.sim:common/Make-common.in)
61 dnl Build a particular arch subdir.
62 dnl arg[1] is the arch subdir name.
63 dnl arg[2] is whether the arch has a dedicated configure script.
64 m4_define([SIM_BUILD_TARGET], [dnl
65 m4_if($2, [true], [dnl
66 AC_CONFIG_SUBDIRS($1)
67 ], [dnl
68 AC_CONFIG_FILES($1/Makefile.sim:$1/Makefile.in)
69 AC_CONFIG_COMMANDS([$1/Makefile],
70 [sed -n \
71 -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ {
72 /^srcdir = / s:$:/$1:
73 p
74 }' \
75 <Make-common.sim >$1/Makesim1.tmp
76 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >$1/Makesim2.tmp
77 sed -e '/^## COMMON_PRE_/ r $1/Makesim1.tmp' \
78 -e '/^## COMMON_POST_/ r $1/Makesim2.tmp' \
79 <$1/Makefile.sim >$1/Makefile
80 rm -f $1/Makesim1.tmp $1/Makesim2.tmp
81 ])
82 AS_VAR_APPEND([SIM_SUBDIRS], [" $1"])
83 ])
84 dnl Create the depdirs for ports until we can convert them to automake.
85 AC_CONFIG_COMMANDS([depdir-$1],
86 [$SHELL $ac_aux_dir/mkinstalldirs $1/$DEPDIR],
87 [ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
88 ])
89 dnl Enable a particular arch subdir.
90 dnl arg[1] is the matching target triple.
91 dnl arg[2] is the arch subdir name.
92 dnl arg[3] is whether the arch has a dedicated configure script.
93 dnl arg[4] is any additional shell code to run for this arch.
94 m4_define([SIM_TARGET], [dnl
95 sim_enable_arch_$2=false
96 case "${targ}" in
97 all|$1)
98 if test "${targ}" = "${target}"; then
99 SIM_PRIMARY_TARGET=$2
100 fi
101 SIM_BUILD_TARGET($2, $3)
102 sim_enable_arch_$2=true
103 $4
104 ;;
105 esac
106 SIM_AC_TOOLCHAIN_FOR_TARGET($2)
107 AM_CONDITIONAL([SIM_ENABLE_ARCH_$2], [${sim_enable_arch_$2}])
108 ])
109
110 dnl WHEN ADDING ENTRIES TO THIS MATRIX:
111 dnl Make sure that the left side always has two dashes. Otherwise you can get
112 dnl spurious matches. Even for unambiguous cases, do this as a convention, else
113 dnl the table becomes a real mess to understand and maintain.
114 dnl
115 dnl NB: Target matching is aligned with gdb/configure.tgt. Changes must be kept
116 dnl in sync with that file.
117 if test "${enable_sim}" != no; then
118 sim_igen=no
119 for targ in `echo $target $enable_targets | sed 's/,/ /g'`
120 do
121 SIM_TARGET([aarch64*-*-*], [aarch64])
122 SIM_TARGET([arm*-*-*], [arm])
123 SIM_TARGET([avr*-*-*], [avr])
124 SIM_TARGET([bfin-*-*], [bfin])
125 SIM_TARGET([bpf-*-*], [bpf], [true])
126 SIM_TARGET([cr16*-*-*], [cr16])
127 SIM_TARGET([cris-*-* | crisv32-*-*], [cris])
128 SIM_TARGET([d10v-*-*], [d10v])
129 SIM_TARGET([frv-*-*], [frv])
130 SIM_TARGET([ft32-*-*], [ft32])
131 SIM_TARGET([h8300*-*-*], [h8300])
132 SIM_TARGET([iq2000-*-*], [iq2000])
133 SIM_TARGET([lm32-*-*], [lm32])
134 SIM_TARGET([m32c-*-*], [m32c])
135 SIM_TARGET([m32r-*-*], [m32r])
136 SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11])
137 SIM_TARGET([mcore-*-*], [mcore])
138 SIM_TARGET([microblaze*-*-*], [microblaze])
139 SIM_TARGET([mips*-*-*], [mips], [true], [sim_igen=yes])
140 SIM_TARGET([mn10300*-*-*], [mn10300], [true], [sim_igen=yes])
141 SIM_TARGET([moxie-*-*], [moxie])
142 SIM_TARGET([msp430*-*-*], [msp430])
143 SIM_TARGET([or1k*-*-*], [or1k], [true])
144 SIM_TARGET([powerpc*-*-*], [ppc], [true])
145 SIM_TARGET([pru*-*-*], [pru])
146 SIM_TARGET([riscv*-*-*], [riscv], [true])
147 SIM_TARGET([rl78-*-*], [rl78])
148 SIM_TARGET([rx-*-*], [rx])
149 SIM_TARGET([sh*-*-*], [sh])
150 SIM_TARGET([sparc-*-*], [erc32])
151 SIM_TARGET([v850*-*-*], [v850], [true], [sim_igen=yes])
152 done
153
154 if test "x${enable_example_sims}" = xyes; then
155 SIM_AC_TOOLCHAIN_FOR_TARGET(example-synacor)
156 SIM_BUILD_TARGET([example-synacor])
157 fi
158 fi
159 AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
160 AM_CONDITIONAL([ENABLE_SIM], [test -n "$SIM_SUBDIRS"])
161
162 dnl Standard (and optional) simulator options.
163 dnl Eventually all simulators will support these.
164 SIM_AC_OPTION_ALIGNMENT
165 SIM_AC_OPTION_ASSERT
166 SIM_AC_OPTION_CGEN_MAINT
167 SIM_AC_OPTION_DEBUG
168 SIM_AC_OPTION_ENDIAN
169 SIM_AC_OPTION_ENVIRONMENT
170 SIM_AC_OPTION_HARDWARE
171 SIM_AC_OPTION_INLINE
172 SIM_AC_OPTION_PROFILE
173 SIM_AC_OPTION_RESERVED_BITS
174 SIM_AC_OPTION_SCACHE
175 SIM_AC_OPTION_STDIO
176 SIM_AC_OPTION_TRACE
177 SIM_AC_OPTION_WARNINGS
178
179 dnl These are unfortunate. They are conditionally called by other sim macros
180 dnl but always used by common/Make-common.in. So we have to subst here even
181 dnl when the rest of the code is in the respective macros. Once we merge the
182 dnl respective SIM_AC_OPTION_xxx call above, we can drop these.
183 AC_SUBST(sim_bitsize)
184 AC_SUBST(sim_float)
185
186 dnl Some arches have unique configure flags.
187 m4_include([frv/acinclude.m4])
188 m4_include([rx/acinclude.m4])
189
190 AC_CONFIG_FILES([arch-subdir.mk Makefile])
191 AC_OUTPUT