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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [configure.ac] - Blame information for rev 89

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

Line No. Rev Author Line
1 82 jeremybenn
# configure.ac -- Top level autoconf configuration file
2 19 jeremybenn
#
3
# Copyright (C) 1999-2008 OpenCores
4 82 jeremybenn
# Copyright (C) 2008, 2010 Embecosm Limited
5 19 jeremybenn
#
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 82 jeremybenn
# Use a full version number (x.y.z, possibly with "rcn" as a suffix) when
30 89 jeremybenn
# preparing a release, otherwise use a the date version (yyyy-mm-dd).
31
AC_INIT([or1ksim], [2010-04-21], [openrisc@opencores.org])
32 82 jeremybenn
AC_CONFIG_MACRO_DIR([m4])
33
 
34
# Check we have the execute source file present for sanity. Specify a separate
35
# config for the testsuite, since we'll need different tool chain there (the
36
# OpenRISC one, rather than the native one).
37 19 jeremybenn
AC_CONFIG_SRCDIR([cpu/or32/execute.c])
38 82 jeremybenn
AC_CONFIG_SUBDIRS([testsuite])
39
 
40 19 jeremybenn
AC_CANONICAL_TARGET([])
41
AC_PROG_LIBTOOL
42
AM_INIT_AUTOMAKE
43
AC_CONFIG_HEADERS([config.h])
44
 
45
AC_REVISION([$Id: configure.ac 89 2010-04-21 10:51:35Z jeremybennett $ using automake version] AC_ACVERSION)
46
 
47
# make sure we are using a recent autoconf version
48
AC_PREREQ(2.59)
49
 
50
# yuck.
51
case "$target_cpu" in
52
or32*)  CPU_ARCH=or32;
53
        ARCH_ISA=OR32;
54
        AC_DEFINE(OR32_TYPES, 1, "The compiler uses the OR32 ELF types");;
55
dlx*)   CPU_ARCH=dlx;
56
        ARCH_ISA=DLX;;
57
*)      AC_MSG_WARN(Unknown target architecture $target_cpu: OR32 assumed);
58
        CPU_ARCH=or32;
59
        ARCH_ISA=OR32;
60
        AC_DEFINE(OR32_TYPES, 1, "The compiler uses the OR32 ELF types");;
61
esac
62
 
63
# determine endianism from target CPU name. If it has "little" in the name,
64
# then its litte endian, otherwise its big endian (default for OR1K)
65
case "$target_cpu" in
66
*little*)  AC_DEFINE(OR32_LITTLE_ENDIAN, 1, "The OR32 is little endian");;
67
       *)  AC_DEFINE(OR32_BIG_ENDIAN,    1, "The OR32 is big endian");;
68
esac
69
 
70
AC_SUBST(CPU_ARCH)
71
 
72 82 jeremybenn
# Set the CFLAGS we want
73
CFLAGS="$CFLAGS -g -Wall -Werror -O2 -D$ARCH_ISA"
74 19 jeremybenn
 
75 82 jeremybenn
AM_PROG_AS
76
 
77 19 jeremybenn
AC_PROG_CC
78
AM_PROG_CC_C_O
79
 
80
AC_PROG_MAKE_SET
81
 
82
AC_PROG_INSTALL
83
AC_CHECK_PROG(AR, ar, ar)
84
 
85
# This is GNU compliant source and uses GNU libraries
86
AC_DEFINE(_GNU_SOURCE, 1, "The source code uses the GNU libraries)
87 82 jeremybenn
AC_SUBST(_GNU_SOURCE)
88 19 jeremybenn
 
89
# Set default for ARFLAGS, since autoconf does not have a macro for it.
90
# This allows people to set it when running configure or make
91
test -n "$ARFLAGS" || ARFLAGS="cr"
92
 
93
MAKE_SHELL=/bin/sh
94
 
95
AC_SUBST(MAKE_SHELL)
96
 
97
AC_TYPE_SIGNAL
98 82 jeremybenn
AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h strings.h      \
99
                 sys/ptem.h sys/pte.h sys/stream.h sys/stropts.h sys/select.h \
100
                 termcap.h termios.h termio.h sys/file.h locale.h getopt.h    \
101
                 net/ethernet.h sys/ethernet.h malloc.h inttypes.h libintl.h)
