source: rtems/cpukit/configure.ac @ 57997d8

4.11
Last change on this file since 57997d8 was 57997d8, checked in by Jennifer Averett <jennifer.averett@…>, on Feb 17, 2014 at 6:15:19 PM

cpukit: Correct bug in check of affinity support in newlib.

  • Property mode set to 100644
File size: 12.6 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# These are SMP related and were added to newlib by RTEMS.
101RTEMS_CHECK_FUNC([pthread_attr_setaffinity_np],[
102  #define _GNU_SOURCE
103  #include <pthread.h>])
104RTEMS_CHECK_FUNC([pthread_attr_getaffinity_np],[
105  #define _GNU_SOURCE
106  #include <pthread.h>])
107RTEMS_CHECK_FUNC([pthread_setaffinity_np],[
108  #define _GNU_SOURCE
109  #include <pthread.h>])
110RTEMS_CHECK_FUNC([pthread_getaffinity_np],[
111  #define _GNU_SOURCE
112  #include <pthread.h>])
113RTEMS_CHECK_FUNC([pthread_getattr_np],[
114  #define _GNU_SOURCE
115  #include <pthread.h>])
116AC_CHECK_HEADERS([sys/cpuset.h])
117
118# Mandated by POSIX, not declared in some versions of newlib.
119AC_CHECK_DECLS([getrusage],,,[#include sys/resource.h])
120
121# Newlib's unix/ directory
122AC_CHECK_FUNCS([ttyname getcwd])
123# </FIXME>
124
125# Check if the installed toolchain provides these headers
126# and error out if not.
127AC_CHECK_HEADERS([tar.h errno.h sched.h sys/cdefs.h sys/queue.h],,
128  [rtems_missing_header="$ac_header";break])
129AS_IF([test -n "$rtems_missing_header"],
130  AC_MSG_ERROR([Missing required header $rtems_missing_header])])
131
132## error out if libc doesn't provide stdint.h
133AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
134[AC_MSG_ERROR([Required header stdint.h not found])])
135
136## error out if libc doesn't provide inttypes.h
137AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
138[AC_MSG_ERROR([Required header inttypes.h not found])])
139
140AC_HEADER_STDBOOL
141AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
142[AC_MSG_ERROR([No sufficient stdbool.h found])])
143
144AC_CHECK_TYPES([ uint8_t,  int8_t])
145AC_CHECK_TYPES([uint16_t, int16_t])
146AC_CHECK_TYPES([uint32_t, int32_t])
147AC_CHECK_TYPES([uint64_t, int64_t])
148AC_CHECK_TYPES([uintmax_t, intmax_t])
149AC_CHECK_TYPES([uintptr_t, intptr_t])
150
151# Some toolchain sanity checks and diagnostics
152RTEMS_CHECK_GCC_SANITY
153
154# These are conditionally defined by the toolchain
155# FIXME: we should either conditionally compile those parts in
156# RTEMS depending on them, or abort - For now, simply check.
157AC_CHECK_HEADER([pthread.h],[
158  AC_CHECK_TYPES([pthread_rwlock_t])
159  AC_CHECK_TYPES([pthread_barrier_t])
160  AC_CHECK_TYPES([pthread_spinlock_t])
161  AC_CHECK_TYPES([struct _pthread_cleanup_context],[],[],[#include <pthread.h>])
162])
163
164AC_CHECK_HEADER([signal.h],[
165  AC_CHECK_TYPES([sighandler_t])
166])
167
168RTEMS_CHECK_MULTIPROCESSING
169RTEMS_CHECK_POSIX_API
170RTEMS_CHECK_NETWORKING
171RTEMS_CHECK_SMP
172if test "${RTEMS_HAS_SMP}" = "yes"; then
173  AC_CHECK_HEADERS([stdatomic.h],[],[AC_MSG_ERROR([<stdatomic.h> is required for SMP support])])
174fi
175
176rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
177rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
178rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
179
180_RTEMS_CPUOPT_INIT
181
182RTEMS_CPUOPT([RTEMS_DEBUG],
183  [test x"${enable_rtems_debug}" = x"yes"],
184  [1],
185  [if RTEMS_DEBUG is enabled])
186
187RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
188  [test x"$enable_multiprocessing" = xyes],
189  [1],
190  [if multiprocessing is enabled])
191
192RTEMS_CPUOPT([RTEMS_NEWLIB],
193  [test x"$RTEMS_USE_NEWLIB" = xyes],
194  [1],
195  [if using newlib])
196
197RTEMS_CPUOPT([RTEMS_POSIX_API],
198  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
199  [1],
200  [if posix api is supported])
201
202RTEMS_CPUOPT([RTEMS_SMP],
203  [test x"$RTEMS_HAS_SMP" = xyes],
204  [1],
205  [if SMP is enabled])
206
207RTEMS_CPUOPT([RTEMS_PARAVIRT],
208  [test x"$RTEMS_HAS_PARAVIRT" = xyes],
209  [1],
210  [PARAVIRT is enabled])
211
212RTEMS_CPUOPT([RTEMS_NETWORKING],
213  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
214  [1],
215  [if networking is enabled])
216
217RTEMS_CPUOPT([RTEMS_VERSION],
218  [true],
219  ["]_RTEMS_VERSION["],
220  [RTEMS version string])
221
222RTEMS_CPUOPT([__RTEMS_USE_TICKS_FOR_STATISTICS__],
223  [test x"${USE_TICKS_FOR_STATISTICS}" = x"1"],
224  [1],
225  [disable nanosecond granularity for statistics])
226
227## Header file differences that need to be known in .h after install
228RTEMS_CPUOPT([__RTEMS_HAVE_SYS_CPUSET_H__],
229  [test x"${ac_cv_header_sys_cpuset_h}" = x"yes"],
230  [1],
231  [indicate if <sys/cpuset.h> is present in toolset])
232
233## This improves both the size and coverage analysis.
234RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
235  [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
236  [1],
237  [disable inlining _Thread_Enable_dispatch])
238
239## This improves both the size and coverage analysis.
240RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__],
241  [test x"${RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE}" = x"1"],
242  [1],
243  [disable inlining _Thread_Enable_dispatch])
244
245## This improves both the size and coverage analysis.
246RTEMS_CPUOPT([__RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY__],
247  [test x"${RTEMS_DO_NOT_UNROLL_THREADQ_ENQUEUE_PRIORITY}" = x"1"],
248  [1],
249  [disable inlining _Thread_queue_Enqueue_priority])
250
251## This gives the same behavior as 4.8 and older
252RTEMS_CPUOPT([__RTEMS_STRICT_ORDER_MUTEX__],
253  [test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
254  [1],
255  [disable strict order mutex])
256
257## Deactivate ada bindings
258RTEMS_CPUOPT([__RTEMS_ADA__],
259  [test x"${enable_ada}" = x"yes"],
260  [1],
261  [Define to 1 if ada/gnat bindings are built-in])
262
263## Then we propagate a private copy of the value into cpuopts.h
264## so it is always available to the RTEMS header files.
265
266RTEMS_CPUOPT([__RTEMS_MAJOR__],
267  [true],
268  [$rtems_major],
269  [major version portion of an RTEMS release])
270
271RTEMS_CPUOPT([__RTEMS_MINOR__],
272  [true],
273  [$rtems_minor],
274  [minor version portion of an RTEMS release])
275
276RTEMS_CPUOPT([__RTEMS_REVISION__],
277  [true],
278  [$rtems_revision],
279  [revision version portion of an RTEMS release])
280
281_RTEMS_CPUOPT_FINI
282
283AC_ENABLE_MULTILIB([Makefile],[..])
284
285# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
286AC_MSG_CHECKING([for assignable stdio])
287AC_COMPILE_IFELSE(
288  [AC_LANG_PROGRAM(
289    [#include <stdio.h>],
290    [stdin = fopen("/tmp", "r")])],
291  [HAVE_ASSIGNABLE_STDIO=yes],
292  [HAVE_ASSIGNABLE_STDIO=no])
293AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
294
295# libmisc/serdbg exploits weak symbols
296RTEMS_CHECK_GCC_WEAK
297
298# FIXME: These checks are only in here to provide
299# configuration-time diagnostics and are not really used.
300AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
301AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
302
303# FIXME: We should get rid of this.
304# So far, only used in libfs/src/nfsclient/src/dirutils.c
305AC_CHECK_SIZEOF([mode_t])
306AC_CHECK_SIZEOF([off_t])
307
308# FIXME: We should get rid of this. It's a cludge.
309AC_CHECK_SIZEOF([time_t])
310
311AC_CHECK_SIZEOF([size_t])
312
313# FIXME: Mandatory in SUSv4, optional in SUSv3.
314#   Not implemented in GCC/newlib, so far.
315AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>])
316AC_CHECK_DECLS([LONG_BIT],,,[#include <limits.h>])
317
318## BSD-ism, excluded from POSIX, but available on most platforms
319AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
320AC_CHECK_DECLS([rcmd],,,[#include <unistd.h>])
321
322## Check if libc provides BSD's strlcpy/strlcat
323AC_CHECK_FUNCS(strlcpy strlcat)
324
325## Check if libc provides decl of utime
326## FIXME: utime has been deprecated in SUSv4.
327##        and is likely to be removed in future versions.
328## FIXME (BUG in newlib): SUSv4 saids including <utime.h> should be sufficient.
329AC_CHECK_DECLS([utime],,,[#include <sys/types.h>
330#include <utime.h>])
331## Check if libc provides decl of utimes
332AC_CHECK_DECLS([utimes],,,[#include <sys/time.h>])
333
334# ... far too many conditionals ...
335AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
336AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
337
338AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
339AM_CONDITIONAL(HAS_SMP,[test "$RTEMS_HAS_SMP" = "yes"])
340
341AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
342AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
343
344AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
345AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
346AM_CONDITIONAL([LIBGNAT],[test x"$rtems_cv_HAS_POSIX_API" = x"yes" \
347&& test x"$enable_ada" = x"yes"])
348
349AM_CONDITIONAL([LIBUTF8PROC],[test $ac_cv_sizeof_size_t -gt 2])
350
351AM_CONDITIONAL([LIBDOSFS],[dnl
352test x"$ac_cv_type_uint8_t" = xyes \
353&& test x"$ac_cv_type_uint16_t" = xyes])
354
355AC_CONFIG_HEADER(config.h)
356
357## These are needed by the NFS Client
358AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
359AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
360&& test -n "$AWK" \
361&& test "$enable_rpcgen" = yes])
362
363RTEMS_AMPOLISH3
364
365# Explicitly list all Makefiles here
366AC_CONFIG_FILES([
367Doxyfile
368Makefile
369rtems/Makefile
370sapi/Makefile
371score/Makefile
372score/cpu/Makefile
373score/cpu/arm/Makefile
374score/cpu/bfin/Makefile
375score/cpu/avr/Makefile
376score/cpu/h8300/Makefile
377score/cpu/i386/Makefile
378score/cpu/lm32/Makefile
379score/cpu/m68k/Makefile
380score/cpu/m32c/Makefile
381score/cpu/m32r/Makefile
382score/cpu/mips/Makefile
383score/cpu/moxie/Makefile
384score/cpu/nios2/Makefile
385score/cpu/powerpc/Makefile
386score/cpu/sh/Makefile
387score/cpu/sparc/Makefile
388score/cpu/sparc64/Makefile
389score/cpu/v850/Makefile
390score/cpu/no_cpu/Makefile
391posix/Makefile
392libblock/Makefile
393libfs/Makefile
394libfs/src/nfsclient/Makefile
395libgnat/Makefile
396libcsupport/Makefile
397libnetworking/Makefile
398librpc/Makefile
399libmisc/Makefile
400libi2c/Makefile
401libmd/Makefile
402zlib/Makefile
403ftpd/Makefile
404telnetd/Makefile
405pppd/Makefile
406mghttpd/Makefile
407wrapup/Makefile])
408
409AC_CONFIG_COMMANDS([preinstall-stamp],
410[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
411[MAKE=${MAKE}
412with_multisubdir="$with_multisubdir"])
413
414AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.