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