1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id$ |
---|
4 | |
---|
5 | AC_PREREQ(2.57) |
---|
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 foreign 1.7.2]) |
---|
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 | AC_PROG_RANLIB |
---|
37 | |
---|
38 | # FIXME: For the moment, no reason to check for ada |
---|
39 | # RTEMS_PROG_GNAT |
---|
40 | |
---|
41 | RTEMS_CHECK_NEWLIB |
---|
42 | |
---|
43 | RTEMS_CHECK_MULTIPROCESSING |
---|
44 | RTEMS_CHECK_POSIX_API |
---|
45 | RTEMS_CHECK_ITRON_API |
---|
46 | RTEMS_CHECK_NETWORKING |
---|
47 | |
---|
48 | RTEMS_CPU_SUBDIRS([score/cpu]) |
---|
49 | |
---|
50 | AS_IF([test x"$HAS_NETWORKING" = x"yes"],[ |
---|
51 | ## FIXME: Should better use a feature-based test |
---|
52 | AC_MSG_CHECKING([whether CPU supports librpc]) |
---|
53 | case "$RTEMS_CPU" in |
---|
54 | c4x ) LIBRPC=no;; |
---|
55 | or32 ) LIBRPC=no;; |
---|
56 | * ) LIBRPC=yes;; |
---|
57 | esac |
---|
58 | AC_MSG_RESULT([$LIBRPC]) |
---|
59 | ]) |
---|
60 | |
---|
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 | |
---|
69 | # HACK: We should use a feature-based configuration. |
---|
70 | AS_IF([test x"${RTEMS_CPU}" = x"unix"],[ |
---|
71 | # HACK: silently accept --enable-unixlib |
---|
72 | test -n "${enable_unixlib}" || enable_unixlib="yes" |
---|
73 | ]) |
---|
74 | |
---|
75 | # BSD-isms, used throughout the sources |
---|
76 | # Not really used by this configure script |
---|
77 | # FIXME: They should be eliminated if possible. |
---|
78 | AC_CHECK_FUNCS([strsep strcasecmp snprintf]) |
---|
79 | AC_CHECK_FUNCS([bcopy bcmp]) |
---|
80 | AC_CHECK_FUNCS([isascii fileno]) |
---|
81 | |
---|
82 | cat >>cpuopts.tmp <<\_ACEOF |
---|
83 | /* target cpu dependent options file */ |
---|
84 | /* automatically generated -- DO NOT EDIT!! */ |
---|
85 | #ifndef __CPU_OPTIONS_h |
---|
86 | #define __CPU_OPTIONS_h |
---|
87 | _ACEOF |
---|
88 | |
---|
89 | RTEMS_CPUOPT([RTEMS_DEBUG], |
---|
90 | [test x"${enable_rtems_debug}" = x"yes"], |
---|
91 | [1], |
---|
92 | [if RTEMS_DEBUG is enabled]) |
---|
93 | |
---|
94 | RTEMS_CPUOPT([RTEMS_INLINES], |
---|
95 | [test x"${enable_rtems_inlines}" = x"yes"], |
---|
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], |
---|
110 | [test x"$enable_multiprocessing" = x"yes"], |
---|
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], |
---|
120 | [test x"$rtems_cv_HAS_POSIX_API" = x"yes"], |
---|
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], |
---|
136 | ["]_RTEMS_VERSION["], |
---|
137 | [RTEMS version string]) |
---|
138 | |
---|
139 | cat >>cpuopts.tmp <<\_ACEOF |
---|
140 | |
---|
141 | #endif |
---|
142 | _ACEOF |
---|
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 |
---|
160 | ]) |
---|
161 | |
---|
162 | AC_ENABLE_MULTILIB([Makefile],[..]) |
---|
163 | |
---|
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 | ]) |
---|
192 | |
---|
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 | |
---|
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 ... |
---|
245 | AM_CONDITIONAL(LIBRPC,[test "$LIBRPC" = "yes"]) |
---|
246 | AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"]) |
---|
247 | AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes") |
---|
248 | |
---|
249 | AM_CONDITIONAL(INLINE,test x"$enable_rtems_inlines" = x"yes" ) |
---|
250 | AM_CONDITIONAL(MACROS,test x"$enable_rtems_inlines" = x"no" ) |
---|
251 | AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" ) |
---|
252 | |
---|
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") |
---|
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 | |
---|
261 | AM_CONDITIONAL(RTEMS_ADA,[test x"$enable_ada" = x"yes" \ |
---|
262 | && test x"$HAS_POSIX_API" = x"yes"]) |
---|
263 | |
---|
264 | AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"]) |
---|
265 | AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"]) |
---|
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 | |
---|
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 | |
---|
272 | AC_CONFIG_HEADER(config.h) |
---|
273 | |
---|
274 | # Explicitly list all Makefiles here |
---|
275 | AC_CONFIG_FILES([ |
---|
276 | Makefile |
---|
277 | ada/Makefile |
---|
278 | rtems/Makefile |
---|
279 | sapi/Makefile |
---|
280 | score/Makefile |
---|
281 | score/cpu/Makefile |
---|
282 | posix/Makefile |
---|
283 | itron/Makefile |
---|
284 | libblock/Makefile |
---|
285 | libfs/Makefile |
---|
286 | libcsupport/Makefile |
---|
287 | libnetworking/Makefile |
---|
288 | libnetworking/lib/Makefile |
---|
289 | libnetworking/libc/Makefile |
---|
290 | librpc/Makefile |
---|
291 | libmisc/Makefile |
---|
292 | |
---|
293 | wrapup/Makefile |
---|
294 | ]) |
---|
295 | |
---|
296 | AC_OUTPUT |
---|