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