depstand.m4 revision 1.1.1.1.4.2 1 1.1.1.1.4.2 yamt ## -*- Autoconf -*-
2 1.1.1.1.4.2 yamt
3 1.1.1.1.4.2 yamt # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
4 1.1.1.1.4.2 yamt # Free Software Foundation, Inc.
5 1.1.1.1.4.2 yamt #
6 1.1.1.1.4.2 yamt # This file is free software; the Free Software Foundation
7 1.1.1.1.4.2 yamt # gives unlimited permission to copy and/or distribute it,
8 1.1.1.1.4.2 yamt # with or without modifications, as long as this notice is preserved.
9 1.1.1.1.4.2 yamt
10 1.1.1.1.4.2 yamt # serial 8
11 1.1.1.1.4.2 yamt
12 1.1.1.1.4.2 yamt # Based on depend.m4 from automake 1.9, modified for standalone use in
13 1.1.1.1.4.2 yamt # an environment where GNU make is required.
14 1.1.1.1.4.2 yamt
15 1.1.1.1.4.2 yamt # ZW_PROG_COMPILER_DEPENDENCIES
16 1.1.1.1.4.2 yamt # -----------------------------
17 1.1.1.1.4.2 yamt # Variant of _AM_DEPENDENCIES which just does the dependency probe and
18 1.1.1.1.4.2 yamt # sets fooDEPMODE accordingly. Cache-variable compatible with
19 1.1.1.1.4.2 yamt # original; not side-effect compatible. As the users of this macro
20 1.1.1.1.4.2 yamt # may require accurate dependencies for correct builds, it does *not*
21 1.1.1.1.4.2 yamt # honor --disable-dependency-checking, and failure to detect a usable
22 1.1.1.1.4.2 yamt # method is an error. depcomp is assumed to be located in
23 1.1.1.1.4.2 yamt # $ac_aux_dir.
24 1.1.1.1.4.2 yamt #
25 1.1.1.1.4.2 yamt # FIXME: Should use the Autoconf 2.5x language-selection mechanism.
26 1.1.1.1.4.2 yamt
27 1.1.1.1.4.2 yamt AC_DEFUN([ZW_PROG_COMPILER_DEPENDENCIES],
28 1.1.1.1.4.2 yamt [ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
29 1.1.1.1.4.2 yamt [$1], CXX, [depcc="$CXX" am_compiler_list=],
30 1.1.1.1.4.2 yamt [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
31 1.1.1.1.4.2 yamt [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
32 1.1.1.1.4.2 yamt [depcc="$$1" am_compiler_list=])
33 1.1.1.1.4.2 yamt
34 1.1.1.1.4.2 yamt am_depcomp=$ac_aux_dir/depcomp
35 1.1.1.1.4.2 yamt AC_CACHE_CHECK([dependency style of $depcc],
36 1.1.1.1.4.2 yamt [am_cv_$1_dependencies_compiler_type],
37 1.1.1.1.4.2 yamt [if test -f "$am_depcomp"; then
38 1.1.1.1.4.2 yamt # We make a subdir and do the tests there. Otherwise we can end up
39 1.1.1.1.4.2 yamt # making bogus files that we don't know about and never remove. For
40 1.1.1.1.4.2 yamt # instance it was reported that on HP-UX the gcc test will end up
41 1.1.1.1.4.2 yamt # making a dummy file named `D' -- because `-MD' means `put the output
42 1.1.1.1.4.2 yamt # in D'.
43 1.1.1.1.4.2 yamt mkdir conftest.dir
44 1.1.1.1.4.2 yamt # Copy depcomp to subdir because otherwise we won't find it if we're
45 1.1.1.1.4.2 yamt # using a relative directory.
46 1.1.1.1.4.2 yamt cp "$am_depcomp" conftest.dir
47 1.1.1.1.4.2 yamt cd conftest.dir
48 1.1.1.1.4.2 yamt # We will build objects and dependencies in a subdirectory because
49 1.1.1.1.4.2 yamt # it helps to detect inapplicable dependency modes. For instance
50 1.1.1.1.4.2 yamt # both Tru64's cc and ICC support -MD to output dependencies as a
51 1.1.1.1.4.2 yamt # side effect of compilation, but ICC will put the dependencies in
52 1.1.1.1.4.2 yamt # the current directory while Tru64 will put them in the object
53 1.1.1.1.4.2 yamt # directory.
54 1.1.1.1.4.2 yamt mkdir sub
55 1.1.1.1.4.2 yamt
56 1.1.1.1.4.2 yamt am_cv_$1_dependencies_compiler_type=none
57 1.1.1.1.4.2 yamt if test "$am_compiler_list" = ""; then
58 1.1.1.1.4.2 yamt am_compiler_list=`sed -n ['s/^\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
59 1.1.1.1.4.2 yamt fi
60 1.1.1.1.4.2 yamt for depmode in $am_compiler_list; do
61 1.1.1.1.4.2 yamt if test $depmode = none; then break; fi
62 1.1.1.1.4.2 yamt
63 1.1.1.1.4.2 yamt _AS_ECHO([$as_me:$LINENO: trying $depmode], AS_MESSAGE_LOG_FD)
64 1.1.1.1.4.2 yamt # Setup a source with many dependencies, because some compilers
65 1.1.1.1.4.2 yamt # like to wrap large dependency lists on column 80 (with \), and
66 1.1.1.1.4.2 yamt # we should not choose a depcomp mode which is confused by this.
67 1.1.1.1.4.2 yamt #
68 1.1.1.1.4.2 yamt # We need to recreate these files for each test, as the compiler may
69 1.1.1.1.4.2 yamt # overwrite some of them when testing with obscure command lines.
70 1.1.1.1.4.2 yamt # This happens at least with the AIX C compiler.
71 1.1.1.1.4.2 yamt : > sub/conftest.c
72 1.1.1.1.4.2 yamt for i in 1 2 3 4 5 6; do
73 1.1.1.1.4.2 yamt echo '#include "conftst'$i'.h"' >> sub/conftest.c
74 1.1.1.1.4.2 yamt # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
75 1.1.1.1.4.2 yamt # Solaris 8's {/usr,}/bin/sh.
76 1.1.1.1.4.2 yamt touch sub/conftst$i.h
77 1.1.1.1.4.2 yamt done
78 1.1.1.1.4.2 yamt echo "include sub/conftest.Po" > confmf
79 1.1.1.1.4.2 yamt
80 1.1.1.1.4.2 yamt # We check with `-c' and `-o' for the sake of the "dashmstdout"
81 1.1.1.1.4.2 yamt # mode. It turns out that the SunPro C++ compiler does not properly
82 1.1.1.1.4.2 yamt # handle `-M -o', and we need to detect this.
83 1.1.1.1.4.2 yamt depcmd="depmode=$depmode \
84 1.1.1.1.4.2 yamt source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
85 1.1.1.1.4.2 yamt depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
86 1.1.1.1.4.2 yamt $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c"
87 1.1.1.1.4.2 yamt echo "| $depcmd" | sed -e 's/ */ /g' >&AS_MESSAGE_LOG_FD
88 1.1.1.1.4.2 yamt if env $depcmd > conftest.err 2>&1 &&
89 1.1.1.1.4.2 yamt grep sub/conftst6.h sub/conftest.Po >>conftest.err 2>&1 &&
90 1.1.1.1.4.2 yamt grep sub/conftest.${OBJEXT-o} sub/conftest.Po >>conftest.err 2>&1 &&
91 1.1.1.1.4.2 yamt ${MAKE-make} -s -f confmf >>conftest.err 2>&1; then
92 1.1.1.1.4.2 yamt # icc doesn't choke on unknown options, it will just issue warnings
93 1.1.1.1.4.2 yamt # or remarks (even with -Werror). So we grep stderr for any message
94 1.1.1.1.4.2 yamt # that says an option was ignored or not supported.
95 1.1.1.1.4.2 yamt # When given -MP, icc 7.0 and 7.1 complain thusly:
96 1.1.1.1.4.2 yamt # icc: Command line warning: ignoring option '-M'; no argument required
97 1.1.1.1.4.2 yamt # The diagnosis changed in icc 8.0:
98 1.1.1.1.4.2 yamt # icc: Command line remark: option '-MP' not supported
99 1.1.1.1.4.2 yamt if (grep 'ignoring option' conftest.err ||
100 1.1.1.1.4.2 yamt grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
101 1.1.1.1.4.2 yamt am_cv_$1_dependencies_compiler_type=$depmode
102 1.1.1.1.4.2 yamt _AS_ECHO([$as_me:$LINENO: success], AS_MESSAGE_LOG_FD)
103 1.1.1.1.4.2 yamt break
104 1.1.1.1.4.2 yamt fi
105 1.1.1.1.4.2 yamt fi
106 1.1.1.1.4.2 yamt _AS_ECHO([$as_me:$LINENO: failure, diagnostics are:], AS_MESSAGE_LOG_FD)
107 1.1.1.1.4.2 yamt sed -e 's/^/| /' < conftest.err >&AS_MESSAGE_LOG_FD
108 1.1.1.1.4.2 yamt done
109 1.1.1.1.4.2 yamt
110 1.1.1.1.4.2 yamt cd ..
111 1.1.1.1.4.2 yamt rm -rf conftest.dir
112 1.1.1.1.4.2 yamt else
113 1.1.1.1.4.2 yamt am_cv_$1_dependencies_compiler_type=none
114 1.1.1.1.4.2 yamt fi
115 1.1.1.1.4.2 yamt ])
116 1.1.1.1.4.2 yamt if test x${am_cv_$1_dependencies_compiler_type-none} = xnone
117 1.1.1.1.4.2 yamt then AC_MSG_ERROR([no usable dependency style found])
118 1.1.1.1.4.2 yamt else AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
119 1.1.1.1.4.2 yamt fi
120 1.1.1.1.4.2 yamt ])
121 1.1.1.1.4.2 yamt
122 1.1.1.1.4.2 yamt # AM_SET_DEPDIR
123 1.1.1.1.4.2 yamt # -------------
124 1.1.1.1.4.2 yamt # Choose a directory name for dependency files.
125 1.1.1.1.4.2 yamt AC_DEFUN([AM_SET_DEPDIR],
126 1.1.1.1.4.2 yamt [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
127 1.1.1.1.4.2 yamt AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
128 1.1.1.1.4.2 yamt ])
129 1.1.1.1.4.2 yamt
130 1.1.1.1.4.2 yamt # ZW_CREATE_DEPDIR
131 1.1.1.1.4.2 yamt # ----------------
132 1.1.1.1.4.2 yamt # As AM_SET_DEPDIR, but also create the directory at config.status time.
133 1.1.1.1.4.2 yamt AC_DEFUN([ZW_CREATE_DEPDIR],
134 1.1.1.1.4.2 yamt [AC_REQUIRE([AM_SET_DEPDIR])dnl
135 1.1.1.1.4.2 yamt AC_CONFIG_COMMANDS([depdir], [$SHELL $ac_aux_dir/mkinstalldirs $DEPDIR],
136 1.1.1.1.4.2 yamt [ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
137 1.1.1.1.4.2 yamt ])
138