]> The Tcpdump Group git mirrors - tcpdump/blobdiff - configure
Support dependency generation with some non-GCC compilers.
[tcpdump] / configure
index 014eca66f78067afce5cedc4a249c3ea274f626b..68af1c33324a84b26d3ca376ba9956d76c9a5a59 100755 (executable)
--- a/configure
+++ b/configure
@@ -673,6 +673,7 @@ EGREP
 LIBOBJS
 PCAP_CONFIG
 RANLIB
+DEPENDENCY_CFLAG MKDEP
 V_CCOPT
 V_DEFS
 V_GROUP
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
            fi
+
+       { echo "$as_me:$LINENO: checking whether the compiler supports generating dependencies" >&5
+echo $ECHO_N "checking whether the compiler supports generating dependencies... $ECHO_C" >&6; }
+       if test "$GCC" = yes ; then
+               #
+               # GCC, or a compiler deemed to be GCC by AC_PROG_CC (even
+               # though it's not); we assume that, in this case, the flag
+               # would be -M.
+               #
+               ac_lbl_dependency_flag="-M"
+       else
+               #
+               # Not GCC or a compiler deemed to be GCC; what platform is
+               # this?  (We're assuming that if the compiler isn't GCC
+               # it's the compiler from the vendor of the OS; that won't
+               # necessarily be true for x86 platforms, where it might be
+               # the Intel C compiler.)
+               #
+               case "$host_os" in
+
+               irix*|osf*|darwin*)
+                       #
+                       # MIPS C for IRIX, DEC C, and clang all use -M.
+                       #
+                       ac_lbl_dependency_flag="-M"
+                       ;;
+
+               solaris*)
+                       #
+                       # Sun C uses -xM.
+                       #
+                       ac_lbl_dependency_flag="-xM"
+                       ;;
+
+               hpux*)
+                       #
+                       # HP's older C compilers don't support this.
+                       # HP's newer C compilers support this with
+                       # either +M or +Make; the older compilers
+                       # interpret +M as something completely
+                       # different, so we use +Make so we don't
+                       # think it works with the older compilers.
+                       #
+                       ac_lbl_dependency_flag="+Make"
+                       ;;
+
+               *)
+                       #
+                       # Not one of the above; assume no support for
+                       # generating dependencies.
+                       #
+                       ac_lbl_dependency_flag=""
+                       ;;
+               esac
+       fi
+
+       #
+       # Is ac_lbl_dependency_flag defined and, if so, does the compiler
+       # complain about it?
+       #
+       # Note: clang doesn't seem to exit with an error status when handed
+       # an unknown non-warning error, even if you pass it
+       # -Werror=unknown-warning-option.  However, it always supports
+       # -M, so the fact that this test always succeeds with clang
+       # isn't an issue.
+       #
+       if test ! -z "$ac_lbl_dependency_flag"; then
+               cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+int main(void) { return 0; }
+_ACEOF
+               echo "$CC" $ac_lbl_dependency_flag conftest.c >&5
+               if "$CC" $ac_lbl_dependency_flag conftest.c >/dev/null 2>&1; then
+                       { echo "$as_me:$LINENO: result: yes, with $ac_lbl_dependency_flag" >&5
+echo "${ECHO_T}yes, with $ac_lbl_dependency_flag" >&6; }
+                       DEPENDENCY_CFLAG="$ac_lbl_dependency_flag"
+                       MKDEP='${srcdir}/mkdep'
+               else
+                       { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+                       #
+                       # We can't run mkdep, so have "make depend" do
+                       # nothing.
+                       #
+                       MKDEP=:
+               fi
+               rm -rf conftest*
+       else
+               { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+               #
+               # We can't run mkdep, so have "make depend" do
+               # nothing.
+               #
+               MKDEP=:
+       fi
+
+
            if test "$GCC" = yes ; then
                    if test "${LBL_CFLAGS+set}" != set; then
                            if test "$ac_cv_prog_cc_g" = yes ; then
@@ -12989,6 +13092,8 @@ EGREP!$EGREP$ac_delim
 LIBOBJS!$LIBOBJS$ac_delim
 PCAP_CONFIG!$PCAP_CONFIG$ac_delim
 RANLIB!$RANLIB$ac_delim
+DEPENDENCY_CFLAG!$DEPENDENCY_CFLAG$ac_delim
+MKDEP!$MKDEP$ac_delim
 V_CCOPT!$V_CCOPT$ac_delim
 V_DEFS!$V_DEFS$ac_delim
 V_GROUP!$V_GROUP$ac_delim
@@ -13003,7 +13108,7 @@ INSTALL_DATA!$INSTALL_DATA$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5