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

Subversion Repositories openrisc

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

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

powered by: WebSVN 2.1.0

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