1 # serial 6 -*- Autoconf -*-
3 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
4 # Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
23 # written in clear, in which case automake, when reading aclocal.m4,
24 # will think it sees a *use*, and therefore will trigger all it's
25 # C support machinery. Also note that it means that autoscan, seeing
26 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
30 # _AM_DEPENDENCIES(NAME)
31 # ----------------------
32 # See how the compiler implements dependency checking.
33 # NAME is "CC", "CXX", "GCJ", or "OBJC".
34 # We try a few techniques and use that to set a single cache variable.
36 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
37 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
38 # dependency, and given that the user is not expected to run this macro,
39 # just rely on AC_PROG_CC.
40 AC_DEFUN([_AM_DEPENDENCIES],
41 [AC_REQUIRE([AM_SET_DEPDIR])dnl
42 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
43 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
44 AC_REQUIRE([AM_DEP_TRACK])dnl
46 ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
47 [$1], CXX, [depcc="$CXX" am_compiler_list=],
48 [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
49 [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
50 [depcc="$$1" am_compiler_list=])
52 AC_CACHE_CHECK([dependency style of $depcc],
53 [am_cv_$1_dependencies_compiler_type],
54 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
55 # We make a subdir and do the tests there. Otherwise we can end up
56 # making bogus files that we don't know about and never remove. For
57 # instance it was reported that on HP-UX the gcc test will end up
58 # making a dummy file named `D' -- because `-MD' means `put the output
61 # Copy depcomp to subdir because otherwise we won't find it if we're
62 # using a relative directory.
63 cp "$am_depcomp" conftest.dir
65 # We will build objects and dependencies in a subdirectory because
66 # it helps to detect inapplicable dependency modes. For instance
67 # both Tru64's cc and ICC support -MD to output dependencies as a
68 # side effect of compilation, but ICC will put the dependencies in
69 # the current directory while Tru64 will put them in the object
73 am_cv_$1_dependencies_compiler_type=none
74 if test "$am_compiler_list" = ""; then
75 am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
77 for depmode in $am_compiler_list; do
78 # Setup a source with many dependencies, because some compilers
79 # like to wrap large dependency lists on column 80 (with \), and
80 # we should not choose a depcomp mode which is confused by this.
82 # We need to recreate these files for each test, as the compiler may
83 # overwrite some of them when testing with obscure command lines.
84 # This happens at least with the AIX C compiler.
86 for i in 1 2 3 4 5 6; do
87 echo '#include "conftst'$i'.h"' >> sub/conftest.c
90 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
94 # after this tag, mechanisms are not by side-effect, so they'll
95 # only be used when explicitly requested
96 if test "x$enable_dependency_tracking" = xyes; then
104 # We check with `-c' and `-o' for the sake of the "dashmstdout"
105 # mode. It turns out that the SunPro C++ compiler does not properly
106 # handle `-M -o', and we need to detect this.
107 if depmode=$depmode \
108 source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
109 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
110 $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
111 >/dev/null 2>conftest.err &&
112 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
113 grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
114 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
115 # icc doesn't choke on unknown options, it will just issue warnings
116 # (even with -Werror). So we grep stderr for any message
117 # that says an option was ignored.
118 if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
119 am_cv_$1_dependencies_compiler_type=$depmode
128 am_cv_$1_dependencies_compiler_type=none
131 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
132 AM_CONDITIONAL([am__fastdep$1], [
133 test "x$enable_dependency_tracking" != xno \
134 && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
140 # Choose a directory name for dependency files.
141 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
142 AC_DEFUN([AM_SET_DEPDIR],
143 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
144 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
150 AC_DEFUN([AM_DEP_TRACK],
151 [AC_ARG_ENABLE(dependency-tracking,
152 [ --disable-dependency-tracking speeds up one-time build
153 --enable-dependency-tracking do not reject slow dependency extractors])
154 if test "x$enable_dependency_tracking" != xno; then
155 am_depcomp="$ac_aux_dir/depcomp"
158 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
159 AC_SUBST([AMDEPBACKSLASH])