source: rtems/cpukit/configure.ac @ ea35fdc6

4.104.114.84.95
Last change on this file since ea35fdc6 was ea35fdc6, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/27/07 at 07:21:27

Dynamically derive RTEMS_MAJOR,
RTEMS_MINOR, RTEMS_REVISION from _RTEMS_VERSION.
Add
RTEMS_MAJOR, RTEMS_MINOR,RTEMS_REVISION to cpuopt.h.

  • Property mode set to 100644
File size: 8.1 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id$
4
5AC_PREREQ(2.60)
6AC_INIT([rtems-cpukit],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
7AC_CONFIG_SRCDIR([score])
8RTEMS_TOP([..],[])
9
10RTEMS_CANONICAL_TARGET_CPU
11
12AM_INIT_AUTOMAKE([no-define nostdinc subdir-objects foreign 1.10])
13AM_MAINTAINER_MODE
14
15RTEMS_ENABLE_MULTILIB
16RTEMS_ENABLE_MULTIPROCESSING
17RTEMS_ENABLE_POSIX
18RTEMS_ENABLE_ITRON
19RTEMS_ENABLE_RTEMS_DEBUG
20RTEMS_ENABLE_NETWORKING
21
22RTEMS_ENV_RTEMSCPU
23RTEMS_CHECK_RTEMS_DEBUG
24
25# Is this a supported CPU?
26AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
27if test -d "$srcdir/score/cpu/$RTEMS_CPU"; then
28  AC_MSG_RESULT(yes)
29else
30  AC_MSG_ERROR(no)
31fi
32
33RTEMS_PROG_CC_FOR_TARGET([-fasm])
34RTEMS_PROG_CCAS
35RTEMS_CANONICALIZE_TOOLS
36AM_PROG_CC_C_O
37AC_PROG_RANLIB
38
39RTEMS_CHECK_NEWLIB
40
41# HACK: We should use a feature-based configuration.
42AS_IF([test x"${RTEMS_CPU}" = x"unix"],[
43# HACK: silently accept --enable-unixlib
44  test -n "${enable_unixlib}" || enable_unixlib="yes"
45])
46
47# BSD-isms, used throughout the sources
48# Not really used by this configure script
49# FIXME: They should be eliminated if possible.
50AC_CHECK_FUNCS([strsep strcasecmp snprintf])
51AC_CHECK_FUNCS([bcopy bcmp])
52AC_CHECK_FUNCS([isascii fileno])
53
54## Check if the installed toolchain has these headers
55AC_CHECK_HEADER([tar.h])
56
57## BSD-ism, should not be used in RTEMS,
58## nevertheless it still is.
59AC_CHECK_HEADER([sys/errno.h],[],
60  [AC_MSG_ERROR([Missing required header sys/errno.h])])
61
62## if libc provides stdint.h, use it.
63AS_IF([test x"${ac_cv_header_stdint_h}" = xyes],
64[RTEMS_USES_STDINT_H=yes],
65[RTEMS_USES_STDINT_H=no])
66
67## error out if libc doesn't at least provide inttypes.h
68AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
69[AC_MSG_ERROR([Required header inttypes.h not found])])
70
71AC_CHECK_TYPES([ uint8_t,  int8_t])
72AC_CHECK_TYPES([uint16_t, int16_t])
73AC_CHECK_TYPES([uint32_t, int32_t])
74AC_CHECK_TYPES([uint64_t, int64_t])
75AC_CHECK_TYPES([uintmax_t])
76
77RTEMS_CHECK_MULTIPROCESSING
78RTEMS_CHECK_POSIX_API
79RTEMS_CHECK_ITRON_API
80RTEMS_CHECK_NETWORKING
81
82AS_IF([test x"${RTEMS_USE_NEWLIB}" = xyes],
83[RTEMS_USES_TAR_H=yes],
84[RTEMS_USES_TAR_H=$ac_cv_header_tar_h])
85
86AS_IF([test x"${RTEMS_CPU}" = x"unix"],[
87## FIXME: This check is doubtful
88AS_IF([test "$HAS_MP" = "yes"],
89  [RTEMS_CHECK_SYSV_UNIX])
90
91## The code fragment below had been used in tools/cpu/unix/gensize.c.
92## FIXME:
93## * The pad very likely is not necessary.
94AC_CHECK_SIZEOF([CPU_CONTEXT],[],[
95#include <stdio.h>
96#include <setjmp.h>
97
98typedef struct {
99  jmp_buf     regs;
100  int         isr_level;
101  int         pad[4]; /* just in case */
102} CPU_CONTEXT;
103])
104])
105
106rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
107rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
108rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
109
110cat >>cpuopts.tmp <<\_ACEOF
111/**
112 * @file rtems/score/cpuopts.h
113 */
114/* target cpu dependent options file */
115/* automatically generated -- DO NOT EDIT!! */
116#ifndef _RTEMS_SCORE_CPUOPTS_H
117#define _RTEMS_SCORE_CPUOPTS_H
118_ACEOF
119
120RTEMS_CPUOPT([RTEMS_DEBUG],
121  [test x"${enable_rtems_debug}" = x"yes"],
122  [1],
123  [if RTEMS_DEBUG is enabled])
124
125RTEMS_CPUOPT([RTEMS_ITRON_API],
126  [test x"$rtems_cv_HAS_ITRON_API" = x"yes"],
127  [1],
128  [if itron api is supported])
129
130RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
131  [test x"$enable_multiprocessing" = xyes],
132  [1],
133  [if multiprocessing is enabled])
134
135RTEMS_CPUOPT([RTEMS_NEWLIB],
136  [test x"$RTEMS_USE_NEWLIB" = xyes],
137  [1],
138  [if using newlib])
139
140RTEMS_CPUOPT([RTEMS_POSIX_API],
141  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
142  [1],
143  [if posix api is supported])
144
145RTEMS_CPUOPT([RTEMS_NETWORKING],
146  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
147  [1],
148  [if networking is enabled])
149
150RTEMS_CPUOPT([RTEMS_UNIX],
151  [test x"$RTEMS_CPU" = xunix],
152  [1],
153  [to indicate RTEMS unix])
154
155RTEMS_CPUOPT([RTEMS_UNIXLIB],
156  [test x"${enable_unixlib}" = xyes],
157  [1],
158  [to indicate RTEMS using RTEMS's unixlib])
159
160RTEMS_CPUOPT([RTEMS_USES_STDINT_H],
161  [test x"${RTEMS_USES_STDINT_H}" = x"yes"],
162  [1],
163  [if RTEMS uses stdint.h])
164
165RTEMS_CPUOPT([RTEMS_USES_TAR_H],
166  [test x"${RTEMS_USES_TAR_H}" = x"yes"],
167  [1],
168  [if RTEMS uses tar.h])
169
170RTEMS_CPUOPT([RTEMS_VERSION],
171  [true],
172  ["]_RTEMS_VERSION["],
173  [RTEMS version string])
174
175RTEMS_CPUOPT([SIZEOF_CPU_CONTEXT],
176  [test x"$RTEMS_CPU" = x"unix"],
177  [$ac_cv_sizeof_CPU_CONTEXT],
178  [The size of a 'CPU_CONTEXT', as computed by sizeof])
179
180RTEMS_CPUOPT([__RTEMS_MAJOR__],
181  [true],
182  [$rtems_major],
183  [major version portion of an RTEMS release])
184
185RTEMS_CPUOPT([__RTEMS_MINOR__],
186  [true],
187  [$rtems_minor],
188  [minor version portion of an RTEMS release])
189
190RTEMS_CPUOPT([__RTEMS_REVISION__],
191  [true],
192  [$rtems_revision],
193  [revision version portion of an RTEMS release])
194
195cat >>cpuopts.tmp <<\_ACEOF
196
197#endif /* _RTEMS_SCORE_CPUOPTS_H */
198_ACEOF
199
200AS_MKDIR_P(score/include/rtems/score)
201AS_IF([test -f score/include/rtems/score/cpuopts.h],
202[
203  AS_IF([cmp -s score/include/rtems/score/cpuopts.h cpuopts.tmp 2>/dev/null],
204  [
205    AC_MSG_NOTICE([score/include/rtems/score/cpuopts.h is unchanged])
206    rm -f cpuopts.tmp
207  ],[
208    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
209    rm -f score/include/rtems/score/cpuopts.h
210    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
211  ])
212],[
213    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
214    rm -f score/include/rtems/score/cpuopts.h
215    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
216])
217
218AC_ENABLE_MULTILIB([Makefile],[..])
219
220# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
221AC_MSG_CHECKING([for assignable stdio])
222AC_COMPILE_IFELSE(
223  [AC_LANG_PROGRAM(
224    [#include <stdio.h>],
225    [stdin = fopen("/tmp", "r")])],
226  [HAVE_ASSIGNABLE_STDIO=yes],
227  [HAVE_ASSIGNABLE_STDIO=no])
228AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
229
230# libmisc/serdbg exploits weak symbols
231RTEMS_CHECK_GCC_WEAK
232
233AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes])
234AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes])
235
236# FIXME: These checks are only in here to provide
237# configuration-time diagnostics and are not really used.
238AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
239AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
240
241## BSD-ism, excluded from POSIX, but available on most platforms
242AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
243
244## Check if libc provides BSD's strlcpy/strlcat
245AC_CHECK_FUNCS(strlcpy strlcat)
246
247
248# ... far too many conditionals ...
249AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
250AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"])
251AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
252
253AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
254
255AM_CONDITIONAL(HAS_POSIX,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
256AM_CONDITIONAL(LIBITRON,test x"$rtems_cv_HAS_ITRON_API" = x"yes")
257AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
258
259AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"])
260AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"])
261
262AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
263AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
264
265AM_CONDITIONAL([LIBDOSFS],[dnl
266test x"${RTEMS_CPU}" != x"unix" \
267&& test x"$ac_cv_type_uint8_t" = xyes \
268&& test x"$ac_cv_type_uint16_t" = xyes])
269
270AC_CONFIG_HEADER(config.h)
271
272RTEMS_AMPOLISH3
273
274# Explicitly list all Makefiles here
275AC_CONFIG_FILES([
276Makefile
277rtems/Makefile
278sapi/Makefile
279score/Makefile
280score/cpu/Makefile
281score/cpu/arm/Makefile
282score/cpu/bfin/Makefile
283score/cpu/avr/Makefile
284score/cpu/c4x/Makefile
285score/cpu/h8300/Makefile
286score/cpu/i386/Makefile
287score/cpu/m68k/Makefile
288score/cpu/mips/Makefile
289score/cpu/nios2/Makefile
290score/cpu/powerpc/Makefile
291score/cpu/sh/Makefile
292score/cpu/sparc/Makefile
293score/cpu/unix/Makefile
294score/cpu/no_cpu/Makefile
295posix/Makefile
296itron/Makefile
297libblock/Makefile
298libfs/Makefile
299libcsupport/Makefile
300libnetworking/Makefile
301librpc/Makefile
302libmisc/Makefile
303libi2c/Makefile
304zlib/Makefile
305httpd/Makefile
306ftpd/Makefile
307telnetd/Makefile
308pppd/Makefile
309wrapup/Makefile])
310
311AC_CONFIG_COMMANDS([preinstall-stamp],
312[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
313[MAKE=${MAKE}
314with_multisubdir="$with_multisubdir"])
315
316AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.