source: rtems/cpukit/configure.ac @ f244bfc5

4.115
Last change on this file since f244bfc5 was f244bfc5, checked in by Sebastian Huber <sebastian.huber@…>, on 03/09/15 at 12:18:35

posix: Install <semaphore.h> only if not provided

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