source: rtems/cpukit/configure.ac @ 2126438a

5
Last change on this file since 2126438a was a5273ab, checked in by Hesham Almatary <hesham@…>, on 10/20/17 at 06:04:08

Add riscv32 to autotools files v3

  • 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_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  AC_CHECK_TYPES([struct _Priority_Node],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <pthread.h>])
160])
161
162AC_CHECK_HEADER([signal.h],[
163  AC_CHECK_TYPES([sighandler_t])
164])
165
166if test x"$RTEMS_USE_NEWLIB" = xyes ; then
167  AC_CHECK_DECLS([__getreent],[],[RTEMS_TOOL_CHAIN_ERROR],[#include <sys/reent.h>])
168fi
169
170AC_CHECK_HEADER([sys/socket.h],[],[])
171AM_CONDITIONAL(HAS_NEWLIB_20170522_HEADER,[test x"${ac_cv_header_sys_socket_h}" = xyes])
172
173RTEMS_CHECK_MULTIPROCESSING
174RTEMS_CHECK_POSIX_API
175RTEMS_CHECK_NETWORKING
176RTEMS_CHECK_SMP
177if test "${RTEMS_HAS_SMP}" = "yes"; then
178  AC_CHECK_HEADERS([stdatomic.h],[],[RTEMS_TOOL_CHAIN_ERROR])
179fi
180
181rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
182rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
183rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
184
185_RTEMS_CPUOPT_INIT
186
187RTEMS_CPUOPT([RTEMS_DEBUG],
188  [test x"${enable_rtems_debug}" = x"yes"],
189  [1],
190  [if RTEMS_DEBUG is enabled])
191
192RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
193  [test x"$enable_multiprocessing" = xyes],
194  [1],
195  [if multiprocessing is enabled])
196
197RTEMS_CPUOPT([RTEMS_NEWLIB],
198  [test x"$RTEMS_USE_NEWLIB" = xyes],
199  [1],
200  [if using newlib])
201
202RTEMS_CPUOPT([RTEMS_POSIX_API],
203  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
204  [1],
205  [if posix api is supported])
206
207RTEMS_CPUOPT([RTEMS_SMP],
208  [test x"$RTEMS_HAS_SMP" = xyes],
209  [1],
210  [if SMP is enabled])
211
212RTEMS_CPUOPT([RTEMS_PARAVIRT],
213  [test x"$RTEMS_HAS_PARAVIRT" = xyes],
214  [1],
215  [PARAVIRT is enabled])
216
217RTEMS_CPUOPT([RTEMS_PROFILING],
218  [test x"$RTEMS_HAS_PROFILING" = xyes],
219  [1],
220  [if profiling is enabled])
221
222RTEMS_CPUOPT([RTEMS_NETWORKING],
223  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
224  [1],
225  [if networking is enabled])
226
227RTEMS_CPUOPT([RTEMS_DRVMGR_STARTUP],
228  [test x"$enable_drvmgr" = xyes],
229  [1],
230  [if driver manager api is supported])
231
232RTEMS_CPUOPT([RTEMS_VERSION],
233  [true],
234  ["]_RTEMS_VERSION["],
235  [RTEMS version string])
236
237## Header file differences that need to be known in .h after install
238
239## Deactivate ada bindings
240RTEMS_CPUOPT([__RTEMS_ADA__],
241  [test x"${enable_ada}" = x"yes"],
242  [1],
243  [Define to 1 if ada/gnat bindings are built-in])
244
245# These are used to provide <rtems/inttypes.h
246AC_CHECK_SIZEOF([mode_t])
247AC_CHECK_SIZEOF([off_t])
248AC_CHECK_SIZEOF([time_t])
249AC_CHECK_SIZEOF([size_t])
250AC_CHECK_SIZEOF([blksize_t])
251AC_CHECK_SIZEOF([blkcnt_t])
252
253## Provide sizeof(mode_t) information via cpuopts.h
254RTEMS_CPUOPT([__RTEMS_SIZEOF_MODE_T__],
255  [true],
256  [${ac_cv_sizeof_mode_t}],
257  [sizeof(mode_t)])
258
259## Provide sizeof(off_t) information via cpuopts.h
260RTEMS_CPUOPT([__RTEMS_SIZEOF_OFF_T__],
261  [true],
262  [${ac_cv_sizeof_off_t}],
263  [sizeof(off_t)])
264
265## Provide sizeof(time_t) information via cpuopts.h
266RTEMS_CPUOPT([__RTEMS_SIZEOF_TIME_T__],
267  [true],
268  [${ac_cv_sizeof_time_t}],
269  [sizeof(time_t)])
270
271## Provide sizeof(blksize_t) information via cpuopts.h
272RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKSIZE_T__],
273  [true],
274  [${ac_cv_sizeof_blksize_t}],
275  [sizeof(blksize_t)])
276
277## Provide sizeof(blkcnt_t) information via cpuopts.h
278RTEMS_CPUOPT([__RTEMS_SIZEOF_BLKCNT_T__],
279  [true],
280  [${ac_cv_sizeof_blkcnt_t}],
281  [sizeof(blkcnt_t)])
282
283## Then we propagate a private copy of the value into cpuopts.h
284## so it is always available to the RTEMS header files.
285
286RTEMS_CPUOPT([__RTEMS_MAJOR__],
287  [true],
288  [$rtems_major],
289  [major version portion of an RTEMS release])
290
291RTEMS_CPUOPT([__RTEMS_MINOR__],
292  [true],
293  [$rtems_minor],
294  [minor version portion of an RTEMS release])
295
296RTEMS_CPUOPT([__RTEMS_REVISION__],
297  [true],
298  [$rtems_revision],
299  [revision version portion of an RTEMS release])
300
301_RTEMS_CPUOPT_FINI
302
303AC_ENABLE_MULTILIB([Makefile],[..])
304
305# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
306AC_MSG_CHECKING([for assignable stdio])
307AC_COMPILE_IFELSE(
308  [AC_LANG_PROGRAM(
309    [#include <stdio.h>],
310    [stdin = fopen("/tmp", "r")])],
311  [HAVE_ASSIGNABLE_STDIO=yes],
312  [HAVE_ASSIGNABLE_STDIO=no])
313AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
314
315# libmisc/serdbg exploits weak symbols
316RTEMS_CHECK_GCC_WEAK
317
318# FIXME: These checks are only in here to provide
319# configuration-time diagnostics and are not really used.
320AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
321AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
322
323# FIXME: Mandatory in SUSv4, optional in SUSv3.
324#   Not implemented in GCC/newlib, so far.
325AC_CHECK_DECLS([WORD_BIT],,,[#include <limits.h>])
326AC_CHECK_DECLS([LONG_BIT],,,[#include <limits.h>])
327
328## BSD-ism, excluded from POSIX, but available on most platforms
329AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
330AC_CHECK_DECLS([rcmd],,,[#include <unistd.h>])
331
332## Check if libc provides BSD's strlcpy/strlcat
333AC_CHECK_FUNCS(strlcpy strlcat)
334
335## Check if libc provides decl of utime
336## FIXME: utime has been deprecated in SUSv4.
337##        and is likely to be removed in future versions.
338## FIXME (BUG in newlib): SUSv4 saids including <utime.h> should be sufficient.
339AC_CHECK_DECLS([utime],,,[#include <sys/types.h>
340#include <utime.h>])
341## Check if libc provides decl of utimes
342AC_CHECK_DECLS([utimes],,,[#include <sys/time.h>])
343
344# ... far too many conditionals ...
345AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
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/riscv32/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_CONFIG_COMMANDS([preinstall-stamp],
493[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
494[MAKE=${MAKE}
495with_multisubdir="$with_multisubdir"])
496
497AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.