102 19 jeremybenn
AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat)
103 82 jeremybenn
AC_CHECK_FUNCS(grantpt unlockpt ptsname on_exit)
104 19 jeremybenn
AC_CHECK_FUNCS(basename)
105
AC_FUNC_STRCOLL
106 82 jeremybenn
AC_CHECK_DECLS([I_PUSH, rl_event_hook], [], [], \
107
               [#include ])
108 19 jeremybenn
AC_C_BIGENDIAN
109
 
110 82 jeremybenn
# The test for strndup, strcasecmp and isblank fails on modern machines. I
111
# think it's because GCC 4 does not like the way autoconf overrides the built
112
# in type declaration. So we must check for them by steam.
113
AC_MSG_CHECKING(for strndup)
114
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_STRING_H
115
                                  #include 
116
                                  #else
117
                                  char *strndup (const char *s,
118
                                                 size_t      n);
119
                                  #endif]],                      \
120
                                [[const char *s = "test";
121
                                  char       *t;
122
                                  t = strndup (s, 3);]])], \
123
               [AC_DEFINE(HAVE_STRNDUP, 1, \
124
                          "Whether the strndup function is available") \
125
                AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
126
 
127
AC_MSG_CHECKING(for strcasecmp)
128
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_STRINGS_H
129
                                  #include 
130
                                  #else
131
                                  int strcasecmp (const char *s1,
132
                                                  const char *s2);
133
                                  #endif]],                       \
134
                                [[const char *s = "test";
135
                                  const char *t = "TEST";
136
                                  int         res;
137
                                  res = strcasecmp (s, t);]])], \
138
               [AC_DEFINE(HAVE_STRCASECMP, 1, \
139
                          "Whether the strcasecmp function is available") \
140
                AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
141
 
142
AC_MSG_CHECKING(for isblank)
143
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_CTYPE_H
144
                                  #include 
145
                                  #else
146
                                  int isblank (int  c);
147
                                  #endif]],               \
148
                                [[return isblank ('x');]])], \
149
               [AC_DEFINE(HAVE_ISBLANK, 1, \
150
                          "Whether the isblank function is available") \
151
                AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
152
 
153 19 jeremybenn
# Checks for typedefs, structures, and compiler characteristics (for argtable2)
154
AC_C_CONST
155
AC_TYPE_SIZE_T
156
AC_STRUCT_TM
157
 
158
# Checks for library functions (for argtable2).
159
AC_FUNC_MALLOC
160
AC_FUNC_STRFTIME
161
AC_FUNC_STRTOD
162
AC_CHECK_FUNCS([bzero strchr strcspn strrchr strtol])
163
AC_CHECK_FUNC(getopt_long, SYS_GETOPTLONG=1, SYS_GETOPTLONG=0)
164
AC_CHECK_FUNC(regcomp,     SYS_REGEX=1,      SYS_REGEX=0)
165
AC_CHECK_FUNC(strptime,    SYS_STRPTIME=1,   SYS_STRPTIME=0)
166
 
167
# Define automake conditionals (for argtable2)
168
AM_CONDITIONAL(USE_SYS_GETOPTLONG, test "$SYS_GETOPTLONG" = "1")
169
AM_CONDITIONAL(USE_ARGREX,         test "$SYS_REGEX" = "1")
170
AM_CONDITIONAL(USE_ARGDATE,        test "$SYS_STRPTIME" = "1")
171
 
172
# check for "long long" (added by Erez)
173
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'.")],[])
174
 
175
# check for {u,}int{8,16,32}_t in inttypes.h.
176
AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t],,, [#include ])
177
AC_CHECK_TYPES([int8_t, int16_t, int32_t],,, [#include ])
178
 
179
AC_CHECK_SIZEOF(char, 1)
180
AC_CHECK_SIZEOF(short, 1)
181
AC_CHECK_SIZEOF(int, 1)
182
AC_CHECK_SIZEOF(long, 1)
183
 
184
#Check for compare function type for qsort (needed by some Linuxes)
185
AC_CHECK_TYPES([__compar_fn_t])
186
 
187
# check for GNU readline
188
AC_CHECK_LIB(readline, add_history)
189
 
190
# yuck
191
case "$host_os" in
192
aix*)   prefer_curses=yes ;;
193
esac
194
 
195
case "$host_cpu" in
196
*cray*) LOCAL_CFLAGS=-DCRAY ;;
197
esac
198
 
199
case "$host_os" in
200
isc*)   LOCAL_CFLAGS=-Disc386 ;;
201
esac
202
 
203
case "$host_os" in
204
solaris*) LIBS="-lsocket -lnsl" ;;
205
esac
206
 
207
# define options
208
 
