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

4.104.115
Last change on this file since 6e73ca2a was 6e73ca2a, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/30/08 at 05:20:54

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

  • configure.ac: Require <errno.h>. Cleanup comments. Remove check for <sys/errno.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_HEADERS([tar.h errno.h])
70
71## error out if libc doesn't provide stdint.h
72AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
73[AC_MSG_ERROR([Required header stdint.h not found])])
74
75## error out if libc doesn't provide inttypes.h
76AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
77[AC_MSG_ERROR([Required header inttypes.h not found])])
78
79## error out if libc doesn't provide errno.h
80AS_IF([test x"${ac_cv_header_errno_h}" != xyes],
81[AC_MSG_ERROR([Required header errno.h not found])])
82
83AC_HEADER_STDBOOL
84AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
85[AC_MSG_ERROR([No sufficient stdbool.h found])])
86
87AC_CHECK_TYPES([ uint8_t,  int8_t])
88AC_CHECK_TYPES([uint16_t, int16_t])
89AC_CHECK_TYPES([uint32_t, int32_t])
90AC_CHECK_TYPES([uint64_t, int64_t])
91AC_CHECK_TYPES([uintmax_t, intmax_t])
92AC_CHECK_TYPES([uintptr_t, intptr_t])
93
94AC_CACHE_CHECK([if PRIxPTR works],
95[rtems_cv_PRIxPTR],[
96  AS_IF([test x"$GCC" = xyes],[
97    save_CFLAGS=$CFLAGS
98    CFLAGS=-Werror])
99
100  AC_COMPILE_IFELSE([
101    AC_LANG_PROGRAM([
102      #include <inttypes.h>
103      #include <stdio.h>
104    ],[
105      void *ptr;
106      printf("%" PRIxPTR "\n", (intptr_t) ptr);
107    ])],
108    [rtems_cv_PRIxPTR=yes],
109    [rtems_cv_PRIxPTR=no])
110
111  AS_IF([test x"$GCC" = xyes],[
112    CFLAGS=$save_CFLAGS])
113])
114
115# These are conditionally defined by the toolchain
116# FIXME: we should either conditionally compile those parts in
117# RTEMS depending on them, or abort - For now, simply check.
118AC_CHECK_HEADER([pthread.h],[
119  AC_CHECK_TYPES([pthread_rwlock_t])
120  AC_CHECK_TYPES([pthread_barrier_t])
121  AC_CHECK_TYPES([pthread_spinlock_t])
122])
123
124RTEMS_CHECK_MULTIPROCESSING
125RTEMS_CHECK_POSIX_API
126RTEMS_CHECK_ITRON_API
127RTEMS_CHECK_NETWORKING
128
129AS_IF([test x"${RTEMS_USE_NEWLIB}" = xyes],
130[RTEMS_USES_TAR_H=yes],
131[RTEMS_USES_TAR_H=$ac_cv_header_tar_h])
132
133AS_IF([test x"${RTEMS_CPU}" = x"unix"],[
134## FIXME: This check is doubtful
135AS_IF([test "$HAS_MP" = "yes"],
136  [RTEMS_CHECK_SYSV_UNIX])
137
138## The code fragment below had been used in tools/cpu/unix/gensize.c.
139AC_CHECK_SIZEOF([CPU_CONTEXT],[],[
140#include <stdio.h>
141#include <setjmp.h>
142
143typedef struct {
144  jmp_buf     regs;
145  int         isr_level;
146} CPU_CONTEXT;
147])
148])
149
150rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
151rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
152rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
153
154_RTEMS_CPUOPT_INIT
155
156RTEMS_CPUOPT([RTEMS_DEBUG],
157  [test x"${enable_rtems_debug}" = x"yes"],
158  [1],
159  [if RTEMS_DEBUG is enabled])
160
161RTEMS_CPUOPT([RTEMS_ITRON_API],
162  [test x"$rtems_cv_HAS_ITRON_API" = x"yes"],
163  [1],
164  [if itron api is supported])
165
166RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
167  [test x"$enable_multiprocessing" = xyes],
168  [1],
169  [if multiprocessing is enabled])
170
171RTEMS_CPUOPT([RTEMS_NEWLIB],
172  [test x"$RTEMS_USE_NEWLIB" = xyes],
173  [1],
174  [if using newlib])
175
176RTEMS_CPUOPT([RTEMS_POSIX_API],
177  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
178  [1],
179  [if posix api is supported])
180
181RTEMS_CPUOPT([RTEMS_NETWORKING],
182  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
183  [1],
184  [if networking is enabled])
185
186RTEMS_CPUOPT([RTEMS_UNIX],
187  [test x"$RTEMS_CPU" = xunix],
188  [1],
189  [to indicate RTEMS unix])
190
191RTEMS_CPUOPT([RTEMS_UNIXLIB],
192  [test x"${enable_unixlib}" = xyes],
193  [1],
194  [to indicate RTEMS using RTEMS's unixlib])
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/lm32/Makefile
342score/cpu/m68k/Makefile
343score/cpu/m32c/Makefile
344score/cpu/m32r/Makefile
345score/cpu/mips/Makefile
346score/cpu/nios2/Makefile
347score/cpu/powerpc/Makefile
348score/cpu/sh/Makefile
349score/cpu/sparc/Makefile
350score/cpu/unix/Makefile
351score/cpu/no_cpu/Makefile
352posix/Makefile
353itron/Makefile
354libblock/Makefile
355libfs/Makefile
356libfs/src/nfsclient/Makefile
357libgnat/Makefile
358libcsupport/Makefile
359libnetworking/Makefile
360librpc/Makefile
361libmisc/Makefile
362libi2c/Makefile
363libmd/Makefile
364zlib/Makefile
365httpd/Makefile
366ftpd/Makefile
367telnetd/Makefile
368pppd/Makefile
369shttpd/Makefile
370wrapup/Makefile])
371
372AC_CONFIG_COMMANDS([preinstall-stamp],
373[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
374[MAKE=${MAKE}
375with_multisubdir="$with_multisubdir"])
376
377AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.