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 | RTEMS_CHECK_CPU |
---|
27 | RTEMS_CANONICAL_HOST |
---|
28 | |
---|
29 | RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) |
---|
30 | RTEMS_CANONICALIZE_TOOLS |
---|
31 | AC_PROG_RANLIB |
---|
32 | |
---|
33 | # FIXME: For the moment, no reason to check for ada |
---|
34 | # RTEMS_PROG_GNAT |
---|
35 | |
---|
36 | RTEMS_CHECK_NEWLIB |
---|
37 | |
---|
38 | RTEMS_CHECK_MULTIPROCESSING |
---|
39 | RTEMS_CHECK_POSIX_API |
---|
40 | RTEMS_CHECK_ITRON_API |
---|
41 | RTEMS_CHECK_NETWORKING |
---|
42 | |
---|
43 | # If RTEMS macros are enabled, then use them. Otherwise, use inlines. |
---|
44 | AS_IF([test "$RTEMS_USE_MACROS" = "yes"], |
---|
45 | [INLINEdir="macros"], |
---|
46 | [INLINEdir="inline"]) |
---|
47 | AC_SUBST(INLINEdir) |
---|
48 | AC_DEFINE(RTEMS_VERSION,["][_RTEMS_VERSION]["],[RTEMS version string]) |
---|
49 | |
---|
50 | RTEMS_CPU_SUBDIRS([score/cpu]) |
---|
51 | |
---|
52 | AS_IF([test x"$HAS_NETWORKING" = x"yes"],[ |
---|
53 | ## FIXME: Should better use a feature-based test |
---|
54 | AC_MSG_CHECKING([whether CPU supports librpc]) |
---|
55 | case "$RTEMS_CPU" in |
---|
56 | c4x ) LIBRPC=no;; |
---|
57 | or32 ) LIBRPC=no;; |
---|
58 | * ) LIBRPC=yes;; |
---|
59 | esac |
---|
60 | AC_MSG_RESULT([$LIBRPC]) |
---|
61 | ]) |
---|
62 | |
---|
63 | AC_ARG_ENABLE([ada], |
---|
64 | [AC_HELP_STRING([--enable-ada],[enable ada support])], |
---|
65 | [case "${enable_ada}" in |
---|
66 | yes) ;; |
---|
67 | no) ;; |
---|
68 | *) AC_MSG_ERROR([bad value ${enable_ada} for --enable-ada]) ;; |
---|
69 | esac],[enable_ada=no]) |
---|
70 | |
---|
71 | RTEMS_DEFINE_POSIX_API |
---|
72 | RTEMS_DEFINE_ITRON_API |
---|
73 | RTEMS_DEFINE_MULTIPROCESSING |
---|
74 | |
---|
75 | # HACK: We should use a feature-based configuration. |
---|
76 | AS_IF([test x"${RTEMS_CPU}" = x"unix"],[ |
---|
77 | AC_DEFINE_UNQUOTED([RTEMS_UNIX],[1],[to indicate RTEMS unix]) |
---|
78 | # HACK: silently accept --enable-unixlib |
---|
79 | test -n "${enable_unixlib}" || enable_unixlib="yes" |
---|
80 | ]) |
---|
81 | |
---|
82 | AS_IF([test x"${enable_unixlib}" = x"yes"], |
---|
83 | [AC_DEFINE_UNQUOTED([RTEMS_UNIXLIB],[1], |
---|
84 | [to indicate RTEMS using RTEMS's unixlib])] |
---|
85 | ) |
---|
86 | |
---|
87 | # BSD-isms, used throughout the sources |
---|
88 | # Not really used by this configure script |
---|
89 | # FIXME: They should be eliminated if possible. |
---|
90 | AC_CHECK_FUNCS([strsep strcasecmp snprintf]) |
---|
91 | AC_CHECK_FUNCS([bcopy bcmp]) |
---|
92 | AC_CHECK_FUNCS([isascii fileno]) |
---|
93 | |
---|
94 | AM_CONFIG_HEADER([score/include/rtems/score/cpuopts-tmp.h],[ |
---|
95 | echo "/* target cpu dependent options file */" >$tmp/config.h |
---|
96 | echo "/* automatically generated -- DO NOT EDIT!! */" >>$tmp/config.h |
---|
97 | echo >>$tmp/config.h |
---|
98 | echo "#ifndef __CPU_OPTIONS_h" >>$tmp/config.h |
---|
99 | echo "#define __CPU_OPTIONS_h" >>$tmp/config.h |
---|
100 | echo >>$tmp/config.h |
---|
101 | sed -e '/.*PACKAGE.*/d' score/include/rtems/score/cpuopts-tmp.h >> $tmp/config.h |
---|
102 | echo >>$tmp/config.h |
---|
103 | echo "#endif" >>$tmp/config.h |
---|
104 | AS_IF([cmp -s score/include/rtems/score/cpuopts.h $tmp/config.h 2>/dev/null], |
---|
105 | [AC_MSG_NOTICE([score/include/rtems/score/cpuopts.h is unchanged]) |
---|
106 | rm -f $tmp/config.h], |
---|
107 | [AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h]) |
---|
108 | rm -f score/include/rtems/score/cpuopts.h |
---|
109 | mv $tmp/config.h score/include/rtems/score/cpuopts.h]) |
---|
110 | ]) |
---|
111 | |
---|
112 | AC_ENABLE_MULTILIB([Makefile],[..]) |
---|
113 | |
---|
114 | ## HACK: Add a define to cpuopts.h to indicate using multilibs |
---|
115 | ## Can be applied to produce compiler errors if using |
---|
116 | ## multilib-incompatible settings somewhere else (eg. bspopts.h). |
---|
117 | AS_IF([test x"${enable_multilib}" = x"yes"],[ |
---|
118 | AC_DEFINE_UNQUOTED([RTEMS_MULTILIBS],[1],[using multilib'ed RTEMS]) |
---|
119 | ]) |
---|
120 | |
---|
121 | # libmisc/shell/* wants to assign file descriptors to stdio file descriptors. |
---|
122 | AC_MSG_CHECKING([for assignable stdio]) |
---|
123 | AC_COMPILE_IFELSE( |
---|
124 | [AC_LANG_PROGRAM( |
---|
125 | [#include <stdio.h>], |
---|
126 | [stdin = fopen("/tmp", "r")])], |
---|
127 | [HAVE_ASSIGNABLE_STDIO=yes], |
---|
128 | [HAVE_ASSIGNABLE_STDIO=no]) |
---|
129 | AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO]) |
---|
130 | |
---|
131 | # libmisc/serdbg exploits weak symbols |
---|
132 | AC_CACHE_CHECK([whether $CC supports function __attribute__((weak))], |
---|
133 | [rtems_cv_cc_attribute_weak],[ |
---|
134 | AS_IF([test x"$GCC" = xyes],[ |
---|
135 | save_CFLAGS=$CFLAGS |
---|
136 | CFLAGS=-Werror]) |
---|
137 | |
---|
138 | AC_COMPILE_IFELSE([ |
---|
139 | AC_LANG_PROGRAM( |
---|
140 | [void myfunc(char c) __attribute__ ((weak)); |
---|
141 | void myfunc(char c) {}], |
---|
142 | [])], |
---|
143 | [rtems_cv_cc_attribute_weak=yes], |
---|
144 | [rtems_cv_cc_attribute_weak=no]) |
---|
145 | |
---|
146 | AS_IF([test x"$GCC" = xyes],[ |
---|
147 | CFLAGS=$save_CFLAGS]) |
---|
148 | ]) |
---|
149 | |
---|
150 | AS_IF([test x"$RTEMS_USE_NEWLIB" != x"yes"],[ |
---|
151 | ## Provide headers only if the host doesn't. |
---|
152 | AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes]) |
---|
153 | AC_CHECK_HEADERS([stdint.h],[NEED_STDINT_H=no],[NEED_STDINT_H=yes]) |
---|
154 | AC_CHECK_HEADERS([inttypes.h],[NEED_INTTYPES_H=no],[NEED_INTTYPES=yes]) |
---|
155 | ],[ |
---|
156 | ## Using newlib, we provide sys/cdefs.h |
---|
157 | NEED_SYS_CDEFS_H=yes |
---|
158 | NEED_STDINT_H=yes |
---|
159 | NEED_INTTYPES_H=yes |
---|
160 | ]) |
---|
161 | |
---|
162 | # FIXME: These checks are only in here to provide |
---|
163 | # configuration-time diagnostics and are not really used. |
---|
164 | AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>]) |
---|
165 | AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>]) |
---|
166 | |
---|
167 | AS_IF([test x"${RTEMS_USE_NEWLIB}" = x"yes"],[ |
---|
168 | ac_cv_have_decl_XTABS=yes |
---|
169 | ac_cv_have_decl_OLCUC=yes |
---|
170 | ## SUSV3, but seemingly not available on some platforms (reportedly FreeBSD) |
---|
171 | ac_cv_have_decl_ONLRET=yes |
---|
172 | ac_cv_have_decl_ONOCR=yes |
---|
173 | ac_cv_have_decl_TABDLY=yes |
---|
174 | ac_cv_have_decl_OCRNL=yes |
---|
175 | ac_cv_have_decl_IUCLC=yes |
---|
176 | ## SUSV3-XSI extension |
---|
177 | ac_cv_have_decl_ECHOPRT=yes |
---|
178 | ]) |
---|
179 | |
---|
180 | # FIXME: Some cruft to work around portability issues with termios.c |
---|
181 | ## Seemingly not covered by any standard. |
---|
182 | AC_CHECK_DECLS([XTABS],,,[#include <termios.h>]) |
---|
183 | AC_CHECK_DECLS([OLCUC],,,[#include <termios.h>]) |
---|
184 | ## SUSV3, but seemingly not available on some platforms (reportedly FreeBSD) |
---|
185 | AC_CHECK_DECLS([ONLRET],,,[#include <termios.h>]) |
---|
186 | AC_CHECK_DECLS([ONOCR],,,[#include <termios.h>]) |
---|
187 | AC_CHECK_DECLS([TABDLY],,,[#include <termios.h>]) |
---|
188 | AC_CHECK_DECLS([OCRNL],,,[#include <termios.h>]) |
---|
189 | AC_CHECK_DECLS([IUCLC],,,[#include <termios.h>]) |
---|
190 | ## SUSV3-XSI extension |
---|
191 | AC_CHECK_DECLS([ECHOPRT],,,[#include <termios.h>]) |
---|
192 | |
---|
193 | ## BSD-ism, excluded from POSIX, but available on most platforms |
---|
194 | AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>]) |
---|
195 | |
---|
196 | ## Check if libc provides BSD's strlcpy/strlcat |
---|
197 | AC_CHECK_FUNCS(strlcpy strlcat) |
---|
198 | |
---|
199 | |
---|
200 | # ... far too many conditionals ... |
---|
201 | AM_CONDITIONAL(LIBRPC,[test "$LIBRPC" = "yes"]) |
---|
202 | AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"]) |
---|
203 | AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes") |
---|
204 | |
---|
205 | AM_CONDITIONAL(INLINE,test x"$INLINEdir" = x"inline" ) |
---|
206 | AM_CONDITIONAL(MACROS,test x"$INLINEdir" = x"macros" ) |
---|
207 | AM_CONDITIONAL(HAS_MP,test x"$HAS_MP" = x"yes" ) |
---|
208 | |
---|
209 | AM_CONDITIONAL(HAS_POSIX,test x"$HAS_POSIX_API" = x"yes") |
---|
210 | AM_CONDITIONAL(HAS_ITRON,test x"$HAS_ITRON_API" = x"yes") |
---|
211 | AM_CONDITIONAL(HAS_NETWORKING,test x"$HAS_NETWORKING" = x"yes") |
---|
212 | |
---|
213 | # FIXME: All ports should have a libscorecpu.a - But the powerpc doesn't! |
---|
214 | AM_CONDITIONAL([LIBSCORECPU], |
---|
215 | [test -f "${srcdir}/score/cpu/${RTEMS_CPU}/cpu.c"]) |
---|
216 | |
---|
217 | AM_CONDITIONAL(RTEMS_ADA,[test x"$enable_ada" = x"yes" \ |
---|
218 | && test x"$HAS_POSIX_API" = x"yes"]) |
---|
219 | |
---|
220 | AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"]) |
---|
221 | AM_CONDITIONAL([NEED_STDINT_H],[test x"$NEED_STDINT_H" = x"yes"]) |
---|
222 | AM_CONDITIONAL([NEED_INTTYPES_H],[test x"$NEED_INTTYPES_H" = x"yes"]) |
---|
223 | |
---|
224 | AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"]) |
---|
225 | AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"]) |
---|
226 | |
---|
227 | # Explicitly list all Makefiles here |
---|
228 | AC_CONFIG_FILES([ |
---|
229 | Makefile |
---|
230 | include/Makefile |
---|
231 | ada/Makefile |
---|
232 | rtems/Makefile |
---|
233 | sapi/Makefile |
---|
234 | score/Makefile |
---|
235 | score/cpu/Makefile |
---|
236 | posix/Makefile |
---|
237 | itron/Makefile |
---|
238 | libblock/Makefile |
---|
239 | libfs/Makefile |
---|
240 | libfs/src/Makefile |
---|
241 | libfs/src/imfs/Makefile |
---|
242 | libfs/src/dosfs/Makefile |
---|
243 | libcsupport/Makefile |
---|
244 | libnetworking/Makefile |
---|
245 | libnetworking/lib/Makefile |
---|
246 | libnetworking/libc/Makefile |
---|
247 | libnetworking/wrapup/Makefile |
---|
248 | librpc/Makefile |
---|
249 | librpc/include/Makefile |
---|
250 | librpc/src/Makefile |
---|
251 | librpc/src/xdr/Makefile |
---|
252 | librpc/src/rpc/Makefile |
---|
253 | libmisc/Makefile |
---|
254 | libmisc/cpuuse/Makefile |
---|
255 | libmisc/shell/Makefile |
---|
256 | libmisc/devnull/Makefile |
---|
257 | libmisc/dummy/Makefile |
---|
258 | libmisc/dumpbuf/Makefile |
---|
259 | libmisc/monitor/Makefile |
---|
260 | libmisc/rtmonuse/Makefile |
---|
261 | libmisc/serdbg/Makefile |
---|
262 | libmisc/stackchk/Makefile |
---|
263 | libmisc/capture/Makefile |
---|
264 | libmisc/untar/Makefile |
---|
265 | libmisc/mw-fb/Makefile |
---|
266 | libmisc/fsmount/Makefile |
---|
267 | libmisc/wrapup/Makefile |
---|
268 | |
---|
269 | wrapup/Makefile |
---|
270 | ]) |
---|
271 | |
---|
272 | AC_OUTPUT |
---|