OSDN Git Service

2002-02-27 Jeff Johnston <jjohnstn@redhat.com>
[pf3gnuchains/pf3gnuchains3x.git] / newlib / libc / machine / v850 / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
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.
7
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.
12
13 dnl This provides configure definitions used by all the newlib
14 dnl configure.in files.
15
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
19 dnl newlib directory.
20
21 AC_DEFUN(NEWLIB_CONFIGURE,
22 [
23 dnl Default to --enable-multilib
24 AC_ARG_ENABLE(multilib,
25 [  --enable-multilib         build many library versions (default)],
26 [case "${enableval}" in
27   yes) multilib=yes ;;
28   no)  multilib=no ;;
29   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
30  esac], [multilib=yes])dnl
31
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
40
41 dnl Support --enable-malloc-debugging - currently only supported for Cygwin
42 AC_ARG_ENABLE(malloc-debugging,
43 [  --enable-malloc-debugging indicate malloc debugging requested],
44 [case "${enableval}" in
45   yes) malloc_debugging=yes ;;
46   no)  malloc_debugging=no ;;
47   *)   AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
48  esac], [malloc_debugging=])dnl
49
50 dnl Support --enable-newlib-mb
51 AC_ARG_ENABLE(newlib-mb,
52 [  --enable-newlib-mb        enable multibyte support],
53 [case "${enableval}" in
54   yes) newlib_mb=yes ;;
55   no)  newlib_mb=no ;;
56   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
57  esac], [newlib_mb=no])dnl
58
59 dnl Support --disable-newlib-io-float
60 AC_ARG_ENABLE(newlib-io-float,
61 [  --disable-newlib-io-float disable printf/scanf family float support],
62 [case "${enableval}" in
63   yes) newlib_io_float=yes ;;
64   no)  newlib_io_float=no ;;
65   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
66  esac], [newlib_io_float=yes])dnl
67
68
69 dnl We may get other options which we don't document:
70 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
71
72 test -z "[$]{with_target_subdir}" && with_target_subdir=.
73
74 if test "[$]{srcdir}" = "."; then
75   if test "[$]{with_target_subdir}" != "."; then
76     newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
77   else
78     newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
79   fi
80 else
81   newlib_basedir="[$]{srcdir}/$1"
82 fi
83 AC_SUBST(newlib_basedir)
84
85 AC_CANONICAL_HOST
86
87 AM_INIT_AUTOMAKE(newlib, 1.10.0)
88
89 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
90 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
91 # are probably using a cross compiler, which will not be able to fully
92 # link an executable.  This should really be fixed in autoconf
93 # itself.
94
95 AC_DEFUN(LIB_AC_PROG_CC,
96 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
97 AC_CHECK_PROG(CC, gcc, gcc)
98 if test -z "$CC"; then
99   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
100   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
101 fi
102
103 AC_PROG_CC_GNU
104
105 if test $ac_cv_prog_gcc = yes; then
106   GCC=yes
107 dnl Check whether -g works, even if CFLAGS is set, in case the package
108 dnl plays around with CFLAGS (such as to build both debugging and
109 dnl normal versions of a library), tasteless as that idea is.
110   ac_test_CFLAGS="${CFLAGS+set}"
111   ac_save_CFLAGS="$CFLAGS"
112   CFLAGS=
113   AC_PROG_CC_G
114   if test "$ac_test_CFLAGS" = set; then
115     CFLAGS="$ac_save_CFLAGS"
116   elif test $ac_cv_prog_cc_g = yes; then
117     CFLAGS="-g -O2"
118   else
119     CFLAGS="-O2"
120   fi
121 else
122   GCC=
123   test "${CFLAGS+set}" = set || CFLAGS="-g"
124 fi
125 ])
126
127 LIB_AC_PROG_CC
128
129 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
130 # run it explicitly here, it will be run implicitly before
131 # NEWLIB_CONFIGURE, which doesn't work because that means that it will
132 # be run before AC_CANONICAL_HOST.
133 AC_CANONICAL_BUILD
134
135 AC_CHECK_TOOL(AS, as)
136 AC_CHECK_TOOL(AR, ar)
137 AC_CHECK_TOOL(RANLIB, ranlib, :)
138
139 AC_PROG_INSTALL
140
141 AM_MAINTAINER_MODE
142
143 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
144 # at least currently, we never actually build a program, so we never
145 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
146 # fails, because we are probably configuring with a cross compiler
147 # which can't create executables.  So we include AC_EXEEXT to keep
148 # automake happy, but we don't execute it, since we don't care about
149 # the result.
150 if false; then
151   AC_EXEEXT
152 fi
153
154 . [$]{newlib_basedir}/configure.host
155
156 case [$]{newlib_basedir} in
157 /* | [A-Za-z]:[/\\]*) newlib_flagbasedir=[$]{newlib_basedir} ;;
158 *) newlib_flagbasedir='[$](top_builddir)/'[$]{newlib_basedir} ;;
159 esac
160
161 newlib_cflags="[$]{newlib_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{newlib_flagbasedir}/libc/include"
162 case "${host}" in
163   *-*-cygwin*)
164     newlib_cflags="[$]{newlib_cflags} -I[$]{newlib_flagbasedir}/../winsup/cygwin/include  -I[$]{newlib_flagbasedir}/../winsup/w32api/include"
165     ;;
166 esac
167
168 newlib_cflags="[$]{newlib_cflags} -fno-builtin"
169
170 NEWLIB_CFLAGS=${newlib_cflags}
171 AC_SUBST(NEWLIB_CFLAGS)
172
173 LDFLAGS=${ldflags}
174 AC_SUBST(LDFLAGS)
175
176 AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
177 AC_SUBST(oext)
178 AC_SUBST(aext)
179
180 AC_SUBST(libm_machine_dir)
181 AC_SUBST(machine_dir)
182 AC_SUBST(sys_dir)
183 ])
184
185 # Do all the work for Automake.  This macro actually does too much --
186 # some checks are only needed if your package does certain things.
187 # But this isn't really a big deal.
188
189 # serial 1
190
191 dnl Usage:
192 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
193
194 AC_DEFUN(AM_INIT_AUTOMAKE,
195 [AC_REQUIRE([AC_PROG_INSTALL])
196 PACKAGE=[$1]
197 AC_SUBST(PACKAGE)
198 VERSION=[$2]
199 AC_SUBST(VERSION)
200 dnl test to see if srcdir already configured
201 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
202   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
203 fi
204 ifelse([$3],,
205 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
206 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
207 AC_REQUIRE([AM_SANITY_CHECK])
208 AC_REQUIRE([AC_ARG_PROGRAM])
209 dnl FIXME This is truly gross.
210 missing_dir=`cd $ac_aux_dir && pwd`
211 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
212 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
213 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
214 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
215 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
216 AC_REQUIRE([AC_PROG_MAKE_SET])])
217
218 #
219 # Check to make sure that the build environment is sane.
220 #
221
222 AC_DEFUN(AM_SANITY_CHECK,
223 [AC_MSG_CHECKING([whether build environment is sane])
224 # Just in case
225 sleep 1
226 echo timestamp > conftestfile
227 # Do `set' in a subshell so we don't clobber the current shell's
228 # arguments.  Must try -L first in case configure is actually a
229 # symlink; some systems play weird games with the mod time of symlinks
230 # (eg FreeBSD returns the mod time of the symlink's containing
231 # directory).
232 if (
233    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
234    if test "[$]*" = "X"; then
235       # -L didn't work.
236       set X `ls -t $srcdir/configure conftestfile`
237    fi
238    if test "[$]*" != "X $srcdir/configure conftestfile" \
239       && test "[$]*" != "X conftestfile $srcdir/configure"; then
240
241       # If neither matched, then we have a broken ls.  This can happen
242       # if, for instance, CONFIG_SHELL is bash and it inherits a
243       # broken ls alias from the environment.  This has actually
244       # happened.  Such a system could not be considered "sane".
245       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
246 alias in your environment])
247    fi
248
249    test "[$]2" = conftestfile
250    )
251 then
252    # Ok.
253    :
254 else
255    AC_MSG_ERROR([newly created file is older than distributed files!
256 Check your system clock])
257 fi
258 rm -f conftest*
259 AC_MSG_RESULT(yes)])
260
261 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
262 dnl The program must properly implement --version.
263 AC_DEFUN(AM_MISSING_PROG,
264 [AC_MSG_CHECKING(for working $2)
265 # Run test in a subshell; some versions of sh will print an error if
266 # an executable is not found, even if stderr is redirected.
267 # Redirect stdin to placate older versions of autoconf.  Sigh.
268 if ($2 --version) < /dev/null > /dev/null 2>&1; then
269    $1=$2
270    AC_MSG_RESULT(found)
271 else
272    $1="$3/missing $2"
273    AC_MSG_RESULT(missing)
274 fi
275 AC_SUBST($1)])
276
277 # Add --enable-maintainer-mode option to configure.
278 # From Jim Meyering
279
280 # serial 1
281
282 AC_DEFUN(AM_MAINTAINER_MODE,
283 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
284   dnl maintainer-mode is disabled by default
285   AC_ARG_ENABLE(maintainer-mode,
286 [  --enable-maintainer-mode enable make rules and dependencies not useful
287                           (and sometimes confusing) to the casual installer],
288       USE_MAINTAINER_MODE=$enableval,
289       USE_MAINTAINER_MODE=no)
290   AC_MSG_RESULT($USE_MAINTAINER_MODE)
291   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
292   MAINT=$MAINTAINER_MODE_TRUE
293   AC_SUBST(MAINT)dnl
294 ]
295 )
296
297 # Define a conditional.
298
299 AC_DEFUN(AM_CONDITIONAL,
300 [AC_SUBST($1_TRUE)
301 AC_SUBST($1_FALSE)
302 if $2; then
303   $1_TRUE=
304   $1_FALSE='#'
305 else
306   $1_TRUE='#'
307   $1_FALSE=
308 fi])
309