source: rtems/cpukit/configure.ac @ 714617e

5
Last change on this file since 714617e was 714617e, checked in by Sebastian Huber <sebastian.huber@…>, on 01/13/17 at 10:43:40

configure: Remove RTEMS_HAVE_DECL_SIGALTSTACK

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