* Contribute CGEN simulator build support code.
[binutils-gdb.git] / sim / configure.in
blobb0fa140f5f79f46d6ff7aaa259f7d8f8fadbf597
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.13)dnl
3 AC_INIT(Makefile.in)
5 AC_PROG_CC
6 AC_PROG_INSTALL
7 AC_CHECK_TOOL(AR, ar)
8 AC_CHECK_TOOL(RANLIB, ranlib, :)
10 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
11 AC_CANONICAL_SYSTEM
12 AC_ARG_PROGRAM
13 AC_PROG_CC
14 AC_SUBST(CFLAGS)
15 AC_SUBST(HDEFINES)
16 AR=${AR-ar}
17 AC_SUBST(AR)
18 AC_PROG_RANLIB
20 # Put a plausible default for CC_FOR_BUILD in Makefile.
21 if test "x$cross_compiling" = "xno"; then
22   CC_FOR_BUILD='$(CC)'
23 else
24   CC_FOR_BUILD=gcc
26 AC_SUBST(CC_FOR_BUILD)
28 # If a cpu ever has more than one simulator to choose from, use
29 # --enable-sim=... to choose.
30 AC_ARG_ENABLE(sim,
31 [  --enable-sim ],
32 [case "${enableval}" in
33 yes | no) ;;
34 *)      AC_MSG_ERROR(bad value ${enableval} given for --enable-sim option) ;;
35 esac])
37 # Assume simulator can be built with cc.
38 # If the user passes --enable-sim built it regardless of $(CC).
39 only_if_gcc=no
40 only_if_enabled=no
41 extra_subdirs=common
43 # WHEN ADDING ENTRIES TO THIS MATRIX:
44 #  Make sure that the left side always has two dashes.  Otherwise you
45 #  can get spurious matches.  Even for unambiguous cases, do this as a
46 #  convention, else the table becomes a real mess to understand and maintain.
48 case "${target}" in
49   arm*-*-* | thumb*-*-*)
50         sim_target=arm
51         extra_subdirs="${extra_subdirs} testsuite"
52         ;;
53   strongarm*-*-*)
54         sim_target=arm
55         extra_subdirs="${extra_subdirs} testsuite"
56         ;;
57   d10v-*-*)             sim_target=d10v ;;
58   d30v-*-*)
59         sim_target=d30v
60         only_if_gcc=yes
61         extra_subdirs="${extra_subdirs} igen"
62         ;;
63   fr30-*-*)             sim_target=fr30 ;;
64   h8300*-*-*)           sim_target=h8300 ;;
65   h8500-*-*)            sim_target=h8500 ;;
66   i960-*-*)             sim_target=i960 ;;
67   m32r-*-*)             sim_target=m32r ;;
68   m68hc11-*-*|m6811-*-*) sim_target=m68hc11 ;;
69   mcore-*-*)            sim_target=mcore ;;
70   mips*-*-*)
71         # The MIPS simulator can only be compiled by gcc.
72         sim_target=mips
73         only_if_gcc=yes
74         extra_subdirs="${extra_subdirs} igen"
75         ;;
76   mn10300*-*-*)
77         # The mn10300 simulator can only be compiled by gcc.
78         sim_target=mn10300
79         only_if_gcc=yes
80         extra_subdirs="${extra_subdirs} igen"
81         ;;
82   mn10200*-*-*)
83         sim_target=mn10200
84         ;;
85   sh*-*-*)              sim_target=sh ;;
86   powerpc*-*-eabi* | powerpc*-*-solaris* | powerpc*-*-sysv4* | powerpc*-*-elf* | powerpc*-*-linux* )
87         # The PowerPC simulator uses the GCC extension long long as well as
88         # ANSI prototypes, so don't enable it for random host compilers
89         # unless asked to.
90         sim_target=ppc
91         only_if_gcc=yes
92         #extra_subdirs="${extra_subdirs}"
93         ;;
94   tic80-*-*)
95         sim_target=tic80
96         only_if_gcc=yes
97         extra_subdirs="${extra_subdirs} igen"
98         ;;
99   v850-*-*)
100         # The V850 simulator can only be compiled by gcc.
101         sim_target=v850
102         extra_subdirs="${extra_subdirs} igen"
103         only_if_gcc=yes
104         ;;
105   v850e-*-*)
106         # The V850 simulator can only be compiled by gcc.
107         sim_target=v850
108         extra_subdirs="${extra_subdirs} igen"
109         only_if_gcc=yes
110         ;;
111   v850ea-*-*)
112         # The V850 simulator can only be compiled by gcc.
113         sim_target=v850
114         extra_subdirs="${extra_subdirs} igen"
115         only_if_gcc=yes
116         ;;
117   w65-*-*)
118         sim_target=w65
119         # The w65 is suffering from gradual decay.
120         only_if_enabled=yes
121         ;;
122   z8k*-*-*)             sim_target=z8k ;;
123   sparc64-*-*)
124         only_if_gcc=yes
125         sim_target=none # Don't build erc32 if sparc64.
126         ;;
127   sparclite*-*-* | sparc86x*-*-*)
128         # The SPARC simulator can only be compiled by gcc.
129         only_if_gcc=yes
130         sim_target=erc32
131         ;;
132   sparc*-*-*)
133         # The SPARC simulator can only be compiled by gcc.
134         only_if_gcc=yes
135         # Unfortunately erc32 won't build on many hosts, so only enable
136         # it if the user really really wants it.
137         only_if_enabled=yes
138         sim_target=erc32
139         ;;
140   *)                    sim_target=none ;;
141 esac
144 # Is there a testsuite directory for the target?
145 testdir=`echo ${target} | sed -e 's/-.*-/-/'`
146 if test -r ${srcdir}/testsuite/${testdir}/configure ; then
147   extra_subdirs="${extra_subdirs} testsuite"
151 case "${enable_sim}" in
152 no)     sim_target=none ;;
153 yes)
154         if test ${only_if_gcc} = yes ; then
155                 if test "${GCC}" != yes ; then
156                         echo "Can't enable simulator since not compiling with GCC."
157                         sim_target=none
158                 fi
159         fi
160         ;;
162         if test ${only_if_enabled} = yes ; then
163                 sim_target=none
164         else
165                 if test ${only_if_gcc} = yes ; then
166                         if test "${GCC}" != yes ; then
167                                 sim_target=none
168                         fi
169                 fi
170         fi
171         ;;
172 esac
174 if test x"${sim_target}" != xnone ; then
175         configdirs="${extra_subdirs} ${sim_target}"
176         AC_CONFIG_SUBDIRS($configdirs)
179 AC_OUTPUT(Makefile)
181 exit 0