source: rtems/cpukit/configure.ac @ b3ef89f9

Last change on this file since b3ef89f9 was b3ef89f9, checked in by Sebastian Huber <sebastian.huber@…>, on Sep 14, 2018 at 5:46:58 PM

build: Merge posix/Makefile.am

  • Property mode set to 100644
File size: 14.8 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([..],[])
7RTEMS_SOURCE_TOP
8RTEMS_BUILD_TOP
9
10RTEMS_CANONICAL_TARGET_CPU
11
12AM_INIT_AUTOMAKE([no-define nostdinc subdir-objects foreign 1.12.2])
13AM_MAINTAINER_MODE
14
15RTEMS_ENABLE_MULTIPROCESSING
16RTEMS_ENABLE_POSIX
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
37AM_PROG_CC_C_O
38RTEMS_CANONICALIZE_TOOLS
39RTEMS_PROG_CCAS
40AC_PROG_RANLIB
41
42RTEMS_CHECK_NEWLIB
43
44# BSD-isms, used throughout the sources
45# Not really used by this configure script
46# FIXME: They should be eliminated if possible.
47AC_CHECK_FUNCS([strsep strcasecmp snprintf])
48AC_CHECK_FUNCS([strdup strndup strncasecmp])
49AC_CHECK_FUNCS([bcopy bcmp])
50AC_CHECK_FUNCS([isascii fileno])
51
52# <FIXME>
53#   Check for functions supplied by newlib >= 1.17.0
54# Newlib's posix/ directory
55AC_CHECK_FUNCS([readdir_r isatty])
56AC_CHECK_FUNCS([creat \
57  opendir closedir readdir rewinddir scandir seekdir \
58  sleep \
59  telldir \
60  usleep],,
61  [RTEMS_TOOL_CHAIN_ERROR])
62AC_CHECK_FUNCS([__assert])
63AC_CHECK_FUNCS([execl execlp execle execv execvp execve])
64AC_CHECK_FUNCS([regcomp regexec regerror regfree])
65
66# Mandated by POSIX, decls not present in some versions of newlib
67AC_CHECK_DECLS([flockfile],[AC_CHECK_FUNCS([flockfile])],,[#include <stdio.h>])
68AC_CHECK_DECLS([funlockfile],[AC_CHECK_FUNCS([funlockfile])],,[#include <stdio.h>])
69AC_CHECK_DECLS([ftrylockfile],[AC_CHECK_FUNCS([ftrylockfile])],,[#include <stdio.h>])
70
71# Newlib proprietary
72AC_CHECK_MEMBER([struct _Thread_queue_Queue._name],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <sys/lock.h>])
73
74# Mandated by POSIX, older newlibs bogusly provided CLOCK_PROCESS_CPUTIME+CLOCK_THREAD_CPUTIME
75AC_CHECK_DECL([CLOCK_PROCESS_CPUTIME_ID],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <time.h>])
76AC_CHECK_DECL([CLOCK_THREAD_CPUTIME_ID],[],[RTEMS_TOOL_CHAIN_ERROR],[#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>])
117
118AC_LANG_PUSH(C)
119AC_MSG_CHECKING([for mprotect(const void *, ...)])
120AC_COMPILE_IFELSE([AC_LANG_SOURCE([
121#include <sys/mman.h>
122int mprotect(const void *, size_t, int);
123])],[
124AC_MSG_RESULT([yes])
125AC_DEFINE(HAVE_MPROTECT_CONST, [], [mprotect(const void *, ...)])
126],[
127AC_MSG_RESULT([no])
128])
129AC_MSG_CHECKING([for pthread_mutex_getprioceiling(const pthread_mutex_t *, ...)])
130AC_COMPILE_IFELSE([AC_LANG_SOURCE([
131#include <pthread.h>
132int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *);
133])],[
134AC_MSG_RESULT([yes])
135AC_DEFINE(HAVE_PTHREAD_MUTEX_GETCEILING_CONST, [], [pthread_mutex_getprioceiling(const pthread_mutex_t *, ...)])
136],[
137AC_MSG_RESULT([no])
138])
139AC_MSG_CHECKING([for pthread_setschedparam(..., const struct sched_param *)])
140AC_COMPILE_IFELSE([AC_LANG_SOURCE([
141#include <pthread.h>
142int pthread_setschedparam(pthread_t, int, const struct sched_param *);
143])],[
144AC_MSG_RESULT([yes])
145AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM_CONST, [], [pthread_setschedparam(..., const struct sched_param *)])
146],[
147AC_MSG_RESULT([no])
148])
149AC_LANG_POP(C)
150
151# Mandated by POSIX, not declared in some versions of newlib.
152AC_CHECK_DECLS([getrusage],,,[#include sys/resource.h])
153
154# Newlib's unix/ directory
155AC_CHECK_FUNCS([ttyname getcwd])
156# </FIXME>
157
158# Check if the installed toolchain provides these headers
159# and error out if not.
160AC_CHECK_HEADERS([errno.h sched.h semaphore.h sys/cdefs.h sys/queue.h tar.h threads.h],,
161  [RTEMS_TOOL_CHAIN_ERROR])
162
163## error out if libc doesn't provide stdint.h
164AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
165[RTEMS_TOOL_CHAIN_ERROR])
166
167## error out if libc doesn't provide inttypes.h
168AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
169[RTEMS_TOOL_CHAIN_ERROR])
170
171AC_HEADER_STDBOOL
172AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
173[RTEMS_TOOL_CHAIN_ERROR])
174
175AC_CHECK_TYPES([ uint8_t,  int8_t])
176AC_CHECK_TYPES([uint16_t, int16_t])
177AC_CHECK_TYPES([uint32_t, int32_t])
178AC_CHECK_TYPES([uint64_t, int64_t])
179AC_CHECK_TYPES([uintmax_t, intmax_t])
180AC_CHECK_TYPES([uintptr_t, intptr_t])
181
182# Some toolchain sanity checks and diagnostics
183RTEMS_CHECK_GCC_SANITY
184
185# These are conditionally defined by the toolchain
186# FIXME: we should either conditionally compile those parts in
187# RTEMS depending on them, or abort - For now, simply check.
188AC_CHECK_HEADER([pthread.h],[
189  AC_CHECK_TYPES([pthread_rwlock_t])
190  AC_CHECK_TYPES([pthread_barrier_t])
191  AC_CHECK_TYPES([pthread_spinlock_t])
192  AC_CHECK_TYPES([struct _pthread_cleanup_context],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <pthread.h>])
193  AC_CHECK_TYPES([struct _Priority_Node],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <pthread.h>])
194])
195
196AC_CHECK_HEADER([signal.h],[
197  AC_CHECK_TYPES([sighandler_t])
198])
199
200if test x"$RTEMS_USE_NEWLIB" = xyes ; then
201  AC_CHECK_DECLS([__getreent],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <sys/reent.h>])
202fi
203
204RTEMS_CHECK_MULTIPROCESSING
205RTEMS_CHECK_POSIX_API
206RTEMS_CHECK_NETWORKING
207RTEMS_CHECK_SMP
208if test "${RTEMS_HAS_SMP}" = "yes"; then
209  AC_CHECK_HEADERS([stdatomic.h],[],[RTEMS_TOOL_CHAIN_ERROR])
210fi
211
212rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
213rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
214rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
215
216_RTEMS_CPUOPT_INIT
217
218RTEMS_CPUOPT([RTEMS_DEBUG],
219  [test x"${enable_rtems_debug}" = x"yes"],
220  [1],
221  [if RTEMS_DEBUG is enabled])
222
223RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
224  [test x"$enable_multiprocessing" = xyes],
225  [1],
226  [if multiprocessing is enabled])
227
228RTEMS_CPUOPT([RTEMS_NEWLIB],
229  [test x"$RTEMS_USE_NEWLIB" = xyes],
230  [1],
231  [if using newlib])
232
233RTEMS_CPUOPT([RTEMS_POSIX_API],
234  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
235  [1],
236  [if posix api is supported])
237
238RTEMS_CPUOPT([RTEMS_SMP],
239  [test x"$RTEMS_HAS_SMP" = xyes],
240  [1],
241  [if SMP is enabled])
242
243RTEMS_CPUOPT([RTEMS_PARAVIRT],
244  [test x"$RTEMS_HAS_PARAVIRT" = xyes],
245  [1],
246  [PARAVIRT is enabled])
247
248RTEMS_CPUOPT([RTEMS_PROFILING],
249  [test x"$RTEMS_HAS_PROFILING" = xyes],
250  [1],
251  [if profiling is enabled])
252
253RTEMS_CPUOPT([RTEMS_NETWORKING],
254  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
255  [1],
256  [if networking is enabled])
257
258RTEMS_CPUOPT([RTEMS_DRVMGR_STARTUP],
259  [test x"$enable_drvmgr" = xyes],
260  [1],
261  [if driver manager api is supported])
262
263RTEMS_CPUOPT([RTEMS_VERSION],
264  [true],
265  ["]_RTEMS_VERSION["],
266  [RTEMS version string])
267
268## Header file differences that need to be known in .h after install
269
270## Deactivate ada bindings
271RTEMS_CPUOPT([__RTEMS_ADA__],
272  [test x"${enable_ada}" = x"yes"],
273  [1],
274  [Define to 1 if ada/gnat bindings are built-in])
275
276# These are used to provide <rtems/inttypes.h
277AC_CHECK_SIZEOF([mode_t])
278AC_CHECK_SIZEOF([off_t])
279AC_CHECK_SIZEOF([time_t])
280AC_CHECK_SIZEOF([size_t])
281AC_CHECK_SIZEOF([blksize_t])
282AC_CHECK_SIZEOF([blkcnt_t])
283
284## Provide sizeof(mode_t) information via cpuopts.h
285RTEMS_CPUOPT([__RTEMS_SIZEOF_MODE_T__],
286  [true],
287  [${ac_cv_sizeof_mode_t}],
288  [sizeof(mode_t)])
289
290## Provide sizeof(off_t) information via cpuopts.h
291RTEMS_CPUOPT([__RTEMS_SIZEOF_OFF_T__],
292  [true],
293  [${ac_cv_sizeof_off_t}],
294  [sizeof(off_t)])
295
296## Provide sizeof(time_t) information via cpuopts.h
297RTEMS_CPUOPT([__RTEMS_SIZEOF_TIME_T__],
298  [true],
299  [${ac_cv_sizeof_time_t}],
300  [sizeof(time_t)])
301
302## Provide sizeof(blksize_t) information via cpuopts.h
303RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKSIZE_T__],
304  [true],
305  [${ac_cv_sizeof_blksize_t}],
306  [sizeof(blksize_t)])
307
308## Provide sizeof(blkcnt_t) information via cpuopts.h
309RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKCNT_T__],
310  [true],
311  [${ac_cv_sizeof_blkcnt_t}],
312  [sizeof(blkcnt_t)])
313
314## Then we propagate a private copy of the value into cpuopts.h
315## so it is always available to the RTEMS header files.
316
317RTEMS_CPUOPT([__RTEMS_MAJOR__],
318  [true],
319  [$rtems_major],
320  [major version portion of an RTEMS release])
321
322RTEMS_CPUOPT([__RTEMS_MINOR__],
323  [true],
324  [$rtems_minor],
325  [minor version portion of an RTEMS release])
326
327RTEMS_CPUOPT([__RTEMS_REVISION__],
328  [true],
329  [$rtems_revision],
330  [revision version portion of an RTEMS release])
331
332_RTEMS_CPUOPT_FINI
333
334AC_ENABLE_MULTILIB([Makefile],[..])
335
336# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
337AC_MSG_CHECKING([for assignable stdio])
338AC_COMPILE_IFELSE(
339  [AC_LANG_PROGRAM(
340    [#include <stdio.h>],
341    [stdin = fopen("/tmp", "r")])],
342  [HAVE_ASSIGNABLE_STDIO=yes],
343  [HAVE_ASSIGNABLE_STDIO=no])
344AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
345
346# libmisc/serdbg exploits weak symbols
347RTEMS_CHECK_GCC_WEAK
348
349# FIXME: These checks are only in here to provide
350# configuration-time diagnostics and are not really used.
351AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
352AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
353
354# FIXME: Mandatory in SUSv4, optional in SUSv3.
355#   Not implemented in GCC/newlib, so far.
356AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>])
357AC_CHECK_DECLS([LONG_BIT],,,[#include <limits.h>])
358
359## BSD-ism, excluded from POSIX, but available on most platforms
360AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
361AC_CHECK_DECLS([rcmd],,,[#include <unistd.h>])
362
363## Check if libc provides BSD's strlcpy/strlcat
364AC_CHECK_FUNCS(strlcpy strlcat)
365
366## Check if libc provides decl of utime
367## FIXME: utime has been deprecated in SUSv4.
368##        and is likely to be removed in future versions.
369## FIXME (BUG in newlib): SUSv4 saids including <utime.h> should be sufficient.
370AC_CHECK_DECLS([utime],,,[#include <sys/types.h>
371#include <utime.h>])
372## Check if libc provides decl of utimes
373AC_CHECK_DECLS([utimes],,,[#include <sys/time.h>])
374
375# Ensure that Newlib does not provide things now in <machine/_timecounter.h>
376AC_CHECK_DECLS([_Timecounter_Time_second],[RTEMS_TOOL_CHAIN_ERROR],,[#include <sys/time.h>])
377
378# ... far too many conditionals ...
379AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
380
381AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
382AM_CONDITIONAL(HAS_SMP,[test "$RTEMS_HAS_SMP" = "yes"])
383
384AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
385AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
386
387AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
388AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
389AM_CONDITIONAL([LIBGNAT],[test x"$rtems_cv_HAS_POSIX_API" = x"yes" \
390&& test x"$enable_ada" = x"yes"])
391
392AM_CONDITIONAL([LIBUTF8PROC],[test $ac_cv_sizeof_size_t -gt 2])
393
394AM_CONDITIONAL([LIBDOSFS],[dnl
395test x"$ac_cv_type_uint8_t" = xyes \
396&& test x"$ac_cv_type_uint16_t" = xyes])
397
398AC_CONFIG_HEADER(config.h)
399
400## These are needed by the NFS Client
401AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
402AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
403&& test -n "$AWK" \
404&& test "$enable_rpcgen" = yes])
405
406# Filter dynamic loading to only build for architectures that have
407# reloc backends
408AC_MSG_CHECKING([whether CPU supports libdl])
409case $RTEMS_CPU in
410  arm | i386 | m68k | mips | moxie | powerpc | sparc)
411   HAVE_LIBDL=yes ;;
412  # bfin has an issue to resolve with libdl. See ticket #2252
413  bfin)
414   HAVE_LIBDL=no ;;
415  # lm32 has an issue to resolve with libdl. See ticket #2283
416  lm32)
417   HAVE_LIBDL=no ;;
418  # v850 has an issue to resolve with libdl. See ticket #2260
419  v850)
420   HAVE_LIBDL=no ;;
421  *)
422   HAVE_LIBDL=no ;;
423esac
424AM_CONDITIONAL(LIBDL,[test x"$HAVE_LIBDL" = x"yes"])
425AC_MSG_RESULT([$HAVE_LIBDL])
426
427# Filter debugger to only build for architectures that have a target backend
428AC_MSG_CHECKING([whether CPU supports libdebugger])
429case $RTEMS_CPU in
430  arm | i386)
431   HAVE_LIBDEBUGGER=yes ;;
432  *)
433   HAVE_LIBDEBUGGER=no ;;
434esac
435AM_CONDITIONAL(LIBDEBUGGER,[test x"$HAVE_LIBDEBUGGER" = x"yes"])
436AC_MSG_RESULT([$HAVE_LIBDEBUGGER])
437
438AC_MSG_CHECKING([whether CPU supports SHA])
439case $RTEMS_CPU in
440  m32c)
441   HAVE_SHA=no ;;
442  *)
443   HAVE_SHA=yes ;;
444esac
445AM_CONDITIONAL(SHA,[test x"$HAVE_SHA" = x"yes"])
446AC_MSG_RESULT([$HAVE_SHA])
447
448# Filter libpci to only build for architectures that have support for it
449AC_MSG_CHECKING([whether CPU supports libpci])
450case $RTEMS_CPU in
451  sparc)
452   HAVE_LIBPCI=yes ;;
453  *)
454   HAVE_LIBPCI=no ;;
455esac
456AM_CONDITIONAL(LIBPCI,[test x"$HAVE_LIBPCI" = x"yes"])
457AC_MSG_RESULT([$HAVE_LIBPCI])
458
459# Filter libdrvmgr to only build for architectures that have support for it
460AC_MSG_CHECKING([whether CPU supports libdrvmgr])
461case $RTEMS_CPU in
462  sparc)
463   HAVE_LIBDRVMGR=yes ;;
464  *)
465   HAVE_LIBDRVMGR=no ;;
466esac
467AM_CONDITIONAL(LIBDRVMGR,[test x"$HAVE_LIBDRVMGR" = x"yes"])
468AC_MSG_RESULT([$HAVE_LIBDRVMGR])
469
470
471RTEMS_AMPOLISH3
472
473# Explicitly list all Makefiles here
474AC_CONFIG_FILES([
475Doxyfile
476Makefile
477rtems/Makefile
478score/Makefile
479score/cpu/Makefile
480score/cpu/arm/Makefile
481score/cpu/bfin/Makefile
482score/cpu/epiphany/Makefile
483score/cpu/i386/Makefile
484score/cpu/lm32/Makefile
485score/cpu/m68k/Makefile
486score/cpu/m32c/Makefile
487score/cpu/mips/Makefile
488score/cpu/moxie/Makefile
489score/cpu/nios2/Makefile
490score/cpu/or1k/Makefile
491score/cpu/powerpc/Makefile
492score/cpu/riscv/Makefile
493score/cpu/sh/Makefile
494score/cpu/sparc/Makefile
495score/cpu/sparc64/Makefile
496score/cpu/v850/Makefile
497score/cpu/x86_64/Makefile
498score/cpu/no_cpu/Makefile
499libnetworking/Makefile
500libmisc/Makefile
501zlib/Makefile
502telnetd/Makefile
503pppd/Makefile
504wrapup/Makefile])
505
506AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.