source: rtems/cpukit/configure.ac @ 4a03e752

5
Last change on this file since 4a03e752 was 4a03e752, checked in by Sebastian Huber <sebastian.huber@…>, on 01/13/17 at 08:45:59

configure: Remove SIZEOF_PTHREAD_SPINLOCK_T

  • Property mode set to 100644
File size: 14.1 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_CXX
17RTEMS_ENABLE_RTEMS_DEBUG
18RTEMS_ENABLE_NETWORKING
19RTEMS_ENABLE_PARAVIRT
20RTEMS_ENABLE_PROFILING
21RTEMS_ENABLE_DRVMGR
22
23RTEMS_ENV_RTEMSCPU
24RTEMS_CHECK_RTEMS_DEBUG
25
26AC_DEFUN([RTEMS_TOOL_CHAIN_ERROR],AC_MSG_ERROR([please update your tool chain via the RSB <https://docs.rtems.org/branches/master/rsb/quick-start.html>]))
27
28# Is this a supported CPU?
29AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
30if test -d "$srcdir/score/cpu/$RTEMS_CPU"; then
31  AC_MSG_RESULT(yes)
32else
33  AC_MSG_ERROR(no)
34fi
35
36RTEMS_PROG_CC_FOR_TARGET
37RTEMS_PROG_CXX_FOR_TARGET
38AM_PROG_CC_C_O
39RTEMS_CANONICALIZE_TOOLS
40RTEMS_PROG_CCAS
41AC_PROG_RANLIB
42
43RTEMS_CHECK_NEWLIB
44
45# BSD-isms, used throughout the sources
46# Not really used by this configure script
47# FIXME: They should be eliminated if possible.
48AC_CHECK_FUNCS([strsep strcasecmp snprintf])
49AC_CHECK_FUNCS([strdup strndup strncasecmp])
50AC_CHECK_FUNCS([bcopy bcmp])
51AC_CHECK_FUNCS([isascii fileno])
52
53# <FIXME>
54#   Check for functions supplied by newlib >= 1.17.0
55# Newlib's posix/ directory
56AC_CHECK_FUNCS([readdir_r isatty])
57AC_CHECK_FUNCS([creat \
58  opendir closedir readdir rewinddir scandir seekdir \
59  sleep \
60  telldir \
61  usleep],,
62  [RTEMS_TOOL_CHAIN_ERROR])
63AC_CHECK_FUNCS([__assert])
64AC_CHECK_FUNCS([execl execlp execle execv execvp execve])
65AC_CHECK_FUNCS([regcomp regexec regerror regfree])
66
67# Mandated by POSIX, decls not present in some versions of newlib
68AC_CHECK_DECLS([flockfile],[AC_CHECK_FUNCS([flockfile])],,[#include <stdio.h>])
69AC_CHECK_DECLS([funlockfile],[AC_CHECK_FUNCS([funlockfile])],,[#include <stdio.h>])
70AC_CHECK_DECLS([ftrylockfile],[AC_CHECK_FUNCS([ftrylockfile])],,[#include <stdio.h>])
71
72# Newlib proprietary
73AC_CHECK_HEADERS([envlock.h])
74AC_CHECK_DECLS([__env_lock],,,[#include <envlock.h>])
75AC_CHECK_DECLS([__env_unlock],,,[#include <envlock.h>])
76AC_CHECK_TYPES([struct _Thread_queue_Queue],[],[],[#include <sys/lock.h>])
77AC_CHECK_MEMBER([struct _Thread_queue_Queue._name],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <sys/lock.h>])
78
79# Mandated by POSIX, older newlibs bogusly provided CLOCK_PROCESS_CPUTIME+CLOCK_THREAD_CPUTIME
80AC_CHECK_DECL([CLOCK_PROCESS_CPUTIME_ID],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <time.h>])
81AC_CHECK_DECL([CLOCK_THREAD_CPUTIME_ID],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <time.h>])
82
83# Mandated by POSIX, decls not present in some versions of newlib,
84# some versions stubbed in newlib's rtems crt0
85RTEMS_CHECK_FUNC([seteuid],[#include <unistd.h>])
86RTEMS_CHECK_FUNC([geteuid],[#include <unistd.h>])
87RTEMS_CHECK_FUNC([setegid],[#include <unistd.h>])
88RTEMS_CHECK_FUNC([getegid],[#include <unistd.h>])
89RTEMS_CHECK_FUNC([setuid],[#include <unistd.h>])
90RTEMS_CHECK_FUNC([getuid],[#include <unistd.h>])
91RTEMS_CHECK_FUNC([setgid],[#include <unistd.h>])
92RTEMS_CHECK_FUNC([getgid],[#include <unistd.h>])
93RTEMS_CHECK_FUNC([setsid],[#include <unistd.h>])
94RTEMS_CHECK_FUNC([getsid],[#include <unistd.h>])
95RTEMS_CHECK_FUNC([setpgid],[#include <unistd.h>])
96RTEMS_CHECK_FUNC([getpgid],[#include <unistd.h>])
97RTEMS_CHECK_FUNC([setpgrp],[#include <unistd.h>])
98RTEMS_CHECK_FUNC([getpgrp],[#include <unistd.h>])
99
100# pthread-functions not declared in some versions of newlib.
101RTEMS_CHECK_FUNC([pthread_attr_getguardsize],[#include <pthread.h>])
102RTEMS_CHECK_FUNC([pthread_attr_setguardsize],[#include <pthread.h>])
103RTEMS_CHECK_FUNC([pthread_attr_setstack],[#include <pthread.h>])
104RTEMS_CHECK_FUNC([pthread_attr_getstack],[#include <pthread.h>])
105
106# These are SMP related and were added to newlib by RTEMS.
107RTEMS_CHECK_FUNC([pthread_attr_setaffinity_np],[
108  #define _GNU_SOURCE
109  #include <pthread.h>])
110RTEMS_CHECK_FUNC([pthread_attr_getaffinity_np],[
111  #define _GNU_SOURCE
112  #include <pthread.h>])
113RTEMS_CHECK_FUNC([pthread_setaffinity_np],[
114  #define _GNU_SOURCE
115  #include <pthread.h>])
116RTEMS_CHECK_FUNC([pthread_getaffinity_np],[
117  #define _GNU_SOURCE
118  #include <pthread.h>])
119RTEMS_CHECK_FUNC([pthread_getattr_np],[
120  #define _GNU_SOURCE
121  #include <pthread.h>])
122
123# This was added to newlib in August 2014 to improve conformance.
124# Disable use of internal definition if it is present.
125RTEMS_CHECK_FUNC([sigaltstack],[
126  #define _GNU_SOURCE
127  #include <signal.h>])
128
129# Mandated by POSIX, not declared in some versions of newlib.
130AC_CHECK_DECLS([getrusage],,,[#include sys/resource.h])
131
132# Newlib's unix/ directory
133AC_CHECK_FUNCS([ttyname getcwd])
134# </FIXME>
135
136# Check if the installed toolchain provides these headers
137# and error out if not.
138AC_CHECK_HEADERS([errno.h sched.h semaphore.h sys/cdefs.h sys/queue.h tar.h threads.h],,
139  [RTEMS_TOOL_CHAIN_ERROR])
140
141## error out if libc doesn't provide stdint.h
142AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
143[RTEMS_TOOL_CHAIN_ERROR])
144
145## error out if libc doesn't provide inttypes.h
146AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
147[RTEMS_TOOL_CHAIN_ERROR])
148
149AC_HEADER_STDBOOL
150AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
151[RTEMS_TOOL_CHAIN_ERROR])
152
153AC_CHECK_TYPES([ uint8_t,  int8_t])
154AC_CHECK_TYPES([uint16_t, int16_t])
155AC_CHECK_TYPES([uint32_t, int32_t])
156AC_CHECK_TYPES([uint64_t, int64_t])
157AC_CHECK_TYPES([uintmax_t, intmax_t])
158AC_CHECK_TYPES([uintptr_t, intptr_t])
159
160# Some toolchain sanity checks and diagnostics
161RTEMS_CHECK_GCC_SANITY
162
163# These are conditionally defined by the toolchain
164# FIXME: we should either conditionally compile those parts in
165# RTEMS depending on them, or abort - For now, simply check.
166AC_CHECK_HEADER([pthread.h],[
167  AC_CHECK_TYPES([pthread_rwlock_t])
168  AC_CHECK_TYPES([pthread_barrier_t])
169  AC_CHECK_TYPES([pthread_spinlock_t])
170  AC_CHECK_TYPES([struct _pthread_cleanup_context],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <pthread.h>])
171])
172
173AC_CHECK_HEADER([signal.h],[
174  AC_CHECK_TYPES([sighandler_t])
175])
176
177if test x"$RTEMS_USE_NEWLIB" = xyes ; then
178  AC_CHECK_DECLS([__getreent],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <sys/reent.h>])
179fi
180
181RTEMS_CHECK_MULTIPROCESSING
182RTEMS_CHECK_POSIX_API
183RTEMS_CHECK_NETWORKING
184RTEMS_CHECK_SMP
185if test "${RTEMS_HAS_SMP}" = "yes"; then
186  AC_CHECK_HEADERS([stdatomic.h],[],[RTEMS_TOOL_CHAIN_ERROR])
187fi
188
189rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
190rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
191rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
192
193_RTEMS_CPUOPT_INIT
194
195RTEMS_CPUOPT([RTEMS_DEBUG],
196  [test x"${enable_rtems_debug}" = x"yes"],
197  [1],
198  [if RTEMS_DEBUG is enabled])
199
200RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
201  [test x"$enable_multiprocessing" = xyes],
202  [1],
203  [if multiprocessing is enabled])
204
205RTEMS_CPUOPT([RTEMS_NEWLIB],
206  [test x"$RTEMS_USE_NEWLIB" = xyes],
207  [1],
208  [if using newlib])
209
210RTEMS_CPUOPT([RTEMS_POSIX_API],
211  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
212  [1],
213  [if posix api is supported])
214
215RTEMS_CPUOPT([RTEMS_SMP],
216  [test x"$RTEMS_HAS_SMP" = xyes],
217  [1],
218  [if SMP is enabled])
219
220RTEMS_CPUOPT([RTEMS_PARAVIRT],
221  [test x"$RTEMS_HAS_PARAVIRT" = xyes],
222  [1],
223  [PARAVIRT is enabled])
224
225RTEMS_CPUOPT([RTEMS_PROFILING],
226  [test x"$RTEMS_HAS_PROFILING" = xyes],
227  [1],
228  [if profiling is enabled])
229
230RTEMS_CPUOPT([RTEMS_NETWORKING],
231  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
232  [1],
233  [if networking is enabled])
234
235RTEMS_CPUOPT([RTEMS_DRVMGR_STARTUP],
236  [test x"$enable_drvmgr" = xyes],
237  [1],
238  [if driver manager api is supported])
239
240RTEMS_CPUOPT([RTEMS_VERSION],
241  [true],
242  ["]_RTEMS_VERSION["],
243  [RTEMS version string])
244
245## Header file differences that need to be known in .h after install
246RTEMS_CPUOPT([__RTEMS_HAVE_DECL_SIGALTSTACK__],
247  [test x"${ac_cv_have_decl_sigaltstack}" = x"yes"],
248  [1],
249  [indicate if <signal.h> in toolset has sigaltstack()])
250
251## This improves both the size and coverage analysis.
252RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
253  [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
254  [1],
255  [disable inlining _Thread_Enable_dispatch])
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
363# Filter dynamic loading to only build for architectures that have
364# reloc backends
365AC_MSG_CHECKING([whether CPU supports libdl])
366case $RTEMS_CPU in
367  arm | i386 | m68k | mips | moxie | powerpc | sparc)
368   HAVE_LIBDL=yes ;;
369  # bfin has an issue to resolve with libdl. See ticket #2252
370  bfin)
371   HAVE_LIBDL=no ;;
372  # lm32 has an issue to resolve with libdl. See ticket #2283
373  lm32)
374   HAVE_LIBDL=no ;;
375  # v850 has an issue to resolve with libdl. See ticket #2260
376  v850)
377   HAVE_LIBDL=no ;;
378  *)
379   HAVE_LIBDL=no ;;
380esac
381AM_CONDITIONAL(LIBDL,[test x"$HAVE_LIBDL" = x"yes"])
382AC_MSG_RESULT([$HAVE_LIBDL])
383
384# Filter debugger to only build for architectures that have a target backend
385AC_MSG_CHECKING([whether CPU supports libdebugger])
386case $RTEMS_CPU in
387  arm | i386)
388   HAVE_LIBDEBUGGER=yes ;;
389  *)
390   HAVE_LIBDEBUGGER=no ;;
391esac
392AM_CONDITIONAL(LIBDEBUGGER,[test x"$HAVE_LIBDEBUGGER" = x"yes"])
393AC_MSG_RESULT([$HAVE_LIBDEBUGGER])
394
395AC_MSG_CHECKING([whether CPU supports SHA])
396case $RTEMS_CPU in
397  m32c)
398   HAVE_SHA=no ;;
399  *)
400   HAVE_SHA=yes ;;
401esac
402AM_CONDITIONAL(SHA,[test x"$HAVE_SHA" = x"yes"])
403AC_MSG_RESULT([$HAVE_SHA])
404
405# Filter libpci to only build for architectures that have support for it
406AC_MSG_CHECKING([whether CPU supports libpci])
407case $RTEMS_CPU in
408  sparc)
409   HAVE_LIBPCI=yes ;;
410  *)
411   HAVE_LIBPCI=no ;;
412esac
413AM_CONDITIONAL(LIBPCI,[test x"$HAVE_LIBPCI" = x"yes"])
414AC_MSG_RESULT([$HAVE_LIBPCI])
415
416# Filter libdrvmgr to only build for architectures that have support for it
417AC_MSG_CHECKING([whether CPU supports libdrvmgr])
418case $RTEMS_CPU in
419  sparc)
420   HAVE_LIBDRVMGR=yes ;;
421  *)
422   HAVE_LIBDRVMGR=no ;;
423esac
424AM_CONDITIONAL(LIBDRVMGR,[test x"$HAVE_LIBDRVMGR" = x"yes"])
425AC_MSG_RESULT([$HAVE_LIBDRVMGR])
426
427
428RTEMS_AMPOLISH3
429
430# Explicitly list all Makefiles here
431AC_CONFIG_FILES([
432Doxyfile
433Makefile
434dev/Makefile
435dtc/libfdt/Makefile
436rtems/Makefile
437sapi/Makefile
438score/Makefile
439score/cpu/Makefile
440score/cpu/arm/Makefile
441score/cpu/bfin/Makefile
442score/cpu/epiphany/Makefile
443score/cpu/i386/Makefile
444score/cpu/lm32/Makefile
445score/cpu/m68k/Makefile
446score/cpu/m32c/Makefile
447score/cpu/mips/Makefile
448score/cpu/moxie/Makefile
449score/cpu/nios2/Makefile
450score/cpu/or1k/Makefile
451score/cpu/powerpc/Makefile
452score/cpu/sh/Makefile
453score/cpu/sparc/Makefile
454score/cpu/sparc64/Makefile
455score/cpu/v850/Makefile
456score/cpu/no_cpu/Makefile
457posix/Makefile
458libblock/Makefile
459libdrvmgr/Makefile
460libfs/Makefile
461libfs/src/nfsclient/Makefile
462libgnat/Makefile
463libcrypt/Makefile
464libcsupport/Makefile
465libnetworking/Makefile
466libpci/Makefile
467librpc/Makefile
468libmisc/Makefile
469libi2c/Makefile
470libmd/Makefile
471libdl/Makefile
472libstdthreads/Makefile
473libdebugger/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.