source: rtems/cpukit/configure.ac @ 2b5bd836

4.115
Last change on this file since 2b5bd836 was 2f797d0, checked in by Ralf Corsepius <ralf.corsepius@…>, on 08/03/10 at 15:44:05

2010-08-03 Ralf Corsépius <ralf.corsepius@…>

  • configure.ac: Apply RTEMS_CHECK_FUNC for set/get*id family of functions. Extend set/get*id family of checks.
  • Property mode set to 100644
File size: 10.7 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_RTEMS_DEBUG
19RTEMS_ENABLE_NETWORKING
20
21RTEMS_ENV_RTEMSCPU
22RTEMS_CHECK_RTEMS_DEBUG
23
24# Is this a supported CPU?
25AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
26if test -d "$srcdir/score/cpu/$RTEMS_CPU"; then
27  AC_MSG_RESULT(yes)
28else
29  AC_MSG_ERROR(no)
30fi
31
32RTEMS_PROG_CC_FOR_TARGET
33RTEMS_PROG_CCAS
34RTEMS_CANONICALIZE_TOOLS
35AM_PROG_CC_C_O
36AC_PROG_RANLIB
37
38RTEMS_CHECK_NEWLIB
39
40# BSD-isms, used throughout the sources
41# Not really used by this configure script
42# FIXME: They should be eliminated if possible.
43AC_CHECK_FUNCS([strsep strcasecmp snprintf])
44AC_CHECK_FUNCS([strdup strndup strncasecmp])
45AC_CHECK_FUNCS([bcopy bcmp])
46AC_CHECK_FUNCS([isascii fileno])
47
48# <FIXME>
49#   Check for functions supplied by newlib >= 1.17.0
50# Newlib's posix/ directory
51AC_CHECK_FUNCS([sleep usleep \
52  opendir closedir readdir readdir_r \
53  rewinddir scandir seekdir telldir isatty])
54AC_CHECK_FUNCS([creat])
55AC_CHECK_FUNCS([__assert])
56AC_CHECK_FUNCS([execl execlp execle execv execvp execve])
57AC_CHECK_FUNCS([regcomp regexec regerror regfree])
58
59# Mandated by POSIX, decls not present in some versions of newlib
60AC_CHECK_DECLS([flockfile],[AC_CHECK_FUNCS([flockfile])],,[#include <stdio.h>])
61AC_CHECK_DECLS([funlockfile],[AC_CHECK_FUNCS([funlockfile])],,[#include <stdio.h>])
62AC_CHECK_DECLS([ftrylockfile],[AC_CHECK_FUNCS([ftrylockfile])],,[#include <stdio.h>])
63
64# Mandated by POSIX, decls not present in some versions of newlib,
65# some versions stubbed in newlib's rtems crt0
66RTEMS_CHECK_FUNC([seteuid],[#include <unistd.h>])
67RTEMS_CHECK_FUNC([geteuid],[#include <unistd.h>])
68RTEMS_CHECK_FUNC([setegid],[#include <unistd.h>])
69RTEMS_CHECK_FUNC([getegid],[#include <unistd.h>])
70RTEMS_CHECK_FUNC([setuid],[#include <unistd.h>])
71RTEMS_CHECK_FUNC([getuid],[#include <unistd.h>])
72RTEMS_CHECK_FUNC([setgid],[#include <unistd.h>])
73RTEMS_CHECK_FUNC([getgid],[#include <unistd.h>])
74RTEMS_CHECK_FUNC([setsid],[#include <unistd.h>])
75RTEMS_CHECK_FUNC([getsid],[#include <unistd.h>])
76RTEMS_CHECK_FUNC([setpgid],[#include <unistd.h>])
77RTEMS_CHECK_FUNC([getpgid],[#include <unistd.h>])
78RTEMS_CHECK_FUNC([setpgrp],[#include <unistd.h>])
79RTEMS_CHECK_FUNC([getpgrp],[#include <unistd.h>])
80
81# Newlib's unix/ directory
82AC_CHECK_FUNCS([ttyname getcwd])
83# </FIXME>
84
85## Check if the installed toolchain has these headers
86AC_CHECK_HEADERS([tar.h errno.h sched.h])
87
88## error out if libc doesn't provide stdint.h
89AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
90[AC_MSG_ERROR([Required header stdint.h not found])])
91
92## error out if libc doesn't provide inttypes.h
93AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
94[AC_MSG_ERROR([Required header inttypes.h not found])])
95
96## error out if libc doesn't provide errno.h
97AS_IF([test x"${ac_cv_header_errno_h}" != xyes],
98[AC_MSG_ERROR([Required header errno.h not found])])
99
100## error out if libc doesn't provide sched.h
101AS_IF([test x"${ac_cv_header_sched_h}" != xyes],
102[AC_MSG_ERROR([Required header sched.h not found])])
103
104## error out if libc doesn't provide tar.h
105AS_IF([test x"${ac_cv_header_tar_h}" != xyes],
106[AC_MSG_ERROR([Required header tar.h not found])])
107
108AC_HEADER_STDBOOL
109AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
110[AC_MSG_ERROR([No sufficient stdbool.h found])])
111
112AC_CHECK_TYPES([ uint8_t,  int8_t])
113AC_CHECK_TYPES([uint16_t, int16_t])
114AC_CHECK_TYPES([uint32_t, int32_t])
115AC_CHECK_TYPES([uint64_t, int64_t])
116AC_CHECK_TYPES([uintmax_t, intmax_t])
117AC_CHECK_TYPES([uintptr_t, intptr_t])
118
119# Some toolchain sanity checks and diagnostics
120RTEMS_CHECK_GCC_SANITY
121
122# These are conditionally defined by the toolchain
123# FIXME: we should either conditionally compile those parts in
124# RTEMS depending on them, or abort - For now, simply check.
125AC_CHECK_HEADER([pthread.h],[
126  AC_CHECK_TYPES([pthread_rwlock_t])
127  AC_CHECK_TYPES([pthread_barrier_t])
128  AC_CHECK_TYPES([pthread_spinlock_t])
129])
130
131RTEMS_CHECK_MULTIPROCESSING
132RTEMS_CHECK_POSIX_API
133RTEMS_CHECK_NETWORKING
134
135rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
136rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
137rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
138
139## This is needed to generate the field offsets of the per CPU
140## data structure so they can be accessed from assembly code.
141AC_CHECK_SIZEOF([void *])
142
143_RTEMS_CPUOPT_INIT
144
145RTEMS_CPUOPT([RTEMS_DEBUG],
146  [test x"${enable_rtems_debug}" = x"yes"],
147  [1],
148  [if RTEMS_DEBUG is enabled])
149
150RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
151  [test x"$enable_multiprocessing" = xyes],
152  [1],
153  [if multiprocessing is enabled])
154
155RTEMS_CPUOPT([RTEMS_NEWLIB],
156  [test x"$RTEMS_USE_NEWLIB" = xyes],
157  [1],
158  [if using newlib])
159
160RTEMS_CPUOPT([RTEMS_POSIX_API],
161  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
162  [1],
163  [if posix api is supported])
164
165RTEMS_CPUOPT([RTEMS_NETWORKING],
166  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
167  [1],
168  [if networking is enabled])
169
170RTEMS_CPUOPT([RTEMS_VERSION],
171  [true],
172  ["]_RTEMS_VERSION["],
173  [RTEMS version string])
174
175RTEMS_CPUOPT([__RTEMS_USE_TICKS_FOR_STATISTICS__],
176  [test x"${USE_TICKS_FOR_STATISTICS}" = x"1"],
177  [1],
178  [disable nanosecond granularity for statistics])
179
180RTEMS_CPUOPT([__RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__],
181  [test x"${USE_TICKS_FOR_CPU_USAGE_STATISTICS}" = x"1"],
182  [1],
183  [disable nanosecond granularity for cpu usage statistics])
184
185RTEMS_CPUOPT([__RTEMS_USE_TICKS_RATE_MONOTONIC_STATISTICS__],
186  [test x"${USE_TICKS_FOR_RATE_MONOTONIC_STATISTICS}" = x"1"],
187  [1],
188  [disable nanosecond granularity for period statistics])
189
190## This improves both the size and coverage analysis.
191RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
192  [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
193  [1],
194  [disable inlining _Thread_Enable_dispatch])
195
196## This improves both the size and coverage analysis.
197RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__],
198  [test x"${RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE}" = x"1"],
199  [1],
200  [disable inlining _Thread_Enable_dispatch])
201
202## This improves both the size and coverage analysis.
203RTEMS_CPUOPT([__RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY__],
204  [test x"${RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY}" = x"1"],
205  [1],
206  [disable inlining _Thread_queue_Enqueue_priority])
207
208## This gives the same behavior as 4.8 and older
209RTEMS_CPUOPT([__RTEMS_STRICT_ORDER_MUTEX__],
210  [test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
211  [1],
212  [disable strict order mutex])
213
214## Deactivate ada bindings
215RTEMS_CPUOPT([__RTEMS_ADA__],
216  [test x"${enable_ada}" = x"yes"],
217  [1],
218  [Define to 1 if ada/gnat bindings are built-in])
219
220## Then we propagate a private copy of the value into cpuopts.h
221## so it is always available to the RTEMS header files.
222
223RTEMS_CPUOPT([__RTEMS_SIZEOF_VOID_P__],
224  [true],
225  [$ac_cv_sizeof_void_p],
226  [Size of a void * pointer])
227
228RTEMS_CPUOPT([__RTEMS_MAJOR__],
229  [true],
230  [$rtems_major],
231  [major version portion of an RTEMS release])
232
233RTEMS_CPUOPT([__RTEMS_MINOR__],
234  [true],
235  [$rtems_minor],
236  [minor version portion of an RTEMS release])
237
238RTEMS_CPUOPT([__RTEMS_REVISION__],
239  [true],
240  [$rtems_revision],
241  [revision version portion of an RTEMS release])
242
243_RTEMS_CPUOPT_FINI
244
245AC_ENABLE_MULTILIB([Makefile],[..])
246
247# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
248AC_MSG_CHECKING([for assignable stdio])
249AC_COMPILE_IFELSE(
250  [AC_LANG_PROGRAM(
251    [#include <stdio.h>],
252    [stdin = fopen("/tmp", "r")])],
253  [HAVE_ASSIGNABLE_STDIO=yes],
254  [HAVE_ASSIGNABLE_STDIO=no])
255AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
256
257# libmisc/serdbg exploits weak symbols
258RTEMS_CHECK_GCC_WEAK
259
260AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes])
261AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes])
262
263# FIXME: These checks are only in here to provide
264# configuration-time diagnostics and are not really used.
265AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
266AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
267
268# FIXME: We should get rid of this.
269# So far, only used in libfs/src/nfsclient/src/dirutils.c
270AC_CHECK_SIZEOF([mode_t])
271AC_CHECK_SIZEOF([off_t])
272
273# FIXME: Mandatory in SUSv4, optional in SUSv3.
274#   Not implemented in GCC/newlib, so far.
275AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>])
276AC_CHECK_DECLS([LONG_BIT],,,[#include <limits.h>])
277
278## BSD-ism, excluded from POSIX, but available on most platforms
279AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
280
281## Check if libc provides BSD's strlcpy/strlcat
282AC_CHECK_FUNCS(strlcpy strlcat)
283
284# ... far too many conditionals ...
285AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
286AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
287
288AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
289
290AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
291AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
292
293AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"])
294AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"])
295
296AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
297AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
298AM_CONDITIONAL([LIBGNAT],[test x"$rtems_cv_HAS_POSIX_API" = x"yes" \
299&& test x"$enable_ada" = x"yes"])
300
301AM_CONDITIONAL([LIBDOSFS],[dnl
302test x"$ac_cv_type_uint8_t" = xyes \
303&& test x"$ac_cv_type_uint16_t" = xyes])
304
305AC_CONFIG_HEADER(config.h)
306
307## These are needed by the NFS Client
308AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
309AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
310&& test -n "$AWK" \
311&& test "$enable_rpcgen" = yes])
312
313RTEMS_AMPOLISH3
314
315# Explicitly list all Makefiles here
316AC_CONFIG_FILES([
317Doxyfile
318Makefile
319rtems/Makefile
320sapi/Makefile
321score/Makefile
322score/cpu/Makefile
323score/cpu/arm/Makefile
324score/cpu/bfin/Makefile
325score/cpu/avr/Makefile
326score/cpu/h8300/Makefile
327score/cpu/i386/Makefile
328score/cpu/lm32/Makefile
329score/cpu/m68k/Makefile
330score/cpu/m32c/Makefile
331score/cpu/m32r/Makefile
332score/cpu/mips/Makefile
333score/cpu/nios2/Makefile
334score/cpu/powerpc/Makefile
335score/cpu/sh/Makefile
336score/cpu/sparc/Makefile
337score/cpu/sparc64/Makefile
338score/cpu/no_cpu/Makefile
339posix/Makefile
340libblock/Makefile
341libfs/Makefile
342libfs/src/nfsclient/Makefile
343libgnat/Makefile
344libcsupport/Makefile
345libnetworking/Makefile
346librpc/Makefile
347libmisc/Makefile
348libi2c/Makefile
349libmd/Makefile
350zlib/Makefile
351ftpd/Makefile
352telnetd/Makefile
353pppd/Makefile
354mghttpd/Makefile
355wrapup/Makefile])
356
357AC_CONFIG_COMMANDS([preinstall-stamp],
358[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
359[MAKE=${MAKE}
360with_multisubdir="$with_multisubdir"])
361
362AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.