]> The Tcpdump Group git mirrors - tcpdump/commitdiff
We still need u_intN_t.
authorGuy Harris <[email protected]>
Wed, 23 Apr 2014 17:56:20 +0000 (10:56 -0700)
committerGuy Harris <[email protected]>
Wed, 23 Apr 2014 17:56:20 +0000 (10:56 -0700)
Some libpcap headers use them, and even if we change libpcap to use
uintN_t, we don't require that tcpdump 4.x go with libpcap 1.x - we
allow people to install the latest tcpdump even if they have an older
libpcap and don't want to install a newer one.

However, we now define them in terms of the C99 uintN_t types, rather
than trying to guess what's appropriate; using unsigned long long for
u_int64_t meant that, on some platforms, u_int64_t didn't match
PRI[doux]64, and using unsigned long obviously won't work on ILP32
platforms.

Also, we already had calls to the autoconf macros for C99 types; get rid
of the ones we added.

Also also, clean up a comment in tcpdump-stdinc.h.

config.h.in
configure
configure.in
tcpdump-stdinc.h

index c8c6507c11596cc49172d91e1014ff5f62b54ed1..4cdb31b7fcfd36927626b431c1c66f0b09be26a8 100644 (file)
    a type exists and the standard includes do not define it. */
 #undef int8_t
 
+/* Define to `uint16_t' if u_int16_t not defined. */
+#undef u_int16_t
+
+/* Define to `uint32_t' if u_int32_t not defined. */
+#undef u_int32_t
+
+/* Define to `uint64_t' if u_int64_t not defined. */
+#undef u_int64_t
+
+/* Define to `uint8_t' if u_int8_t not defined. */
+#undef u_int8_t
+
 /* Define to the type of an unsigned integer type of width exactly 16 bits if
    such a type exists and the standard includes do not define it. */
 #undef uint16_t
index 37aa8a1b9903d1206320ac247ab8f353aec71557..21ce37b8751e2c9580c0b6d32b758c0e8a3bad91 100755 (executable)
--- a/configure
+++ b/configure
@@ -6797,6 +6797,7 @@ fi
 #
 # Make sure we have definitions for all the C99 specified-width types
 # (regardless of whether the environment is a C99 environment or not).
+#
 ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t"
 case $ac_cv_c_int8_t in #(
   no|yes) ;; #(
@@ -6897,107 +6898,56 @@ _ACEOF
 
 
 #
-# The minimum version of autoconf that we support is 2.61, and it
-# supports the AC_TYPE_UINTn_T macros.  Use them; we've stopped
-# using the old BSD-style u_intXX_t types.
+# Define the old BSD specified-width types in terms of the C99 types;
+# we may need them with libpcap include files.
 #
-ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
-case $ac_cv_c_uint8_t in #(
-  no|yes) ;; #(
-  *)
-
-$as_echo "#define _UINT8_T 1" >>confdefs.h
-
+ac_fn_c_check_type "$LINENO" "u_int8_t" "ac_cv_type_u_int8_t" "$ac_includes_default
+#include <sys/types.h>
 
-cat >>confdefs.h <<_ACEOF
-#define uint8_t $ac_cv_c_uint8_t
-_ACEOF
-;;
-  esac
+"
+if test "x$ac_cv_type_u_int8_t" = xyes; then :
 
-ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t"
-case $ac_cv_c_int8_t in #(
-  no|yes) ;; #(
-  *)
+else
 
-cat >>confdefs.h <<_ACEOF
-#define int8_t $ac_cv_c_int8_t
-_ACEOF
-;;
-esac
+$as_echo "#define u_int8_t uint8_t" >>confdefs.h
 
-ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t"
-case $ac_cv_c_uint16_t in #(
-  no|yes) ;; #(
-  *)
+fi
 
+ac_fn_c_check_type "$LINENO" "u_int16_t" "ac_cv_type_u_int16_t" "$ac_includes_default
+#include <sys/types.h>
 
-cat >>confdefs.h <<_ACEOF
-#define uint16_t $ac_cv_c_uint16_t
-_ACEOF
-;;
-  esac
+"
+if test "x$ac_cv_type_u_int16_t" = xyes; then :
 
-ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t"
-case $ac_cv_c_int16_t in #(
-  no|yes) ;; #(
-  *)
+else
 
-cat >>confdefs.h <<_ACEOF
-#define int16_t $ac_cv_c_int16_t
-_ACEOF
-;;
-esac
+$as_echo "#define u_int16_t uint16_t" >>confdefs.h
 
-ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
-case $ac_cv_c_uint32_t in #(
-  no|yes) ;; #(
-  *)
-
-$as_echo "#define _UINT32_T 1" >>confdefs.h
+fi
 
