source: rtems/cpukit/configure.ac @ b2d67fd

4.104.115
Last change on this file since b2d67fd was f4cc6c5, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/24/08 at 16:37:05

Add AC_CHECK_FUNC's to check functions migrating into newlib.

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