Daily bump.
[official-gcc.git] / libjava / aclocal.m4
blobc58b2dc70a15005f5942da082bc201073c468319
1 # aclocal.m4 generated automatically by aclocal 1.5
3 # Copyright 1996, 1997, 1998, 1999, 2000, 2001
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
14 AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
15 [changequote(<<, >>)dnl
16 dnl The name to #define.
17 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
18 dnl The cache variable name.
19 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
20 changequote([, ])dnl
21 AC_MSG_CHECKING(size of $1)
22 AC_CACHE_VAL(AC_CV_NAME,
23 [for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence.
24   AC_TRY_COMPILE([#include "confdefs.h"
25 #include <sys/types.h>
27 ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
28   if test x$AC_CV_NAME != x ; then break; fi
29 done
31 if test x$AC_CV_NAME = x ; then
32   AC_MSG_ERROR([cannot determine a size for $1])
34 AC_MSG_RESULT($AC_CV_NAME)
35 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
36 undefine([AC_TYPE_NAME])dnl
37 undefine([AC_CV_NAME])dnl
40 AC_DEFUN(LIBGCJ_CONFIGURE,
42 dnl Default to --enable-multilib
43 AC_ARG_ENABLE(multilib,
44 [  --enable-multilib       build many library versions (default)],
45 [case "${enableval}" in
46   yes) multilib=yes ;;
47   no)  multilib=no ;;
48   *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
49  esac], [multilib=yes])dnl
51 dnl We may get other options which we don't document:
52 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
54 # When building with srcdir == objdir, links to the source files will
55 # be created in directories within the target_subdir.  We have to
56 # adjust toplevel_srcdir accordingly, so that configure finds
57 # install-sh and other auxiliary files that live in the top-level
58 # source directory.
59 if test "${srcdir}" = "."; then
60   if test -z "${with_target_subdir}"; then
61     toprel=".."
62   else
63     if test "${with_target_subdir}" != "."; then
64       toprel="${with_multisrctop}../.."
65     else
66       toprel="${with_multisrctop}.."
67     fi
68   fi
69 else
70   toprel=".."
73 libgcj_basedir=$srcdir/$toprel/$1/libjava
74 AC_SUBST(libgcj_basedir)
76 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
77 if :; then :; else
78   # This overrides the previous occurrence for automake, but not for
79   # autoconf, which is exactly what we want.
80   AC_CONFIG_AUX_DIR(..)
83 # This works around an automake problem.
84 mkinstalldirs="`cd $ac_aux_dir && pwd`/mkinstalldirs"
85 AC_SUBST(mkinstalldirs)
87 AC_CANONICAL_SYSTEM
89 dnl This shouldn't be needed, as long as top-level dependencies are
90 dnl defined correctly and shared-library paths are set up so that
91 dnl execution tests succeed.  FIXME.
92 define([AC_PROG_CC_WORKS],[])
93 define([AC_PROG_CXX_WORKS],[])
95 AC_PROG_CC
97 # We use the libstdc++-v3 version of LIB_AC_PROG_CXX, but use
98 # glibjava_CXX instead of glibcpp_CXX.  That's because we're passed a
99 # different definition of CXX than other directories, since we don't
100 # depend on libstdc++-v3 having already been built.
101 AC_DEFUN(LIB_AC_PROG_CXX,
102 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
103 dnl Fool anybody using AC_PROG_CXX.
104 AC_PROVIDE([AC_PROG_CXX])
105 # Use glibjava_CXX so that we do not cause CXX to be cached with the
106 # flags that come in CXX while configuring libjava.  They're different
107 # from those used for all other target libraries.  If CXX is set in
108 # the environment, respect that here.
109 glibjava_CXX=$CXX
110 AC_CHECK_PROGS(glibjava_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
111 AC_SUBST(CXX)
112 CXX=$glibjava_CXX
113 test -z "$glibjava_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
115 AC_PROG_CXX_GNU
117 if test "$ac_cv_prog_gxx" = yes; then
118   GXX=yes
119 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
120 dnl plays around with CXXFLAGS (such as to build both debugging and
121 dnl normal versions of a library), tasteless as that idea is.
122   ac_test_CXXFLAGS="${CXXFLAGS+set}"
123   ac_save_CXXFLAGS="$CXXFLAGS"
124   CXXFLAGS=
125   AC_PROG_CXX_G
126   if test "$ac_test_CXXFLAGS" = set; then
127     CXXFLAGS="$ac_save_CXXFLAGS"
128   elif test "$ac_cv_prog_cxx_g" = yes; then
129     CXXFLAGS="-g -O2"
130   else
131     CXXFLAGS="-O2"
132   fi
133 else
134   GXX=
135   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
139 LIB_AC_PROG_CXX
141 dnl version is pulled out to make it a bit easier to change using sed.
142 version=0.0.7
143 dnl Still use "libjava" here to placate dejagnu.
144 AM_INIT_AUTOMAKE(libjava, $version)
146 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
147 # run it explicitly here, it will be run implicitly before
148 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
149 # be run before AC_CANONICAL_HOST.
150 AC_CANONICAL_BUILD
152 AC_CHECK_TOOL(AS, as)
153 AC_CHECK_TOOL(AR, ar)
154 AC_CHECK_TOOL(RANLIB, ranlib, :)
156 AC_PROG_INSTALL
158 AM_MAINTAINER_MODE
160 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
161 # at least currently, we never actually build a program, so we never
162 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
163 # fails, because we are probably configuring with a cross compiler
164 # which cant create executables.  So we include AC_EXEEXT to keep
165 # automake happy, but we don't execute it, since we don't care about
166 # the result.
167 if false; then
168   # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
169   # to nothing, so nothing would remain between `then' and `fi' if it
170   # were not for the `:' below.
171   :
172   AC_EXEEXT
175 # configure.host sets the following important variables
176 #       libgcj_cflags    - host specific C compiler flags
177 #       libgcj_cxxflags  - host specific C++ compiler flags
178 #       libgcj_javaflags - host specific Java compiler flags
180 libgcj_cflags=
181 libgcj_cxxflags=
182 libgcj_javaflags=
184 . [$]{srcdir}/configure.host
186 LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
187 LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
188 LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
189 AC_SUBST(LIBGCJ_CFLAGS)
190 AC_SUBST(LIBGCJ_CXXFLAGS)
191 AC_SUBST(LIBGCJ_JAVAFLAGS)
192 ])dnl
194 sinclude(../libtool.m4)
195 dnl The lines below arrange for aclocal not to bring libtool.m4
196 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
197 dnl to add a definition of LIBTOOL to Makefile.in.
198 ifelse(yes,no,[
199 AC_DEFUN([AM_PROG_LIBTOOL],)
200 AC_DEFUN([AC_LIBTOOL_DLOPEN],)
201 AC_DEFUN([AC_LIBLTDL_CONVENIENCE],)
202 AC_DEFUN([LT_AC_PROG_GCJ],)
203 AC_SUBST(GCJ)
204 AC_SUBST(LIBTOOL)
207 #serial AM2
209 dnl From Bruno Haible.
211 AC_DEFUN([AM_ICONV],
213   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
214   dnl those with the standalone portable GNU libiconv installed).
216   am_cv_lib_iconv_ldpath=
217   AC_ARG_WITH([libiconv-prefix],
218 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
219     for dir in `echo "$withval" | tr : ' '`; do
220       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
221       if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
222     done
223    ])
225   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
226     am_cv_func_iconv="no, consider installing GNU libiconv"
227     am_cv_lib_iconv=no
228     AC_TRY_LINK([#include <stdlib.h>
229 #include <iconv.h>],
230       [iconv_t cd = iconv_open("","");
231        iconv(cd,NULL,NULL,NULL,NULL);
232        iconv_close(cd);],
233       am_cv_func_iconv=yes)
234     if test "$am_cv_func_iconv" != yes; then
235       am_save_LIBS="$LIBS"
236       LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
237       AC_TRY_LINK([#include <stdlib.h>
238 #include <iconv.h>],
239         [iconv_t cd = iconv_open("","");
240          iconv(cd,NULL,NULL,NULL,NULL);
241          iconv_close(cd);],
242         am_cv_lib_iconv=yes
243         am_cv_func_iconv=yes)
244       LIBS="$am_save_LIBS"
245     fi
246   ])
247   if test "$am_cv_func_iconv" = yes; then
248     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
249     AC_MSG_CHECKING([for iconv declaration])
250     AC_CACHE_VAL(am_cv_proto_iconv, [
251       AC_TRY_COMPILE([
252 #include <stdlib.h>
253 #include <iconv.h>
254 extern
255 #ifdef __cplusplus
257 #endif
258 #if defined(__STDC__) || defined(__cplusplus)
259 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
260 #else
261 size_t iconv();
262 #endif
263 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
264       am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
265     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
266     AC_MSG_RESULT([$]{ac_t:-
267          }[$]am_cv_proto_iconv)
268     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
269       [Define as const if the declaration of iconv() needs const.])
270   fi
271   LIBICONV=
272   if test "$am_cv_lib_iconv" = yes; then
273     LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
274   fi
275   AC_SUBST(LIBICONV)
278 # Check whether LC_MESSAGES is available in <locale.h>.
279 # Ulrich Drepper <drepper@cygnus.com>, 1995.
281 # This file can be copied and used freely without restrictions.  It can
282 # be used in projects which are not available under the GNU General Public
283 # License or the GNU Library General Public License but which still want
284 # to provide support for the GNU gettext functionality.
285 # Please note that the actual code of the GNU gettext library is covered
286 # by the GNU Library General Public License, and the rest of the GNU
287 # gettext package package is covered by the GNU General Public License.
288 # They are *not* in the public domain.
290 # serial 2
292 AC_DEFUN([AM_LC_MESSAGES],
293   [if test "$ac_cv_header_locale_h" = yes; then
294     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
295       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
296        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
297     if test "$am_cv_val_LC_MESSAGES" = yes; then
298       AC_DEFINE(HAVE_LC_MESSAGES, 1,
299         [Define if your <locale.h> file defines LC_MESSAGES.])
300     fi
301   fi])
303 # Do all the work for Automake.  This macro actually does too much --
304 # some checks are only needed if your package does certain things.
305 # But this isn't really a big deal.
307 # serial 5
309 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
310 # written in clear, in which case automake, when reading aclocal.m4,
311 # will think it sees a *use*, and therefore will trigger all it's
312 # C support machinery.  Also note that it means that autoscan, seeing
313 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
316 # We require 2.13 because we rely on SHELL being computed by configure.
317 AC_PREREQ([2.13])
319 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
320 # -----------------------------------------------------------
321 # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
322 # The purpose of this macro is to provide the user with a means to
323 # check macros which are provided without letting her know how the
324 # information is coded.
325 # If this macro is not defined by Autoconf, define it here.
326 ifdef([AC_PROVIDE_IFELSE],
327       [],
328       [define([AC_PROVIDE_IFELSE],
329               [ifdef([AC_PROVIDE_$1],
330                      [$2], [$3])])])
333 # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
334 # ----------------------------------------------
335 AC_DEFUN([AM_INIT_AUTOMAKE],
336 [AC_REQUIRE([AC_PROG_INSTALL])dnl
337 # test to see if srcdir already configured
338 if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
339    test -f $srcdir/config.status; then
340   AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])
343 # Define the identity of the package.
344 PACKAGE=$1
345 AC_SUBST(PACKAGE)dnl
346 VERSION=$2
347 AC_SUBST(VERSION)dnl
348 ifelse([$3],,
349 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
350 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
352 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
353 # the ones we care about.
354 ifdef([m4_pattern_allow],
355       [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl
357 # Autoconf 2.50 always computes EXEEXT.  However we need to be
358 # compatible with 2.13, for now.  So we always define EXEEXT, but we
359 # don't compute it.
360 AC_SUBST(EXEEXT)
361 # Similar for OBJEXT -- only we only use OBJEXT if the user actually
362 # requests that it be used.  This is a bit dumb.
363 : ${OBJEXT=o}
364 AC_SUBST(OBJEXT)
366 # Some tools Automake needs.
367 AC_REQUIRE([AM_SANITY_CHECK])dnl
368 AC_REQUIRE([AC_ARG_PROGRAM])dnl
369 AM_MISSING_PROG(ACLOCAL, aclocal)
370 AM_MISSING_PROG(AUTOCONF, autoconf)
371 AM_MISSING_PROG(AUTOMAKE, automake)
372 AM_MISSING_PROG(AUTOHEADER, autoheader)
373 AM_MISSING_PROG(MAKEINFO, makeinfo)
374 AM_MISSING_PROG(AMTAR, tar)
375 AM_PROG_INSTALL_SH
376 AM_PROG_INSTALL_STRIP
377 # We need awk for the "check" target.  The system "awk" is bad on
378 # some platforms.
379 AC_REQUIRE([AC_PROG_AWK])dnl
380 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
381 AC_REQUIRE([AM_DEP_TRACK])dnl
382 AC_REQUIRE([AM_SET_DEPDIR])dnl
383 AC_PROVIDE_IFELSE([AC_PROG_][CC],
384                   [_AM_DEPENDENCIES(CC)],
385                   [define([AC_PROG_][CC],
386                           defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
387 AC_PROVIDE_IFELSE([AC_PROG_][CXX],
388                   [_AM_DEPENDENCIES(CXX)],
389                   [define([AC_PROG_][CXX],
390                           defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
394 # Check to make sure that the build environment is sane.
397 # serial 3
399 # AM_SANITY_CHECK
400 # ---------------
401 AC_DEFUN([AM_SANITY_CHECK],
402 [AC_MSG_CHECKING([whether build environment is sane])
403 # Just in case
404 sleep 1
405 echo timestamp > conftest.file
406 # Do `set' in a subshell so we don't clobber the current shell's
407 # arguments.  Must try -L first in case configure is actually a
408 # symlink; some systems play weird games with the mod time of symlinks
409 # (eg FreeBSD returns the mod time of the symlink's containing
410 # directory).
411 if (
412    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
413    if test "$[*]" = "X"; then
414       # -L didn't work.
415       set X `ls -t $srcdir/configure conftest.file`
416    fi
417    rm -f conftest.file
418    if test "$[*]" != "X $srcdir/configure conftest.file" \
419       && test "$[*]" != "X conftest.file $srcdir/configure"; then
421       # If neither matched, then we have a broken ls.  This can happen
422       # if, for instance, CONFIG_SHELL is bash and it inherits a
423       # broken ls alias from the environment.  This has actually
424       # happened.  Such a system could not be considered "sane".
425       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
426 alias in your environment])
427    fi
429    test "$[2]" = conftest.file
430    )
431 then
432    # Ok.
433    :
434 else
435    AC_MSG_ERROR([newly created file is older than distributed files!
436 Check your system clock])
438 AC_MSG_RESULT(yes)])
441 # serial 2
443 # AM_MISSING_PROG(NAME, PROGRAM)
444 # ------------------------------
445 AC_DEFUN([AM_MISSING_PROG],
446 [AC_REQUIRE([AM_MISSING_HAS_RUN])
447 $1=${$1-"${am_missing_run}$2"}
448 AC_SUBST($1)])
451 # AM_MISSING_HAS_RUN
452 # ------------------
453 # Define MISSING if not defined so far and test if it supports --run.
454 # If it does, set am_missing_run to use it, otherwise, to nothing.
455 AC_DEFUN([AM_MISSING_HAS_RUN],
456 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
457 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
458 # Use eval to expand $SHELL
459 if eval "$MISSING --run true"; then
460   am_missing_run="$MISSING --run "
461 else
462   am_missing_run=
463   am_backtick='`'
464   AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
468 # AM_AUX_DIR_EXPAND
470 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
471 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
472 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
474 # Of course, Automake must honor this variable whenever it calls a
475 # tool from the auxiliary directory.  The problem is that $srcdir (and
476 # therefore $ac_aux_dir as well) can be either absolute or relative,
477 # depending on how configure is run.  This is pretty annoying, since
478 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
479 # source directory, any form will work fine, but in subdirectories a
480 # relative path needs to be adjusted first.
482 # $ac_aux_dir/missing
483 #    fails when called from a subdirectory if $ac_aux_dir is relative
484 # $top_srcdir/$ac_aux_dir/missing
485 #    fails if $ac_aux_dir is absolute,
486 #    fails when called from a subdirectory in a VPATH build with
487 #          a relative $ac_aux_dir
489 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
490 # are both prefixed by $srcdir.  In an in-source build this is usually
491 # harmless because $srcdir is `.', but things will broke when you
492 # start a VPATH build or use an absolute $srcdir.
494 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
495 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
496 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
497 # and then we would define $MISSING as
498 #   MISSING="\${SHELL} $am_aux_dir/missing"
499 # This will work as long as MISSING is not called from configure, because
500 # unfortunately $(top_srcdir) has no meaning in configure.
501 # However there are other variables, like CC, which are often used in
502 # configure, and could therefore not use this "fixed" $ac_aux_dir.
504 # Another solution, used here, is to always expand $ac_aux_dir to an
505 # absolute PATH.  The drawback is that using absolute paths prevent a
506 # configured tree to be moved without reconfiguration.
508 AC_DEFUN([AM_AUX_DIR_EXPAND], [
509 # expand $ac_aux_dir to an absolute path
510 am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd`
513 # AM_PROG_INSTALL_SH
514 # ------------------
515 # Define $install_sh.
516 AC_DEFUN([AM_PROG_INSTALL_SH],
517 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
518 install_sh=${install_sh-"$am_aux_dir/install-sh"}
519 AC_SUBST(install_sh)])
521 # One issue with vendor `install' (even GNU) is that you can't
522 # specify the program used to strip binaries.  This is especially
523 # annoying in cross-compiling environments, where the build's strip
524 # is unlikely to handle the host's binaries.
525 # Fortunately install-sh will honor a STRIPPROG variable, so we
526 # always use install-sh in `make install-strip', and initialize
527 # STRIPPROG with the value of the STRIP variable (set by the user).
528 AC_DEFUN([AM_PROG_INSTALL_STRIP],
529 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
530 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
531 AC_SUBST([INSTALL_STRIP_PROGRAM])])
533 # serial 4                                              -*- Autoconf -*-
537 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
538 # written in clear, in which case automake, when reading aclocal.m4,
539 # will think it sees a *use*, and therefore will trigger all it's
540 # C support machinery.  Also note that it means that autoscan, seeing
541 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
545 # _AM_DEPENDENCIES(NAME)
546 # ---------------------
547 # See how the compiler implements dependency checking.
548 # NAME is "CC", "CXX" or "OBJC".
549 # We try a few techniques and use that to set a single cache variable.
551 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
552 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
553 # dependency, and given that the user is not expected to run this macro,
554 # just rely on AC_PROG_CC.
555 AC_DEFUN([_AM_DEPENDENCIES],
556 [AC_REQUIRE([AM_SET_DEPDIR])dnl
557 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
558 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
559 AC_REQUIRE([AM_DEP_TRACK])dnl
561 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
562        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
563        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc']
564        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
565                    [depcc="$$1"   am_compiler_list=])
567 AC_CACHE_CHECK([dependency style of $depcc],
568                [am_cv_$1_dependencies_compiler_type],
569 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
570   # We make a subdir and do the tests there.  Otherwise we can end up
571   # making bogus files that we don't know about and never remove.  For
572   # instance it was reported that on HP-UX the gcc test will end up
573   # making a dummy file named `D' -- because `-MD' means `put the output
574   # in D'.
575   mkdir conftest.dir
576   # Copy depcomp to subdir because otherwise we won't find it if we're
577   # using a relative directory.
578   cp "$am_depcomp" conftest.dir
579   cd conftest.dir
581   am_cv_$1_dependencies_compiler_type=none
582   if test "$am_compiler_list" = ""; then
583      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
584   fi
585   for depmode in $am_compiler_list; do
586     # We need to recreate these files for each test, as the compiler may
587     # overwrite some of them when testing with obscure command lines.
588     # This happens at least with the AIX C compiler.
589     echo '#include "conftest.h"' > conftest.c
590     echo 'int i;' > conftest.h
591     echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
593     case $depmode in
594     nosideeffect)
595       # after this tag, mechanisms are not by side-effect, so they'll
596       # only be used when explicitly requested
597       if test "x$enable_dependency_tracking" = xyes; then
598         continue
599       else
600         break
601       fi
602       ;;
603     none) break ;;
604     esac
605     # We check with `-c' and `-o' for the sake of the "dashmstdout"
606     # mode.  It turns out that the SunPro C++ compiler does not properly
607     # handle `-M -o', and we need to detect this.
608     if depmode=$depmode \
609        source=conftest.c object=conftest.o \
610        depfile=conftest.Po tmpdepfile=conftest.TPo \
611        $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
612        grep conftest.h conftest.Po > /dev/null 2>&1 &&
613        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
614       am_cv_$1_dependencies_compiler_type=$depmode
615       break
616     fi
617   done
619   cd ..
620   rm -rf conftest.dir
621 else
622   am_cv_$1_dependencies_compiler_type=none
625 $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type"
626 AC_SUBST([$1DEPMODE])
630 # AM_SET_DEPDIR
631 # -------------
632 # Choose a directory name for dependency files.
633 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
634 AC_DEFUN([AM_SET_DEPDIR],
635 [rm -f .deps 2>/dev/null
636 mkdir .deps 2>/dev/null
637 if test -d .deps; then
638   DEPDIR=.deps
639 else
640   # MS-DOS does not allow filenames that begin with a dot.
641   DEPDIR=_deps
643 rmdir .deps 2>/dev/null
644 AC_SUBST(DEPDIR)
648 # AM_DEP_TRACK
649 # ------------
650 AC_DEFUN([AM_DEP_TRACK],
651 [AC_ARG_ENABLE(dependency-tracking,
652 [  --disable-dependency-tracking Speeds up one-time builds
653   --enable-dependency-tracking  Do not reject slow dependency extractors])
654 if test "x$enable_dependency_tracking" != xno; then
655   am_depcomp="$ac_aux_dir/depcomp"
656   AMDEPBACKSLASH='\'
658 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
659 pushdef([subst], defn([AC_SUBST]))
660 subst(AMDEPBACKSLASH)
661 popdef([subst])
664 # Generate code to set up dependency tracking.
665 # This macro should only be invoked once -- use via AC_REQUIRE.
666 # Usage:
667 # AM_OUTPUT_DEPENDENCY_COMMANDS
670 # This code is only required when automatic dependency tracking
671 # is enabled.  FIXME.  This creates each `.P' file that we will
672 # need in order to bootstrap the dependency handling code.
673 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[
674 AC_OUTPUT_COMMANDS([
675 test x"$AMDEP_TRUE" != x"" ||
676 for mf in $CONFIG_FILES; do
677   case "$mf" in
678   Makefile) dirpart=.;;
679   */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
680   *) continue;;
681   esac
682   grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
683   # Extract the definition of DEP_FILES from the Makefile without
684   # running `make'.
685   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
686   test -z "$DEPDIR" && continue
687   # When using ansi2knr, U may be empty or an underscore; expand it
688   U=`sed -n -e '/^U = / s///p' < "$mf"`
689   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
690   # We invoke sed twice because it is the simplest approach to
691   # changing $(DEPDIR) to its actual value in the expansion.
692   for file in `sed -n -e '
693     /^DEP_FILES = .*\\\\$/ {
694       s/^DEP_FILES = //
695       :loop
696         s/\\\\$//
697         p
698         n
699         /\\\\$/ b loop
700       p
701     }
702     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
703        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
704     # Make sure the directory exists.
705     test -f "$dirpart/$file" && continue
706     fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
707     $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
708     # echo "creating $dirpart/$file"
709     echo '# dummy' > "$dirpart/$file"
710   done
711 done
712 ], [AMDEP_TRUE="$AMDEP_TRUE"
713 ac_aux_dir="$ac_aux_dir"])])
715 # AM_MAKE_INCLUDE()
716 # -----------------
717 # Check to see how make treats includes.
718 AC_DEFUN([AM_MAKE_INCLUDE],
719 [am_make=${MAKE-make}
720 cat > confinc << 'END'
721 doit:
722         @echo done
724 # If we don't find an include directive, just comment out the code.
725 AC_MSG_CHECKING([for style of include used by $am_make])
726 am__include='#'
727 am__quote=
728 _am_result=none
729 # First try GNU make style include.
730 echo "include confinc" > confmf
731 # We grep out `Entering directory' and `Leaving directory'
732 # messages which can occur if `w' ends up in MAKEFLAGS.
733 # In particular we don't look at `^make:' because GNU make might
734 # be invoked under some other name (usually "gmake"), in which
735 # case it prints its new name instead of `make'.
736 if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
737    am__include=include
738    am__quote=
739    _am_result=GNU
741 # Now try BSD make style include.
742 if test "$am__include" = "#"; then
743    echo '.include "confinc"' > confmf
744    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
745       am__include=.include
746       am__quote='"'
747       _am_result=BSD
748    fi
750 AC_SUBST(am__include)
751 AC_SUBST(am__quote)
752 AC_MSG_RESULT($_am_result)
753 rm -f confinc confmf
756 # serial 3
758 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
759 # -------------------------------------
760 # Define a conditional.
762 # FIXME: Once using 2.50, use this:
763 # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl
764 AC_DEFUN([AM_CONDITIONAL],
765 [ifelse([$1], [TRUE],
766         [errprint(__file__:__line__: [$0: invalid condition: $1
767 ])dnl
768 m4exit(1)])dnl
769 ifelse([$1], [FALSE],
770        [errprint(__file__:__line__: [$0: invalid condition: $1
771 ])dnl
772 m4exit(1)])dnl
773 AC_SUBST([$1_TRUE])
774 AC_SUBST([$1_FALSE])
775 if $2; then
776   $1_TRUE=
777   $1_FALSE='#'
778 else
779   $1_TRUE='#'
780   $1_FALSE=
781 fi])
783 # Add --enable-maintainer-mode option to configure.
784 # From Jim Meyering
786 # serial 1
788 AC_DEFUN([AM_MAINTAINER_MODE],
789 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
790   dnl maintainer-mode is disabled by default
791   AC_ARG_ENABLE(maintainer-mode,
792 [  --enable-maintainer-mode enable make rules and dependencies not useful
793                           (and sometimes confusing) to the casual installer],
794       USE_MAINTAINER_MODE=$enableval,
795       USE_MAINTAINER_MODE=no)
796   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
797   AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
798   MAINT=$MAINTAINER_MODE_TRUE
799   AC_SUBST(MAINT)dnl
803 # Like AC_CONFIG_HEADER, but automatically create stamp file.
805 # serial 3
807 # When config.status generates a header, we must update the stamp-h file.
808 # This file resides in the same directory as the config header
809 # that is generated.  We must strip everything past the first ":",
810 # and everything past the last "/".
812 AC_PREREQ([2.12])
814 AC_DEFUN([AM_CONFIG_HEADER],
815 [ifdef([AC_FOREACH],dnl
816          [dnl init our file count if it isn't already
817          m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0]))
818          dnl prepare to store our destination file list for use in config.status
819          AC_FOREACH([_AM_File], [$1],
820                     [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*]))
821                     m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index))
822                     dnl and add it to the list of files AC keeps track of, along
823                     dnl with our hook
824                     AC_CONFIG_HEADERS(_AM_File,
825 dnl COMMANDS, [, INIT-CMDS]
826 [# update the timestamp
827 echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index["
828 ][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS
829                     m4_popdef([_AM_Dest])])],dnl
830 [AC_CONFIG_HEADER([$1])
831   AC_OUTPUT_COMMANDS(
832    ifelse(patsubst([$1], [[^ ]], []),
833           [],
834           [test -z "$CONFIG_HEADERS" || echo timestamp >dnl
835            patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl
836 [am_indx=1
837 for am_file in $1; do
838   case " \$CONFIG_HEADERS " in
839   *" \$am_file "*)
840     am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\`
841     if test -n "\$am_dir"; then
842       am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\`
843       for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do
844         am_tmpdir=\$am_tmpdir\$am_subdir/
845         if test ! -d \$am_tmpdir; then
846           mkdir \$am_tmpdir
847         fi
848       done
849     fi
850     echo timestamp > "\$am_dir"stamp-h\$am_indx
851     ;;
852   esac
853   am_indx=\`expr \$am_indx + 1\`
854 done])
855 ])]) # AM_CONFIG_HEADER
857 # _AM_DIRNAME(PATH)
858 # -----------------
859 # Like AS_DIRNAME, only do it during macro expansion
860 AC_DEFUN([_AM_DIRNAME],
861        [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
862               m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1,
863                     m4_if(m4_regexp([$1], [^/.*]), -1,
864                           [.],
865                           m4_patsubst([$1], [^\(/\).*], [\1])),
866                     m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
867               m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
868 ]) # _AM_DIRNAME