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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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