source: rtems/cpukit/configure.ac @ 29ab6a0

4.104.114.95
Last change on this file since 29ab6a0 was a5de1ef, checked in by Chris Johns <chrisj@…>, on 01/05/08 at 06:57:17

2008-01-05 Chris Johns <chrisj@…>

  • configure.ac: Fix typo in the strict order mutex CPU OPTs test.
  • libmisc/shell/shell.c: Handle '#' comment characters correctly.
  • libblock/include/rtems/flashdisk.h: Add docmentation about the control fields. Add more control fields to handle the flash when full.
  • libblock/src/flashdisk.c: Fix the descriptor erase test so it detects a descriptor is erased. Add support for unavailable blocks the user can configure. Print the used list as a diag. Fix the bug when a page is detected as failed and present on more than one queue. Add a count to the queues so queue length can be used to manage compaction.
  • Property mode set to 100644
File size: 10.0 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
139cat >>cpuopts.tmp <<\_ACEOF
140/**
141 * @file rtems/score/cpuopts.h
142 */
143/* target cpu dependent options file */
144/* automatically generated -- DO NOT EDIT!! */
145#ifndef _RTEMS_SCORE_CPUOPTS_H
146#define _RTEMS_SCORE_CPUOPTS_H
147_ACEOF
148
149RTEMS_CPUOPT([RTEMS_DEBUG],
150  [test x"${enable_rtems_debug}" = x"yes"],
151  [1],
152  [if RTEMS_DEBUG is enabled])
153
154RTEMS_CPUOPT([RTEMS_ITRON_API],
155  [test x"$rtems_cv_HAS_ITRON_API" = x"yes"],
156  [1],
157  [if itron api is supported])
158
159RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
160  [test x"$enable_multiprocessing" = xyes],
161  [1],
162  [if multiprocessing is enabled])
163
164RTEMS_CPUOPT([RTEMS_NEWLIB],
165  [test x"$RTEMS_USE_NEWLIB" = xyes],
166  [1],
167  [if using newlib])
168
169RTEMS_CPUOPT([RTEMS_POSIX_API],
170  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
171  [1],
172  [if posix api is supported])
173
174RTEMS_CPUOPT([RTEMS_NETWORKING],
175  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
176  [1],
177  [if networking is enabled])
178
179RTEMS_CPUOPT([RTEMS_UNIX],
180  [test x"$RTEMS_CPU" = xunix],
181  [1],
182  [to indicate RTEMS unix])
183
184RTEMS_CPUOPT([RTEMS_UNIXLIB],
185  [test x"${enable_unixlib}" = xyes],
186  [1],
187  [to indicate RTEMS using RTEMS's unixlib])
188
189RTEMS_CPUOPT([RTEMS_USES_STDINT_H],
190  [test x"${RTEMS_USES_STDINT_H}" = x"yes"],
191  [1],
192  [if RTEMS uses stdint.h])
193
194RTEMS_CPUOPT([RTEMS_USES_TAR_H],
195  [test x"${RTEMS_USES_TAR_H}" = x"yes"],
196  [1],
197  [if RTEMS uses tar.h])
198
199RTEMS_CPUOPT([RTEMS_VERSION],
200  [true],
201  ["]_RTEMS_VERSION["],
202  [RTEMS version string])
203
204RTEMS_CPUOPT([SIZEOF_CPU_CONTEXT],
205  [test x"$RTEMS_CPU" = x"unix"],
206  [$ac_cv_sizeof_CPU_CONTEXT],
207  [The size of a 'CPU_CONTEXT', as computed by sizeof])
208
209RTEMS_CPUOPT([__RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__],
210  [test x"${USE_TICKS_FOR_CPU_USAGE_STATISTICS}" = x"1"],
211  [1],
212  [disable nanosecond granularity for cpu usage statistics]
213)
214
215RTEMS_CPUOPT([__RTEMS_USE_TICKS_RATE_MONOTONIC_STATISTICS__],
216  [test x"${USE_TICKS_FOR_RATE_MONOTONIC_STATISTICS}" = x"1"],
217  [1],
218  [disable nanosecond granularity for period statistics]
219)
220
221## This improves both the size and coverage analysis.
222RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
223  [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
224  [1],
225  [disable inlining _Thread_Enable_dispatch]
226)
227
228## This improves both the size and coverage analysis.
229RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__],
230  [test x"${RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE}" = x"1"],
231  [1],
232  [disable inlining _Thread_Enable_dispatch]
233)
234
235## This gives the same behavior as 4.8 and older
236RTEMS_CPUOPT([__STRICT_ORDER_MUTEX__],
237  [test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
238  [1],
239  [disable strict order mutex]
240)
241
242RTEMS_CPUOPT([__RTEMS_MAJOR__],
243  [true],
244  [$rtems_major],
245  [major version portion of an RTEMS release])
246
247RTEMS_CPUOPT([__RTEMS_MINOR__],
248  [true],
249  [$rtems_minor],
250  [minor version portion of an RTEMS release])
251
252RTEMS_CPUOPT([__RTEMS_REVISION__],
253  [true],
254  [$rtems_revision],
255  [revision version portion of an RTEMS release])
256
257cat >>cpuopts.tmp <<\_ACEOF
258
259#endif /* _RTEMS_SCORE_CPUOPTS_H */
260_ACEOF
261
262AS_MKDIR_P(score/include/rtems/score)
263AS_IF([test -f score/include/rtems/score/cpuopts.h],
264[
265  AS_IF([cmp -s score/include/rtems/score/cpuopts.h cpuopts.tmp 2>/dev/null],
266  [
267    AC_MSG_NOTICE([score/include/rtems/score/cpuopts.h is unchanged])
268    rm -f cpuopts.tmp
269  ],[
270    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
271    rm -f score/include/rtems/score/cpuopts.h
272    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
273  ])
274],[
275    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
276    rm -f score/include/rtems/score/cpuopts.h
277    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
278])
279
280AC_ENABLE_MULTILIB([Makefile],[..])
281
282# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
283AC_MSG_CHECKING([for assignable stdio])
284AC_COMPILE_IFELSE(
285  [AC_LANG_PROGRAM(
286    [#include <stdio.h>],
287    [stdin = fopen("/tmp", "r")])],
288  [HAVE_ASSIGNABLE_STDIO=yes],
289  [HAVE_ASSIGNABLE_STDIO=no])
290AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
291
292# libmisc/serdbg exploits weak symbols
293RTEMS_CHECK_GCC_WEAK
294
295AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes])
296AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes])
297
298# FIXME: These checks are only in here to provide
299# configuration-time diagnostics and are not really used.
300AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
301AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
302
303## BSD-ism, excluded from POSIX, but available on most platforms
304AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
305
306## Check if libc provides BSD's strlcpy/strlcat
307AC_CHECK_FUNCS(strlcpy strlcat)
308
309
310# ... far too many conditionals ...
311AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
312AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"])
313AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
314
315AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
316
317AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
318AM_CONDITIONAL(LIBPOSIX,test x"${RTEMS_CPU}" != x"unix")
319AM_CONDITIONAL(LIBITRON,test x"$rtems_cv_HAS_ITRON_API" = x"yes")
320AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
321
322AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"])
323AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"])
324
325AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
326AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
327
328AM_CONDITIONAL([LIBDOSFS],[dnl
329test x"${RTEMS_CPU}" != x"unix" \
330&& test x"$ac_cv_type_uint8_t" = xyes \
331&& test x"$ac_cv_type_uint16_t" = xyes])
332
333AC_CONFIG_HEADER(config.h)
334
335RTEMS_AMPOLISH3
336
337# Explicitly list all Makefiles here
338AC_CONFIG_FILES([
339Makefile
340rtems/Makefile
341sapi/Makefile
342score/Makefile
343score/cpu/Makefile
344score/cpu/arm/Makefile
345score/cpu/arm/thumb/Makefile
346score/cpu/bfin/Makefile
347score/cpu/avr/Makefile
348score/cpu/c4x/Makefile
349score/cpu/h8300/Makefile
350score/cpu/i386/Makefile
351score/cpu/m68k/Makefile
352score/cpu/mips/Makefile
353score/cpu/nios2/Makefile
354score/cpu/powerpc/Makefile
355score/cpu/sh/Makefile
356score/cpu/sparc/Makefile
357score/cpu/unix/Makefile
358score/cpu/no_cpu/Makefile
359posix/Makefile
360itron/Makefile
361libblock/Makefile
362libfs/Makefile
363libgnat/Makefile
364libcsupport/Makefile
365libnetworking/Makefile
366librpc/Makefile
367libmisc/Makefile
368libi2c/Makefile
369libmd/Makefile
370zlib/Makefile
371httpd/Makefile
372ftpd/Makefile
373telnetd/Makefile
374pppd/Makefile
375shttpd/Makefile
376wrapup/Makefile])
377
378AC_CONFIG_COMMANDS([preinstall-stamp],
379[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
380[MAKE=${MAKE}
381with_multisubdir="$with_multisubdir"])
382
383AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.