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