OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [configure.ac] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1748 jeremybenn
# configure.in -- Top level autoconf configuration file
2
#
3
# Copyright (C) 1999-2008 OpenCores
4
# Copyright (C) 2008 Embecosm Limited
5
#
6
# Contributor Jeremy Bennett 
7
#
8
# This file is part of OpenRISC 1000 Architectural Simulator.
9
#
10
# This program is free software; you can redistribute it and/or modify it
11
# under the terms of the GNU General Public License as published by the Free
12
# Software Foundation; either version 3 of the License, or (at your option)
13
# any later version.
14
#
15
# This program is distributed in the hope that it will be useful, but WITHOUT
16
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18
# more details.
19
#
20
# You should have received a copy of the GNU General Public License along
21
# with this program.  If not, see .
22
 
23
 
24
# Configure script for the OpenRISC 1000 simulator
25
 
26
# Process this file with autoconf to produce a configure script.
27
 
28
 
29 1760 jeremybenn
AC_INIT([or1ksim], [0.3.0], [openrisc@opencores.org])
30 1748 jeremybenn
AC_CONFIG_SRCDIR([cpu/or32/execute.c])
31
AC_CANONICAL_TARGET([])
32
AC_PROG_LIBTOOL
33
AM_INIT_AUTOMAKE
34
AC_CONFIG_HEADERS([config.h])
35
 
36 1760 jeremybenn
AC_REVISION([$Id: configure.ac,v 1.5 2009-03-02 13:16:01 jeremybennett Exp $ using automake version] AC_ACVERSION)
37 1748 jeremybenn
 
38
# make sure we are using a recent autoconf version
39
AC_PREREQ(2.59)
40
 
41 1751 jeremybenn
# yuck.
42 1748 jeremybenn
case "$target_cpu" in
43
or32*)  CPU_ARCH=or32;
44
        ARCH_ISA=OR32;
45
        AC_DEFINE(OR32_TYPES, 1, "The compiler uses the OR32 ELF types");;
46
dlx*)   CPU_ARCH=dlx;
47
        ARCH_ISA=DLX;;
48
*)      AC_MSG_WARN(Unknown target architecture $target_cpu: OR32 assumed);
49
        CPU_ARCH=or32;
50
        ARCH_ISA=OR32;
51
        AC_DEFINE(OR32_TYPES, 1, "The compiler uses the OR32 ELF types");;
52
esac
53
 
54 1751 jeremybenn
# determine endianism from target CPU name. If it has "little" in the name,
55
# then its litte endian, otherwise its big endian (default for OR1K)
56
case "$target_cpu" in
57
*little*)  AC_DEFINE(OR32_LITTLE_ENDIAN, 1, "The OR32 is little endian");;
58
       *)  AC_DEFINE(OR32_BIG_ENDIAN,    1, "The OR32 is big endian");;
59
esac
60
 
61 1748 jeremybenn
AC_SUBST(CPU_ARCH)
62
 
63
# We want these before the checks, so the checks can modify their values.
64
test -z "$CFLAGS" && CFLAGS="-g -Wall" auto_cflags=1
65
 
66
AC_PROG_CC
67
AM_PROG_CC_C_O
68
 
69
AC_PROG_MAKE_SET
70
 
71
# If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS.
72
test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O2 -D$ARCH_ISA"
73
 
74
AC_PROG_GCC_TRADITIONAL
75
AC_PROG_INSTALL
76
AC_CHECK_PROG(AR, ar, ar)
77
 
