source: rtems/cpukit/configure.ac @ 6a0898b

4.104.114.95
Last change on this file since 6a0898b was 7f5a245d, checked in by Ralf Corsepius <ralf.corsepius@…>, on 07/02/08 at 14:18:50

Add RTEMS_ADD

  • Property mode set to 100644
File size: 9.6 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([__RTEMS_STRICT_ORDER_MUTEX__],
225  [test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
226  [1],
227  [disable strict order mutex])
228
229## Deactivate ada bindings
230RTEMS_CPUOPT([__RTEMS_ADA__],
231  [test x"${enable_ada}" = x"yes"],
232  [1],
233  [Define to 1 if ada/gnat bindings are built-in])
234
235RTEMS_CPUOPT([__RTEMS_MAJOR__],
236  [true],
237  [$rtems_major],
238  [major version portion of an RTEMS release])
239
240RTEMS_CPUOPT([__RTEMS_MINOR__],
241  [true],
242  [$rtems_minor],
243  [minor version portion of an RTEMS release])
244
245RTEMS_CPUOPT([__RTEMS_REVISION__],
246  [true],
247  [$rtems_revision],
248  [revision version portion of an RTEMS release])
249
250_RTEMS_CPUOPT_FINI
251
252AC_ENABLE_MULTILIB([Makefile],[..])
253
254# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
255AC_MSG_CHECKING([for assignable stdio])
256AC_COMPILE_IFELSE(
257  [AC_LANG_PROGRAM(
258    [#include <stdio.h>],
259    [stdin = fopen("/tmp", "r")])],
260  [HAVE_ASSIGNABLE_STDIO=yes],
261  [HAVE_ASSIGNABLE_STDIO=no])
262AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
263
264# libmisc/serdbg exploits weak symbols
265RTEMS_CHECK_GCC_WEAK
266
267AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes])
268AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes])
269
270# FIXME: These checks are only in here to provide
271# configuration-time diagnostics and are not really used.
272AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
273AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
274
275## BSD-ism, excluded from POSIX, but available on most platforms
276AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
277
278## Check if libc provides BSD's strlcpy/strlcat
279AC_CHECK_FUNCS(strlcpy strlcat)
280
281
282# ... far too many conditionals ...
283AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
284AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"])
285AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
286
287AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
288
289AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
290AM_CONDITIONAL(LIBPOSIX,test x"${RTEMS_CPU}" != x"unix")
291AM_CONDITIONAL(LIBITRON,test x"$rtems_cv_HAS_ITRON_API" = x"yes")
292AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
293
294AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"])
295AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"])
296
297AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
298AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
299AM_CONDITIONAL([LIBGNAT],[test x"$rtems_cv_HAS_POSIX_API" = x"yes" \
300&& test x"$enable_ada" = x"yes"])
301
302AM_CONDITIONAL([LIBDOSFS],[dnl
303test x"${RTEMS_CPU}" != x"unix" \
304&& test x"$ac_cv_type_uint8_t" = xyes \
305&& test x"$ac_cv_type_uint16_t" = xyes])
306
307AC_CONFIG_HEADER(config.h)
308
309## These are needed by the NFS Client
310AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
311AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
312&& test -n "$AWK" \
313&& test "$enable_rpcgen" = yes])
314
315RTEMS_AMPOLISH3
316
317# Explicitly list all Makefiles here
318AC_CONFIG_FILES([
319Makefile
320rtems/Makefile
321sapi/Makefile
322score/Makefile
323score/cpu/Makefile
324score/cpu/arm/Makefile
325score/cpu/arm/thumb/Makefile
326score/cpu/bfin/Makefile
327score/cpu/avr/Makefile
328score/cpu/c4x/Makefile
329score/cpu/h8300/Makefile
330score/cpu/i386/Makefile
331score/cpu/m68k/Makefile
332score/cpu/mips/Makefile
333score/cpu/nios2/Makefile
334score/cpu/powerpc/Makefile
335score/cpu/sh/Makefile
336score/cpu/sparc/Makefile
337score/cpu/unix/Makefile
338score/cpu/no_cpu/Makefile
339posix/Makefile
340itron/Makefile
341libblock/Makefile
342libfs/Makefile
343libfs/src/nfsclient/Makefile
344libgnat/Makefile
345libcsupport/Makefile
346libnetworking/Makefile
347librpc/Makefile
348libmisc/Makefile
349libi2c/Makefile
350libmd/Makefile
351zlib/Makefile
352httpd/Makefile
353ftpd/Makefile
354telnetd/Makefile
355pppd/Makefile
356shttpd/Makefile
357wrapup/Makefile])
358
359AC_CONFIG_COMMANDS([preinstall-stamp],
360[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
361[MAKE=${MAKE}
362with_multisubdir="$with_multisubdir"])
363
364AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.