[66387986] | 1 | ## Process this file with autoconf to produce a configure script. |
---|
| 2 | ## |
---|
| 3 | ## $Id$ |
---|
[eb299afc] | 4 | |
---|
[9b353a5] | 5 | AC_PREREQ(2.57) |
---|
[7dcc3fe] | 6 | AC_INIT([rtems-cpukit],[_RTEMS_VERSION],[rtems-bugs@rtems.com]) |
---|
[66387986] | 7 | AC_CONFIG_SRCDIR([score]) |
---|
[51b4875] | 8 | RTEMS_TOP(..) |
---|
[eb299afc] | 9 | |
---|
| 10 | RTEMS_CANONICAL_TARGET_CPU |
---|
| 11 | |
---|
[33e6983] | 12 | AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.7.2]) |
---|
[eb299afc] | 13 | AM_MAINTAINER_MODE |
---|
[04e6f7bf] | 14 | |
---|
| 15 | RTEMS_ENABLE_MULTILIB |
---|
[eb299afc] | 16 | RTEMS_ENABLE_MULTIPROCESSING |
---|
| 17 | RTEMS_ENABLE_POSIX |
---|
[352c9b2] | 18 | RTEMS_ENABLE_ITRON |
---|
[eb299afc] | 19 | RTEMS_ENABLE_INLINES |
---|
[39607984] | 20 | RTEMS_ENABLE_RTEMS_DEBUG |
---|
[3e39b47] | 21 | RTEMS_ENABLE_NETWORKING |
---|
[eb299afc] | 22 | |
---|
[04e6f7bf] | 23 | RTEMS_ENV_RTEMSCPU |
---|
[39607984] | 24 | RTEMS_CHECK_RTEMS_DEBUG |
---|
[eb299afc] | 25 | |
---|
[5b2e199] | 26 | # Is this a supported CPU? |
---|
| 27 | AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported]) |
---|
| 28 | if test -d "$srcdir/score/cpu/$RTEMS_CPU"; then |
---|
| 29 | AC_MSG_RESULT(yes) |
---|
| 30 | else |
---|
| 31 | AC_MSG_ERROR(no) |
---|
| 32 | fi |
---|
| 33 | |
---|
[53c3a2c6] | 34 | RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) |
---|
[eb299afc] | 35 | RTEMS_CANONICALIZE_TOOLS |
---|
[e73e576] | 36 | AC_PROG_RANLIB |
---|
[eb299afc] | 37 | |
---|
[92ed8c2] | 38 | # FIXME: For the moment, no reason to check for ada |
---|
| 39 | # RTEMS_PROG_GNAT |
---|
| 40 | |
---|
[eb299afc] | 41 | RTEMS_CHECK_NEWLIB |
---|
| 42 | |
---|
[27f9f12] | 43 | RTEMS_CHECK_MULTIPROCESSING |
---|
| 44 | RTEMS_CHECK_POSIX_API |
---|
| 45 | RTEMS_CHECK_ITRON_API |
---|
[3e39b47] | 46 | RTEMS_CHECK_NETWORKING |
---|
[1896a650] | 47 | |
---|
[7660ccd8] | 48 | RTEMS_CPU_SUBDIRS([score/cpu]) |
---|
[85956f9] | 49 | |
---|
[85eb57e7] | 50 | AS_IF([test x"$HAS_NETWORKING" = x"yes"],[ |
---|
| 51 | ## FIXME: Should better use a feature-based test |
---|
[e336882] | 52 | AC_MSG_CHECKING([whether CPU supports librpc]) |
---|
[85eb57e7] | 53 | case "$RTEMS_CPU" in |
---|
| 54 | c4x ) LIBRPC=no;; |
---|
| 55 | or32 ) LIBRPC=no;; |
---|
| 56 | * ) LIBRPC=yes;; |
---|
| 57 | esac |
---|
[e336882] | 58 | AC_MSG_RESULT([$LIBRPC]) |
---|
[2a582aa5] | 59 | ]) |
---|
[07da959] | 60 | |
---|
[965c49b2] | 61 | AC_ARG_ENABLE([ada], |
---|
| 62 | [AC_HELP_STRING([--enable-ada],[enable ada support])], |
---|
| 63 | [case "${enable_ada}" in |
---|
| 64 | yes) ;; |
---|
| 65 | no) ;; |
---|
| 66 | *) AC_MSG_ERROR([bad value ${enable_ada} for --enable-ada]) ;; |
---|
| 67 | esac],[enable_ada=no]) |
---|
| 68 | |
---|
[c0394d4b] | 69 | # HACK: We should use a feature-based configuration. |
---|
[8217c40] | 70 | AS_IF([test x"${RTEMS_CPU}" = x"unix"],[ |
---|
| 71 | # HACK: silently accept --enable-unixlib |
---|
[64b1f81] | 72 | test -n "${enable_unixlib}" || enable_unixlib="yes" |
---|
[8217c40] | 73 | ]) |
---|
| 74 | |
---|
[b422de6c] | 75 | # BSD-isms, used throughout the sources |
---|
| 76 | # Not really used by this configure script |
---|
| 77 | # FIXME: They should be eliminated if possible. |
---|
[85956f9] | 78 | AC_CHECK_FUNCS([strsep strcasecmp snprintf]) |
---|
[b422de6c] | 79 | AC_CHECK_FUNCS([bcopy bcmp]) |
---|
| 80 | AC_CHECK_FUNCS([isascii fileno]) |
---|
[f31a078] | 81 | |
---|
[1bcbe41] | 82 | cat >>cpuopts.tmp <<\_ACEOF |
---|
[3da33bf8] | 83 | /* target cpu dependent options file */ |
---|
| 84 | /* automatically generated -- DO NOT EDIT!! */ |
---|
| 85 | #ifndef __CPU_OPTIONS_h |
---|
| 86 | #define __CPU_OPTIONS_h |
---|
[1bcbe41] | 87 | _ACEOF |
---|
[3da33bf8] | 88 | |
---|
[926e856a] | 89 | RTEMS_CPUOPT([RTEMS_DEBUG], |
---|
| 90 | [test x"${enable_rtems_debug}" = x"yes"], |
---|
| 91 | [1], |
---|
| 92 | [if RTEMS_DEBUG is enabled]) |
---|
| 93 | |
---|
[dcfba35] | 94 | RTEMS_CPUOPT([RTEMS_INLINES], |
---|
| 95 | [test x"${enable_rtems_inlines}" = x"yes"], |
---|
[3da33bf8] | 96 | [1], |
---|
| 97 | [if using inlines]) |
---|
| 98 | |
---|
| 99 | RTEMS_CPUOPT([RTEMS_ITRON_API], |
---|
| 100 | [test x"$rtems_cv_HAS_ITRON_API" = x"yes"], |
---|
| 101 | [1], |
---|
| 102 | [if itron api is supported]) |
---|
| 103 | |
---|
| 104 | RTEMS_CPUOPT([RTEMS_MULTILIBS], |
---|
| 105 | [test x"$RTEMS_MULTILIBS" = x"yes"], |
---|
| 106 | [1], |
---|
| 107 | [using multilib'ed RTEMS]) |
---|
| 108 | |
---|
| 109 | RTEMS_CPUOPT([RTEMS_MULTIPROCESSING], |
---|
[1bcbe41] | 110 | [test x"$enable_multiprocessing" = x"yes"], |
---|
[3da33bf8] | 111 | [1], |
---|
| 112 | [if multiprocessing is enabled]) |
---|
| 113 | |
---|
| 114 | RTEMS_CPUOPT([RTEMS_NEWLIB], |
---|
| 115 | [test x"$RTEMS_USE_NEWLIB" = x"yes"], |
---|
| 116 | [1], |
---|
| 117 | [if using newlib]) |
---|
| 118 | |
---|
| 119 | RTEMS_CPUOPT([RTEMS_POSIX_API], |
---|
[1bcbe41] | 120 | [test x"$rtems_cv_HAS_POSIX_API" = x"yes"], |
---|
[3da33bf8] | 121 | [1], |
---|
| 122 | [if posix api is supported]) |
---|
| 123 | |
---|
| 124 | RTEMS_CPUOPT([RTEMS_UNIX], |
---|
| 125 | [test x"$RTEMS_CPU" = x"unix"], |
---|
| 126 | [1], |
---|
| 127 | [to indicate RTEMS unix]) |
---|
| 128 | |
---|
| 129 | RTEMS_CPUOPT([RTEMS_UNIXLIB], |
---|
| 130 | [test x"${enable_unixlib}" = x"yes"], |
---|
| 131 | [1], |
---|
| 132 | [to indicate RTEMS using RTEMS's unixlib]) |
---|
| 133 | |
---|
| 134 | RTEMS_CPUOPT([RTEMS_VERSION], |
---|
| 135 | [true], |
---|
[1bcbe41] | 136 | ["]_RTEMS_VERSION["], |
---|
[3da33bf8] | 137 | [RTEMS version string]) |
---|
| 138 | |
---|
[1bcbe41] | 139 | cat >>cpuopts.tmp <<\_ACEOF |
---|
| 140 | |
---|
| 141 | #endif |
---|
| 142 | _ACEOF |
---|
[3da33bf8] | 143 | |
---|
| 144 | AS_MKDIR_P(score/include/rtems/score) |
---|
| 145 | AS_IF([test -f score/include/rtems/score/cpuopts.h], |
---|
| 146 | [ |
---|
| 147 | AS_IF([cmp -s score/include/rtems/score/cpuopts.h cpuopts.tmp 2>/dev/null], |
---|
| 148 | [ |
---|
| 149 | AC_MSG_NOTICE([score/include/rtems/score/cpuopts.h is unchanged]) |
---|
| 150 | rm -f cpuopts.tmp |
---|
| 151 | ],[ |
---|
| 152 | AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h]) |
---|
| 153 | rm -f score/include/rtems/score/cpuopts.h |
---|
| 154 | mv cpuopts.tmp score/include/rtems/score/cpuopts.h |
---|
| 155 | ]) |
---|
| 156 | ],[ |
---|
| 157 | AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h]) |
---|
| 158 | rm -f score/include/rtems/score/cpuopts.h |
---|
| 159 | mv cpuopts.tmp score/include/rtems/score/cpuopts.h |
---|
[f31a078] | 160 | ]) |
---|
[e0ba3e8] | 161 | |
---|
[8217c40] | 162 | AC_ENABLE_MULTILIB([Makefile],[..]) |
---|
| 163 | |
---|
[e30210ea] | 164 | # libmisc/shell/* wants to assign file descriptors to stdio file descriptors. |
---|
| 165 | AC_MSG_CHECKING([for assignable stdio]) |
---|
| 166 | AC_COMPILE_IFELSE( |
---|
| 167 | [AC_LANG_PROGRAM( |
---|
| 168 | [#include <stdio.h>], |
---|
| 169 | [stdin = fopen("/tmp", "r")])], |
---|
| 170 | [HAVE_ASSIGNABLE_STDIO=yes], |
---|
| 171 | [HAVE_ASSIGNABLE_STDIO=no]) |
---|
| 172 | AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO]) |
---|
| 173 | |
---|
| 174 | # libmisc/serdbg exploits weak symbols |
---|
| 175 | AC_CACHE_CHECK([whether $CC supports function __attribute__((weak))], |
---|
| 176 | [rtems_cv_cc_attribute_weak],[ |
---|
| 177 | AS_IF([test x"$GCC" = xyes],[ |
---|
| 178 | save_CFLAGS=$CFLAGS |
---|
| 179 | CFLAGS=-Werror]) |
---|
| 180 | |
---|
| 181 | AC_COMPILE_IFELSE([ |
---|
| 182 | AC_LANG_PROGRAM( |
---|
| 183 | [void myfunc(char c) __attribute__ ((weak)); |
---|
| 184 | void myfunc(char c) {}], |
---|
| 185 | [])], |
---|
| 186 | [rtems_cv_cc_attribute_weak=yes], |
---|
| 187 | [rtems_cv_cc_attribute_weak=no]) |
---|
| 188 | |
---|
| 189 | AS_IF([test x"$GCC" = xyes],[ |
---|
| 190 | CFLAGS=$save_CFLAGS]) |
---|
| 191 | ]) |
---|
[f7952533] | 192 | |
---|
[62f0829] | 193 | AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes]) |
---|
| 194 | AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes]) |
---|
| 195 | |
---|
[07da959] | 196 | AS_IF([test x"$RTEMS_USE_NEWLIB" != x"yes"],[ |
---|
| 197 | ## Provide headers only if the host doesn't. |
---|
| 198 | AC_CHECK_HEADERS([stdint.h],[NEED_STDINT_H=no],[NEED_STDINT_H=yes]) |
---|
| 199 | AC_CHECK_HEADERS([inttypes.h],[NEED_INTTYPES_H=no],[NEED_INTTYPES=yes]) |
---|
| 200 | ],[ |
---|
| 201 | ## Using newlib, we provide sys/cdefs.h |
---|
| 202 | NEED_STDINT_H=yes |
---|
| 203 | NEED_INTTYPES_H=yes |
---|
| 204 | ]) |
---|
| 205 | |
---|
| 206 | # FIXME: These checks are only in here to provide |
---|
| 207 | # configuration-time diagnostics and are not really used. |
---|
| 208 | AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>]) |
---|
| 209 | AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>]) |
---|
| 210 | |
---|
| 211 | AS_IF([test x"${RTEMS_USE_NEWLIB}" = x"yes"],[ |
---|
| 212 | ac_cv_have_decl_XTABS=yes |
---|
| 213 | ac_cv_have_decl_OLCUC=yes |
---|
| 214 | ## SUSV3, but seemingly not available on some platforms (reportedly FreeBSD) |
---|
| 215 | ac_cv_have_decl_ONLRET=yes |
---|
| 216 | ac_cv_have_decl_ONOCR=yes |
---|
| 217 | ac_cv_have_decl_TABDLY=yes |
---|
| 218 | ac_cv_have_decl_OCRNL=yes |
---|
| 219 | ac_cv_have_decl_IUCLC=yes |
---|
| 220 | ## SUSV3-XSI extension |
---|
| 221 | ac_cv_have_decl_ECHOPRT=yes |
---|
| 222 | ]) |
---|
| 223 | |
---|
| 224 | # FIXME: Some cruft to work around portability issues with termios.c |
---|
| 225 | ## Seemingly not covered by any standard. |
---|
| 226 | AC_CHECK_DECLS([XTABS],,,[#include <termios.h>]) |
---|
| 227 | AC_CHECK_DECLS([OLCUC],,,[#include <termios.h>]) |
---|
| 228 | ## SUSV3, but seemingly not available on some platforms (reportedly FreeBSD) |
---|
| 229 | AC_CHECK_DECLS([ONLRET],,,[#include <termios.h>]) |
---|
| 230 | AC_CHECK_DECLS([ONOCR],,,[#include <termios.h>]) |
---|
| 231 | AC_CHECK_DECLS([TABDLY],,,[#include <termios.h>]) |
---|
| 232 | AC_CHECK_DECLS([OCRNL],,,[#include <termios.h>]) |
---|
| 233 | AC_CHECK_DECLS([IUCLC],,,[#include <termios.h>]) |
---|
| 234 | ## SUSV3-XSI extension |
---|
| 235 | AC_CHECK_DECLS([ECHOPRT],,,[#include <termios.h>]) |
---|
| 236 | |
---|
| 237 | ## BSD-ism, excluded from POSIX, but available on most platforms |
---|
| 238 | AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>]) |
---|
| 239 | |
---|
| 240 | ## Check if libc provides BSD's strlcpy/strlcat |
---|
| 241 | AC_CHECK_FUNCS(strlcpy strlcat) |
---|
| 242 | |
---|
| 243 | |
---|
| 244 | # ... far too many conditionals ... |
---|
[b422de6c] | 245 | AM_CONDITIONAL(LIBRPC,[test "$LIBRPC" = "yes"]) |
---|
| 246 | AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"]) |
---|
[07da959] | 247 | AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes") |
---|
[b422de6c] | 248 | |
---|
[dcfba35] | 249 | AM_CONDITIONAL(INLINE,test x"$enable_rtems_inlines" = x"yes" ) |
---|
| 250 | AM_CONDITIONAL(MACROS,test x"$enable_rtems_inlines" = x"no" ) |
---|
[1bcbe41] | 251 | AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" ) |
---|
[b422de6c] | 252 | |
---|
[1bcbe41] | 253 | AM_CONDITIONAL(HAS_POSIX,test x"$rtems_cv_HAS_POSIX_API" = x"yes") |
---|
| 254 | AM_CONDITIONAL(HAS_ITRON,test x"$rtems_cv_HAS_ITRON_API" = x"yes") |
---|
[b422de6c] | 255 | AM_CONDITIONAL(HAS_NETWORKING,test x"$HAS_NETWORKING" = x"yes") |
---|
| 256 | |
---|
| 257 | # FIXME: All ports should have a libscorecpu.a - But the powerpc doesn't! |
---|
| 258 | AM_CONDITIONAL([LIBSCORECPU], |
---|
| 259 | [test -f "${srcdir}/score/cpu/${RTEMS_CPU}/cpu.c"]) |
---|
| 260 | |
---|
[92ed8c2] | 261 | AM_CONDITIONAL(RTEMS_ADA,[test x"$enable_ada" = x"yes" \ |
---|
| 262 | && test x"$HAS_POSIX_API" = x"yes"]) |
---|
| 263 | |
---|
[07da959] | 264 | AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"]) |
---|
[62f0829] | 265 | AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"]) |
---|
[07da959] | 266 | AM_CONDITIONAL([NEED_STDINT_H],[test x"$NEED_STDINT_H" = x"yes"]) |
---|
| 267 | AM_CONDITIONAL([NEED_INTTYPES_H],[test x"$NEED_INTTYPES_H" = x"yes"]) |
---|
| 268 | |
---|
[e30210ea] | 269 | AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"]) |
---|
| 270 | AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"]) |
---|
| 271 | |
---|
[3da33bf8] | 272 | AC_CONFIG_HEADER(config.h) |
---|
| 273 | |
---|
[70810dc] | 274 | # Explicitly list all Makefiles here |
---|
[b422de6c] | 275 | AC_CONFIG_FILES([ |
---|
| 276 | Makefile |
---|
| 277 | ada/Makefile |
---|
[1896a650] | 278 | rtems/Makefile |
---|
| 279 | sapi/Makefile |
---|
[eb299afc] | 280 | score/Makefile |
---|
| 281 | score/cpu/Makefile |
---|
[b422de6c] | 282 | posix/Makefile |
---|
| 283 | itron/Makefile |
---|
| 284 | libblock/Makefile |
---|
| 285 | libfs/Makefile |
---|
[07da959] | 286 | libcsupport/Makefile |
---|
[b422de6c] | 287 | libnetworking/Makefile |
---|
[da0fc5d] | 288 | librpc/Makefile |
---|
[b422de6c] | 289 | libmisc/Makefile |
---|
[e30210ea] | 290 | |
---|
[b422de6c] | 291 | wrapup/Makefile |
---|
| 292 | ]) |
---|
[92ed8c2] | 293 | |
---|
[66387986] | 294 | AC_OUTPUT |
---|