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