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

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

automake 1.9.6

File size: 6.0 KB
Line 
1## -*- Autoconf -*-
2
3# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
4# Free Software Foundation, Inc.
5#
6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10# serial 8
11
12# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
13# written in clear, in which case automake, when reading aclocal.m4,
14# will think it sees a *use*, and therefore will trigger all it's
15# C support machinery. Also note that it means that autoscan, seeing
16# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
17
18
19# _AM_DEPENDENCIES(NAME)
20# ----------------------
21# See how the compiler implements dependency checking.
22# NAME is "CC", "CXX", "GCJ", or "OBJC".
23# We try a few techniques and use that to set a single cache variable.
24#
25# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
26# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
27# dependency, and given that the user is not expected to run this macro,
28# just rely on AC_PROG_CC.
29AC_DEFUN([_AM_DEPENDENCIES],
30[AC_REQUIRE([AM_SET_DEPDIR])dnl
31AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
32AC_REQUIRE([AM_MAKE_INCLUDE])dnl
33AC_REQUIRE([AM_DEP_TRACK])dnl
34
35ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
36 [$1], CXX, [depcc="$CXX" am_compiler_list=],
37 [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
38 [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
39 [depcc="$$1" am_compiler_list=])
40
41AC_CACHE_CHECK([dependency style of $depcc],
42 [am_cv_$1_dependencies_compiler_type],
43[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
44 # We make a subdir and do the tests there. Otherwise we can end up
45 # making bogus files that we don't know about and never remove. For
46 # instance it was reported that on HP-UX the gcc test will end up
47 # making a dummy file named `D' -- because `-MD' means `put the output
48 # in D'.
49 mkdir conftest.dir
50 # Copy depcomp to subdir because otherwise we won't find it if we're
51 # using a relative directory.
52 cp "$am_depcomp" conftest.dir
53 cd conftest.dir
54 # We will build objects and dependencies in a subdirectory because
55 # it helps to detect inapplicable dependency modes. For instance
56 # both Tru64's cc and ICC support -MD to output dependencies as a
57 # side effect of compilation, but ICC will put the dependencies in
58 # the current directory while Tru64 will put them in the object
59 # directory.
60 mkdir sub
61
62 am_cv_$1_dependencies_compiler_type=none
63 if test "$am_compiler_list" = ""; then
64 am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
65 fi
66 for depmode in $am_compiler_list; do
67 # Setup a source with many dependencies, because some compilers
68 # like to wrap large dependency lists on column 80 (with \), and
69 # we should not choose a depcomp mode which is confused by this.
70 #
71 # We need to recreate these files for each test, as the compiler may
72 # overwrite some of them when testing with obscure command lines.
73 # This happens at least with the AIX C compiler.
74 : > sub/conftest.c
75 for i in 1 2 3 4 5 6; do
76 echo '#include "conftst'$i'.h"' >> sub/conftest.c
77 # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
78 # Solaris 8's {/usr,}/bin/sh.
79 touch sub/conftst$i.h
80 done
81 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
82
83 case $depmode in
84 nosideeffect)
85 # after this tag, mechanisms are not by side-effect, so they'll
86 # only be used when explicitly requested
87 if test "x$enable_dependency_tracking" = xyes; then
88 continue
89 else
90 break
91 fi
92 ;;
93 none) break ;;
94 esac
95 # We check with `-c' and `-o' for the sake of the "dashmstdout"
96 # mode. It turns out that the SunPro C++ compiler does not properly
97 # handle `-M -o', and we need to detect this.
98 if depmode=$depmode \
99 source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
100 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
101 $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
102 >/dev/null 2>conftest.err &&
103 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
104 grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
105 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
106 # icc doesn't choke on unknown options, it will just issue warnings
107 # or remarks (even with -Werror). So we grep stderr for any message
108 # that says an option was ignored or not supported.
109 # When given -MP, icc 7.0 and 7.1 complain thusly:
110 # icc: Command line warning: ignoring option '-M'; no argument required
111 # The diagnosis changed in icc 8.0:
112 # icc: Command line remark: option '-MP' not supported
113 if (grep 'ignoring option' conftest.err ||
114 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
115 am_cv_$1_dependencies_compiler_type=$depmode
116 break
117 fi
118 fi
119 done
120
121 cd ..
122 rm -rf conftest.dir
123else
124 am_cv_$1_dependencies_compiler_type=none
125fi
126])
127AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
128AM_CONDITIONAL([am__fastdep$1], [
129 test "x$enable_dependency_tracking" != xno \
130 && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
131])
132
133
134# AM_SET_DEPDIR
135# -------------
136# Choose a directory name for dependency files.
137# This macro is AC_REQUIREd in _AM_DEPENDENCIES
138AC_DEFUN([AM_SET_DEPDIR],
139[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
140AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
141])
142
143
144# AM_DEP_TRACK
145# ------------
146AC_DEFUN([AM_DEP_TRACK],
147[AC_ARG_ENABLE(dependency-tracking,
148[ --disable-dependency-tracking speeds up one-time build
149 --enable-dependency-tracking do not reject slow dependency extractors])
150if test "x$enable_dependency_tracking" != xno; then
151 am_depcomp="$ac_aux_dir/depcomp"
152 AMDEPBACKSLASH='\'
153fi
154AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
155AC_SUBST([AMDEPBACKSLASH])
156])
Note: See TracBrowser for help on using the repository browser.