source: rtems/cpukit/configure.ac @ 927a0a1

4.115
Last change on this file since 927a0a1 was 927a0a1, checked in by Sebastian Huber <sebastian.huber@…>, on 12/02/13 at 07:33:35

posix: Use cleanup contexts on the stack

Provide support for latest Newlib <pthread.h> change. The cleanup
contexts are stored on the thread stack. This is conformant with the
POSIX requirements for the pthread_cleanup_push() and
pthread_cleanup_pop() statement pair.

Passing an invalid pointer as the routine to pthread_cleanup_push() is
now a usage error and the behaviour is undefined.

  • Property mode set to 100644
File size: 11.8 KB
Line 
1## Process this file with autoconf to produce a configure script.
2
3AC_PREREQ([2.69])
4AC_INIT([rtems-cpukit],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
5AC_CONFIG_SRCDIR([score])
6RTEMS_TOP([..],[])
7
8RTEMS_CANONICAL_TARGET_CPU
9
10AM_INIT_AUTOMAKE([no-define nostdinc subdir-objects foreign 1.12.2])
11AM_MAINTAINER_MODE
12
13RTEMS_ENABLE_MULTILIB
14RTEMS_ENABLE_MULTIPROCESSING
15RTEMS_ENABLE_POSIX
16RTEMS_ENABLE_RTEMS_DEBUG
17RTEMS_ENABLE_NETWORKING
18RTEMS_ENABLE_PARAVIRT
19
20RTEMS_ENV_RTEMSCPU
21RTEMS_CHECK_RTEMS_DEBUG
22
23# Is this a supported CPU?
24AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
25if test -d "$srcdir/score/cpu/$RTEMS_CPU"; then
26  AC_MSG_RESULT(yes)
27else
28  AC_MSG_ERROR(no)
29fi
30
31RTEMS_PROG_CC_FOR_TARGET
32RTEMS_PROG_CCAS
33RTEMS_CANONICALIZE_TOOLS
34AM_PROG_CC_C_O
35AC_PROG_RANLIB
36
37RTEMS_CHECK_NEWLIB
38
39# BSD-isms, used throughout the sources
40# Not really used by this configure script
41# FIXME: They should be eliminated if possible.
42AC_CHECK_FUNCS([strsep strcasecmp snprintf])
43AC_CHECK_FUNCS([strdup strndup strncasecmp])
44AC_CHECK_FUNCS([bcopy bcmp])
45AC_CHECK_FUNCS([isascii fileno])
46
47# <FIXME>
48#   Check for functions supplied by newlib >= 1.17.0
49# Newlib's posix/ directory
50AC_CHECK_FUNCS([readdir_r isatty])
51AC_CHECK_FUNCS([creat \
52  opendir closedir readdir rewinddir scandir seekdir \
53  sleep \
54  telldir \
55  usleep],,
56  [rtems_missing_func="$ac_func";break])
57AS_IF([test -n "$rtems_missing_func"],
58  AC_MSG_ERROR([Missing function $rtems_missing_func in libc])])
59AC_CHECK_FUNCS([__assert])
60AC_CHECK_FUNCS([execl execlp execle execv execvp execve])
61AC_CHECK_FUNCS([regcomp regexec regerror regfree])
62
63# Mandated by POSIX, decls not present in some versions of newlib
64AC_CHECK_DECLS([flockfile],[AC_CHECK_FUNCS([flockfile])],,[#include <stdio.h>])
65AC_CHECK_DECLS([funlockfile],[AC_CHECK_FUNCS([funlockfile])],,[#include <stdio.h>])
66AC_CHECK_DECLS([ftrylockfile],[AC_CHECK_FUNCS([ftrylockfile])],,[#include <stdio.h>])
67
68# Newlib proprietary
69AC_CHECK_HEADERS([envlock.h])
70AC_CHECK_DECLS([__env_lock],,,[#include <envlock.h>])
71AC_CHECK_DECLS([__env_unlock],,,[#include <envlock.h>])
72
73# Mandated by POSIX, older newlibs bogusly provided CLOCK_PROCESS_CPUTIME+CLOCK_THREAD_CPUTIME
74AC_CHECK_DECL([CLOCK_PROCESS_CPUTIME_ID],[],[AC_MSG_ERROR([missing define CLOCK_PROCESS_CPUTIME_ID])],[#include <time.h>])
75AC_CHECK_DECL([CLOCK_THREAD_CPUTIME_ID],[],[AC_MSG_ERROR([missing define CLOCK_THREAD_CPUTIME_ID])],[#include <time.h>])
76
77# Mandated by POSIX, decls not present in some versions of newlib,
78# some versions stubbed in newlib's rtems crt0
79RTEMS_CHECK_FUNC([seteuid],[#include <unistd.h>])
80RTEMS_CHECK_FUNC([geteuid],[#include <unistd.h>])
81RTEMS_CHECK_FUNC([setegid],[#include <unistd.h>])
82RTEMS_CHECK_FUNC([getegid],[#include <unistd.h>])
83RTEMS_CHECK_FUNC([setuid],[#include <unistd.h>])
84RTEMS_CHECK_FUNC([getuid],[#include <unistd.h>])
85RTEMS_CHECK_FUNC([setgid],[#include <unistd.h>])
86RTEMS_CHECK_FUNC([getgid],[#include <unistd.h>])
87RTEMS_CHECK_FUNC([setsid],[#include <unistd.h>])
88RTEMS_CHECK_FUNC([getsid],[#include <unistd.h>])
89RTEMS_CHECK_FUNC([setpgid],[#include <unistd.h>])
90RTEMS_CHECK_FUNC([getpgid],[#include <unistd.h>])
91RTEMS_CHECK_FUNC([setpgrp],[#include <unistd.h>])
92RTEMS_CHECK_FUNC([getpgrp],[#include <unistd.h>])
93
94# pthread-functions not declared in some versions of newlib.
95RTEMS_CHECK_FUNC([pthread_attr_getguardsize],[#include <pthread.h>])
96RTEMS_CHECK_FUNC([pthread_attr_setguardsize],[#include <pthread.h>])
97RTEMS_CHECK_FUNC([pthread_attr_setstack],[#include <pthread.h>])
98RTEMS_CHECK_FUNC([pthread_attr_getstack],[#include <pthread.h>])
99
100# Mandated by POSIX, not declared in some versions of newlib.
101AC_CHECK_DECLS([getrusage],,,[#include sys/resource.h])
102
103# Newlib's unix/ directory
104AC_CHECK_FUNCS([ttyname getcwd])
105# </FIXME>
106
107# Check if the installed toolchain provides these headers
108# and error out if not.
109AC_CHECK_HEADERS([tar.h errno.h sched.h sys/cdefs.h sys/queue.h],,
110  [rtems_missing_header="$ac_header";break])
111AS_IF([test -n "$rtems_missing_header"],
112  AC_MSG_ERROR([Missing required header $rtems_missing_header])])
113
114## error out if libc doesn't provide stdint.h
115AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
116[AC_MSG_ERROR([Required header stdint.h not found])])
117
118## error out if libc doesn't provide inttypes.h
119AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
120[AC_MSG_ERROR([Required header inttypes.h not found])])
121
122AC_HEADER_STDBOOL
123AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
124[AC_MSG_ERROR([No sufficient stdbool.h found])])
125
126AC_CHECK_TYPES([ uint8_t,  int8_t])
127AC_CHECK_TYPES([uint16_t, int16_t])
128AC_CHECK_TYPES([uint32_t, int32_t])
129AC_CHECK_TYPES([uint64_t, int64_t])
130AC_CHECK_TYPES([uintmax_t, intmax_t])
131AC_CHECK_TYPES([uintptr_t, intptr_t])
132
133# Some toolchain sanity checks and diagnostics
134RTEMS_CHECK_GCC_SANITY
135
136# These are conditionally defined by the toolchain
137# FIXME: we should either conditionally compile those parts in
138# RTEMS depending on them, or abort - For now, simply check.
139AC_CHECK_HEADER([pthread.h],[
140  AC_CHECK_TYPES([pthread_rwlock_t])
141  AC_CHECK_TYPES([pthread_barrier_t])
142  AC_CHECK_TYPES([pthread_spinlock_t])
143  AC_CHECK_TYPES([struct _pthread_cleanup_context],[],[],[#include <pthread.h>])
144])
145
146AC_CHECK_HEADER([signal.h],[
147  AC_CHECK_TYPES([sighandler_t])
148])
149
150RTEMS_CHECK_MULTIPROCESSING
151RTEMS_CHECK_POSIX_API
152RTEMS_CHECK_NETWORKING
153RTEMS_CHECK_SMP
154RTEMS_CHECK_ATOMIC
155
156rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
157rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
158rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
159
160_RTEMS_CPUOPT_INIT
161
162RTEMS_CPUOPT([RTEMS_DEBUG],
163  [test x"${enable_rtems_debug}" = x"yes"],
164  [1],
165  [if RTEMS_DEBUG is enabled])
166
167RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
168  [test x"$enable_multiprocessing" = xyes],
169  [1],
170  [if multiprocessing is enabled])
171
172RTEMS_CPUOPT([RTEMS_NEWLIB],
173  [test x"$RTEMS_USE_NEWLIB" = xyes],
174  [1],
175  [if using newlib])
176
177RTEMS_CPUOPT([RTEMS_POSIX_API],
178  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
179  [1],
180  [if posix api is supported])
181
182RTEMS_CPUOPT([RTEMS_SMP],
183  [test x"$RTEMS_HAS_SMP" = xyes],
184  [1],
185  [if SMP is enabled])
186
187RTEMS_CPUOPT([RTEMS_PARAVIRT],
188  [test x"$RTEMS_HAS_PARAVIRT" = xyes],
189  [1],
190  [PARAVIRT is enabled])
191
192RTEMS_CPUOPT([RTEMS_NETWORKING],
193  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
194  [1],
195  [if networking is enabled])
196
197RTEMS_CPUOPT([RTEMS_ATOMIC],
198  [test x"$rtems_cv_ATOMIC" = xyes],
199  [1],
200  [if cpu supports atomic operations])
201
202RTEMS_CPUOPT([RTEMS_VERSION],
203  [true],
204  ["]_RTEMS_VERSION["],
205  [RTEMS version string])
206
207RTEMS_CPUOPT([__RTEMS_USE_TICKS_FOR_STATISTICS__],
208  [test x"${USE_TICKS_FOR_STATISTICS}" = x"1"],
209  [1],
210  [disable nanosecond granularity for statistics])
211
212## This improves both the size and coverage analysis.
213RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
214  [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
215  [1],
216  [disable inlining _Thread_Enable_dispatch])
217
218## This improves both the size and coverage analysis.
219RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__],
220  [test x"${RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE}" = x"1"],
221  [1],
222  [disable inlining _Thread_Enable_dispatch])
223
224## This improves both the size and coverage analysis.
225RTEMS_CPUOPT([__RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY__],
226  [test x"${RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY}" = x"1"],
227  [1],
228  [disable inlining _Thread_queue_Enqueue_priority])
229
230## This gives the same behavior as 4.8 and older
231RTEMS_CPUOPT([__RTEMS_STRICT_ORDER_MUTEX__],
232  [test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
233  [1],
234  [disable strict order mutex])
235
236## Deactivate ada bindings
237RTEMS_CPUOPT([__RTEMS_ADA__],
238  [test x"${enable_ada}" = x"yes"],
239  [1],
240  [Define to 1 if ada/gnat bindings are built-in])
241
242## Then we propagate a private copy of the value into cpuopts.h
243## so it is always available to the RTEMS header files.
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
290AC_CHECK_SIZEOF([size_t])
291
292# FIXME: Mandatory in SUSv4, optional in SUSv3.
293#   Not implemented in GCC/newlib, so far.
294AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>])
295AC_CHECK_DECLS([LONG_BIT],,,[#include <limits.h>])
296
297## BSD-ism, excluded from POSIX, but available on most platforms
298AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
299AC_CHECK_DECLS([rcmd],,,[#include <unistd.h>])
300
301## Check if libc provides BSD's strlcpy/strlcat
302AC_CHECK_FUNCS(strlcpy strlcat)
303
304## Check if libc provides decl of utime
305## FIXME: utime has been deprecated in SUSv4.
306##        and is likely to be removed in future versions.
307## FIXME (BUG in newlib): SUSv4 saids including <utime.h> should be sufficient.
308AC_CHECK_DECLS([utime],,,[#include <sys/types.h>
309#include <utime.h>])
310## Check if libc provides decl of utimes
311AC_CHECK_DECLS([utimes],,,[#include <sys/time.h>])
312
313# ... far too many conditionals ...
314AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
315AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
316
317AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
318AM_CONDITIONAL(HAS_SMP,[test "$RTEMS_HAS_SMP" = "yes"])
319
320AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
321AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
322AM_CONDITIONAL([ATOMIC],[test x"$rtems_cv_ATOMIC" = x"yes"])
323
324AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
325AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
326AM_CONDITIONAL([LIBGNAT],[test x"$rtems_cv_HAS_POSIX_API" = x"yes" \
327&& test x"$enable_ada" = x"yes"])
328
329AM_CONDITIONAL([LIBUTF8PROC],[test $ac_cv_sizeof_size_t -gt 2])
330
331AM_CONDITIONAL([LIBDOSFS],[dnl
332test x"$ac_cv_type_uint8_t" = xyes \
333&& test x"$ac_cv_type_uint16_t" = xyes])
334
335AC_CONFIG_HEADER(config.h)
336
337## These are needed by the NFS Client
338AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
339AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
340&& test -n "$AWK" \
341&& test "$enable_rpcgen" = yes])
342
343RTEMS_AMPOLISH3
344
345# Explicitly list all Makefiles here
346AC_CONFIG_FILES([
347Doxyfile
348Makefile
349rtems/Makefile
350sapi/Makefile
351score/Makefile
352score/cpu/Makefile
353score/cpu/arm/Makefile
354score/cpu/bfin/Makefile
355score/cpu/avr/Makefile
356score/cpu/h8300/Makefile
357score/cpu/i386/Makefile
358score/cpu/lm32/Makefile
359score/cpu/m68k/Makefile
360score/cpu/m32c/Makefile
361score/cpu/m32r/Makefile
362score/cpu/mips/Makefile
363score/cpu/moxie/Makefile
364score/cpu/nios2/Makefile
365score/cpu/powerpc/Makefile
366score/cpu/sh/Makefile
367score/cpu/sparc/Makefile
368score/cpu/sparc64/Makefile
369score/cpu/v850/Makefile
370score/cpu/no_cpu/Makefile
371posix/Makefile
372libblock/Makefile
373libfs/Makefile
374libfs/src/nfsclient/Makefile
375libgnat/Makefile
376libcsupport/Makefile
377libnetworking/Makefile
378librpc/Makefile
379libmisc/Makefile
380libi2c/Makefile
381libmd/Makefile
382zlib/Makefile
383ftpd/Makefile
384telnetd/Makefile
385pppd/Makefile
386mghttpd/Makefile
387wrapup/Makefile])
388
389AC_CONFIG_COMMANDS([preinstall-stamp],
390[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
391[MAKE=${MAKE}
392with_multisubdir="$with_multisubdir"])
393
394AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.