source: rtems/cpukit/configure.ac @ 16f4661f

Last change on this file since 16f4661f was 16f4661f, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 9, 2018 at 7:38:18 AM

network: Optionally install network headers

Install the network headers only if --enable-networking is specified.

Update #3254.

  • Property mode set to 100644
File size: 14.1 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
118# Mandated by POSIX, not declared in some versions of newlib.
119AC_CHECK_DECLS([getrusage],,,[#include sys/resource.h])
120
121# Newlib's unix/ directory
122AC_CHECK_FUNCS([ttyname getcwd])
123# </FIXME>
124
125# Check if the installed toolchain provides these headers
126# and error out if not.
127AC_CHECK_HEADERS([errno.h sched.h semaphore.h sys/cdefs.h sys/queue.h tar.h threads.h],,
128  [RTEMS_TOOL_CHAIN_ERROR])
129
130## error out if libc doesn't provide stdint.h
131AS_IF([test x"${ac_cv_header_stdint_h}" != xyes],
132[RTEMS_TOOL_CHAIN_ERROR])
133
134## error out if libc doesn't provide inttypes.h
135AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
136[RTEMS_TOOL_CHAIN_ERROR])
137
138AC_HEADER_STDBOOL
139AS_IF([test x"${ac_cv_header_stdbool_h}" != xyes],
140[RTEMS_TOOL_CHAIN_ERROR])
141
142AC_CHECK_TYPES([ uint8_t,  int8_t])
143AC_CHECK_TYPES([uint16_t, int16_t])
144AC_CHECK_TYPES([uint32_t, int32_t])
145AC_CHECK_TYPES([uint64_t, int64_t])
146AC_CHECK_TYPES([uintmax_t, intmax_t])
147AC_CHECK_TYPES([uintptr_t, intptr_t])
148
149# Some toolchain sanity checks and diagnostics
150RTEMS_CHECK_GCC_SANITY
151
152# These are conditionally defined by the toolchain
153# FIXME: we should either conditionally compile those parts in
154# RTEMS depending on them, or abort - For now, simply check.
155AC_CHECK_HEADER([pthread.h],[
156  AC_CHECK_TYPES([pthread_rwlock_t])
157  AC_CHECK_TYPES([pthread_barrier_t])
158  AC_CHECK_TYPES([pthread_spinlock_t])
159  AC_CHECK_TYPES([struct _pthread_cleanup_context],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <pthread.h>])
160  AC_CHECK_TYPES([struct _Priority_Node],[],[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## Deactivate ada bindings
238RTEMS_CPUOPT([__RTEMS_ADA__],
239  [test x"${enable_ada}" = x"yes"],
240  [1],
241  [Define to 1 if ada/gnat bindings are built-in])
242
243# These are used to provide <rtems/inttypes.h
244AC_CHECK_SIZEOF([mode_t])
245AC_CHECK_SIZEOF([off_t])
246AC_CHECK_SIZEOF([time_t])
247AC_CHECK_SIZEOF([size_t])
248AC_CHECK_SIZEOF([blksize_t])
249AC_CHECK_SIZEOF([blkcnt_t])
250
251## Provide sizeof(mode_t) information via cpuopts.h
252RTEMS_CPUOPT([__RTEMS_SIZEOF_MODE_T__],
253  [true],
254  [${ac_cv_sizeof_mode_t}],
255  [sizeof(mode_t)])
256
257## Provide sizeof(off_t) information via cpuopts.h
258RTEMS_CPUOPT([__RTEMS_SIZEOF_OFF_T__],
259  [true],
260  [${ac_cv_sizeof_off_t}],
261  [sizeof(off_t)])
262
263## Provide sizeof(time_t) information via cpuopts.h
264RTEMS_CPUOPT([__RTEMS_SIZEOF_TIME_T__],
265  [true],
266  [${ac_cv_sizeof_time_t}],
267  [sizeof(time_t)])
268
269## Provide sizeof(blksize_t) information via cpuopts.h
270RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKSIZE_T__],
271  [true],
272  [${ac_cv_sizeof_blksize_t}],
273  [sizeof(blksize_t)])
274
275## Provide sizeof(blkcnt_t) information via cpuopts.h
276RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKCNT_T__],
277  [true],
278  [${ac_cv_sizeof_blkcnt_t}],
279  [sizeof(blkcnt_t)])
280
281## Then we propagate a private copy of the value into cpuopts.h
282## so it is always available to the RTEMS header files.
283
284RTEMS_CPUOPT([__RTEMS_MAJOR__],
285  [true],
286  [$rtems_major],
287  [major version portion of an RTEMS release])
288
289RTEMS_CPUOPT([__RTEMS_MINOR__],
290  [true],
291  [$rtems_minor],
292  [minor version portion of an RTEMS release])
293
294RTEMS_CPUOPT([__RTEMS_REVISION__],
295  [true],
296  [$rtems_revision],
297  [revision version portion of an RTEMS release])
298
299_RTEMS_CPUOPT_FINI
300
301AC_ENABLE_MULTILIB([Makefile],[..])
302
303# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
304AC_MSG_CHECKING([for assignable stdio])
305AC_COMPILE_IFELSE(
306  [AC_LANG_PROGRAM(
307    [#include <stdio.h>],
308    [stdin = fopen("/tmp", "r")])],
309  [HAVE_ASSIGNABLE_STDIO=yes],
310  [HAVE_ASSIGNABLE_STDIO=no])
311AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
312
313# libmisc/serdbg exploits weak symbols
314RTEMS_CHECK_GCC_WEAK
315
316# FIXME: These checks are only in here to provide
317# configuration-time diagnostics and are not really used.
318AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
319AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
320
321# FIXME: Mandatory in SUSv4, optional in SUSv3.
322#   Not implemented in GCC/newlib, so far.
323AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>])
324AC_CHECK_DECLS([LONG_BIT],,,[#include <limits.h>])
325
326## BSD-ism, excluded from POSIX, but available on most platforms
327AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
328AC_CHECK_DECLS([rcmd],,,[#include <unistd.h>])
329
330## Check if libc provides BSD's strlcpy/strlcat
331AC_CHECK_FUNCS(strlcpy strlcat)
332
333## Check if libc provides decl of utime
334## FIXME: utime has been deprecated in SUSv4.
335##        and is likely to be removed in future versions.
336## FIXME (BUG in newlib): SUSv4 saids including <utime.h> should be sufficient.
337AC_CHECK_DECLS([utime],,,[#include <sys/types.h>
338#include <utime.h>])
339## Check if libc provides decl of utimes
340AC_CHECK_DECLS([utimes],,,[#include <sys/time.h>])
341
342# Ensure that Newlib does not provide things now in <machine/_timecounter.h>
343AC_CHECK_DECLS([_Timecounter_Time_second],[RTEMS_TOOL_CHAIN_ERROR],,[#include <sys/time.h>])
344
345# ... far too many conditionals ...
346AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
347
348AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
349AM_CONDITIONAL(HAS_SMP,[test "$RTEMS_HAS_SMP" = "yes"])
350
351AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
352AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
353
354AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
355AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
356AM_CONDITIONAL([LIBGNAT],[test x"$rtems_cv_HAS_POSIX_API" = x"yes" \
357&& test x"$enable_ada" = x"yes"])
358
359AM_CONDITIONAL([LIBUTF8PROC],[test $ac_cv_sizeof_size_t -gt 2])
360
361AM_CONDITIONAL([LIBDOSFS],[dnl
362test x"$ac_cv_type_uint8_t" = xyes \
363&& test x"$ac_cv_type_uint16_t" = xyes])
364
365AC_CONFIG_HEADER(config.h)
366
367## These are needed by the NFS Client
368AC_CHECK_PROG(RPCGEN,rpcgen,rpcgen)
369AM_CONDITIONAL([RPCTOOLS],[test "$RPCGEN" = rpcgen \
370&& test -n "$AWK" \
371&& test "$enable_rpcgen" = yes])
372
373# Filter dynamic loading to only build for architectures that have
374# reloc backends
375AC_MSG_CHECKING([whether CPU supports libdl])
376case $RTEMS_CPU in
377  arm | i386 | m68k | mips | moxie | powerpc | sparc)
378   HAVE_LIBDL=yes ;;
379  # bfin has an issue to resolve with libdl. See ticket #2252
380  bfin)
381   HAVE_LIBDL=no ;;
382  # lm32 has an issue to resolve with libdl. See ticket #2283
383  lm32)
384   HAVE_LIBDL=no ;;
385  # v850 has an issue to resolve with libdl. See ticket #2260
386  v850)
387   HAVE_LIBDL=no ;;
388  *)
389   HAVE_LIBDL=no ;;
390esac
391AM_CONDITIONAL(LIBDL,[test x"$HAVE_LIBDL" = x"yes"])
392AC_MSG_RESULT([$HAVE_LIBDL])
393
394# Filter debugger to only build for architectures that have a target backend
395AC_MSG_CHECKING([whether CPU supports libdebugger])
396case $RTEMS_CPU in
397  arm | i386)
398   HAVE_LIBDEBUGGER=yes ;;
399  *)
400   HAVE_LIBDEBUGGER=no ;;
401esac
402AM_CONDITIONAL(LIBDEBUGGER,[test x"$HAVE_LIBDEBUGGER" = x"yes"])
403AC_MSG_RESULT([$HAVE_LIBDEBUGGER])
404
405AC_MSG_CHECKING([whether CPU supports SHA])
406case $RTEMS_CPU in
407  m32c)
408   HAVE_SHA=no ;;
409  *)
410   HAVE_SHA=yes ;;
411esac
412AM_CONDITIONAL(SHA,[test x"$HAVE_SHA" = x"yes"])
413AC_MSG_RESULT([$HAVE_SHA])
414
415# Filter libpci to only build for architectures that have support for it
416AC_MSG_CHECKING([whether CPU supports libpci])
417case $RTEMS_CPU in
418  sparc)
419   HAVE_LIBPCI=yes ;;
420  *)
421   HAVE_LIBPCI=no ;;
422esac
423AM_CONDITIONAL(LIBPCI,[test x"$HAVE_LIBPCI" = x"yes"])
424AC_MSG_RESULT([$HAVE_LIBPCI])
425
426# Filter libdrvmgr to only build for architectures that have support for it
427AC_MSG_CHECKING([whether CPU supports libdrvmgr])
428case $RTEMS_CPU in
429  sparc)
430   HAVE_LIBDRVMGR=yes ;;
431  *)
432   HAVE_LIBDRVMGR=no ;;
433esac
434AM_CONDITIONAL(LIBDRVMGR,[test x"$HAVE_LIBDRVMGR" = x"yes"])
435AC_MSG_RESULT([$HAVE_LIBDRVMGR])
436
437
438RTEMS_AMPOLISH3
439
440# Explicitly list all Makefiles here
441AC_CONFIG_FILES([
442Doxyfile
443Makefile
444dev/Makefile
445dtc/libfdt/Makefile
446rtems/Makefile
447sapi/Makefile
448score/Makefile
449score/cpu/Makefile
450score/cpu/arm/Makefile
451score/cpu/bfin/Makefile
452score/cpu/epiphany/Makefile
453score/cpu/i386/Makefile
454score/cpu/lm32/Makefile
455score/cpu/m68k/Makefile
456score/cpu/m32c/Makefile
457score/cpu/mips/Makefile
458score/cpu/moxie/Makefile
459score/cpu/nios2/Makefile
460score/cpu/or1k/Makefile
461score/cpu/powerpc/Makefile
462score/cpu/riscv/Makefile
463score/cpu/sh/Makefile
464score/cpu/sparc/Makefile
465score/cpu/sparc64/Makefile
466score/cpu/v850/Makefile
467score/cpu/no_cpu/Makefile
468posix/Makefile
469libblock/Makefile
470libdrvmgr/Makefile
471libfs/Makefile
472libfs/src/nfsclient/Makefile
473libgnat/Makefile
474libcrypt/Makefile
475libcsupport/Makefile
476libnetworking/Makefile
477libpci/Makefile
478librpc/Makefile
479libmisc/Makefile
480libi2c/Makefile
481libmd/Makefile
482libdl/Makefile
483libstdthreads/Makefile
484libdebugger/Makefile
485zlib/Makefile
486ftpd/Makefile
487telnetd/Makefile
488pppd/Makefile
489mghttpd/Makefile
490wrapup/Makefile])
491
492AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.