source: rtems/cpukit/configure.ac @ 438ca2f

Last change on this file since 438ca2f was 438ca2f, checked in by Joel Sherrill <joel@…>, on Apr 22, 2017 at 7:15:22 PM

rtems/inttypes.h: Add blksize_t and blkcnt_t

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