source: rtems/cpukit/configure.ac @ 1a9aa7e

4.104.114.84.95
Last change on this file since 1a9aa7e was 161016b, checked in by Ralf Corsepius <ralf.corsepius@…>, on 05/08/07 at 10:46:30

2007-05-08 Ralf Corsépius <ralf.corsepius@…>

  • configure.ac: Check for working PRIxPTR.
  • Property mode set to 100644
File size: 9.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([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
78AC_CACHE_CHECK([if PRIxPTR works],
79[rtems_cv_PRIxPTR],[
80  AS_IF([test x"$GCC" = xyes],[
81    save_CFLAGS=$CFLAGS
82    CFLAGS=-Werror])
83
84  AC_COMPILE_IFELSE([
85    AC_LANG_PROGRAM([
86      #include <inttypes.h>
87      #include <stdio.h>
88    ],[
89      void *ptr;
90      printf("%" PRIxPTR "\n", (intptr_t) ptr);
91    ])],
92    [rtems_cv_PRIxPTR=yes],
93    [rtems_cv_PRIxPTR=no])
94
95  AS_IF([test x"$GCC" = xyes],[
96    CFLAGS=$save_CFLAGS])
97])
98
99# These are conditionally defined by the toolchain
100# FIXME: we should either conditionally compile those parts in
101# RTEMS depending on them, or abort - For now, simply check.
102AC_CHECK_HEADER([pthread.h],[
103  AC_CHECK_TYPES([pthread_rwlock_t])
104  AC_CHECK_TYPES([pthread_barrier_t])
105  AC_CHECK_TYPES([pthread_spinlock_t])
106])
107
108RTEMS_CHECK_MULTIPROCESSING
109RTEMS_CHECK_POSIX_API
110RTEMS_CHECK_ITRON_API
111RTEMS_CHECK_NETWORKING
112
113AS_IF([test x"${RTEMS_USE_NEWLIB}" = xyes],
114[RTEMS_USES_TAR_H=yes],
115[RTEMS_USES_TAR_H=$ac_cv_header_tar_h])
116
117AS_IF([test x"${RTEMS_CPU}" = x"unix"],[
118## FIXME: This check is doubtful
119AS_IF([test "$HAS_MP" = "yes"],
120  [RTEMS_CHECK_SYSV_UNIX])
121
122## The code fragment below had been used in tools/cpu/unix/gensize.c.
123## FIXME:
124## * The pad very likely is not necessary.
125AC_CHECK_SIZEOF([CPU_CONTEXT],[],[
126#include <stdio.h>
127#include <setjmp.h>
128
129typedef struct {
130  jmp_buf     regs;
131  int         isr_level;
132  int         pad[4]; /* just in case */
133} CPU_CONTEXT;
134])
135])
136
137rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
138rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
139rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
140
141cat >>cpuopts.tmp <<\_ACEOF
142/**
143 * @file rtems/score/cpuopts.h
144 */
145/* target cpu dependent options file */
146/* automatically generated -- DO NOT EDIT!! */
147#ifndef _RTEMS_SCORE_CPUOPTS_H
148#define _RTEMS_SCORE_CPUOPTS_H
149_ACEOF
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_MAJOR__],
212  [true],
213  [$rtems_major],
214  [major version portion of an RTEMS release])
215
216RTEMS_CPUOPT([__RTEMS_MINOR__],
217  [true],
218  [$rtems_minor],
219  [minor version portion of an RTEMS release])
220
221RTEMS_CPUOPT([__RTEMS_REVISION__],
222  [true],
223  [$rtems_revision],
224  [revision version portion of an RTEMS release])
225
226cat >>cpuopts.tmp <<\_ACEOF
227
228#endif /* _RTEMS_SCORE_CPUOPTS_H */
229_ACEOF
230
231AS_MKDIR_P(score/include/rtems/score)
232AS_IF([test -f score/include/rtems/score/cpuopts.h],
233[
234  AS_IF([cmp -s score/include/rtems/score/cpuopts.h cpuopts.tmp 2>/dev/null],
235  [
236    AC_MSG_NOTICE([score/include/rtems/score/cpuopts.h is unchanged])
237    rm -f cpuopts.tmp
238  ],[
239    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
240    rm -f score/include/rtems/score/cpuopts.h
241    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
242  ])
243],[
244    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
245    rm -f score/include/rtems/score/cpuopts.h
246    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
247])
248
249AC_ENABLE_MULTILIB([Makefile],[..])
250
251# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
252AC_MSG_CHECKING([for assignable stdio])
253AC_COMPILE_IFELSE(
254  [AC_LANG_PROGRAM(
255    [#include <stdio.h>],
256    [stdin = fopen("/tmp", "r")])],
257  [HAVE_ASSIGNABLE_STDIO=yes],
258  [HAVE_ASSIGNABLE_STDIO=no])
259AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
260
261# libmisc/serdbg exploits weak symbols
262RTEMS_CHECK_GCC_WEAK
263
264AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes])
265AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes])
266
267# FIXME: These checks are only in here to provide
268# configuration-time diagnostics and are not really used.
269AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
270AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
271
272## BSD-ism, excluded from POSIX, but available on most platforms
273AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
274
275## Check if libc provides BSD's strlcpy/strlcat
276AC_CHECK_FUNCS(strlcpy strlcat)
277
278
279# ... far too many conditionals ...
280AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
281AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"])
282AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
283
284AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
285
286AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
287AM_CONDITIONAL(LIBPOSIX,test x"${RTEMS_CPU}" != x"unix")
288AM_CONDITIONAL(LIBITRON,test x"$rtems_cv_HAS_ITRON_API" = x"yes")
289AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
290
291AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"])
292AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"])
293
294AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
295AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
296
297AM_CONDITIONAL([LIBDOSFS],[dnl
298test x"${RTEMS_CPU}" != x"unix" \
299&& test x"$ac_cv_type_uint8_t" = xyes \
300&& test x"$ac_cv_type_uint16_t" = xyes])
301
302AC_CONFIG_HEADER(config.h)
303
304RTEMS_AMPOLISH3
305
306# Explicitly list all Makefiles here
307AC_CONFIG_FILES([
308Makefile
309rtems/Makefile
310sapi/Makefile
311score/Makefile
312score/cpu/Makefile
313score/cpu/arm/Makefile
314score/cpu/bfin/Makefile
315score/cpu/avr/Makefile
316score/cpu/c4x/Makefile
317score/cpu/h8300/Makefile
318score/cpu/i386/Makefile
319score/cpu/m68k/Makefile
320score/cpu/mips/Makefile
321score/cpu/nios2/Makefile
322score/cpu/powerpc/Makefile
323score/cpu/sh/Makefile
324score/cpu/sparc/Makefile
325score/cpu/unix/Makefile
326score/cpu/no_cpu/Makefile
327posix/Makefile
328itron/Makefile
329libblock/Makefile
330libfs/Makefile
331libcsupport/Makefile
332libnetworking/Makefile
333librpc/Makefile
334libmisc/Makefile
335libi2c/Makefile
336zlib/Makefile
337httpd/Makefile
338ftpd/Makefile
339telnetd/Makefile
340pppd/Makefile
341wrapup/Makefile])
342
343AC_CONFIG_COMMANDS([preinstall-stamp],
344[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
345[MAKE=${MAKE}
346with_multisubdir="$with_multisubdir"])
347
348AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.