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