source: rtems/cpukit/configure.ac @ b4dca71

4.104.114.95
Last change on this file since b4dca71 was b4dca71, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jun 30, 2008 at 1:20:48 PM

Apply _RTEMS_CPU_INIT, _RTEMS_CPUOPT_FINI.
Cleanup mal-formated RTEMS_CPUOPTs.

  • Property mode set to 100644
File size: 9.9 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id$
4
5AC_PREREQ(2.61)
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([strdup strndup strncasecmp])
52AC_CHECK_FUNCS([bcopy bcmp])
53AC_CHECK_FUNCS([isascii fileno])
54
55## Check if the installed toolchain has these headers
56AC_CHECK_HEADER([tar.h])
57
58## BSD-ism, should not be used in RTEMS,
59## nevertheless it still is.
60AC_CHECK_HEADER([sys/errno.h],[],
61  [AC_MSG_ERROR([Missing required header sys/errno.h])])
62
63## if libc provides stdint.h, use it.
64AS_IF([test x"${ac_cv_header_stdint_h}" = xyes],
65[RTEMS_USES_STDINT_H=yes],
66[RTEMS_USES_STDINT_H=no])
67
68## error out if libc doesn't at least provide inttypes.h
69AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
70[AC_MSG_ERROR([Required header inttypes.h not found])])
71
72AC_CHECK_TYPES([ uint8_t,  int8_t])
73AC_CHECK_TYPES([uint16_t, int16_t])
74AC_CHECK_TYPES([uint32_t, int32_t])
75AC_CHECK_TYPES([uint64_t, int64_t])
76AC_CHECK_TYPES([uintmax_t, intmax_t])
77AC_CHECK_TYPES([uintptr_t, intptr_t])
78
79AC_CACHE_CHECK([if PRIxPTR works],
80[rtems_cv_PRIxPTR],[
81  AS_IF([test x"$GCC" = xyes],[
82    save_CFLAGS=$CFLAGS
83    CFLAGS=-Werror])
84
85  AC_COMPILE_IFELSE([
86    AC_LANG_PROGRAM([
87      #include <inttypes.h>
88      #include <stdio.h>
89    ],[
90      void *ptr;
91      printf("%" PRIxPTR "\n", (intptr_t) ptr);
92    ])],
93    [rtems_cv_PRIxPTR=yes],
94    [rtems_cv_PRIxPTR=no])
95
96  AS_IF([test x"$GCC" = xyes],[
97    CFLAGS=$save_CFLAGS])
98])
99
100# These are conditionally defined by the toolchain
101# FIXME: we should either conditionally compile those parts in
102# RTEMS depending on them, or abort - For now, simply check.
103AC_CHECK_HEADER([pthread.h],[
104  AC_CHECK_TYPES([pthread_rwlock_t])
105  AC_CHECK_TYPES([pthread_barrier_t])
106  AC_CHECK_TYPES([pthread_spinlock_t])
107])
108
109RTEMS_CHECK_MULTIPROCESSING
110RTEMS_CHECK_POSIX_API
111RTEMS_CHECK_ITRON_API
112RTEMS_CHECK_NETWORKING
113
114AS_IF([test x"${RTEMS_USE_NEWLIB}" = xyes],
115[RTEMS_USES_TAR_H=yes],
116[RTEMS_USES_TAR_H=$ac_cv_header_tar_h])
117
118AS_IF([test x"${RTEMS_CPU}" = x"unix"],[
119## FIXME: This check is doubtful
120AS_IF([test "$HAS_MP" = "yes"],
121  [RTEMS_CHECK_SYSV_UNIX])
122
123## The code fragment below had been used in tools/cpu/unix/gensize.c.
124AC_CHECK_SIZEOF([CPU_CONTEXT],[],[
125#include <stdio.h>
126#include <setjmp.h>
127
128typedef struct {
129  jmp_buf     regs;
130  int         isr_level;
131} CPU_CONTEXT;
132])
133])
134
135rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
136rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
137rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
138
139_RTEMS_CPUOPT_INIT
140
141RTEMS_CPUOPT([RTEMS_DEBUG],
142  [test x"${enable_rtems_debug}" = x"yes"],
143  [1],
144  [if RTEMS_DEBUG is enabled])
145
146RTEMS_CPUOPT([RTEMS_ITRON_API],
147  [test x"$rtems_cv_HAS_ITRON_API" = x"yes"],
148  [1],
149  [if itron api is supported])
150
151RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
152  [test x"$enable_multiprocessing" = xyes],
153  [1],
154  [if multiprocessing is enabled])
155
156RTEMS_CPUOPT([RTEMS_NEWLIB],
157  [test x"$RTEMS_USE_NEWLIB" = xyes],
158  [1],
159  [if using newlib])
160
161RTEMS_CPUOPT([RTEMS_POSIX_API],
162  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
163  [1],
164  [if posix api is supported])
165
166RTEMS_CPUOPT([RTEMS_NETWORKING],
167  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
168  [1],
169  [if networking is enabled])
170
171RTEMS_CPUOPT([RTEMS_UNIX],
172  [test x"$RTEMS_CPU" = xunix],
173  [1],
174  [to indicate RTEMS unix])
175
176RTEMS_CPUOPT([RTEMS_UNIXLIB],
177  [test x"${enable_unixlib}" = xyes],
178  [1],
179  [to indicate RTEMS using RTEMS's unixlib])
180
181RTEMS_CPUOPT([RTEMS_USES_STDINT_H],
182  [test x"${RTEMS_USES_STDINT_H}" = x"yes"],
183  [1],
184  [if RTEMS uses stdint.h])
185
186RTEMS_CPUOPT([RTEMS_USES_TAR_H],
187  [test x"${RTEMS_USES_TAR_H}" = x"yes"],
188  [1],
189  [if RTEMS uses tar.h])
190
191RTEMS_CPUOPT([RTEMS_VERSION],
192  [true],
193  ["]_RTEMS_VERSION["],
194  [RTEMS version string])
195
196RTEMS_CPUOPT([SIZEOF_CPU_CONTEXT],
197  [test x"$RTEMS_CPU" = x"unix"],
198  [$ac_cv_sizeof_CPU_CONTEXT],
199  [The size of a 'CPU_CONTEXT', as computed by sizeof])
200
201RTEMS_CPUOPT([__RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__],
202  [test x"${USE_TICKS_FOR_CPU_USAGE_STATISTICS}" = x"1"],
203  [1],
204  [disable nanosecond granularity for cpu usage statistics])
205
206RTEMS_CPUOPT([__RTEMS_USE_TICKS_RATE_MONOTONIC_STATISTICS__],
207  [test x"${USE_TICKS_FOR_RATE_MONOTONIC_STATISTICS}" = x"1"],
208  [1],
209  [disable nanosecond granularity for period statistics])
210
211## This improves both the size and coverage analysis.
212RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
213  [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
214  [1],
215  [disable inlining _Thread_Enable_dispatch])
216
217## This improves both the size and coverage analysis.
218RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__],
219  [test x"${RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE}" = x"1"],
220  [1],
221  [disable inlining _Thread_Enable_dispatch])
222
223## This gives the same behavior as 4.8 and older
224RTEMS_CPUOPT([__STRICT_ORDER_MUTEX__],
225  [test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
226  [1],
227  [disable strict order mutex])
228
229RTEMS_CPUOPT([__RTEMS_MAJOR__],
230  [true],
231  [$rtems_major],
232  [major version portion of an RTEMS release])
233
234RTEMS_CPUOPT([__RTEMS_MINOR__],
235  [true],
236  [$rtems_minor],
237  [minor version portion of an RTEMS release])
238
239RTEMS_CPUOPT([__RTEMS_REVISION__],
240  [true],
241  [$rtems_revision],
242  [revision version portion of an RTEMS release])
243
244_RTEMS_CPUOPT_FINI
245
246AS_MKDIR_P(score/include/rtems/score)
247AS_IF([test -f score/include/rtems/score/cpuopts.h],
248[
249  AS_IF([cmp -s score/include/rtems/score/cpuopts.h cpuopts.tmp 2>/dev/null],
250  [
251    AC_MSG_NOTICE([score/include/rtems/score/cpuopts.h is unchanged])
252    rm -f cpuopts.tmp
253  ],[
254    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
255    rm -f score/include/rtems/score/cpuopts.h
256    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
257  ])
258],[
259    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
260    rm -f score/include/rtems/score/cpuopts.h
261    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
262])
263
264AC_ENABLE_MULTILIB([Makefile],[..])
265
266# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
267AC_MSG_CHECKING([for assignable stdio])
268AC_COMPILE_IFELSE(
269  [AC_LANG_PROGRAM(
270    [#include <stdio.h>],
271    [stdin = fopen("/tmp", "r")])],
272  [HAVE_ASSIGNABLE_STDIO=yes],
273  [HAVE_ASSIGNABLE_STDIO=no])
274AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
275
276# libmisc/serdbg exploits weak symbols
277RTEMS_CHECK_GCC_WEAK
278
279AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes])
280AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes])
281
282# FIXME: These checks are only in here to provide
283# configuration-time diagnostics and are not really used.
284AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
285AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
286
287## BSD-ism, excluded from POSIX, but available on most platforms
288AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
289
290## Check if libc provides BSD's strlcpy/strlcat
291AC_CHECK_FUNCS(strlcpy strlcat)
292
293
294# ... far too many conditionals ...
295AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
296AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"])
297AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
298
299AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
300
301AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
302AM_CONDITIONAL(LIBPOSIX,test x"${RTEMS_CPU}" != x"unix")
303AM_CONDITIONAL(LIBITRON,test x"$rtems_cv_HAS_ITRON_API" = x"yes")
304AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
305
306AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"])
307AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"])
308
309AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
310AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
311
312AM_CONDITIONAL([LIBDOSFS],[dnl
313test x"${RTEMS_CPU}" != x"unix" \
314&& test x"$ac_cv_type_uint8_t" = xyes \
315&& test x"$ac_cv_type_uint16_t" = xyes])
316
317AC_CONFIG_HEADER(config.h)
318
319## These are needed by the NFS Client
320AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
321AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
322&& test -n "$AWK" \
323&& test "$enable_rpcgen" = yes])
324
325RTEMS_AMPOLISH3
326
327# Explicitly list all Makefiles here
328AC_CONFIG_FILES([
329Makefile
330rtems/Makefile
331sapi/Makefile
332score/Makefile
333score/cpu/Makefile
334score/cpu/arm/Makefile
335score/cpu/arm/thumb/Makefile
336score/cpu/bfin/Makefile
337score/cpu/avr/Makefile
338score/cpu/c4x/Makefile
339score/cpu/h8300/Makefile
340score/cpu/i386/Makefile
341score/cpu/m68k/Makefile
342score/cpu/mips/Makefile
343score/cpu/nios2/Makefile
344score/cpu/powerpc/Makefile
345score/cpu/sh/Makefile
346score/cpu/sparc/Makefile
347score/cpu/unix/Makefile
348score/cpu/no_cpu/Makefile
349posix/Makefile
350itron/Makefile
351libblock/Makefile
352libfs/Makefile
353libfs/src/nfsclient/Makefile
354libgnat/Makefile
355libcsupport/Makefile
356libnetworking/Makefile
357librpc/Makefile
358libmisc/Makefile
359libi2c/Makefile
360libmd/Makefile
361zlib/Makefile
362httpd/Makefile
363ftpd/Makefile
364telnetd/Makefile
365pppd/Makefile
366shttpd/Makefile
367wrapup/Makefile])
368
369AC_CONFIG_COMMANDS([preinstall-stamp],
370[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
371[MAKE=${MAKE}
372with_multisubdir="$with_multisubdir"])
373
374AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.