| 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 | SIM_AC_TOOLCHAIN |
| 9 | |
| 10 | AM_MAINTAINER_MODE |
| 11 | AM_INIT_AUTOMAKE |
| 12 | |
| 13 | # If a cpu ever has more than one simulator to choose from, use |
| 14 | # --enable-sim=... to choose. |
| 15 | AC_ARG_ENABLE(sim, |
| 16 | [AS_HELP_STRING([--enable-sim], [Enable the GNU simulator])], |
| 17 | [case "${enableval}" in |
| 18 | yes | no) ;; |
| 19 | *) AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;; |
| 20 | esac]) |
| 21 | |
| 22 | AC_ARG_ENABLE([example-sims], |
| 23 | [AC_HELP_STRING([--enable-example-sims], |
| 24 | [enable example GNU simulators])]) |
| 25 | |
| 26 | AC_ARG_ENABLE(targets, |
| 27 | [ --enable-targets alternative target configurations], |
| 28 | [case "${enableval}" in |
| 29 | yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all') |
| 30 | ;; |
| 31 | no) enable_targets= ;; |
| 32 | *) enable_targets=$enableval ;; |
| 33 | esac]) |
| 34 | |
| 35 | dnl Used to keep track of which target (if any) is the default one. This is |
| 36 | dnl used when installing files to see if they need to be suffixed. |
| 37 | SIM_PRIMARY_TARGET= |
| 38 | AC_SUBST(SIM_PRIMARY_TARGET) |
| 39 | |
| 40 | m4_define([SIM_TARGET], [ |
| 41 | case "${targ}" in |
| 42 | all|$1) |
| 43 | if test "${targ}" = "${target}"; then |
| 44 | SIM_PRIMARY_TARGET=$2 |
| 45 | fi |
| 46 | AC_CONFIG_SUBDIRS($2) |
| 47 | $3 |
| 48 | ;; |
| 49 | esac |
| 50 | ]) |
| 51 | |
| 52 | dnl WHEN ADDING ENTRIES TO THIS MATRIX: |
| 53 | dnl Make sure that the left side always has two dashes. Otherwise you can get |
| 54 | dnl spurious matches. Even for unambiguous cases, do this as a convention, else |
| 55 | dnl the table becomes a real mess to understand and maintain. |
| 56 | if test "${enable_sim}" != no; then |
| 57 | sim_igen=no |
| 58 | for targ in `echo $target $enable_targets | sed 's/,/ /g'` |
| 59 | do |
| 60 | SIM_TARGET([aarch64*-*-*], [aarch64]) |
| 61 | SIM_TARGET([arm*-*-*], [arm]) |
| 62 | SIM_TARGET([avr*-*-*], [avr]) |
| 63 | SIM_TARGET([bfin-*-*], [bfin]) |
| 64 | SIM_TARGET([bpf-*-*], [bpf]) |
| 65 | SIM_TARGET([cr16*-*-*], [cr16]) |
| 66 | SIM_TARGET([cris-*-* | crisv32-*-*], [cris]) |
| 67 | SIM_TARGET([d10v-*-*], [d10v]) |
| 68 | SIM_TARGET([frv-*-*], [frv]) |
| 69 | SIM_TARGET([h8300*-*-*], [h8300]) |
| 70 | SIM_TARGET([iq2000-*-*], [iq2000]) |
| 71 | SIM_TARGET([lm32-*-*], [lm32]) |
| 72 | SIM_TARGET([m32c-*-*], [m32c]) |
| 73 | SIM_TARGET([m32r-*-*], [m32r]) |
| 74 | SIM_TARGET([m68hc11-*-*|m6811-*-*], [m68hc11]) |
| 75 | SIM_TARGET([mcore-*-*], [mcore]) |
| 76 | SIM_TARGET([microblaze-*-*], [microblaze]) |
| 77 | SIM_TARGET([mips*-*-*], [mips], [sim_igen=yes]) |
| 78 | SIM_TARGET([mn10300*-*-*], [mn10300], [sim_igen=yes]) |
| 79 | SIM_TARGET([moxie-*-*], [moxie]) |
| 80 | SIM_TARGET([msp430*-*-*], [msp430]) |
| 81 | SIM_TARGET([or1k-*-* | or1knd-*-*], [or1k]) |
| 82 | SIM_TARGET([pru*-*-*], [pru]) |
| 83 | SIM_TARGET([riscv*-*-*], [riscv]) |
| 84 | SIM_TARGET([rl78-*-*], [rl78]) |
| 85 | SIM_TARGET([rx-*-*], [rx]) |
| 86 | SIM_TARGET([sh*-*-*], [sh]) |
| 87 | SIM_TARGET([sparc-*-rtems*|sparc-*-elf*], [erc32]) |
| 88 | SIM_TARGET([powerpc*-*-*], [ppc]) |
| 89 | SIM_TARGET([ft32-*-*], [ft32]) |
| 90 | SIM_TARGET([v850*-*-*], [v850], [sim_igen=yes]) |
| 91 | done |
| 92 | |
| 93 | if test "x${enable_example_sims}" = xyes; then |
| 94 | AC_CONFIG_SUBDIRS(example-synacor) |
| 95 | fi |
| 96 | fi |
| 97 | AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"]) |
| 98 | |
| 99 | AC_CONFIG_FILES([Makefile]) |
| 100 | AC_OUTPUT |