source: rtems/cpukit/configure.ac @ 1772a04

5
Last change on this file since 1772a04 was 1772a04, checked in by Sebastian Huber <sebastian.huber@…>, on 01/12/17 at 09:00:22

configure: Add RTEMS_TOOL_CHAIN_ERROR

Stop the build with a common error message in case the tool chain is
seriously out of date.

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