Ethereal-dev: [ethereal-dev] zlib support issue

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

Date: Mon, 24 Jan 2000 19:35:27 +0900
	On NetBSD 1.4.1, ethereal zlib support needs to be disabled to
	make it function properly.  This is because:
	- /usr/include/zconf.h includes the following clause,
	- libz.a is compiled with z_off_t == long,
	- and ethreal uses z_off_t = off_t (due to HAVE_UNISTD_H).

	I find it easier to disable zlib on such platform.  The attached
	diff should check for such situations.  It works for NetBSD 1.4.1.
	Could you please check if it works correctly on other platforms?

itojun


#ifdef HAVE_UNISTD_H
#  include <sys/types.h> /* for off_t */
#  include <unistd.h>    /* for SEEK_* and off_t */
#  define z_off_t  off_t
#endif
#ifndef SEEK_SET
#  define SEEK_SET        0       /* Seek from beginning of file.  */
#  define SEEK_CUR        1       /* Seek from current position.  */
#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
#  define  z_off_t long
#endif



? aclocal.m4-
Index: acinclude.m4
===================================================================
RCS file: /usr/local/cvsroot/ethereal/acinclude.m4,v
retrieving revision 1.20
diff -u -r1.20 acinclude.m4
--- acinclude.m4	2000/01/21 06:18:15	1.20
+++ acinclude.m4	2000/01/24 10:34:26
@@ -282,16 +282,29 @@
 #
 AC_DEFUN(AC_ETHEREAL_ZLIB_CHECK,
 [
-        AC_CHECK_HEADER(zlib.h,,enable_zlib=no)
+	dnl
+	dnl In some of OS platforms, type definition of z_off_t is not
+	dnl friendly with ethereal.
+	AC_TRY_RUN([#include <sys/types.h>
+#include <zlib.h>
+int main()
+{
+	if (sizeof(z_off_t) == sizeof(off_t))
+		return 0;
+	else
+		return 1;
+}],
+		[AC_CHECK_HEADER(zlib.h,,enable_zlib=no)
 
-        dnl
-        dnl Check for "gzgets()" in zlib, because we need it, but
-        dnl some older versions of zlib don't have it.  It appears
-        dnl from the ChangeLog that any released version of zlib
-        dnl with "gzgets()" should have the other routines we
-        dnl depend on, such as "gzseek()", "gztell()", and "zError()".
-        dnl
-        AC_CHECK_LIB(z, gzgets,,enable_zlib=no)
+		dnl
+		dnl Check for "gzgets()" in zlib, because we need it, but
+		dnl some older versions of zlib don't have it.  It appears
+		dnl from the ChangeLog that any released version of zlib
+		dnl with "gzgets()" should have the other routines we
+		dnl depend on, such as "gzseek()", "gztell()", and "zError()".
+		dnl
+		AC_CHECK_LIB(z, gzgets,,enable_zlib=no)
+		], [enable_zlib=buggy])
 ])
 
 #
Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/ethereal/configure.in,v
retrieving revision 1.80
diff -u -r1.80 configure.in
--- configure.in	2000/01/21 08:44:40	1.80
+++ configure.in	2000/01/24 10:34:26
@@ -155,9 +155,16 @@
 else
         AC_MSG_RESULT(yes)
         AC_ETHEREAL_ZLIB_CHECK
-	if test "x$enable_zlib" = "xno" ; then
-		AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
-	fi
+	case "x$enable_zlib" in
+	xyes)	;;
+	xno)	AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
+		;;
+	xbuggy)	AC_MSG_RESULT(zlib on the platform is buggy - disabling compressed capture file support)
+		enable_zlib=no
+		;;
+	*)	AC_MSG_RESULT(unknown result of zlib check)
+		;;
+	esac
 fi