From: guy Date: Thu, 21 Apr 2005 02:22:38 +0000 (+0000) Subject: Put back AC_LBL_C_INLINE; it turns out that wasn't the cause of the X-Git-Tag: tcpdump-3.9.1~116 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/b9310cc0db6b64492e201863f10c08bae9b21574 Put back AC_LBL_C_INLINE; it turns out that wasn't the cause of the 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. --- diff --git a/aclocal.m4 b/aclocal.m4 index 2d5e46a3..5c635566 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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. @@ -157,6 +157,52 @@ AC_DEFUN(AC_LBL_C_INIT, 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 diff --git a/config.h.in b/config.h.in index afc66d80..1088e51f 100644 --- a/config.h.in +++ b/config.h.in @@ -316,8 +316,7 @@ /* Define to 1 if you can safely include both and . */ #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. */ diff --git a/configure b/configure index 9a9ebe0c..9a6fd2c8 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /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. # @@ -2503,24 +2503,42 @@ _ACEOF 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 - 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. */ -#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 @@ -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_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 -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 -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 - ;; -esac echo "$as_me:$LINENO: checking for __attribute__" >&5 diff --git a/configure.in b/configure.in index 376e9fab..8fbe2bfd 100644 --- a/configure.in +++ b/configure.in @@ -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. @@ -6,14 +6,14 @@ 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_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