78
# This is GNU compliant source and uses GNU libraries
79
AC_DEFINE(_GNU_SOURCE, 1, "The source code uses the GNU libraries)
80
 
81
# Set default for ARFLAGS, since autoconf does not have a macro for it.
82
# This allows people to set it when running configure or make
83
test -n "$ARFLAGS" || ARFLAGS="cr"
84
 
85
MAKE_SHELL=/bin/sh
86
 
87
AC_SUBST(MAKE_SHELL)
88
 
89
AC_TYPE_SIGNAL
90
AC_HEADER_STAT
91
AC_HEADER_DIRENT
92
AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat)
93
AC_CHECK_FUNCS(strndup grantpt unlockpt ptsname on_exit isblank)
94
AC_CHECK_FUNCS(basename)
95
AC_FUNC_STRCOLL
96
AC_HEADER_STDC
97
AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
98
                sys/ptem.h sys/pte.h sys/stream.h sys/stropts.h sys/select.h \
99
                termcap.h termios.h termio.h sys/file.h locale.h getopt.h \
100
                net/ethernet.h sys/ethernet.h malloc.h inttypes.h libintl.h)
101 1751 jeremybenn
AC_CHECK_DECLS([I_PUSH])
102 1748 jeremybenn
AC_C_BIGENDIAN
103
 
104
# Checks for typedefs, structures, and compiler characteristics (for argtable2)
105
AC_C_CONST
106
AC_TYPE_SIZE_T
107
AC_STRUCT_TM
108
 
109
# Checks for library functions (for argtable2).
110
AC_FUNC_MALLOC
111
AC_FUNC_STRFTIME
112
AC_FUNC_STRTOD
113
AC_CHECK_FUNCS([bzero strchr strcspn strrchr strtol])
114
AC_CHECK_FUNC(getopt_long, SYS_GETOPTLONG=1, SYS_GETOPTLONG=0)
115
AC_CHECK_FUNC(regcomp,     SYS_REGEX=1,      SYS_REGEX=0)
116
AC_CHECK_FUNC(strptime,    SYS_STRPTIME=1,   SYS_STRPTIME=0)
117
 
118
# Define automake conditionals (for argtable2)
119
AM_CONDITIONAL(USE_SYS_GETOPTLONG, test "$SYS_GETOPTLONG" = "1")
120
AM_CONDITIONAL(USE_ARGREX,         test "$SYS_REGEX" = "1")
121
AM_CONDITIONAL(USE_ARGDATE,        test "$SYS_STRPTIME" = "1")
122
 
123
# check for "long long" (added by Erez)
124
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long ll; unsigned long long ull;]])],[AC_DEFINE(CC_HAS_LONG_LONG, 1, "Whether the compiler supports 'long long'.")],[])
125
 
126
# check for {u,}int{8,16,32}_t in inttypes.h.
127
AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t],,, [#include ])
128
AC_CHECK_TYPES([int8_t, int16_t, int32_t],,, [#include ])
129
 
130
AC_CHECK_SIZEOF(char, 1)
131
AC_CHECK_SIZEOF(short, 1)
132
AC_CHECK_SIZEOF(int, 1)
133
AC_CHECK_SIZEOF(long, 1)
134
 
135 1751 jeremybenn
#Check for compare function type for qsort (needed by some Linuxes)
136
AC_CHECK_TYPES([__compar_fn_t])
137
 
138 1748 jeremybenn
# check for GNU readline
139
AC_CHECK_LIB(readline, add_history)
140
 
141
# yuck
142
case "$host_os" in
143
aix*)   prefer_curses=yes ;;
144
esac
145
 
146
case "$host_cpu" in
147
*cray*) LOCAL_CFLAGS=-DCRAY ;;
148
esac
149
 
150
case "$host_os" in
151
isc*)   LOCAL_CFLAGS=-Disc386 ;;
152
esac
153
 
154
case "$host_os" in
155
solaris*) LIBS="-lsocket -lnsl" ;;
156
esac
157
 
158
# define options
159
 
160
AC_MSG_CHECKING(whether to enable profiling)
161
AC_ARG_ENABLE(profiling,
162
    [  --enable-profiling      generate profiling code], [
163
    case "$enableval" in
164 1751 jeremybenn
        yes) profile="-pg" ;;
165 1748 jeremybenn
    esac
166
])
167
AC_MSG_RESULT(${enable_profiling-no})
168
 
169
execution="1"
170
 
