source: rtems/cpukit/configure.ac @ d5cc9fd6

5
Last change on this file since d5cc9fd6 was d5cc9fd6, checked in by Sebastian Huber <sebastian.huber@…>, on 04/28/16 at 04:51:25

score: RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE

Delete RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE as a preparation to
restructure the CORE mutex variants and reduce the branch complexity.

  • Property mode set to 100644
File size: 14.4 KB
Line 
1## Process this file with autoconf to produce a configure script.
2
3AC_PREREQ([2.69])
4AC_INIT([rtems-cpukit],[_RTEMS_VERSION],[https://devel.rtems.org/newticket])
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
19RTEMS_ENABLE_PROFILING
20RTEMS_ENABLE_DRVMGR
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
34RTEMS_PROG_CCAS
35RTEMS_CANONICALIZE_TOOLS
36AM_PROG_CC_C_O
37AC_PROG_RANLIB
38
39RTEMS_CHECK_NEWLIB
40
41# BSD-isms, used throughout the sources
42# Not really used by this configure script
43# FIXME: They should be eliminated if possible.
44AC_CHECK_FUNCS([strsep strcasecmp snprintf])
45AC_CHECK_FUNCS([strdup strndup strncasecmp])
46AC_CHECK_FUNCS([bcopy bcmp])
47AC_CHECK_FUNCS([isascii fileno])
48
49# <FIXME>
50#   Check for functions supplied by newlib >= 1.17.0
51# Newlib's posix/ directory
52AC_CHECK_FUNCS([readdir_r isatty])
53AC_CHECK_FUNCS([creat \
54  opendir closedir readdir rewinddir scandir seekdir \
55  sleep \
56  telldir \
57  usleep],,
58  [rtems_missing_func="$ac_func";break])
59AS_IF([test -n "$rtems_missing_func"],
60  AC_MSG_ERROR([Missing function $rtems_missing_func in libc])])
61AC_CHECK_FUNCS([__assert])
62AC_CHECK_FUNCS([execl execlp execle execv execvp execve])
63AC_CHECK_FUNCS([regcomp regexec regerror regfree])
64
65# Mandated by POSIX, decls not present in some versions of newlib
66AC_CHECK_DECLS([flockfile],[AC_CHECK_FUNCS([flockfile])],,[#include <stdio.h>])
67AC_CHECK_DECLS([funlockfile],[AC_CHECK_FUNCS([funlockfile])],,[#include <stdio.h>])
68AC_CHECK_DECLS([ftrylockfile],[AC_CHECK_FUNCS([ftrylockfile])],,[#include <stdio.h>])
69
70# Newlib proprietary
71AC_CHECK_HEADERS([envlock.h])
72AC_CHECK_DECLS([__env_lock],,,[#include <envlock.h>])
73AC_CHECK_DECLS([__env_unlock],,,[#include <envlock.h>])
74AC_CHECK_TYPES([struct _Thread_queue_Queue],[],[],[#include <sys/lock.h>])
75
76# Mandated by POSIX, older newlibs bogusly provided CLOCK_PROCESS_CPUTIME+CLOCK_THREAD_CPUTIME
77AC_CHECK_DECL([CLOCK_PROCESS_CPUTIME_ID],[],[AC_MSG_ERROR([missing define CLOCK_PROCESS_CPUTIME_ID])],[#include <time.h>])
78AC_CHECK_DECL([CLOCK_THREAD_CPUTIME_ID],[],[AC_MSG_ERROR([missing define CLOCK_THREAD_CPUTIME_ID])],[#include <time.h>])
79
80# Mandated by POSIX, decls not present in some versions of newlib,
81# some versions stubbed in newlib's rtems crt0
82RTEMS_CHECK_FUNC([seteuid],[#include <unistd.h>])
83RTEMS_CHECK_FUNC([geteuid],[#include <unistd.h>])
84RTEMS_CHECK_FUNC([setegid],[#include <unistd.h>])
85RTEMS_CHECK_FUNC([getegid],[#include <unistd.h>])
86RTEMS_CHECK_FUNC([setuid],[#include <unistd.h>])
87RTEMS_CHECK_FUNC([getuid],[#include <unistd.h>])
88RTEMS_CHECK_FUNC([setgid],[#include <unistd.h>])
89RTEMS_CHECK_FUNC([getgid],[#include <unistd.h>])
90RTEMS_CHECK_FUNC([setsid],[#include <unistd.h>])
91RTEMS_CHECK_FUNC([getsid],[#include <unistd.h>])
92RTEMS_CHECK_FUNC([setpgid],[#include <unistd.h>])
93RTEMS_CHECK_FUNC([getpgid],[#include <unistd.h>])
94RTEMS_CHECK_FUNC([setpgrp],[#include <unistd.h>])
95RTEMS_CHECK_FUNC([getpgrp],[#include <unistd.h>])
96
97# pthread-functions not declared in some versions of newlib.
98RTEMS_CHECK_FUNC([pthread_attr_getguardsize],[#include <pthread.h>])
99RTEMS_CHECK_FUNC([pthread_attr_setguardsize],[#include <pthread.h>])
100RTEMS_CHECK_FUNC([pthread_attr_setstack],[#include <pthread.h>])
101RTEMS_CHECK_FUNC([pthread_attr_getstack],[#include <pthread.h>])
102
103# These are SMP related and were added to newlib by RTEMS.
104RTEMS_CHECK_FUNC([pthread_attr_setaffinity_np],[
105  #define _GNU_SOURCE
106  #include <pthread.h>])
107RTEMS_CHECK_FUNC([pthread_attr_getaffinity_np],[
108  #define _GNU_SOURCE
109  #include <pthread.h>])
110RTEMS_CHECK_FUNC([pthread_setaffinity_np],[
111  #define _GNU_SOURCE
112  #include <pthread.h>])
113RTEMS_CHECK_FUNC([pthread_getaffinity_np],[
114  #define _GNU_SOURCE
115  #include <pthread.h>])
116RTEMS_CHECK_FUNC([pthread_getattr_np],[
117  #define _GNU_SOURCE
118  #include <pthread.h>])
119AC_CHECK_HEADERS([sys/cpuset.h])
120
121# This was added to newlib in August 2014 to improve conformance.
122# Disable use of internal definition if it is present.
123RTEMS_CHECK_FUNC([sigaltstack],[
124  #define _GNU_SOURCE
125  #include <signal.h>])
126
127# Mandated by POSIX, not declared in some versions of newlib.
128AC_CHECK_DECLS([getrusage],,,[#include sys/resource.h])
129
130# Newlib's unix/ directory
131AC_CHECK_FUNCS([ttyname getcwd])
132# </FIXME>
133
134# Check if the installed toolchain provides these headers
135# and error out if not.
136AC_CHECK_HEADERS([tar.h errno.h sched.h sys/cdefs.h sys/queue.h],,
137  [rtems_missing_header="$ac_header";break])
138AS_IF([test -n "$rtems_missing_header"],
139  AC_MSG_ERROR([Missing required header $rtems_missing_header])])
140
141AC_CHECK_HEADERS([semaphore.h])
142AM_CONDITIONAL([HAVE_SEMAPHORE_H],[test x"$ac_cv_header_semaphore_h" = x"yes"])
143
144AC_CHECK_HEADERS([threads.h])
145AM_CONDITIONAL([HAVE_THREADS_H],[test x"$ac_cv_header_threads_h" = x"yes"])
146
147## error out if libc doesn't provide stdint.h
148AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
149[AC_MSG_ERROR([Required header stdint.h not found])])
150
151## error out if libc doesn't provide inttypes.h
152AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
153[AC_MSG_ERROR([Required header inttypes.h not found])])
154
155AC_HEADER_STDBOOL
156AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
157[AC_MSG_ERROR([No sufficient stdbool.h found])])
158
159AC_CHECK_TYPES([ uint8_t,  int8_t])
160AC_CHECK_TYPES([uint16_t, int16_t])
161AC_CHECK_TYPES([uint32_t, int32_t])
162AC_CHECK_TYPES([uint64_t, int64_t])
163AC_CHECK_TYPES([uintmax_t, intmax_t])
164AC_CHECK_TYPES([uintptr_t, intptr_t])
165
166# Some toolchain sanity checks and diagnostics
167RTEMS_CHECK_GCC_SANITY
168
169# These are conditionally defined by the toolchain
170# FIXME: we should either conditionally compile those parts in
171# RTEMS depending on them, or abort - For now, simply check.
172AC_CHECK_HEADER([pthread.h],[
173  AC_CHECK_TYPES([pthread_rwlock_t])
174  AC_CHECK_TYPES([pthread_barrier_t])
175  AC_CHECK_TYPES([pthread_spinlock_t])
176  AC_CHECK_TYPES([struct _pthread_cleanup_context],[],[AC_MSG_ERROR([struct _pthread_cleanup_context in <pthread.h> is mandatory])],[#include <pthread.h>])
177])
178
179AC_CHECK_HEADER([signal.h],[
180  AC_CHECK_TYPES([sighandler_t])
181])
182
183if test x"$RTEMS_USE_NEWLIB" = xyes ; then
184  AC_CHECK_DECLS([__getreent],[],[AC_MSG_ERROR([__getreent() in <sys/reent.h> is mandatory])],[#include <sys/reent.h>])
185fi
186
187RTEMS_CHECK_MULTIPROCESSING
188RTEMS_CHECK_POSIX_API
189RTEMS_CHECK_NETWORKING
190RTEMS_CHECK_SMP
191if test "${RTEMS_HAS_SMP}" = "yes"; then
192  AC_CHECK_HEADERS([stdatomic.h],[],[AC_MSG_ERROR([<stdatomic.h> is required for SMP support])])
193fi
194
195rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
196rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
197rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
198
199_RTEMS_CPUOPT_INIT
200
201RTEMS_CPUOPT([RTEMS_DEBUG],
202  [test x"${enable_rtems_debug}" = x"yes"],
203  [1],
204  [if RTEMS_DEBUG is enabled])
205
206RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
207  [test x"$enable_multiprocessing" = xyes],
208  [1],
209  [if multiprocessing is enabled])
210
211RTEMS_CPUOPT([RTEMS_NEWLIB],
212  [test x"$RTEMS_USE_NEWLIB" = xyes],
213  [1],
214  [if using newlib])
215
216RTEMS_CPUOPT([RTEMS_POSIX_API],
217  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
218  [1],
219  [if posix api is supported])
220
221RTEMS_CPUOPT([RTEMS_SMP],
222  [test x"$RTEMS_HAS_SMP" = xyes],
223  [1],
224  [if SMP is enabled])
225
226RTEMS_CPUOPT([RTEMS_PARAVIRT],
227  [test x"$RTEMS_HAS_PARAVIRT" = xyes],
228  [1],
229  [PARAVIRT is enabled])
230
231RTEMS_CPUOPT([RTEMS_PROFILING],
232  [test x"$RTEMS_HAS_PROFILING" = xyes],
233  [1],
234  [if profiling is enabled])
235
236RTEMS_CPUOPT([RTEMS_NETWORKING],
237  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
238  [1],
239  [if networking is enabled])
240
241RTEMS_CPUOPT([RTEMS_DRVMGR_STARTUP],
242  [test x"$enable_drvmgr" = xyes],
243  [1],
244  [if driver manager api is supported])
245
246RTEMS_CPUOPT([RTEMS_VERSION],
247  [true],
248  ["]_RTEMS_VERSION["],
249  [RTEMS version string])
250
251## Header file differences that need to be known in .h after install
252RTEMS_CPUOPT([__RTEMS_HAVE_SYS_CPUSET_H__],
253  [test x"${ac_cv_header_sys_cpuset_h}" = x"yes"],
254  [1],
255  [indicate if <sys/cpuset.h> is present in toolset])
256
257## Header file differences that need to be known in .h after install
258RTEMS_CPUOPT([__RTEMS_HAVE_DECL_SIGALTSTACK__],
259  [test x"${ac_cv_have_decl_sigaltstack}" = x"yes"],
260  [1],
261  [indicate if <signal.h> in toolset has sigaltstack()])
262
263## This improves both the size and coverage analysis.
264RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
265  [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
266  [1],
267  [disable inlining _Thread_Enable_dispatch])
268
269## Deactivate ada bindings
270RTEMS_CPUOPT([__RTEMS_ADA__],
271  [test x"${enable_ada}" = x"yes"],
272  [1],
273  [Define to 1 if ada/gnat bindings are built-in])
274
275## Then we propagate a private copy of the value into cpuopts.h
276## so it is always available to the RTEMS header files.
277
278RTEMS_CPUOPT([__RTEMS_MAJOR__],
279  [true],
280  [$rtems_major],
281  [major version portion of an RTEMS release])
282
283RTEMS_CPUOPT([__RTEMS_MINOR__],
284  [true],
285  [$rtems_minor],
286  [minor version portion of an RTEMS release])
287
288RTEMS_CPUOPT([__RTEMS_REVISION__],
289  [true],
290  [$rtems_revision],
291  [revision version portion of an RTEMS release])
292
293_RTEMS_CPUOPT_FINI
294
295AC_ENABLE_MULTILIB([Makefile],[..])
296
297# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
298AC_MSG_CHECKING([for assignable stdio])
299AC_COMPILE_IFELSE(
300  [AC_LANG_PROGRAM(
301    [#include <stdio.h>],
302    [stdin = fopen("/tmp", "r")])],
303  [HAVE_ASSIGNABLE_STDIO=yes],
304  [HAVE_ASSIGNABLE_STDIO=no])
305AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
306
307# libmisc/serdbg exploits weak symbols
308RTEMS_CHECK_GCC_WEAK
309
310# FIXME: These checks are only in here to provide
311# configuration-time diagnostics and are not really used.
312AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
313AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
314
315# FIXME: We should get rid of this.
316# So far, only used in libfs/src/nfsclient/src/dirutils.c
317AC_CHECK_SIZEOF([mode_t])
318AC_CHECK_SIZEOF([off_t])
319
320# FIXME: We should get rid of this. It's a cludge.
321AC_CHECK_SIZEOF([time_t])
322
323AC_CHECK_SIZEOF([size_t])
324
325# FIXME: Mandatory in SUSv4, optional in SUSv3.
326#   Not implemented in GCC/newlib, so far.
327AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>])
328AC_CHECK_DECLS([LONG_BIT],,,[#include <limits.h>])
329
330## BSD-ism, excluded from POSIX, but available on most platforms
331AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
332AC_CHECK_DECLS([rcmd],,,[#include <unistd.h>])
333
334## Check if libc provides BSD's strlcpy/strlcat
335AC_CHECK_FUNCS(strlcpy strlcat)
336
337## Check if libc provides decl of utime
338## FIXME: utime has been deprecated in SUSv4.
339##        and is likely to be removed in future versions.
340## FIXME (BUG in newlib): SUSv4 saids including <utime.h> should be sufficient.
341AC_CHECK_DECLS([utime],,,[#include <sys/types.h>
342#include <utime.h>])
343## Check if libc provides decl of utimes
344AC_CHECK_DECLS([utimes],,,[#include <sys/time.h>])
345
346# ... far too many conditionals ...
347AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
348AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
349
350AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
351AM_CONDITIONAL(HAS_SMP,[test "$RTEMS_HAS_SMP" = "yes"])
352
353AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
354AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
355
356AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
357AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
358AM_CONDITIONAL([LIBGNAT],[test x"$rtems_cv_HAS_POSIX_API" = x"yes" \
359&& test x"$enable_ada" = x"yes"])
360
361AM_CONDITIONAL([LIBUTF8PROC],[test $ac_cv_sizeof_size_t -gt 2])
362
363AM_CONDITIONAL([LIBDOSFS],[dnl
364test x"$ac_cv_type_uint8_t" = xyes \
365&& test x"$ac_cv_type_uint16_t" = xyes])
366
367AC_CONFIG_HEADER(config.h)
368
369## These are needed by the NFS Client
370AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
371AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
372&& test -n "$AWK" \
373&& test "$enable_rpcgen" = yes])
374
375# Filter dynamic loading to only build for architectures that have
376# reloc backends
377AC_MSG_CHECKING([whether CPU supports libdl])
378case $RTEMS_CPU in
379  arm | i386 | m68k | mips | moxie | powerpc | sparc)
380   HAVE_LIBDL=yes ;;
381  # bfin has an issue to resolve with libdl. See ticket #2252
382  bfin)
383   HAVE_LIBDL=no ;;
384  # lm32 has an issue to resolve with libdl. See ticket #2283
385  lm32)
386   HAVE_LIBDL=no ;;
387  # v850 has an issue to resolve with libdl. See ticket #2260
388  v850)
389   HAVE_LIBDL=no ;;
390  *)
391   HAVE_LIBDL=no ;;
392esac
393AM_CONDITIONAL(LIBDL,[test x"$HAVE_LIBDL" = x"yes"])
394AC_MSG_RESULT([$HAVE_LIBDL])
395
396AC_MSG_CHECKING([whether CPU supports SHA])
397case $RTEMS_CPU in
398  m32c)
399   HAVE_SHA=no ;;
400  *)
401   HAVE_SHA=yes ;;
402esac
403AM_CONDITIONAL(SHA,[test x"$HAVE_SHA" = x"yes"])
404AC_MSG_RESULT([$HAVE_SHA])
405
406# Filter libpci to only build for architectures that have support for it
407AC_MSG_CHECKING([whether CPU supports libpci])
408case $RTEMS_CPU in
409  sparc)
410   HAVE_LIBPCI=yes ;;
411  *)
412   HAVE_LIBPCI=no ;;
413esac
414AM_CONDITIONAL(LIBPCI,[test x"$HAVE_LIBPCI" = x"yes"])
415AC_MSG_RESULT([$HAVE_LIBPCI])
416
417# Filter libdrvmgr to only build for architectures that have support for it
418AC_MSG_CHECKING([whether CPU supports libdrvmgr])
419case $RTEMS_CPU in
420  sparc)
421   HAVE_LIBDRVMGR=yes ;;
422  *)
423   HAVE_LIBDRVMGR=no ;;
424esac
425AM_CONDITIONAL(LIBDRVMGR,[test x"$HAVE_LIBDRVMGR" = x"yes"])
426AC_MSG_RESULT([$HAVE_LIBDRVMGR])
427
428
429RTEMS_AMPOLISH3
430
431# Explicitly list all Makefiles here
432AC_CONFIG_FILES([
433Doxyfile
434Makefile
435dev/Makefile
436dtc/libfdt/Makefile
437rtems/Makefile
438sapi/Makefile
439score/Makefile
440score/cpu/Makefile
441score/cpu/arm/Makefile
442score/cpu/bfin/Makefile
443score/cpu/epiphany/Makefile
444score/cpu/i386/Makefile
445score/cpu/lm32/Makefile
446score/cpu/m68k/Makefile
447score/cpu/m32c/Makefile
448score/cpu/mips/Makefile
449score/cpu/moxie/Makefile
450score/cpu/nios2/Makefile
451score/cpu/or1k/Makefile
452score/cpu/powerpc/Makefile
453score/cpu/sh/Makefile
454score/cpu/sparc/Makefile
455score/cpu/sparc64/Makefile
456score/cpu/v850/Makefile
457score/cpu/no_cpu/Makefile
458posix/Makefile
459libblock/Makefile
460libdrvmgr/Makefile
461libfs/Makefile
462libfs/src/nfsclient/Makefile
463libgnat/Makefile
464libcrypt/Makefile
465libcsupport/Makefile
466libnetworking/Makefile
467libpci/Makefile
468librpc/Makefile
469libmisc/Makefile
470libi2c/Makefile
471libmd/Makefile
472libdl/Makefile
473libstdthreads/Makefile
474zlib/Makefile
475ftpd/Makefile
476telnetd/Makefile
477pppd/Makefile
478mghttpd/Makefile
479wrapup/Makefile])
480
481AC_CONFIG_COMMANDS([preinstall-stamp],
482[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
483[MAKE=${MAKE}
484with_multisubdir="$with_multisubdir"])
485
486AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.