209
AC_MSG_CHECKING(whether to enable profiling)
210
AC_ARG_ENABLE(profiling,
211
    [  --enable-profiling      generate profiling code], [
212
    case "$enableval" in
213
        yes) profile="-pg" ;;
214
    esac
215
])
216
AC_MSG_RESULT(${enable_profiling-no})
217
 
218
execution="1"
219
 
220
INCLUDES="-I\${top_builddir}/cpu/$CPU_ARCH"
221
AC_MSG_CHECKING(which execution style to use)
222
AC_ARG_ENABLE(execution,
223
    [  --enable-execution Execution style to use (simple/complex/dynamic)],
224
    [
225
    case "$enableval" in
226
    simple)
227
      INCLUDES="-I\${top_srcdir}/cpu/$CPU_ARCH"
228
      execution="0"
229
      AC_MSG_RESULT(simple)
230
      ;;
231
    complex)
232
      INCLUDES="-I\${top_builddir}/cpu/$CPU_ARCH"
233
      execution="1"
234
      AC_MSG_RESULT(complex)
235
      ;;
236
    dynamic)
237
      INCLUDES="-I\${top_srcdir}/cpu/$CPU_ARCH"
238
      execution="2"
239
      AC_MSG_RESULT(dynamic)
240
      ;;
241
    *)
242
      AC_MSG_ERROR("excecution must one of simple/complex/dynamic")
243
      ;;
244
    esac
245
    ],
246
    [
247
      AC_MSG_RESULT(complex)
248
    ])
249
 
250
eth_phy="0"
251
AC_MSG_CHECKING(whether to enable ethernet phy emulation)
252
AC_ARG_ENABLE(ethphy,
253
    [  --enable-ethphy    compiles sim with ethernet phy support], [
254
    case "$enableval" in
255
  no)  eth_phy="0" ;;
256
        yes) eth_phy="1" ;;
257
    esac
258
])
259
AC_MSG_RESULT(${enable_eth_phy-no})
260
 
261
 
262
raw_range_stats="0"
263
AC_MSG_CHECKING(whether to use raw range stats)
264
AC_ARG_ENABLE(range_stats,
265
    [  --enable-range-stats      Specifies, whether we should do register accesses over time analysis.], [
266
    case "$enableval" in
267
  no)  raw_range_stats="0" ;;
268
        yes) raw_range_stats="1" simple_execution="1" ;;
269
    esac
270
])
271
AC_MSG_RESULT(${enable_range_stats-no})
272
 
273
set_ov_flag="0"
274
AC_MSG_CHECKING(whether instructions set overflow flag)
275
AC_ARG_ENABLE(ov_flag,
276
    [  --enable-ov-flag      Whether instructions set overflow flag.], [
277
    case "$enableval" in
278
    no)  set_ov_flag="0" ;;
279
    yes) set_ov_flag="1" ;;
280
    esac
281
])
282
AC_MSG_RESULT(${enable_ov_flag-no})
283
 
284
set_arith_flag="0"
285
AC_MSG_CHECKING(whether arithmethic instructions set flag)
286
AC_ARG_ENABLE(arith_flag,
287
    [  --enable-arith-flag      Whether arithmethic instructions setflag.], [
288
    case "$enableval" in
289
  no)  set_arith_flag="0" ;;
290
        yes) set_arith_flag="1" ;;
291
    esac
292
])
293
AC_MSG_RESULT(${enable_arith_flag-no})
294
 
295
# check for --enable-debug argument (for argtable2)
296
AC_ARG_ENABLE(
297
    [debug],
298
    AC_HELP_STRING([--enable-debug],[enable library debugging symbols]),
299
    [
300
       case $enableval in
301
          yes) echo "enabling argtable2 debugging symbols" & DEBUGFLAGS="-g -UNDEBUG";;
302
          no)  echo "disabling argtable2 debugging symbols" & DEBUGFLAGS="-DNDEBUG";;
303
          *)   echo "illegal argument to --enable-debug" & exit 1;;
304
       esac
305
    ],
306
    [DEBUGFLAGS="-DNDEBUG"]
307
    )
308
AC_SUBST(DEBUGFLAGS)
309
 
