OSDN Git Service

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