171
INCLUDES="-I\${top_builddir}/cpu/$CPU_ARCH"
172
AC_MSG_CHECKING(which execution style to use)
173
AC_ARG_ENABLE(execution,
174
    [  --enable-execution Execution style to use (simple/complex/dynamic)],
175
    [
176
    case "$enableval" in
177
    simple)
178
      INCLUDES="-I\${top_srcdir}/cpu/$CPU_ARCH"
179
      execution="0"
180
      AC_MSG_RESULT(simple)
181
      ;;
182
    complex)
183
      INCLUDES="-I\${top_builddir}/cpu/$CPU_ARCH"
184
      execution="1"
185
      AC_MSG_RESULT(complex)
186
      ;;
187
    dynamic)
188
      INCLUDES="-I\${top_srcdir}/cpu/$CPU_ARCH"
189
      execution="2"
190
      AC_MSG_RESULT(dynamic)
191
      ;;
192
    *)
193
      AC_MSG_ERROR("excecution must one of simple/complex/dynamic")
194
      ;;
195
    esac
196
    ],
197
    [
198
      AC_MSG_RESULT(complex)
199
    ])
200
 
201
eth_phy="0"
202
AC_MSG_CHECKING(whether to enable ethernet phy emulation)
203
AC_ARG_ENABLE(ethphy,
204
    [  --enable-ethphy    compiles sim with ethernet phy support], [
205
    case "$enableval" in
206
  no)  eth_phy="0" ;;
207
        yes) eth_phy="1" ;;
208
    esac
209
])
210
AC_MSG_RESULT(${enable_eth_phy-no})
211
 
212
 
213
raw_range_stats="0"
214
AC_MSG_CHECKING(whether to use raw range stats)
215
AC_ARG_ENABLE(range_stats,
216
    [  --enable-range-stats      Specifies, whether we should do register accesses over time analysis.], [
217
    case "$enableval" in
218
  no)  raw_range_stats="0" ;;
219
        yes) raw_range_stats="1" simple_execution="1" ;;
220
    esac
221
])
222
AC_MSG_RESULT(${enable_range_stats-no})
223
 
224
set_ov_flag="0"
225
AC_MSG_CHECKING(whether instructions set overflow flag)
226
AC_ARG_ENABLE(ov_flag,
227
    [  --enable-ov-flag      Whether instructions set overflow flag.], [
228
    case "$enableval" in
229 1751 jeremybenn
    no)  set_ov_flag="0" ;;
230
    yes) set_ov_flag="1" ;;
231 1748 jeremybenn
    esac
232
])
233
AC_MSG_RESULT(${enable_ov_flag-no})
234
 
235
set_arith_flag="0"
236
AC_MSG_CHECKING(whether arithmethic instructions set flag)
237
AC_ARG_ENABLE(arith_flag,
238
    [  --enable-arith-flag      Whether arithmethic instructions setflag.], [
239
    case "$enableval" in
240
  no)  set_arith_flag="0" ;;
241
        yes) set_arith_flag="1" ;;
242
    esac
243
])
244
AC_MSG_RESULT(${enable_arith_flag-no})
245
 
246
# check for --enable-debug argument (for argtable2)
247
AC_ARG_ENABLE(
248
    [debug],
249
    AC_HELP_STRING([--enable-debug],[enable library debugging symbols]),
250
    [
251
       case $enableval in
252 1751 jeremybenn
          yes) echo "enabling argtable2 debugging symbols" & DEBUGFLAGS="-g -UNDEBUG";;
253
          no)  echo "disabling argtable2 debugging symbols" & DEBUGFLAGS="-DNDEBUG";;
254 1748 jeremybenn
          *)   echo "illegal argument to --enable-debug" & exit 1;;
255
       esac
256
    ],
257
    [DEBUGFLAGS="-DNDEBUG"]
258
    )
259
AC_SUBST(DEBUGFLAGS)
260
 
