]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Get rid of some autoconf macros not used, or no longer used, with
authorGuy Harris <[email protected]>
Wed, 8 Jul 2009 08:22:27 +0000 (01:22 -0700)
committerGuy Harris <[email protected]>
Wed, 8 Jul 2009 08:22:27 +0000 (01:22 -0700)
tcpdump.

Check whether __attribute__((format)) can be applied to function
pointers and, if not, don't apply it to function pointers; some older
versions of GCC appear to support applying it to functions, but not
pointers to functions.

As we've gotten rid of missing/getaddrinfo.c, don't use it.

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

index 70ffa41c8c0e864bbf1618e77a65982b7699dc8b..397199d67fac6d8463248a634c69791160fd7739 100644 (file)
@@ -508,65 +508,6 @@ AC_DEFUN(AC_LBL_FIXINCLUDES,
            fi
     fi])
 
-dnl
-dnl Check for flex, default to lex
-dnl Require flex 2.4 or higher
-dnl Check for bison, default to yacc
-dnl Default to lex/yacc if both flex and bison are not available
-dnl Define the yy prefix string if using flex and bison
-dnl
-dnl usage:
-dnl
-dnl    AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix)
-dnl
-dnl results:
-dnl
-dnl    $1 (lex set)
-dnl    $2 (yacc appended)
-dnl    $3 (optional flex and bison -P prefix)
-dnl
-AC_DEFUN(AC_LBL_LEX_AND_YACC,
-    [AC_ARG_WITH(flex, [  --without-flex          don't use flex])
-    AC_ARG_WITH(bison, [  --without-bison         don't use bison])
-    if test "$with_flex" = no ; then
-           $1=lex
-    else
-           AC_CHECK_PROGS($1, flex, lex)
-    fi
-    if test "$$1" = flex ; then
-           # The -V flag was added in 2.4
-           AC_MSG_CHECKING(for flex 2.4 or higher)
-           AC_CACHE_VAL(ac_cv_lbl_flex_v24,
-               if flex -V >/dev/null 2>&1; then
-                       ac_cv_lbl_flex_v24=yes
-               else
-                       ac_cv_lbl_flex_v24=no
-               fi)
-           AC_MSG_RESULT($ac_cv_lbl_flex_v24)
-           if test $ac_cv_lbl_flex_v24 = no ; then
-                   s="2.4 or higher required"
-                   AC_MSG_WARN(ignoring obsolete flex executable ($s))
-                   $1=lex
-           fi
-    fi
-    if test "$with_bison" = no ; then
-           $2=yacc
-    else
-           AC_CHECK_PROGS($2, bison, yacc)
-    fi
-    if test "$$2" = bison ; then
-           $2="$$2 -y"
-    fi
-    if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then
-           AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc)
-           $1=lex
-           $2=yacc
-    fi
-    if test "$$1" = flex -a -n "$3" ; then
-           $1="$$1 -P$3"
-           $2="$$2 -p $3"
-    fi])
-
 dnl
 dnl Checks to see if union wait is used with WEXITSTATUS()
 dnl
@@ -1024,83 +965,6 @@ AC_DEFUN(AC_CHECK_SA_LEN, [
        fi
 ])
 
-dnl
-dnl Checks for portable prototype declaration macro
-AC_DEFUN(AC_CHECK_PORTABLE_PROTO,  [
-       AC_MSG_CHECKING(for __P)
-       AC_CACHE_VAL($1,
-       AC_TRY_COMPILE([
-#              include <unistd.h>],
-               [int f __P(())],
-               $1=yes,
-               $1=no))
-       AC_MSG_RESULT($$1)
-       if test $$1 = yes; then
-               AC_DEFINE(HAVE_PORTABLE_PROTOTYPE)
-       fi
-])
-
-dnl checks for u_intXX_t
-AC_DEFUN(AC_CHECK_BITTYPES, [
-       $1=yes
-dnl check for u_int8_t
-       AC_MSG_CHECKING(for u_int8_t)
-       AC_CACHE_VAL(ac_cv_u_int8_t,
-       AC_TRY_COMPILE([
-#              include <sys/types.h>],
-               [u_int8_t i],
-               ac_cv_u_int8_t=yes,
-               ac_cv_u_int8_t=no))
-       AC_MSG_RESULT($ac_cv_u_int8_t)
-       if test $ac_cv_u_int8_t = yes; then
-               AC_DEFINE(HAVE_U_INT8_T)
-       else
-               $1=no
-       fi
-dnl check for u_int16_t
-       AC_MSG_CHECKING(for u_int16_t)
-       AC_CACHE_VAL(ac_cv_u_int16_t,
-       AC_TRY_COMPILE([
-#              include <sys/types.h>],
-               [u_int16_t i],
-               ac_cv_u_int16_t=yes,
-               ac_cv_u_int16_t=no))
-       AC_MSG_RESULT($ac_cv_u_int16_t)
-       if test $ac_cv_u_int16_t = yes; then
-               AC_DEFINE(HAVE_U_INT16_T)
-       else
-               $1=no
-       fi
-dnl check for u_int32_t
-       AC_MSG_CHECKING(for u_int32_t)
-       AC_CACHE_VAL(ac_cv_u_int32_t,
-       AC_TRY_COMPILE([
-#              include <sys/types.h>],
-               [u_int32_t i],
-               ac_cv_u_int32_t=yes,
-               ac_cv_u_int32_t=no))
-       AC_MSG_RESULT($ac_cv_u_int32_t)
-       if test $ac_cv_u_int32_t = yes; then
-               AC_DEFINE(HAVE_U_INT32_T)
-       else
-               $1=no
-       fi
-dnl check for u_int64_t
-       AC_MSG_CHECKING(for u_int64_t)
-       AC_CACHE_VAL(ac_cv_u_int64_t,
-       AC_TRY_COMPILE([
-#              include <sys/types.h>],
-               [u_int64_t i],
-               ac_cv_u_int64_t=yes,
-               ac_cv_u_int64_t=no))
-       AC_MSG_RESULT($ac_cv_u_int64_t)
-       if test $ac_cv_u_int64_t = yes; then
-               AC_DEFINE(HAVE_U_INT64_T)
-       else
-               $1=no
-       fi
-])
-
 dnl
 dnl Checks for addrinfo structure
 AC_DEFUN(AC_STRUCT_ADDRINFO, [
@@ -1330,6 +1194,37 @@ fi
 AC_MSG_RESULT($ac_cv___attribute__)
 ])
 
+
+dnl
+dnl Test whether __attribute__((format)) can be applied to function
+dnl pointers
+dnl
+
+AC_DEFUN(AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER, [
+AC_MSG_CHECKING([whether __attribute__((format)) can be applied to function pointers])
+AC_CACHE_VAL(ac_cv___attribute___format_function_pointer, [
+AC_COMPILE_IFELSE(
+  AC_LANG_SOURCE([[
+#include <stdlib.h>
+
+extern int (*foo)(const char *fmt, ...)
+                 __attribute__ ((format (printf, 1, 2)));
+
+int
+main(int argc, char **argv)
+{
+  (*foo)("%s", "test");
+}
+  ]]),
+ac_cv___attribute___format_function_pointer=yes,
+ac_cv___attribute___format_function_pointer=no)])
+if test "$ac_cv___attribute___format_function_pointer" = "yes"; then
+  AC_DEFINE(__ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS, 1,
+    [define if your compiler allows __attribute__((format)) to be applied to function pointers])
+fi
+AC_MSG_RESULT($ac_cv___attribute___format_function_pointer)
+])
+
 AC_DEFUN(AC_LBL_SSLEAY,
     [
        #
index c0e762bd1674abe46883d12c6e45da975ec99571..20c3fcf394a9f2386e9d70e7abc809f282936449 100644 (file)
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
-/* Define to 1 if you have the `getaddrinfo' function. */
-#undef HAVE_GETADDRINFO
-
 /* Define to 1 if you have the `getnameinfo' function. */
 #undef HAVE_GETNAMEINFO
 
 /* needed on HP-UX */
 #undef _HPUX_SOURCE
 
+/* define if your compiler allows __attribute__((format)) to be applied to
+   function pointers */
+#undef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
+
 /* to handle Ultrix compilers that don't support const in prototypes */
 #undef const
 
index 6a6c560e47077ea228f12a9846c60bb01d41bf53..7ea108d0cfab9f400618f8f8c379ea6dfa107212 100755 (executable)
--- a/configure
+++ b/configure
@@ -3275,6 +3275,72 @@ fi
 { echo "$as_me:$LINENO: result: $ac_cv___attribute__" >&5
 echo "${ECHO_T}$ac_cv___attribute__" >&6; }
 
+if test "$ac_cv___attribute__" = "yes"; then
+
+{ echo "$as_me:$LINENO: checking whether __attribute__((format)) can be applied to function pointers" >&5
+echo $ECHO_N "checking whether __attribute__((format)) can be applied to function pointers... $ECHO_C" >&6; }
+if test "${ac_cv___attribute___format_function_pointer+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <stdlib.h>
+
+extern int (*foo)(const char *fmt, ...)
+                 __attribute__ ((format (printf, 1, 2)));
+
+int
+main(int argc, char **argv)
+{
+  (*foo)("%s", "test");
+}
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv___attribute___format_function_pointer=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv___attribute___format_function_pointer=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+if test "$ac_cv___attribute___format_function_pointer" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS 1
+_ACEOF
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv___attribute___format_function_pointer" >&5
+echo "${ECHO_T}$ac_cv___attribute___format_function_pointer" >&6; }
+
+fi
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5260,8 +5326,7 @@ echo "${ECHO_T}buggy" >&6; }
 fi
 
 
-
-for ac_func in getaddrinfo getnameinfo
+for ac_func in getnameinfo
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -7423,7 +7488,6 @@ _ACEOF
 
 
 
-
        { echo "$as_me:$LINENO: checking for addrinfo" >&5
 echo $ECHO_N "checking for addrinfo... $ECHO_C" >&6; }
        if test "${ac_cv_addrinfo+set}" = set; then
index e6a78e281ce8d4536da766a8717df4535c4aab4d..50ac7ad91f6ccc6ced934515fe3dd5d9ef2fd6cb 100644 (file)
@@ -24,6 +24,9 @@ AC_CANONICAL_HOST
 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
 AC_LBL_C_INLINE
 AC_C___ATTRIBUTE__
+if test "$ac_cv___attribute__" = "yes"; then
+       AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER
+fi
 AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h)
 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
 #include <sys/socket.h>
@@ -450,7 +453,7 @@ main()
                fi
        fi
        ])
-       AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
+       AC_REPLACE_FUNCS(getnameinfo)
 fi
 
 AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
@@ -471,13 +474,6 @@ AC_CHECK_SIZEOF(int, 4)
 AC_CHECK_SIZEOF(long, 4)
 AC_CHECK_SIZEOF(long long, 8)
 
-dnl
-dnl Checks for u_intXX_t
-dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
-dnl if test "$ac_cv_bittypes" = no; then
-dnl    missing_includes=yes
-dnl fi
-
 dnl
 dnl Checks for addrinfo structure
 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
index c557f6ae4996f80e3a0a080efdcfb89b6c28aca6..9b64f3a5cb066953d55cfca3f6fbd84499806bb1 100644 (file)
@@ -150,13 +150,22 @@ struct netdissect_options {
 
   int  (*ndo_printf)(netdissect_options *,
                     const char *fmt, ...)
-                    __attribute__ ((format (printf, 2, 3)));
+#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
+                    __attribute__ ((format (printf, 2, 3)))
+#endif
+                    ;
   void (*ndo_error)(netdissect_options *,
                    const char *fmt, ...)
-                    __attribute__ ((format (printf, 2, 3)));
+#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
+                    __attribute__ ((format (printf, 2, 3)))
+#endif
+                    ;
   void (*ndo_warning)(netdissect_options *,
                      const char *fmt, ...)
-                    __attribute__ ((format (printf, 2, 3)));
+#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
+                    __attribute__ ((format (printf, 2, 3)))
+#endif
+                    ;
 };
 
 #define PT_VAT         1       /* Visual Audio Tool */