+ac_fn_c_check_type "$LINENO" "u_int32_t" "ac_cv_type_u_int32_t" "$ac_includes_default
+#include <sys/types.h>
 
-cat >>confdefs.h <<_ACEOF
-#define uint32_t $ac_cv_c_uint32_t
-_ACEOF
-;;
-  esac
+"
+if test "x$ac_cv_type_u_int32_t" = xyes; then :
 
-ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
-case $ac_cv_c_int32_t in #(
-  no|yes) ;; #(
-  *)
+else
 
-cat >>confdefs.h <<_ACEOF
-#define int32_t $ac_cv_c_int32_t
-_ACEOF
-;;
-esac
+$as_echo "#define u_int32_t uint32_t" >>confdefs.h
 
-ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t"
-case $ac_cv_c_uint64_t in #(
-  no|yes) ;; #(
-  *)
+fi
 
-$as_echo "#define _UINT64_T 1" >>confdefs.h
+ac_fn_c_check_type "$LINENO" "u_int64_t" "ac_cv_type_u_int64_t" "$ac_includes_default
+#include <sys/types.h>
 
+"
+if test "x$ac_cv_type_u_int64_t" = xyes; then :
 
-cat >>confdefs.h <<_ACEOF
-#define uint64_t $ac_cv_c_uint64_t
-_ACEOF
-;;
-  esac
+else
 
-ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t"
-case $ac_cv_c_int64_t in #(
-  no|yes) ;; #(
-  *)
+$as_echo "#define u_int64_t uint64_t" >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define int64_t $ac_cv_c_int64_t
-_ACEOF
-;;
-esac
+fi
 
 
 #
index a027c5c6dd5ba9e2482d5fc078e239991092bd86..dde10b380cc7699560d89f41e2fdbf8df30eded8 100644 (file)
@@ -869,6 +869,7 @@ fi
 #
 # Make sure we have definitions for all the C99 specified-width types
 # (regardless of whether the environment is a C99 environment or not).
+#
 AC_TYPE_INT8_T
 AC_TYPE_INT16_T
 AC_TYPE_INT32_T
@@ -879,18 +880,33 @@ AC_TYPE_UINT32_T
 AC_TYPE_UINT64_T
 
 #
-# The minimum version of autoconf that we support is 2.61, and it
-# supports the AC_TYPE_UINTn_T macros.  Use them; we've stopped
-# using the old BSD-style u_intXX_t types.
+# Define the old BSD specified-width types in terms of the C99 types;
+# we may need them with libpcap include files.
 #
-AC_TYPE_UINT8_T
-AC_TYPE_INT8_T
-AC_TYPE_UINT16_T
-AC_TYPE_INT16_T
-AC_TYPE_UINT32_T
-AC_TYPE_INT32_T
-AC_TYPE_UINT64_T
-AC_TYPE_INT64_T
+AC_CHECK_TYPE([u_int8_t], ,
+       [AC_DEFINE([u_int8_t], [uint8_t],
+       [Define to `uint8_t' if u_int8_t not defined.])],
+       [AC_INCLUDES_DEFAULT
+#include <sys/types.h>
+])
+AC_CHECK_TYPE([u_int16_t], ,
+       [AC_DEFINE([u_int16_t], [uint16_t],
+       [Define to `uint16_t' if u_int16_t not defined.])],
+       [AC_INCLUDES_DEFAULT
+#include <sys/types.h>
+])
+AC_CHECK_TYPE([u_int32_t], ,
+       [AC_DEFINE([u_int32_t], [uint32_t],
+       [Define to `uint32_t' if u_int32_t not defined.])],
+       [AC_INCLUDES_DEFAULT
+#include <sys/types.h>
+])
+AC_CHECK_TYPE([u_int64_t], ,
+       [AC_DEFINE([u_int64_t], [uint64_t],
+       [Define to `uint64_t' if u_int64_t not defined.])],
+       [AC_INCLUDES_DEFAULT
+#include <sys/types.h>
+])
 
 #
 # Check for <inttypes.h>
index cf763cffdffc56eb8135618ad0a8b459d347e858..9a068e64826c779c9d49e139503cf0b095583766 100644 (file)
@@ -31,8 +31,8 @@
 
 /*
  * Include the appropriate OS header files on Windows and various flavors
- * of UNIX, and also define some additional items and include various
- * non-OS header files on Windows, and; this isolates most of the platform
+ * of UNIX, include various non-OS header files on Windows, and define
+ * various items as needed, to isolate most of tcpdump's platform
  * differences to this one file.
  */