1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 dnl This provides configure definitions used by all the newlib
14 dnl configure.in files.
16 dnl Basic newlib configury. This calls basic introductory stuff,
17 dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
18 dnl configure.host. The only argument is the relative path to the top
21 AC_DEFUN(NEWLIB_CONFIGURE,
23 dnl Default to --enable-multilib
24 AC_ARG_ENABLE(multilib,
25 [ --enable-multilib build many library versions (default)],
26 [case "${enableval}" in
29 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
30 esac], [multilib=yes])dnl
32 dnl Support --enable-target-optspace
33 AC_ARG_ENABLE(target-optspace,
34 [ --enable-target-optspace optimize for space],
35 [case "${enableval}" in
36 yes) target_optspace=yes ;;
37 no) target_optspace=no ;;
38 *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
39 esac], [target_optspace=])dnl
41 dnl Support --enable-newlib-mb
42 AC_ARG_ENABLE(newlib-mb,
43 [ --enable-newlib-mb enable multibyte support],
44 [case "${enableval}" in
47 *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
48 esac], [newlib_mb=no])dnl
50 dnl We may get other options which we don't document:
51 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
53 test -z "[$]{with_target_subdir}" && with_target_subdir=.
55 if test "[$]{srcdir}" = "."; then
56 if test "[$]{with_target_subdir}" != "."; then
57 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
59 newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
62 newlib_basedir="[$]{srcdir}/$1"
64 AC_SUBST(newlib_basedir)
68 AM_INIT_AUTOMAKE(newlib, 1.8.1)
70 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
71 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
72 # are probably using a cross compiler, which will not be able to fully
73 # link an executable. This should really be fixed in autoconf
76 AC_DEFUN(LIB_AC_PROG_CC,
77 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
78 AC_CHECK_PROG(CC, gcc, gcc)
79 if test -z "$CC"; then
80 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
81 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
86 if test $ac_cv_prog_gcc = yes; then
88 dnl Check whether -g works, even if CFLAGS is set, in case the package
89 dnl plays around with CFLAGS (such as to build both debugging and
90 dnl normal versions of a library), tasteless as that idea is.
91 ac_test_CFLAGS="${CFLAGS+set}"
92 ac_save_CFLAGS="$CFLAGS"
95 if test "$ac_test_CFLAGS" = set; then
96 CFLAGS="$ac_save_CFLAGS"
97 elif test $ac_cv_prog_cc_g = yes; then
104 test "${CFLAGS+set}" = set || CFLAGS="-g"
110 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we don't
111 # run it explicitly here, it will be run implicitly before
112 # NEWLIB_CONFIGURE, which doesn't work because that means that it will
113 # be run before AC_CANONICAL_HOST.
116 AC_CHECK_TOOL(AS, as)
117 AC_CHECK_TOOL(AR, ar)
118 AC_CHECK_TOOL(RANLIB, ranlib, :)
124 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
125 # at least currently, we never actually build a program, so we never
126 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
127 # fails, because we are probably configuring with a cross compiler
128 # which can't create executables. So we include AC_EXEEXT to keep
129 # automake happy, but we don't execute it, since we don't care about
135 . [$]{newlib_basedir}/configure.host
137 case [$]{newlib_basedir} in
138 /* | [A-Za-z]:[/\\]*) newlib_flagbasedir=[$]{newlib_basedir} ;;
139 *) newlib_flagbasedir='[$](top_builddir)/'[$]{newlib_basedir} ;;
142 newlib_cflags="[$]{newlib_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{newlib_flagbasedir}/libc/include"
145 newlib_cflags="[$]{newlib_cflags} -I[$]{newlib_flagbasedir}/../winsup/cygwin/include -I[$]{newlib_flagbasedir}/../winsup/w32api/include"
149 newlib_cflags="[$]{newlib_cflags} -fno-builtin"
151 NEWLIB_CFLAGS=${newlib_cflags}
152 AC_SUBST(NEWLIB_CFLAGS)
154 AC_SUBST(machine_dir)
158 # Do all the work for Automake. This macro actually does too much --
159 # some checks are only needed if your package does certain things.
160 # But this isn't really a big deal.
165 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
167 AC_DEFUN(AM_INIT_AUTOMAKE,
168 [AC_REQUIRE([AC_PROG_INSTALL])
173 dnl test to see if srcdir already configured
174 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
175 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
178 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
179 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
180 AC_REQUIRE([AM_SANITY_CHECK])
181 AC_REQUIRE([AC_ARG_PROGRAM])
182 dnl FIXME This is truly gross.
183 missing_dir=`cd $ac_aux_dir && pwd`
184 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
185 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
186 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
187 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
188 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
189 AC_REQUIRE([AC_PROG_MAKE_SET])])
192 # Check to make sure that the build environment is sane.
195 AC_DEFUN(AM_SANITY_CHECK,
196 [AC_MSG_CHECKING([whether build environment is sane])
199 echo timestamp > conftestfile
200 # Do `set' in a subshell so we don't clobber the current shell's
201 # arguments. Must try -L first in case configure is actually a
202 # symlink; some systems play weird games with the mod time of symlinks
203 # (eg FreeBSD returns the mod time of the symlink's containing
206 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
207 if test "[$]*" = "X"; then
209 set X `ls -t $srcdir/configure conftestfile`
211 if test "[$]*" != "X $srcdir/configure conftestfile" \
212 && test "[$]*" != "X conftestfile $srcdir/configure"; then
214 # If neither matched, then we have a broken ls. This can happen
215 # if, for instance, CONFIG_SHELL is bash and it inherits a
216 # broken ls alias from the environment. This has actually
217 # happened. Such a system could not be considered "sane".
218 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
219 alias in your environment])
222 test "[$]2" = conftestfile
228 AC_MSG_ERROR([newly created file is older than distributed files!
229 Check your system clock])
234 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
235 dnl The program must properly implement --version.
236 AC_DEFUN(AM_MISSING_PROG,
237 [AC_MSG_CHECKING(for working $2)
238 # Run test in a subshell; some versions of sh will print an error if
239 # an executable is not found, even if stderr is redirected.
240 # Redirect stdin to placate older versions of autoconf. Sigh.
241 if ($2 --version) < /dev/null > /dev/null 2>&1; then
246 AC_MSG_RESULT(missing)
250 # Add --enable-maintainer-mode option to configure.
255 AC_DEFUN(AM_MAINTAINER_MODE,
256 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
257 dnl maintainer-mode is disabled by default
258 AC_ARG_ENABLE(maintainer-mode,
259 [ --enable-maintainer-mode enable make rules and dependencies not useful
260 (and sometimes confusing) to the casual installer],
261 USE_MAINTAINER_MODE=$enableval,
262 USE_MAINTAINER_MODE=no)
263 AC_MSG_RESULT($USE_MAINTAINER_MODE)
264 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
265 MAINT=$MAINTAINER_MODE_TRUE
270 # Define a conditional.
272 AC_DEFUN(AM_CONDITIONAL,