source: rtems/cpukit/configure.ac @ 52a634e9

4.104.115
Last change on this file since 52a634e9 was 52a634e9, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/17/08 at 06:39:14

2008-12-17 Ralf Corsépius <ralf.corsepius@…>

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