source: rtems/cpukit/configure.ac @ 9a4eca5

Last change on this file since 9a4eca5 was 9a4eca5, checked in by Chris Johns <chrisj@…>, on Aug 10, 2016 at 3:07:29 AM

build-system: Always enable C++ if the compiler is present.

We always build a C++ compiler and building with C++ does not effect
RTEMS or the runtime. This patch always enabled the support. There is
no need to manually enable it any more.

You can disable C++ with '--disable-cxx'.

If an architecture does not have a C++ compiler support is automatically
disabled.

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