Edit

kc3-lang/automake/m4/depend.m4

Branch :

  • Show log

    Commit

  • Author : Tom Tromey
    Date : 2001-05-18 00:00:33
    Hash : e8fef394
    Message : * m4/depend.m4 (AM_DEPENDENCIES): If depcomp doesn't exist, revert to no dependency tracking. * tests/Makefile.am (TESTS): Added depcomp2.test. * tests/depcomp2.test: New file. From Pavel Roskin.

  • m4/depend.m4
  • # serial 3
    
    # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
    # written in clear, in which case automake, when reading aclocal.m4,
    # will think it sees a *use*, and therefore will trigger all it's
    # C support machinery.  Also note that it means that autoscan, seeing
    # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
    
    # AM_DEPENDENCIES(NAME)
    # ---------------------
    # See how the compiler implements dependency checking.
    # NAME is "CC", "CXX" or "OBJC".
    # We try a few techniques and use that to set a single cache variable.
    AC_DEFUN([AM_DEPENDENCIES],
    [AC_REQUIRE([AM_SET_DEPDIR])dnl
    AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
    am_compiler_list=
    ifelse([$1], CC,
           [AC_REQUIRE([AC_PROG_][CC])dnl
    AC_REQUIRE([AC_PROG_][CPP])
    depcc="$CC"
    depcpp="$CPP"],
           [$1], CXX, [AC_REQUIRE([AC_PROG_][CXX])dnl
    AC_REQUIRE([AC_PROG_][CXXCPP])
    depcc="$CXX"
    depcpp="$CXXCPP"],
           [$1], OBJC, [am_compiler_list='gcc3 gcc'
    depcc="$OBJC"
    depcpp=""],
           [$1], GCJ,  [am_compiler_list='gcc3 gcc'
    depcc="$GCJ"
    depcpp=""],
           [AC_REQUIRE([AC_PROG_][$1])dnl
    depcc="$$1"
    depcpp=""])
    
    AC_REQUIRE([AM_MAKE_INCLUDE])
    AC_REQUIRE([AM_DEP_TRACK])
    
    AC_CACHE_CHECK([dependency style of $depcc],
                   [am_cv_$1_dependencies_compiler_type],
    [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
      # We make a subdir and do the tests there.  Otherwise we can end up
      # making bogus files that we don't know about and never remove.  For
      # instance it was reported that on HP-UX the gcc test will end up
      # making a dummy file named `D' -- because `-MD' means `put the output
      # in D'.
      mkdir confdir
      # Copy depcomp to subdir because otherwise we won't find it if we're
      # using a relative directory.
      cp "$am_depcomp" confdir
      cd confdir
    
      am_cv_$1_dependencies_compiler_type=none
      if test "$am_compiler_list" = ""; then
         am_compiler_list="`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`"
      fi
      for depmode in $am_compiler_list; do
        # We need to recreate these files for each test, as the compiler may
        # overwrite some of them when testing with obscure command lines.
        # This happens at least with the AIX C compiler.
        echo '#include "conftest.h"' > conftest.c
        echo 'int i;' > conftest.h
    
        case "$depmode" in
        nosideeffect)
          # after this tag, mechanisms are not by side-effect, so they'll
          # only be used when explicitly requested
          if test "x$enable_dependency_tracking" = xyes; then
    	continue
          else
    	break
          fi
          ;;
        none) break ;;
        esac
        # We check with `-c' and `-o' for the sake of the "dashmstdout"
        # mode.  It turns out that the SunPro C++ compiler does not properly
        # handle `-M -o', and we need to detect this.
        if depmode="$depmode" \
           source=conftest.c object=conftest.o \
           depfile=conftest.Po tmpdepfile=conftest.TPo \
           $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
           grep conftest.h conftest.Po > /dev/null 2>&1; then
          am_cv_$1_dependencies_compiler_type="$depmode"
          break
        fi
      done
    
      cd ..
      rm -rf confdir
    else
      am_cv_$1_dependencies_compiler_type=none
    fi
    ])
    $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type"
    AC_SUBST([$1DEPMODE])
    ])
    
    
    # AM_SET_DEPDIR
    # -------------
    # Choose a directory name for dependency files.
    # This macro is AC_REQUIREd in AM_DEPENDENCIES
    AC_DEFUN([AM_SET_DEPDIR],
    [if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
      DEPDIR=.deps
      # We redirect because .deps might already exist and be populated.
      # In this situation we don't want to see an error.
      rmdir .deps > /dev/null 2>&1
    else
      DEPDIR=_deps
    fi
    AC_SUBST(DEPDIR)
    ])
    
    
    # AM_DEP_TRACK
    # ------------
    AC_DEFUN([AM_DEP_TRACK],
    [AC_ARG_ENABLE(dependency-tracking,
    [  --disable-dependency-tracking Speeds up one-time builds
      --enable-dependency-tracking  Do not reject slow dependency extractors])
    if test "x$enable_dependency_tracking" != xno; then
      am_depcomp="$ac_aux_dir/depcomp"
      AMDEPBACKSLASH='\'
    fi
    AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
    pushdef([subst], defn([AC_SUBST]))
    subst(AMDEPBACKSLASH)
    popdef([subst])
    ])