1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id$ |
---|
4 | |
---|
5 | AC_PREREQ(2.60) |
---|
6 | AC_INIT([rtems-c-src],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla]) |
---|
7 | AC_CONFIG_SRCDIR([optman]) |
---|
8 | RTEMS_TOP(../..) |
---|
9 | |
---|
10 | RTEMS_ENABLE_CXX |
---|
11 | RTEMS_ENABLE_NETWORKING |
---|
12 | |
---|
13 | RTEMS_CANONICAL_TARGET_CPU |
---|
14 | |
---|
15 | AM_INIT_AUTOMAKE([no-define subdir-objects no-exeext foreign 1.10]) |
---|
16 | AM_MAINTAINER_MODE |
---|
17 | |
---|
18 | RTEMS_ENABLE_MULTILIB |
---|
19 | RTEMS_ENABLE_MULTIPROCESSING |
---|
20 | RTEMS_ENV_RTEMSBSP |
---|
21 | |
---|
22 | RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) |
---|
23 | |
---|
24 | RTEMS_CHECK_NETWORKING(RTEMS_BSP) |
---|
25 | RTEMS_CHECK_POSIX_API(RTEMS_BSP) |
---|
26 | |
---|
27 | AC_MSG_NOTICE([setting up make/custom]) |
---|
28 | |
---|
29 | AS_MKDIR_P([make/custom]) |
---|
30 | AM_SET_DEPDIR |
---|
31 | test -d ${DEPDIR} || mkdir ${DEPDIR} |
---|
32 | |
---|
33 | rm -f ${DEPDIR}/cfg.P |
---|
34 | cp ${srcdir}/make/custom/default.cfg.in make/custom/default.cfg |
---|
35 | cat << EOF > ${DEPDIR}/cfg.P |
---|
36 | # Do not edit - automatically generated by $0 |
---|
37 | make/custom/default.cfg: \$(srcdir)/make/custom/default.cfg.in |
---|
38 | @\$(MKDIR_P) make/custom |
---|
39 | cp \$(srcdir)/make/custom/default.cfg.in make/custom/default.cfg |
---|
40 | EOF |
---|
41 | |
---|
42 | # Collect and copy the BSP's make/custom/*.cfg files from the toplevel make |
---|
43 | # directory into the build tree's <bsp>/make/custom subdirectories |
---|
44 | CUSTOM_CFG_FILES= |
---|
45 | f="${RTEMS_BSP}.cfg" |
---|
46 | while test -n "$f"; do |
---|
47 | cfg_file= |
---|
48 | _RTEMS_CHECK_CUSTOM_BSP([$f],cfg_file) |
---|
49 | if test -n "${cfg_file}"; then |
---|
50 | cp ${cfg_file} make/custom/$f |
---|
51 | cat << EOF >> ${DEPDIR}/cfg.P |
---|
52 | make/custom/$f: ${cfg_file} make/custom/default.cfg |
---|
53 | cp ${cfg_file} make/custom/$f |
---|
54 | EOF |
---|
55 | CUSTOM_CFG_FILES="$CUSTOM_CFG_FILES make/custom/$f" |
---|
56 | f=`grep "^include.*make/custom" ${cfg_file} \ |
---|
57 | | sed \ |
---|
58 | -e 's%^.*custom\/%%' \ |
---|
59 | -e 's%default\.cfg%%'`; |
---|
60 | else break; fi; |
---|
61 | done |
---|
62 | #${MAKE-make} -f ${DEPDIR}/cfg.P \ |
---|
63 | # srcdir="${srcdir}" MKDIR_P="${MKDIR_P}" \ |
---|
64 | # make/custom/default.cfg $CUSTOM_CFG_FILES |
---|
65 | |
---|
66 | AC_MSG_NOTICE([creating make/${RTEMS_BSP}.cache]) |
---|
67 | ${MAKE-make} -f ${srcdir}/make/bsp.mak \ |
---|
68 | RTEMS_BSP=${RTEMS_BSP} \ |
---|
69 | RTEMS_ROOT=. make/${RTEMS_BSP}.cache |
---|
70 | |
---|
71 | # Read back the cache |
---|
72 | AC_CACHE_CHECK([for RTEMS_CPU_MODEL], [ac_cv_env_RTEMS_CPU_MODEL], |
---|
73 | [. ./make/${RTEMS_BSP}.cache]) |
---|
74 | RTEMS_CPU_MODEL=$ac_cv_env_RTEMS_CPU_MODEL |
---|
75 | AC_SUBST(RTEMS_CPU_MODEL) |
---|
76 | test -n "${RTEMS_CPU_MODEL}" && \ |
---|
77 | ac_configure_args="$ac_configure_args 'RTEMS_CPU_MODEL=${RTEMS_CPU_MODEL}'" |
---|
78 | |
---|
79 | AC_CACHE_CHECK([for RTEMS_BSP_FAMILY],[ac_cv_env_RTEMS_BSP_FAMILY], |
---|
80 | [RTEMS_BSP_ALIAS([${RTEMS_BSP}],[ac_cv_env_RTEMS_BSP_FAMILY])]) |
---|
81 | RTEMS_BSP_FAMILY=$ac_cv_env_RTEMS_BSP_FAMILY |
---|
82 | AC_SUBST(RTEMS_BSP_FAMILY) |
---|
83 | test -n "${RTEMS_BSP_FAMILY}" && \ |
---|
84 | ac_configure_args="$ac_configure_args 'RTEMS_BSP_FAMILY=${RTEMS_BSP_FAMILY}'" |
---|
85 | |
---|
86 | AC_CACHE_CHECK([for CPU_CFLAGS],[ac_cv_env_CPU_CFLAGS], |
---|
87 | [. ./make/${RTEMS_BSP}.cache]) |
---|
88 | CPU_CFLAGS=$ac_cv_env_CPU_CFLAGS |
---|
89 | |
---|
90 | AC_CACHE_CHECK([for CFLAGS_OPTIMIZE_V],[ac_cv_env_CFLAGS_OPTIMIZE_V], |
---|
91 | [. ./make/${RTEMS_BSP}.cache]) |
---|
92 | CFLAGS_OPTIMIZE_V=$ac_cv_env_CFLAGS_OPTIMIZE_V |
---|
93 | |
---|
94 | # Was CFLAGS set? |
---|
95 | rtems_cv_CFLAGS_set="${CFLAGS+set}" |
---|
96 | |
---|
97 | CFLAGS="${CFLAGS-${CPU_CFLAGS} ${CFLAGS_OPTIMIZE_V}}" |
---|
98 | |
---|
99 | RTEMS_PROG_CC_FOR_TARGET |
---|
100 | AM_PROG_CC_C_O |
---|
101 | RTEMS_PROG_CCAS |
---|
102 | RTEMS_CANONICALIZE_TOOLS |
---|
103 | |
---|
104 | # Append warning flags if CFLAGS wasn't set. |
---|
105 | AS_IF([test "$GCC" = yes && test "$rtems_cv_CFLAGS_set" != set], |
---|
106 | [CFLAGS="$CFLAGS -Wall -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs"]) |
---|
107 | |
---|
108 | AS_IF([test -n "${CFLAGS}"],[ |
---|
109 | ac_configure_args="$ac_configure_args 'CFLAGS=${CFLAGS}'"]) |
---|
110 | |
---|
111 | RTEMS_CHECK_GCC_WEAK |
---|
112 | |
---|
113 | AC_SUBST(CUSTOM_CFG_FILES) |
---|
114 | |
---|
115 | RTEMS_CHECK_MULTIPROCESSING |
---|
116 | |
---|
117 | BSP_SUBDIRS= |
---|
118 | ## Configure ${srcdir}/../../cpukit as cpukit/ if multilibs are disabled |
---|
119 | RTEMS_BSP_CONFIG_SUBDIR( |
---|
120 | [cpukit],[../../cpukit], |
---|
121 | ['--with-project-root=${with_project_root}../$RTEMS_BSP/' \ |
---|
122 | '--includedir=${exec_prefix}/${RTEMS_BSP}/lib/include' \ |
---|
123 | '--libdir=${exec_prefix}/${RTEMS_BSP}/lib' \ |
---|
124 | ], |
---|
125 | [test x"$multilib" = xno]) |
---|
126 | |
---|
127 | ## Note: the order of the directories below is essential |
---|
128 | AC_CONFIG_SUBDIRS([make]) |
---|
129 | BSP_SUBDIRS="$BSP_SUBDIRS make" |
---|
130 | |
---|
131 | RTEMS_CPU_SUBDIRS(lib/libcpu) |
---|
132 | if test -d "${srcdir}/lib/libcpu/${RTEMS_CPU}"; then |
---|
133 | libcpu_cpu_subdir="${RTEMS_CPU}" |
---|
134 | else |
---|
135 | libcpu_cpu_subdir= |
---|
136 | fi |
---|
137 | AC_SUBST(libcpu_cpu_subdir) |
---|
138 | |
---|
139 | # Is there code where there should be for this BSP? |
---|
140 | RTEMS_CPU_SUBDIRS([lib/libbsp]) |
---|
141 | AC_SUBST(libbsp_cpu_subdir,$RTEMS_CPU) |
---|
142 | |
---|
143 | BSP_SUBDIRS="$BSP_SUBDIRS lib" |
---|
144 | BSP_SUBDIRS="$BSP_SUBDIRS libchip" |
---|
145 | |
---|
146 | AS_IF([test "$RTEMS_HAS_CPLUSPLUS" = "yes"],[ |
---|
147 | AC_CONFIG_SUBDIRS([librtems++]) |
---|
148 | BSP_SUBDIRS="$BSP_SUBDIRS librtems++" |
---|
149 | ]) |
---|
150 | |
---|
151 | BSP_SUBDIRS="$BSP_SUBDIRS support" |
---|
152 | BSP_SUBDIRS="$BSP_SUBDIRS ada" |
---|
153 | BSP_SUBDIRS="$BSP_SUBDIRS wrapup" |
---|
154 | |
---|
155 | BSP_SUBDIRS="$BSP_SUBDIRS optman" |
---|
156 | |
---|
157 | AC_ARG_ENABLE([ada], |
---|
158 | [AS_HELP_STRING(--enable-ada,enable ada support)], |
---|
159 | [case "${enable_ada}" in |
---|
160 | yes) ;; |
---|
161 | no) ;; |
---|
162 | *) AC_MSG_ERROR(bad value ${enable_ada} for --enable-ada) ;; |
---|
163 | esac],[enable_ada=no]) |
---|
164 | |
---|
165 | RTEMS_BSP_CONFIG_SUBDIR( |
---|
166 | [ada-tests],[ada-tests], |
---|
167 | ['--enable-rtems-root=../' \ |
---|
168 | '--enable-project-root=${with_project_root}../$RTEMS_BSP' \ |
---|
169 | '--with-project-top=${with_project_top}../' \ |
---|
170 | '--enable-rtemsbsp=$RTEMS_BSP' \ |
---|
171 | ], |
---|
172 | [test x"$enable_tests" = xyes && test x"$enable_ada" = xyes]) |
---|
173 | |
---|
174 | # HACK ALERT! |
---|
175 | |
---|
176 | # FIXME: Assume multilib implies in-source-tree multilibs |
---|
177 | # Build testsuites multilibbed |
---|
178 | RTEMS_BSP_CONFIG_SUBDIR( |
---|
179 | [testsuites],[../../testsuites], |
---|
180 | ['--enable-rtems-root=../' \ |
---|
181 | '--enable-project-root=${with_project_root}../$RTEMS_BSP' \ |
---|
182 | '--with-project-top=${with_project_top}../' \ |
---|
183 | '--enable-rtemsbsp=$RTEMS_BSP' \ |
---|
184 | '--includedir=${exec_prefix}/${RTEMS_BSP}/lib/include' \ |
---|
185 | '--libdir=${exec_prefix}/${RTEMS_BSP}/lib' \ |
---|
186 | ], |
---|
187 | [test x"$enable_tests" != x"no" && test x"$multilib" = xno]) |
---|
188 | |
---|
189 | # Build testsuites non-multilibbed |
---|
190 | RTEMS_BSP_CONFIG_SUBDIR( |
---|
191 | [testsuites],[../../testsuites], |
---|
192 | ['--enable-rtems-root=../' \ |
---|
193 | '--enable-cpukit-root=${with_project_root}..' \ |
---|
194 | '--enable-project-root=${with_project_root}../$RTEMS_BSP' \ |
---|
195 | '--with-project-top=${with_project_top}../' \ |
---|
196 | '--enable-rtemsbsp=$RTEMS_BSP' \ |
---|
197 | '--includedir=${exec_prefix}/${RTEMS_BSP}/lib/include' \ |
---|
198 | '--libdir=${exec_prefix}/${RTEMS_BSP}/lib' \ |
---|
199 | ], |
---|
200 | [test x"$enable_tests" != x"no" && test x"$multilib" = xyes]) |
---|
201 | |
---|
202 | AC_SUBST([BSP_SUBDIRS],[$BSP_SUBDIRS]) |
---|
203 | |
---|
204 | AS_IF([test "$host_cpu" = sparc],[ |
---|
205 | AC_DEFINE_UNQUOTED([CPU_U32_FIX],[1], |
---|
206 | [whether to enable ipalignment work-around]) |
---|
207 | ]) |
---|
208 | |
---|
209 | AM_CONDITIONAL([HAS_NETWORKING],[test "$HAS_NETWORKING" = "yes"]) |
---|
210 | |
---|
211 | AM_CONDITIONAL(HAS_POSIX,test "$HAS_POSIX_API" = "yes") |
---|
212 | |
---|
213 | AM_CONDITIONAL(RTEMS_ADA,[test x"$enable_ada" = x"yes" \ |
---|
214 | && test x"$rtems_cv_HAS_POSIX_API" = x"yes"]) |
---|
215 | |
---|
216 | RTEMS_PROJECT_ROOT |
---|
217 | |
---|
218 | # Explicitly list all Makefiles here |
---|
219 | AC_CONFIG_FILES([Makefile], |
---|
220 | [${MAKE} make/${RTEMS_BSP}.cache], |
---|
221 | [RTEMS_BSP=${RTEMS_BSP} |
---|
222 | MAKE=${MAKE}]) |
---|
223 | |
---|
224 | AC_CONFIG_FILES([ |
---|
225 | support/Makefile |
---|
226 | |
---|
227 | libchip/Makefile |
---|
228 | |
---|
229 | optman/Makefile |
---|
230 | |
---|
231 | lib/Makefile |
---|
232 | |
---|
233 | lib/libcpu/Makefile |
---|
234 | |
---|
235 | lib/libbsp/Makefile |
---|
236 | |
---|
237 | ada/Makefile |
---|
238 | |
---|
239 | wrapup/Makefile |
---|
240 | ]) |
---|
241 | |
---|
242 | AC_OUTPUT |
---|