source: rtems/cpukit/configure.ac @ dc2a1750

4.104.114.84.9
Last change on this file since dc2a1750 was 9a673dba, checked in by Ralf Corsepius <ralf.corsepius@…>, on Feb 7, 2007 at 3:36:52 AM

2007-02-07 Ralf Corsépius <ralf.corsepius@…>

  • configure.ac: Check fo intmax_t, uintptr_t, intptr_t, pthread.h, pthread_rwlock_t, pthread_barrier_t, pthread_spinlock_t.
  • Property mode set to 100644
File size: 8.5 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([bcopy bcmp])
52AC_CHECK_FUNCS([isascii fileno])
53
54## Check if the installed toolchain has these headers
55AC_CHECK_HEADER([tar.h])
56
57## BSD-ism, should not be used in RTEMS,
58## nevertheless it still is.
59AC_CHECK_HEADER([sys/errno.h],[],
60  [AC_MSG_ERROR([Missing required header sys/errno.h])])
61
62## if libc provides stdint.h, use it.
63AS_IF([test x"${ac_cv_header_stdint_h}" = xyes],
64[RTEMS_USES_STDINT_H=yes],
65[RTEMS_USES_STDINT_H=no])
66
67## error out if libc doesn't at least provide inttypes.h
68AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
69[AC_MSG_ERROR([Required header inttypes.h not found])])
70
71AC_CHECK_TYPES([ uint8_t,  int8_t])
72AC_CHECK_TYPES([uint16_t, int16_t])
73AC_CHECK_TYPES([uint32_t, int32_t])
74AC_CHECK_TYPES([uint64_t, int64_t])
75AC_CHECK_TYPES([uintmax_t, intmax_t])
76AC_CHECK_TYPES([uintptr_t, intptr_t])
77
78# These are conditionally defined by the toolchain
79# FIXME: we should either conditionally compile those parts in
80# RTEMS depending on them, or abort - For now, simply check.
81AC_CHECK_HEADER([pthread.h],[
82  AC_CHECK_TYPES([pthread_rwlock_t])
83  AC_CHECK_TYPES([pthread_barrier_t])
84  AC_CHECK_TYPES([pthread_spinlock_t])
85])
86
87RTEMS_CHECK_MULTIPROCESSING
88RTEMS_CHECK_POSIX_API
89RTEMS_CHECK_ITRON_API
90RTEMS_CHECK_NETWORKING
91
92AS_IF([test x"${RTEMS_USE_NEWLIB}" = xyes],
93[RTEMS_USES_TAR_H=yes],
94[RTEMS_USES_TAR_H=$ac_cv_header_tar_h])
95
96AS_IF([test x"${RTEMS_CPU}" = x"unix"],[
97## FIXME: This check is doubtful
98AS_IF([test "$HAS_MP" = "yes"],
99  [RTEMS_CHECK_SYSV_UNIX])
100
101## The code fragment below had been used in tools/cpu/unix/gensize.c.
102## FIXME:
103## * The pad very likely is not necessary.
104AC_CHECK_SIZEOF([CPU_CONTEXT],[],[
105#include <stdio.h>
106#include <setjmp.h>
107
108typedef struct {
109  jmp_buf     regs;
110  int         isr_level;
111  int         pad[4]; /* just in case */
112} CPU_CONTEXT;
113])
114])
115
116rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
117rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
118rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
119
120cat >>cpuopts.tmp <<\_ACEOF
121/**
122 * @file rtems/score/cpuopts.h
123 */
124/* target cpu dependent options file */
125/* automatically generated -- DO NOT EDIT!! */
126#ifndef _RTEMS_SCORE_CPUOPTS_H
127#define _RTEMS_SCORE_CPUOPTS_H
128_ACEOF
129
130RTEMS_CPUOPT([RTEMS_DEBUG],
131  [test x"${enable_rtems_debug}" = x"yes"],
132  [1],
133  [if RTEMS_DEBUG is enabled])
134
135RTEMS_CPUOPT([RTEMS_ITRON_API],
136  [test x"$rtems_cv_HAS_ITRON_API" = x"yes"],
137  [1],
138  [if itron api is supported])
139
140RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
141  [test x"$enable_multiprocessing" = xyes],
142  [1],
143  [if multiprocessing is enabled])
144
145RTEMS_CPUOPT([RTEMS_NEWLIB],
146  [test x"$RTEMS_USE_NEWLIB" = xyes],
147  [1],
148  [if using newlib])
149
150RTEMS_CPUOPT([RTEMS_POSIX_API],
151  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
152  [1],
153  [if posix api is supported])
154
155RTEMS_CPUOPT([RTEMS_NETWORKING],
156  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
157  [1],
158  [if networking is enabled])
159
160RTEMS_CPUOPT([RTEMS_UNIX],
161  [test x"$RTEMS_CPU" = xunix],
162  [1],
163  [to indicate RTEMS unix])
164
165RTEMS_CPUOPT([RTEMS_UNIXLIB],
166  [test x"${enable_unixlib}" = xyes],
167  [1],
168  [to indicate RTEMS using RTEMS's unixlib])
169
170RTEMS_CPUOPT([RTEMS_USES_STDINT_H],
171  [test x"${RTEMS_USES_STDINT_H}" = x"yes"],
172  [1],
173  [if RTEMS uses stdint.h])
174
175RTEMS_CPUOPT([RTEMS_USES_TAR_H],
176  [test x"${RTEMS_USES_TAR_H}" = x"yes"],
177  [1],
178  [if RTEMS uses tar.h])
179
180RTEMS_CPUOPT([RTEMS_VERSION],
181  [true],
182  ["]_RTEMS_VERSION["],
183  [RTEMS version string])
184
185RTEMS_CPUOPT([SIZEOF_CPU_CONTEXT],
186  [test x"$RTEMS_CPU" = x"unix"],
187  [$ac_cv_sizeof_CPU_CONTEXT],
188  [The size of a 'CPU_CONTEXT', as computed by sizeof])
189
190RTEMS_CPUOPT([__RTEMS_MAJOR__],
191  [true],
192  [$rtems_major],
193  [major version portion of an RTEMS release])
194
195RTEMS_CPUOPT([__RTEMS_MINOR__],
196  [true],
197  [$rtems_minor],
198  [minor version portion of an RTEMS release])
199
200RTEMS_CPUOPT([__RTEMS_REVISION__],
201  [true],
202  [$rtems_revision],
203  [revision version portion of an RTEMS release])
204
205cat >>cpuopts.tmp <<\_ACEOF
206
207#endif /* _RTEMS_SCORE_CPUOPTS_H */
208_ACEOF
209
210AS_MKDIR_P(score/include/rtems/score)
211AS_IF([test -f score/include/rtems/score/cpuopts.h],
212[
213  AS_IF([cmp -s score/include/rtems/score/cpuopts.h cpuopts.tmp 2>/dev/null],
214  [
215    AC_MSG_NOTICE([score/include/rtems/score/cpuopts.h is unchanged])
216    rm -f cpuopts.tmp
217  ],[
218    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
219    rm -f score/include/rtems/score/cpuopts.h
220    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
221  ])
222],[
223    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
224    rm -f score/include/rtems/score/cpuopts.h
225    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
226])
227
228AC_ENABLE_MULTILIB([Makefile],[..])
229
230# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
231AC_MSG_CHECKING([for assignable stdio])
232AC_COMPILE_IFELSE(
233  [AC_LANG_PROGRAM(
234    [#include <stdio.h>],
235    [stdin = fopen("/tmp", "r")])],
236  [HAVE_ASSIGNABLE_STDIO=yes],
237  [HAVE_ASSIGNABLE_STDIO=no])
238AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
239
240# libmisc/serdbg exploits weak symbols
241RTEMS_CHECK_GCC_WEAK
242
243AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes])
244AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes])
245
246# FIXME: These checks are only in here to provide
247# configuration-time diagnostics and are not really used.
248AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
249AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
250
251## BSD-ism, excluded from POSIX, but available on most platforms
252AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
253
254## Check if libc provides BSD's strlcpy/strlcat
255AC_CHECK_FUNCS(strlcpy strlcat)
256
257
258# ... far too many conditionals ...
259AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
260AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"])
261AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
262
263AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
264
265AM_CONDITIONAL(HAS_POSIX,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
266AM_CONDITIONAL(LIBITRON,test x"$rtems_cv_HAS_ITRON_API" = x"yes")
267AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
268
269AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"])
270AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"])
271
272AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
273AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
274
275AM_CONDITIONAL([LIBDOSFS],[dnl
276test x"${RTEMS_CPU}" != x"unix" \
277&& test x"$ac_cv_type_uint8_t" = xyes \
278&& test x"$ac_cv_type_uint16_t" = xyes])
279
280AC_CONFIG_HEADER(config.h)
281
282RTEMS_AMPOLISH3
283
284# Explicitly list all Makefiles here
285AC_CONFIG_FILES([
286Makefile
287rtems/Makefile
288sapi/Makefile
289score/Makefile
290score/cpu/Makefile
291score/cpu/arm/Makefile
292score/cpu/bfin/Makefile
293score/cpu/avr/Makefile
294score/cpu/c4x/Makefile
295score/cpu/h8300/Makefile
296score/cpu/i386/Makefile
297score/cpu/m68k/Makefile
298score/cpu/mips/Makefile
299score/cpu/nios2/Makefile
300score/cpu/powerpc/Makefile
301score/cpu/sh/Makefile
302score/cpu/sparc/Makefile
303score/cpu/unix/Makefile
304score/cpu/no_cpu/Makefile
305posix/Makefile
306itron/Makefile
307libblock/Makefile
308libfs/Makefile
309libcsupport/Makefile
310libnetworking/Makefile
311librpc/Makefile
312libmisc/Makefile
313libi2c/Makefile
314zlib/Makefile
315httpd/Makefile
316ftpd/Makefile
317telnetd/Makefile
318pppd/Makefile
319wrapup/Makefile])
320
321AC_CONFIG_COMMANDS([preinstall-stamp],
322[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
323[MAKE=${MAKE}
324with_multisubdir="$with_multisubdir"])
325
326AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.