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

Subversion Repositories openrisc_me

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

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

powered by: WebSVN 2.1.0

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