source: rtems/cpukit/configure.ac @ dc703190

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

configure: Remove HAVE_THREADS_H support

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