]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Put back AC_LBL_C_INLINE; it turns out that wasn't the cause of the
authorguy <guy>
Thu, 21 Apr 2005 02:22:38 +0000 (02:22 +0000)
committerguy <guy>
Thu, 21 Apr 2005 02:22:38 +0000 (02:22 +0000)
inline problem, and AC_LBL_C_INLINE checks for a case that some versions
of the HP C compiler don't handle, and only uses inline if that case
succeeds.

aclocal.m4
config.h.in
configure
configure.in

index 2d5e46a34b24eeaa2b06fa9f8930316c8d60a59a..5c63556630c3c632bd652885da536d6a26e8d87e 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.106.2.2 2005-04-20 09:51:03 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.106.2.3 2005-04-21 02:22:38 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1995, 1996, 1997, 1998
 dnl    The Regents of the University of California.  All rights reserved.
 dnl
 dnl Copyright (c) 1995, 1996, 1997, 1998
 dnl    The Regents of the University of California.  All rights reserved.
@@ -157,6 +157,52 @@ AC_DEFUN(AC_LBL_C_INIT,
     fi
 ])
 
     fi
 ])
 
+
+#
+# Try compiling a sample of the type of code that appears in
+# gencode.c with "inline", "__inline__", and "__inline".
+#
+# Autoconf's AC_C_INLINE, at least in autoconf 2.13, isn't good enough,
+# as it just tests whether a function returning "int" can be inlined;
+# at least some versions of HP's C compiler can inline that, but can't
+# inline a function that returns a struct pointer.
+#
+AC_DEFUN(AC_LBL_C_INLINE,
+    [AC_MSG_CHECKING(for inline)
+    AC_CACHE_VAL(ac_cv_lbl_inline, [
+       ac_cv_lbl_inline=""
+       ac_lbl_cc_inline=no
+       for ac_lbl_inline in inline __inline__ __inline
+       do
+           AC_TRY_COMPILE(
+               [#define inline $ac_lbl_inline
+               static inline struct iltest *foo(void);
+               struct iltest {
+                   int iltest1;
+                   int iltest2;
+               };
+
+               static inline struct iltest *
+               foo()
+               {
+                   static struct iltest xxx;
+
+                   return &xxx;
+               }],,ac_lbl_cc_inline=yes,)
+           if test "$ac_lbl_cc_inline" = yes ; then
+               break;
+           fi
+       done
+       if test "$ac_lbl_cc_inline" = yes ; then
+           ac_cv_lbl_inline=$ac_lbl_inline
+       fi])
+    if test ! -z "$ac_cv_lbl_inline" ; then
+       AC_MSG_RESULT($ac_cv_lbl_inline)
+    else
+       AC_MSG_RESULT(no)
+    fi
+    AC_DEFINE_UNQUOTED(inline, $ac_cv_lbl_inline, [Define as token for inline if inlining supported])])
+
 dnl
 dnl Use pfopen.c if available and pfopen() not in standard libraries
 dnl Require libpcap
 dnl
 dnl Use pfopen.c if available and pfopen() not in standard libraries
 dnl Require libpcap
index afc66d80aadf2f382ed6b4e4f54a49dff3d33d5f..1088e51fabddcc1ad78fe5c24b56686b7eb84bf9 100644 (file)
 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
 #undef TIME_WITH_SYS_TIME
 
 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
 #undef TIME_WITH_SYS_TIME
 
-/* Define as `__inline' if that's what the C compiler calls it, or to nothing
-   if it is not supported. */
+/* Define as token for inline if inlining supported */
 #undef inline
 
 /* Define to `short' if int16_t not defined. */
 #undef inline
 
 /* Define to `short' if int16_t not defined. */
index 9a9ebe0c2838ec87ae2e22f979dae212fb50a92c..9a6fd2c814533d4e6b639834bf549eee344069c9 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
 #! /bin/sh
-# From configure.in Revision: 1.188.2.3 .
+# From configure.in Revision: 1.188.2.4 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.57.
 #
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.57.
 #
@@ -2503,24 +2503,42 @@ _ACEOF
 
 echo "$as_me:$LINENO: checking for inline" >&5
 echo $ECHO_N "checking for inline... $ECHO_C" >&6
 
 echo "$as_me:$LINENO: checking for inline" >&5
 echo $ECHO_N "checking for inline... $ECHO_C" >&6
-if test "${ac_cv_c_inline+set}" = set; then
+    if test "${ac_cv_lbl_inline+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
-  cat >conftest.$ac_ext <<_ACEOF
+
+       ac_cv_lbl_inline=""
+       ac_lbl_cc_inline=no
+       for ac_lbl_inline in inline __inline__ __inline
+       do
+           cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#ifndef __cplusplus
-typedef int foo_t;
-static $ac_kw foo_t static_foo () {return 0; }
-$ac_kw foo_t foo () {return 0; }
-#endif
+#define inline $ac_lbl_inline
+               static inline struct iltest *foo(void);
+               struct iltest {
+                   int iltest1;
+                   int iltest2;
+               };
 
 
+               static inline struct iltest *
+               foo()
+               {
+                   static struct iltest xxx;
+
+                   return &xxx;
+               }
+int
+main ()
+{
+
+  ;
+  return 0;
+}
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -2534,30 +2552,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_c_inline=$ac_kw; break
+  ac_lbl_cc_inline=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-done
-
+           if test "$ac_lbl_cc_inline" = yes ; then
+               break;
+           fi
+       done
+       if test "$ac_lbl_cc_inline" = yes ; then
+           ac_cv_lbl_inline=$ac_lbl_inline
+       fi
 fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6
-case $ac_cv_c_inline in
-  inline | yes) ;;
-  no)
-cat >>confdefs.h <<\_ACEOF
-#define inline
-_ACEOF
- ;;
-  *)  cat >>confdefs.h <<_ACEOF
-#define inline $ac_cv_c_inline
+
+    if test ! -z "$ac_cv_lbl_inline" ; then
+       echo "$as_me:$LINENO: result: $ac_cv_lbl_inline" >&5
+echo "${ECHO_T}$ac_cv_lbl_inline" >&6
+    else
+       echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    fi
+
+cat >>confdefs.h <<_ACEOF
+#define inline $ac_cv_lbl_inline
 _ACEOF
 _ACEOF
- ;;
-esac
 
 
 echo "$as_me:$LINENO: checking for __attribute__" >&5
 
 
 echo "$as_me:$LINENO: checking for __attribute__" >&5
index 376e9fab98539158d2b7a35ff23cc83bb076fbcd..8fbe2bfd7334c1773f7e334aceb98b9055fc139e 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.188.2.3 2005-04-20 11:20:52 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.188.2.4 2005-04-21 02:22:38 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl    The Regents of the University of California.  All rights reserved.
 dnl
 dnl Copyright (c) 1994, 1995, 1996, 1997
 dnl    The Regents of the University of California.  All rights reserved.
@@ -6,14 +6,14 @@ dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
-AC_REVISION($Revision: 1.188.2.3 $)
+AC_REVISION($Revision: 1.188.2.4 $)
 AC_PREREQ(2.50)
 AC_INIT(tcpdump.c)
 
 AC_CANONICAL_HOST
 
 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
 AC_PREREQ(2.50)
 AC_INIT(tcpdump.c)
 
 AC_CANONICAL_HOST
 
 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
-AC_C_INLINE
+AC_LBL_C_INLINE
 AC_C___ATTRIBUTE__
 AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h)
 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
 AC_C___ATTRIBUTE__
 AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h)
 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>