source: rtems/cpukit/configure.ac @ f785492

4.115
Last change on this file since f785492 was 12072880, checked in by Sebastian Huber <sebastian.huber@…>, on 12/04/14 at 09:03:50

Update bug report URL

  • Property mode set to 100644
File size: 13.3 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
20
21RTEMS_ENV_RTEMSCPU
22RTEMS_CHECK_RTEMS_DEBUG
23
24# Is this a supported CPU?
25AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
26if test -d "$srcdir/score/cpu/$RTEMS_CPU"; then
27  AC_MSG_RESULT(yes)
28else
29  AC_MSG_ERROR(no)
30fi
31
32RTEMS_PROG_CC_FOR_TARGET
33RTEMS_PROG_CCAS
34RTEMS_CANONICALIZE_TOOLS
35AM_PROG_CC_C_O
36AC_PROG_RANLIB
37
38RTEMS_CHECK_NEWLIB
39
40# BSD-isms, used throughout the sources
41# Not really used by this configure script
42# FIXME: They should be eliminated if possible.
43AC_CHECK_FUNCS([strsep strcasecmp snprintf])
44AC_CHECK_FUNCS([strdup strndup strncasecmp])
45AC_CHECK_FUNCS([bcopy bcmp])
46AC_CHECK_FUNCS([isascii fileno])
47
48# <FIXME>
49#   Check for functions supplied by newlib >= 1.17.0
50# Newlib's posix/ directory
51AC_CHECK_FUNCS([readdir_r isatty])
52AC_CHECK_FUNCS([creat \
53  opendir closedir readdir rewinddir scandir seekdir \
54  sleep \
55  telldir \
56  usleep],,
57  [rtems_missing_func="$ac_func";break])
58AS_IF([test -n "$rtems_missing_func"],
59  AC_MSG_ERROR([Missing function $rtems_missing_func in libc])])
60AC_CHECK_FUNCS([__assert])
61AC_CHECK_FUNCS([execl execlp execle execv execvp execve])
62AC_CHECK_FUNCS([regcomp regexec regerror regfree])
63
64# Mandated by POSIX, decls not present in some versions of newlib
65AC_CHECK_DECLS([flockfile],[AC_CHECK_FUNCS([flockfile])],,[#include <stdio.h>])
66AC_CHECK_DECLS([funlockfile],[AC_CHECK_FUNCS([funlockfile])],,[#include <stdio.h>])
67AC_CHECK_DECLS([ftrylockfile],[AC_CHECK_FUNCS([ftrylockfile])],,[#include <stdio.h>])
68
69# Newlib proprietary
70AC_CHECK_HEADERS([envlock.h])
71AC_CHECK_DECLS([__env_lock],,,[#include <envlock.h>])
72AC_CHECK_DECLS([__env_unlock],,,[#include <envlock.h>])
73
74# Mandated by POSIX, older newlibs bogusly provided CLOCK_PROCESS_CPUTIME+CLOCK_THREAD_CPUTIME
75AC_CHECK_DECL([CLOCK_PROCESS_CPUTIME_ID],[],[AC_MSG_ERROR([missing define CLOCK_PROCESS_CPUTIME_ID])],[#include <time.h>])
76AC_CHECK_DECL([CLOCK_THREAD_CPUTIME_ID],[],[AC_MSG_ERROR([missing define CLOCK_THREAD_CPUTIME_ID])],[#include <time.h>])
77
78# Mandated by POSIX, decls not present in some versions of newlib,
79# some versions stubbed in newlib's rtems crt0
80RTEMS_CHECK_FUNC([seteuid],[#include <unistd.h>])
81RTEMS_CHECK_FUNC([geteuid],[#include <unistd.h>])
82RTEMS_CHECK_FUNC([setegid],[#include <unistd.h>])
83RTEMS_CHECK_FUNC([getegid],[#include <unistd.h>])
84RTEMS_CHECK_FUNC([setuid],[#include <unistd.h>])
85RTEMS_CHECK_FUNC([getuid],[#include <unistd.h>])
86RTEMS_CHECK_FUNC([setgid],[#include <unistd.h>])
87RTEMS_CHECK_FUNC([getgid],[#include <unistd.h>])
88RTEMS_CHECK_FUNC([setsid],[#include <unistd.h>])
89RTEMS_CHECK_FUNC([getsid],[#include <unistd.h>])
90RTEMS_CHECK_FUNC([setpgid],[#include <unistd.h>])
91RTEMS_CHECK_FUNC([getpgid],[#include <unistd.h>])
92RTEMS_CHECK_FUNC([setpgrp],[#include <unistd.h>])
93RTEMS_CHECK_FUNC([getpgrp],[#include <unistd.h>])
94
95# pthread-functions not declared in some versions of newlib.
96RTEMS_CHECK_FUNC([pthread_attr_getguardsize],[#include <pthread.h>])
97RTEMS_CHECK_FUNC([pthread_attr_setguardsize],[#include <pthread.h>])
98RTEMS_CHECK_FUNC([pthread_attr_setstack],[#include <pthread.h>])
99RTEMS_CHECK_FUNC([pthread_attr_getstack],[#include <pthread.h>])
100
101# These are SMP related and were added to newlib by RTEMS.
102RTEMS_CHECK_FUNC([pthread_attr_setaffinity_np],[
103  #define _GNU_SOURCE
104  #include <pthread.h>])
105RTEMS_CHECK_FUNC([pthread_attr_getaffinity_np],[
106  #define _GNU_SOURCE
107  #include <pthread.h>])
108RTEMS_CHECK_FUNC([pthread_setaffinity_np],[
109  #define _GNU_SOURCE
110  #include <pthread.h>])
111RTEMS_CHECK_FUNC([pthread_getaffinity_np],[
112  #define _GNU_SOURCE
113  #include <pthread.h>])
114RTEMS_CHECK_FUNC([pthread_getattr_np],[
115  #define _GNU_SOURCE
116  #include <pthread.h>])
117AC_CHECK_HEADERS([sys/cpuset.h])
118
119# This was added to newlib in August 2014 to improve conformance.
120# Disable use of internal definition if it is present.
121RTEMS_CHECK_FUNC([sigaltstack],[
122  #define _GNU_SOURCE
123  #include <signal.h>])
124
125# Mandated by POSIX, not declared in some versions of newlib.
126AC_CHECK_DECLS([getrusage],,,[#include sys/resource.h])
127
128# Newlib's unix/ directory
129AC_CHECK_FUNCS([ttyname getcwd])
130# </FIXME>
131
132# Check if the installed toolchain provides these headers
133# and error out if not.
134AC_CHECK_HEADERS([tar.h errno.h sched.h sys/cdefs.h sys/queue.h],,
135  [rtems_missing_header="$ac_header";break])
136AS_IF([test -n "$rtems_missing_header"],
137  AC_MSG_ERROR([Missing required header $rtems_missing_header])])
138
139## error out if libc doesn't provide stdint.h
140AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
141[AC_MSG_ERROR([Required header stdint.h not found])])
142
143## error out if libc doesn't provide inttypes.h
144AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
145[AC_MSG_ERROR([Required header inttypes.h not found])])
146
147AC_HEADER_STDBOOL
148AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
149[AC_MSG_ERROR([No sufficient stdbool.h found])])
150
151AC_CHECK_TYPES([ uint8_t,  int8_t])
152AC_CHECK_TYPES([uint16_t, int16_t])
153AC_CHECK_TYPES([uint32_t, int32_t])
154AC_CHECK_TYPES([uint64_t, int64_t])
155AC_CHECK_TYPES([uintmax_t, intmax_t])
156AC_CHECK_TYPES([uintptr_t, intptr_t])
157
158# Some toolchain sanity checks and diagnostics
159RTEMS_CHECK_GCC_SANITY
160
161# These are conditionally defined by the toolchain
162# FIXME: we should either conditionally compile those parts in
163# RTEMS depending on them, or abort - For now, simply check.
164AC_CHECK_HEADER([pthread.h],[
165  AC_CHECK_TYPES([pthread_rwlock_t])
166  AC_CHECK_TYPES([pthread_barrier_t])
167  AC_CHECK_TYPES([pthread_spinlock_t])
168  AC_CHECK_TYPES([struct _pthread_cleanup_context],[],[],[#include <pthread.h>])
169])
170
171AC_CHECK_HEADER([signal.h],[
172  AC_CHECK_TYPES([sighandler_t])
173])
174
175RTEMS_CHECK_MULTIPROCESSING
176RTEMS_CHECK_POSIX_API
177RTEMS_CHECK_NETWORKING
178RTEMS_CHECK_SMP
179if test "${RTEMS_HAS_SMP}" = "yes"; then
180  AC_CHECK_HEADERS([stdatomic.h],[],[AC_MSG_ERROR([<stdatomic.h> is required for SMP support])])
181fi
182
183rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
184rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
185rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
186
187_RTEMS_CPUOPT_INIT
188
189RTEMS_CPUOPT([RTEMS_DEBUG],
190  [test x"${enable_rtems_debug}" = x"yes"],
191  [1],
192  [if RTEMS_DEBUG is enabled])
193
194RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
195  [test x"$enable_multiprocessing" = xyes],
196  [1],
197  [if multiprocessing is enabled])
198
199RTEMS_CPUOPT([RTEMS_NEWLIB],
200  [test x"$RTEMS_USE_NEWLIB" = xyes],
201  [1],
202  [if using newlib])
203
204RTEMS_CPUOPT([RTEMS_POSIX_API],
205  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
206  [1],
207  [if posix api is supported])
208
209RTEMS_CPUOPT([RTEMS_SMP],
210  [test x"$RTEMS_HAS_SMP" = xyes],
211  [1],
212  [if SMP is enabled])
213
214RTEMS_CPUOPT([RTEMS_PARAVIRT],
215  [test x"$RTEMS_HAS_PARAVIRT" = xyes],
216  [1],
217  [PARAVIRT is enabled])
218
219RTEMS_CPUOPT([RTEMS_PROFILING],
220  [test x"$RTEMS_HAS_PROFILING" = xyes],
221  [1],
222  [if profiling is enabled])
223
224RTEMS_CPUOPT([RTEMS_NETWORKING],
225  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
226  [1],
227  [if networking is enabled])
228
229RTEMS_CPUOPT([RTEMS_VERSION],
230  [true],
231  ["]_RTEMS_VERSION["],
232  [RTEMS version string])
233
234RTEMS_CPUOPT([__RTEMS_USE_TICKS_FOR_STATISTICS__],
235  [test x"${USE_TICKS_FOR_STATISTICS}" = x"1"],
236  [1],
237  [disable nanosecond granularity for statistics])
238
239## Header file differences that need to be known in .h after install
240RTEMS_CPUOPT([__RTEMS_HAVE_SYS_CPUSET_H__],
241  [test x"${ac_cv_header_sys_cpuset_h}" = x"yes"],
242  [1],
243  [indicate if <sys/cpuset.h> is present in toolset])
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## This improves both the size and coverage analysis.
258RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__],
259  [test x"${RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE}" = x"1"],
260  [1],
261  [disable inlining _Thread_Enable_dispatch])
262
263## This gives the same behavior as 4.8 and older
264RTEMS_CPUOPT([__RTEMS_STRICT_ORDER_MUTEX__],
265  [test x"${ENABLE_STRICT_ORDER_MUTEX}" = x"1"],
266  [1],
267  [disable strict order mutex])
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 | bfin | h8300 | i386 | lm32 | m32r | m68k | mips | \
380  moxie | powerpc | sparc | v850)
381   HAVE_LIBDL=yes ;;
382  *)
383   HAVE_LIBDL=no ;;
384esac
385AM_CONDITIONAL(LIBDL,[test x"$HAVE_LIBDL" = x"yes"])
386AC_MSG_RESULT([$HAVE_LIBDL])
387
388RTEMS_AMPOLISH3
389
390# Explicitly list all Makefiles here
391AC_CONFIG_FILES([
392Doxyfile
393Makefile
394dev/Makefile
395rtems/Makefile
396sapi/Makefile
397score/Makefile
398score/cpu/Makefile
399score/cpu/arm/Makefile
400score/cpu/bfin/Makefile
401score/cpu/avr/Makefile
402score/cpu/h8300/Makefile
403score/cpu/i386/Makefile
404score/cpu/lm32/Makefile
405score/cpu/m68k/Makefile
406score/cpu/m32c/Makefile
407score/cpu/m32r/Makefile
408score/cpu/mips/Makefile
409score/cpu/moxie/Makefile
410score/cpu/nios2/Makefile
411score/cpu/or1k/Makefile
412score/cpu/powerpc/Makefile
413score/cpu/sh/Makefile
414score/cpu/sparc/Makefile
415score/cpu/sparc64/Makefile
416score/cpu/v850/Makefile
417score/cpu/no_cpu/Makefile
418posix/Makefile
419libblock/Makefile
420libfs/Makefile
421libfs/src/nfsclient/Makefile
422libgnat/Makefile
423libcrypt/Makefile
424libcsupport/Makefile
425libnetworking/Makefile
426librpc/Makefile
427libmisc/Makefile
428libi2c/Makefile
429libmd/Makefile
430libdl/Makefile
431zlib/Makefile
432ftpd/Makefile
433telnetd/Makefile
434pppd/Makefile
435mghttpd/Makefile
436wrapup/Makefile])
437
438AC_CONFIG_COMMANDS([preinstall-stamp],
439[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
440[MAKE=${MAKE}
441with_multisubdir="$with_multisubdir"])
442
443AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.