source: trunk/essentials/sys-devel/automake-1.8/m4/depend.m4

Last change on this file was 3118, checked in by bird, 18 years ago

automake 1.8.5

File size: 6.4 KB
Line 
1# serial 7 -*- Autoconf -*-
2
3# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
4# Free Software Foundation, Inc.
5
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)
9# any later version.
10
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.
15
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
19# 02111-1307, USA.
20
21
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...
27
28
29
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.
35#
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.
40AC_DEFUN([_AM_DEPENDENCIES],
41[AC_REQUIRE([AM_SET_DEPDIR])dnl
42AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
43AC_REQUIRE([AM_MAKE_INCLUDE])dnl
44AC_REQUIRE([AM_DEP_TRACK])dnl
45
46ifelse([$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=])
51
52AC_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
59 # in D'.
60 mkdir conftest.dir
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
64 cd 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
70 # directory.
71 mkdir sub
72
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`
76 fi
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.
81 #
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.
85 : > sub/conftest.c
86 for i in 1 2 3 4 5 6; do
87 echo '#include "conftst'$i'.h"' >> sub/conftest.c
88 # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
89 # Solaris 8's {/usr,}/bin/sh.
90 touch sub/conftst$i.h
91 done
92 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
93
94 case $depmode in
95 nosideeffect)
96 # after this tag, mechanisms are not by side-effect, so they'll
97 # only be used when explicitly requested
98 if test "x$enable_dependency_tracking" = xyes; then
99 continue
100 else
101 break
102 fi
103 ;;
104 none) break ;;
105 esac
106 # We check with `-c' and `-o' for the sake of the "dashmstdout"
107 # mode. It turns out that the SunPro C++ compiler does not properly
108 # handle `-M -o', and we need to detect this.
109 if depmode=$depmode \
110 source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
111 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
112 $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
113 >/dev/null 2>conftest.err &&
114 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
115 grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
116 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
117 # icc doesn't choke on unknown options, it will just issue warnings
118 # or remarks (even with -Werror). So we grep stderr for any message
119 # that says an option was ignored or not supported.
120 # When given -MP, icc 7.0 and 7.1 complain thusly:
121 # icc: Command line warning: ignoring option '-M'; no argument required
122 # The diagnosis changed in icc 8.0:
123 # icc: Command line remark: option '-MP' not supported
124 if (grep 'ignoring option' conftest.err ||
125 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
126 am_cv_$1_dependencies_compiler_type=$depmode
127 break
128 fi
129 fi
130 done
131
132 cd ..
133 rm -rf conftest.dir
134else
135 am_cv_$1_dependencies_compiler_type=none
136fi
137])
138AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
139AM_CONDITIONAL([am__fastdep$1], [
140 test "x$enable_dependency_tracking" != xno \
141 && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
142])
143
144
145# AM_SET_DEPDIR
146# -------------
147# Choose a directory name for dependency files.
148# This macro is AC_REQUIREd in _AM_DEPENDENCIES
149AC_DEFUN([AM_SET_DEPDIR],
150[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
151AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
152])
153
154
155# AM_DEP_TRACK
156# ------------
157AC_DEFUN([AM_DEP_TRACK],
158[AC_ARG_ENABLE(dependency-tracking,
159[ --disable-dependency-tracking speeds up one-time build
160 --enable-dependency-tracking do not reject slow dependency extractors])
161if test "x$enable_dependency_tracking" != xno; then
162 am_depcomp="$ac_aux_dir/depcomp"
163 AMDEPBACKSLASH='\'
164fi
165AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
166AC_SUBST([AMDEPBACKSLASH])
167])
Note: See TracBrowser for help on using the repository browser.