source: rtems/cpukit/configure.ac @ 12f93fbb

Last change on this file since 12f93fbb was 12f93fbb, checked in by Sebastian Huber <sebastian.huber@…>, on Jul 27, 2015 at 11:19:17 AM

score: Add thread queue for self-contained objects

  • Property mode set to 100644
File size: 14.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],[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
144## error out if libc doesn't provide stdint.h
145AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
146[AC_MSG_ERROR([Required header stdint.h not found])])
147
148## error out if libc doesn't provide inttypes.h
149AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
150[AC_MSG_ERROR([Required header inttypes.h not found])])
151
152AC_HEADER_STDBOOL
153AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
154[AC_MSG_ERROR([No sufficient stdbool.h found])])
155
156AC_CHECK_TYPES([ uint8_t,  int8_t])
157AC_CHECK_TYPES([uint16_t, int16_t])
158AC_CHECK_TYPES([uint32_t, int32_t])
159AC_CHECK_TYPES([uint64_t, int64_t])
160AC_CHECK_TYPES([uintmax_t, intmax_t])
161AC_CHECK_TYPES([uintptr_t, intptr_t])
162
163# Some toolchain sanity checks and diagnostics
164RTEMS_CHECK_GCC_SANITY
165
166# These are conditionally defined by the toolchain
167# FIXME: we should either conditionally compile those parts in
168# RTEMS depending on them, or abort - For now, simply check.
169AC_CHECK_HEADER([pthread.h],[
170  AC_CHECK_TYPES([pthread_rwlock_t])
171  AC_CHECK_TYPES([pthread_barrier_t])
172  AC_CHECK_TYPES([pthread_spinlock_t])
173  AC_CHECK_TYPES([struct _pthread_cleanup_context],[],[],[#include <pthread.h>])
174])
175
176AC_CHECK_HEADER([signal.h],[
177  AC_CHECK_TYPES([sighandler_t])
178])
179
180RTEMS_CHECK_MULTIPROCESSING
181RTEMS_CHECK_POSIX_API
182RTEMS_CHECK_NETWORKING
183RTEMS_CHECK_SMP
184if test "${RTEMS_HAS_SMP}" = "yes"; then
185  AC_CHECK_HEADERS([stdatomic.h],[],[AC_MSG_ERROR([<stdatomic.h> is required for SMP support])])
186fi
187
188rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
189rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
190rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
191
192_RTEMS_CPUOPT_INIT
193
194RTEMS_CPUOPT([RTEMS_DEBUG],
195  [test x"${enable_rtems_debug}" = x"yes"],
196  [1],
197  [if RTEMS_DEBUG is enabled])
198
199RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
200  [test x"$enable_multiprocessing" = xyes],
201  [1],
202  [if multiprocessing is enabled])
203
204RTEMS_CPUOPT([RTEMS_NEWLIB],
205  [test x"$RTEMS_USE_NEWLIB" = xyes],
206  [1],
207  [if using newlib])
208
209RTEMS_CPUOPT([RTEMS_POSIX_API],
210  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
211  [1],
212  [if posix api is supported])
213
214RTEMS_CPUOPT([RTEMS_SMP],
215  [test x"$RTEMS_HAS_SMP" = xyes],
216  [1],
217  [if SMP is enabled])
218
219RTEMS_CPUOPT([RTEMS_PARAVIRT],
220  [test x"$RTEMS_HAS_PARAVIRT" = xyes],
221  [1],
222  [PARAVIRT is enabled])
223
224RTEMS_CPUOPT([RTEMS_PROFILING],
225  [test x"$RTEMS_HAS_PROFILING" = xyes],
226  [1],
227  [if profiling is enabled])
228
229RTEMS_CPUOPT([RTEMS_NETWORKING],
230  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
231  [1],
232  [if networking is enabled])
233
234RTEMS_CPUOPT([RTEMS_DRVMGR_STARTUP],
235  [test x"$enable_drvmgr" = xyes],
236  [1],
237  [if driver manager api is supported])
238
239RTEMS_CPUOPT([RTEMS_VERSION],
240  [true],
241  ["]_RTEMS_VERSION["],
242  [RTEMS version string])
243
244## Header file differences that need to be known in .h after install
245RTEMS_CPUOPT([__RTEMS_HAVE_SYS_CPUSET_H__],
246  [test x"${ac_cv_header_sys_cpuset_h}" = x"yes"],
247  [1],
248  [indicate if <sys/cpuset.h> is present in toolset])
249
250## Header file differences that need to be known in .h after install
251RTEMS_CPUOPT([__RTEMS_HAVE_DECL_SIGALTSTACK__],
252  [test x"${ac_cv_have_decl_sigaltstack}" = x"yes"],
253  [1],
254  [indicate if <signal.h> in toolset has sigaltstack()])
255
256## This improves both the size and coverage analysis.
257RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
258  [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
259  [1],
260  [disable inlining _Thread_Enable_dispatch])
261
262## This improves both the size and coverage analysis.
263RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__],
264  [test x"${RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE}" = x"1"],
265  [1],
266  [disable inlining _Thread_Enable_dispatch])
267
268## This gives the same behavior as 4.8 and older
269RTEMS_CPUOPT([__RTEMS_STRICT_ORDER_MUTEX__],
270  [test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
271  [1],
272  [disable strict order mutex])
273
274## Deactivate ada bindings
275RTEMS_CPUOPT([__RTEMS_ADA__],
276  [test x"${enable_ada}" = x"yes"],
277  [1],
278  [Define to 1 if ada/gnat bindings are built-in])
279
280## Then we propagate a private copy of the value into cpuopts.h
281## so it is always available to the RTEMS header files.
282
283RTEMS_CPUOPT([__RTEMS_MAJOR__],
284  [true],
285  [$rtems_major],
286  [major version portion of an RTEMS release])
287
288RTEMS_CPUOPT([__RTEMS_MINOR__],
289  [true],
290  [$rtems_minor],
291  [minor version portion of an RTEMS release])
292
293RTEMS_CPUOPT([__RTEMS_REVISION__],
294  [true],
295  [$rtems_revision],
296  [revision version portion of an RTEMS release])
297
298_RTEMS_CPUOPT_FINI
299
300AC_ENABLE_MULTILIB([Makefile],[..])
301
302# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
303AC_MSG_CHECKING([for assignable stdio])
304AC_COMPILE_IFELSE(
305  [AC_LANG_PROGRAM(
306    [#include <stdio.h>],
307    [stdin = fopen("/tmp", "r")])],
308  [HAVE_ASSIGNABLE_STDIO=yes],
309  [HAVE_ASSIGNABLE_STDIO=no])
310AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
311
312# libmisc/serdbg exploits weak symbols
313RTEMS_CHECK_GCC_WEAK
314
315# FIXME: These checks are only in here to provide
316# configuration-time diagnostics and are not really used.
317AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
318AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
319
320# FIXME: We should get rid of this.
321# So far, only used in libfs/src/nfsclient/src/dirutils.c
322AC_CHECK_SIZEOF([mode_t])
323AC_CHECK_SIZEOF([off_t])
324
325# FIXME: We should get rid of this. It's a cludge.
326AC_CHECK_SIZEOF([time_t])
327
328AC_CHECK_SIZEOF([size_t])
329
330# FIXME: Mandatory in SUSv4, optional in SUSv3.
331#   Not implemented in GCC/newlib, so far.
332AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>])
333AC_CHECK_DECLS([LONG_BIT],,,[#include <limits.h>])
334
335## BSD-ism, excluded from POSIX, but available on most platforms
336AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
337AC_CHECK_DECLS([rcmd],,,[#include <unistd.h>])
338
339## Check if libc provides BSD's strlcpy/strlcat
340AC_CHECK_FUNCS(strlcpy strlcat)
341
342## Check if libc provides decl of utime
343## FIXME: utime has been deprecated in SUSv4.
344##        and is likely to be removed in future versions.
345## FIXME (BUG in newlib): SUSv4 saids including <utime.h> should be sufficient.
346AC_CHECK_DECLS([utime],,,[#include <sys/types.h>
347#include <utime.h>])
348## Check if libc provides decl of utimes
349AC_CHECK_DECLS([utimes],,,[#include <sys/time.h>])
350
351# ... far too many conditionals ...
352AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
353AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
354
355AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
356AM_CONDITIONAL(HAS_SMP,[test "$RTEMS_HAS_SMP" = "yes"])
357
358AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
359AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
360
361AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
362AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
363AM_CONDITIONAL([LIBGNAT],[test x"$rtems_cv_HAS_POSIX_API" = x"yes" \
364&& test x"$enable_ada" = x"yes"])
365
366AM_CONDITIONAL([LIBUTF8PROC],[test $ac_cv_sizeof_size_t -gt 2])
367
368AM_CONDITIONAL([LIBDOSFS],[dnl
369test x"$ac_cv_type_uint8_t" = xyes \
370&& test x"$ac_cv_type_uint16_t" = xyes])
371
372AC_CONFIG_HEADER(config.h)
373
374## These are needed by the NFS Client
375AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
376AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
377&& test -n "$AWK" \
378&& test "$enable_rpcgen" = yes])
379
380# Filter dynamic loading to only build for architectures that have
381# reloc backends
382AC_MSG_CHECKING([whether CPU supports libdl])
383case $RTEMS_CPU in
384  arm | i386 | m32r | m68k | mips | \
385  moxie | powerpc | sparc)
386   HAVE_LIBDL=yes ;;
387  # bfin has an issue to resolve with libdl. See ticket #2252
388  bfin)
389   HAVE_LIBDL=no ;;
390  # h8300 has an issue to resolve with libdl. See ticket #2284
391  h8300)
392   HAVE_LIBDL=no ;;
393  # lm32 has an issue to resolve with libdl. See ticket #2283
394  lm32)
395   HAVE_LIBDL=no ;;
396  # v850 has an issue to resolve with libdl. See ticket #2260
397  v850)
398   HAVE_LIBDL=no ;;
399  *)
400   HAVE_LIBDL=no ;;
401esac
402AM_CONDITIONAL(LIBDL,[test x"$HAVE_LIBDL" = x"yes"])
403AC_MSG_RESULT([$HAVE_LIBDL])
404
405AC_MSG_CHECKING([whether CPU supports SHA])
406case $RTEMS_CPU in
407  m32c)
408   HAVE_SHA=no ;;
409  *)
410   HAVE_SHA=yes ;;
411esac
412AM_CONDITIONAL(SHA,[test x"$HAVE_SHA" = x"yes"])
413AC_MSG_RESULT([$HAVE_SHA])
414
415# Filter libpci to only build for architectures that have support for it
416AC_MSG_CHECKING([whether CPU supports libpci])
417case $RTEMS_CPU in
418  sparc)
419   HAVE_LIBPCI=yes ;;
420  *)
421   HAVE_LIBPCI=no ;;
422esac
423AM_CONDITIONAL(LIBPCI,[test x"$HAVE_LIBPCI" = x"yes"])
424AC_MSG_RESULT([$HAVE_LIBPCI])
425
426# Filter libdrvmgr to only build for architectures that have support for it
427AC_MSG_CHECKING([whether CPU supports libdrvmgr])
428case $RTEMS_CPU in
429  sparc)
430   HAVE_LIBDRVMGR=yes ;;
431  *)
432   HAVE_LIBDRVMGR=no ;;
433esac
434AM_CONDITIONAL(LIBDRVMGR,[test x"$HAVE_LIBDRVMGR" = x"yes"])
435AC_MSG_RESULT([$HAVE_LIBDRVMGR])
436
437
438RTEMS_AMPOLISH3
439
440# Explicitly list all Makefiles here
441AC_CONFIG_FILES([
442Doxyfile
443Makefile
444dev/Makefile
445rtems/Makefile
446sapi/Makefile
447score/Makefile
448score/cpu/Makefile
449score/cpu/arm/Makefile
450score/cpu/bfin/Makefile
451score/cpu/avr/Makefile
452score/cpu/epiphany/Makefile
453score/cpu/h8300/Makefile
454score/cpu/i386/Makefile
455score/cpu/lm32/Makefile
456score/cpu/m68k/Makefile
457score/cpu/m32c/Makefile
458score/cpu/m32r/Makefile
459score/cpu/mips/Makefile
460score/cpu/moxie/Makefile
461score/cpu/nios2/Makefile
462score/cpu/or1k/Makefile
463score/cpu/powerpc/Makefile
464score/cpu/sh/Makefile
465score/cpu/sparc/Makefile
466score/cpu/sparc64/Makefile
467score/cpu/v850/Makefile
468score/cpu/no_cpu/Makefile
469posix/Makefile
470libblock/Makefile
471libdrvmgr/Makefile
472libfs/Makefile
473libfs/src/nfsclient/Makefile
474libgnat/Makefile
475libcrypt/Makefile
476libcsupport/Makefile
477libnetworking/Makefile
478libpci/Makefile
479librpc/Makefile
480libmisc/Makefile
481libi2c/Makefile
482libmd/Makefile
483libdl/Makefile
484zlib/Makefile
485ftpd/Makefile
486telnetd/Makefile
487pppd/Makefile
488mghttpd/Makefile
489wrapup/Makefile])
490
491AC_CONFIG_COMMANDS([preinstall-stamp],
492[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
493[MAKE=${MAKE}
494with_multisubdir="$with_multisubdir"])
495
496AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.