310
AC_DEFINE_UNQUOTED(RAW_RANGE_STATS, $raw_range_stats, [ Specifies, whether we should do register accesses over time analysis. Simple execution must be enabled!])
311
AC_DEFINE_UNQUOTED(SET_OV_FLAG, $set_ov_flag, [ Whether instructions set overflow flag])
312
AC_DEFINE_UNQUOTED(ARITH_SET_FLAG, $set_arith_flag, [Whether arithmethic instructions set flag on zero])
313
AC_DEFINE_UNQUOTED(HAVE_ETH_PHY, $eth_phy, [Whether we have ethernet PHY support])
314
AC_DEFINE_UNQUOTED(SIMPLE_EXECUTION, $execution == 0, [Whether we are building with simple execution module])
315
AC_DEFINE_UNQUOTED(COMPLEX_EXECUTION, $execution == 1, [Whether we are building with complex execution module])
316
AC_DEFINE_UNQUOTED(DYNAMIC_EXECUTION, $execution == 2, [Whether we are building with dynamic execution module])
317
AM_CONDITIONAL(GENERATE_NEEDED, test x$execution = x1)
318
AM_CONDITIONAL(DYNAMIC_EXECUTION, test x$execution = x2)
319
 
320
 
321
test -n "$profile"  && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile"
322
# CFLAGS="$CFLAGS -O4"
323
 
324
BUILD_DIR=`pwd`
325
AC_SUBST(BUILD_DIR)
326
 
327
AC_SUBST(CFLAGS)
328
AC_SUBST(LOCAL_CFLAGS)
329
AC_SUBST(LOCAL_LDFLAGS)
330
AC_SUBST(LOCAL_DEFS)
331
 
332
AC_SUBST(AR)
333
AC_SUBST(ARFLAGS)
334
 
335
AC_SUBST(host_cpu)
336
AC_SUBST(host_os)
337
AC_SUBST(host)
338
 
339
AC_SUBST(SUMVERSION)
340
AC_SUBST(TERMCAP_LIB)
341
 
342
AC_DEFINE(HAVE_EXECUTION, 1, [ Some shared files require to know, whether we have execution functions defined.])
343
 
344
# yuck
345
INCLUDES="$INCLUDES -I\${top_srcdir} -I\${top_srcdir}/cpu/common \
346
-I\${top_srcdir}/cpu/or1k -I\${top_srcdir}/cache -I\${top_srcdir}/mmu \
347
-I\${top_srcdir}/bpb -I\${top_srcdir}/peripheral -I\${top_srcdir}/tick \
348
-I\${top_srcdir}/peripheral/channels -I\${top_srcdir}/pm -I\${top_srcdir}/pic \
349
-I\${top_srcdir}/debug -I\${top_srcdir}/vapi -I\${top_srcdir}/support \
350
-I\${top_srcdir}/cuc -I\${top_srcdir}/port -I\${top_srcdir}/argtable2"
351
AC_SUBST(INCLUDES)
352
 
353 82 jeremybenn
AC_CONFIG_FILES([Makefile                             \
354
                 argtable2/Makefile                   \
355
                 bpb/Makefile                         \
356
                 cache/Makefile                       \
357
                 cpu/Makefile                         \
358
                 cpu/common/Makefile                  \
359
                 cpu/or1k/Makefile                    \
360
                 cuc/Makefile                         \
361
                 debug/Makefile                       \
362
                 doc/Makefile                         \
363
                 support/Makefile                     \
364
                 mmu/Makefile                         \
365
                 peripheral/Makefile                  \
366
                 tick/Makefile                        \
367
                 peripheral/channels/Makefile         \
368
                 pm/Makefile                          \
369
                 pic/Makefile                         \
370
                 vapi/Makefile                        \
371
                 port/Makefile])
372 19 jeremybenn
 
373
# yuck. I don't know why I cannot just substitute $CPU_ARCH in the above
374
case "$CPU_ARCH" in
375
dlx)    AC_CONFIG_FILES([cpu/dlx/Makefile]);;
376
*)      AC_CONFIG_FILES([cpu/or32/Makefile]);;
377
esac
378
 
379 82 jeremybenn
# Generate the output
380
AC_COPYRIGHT([Copyright (C) 1999-2008 OpenCores
381
Copyright (C) 2008, 2010 Embecosm Limited
382
 
383
Contributor Jeremy Bennett 
384
 
385
This file is part of OpenRISC 1000 Architectural Simulator.
386
 
387
This program is free software; you can redistribute it and/or modify it
388
under the terms of the GNU General Public License as published by the Free
389
Software Foundation; either version 3 of the License, or (at your option)
390
any later version.
391
 
392
This program is distributed in the hope that it will be useful, but WITHOUT
393
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
394
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
395
more details.
396
 
397
You should have received a copy of the GNU General Public License along
398
with this program.  If not, see .])
399
 
400 19 jeremybenn
AC_OUTPUT

powered by: WebSVN 2.1.0

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