comparison host/acinclude.m4 @ 76:435cced73e2f ecos-v1_3_1-release

eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
author jlarmour
date Tue, 28 Mar 2000 14:10:45 +0000
parents
children a9ac27ec7abc
comparison
equal deleted inserted replaced
75:41bf073c0c32 76:435cced73e2f
1 dnl Process this file with aclocal to get an aclocal.m4 file. Then
2 dnl process that with autoconf.
3 dnl ====================================================================
4 dnl
5 dnl acinclude.m4
6 dnl
7 dnl Various autoconf macros that are shared between different
8 dnl eCos packages.
9 dnl
10 dnl ====================================================================
11 dnl####COPYRIGHTBEGIN####
12 dnl
13 dnl ----------------------------------------------------------------------------
14 dnl Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
15 dnl
16 dnl This file is part of the eCos host tools.
17 dnl
18 dnl This program is free software; you can redistribute it and/or modify it
19 dnl under the terms of the GNU General Public License as published by the Free
20 dnl Software Foundation; either version 2 of the License, or (at your option)
21 dnl any later version.
22 dnl
23 dnl This program is distributed in the hope that it will be useful, but WITHOUT
24 dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25 dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
26 dnl more details.
27 dnl
28 dnl You should have received a copy of the GNU General Public License along with
29 dnl this program; if not, write to the Free Software Foundation, Inc.,
30 dnl 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 dnl
32 dnl ----------------------------------------------------------------------------
33 dnl
34 dnl####COPYRIGHTEND####
35 dnl ====================================================================
36 dnl#####DESCRIPTIONBEGIN####
37 dnl
38 dnl Author(s): bartv
39 dnl Contact(s): bartv
40 dnl Date: 1998/12/16
41 dnl Version: 0.01
42 dnl
43 dnl####DESCRIPTIONEND####
44 dnl ====================================================================
45
46 dnl ====================================================================
47 dnl The AM_INIT_AUTOMAKE() will define a symbol VERSION for the
48 dnl package's version number. Unfortunately this symbol is rather
49 dnl hard to share if several different packages are involved, so this
50 dnl macro is used to define an alternative symbol
51
52 AC_DEFUN(CYG_AC_SUBST_VERSION,[
53 AC_REQUIRE([AM_INIT_AUTOMAKE])
54 ifelse($#,1,,AC_MSG_ERROR([Invalid number of arguments passed to CYG AC_SUBST_VERSION]))
55 AC_DEFINE_UNQUOTED($1, "$VERSION")
56 ])
57
58 dnl ====================================================================
59 dnl Provide support for an automake conditional MSVC. Also set a
60 dnl variable MSVC to true or false, which may help other tests.
61
62 AC_DEFUN(CYG_AC_PROG_MSVC,[
63 AC_REQUIRE([AC_PROG_CC])
64 AC_REQUIRE([AC_PROG_CXX])
65
66 AC_MSG_CHECKING("for Visual C++")
67 MSVC="no";
68 if test "${CC}" = "cl" ; then
69 MSVC="yes"
70 fi
71 if test "${CXX}" = "cl" ; then
72 MSVC="yes"
73 fi
74 AM_CONDITIONAL(MSVC, test "${MSVC}" = "yes")
75 AC_MSG_RESULT(${MSVC})
76 ])
77
78 dnl ====================================================================
79 dnl Set up sensible flags for the various different compilers. This
80 dnl is achieved by redefining CC and CXX.
81 dnl
82 dnl A better way of doing this sort of thing would be to detect
83 dnl arguments to add and remove to the set of compiler flags, and
84 dnl then update CFLAGS and CXXFLAGS (or even better, the AM
85 dnl versions of those flags?)
86 dnl
87 dnl There is no point in checking the cache, this macro does
88 dnl not do any feature tests.
89 dnl
90 dnl The VC++ variant might benefit from -Za, but the header files
91 dnl shipped with the compiler are incompatible with this option.
92
93 AC_DEFUN(CYG_AC_PROG_STANDARD_COMPILER_FLAGS, [
94 AC_REQUIRE([AC_PROG_CC])
95 AC_REQUIRE([AC_PROG_CXX])
96 AC_REQUIRE([CYG_AC_PROG_MSVC])
97
98 AC_MSG_CHECKING("the default compiler flags")
99
100 dnl Add a user-settable flag to control whether or debugging info is
101 dnl incorporated at compile-time.
102 dnl
103 dnl NOTE: there may also have to be a flag to control whether or
104 dnl the VC++ multi-threading flags are enabled.
105 cygflags_enable_debug="no"
106 AC_ARG_ENABLE(debug,[ --enable-debug do a debug rather than a release build],
107 [case "${enableval}" in
108 yes) cygflags_enable_debug="yes" ;;
109 *) cygflags_enable_debug="no" ;;
110 esac])
111
112 dnl For VC++ builds also provide a flag for ANSI vs. unicode builds.
113 dnl For now this does not actually affect the compiler flags.
114 cygflags_enable_ansi="no"
115 if test "${MSVC}" = "yes" ; then
116 AC_ARG_ENABLE(ansi,[ --enable-ansi Do an ANSI rather than a unicode build],
117 [case "${enableval}" in
118 yes) cygflags_enable_ansi="yes" ;;
119 *) cygflags_enable_ansi="no" ;;
120 esac])
121 fi
122
123 if test "${GCC}" = "yes" ; then
124 CC="$CC -Wall -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs"
125 CXX="$CXX -Wall -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual"
126 elif test "${MSVC}" = "yes" ; then
127 CC="$CC -nologo -W3"
128 CXX="$CXX -nologo -W3 -GR -GX"
129 if test "${cygflags_enable_debug}" = "yes" ; then
130 CC="$CC -MDd -Zi"
131 CXX="$CXX -MDd -Zi"
132 else
133 CC="$CC -MD -O2"
134 CXX="$CXX -MD -O2"
135 fi
136 else
137 AC_MSG_ERROR("default flags for ${CC} are not known")
138 fi
139 AC_MSG_RESULT(done)
140 ])
141
142 dnl --------------------------------------------------------------------
143 dnl User-settable options for assertions and tracing.
144 dnl
145 dnl The settable options are:
146 dnl --disable-asserts
147 dnl --disable-preconditions
148 dnl --disable-postconditions
149 dnl --disable-invariants
150 dnl --disable-loopinvariants
151 dnl --disable-tracing
152 dnl --disable-fntracing
153
154 AC_DEFUN(CYG_AC_ARG_INFRASTRUCTURE, [
155
156 AC_REQUIRE([CYG_AC_PROG_STANDARD_COMPILER_FLAGS])
157
158 if test "${cygflags_enable_debug}" = "yes" ; then
159 cyginfra_asserts=yes
160 cyginfra_preconditions=yes
161 cyginfra_postconditions=yes
162 cyginfra_invariants=yes
163 cyginfra_loopinvariants=yes
164 cyginfra_tracing=yes
165 cyginfra_fntracing=yes
166 else
167 cyginfra_asserts=no
168 cyginfra_preconditions=no
169 cyginfra_postconditions=no
170 cyginfra_invariants=no
171 cyginfra_loopinvariants=no
172 cyginfra_tracing=no
173 cyginfra_fntracing=no
174 fi
175
176 AC_ARG_ENABLE(asserts,[ --disable-asserts disable all assertions],
177 [case "${enableval}" in
178 yes) cyginfra_asserts=yes ;;
179 no) cyginfra_asserts=no ;;
180 *) AC_MSG_ERROR([bad value ${enableval} for disable-asserts option]) ;;
181 esac])
182 if test "${cyginfra_asserts}" = "yes"; then
183 AC_DEFINE(CYGDBG_USE_ASSERTS)
184 fi
185
186 AC_ARG_ENABLE(preconditions, [ --disable-preconditions disable a subset of the assertions],
187 [case "${enableval}" in
188 yes) cyginfra_preconditions=yes ;;
189 no) cyginfra_preconditions=no ;;
190 *) AC_MSG_ERROR([bad value ${enableval} for disable-preconditions option]) ;;
191 esac])
192 if test "${cyginfra_preconditions}" = "yes"; then
193 AC_DEFINE(CYGDBG_INFRA_DEBUG_PRECONDITIONS)
194 fi
195
196 AC_ARG_ENABLE(postconditions, [ --disable-postconditions disable a subset of the assertions],
197 [case "${enableval}" in
198 yes) cyginfra_postconditions=yes ;;
199 no) cyginfra_postconditions=no ;;
200 *) AC_MSG_ERROR([bad value ${enableval} for disable-postconditions option]) ;;
201 esac])
202 if test "${cyginfra_postconditions}" = "yes"; then
203 AC_DEFINE(CYGDBG_INFRA_DEBUG_POSTCONDITIONS)
204 fi
205
206 AC_ARG_ENABLE(invariants, [ --disable-invariants disable a subset of the assertions],
207 [case "${enableval}" in
208 yes) cyginfra_invariants=yes ;;
209 no) cyginfra_invariants=no ;;
210 *) AC_MSG_ERROR([bad value ${enableval} for disable-invariants option]) ;;
211 esac])
212 if test "${cyginfra_invariants}" = "yes"; then
213 AC_DEFINE(CYGDBG_INFRA_DEBUG_INVARIANTS)
214 fi
215
216 AC_ARG_ENABLE(loopinvariants, [ --disable-loopinvariants disable a subset of the assertions],
217 [case "${enableval}" in
218 yes) cyginfra_loopinvariants=yes ;;
219 no) cyginfra_loopinvariants=no ;;
220 *) AC_MSG_ERROR([bad value ${enableval} for disable-loopinvariants option]) ;;
221 esac])
222 if test "${cyginfra_loopinvariants}" = "yes"; then
223 AC_DEFINE(CYGDBG_INFRA_DEBUG_LOOP_INVARIANTS)
224 fi
225
226 AC_ARG_ENABLE(tracing,[ --disable-tracing disable tracing],
227 [case "${enableval}" in
228 yes) cyginfra_tracing=yes ;;
229 no) cyginfra_tracing=no ;;
230 *) AC_MSG_ERROR([bad value ${enableval} for disable-tracing option]) ;;
231 esac])
232 if test "${cyginfra_tracing}" = "yes"; then
233 AC_DEFINE(CYGDBG_USE_TRACING)
234 fi
235
236 AC_ARG_ENABLE(fntracing,[ --disable-fntracing disable function entry/exit tracing],
237 [case "${enableval}" in
238 yes) cyginfra_fntracing=yes ;;
239 no) cyginfra_fntracing=no ;;
240 *) AC_MSG_ERROR([bad value ${enableval} for disable-fntracing option]) ;;
241 esac])
242 if test "${cyginfra_fntracing}" = "yes"; then
243 AC_DEFINE(CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS)
244 fi
245
246 ])
247
248 dnl --------------------------------------------------------------------
249 dnl Convert a cygwin pathname to something acceptable to VC++ (but
250 dnl still invoked from bash and cygwin's make). This means using
251 dnl the cygpath utility and then translating any backslashes into
252 dnl forward slashes to avoid confusing make.
253
254 AC_DEFUN(CYG_AC_MSVC_PATH, [
255 AC_REQUIRE([CYG_AC_PROG_MSVC])
256 ifelse($#, 1, , AC_MSG_ERROR("Invalid number of arguments passed to CYG AC_MSVC_PATH"))
257
258 if test "${MSVC}" = "yes" ; then
259 $1=`cygpath -w ${$1} | tr \\\\\\\\ /`
260 fi
261 ])
262
263
264 dnl --------------------------------------------------------------------
265 dnl Work out details of the Tcl installation that should be used.
266 dnl This adds two command-line options, --with-tcl=<prefix> to
267 dnl specify the Tcl install directory, and --with-tcl-version=<vsn>
268 dnl to control which version of Tcl should be used.
269 dnl
270 dnl On Unix systems and under cygwin there should be a file
271 dnl $(tcl_prefix)/lib/tclConfig.sh containing all the information
272 dnl needed for Tcl. This file are consulted and the appropriate
273 dnl variables extracted.
274 dnl
275 dnl To confuse matters, subtly different naming conventions are used
276 dnl under Unix and NT. Under Unix the Tcl library will be called
277 dnl libtcl8.0.a, libtcl8.1.a, etc. with a dot between the major and
278 dnl minor version. Under NT (including cygwin) the library will be
279 dnl called tcl80.lib, dnl tcl81.lib, libtcl80.a, libtcl81.a, etc.
280 dnl without a dot.
281 dnl
282 dnl The macro should really assume that it is running inside devo,
283 dnl with tcl and tcl8.1 directories present and already configured.
284 dnl This is tricky for a number of reasons, including confusion about
285 dnl the meaning of top_srcdir.
286 dnl
287 dnl This macro defines four new shell variables which will be
288 dnl substituted (typically into Makefile.in):
289 dnl
290 dnl cyg_ac_tcl_version - the version of Tcl that is to be used
291 dnl cyg_ac_tcl_incdir - location of <tcl.h> etc al
292 dnl cyg_ac_tcl_libdir - location of libtcl.a/tcl.lib etc.
293 dnl cyg_ac_tcl_libs - all of the libraries that are needed for Tcl
294
295 AC_DEFUN(CYG_AC_PATH_TCL, [
296
297 AC_REQUIRE([CYG_AC_PROG_MSVC])
298 AC_REQUIRE([AC_CYGWIN])
299
300 dnl Look for the version of Tcl. If none is specified, default to
301 dnl 8.0 under VC++ and cygwin, nothing under Unix. A version has to be
302 dnl specified under NT because there is no symbolic link from libtcl.a
303 dnl to whatever happens to be the most recent installed version.
304
305 AC_MSG_CHECKING(for Tcl version)
306 AC_ARG_WITH(tcl-version,[ --with-tcl-version=<vsn> version of Tcl to be used],[
307 cyg_ac_tcl_version=${with_tcl_version}
308 ],[
309 if test "${MSVC}" = "yes" ; then
310 cyg_ac_tcl_version=80
311 else
312 if test "${ac_cv_cygwin}" = "yes" ; then
313 cyg_ac_tcl_version=80
314 else
315 cyg_ac_tcl_version=""
316 fi
317 fi
318 ])
319 AC_MSG_RESULT(${cyg_ac_tcl_version})
320 AC_SUBST(cyg_ac_tcl_version)
321
322 dnl Where is the Tcl installation? By default assume Tcl is already
323 dnl installed in the same place as the eCos host-side.
324 AC_MSG_CHECKING(for Tcl installation)
325 AC_ARG_WITH(tcl,[ --with-tcl=<path> location of Tcl header and libraries],[
326 cyg_ac_tcl_incdir=${with_tcl}/include
327 cyg_ac_tcl_libdir=${with_tcl}/lib
328 ],[
329 cyg_ac_tcl_incdir=${prefix}/include
330 cyg_ac_tcl_libdir=${prefix}/lib
331 ])
332 AC_MSG_RESULT(${cyg_ac_tcl_libdir})
333
334 dnl Sanity check, make sure that there is a tcl.h header file.
335 dnl If not then there is no point in proceeding.
336 if test \! -r ${cyg_ac_tcl_incdir}/tcl.h ; then
337 AC_MSG_ERROR(unable to locate Tcl header file tcl.h)
338 fi
339
340 dnl If using VC++ then there is no tclConfig.sh file, so the
341 dnl library information has to be hard-wired. Otherwise ther
342 dnl should be a tclConfig.sh file containing the necessary information.
343 if test "${MSVC}" = "yes" ; then
344 cyg_ac_tcl_libs="tcl${cyg_ac_tcl_version}.lib"
345 CYG_AC_MSVC_PATH(cyg_ac_tcl_incdir)
346 CYG_AC_MSVC_PATH(cyg_ac_tcl_libdir)
347 else
348 if test \! -r ${cyg_ac_tcl_libdir}/tclConfig.sh ; then
349 AC_MSG_ERROR(unable to locate Tcl config file tclConfig.sh)
350 else
351 . ${cyg_ac_tcl_libdir}/tclConfig.sh
352 cyg_ac_tcl_libs="-ltcl${cyg_ac_tcl_version} ${TCL_LIBS}"
353 fi
354 fi
355
356 AC_SUBST(cyg_ac_tcl_incdir)
357 AC_SUBST(cyg_ac_tcl_libdir)
358 AC_SUBST(cyg_ac_tcl_libs)
359 AC_SUBST(cyg_ac_tk_libs)
360 ])
361
362
363