261
AC_DEFINE_UNQUOTED(RAW_RANGE_STATS, $raw_range_stats, [ Specifies, whether we should do register accesses over time analysis. Simple execution must be enabled!])
262
AC_DEFINE_UNQUOTED(SET_OV_FLAG, $set_ov_flag, [ Whether instructions set overflow flag])
263
AC_DEFINE_UNQUOTED(ARITH_SET_FLAG, $set_arith_flag, [Whether arithmethic instructions set flag on zero])
264
AC_DEFINE_UNQUOTED(HAVE_ETH_PHY, $eth_phy, [Whether we have ethernet PHY support])
265
AC_DEFINE_UNQUOTED(SIMPLE_EXECUTION, $execution == 0, [Whether we are building with simple execution module])
266
AC_DEFINE_UNQUOTED(COMPLEX_EXECUTION, $execution == 1, [Whether we are building with complex execution module])
267
AC_DEFINE_UNQUOTED(DYNAMIC_EXECUTION, $execution == 2, [Whether we are building with dynamic execution module])
268
AM_CONDITIONAL(GENERATE_NEEDED, test x$execution = x1)
269
AM_CONDITIONAL(DYNAMIC_EXECUTION, test x$execution = x2)
270
 
271
 
272
test -n "$profile"  && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile"
273
# CFLAGS="$CFLAGS -O4"
274
 
275
BUILD_DIR=`pwd`
276
AC_SUBST(BUILD_DIR)
277
 
278
AC_SUBST(CFLAGS)
279
AC_SUBST(LOCAL_CFLAGS)
280
AC_SUBST(LOCAL_LDFLAGS)
281
AC_SUBST(LOCAL_DEFS)
282
 
283
AC_SUBST(AR)
284
AC_SUBST(ARFLAGS)
285
 
286
AC_SUBST(host_cpu)
287
AC_SUBST(host_os)
288
AC_SUBST(host)
289
 
290
AC_SUBST(SUMVERSION)
291
AC_SUBST(TERMCAP_LIB)
292
 
293
AC_DEFINE(HAVE_EXECUTION, 1, [ Some shared files require to know, whether we have execution functions defined.])
294
 
295
# yuck
296
INCLUDES="$INCLUDES -I\${top_srcdir} -I\${top_srcdir}/cpu/common \
297
-I\${top_srcdir}/cpu/or1k -I\${top_srcdir}/cache -I\${top_srcdir}/mmu \
298
-I\${top_srcdir}/bpb -I\${top_srcdir}/peripheral -I\${top_srcdir}/tick \
299
-I\${top_srcdir}/peripheral/channels -I\${top_srcdir}/pm -I\${top_srcdir}/pic \
300
-I\${top_srcdir}/debug -I\${top_srcdir}/vapi -I\${top_srcdir}/support \
301
-I\${top_srcdir}/cuc -I\${top_srcdir}/port -I\${top_srcdir}/argtable2"
302
AC_SUBST(INCLUDES)
303
 
304
AC_CONFIG_FILES([Makefile argtable2/Makefile bpb/Makefile cache/Makefile
305
        cpu/Makefile cpu/common/Makefile cpu/or1k/Makefile cuc/Makefile
306
        debug/Makefile doc/Makefile
307
        support/Makefile mmu/Makefile peripheral/Makefile tick/Makefile
308
        peripheral/channels/Makefile
309
        pm/Makefile pic/Makefile vapi/Makefile port/Makefile])
310
 
311
# yuck. I don't know why I cannot just substitute $CPU_ARCH in the above
312
case "$CPU_ARCH" in
313
dlx)    AC_CONFIG_FILES([cpu/dlx/Makefile]);;
314
*)      AC_CONFIG_FILES([cpu/or32/Makefile]);;
315
esac
316
 
317
# Makefile uses this timestamp file to record whether config.h is up to date.
318
# AC_CONFIG_COMMANDS([default],[[
319
# echo > stamp-h
320
# ]],[[]])
321
AC_OUTPUT

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.