source: rtems/cpukit/configure.ac @ 51405b9

Last change on this file since 51405b9 was 51405b9, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jan 27, 2007 at 7:27:41 AM

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