source: rtems/cpukit/configure.ac @ ad9eaf26

4.115
Last change on this file since ad9eaf26 was ad9eaf26, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/30/11 at 13:08:45

2011-09-30 Ralf Corsépius <ralf.corsepius@…>

  • configure.ac: Check for size of time_t.
  • Property mode set to 100644
File size: 11.2 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id$
4
5AC_PREREQ([2.68])
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.11.1])
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([readdir_r isatty])
52AC_CHECK_FUNCS([creat \
53  opendir closedir readdir rewinddir scandir seekdir \
54  sleep \
55  telldir \
56  usleep],,
57  [rtems_missing_func="$ac_func";break])
58AS_IF([test -n "$rtems_missing_func"],
59  AC_MSG_ERROR([Missing function $rtems_missing_func in libc])])
60AC_CHECK_FUNCS([__assert])
61AC_CHECK_FUNCS([execl execlp execle execv execvp execve])
62AC_CHECK_FUNCS([regcomp regexec regerror regfree])
63
64# Mandated by POSIX, decls not present in some versions of newlib
65AC_CHECK_DECLS([flockfile],[AC_CHECK_FUNCS([flockfile])],,[#include <stdio.h>])
66AC_CHECK_DECLS([funlockfile],[AC_CHECK_FUNCS([funlockfile])],,[#include <stdio.h>])
67AC_CHECK_DECLS([ftrylockfile],[AC_CHECK_FUNCS([ftrylockfile])],,[#include <stdio.h>])
68
69# Mandated by POSIX, older newlibs bogusly provided CLOCK_PROCESS_CPUTIME+CLOCK_THREAD_CPUTIME
70AC_CHECK_DECL([CLOCK_PROCESS_CPUTIME_ID],[],[AC_MSG_ERROR([missing define CLOCK_PROCESS_CPUTIME_ID])],[#include <time.h>])
71AC_CHECK_DECL([CLOCK_THREAD_CPUTIME_ID],[],[AC_MSG_ERROR([missing define CLOCK_THREAD_CPUTIME_ID])],[#include <time.h>])
72
73# Mandated by POSIX, decls not present in some versions of newlib,
74# some versions stubbed in newlib's rtems crt0
75RTEMS_CHECK_FUNC([seteuid],[#include <unistd.h>])
76RTEMS_CHECK_FUNC([geteuid],[#include <unistd.h>])
77RTEMS_CHECK_FUNC([setegid],[#include <unistd.h>])
78RTEMS_CHECK_FUNC([getegid],[#include <unistd.h>])
79RTEMS_CHECK_FUNC([setuid],[#include <unistd.h>])
80RTEMS_CHECK_FUNC([getuid],[#include <unistd.h>])
81RTEMS_CHECK_FUNC([setgid],[#include <unistd.h>])
82RTEMS_CHECK_FUNC([getgid],[#include <unistd.h>])
83RTEMS_CHECK_FUNC([setsid],[#include <unistd.h>])
84RTEMS_CHECK_FUNC([getsid],[#include <unistd.h>])
85RTEMS_CHECK_FUNC([setpgid],[#include <unistd.h>])
86RTEMS_CHECK_FUNC([getpgid],[#include <unistd.h>])
87RTEMS_CHECK_FUNC([setpgrp],[#include <unistd.h>])
88RTEMS_CHECK_FUNC([getpgrp],[#include <unistd.h>])
89
90# pthread-functions not declared in some versions of newlib.
91RTEMS_CHECK_FUNC([pthread_attr_getguardsize],[#include <pthread.h>])
92RTEMS_CHECK_FUNC([pthread_attr_setguardsize],[#include <pthread.h>])
93RTEMS_CHECK_FUNC([pthread_attr_setstack],[#include <pthread.h>])
94RTEMS_CHECK_FUNC([pthread_attr_getstack],[#include <pthread.h>])
95
96# Newlib's unix/ directory
97AC_CHECK_FUNCS([ttyname getcwd])
98# </FIXME>
99
100# Check if the installed toolchain provides these headers
101# and error out if not.
102AC_CHECK_HEADERS([tar.h errno.h sched.h sys/cdefs.h sys/queue.h],,
103  [rtems_missing_header="$ac_header";break])
104AS_IF([test -n "$rtems_missing_header"],
105  AC_MSG_ERROR([Missing required header $rtems_missing_header])])
106
107## error out if libc doesn't provide stdint.h
108AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
109[AC_MSG_ERROR([Required header stdint.h not found])])
110
111## error out if libc doesn't provide inttypes.h
112AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
113[AC_MSG_ERROR([Required header inttypes.h not found])])
114
115AC_HEADER_STDBOOL
116AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
117[AC_MSG_ERROR([No sufficient stdbool.h found])])
118
119AC_CHECK_TYPES([ uint8_t,  int8_t])
120AC_CHECK_TYPES([uint16_t, int16_t])
121AC_CHECK_TYPES([uint32_t, int32_t])
122AC_CHECK_TYPES([uint64_t, int64_t])
123AC_CHECK_TYPES([uintmax_t, intmax_t])
124AC_CHECK_TYPES([uintptr_t, intptr_t])
125
126# Some toolchain sanity checks and diagnostics
127RTEMS_CHECK_GCC_SANITY
128
129# These are conditionally defined by the toolchain
130# FIXME: we should either conditionally compile those parts in
131# RTEMS depending on them, or abort - For now, simply check.
132AC_CHECK_HEADER([pthread.h],[
133  AC_CHECK_TYPES([pthread_rwlock_t])
134  AC_CHECK_TYPES([pthread_barrier_t])
135  AC_CHECK_TYPES([pthread_spinlock_t])
136])
137
138AC_CHECK_HEADER([signal.h],[
139  AC_CHECK_TYPES([sighandler_t])
140])
141
142RTEMS_CHECK_MULTIPROCESSING
143RTEMS_CHECK_POSIX_API
144RTEMS_CHECK_NETWORKING
145RTEMS_CHECK_SMP
146
147rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
148rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
149rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
150
151## This is needed to generate the field offsets of the per CPU
152## data structure so they can be accessed from assembly code.
153AC_CHECK_SIZEOF([void *])
154
155_RTEMS_CPUOPT_INIT
156
157RTEMS_CPUOPT([RTEMS_DEBUG],
158  [test x"${enable_rtems_debug}" = x"yes"],
159  [1],
160  [if RTEMS_DEBUG is enabled])
161
162RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
163  [test x"$enable_multiprocessing" = xyes],
164  [1],
165  [if multiprocessing is enabled])
166
167RTEMS_CPUOPT([RTEMS_NEWLIB],
168  [test x"$RTEMS_USE_NEWLIB" = xyes],
169  [1],
170  [if using newlib])
171
172RTEMS_CPUOPT([RTEMS_POSIX_API],
173  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
174  [1],
175  [if posix api is supported])
176
177RTEMS_CPUOPT([RTEMS_SMP],
178  [test x"$RTEMS_HAS_SMP" = xyes],
179  [1],
180  [if SMP is enabled])
181
182RTEMS_CPUOPT([RTEMS_NETWORKING],
183  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
184  [1],
185  [if networking is enabled])
186
187RTEMS_CPUOPT([RTEMS_VERSION],
188  [true],
189  ["]_RTEMS_VERSION["],
190  [RTEMS version string])
191
192RTEMS_CPUOPT([__RTEMS_USE_TICKS_FOR_STATISTICS__],
193  [test x"${USE_TICKS_FOR_STATISTICS}" = x"1"],
194  [1],
195  [disable nanosecond granularity for statistics])
196
197RTEMS_CPUOPT([__RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__],
198  [test x"${USE_TICKS_FOR_CPU_USAGE_STATISTICS}" = x"1"],
199  [1],
200  [disable nanosecond granularity for cpu usage statistics])
201
202RTEMS_CPUOPT([__RTEMS_USE_TICKS_RATE_MONOTONIC_STATISTICS__],
203  [test x"${USE_TICKS_FOR_RATE_MONOTONIC_STATISTICS}" = x"1"],
204  [1],
205  [disable nanosecond granularity for period statistics])
206
207## This improves both the size and coverage analysis.
208RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
209  [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
210  [1],
211  [disable inlining _Thread_Enable_dispatch])
212
213## This improves both the size and coverage analysis.
214RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__],
215  [test x"${RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE}" = x"1"],
216  [1],
217  [disable inlining _Thread_Enable_dispatch])
218
219## This improves both the size and coverage analysis.
220RTEMS_CPUOPT([__RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY__],
221  [test x"${RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY}" = x"1"],
222  [1],
223  [disable inlining _Thread_queue_Enqueue_priority])
224
225## This gives the same behavior as 4.8 and older
226RTEMS_CPUOPT([__RTEMS_STRICT_ORDER_MUTEX__],
227  [test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
228  [1],
229  [disable strict order mutex])
230
231## Deactivate ada bindings
232RTEMS_CPUOPT([__RTEMS_ADA__],
233  [test x"${enable_ada}" = x"yes"],
234  [1],
235  [Define to 1 if ada/gnat bindings are built-in])
236
237## Then we propagate a private copy of the value into cpuopts.h
238## so it is always available to the RTEMS header files.
239
240RTEMS_CPUOPT([__RTEMS_SIZEOF_VOID_P__],
241  [true],
242  [$ac_cv_sizeof_void_p],
243  [Size of a void * pointer])
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
277# FIXME: These checks are only in here to provide
278# configuration-time diagnostics and are not really used.
279AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
280AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
281
282# FIXME: We should get rid of this.
283# So far, only used in libfs/src/nfsclient/src/dirutils.c
284AC_CHECK_SIZEOF([mode_t])
285AC_CHECK_SIZEOF([off_t])
286
287# FIXME: We should get rid of this. It's a cludge.
288AC_CHECK_SIZEOF([time_t])
289
290# FIXME: Mandatory in SUSv4, optional in SUSv3.
291#   Not implemented in GCC/newlib, so far.
292AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>])
293AC_CHECK_DECLS([LONG_BIT],,,[#include <limits.h>])
294
295## BSD-ism, excluded from POSIX, but available on most platforms
296AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
297
298## Check if libc provides BSD's strlcpy/strlcat
299AC_CHECK_FUNCS(strlcpy strlcat)
300
301# ... far too many conditionals ...
302AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
303AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
304
305AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
306AM_CONDITIONAL(HAS_SMP,[test "$RTEMS_HAS_SMP" = "yes"])
307
308AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
309AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
310
311AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
312AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
313AM_CONDITIONAL([LIBGNAT],[test x"$rtems_cv_HAS_POSIX_API" = x"yes" \
314&& test x"$enable_ada" = x"yes"])
315
316AM_CONDITIONAL([LIBDOSFS],[dnl
317test x"$ac_cv_type_uint8_t" = xyes \
318&& test x"$ac_cv_type_uint16_t" = xyes])
319
320AC_CONFIG_HEADER(config.h)
321
322## These are needed by the NFS Client
323AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
324AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
325&& test -n "$AWK" \
326&& test "$enable_rpcgen" = yes])
327
328RTEMS_AMPOLISH3
329
330# Explicitly list all Makefiles here
331AC_CONFIG_FILES([
332Doxyfile
333Makefile
334rtems/Makefile
335sapi/Makefile
336score/Makefile
337score/cpu/Makefile
338score/cpu/arm/Makefile
339score/cpu/bfin/Makefile
340score/cpu/avr/Makefile
341score/cpu/h8300/Makefile
342score/cpu/i386/Makefile
343score/cpu/lm32/Makefile
344score/cpu/m68k/Makefile
345score/cpu/m32c/Makefile
346score/cpu/m32r/Makefile
347score/cpu/mips/Makefile
348score/cpu/nios2/Makefile
349score/cpu/powerpc/Makefile
350score/cpu/sh/Makefile
351score/cpu/sparc/Makefile
352score/cpu/sparc64/Makefile
353score/cpu/no_cpu/Makefile
354posix/Makefile
355libblock/Makefile
356libfs/Makefile
357libfs/src/nfsclient/Makefile
358libgnat/Makefile
359libcsupport/Makefile
360libnetworking/Makefile
361librpc/Makefile
362libmisc/Makefile
363libi2c/Makefile
364libmd/Makefile
365zlib/Makefile
366ftpd/Makefile
367telnetd/Makefile
368pppd/Makefile
369mghttpd/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.