Ethereal-dev: [Ethereal-dev] autoconf patches to 0.8.16

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

Date: Wed, 7 Mar 2001 23:20:52 -0600
Build patches:
  1. Added --with-libpcap-include=DIR and --with-libpcap-lib=DIR
     to specify path to libpcap library.
  2. Added --with-zlib=DIR to specify the path to zlib
  3. Remove hard-coding /usr/local/include and /usr/local/lib. This
     is gross.

-- 
albert chin (china@xxxxxxxxxxxxxxxxxx)

-- snip snip
--- acinclude.m4.orig	Wed Mar  7 20:20:40 2001
+++ acinclude.m4	Wed Mar  7 20:49:10 2001
@@ -242,35 +242,53 @@
 #
 AC_DEFUN(AC_ETHEREAL_PCAP_CHECK,
 [
-	# Evidently, some systems have pcap.h, etc. in */include/pcap
-	AC_MSG_CHECKING(for extraneous pcap header directories)
-	found_pcap_dir=""
-	for pcap_dir in /usr/include/pcap /usr/local/include/pcap $prefix/include
-	do
-	  if test -d $pcap_dir ; then
-	    CFLAGS="$CFLAGS -I$pcap_dir"
-	    CPPFLAGS="$CPPFLAGS -I$pcap_dir"
-	    found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
-	  fi
-	done
-
-	if test "$found_pcap_dir" != "" ; then
-	  AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
-	else
-	  AC_MSG_RESULT(not found)
+	AC_ARG_WITH(libpcap-include,
+	[  --with-libpcap-include=DIR  use pcap includes in DIR],[
+		if test -d "$withval"; then
+			CPPFLAGS="${CPPFLAGS} -I$withval"
+		fi
+	])
+	AC_ARG_WITH(libpcap-lib,
+	[  --with-libpcap-lib=DIR      use pcap library in DIR],[
+		if test -d "$withval"; then
+			LDFLAGS="${LDFLAGS} -L$withval"
+		fi
+	])
+
+	# if --with-libpcap not explicitly set, search in
+	# pre-defined locations
+	if test "${with_libpcap_includes+set}" != set; then
+		# Evidently, some systems have pcap.h, etc. in */include/pcap
+		AC_MSG_CHECKING(for extraneous pcap header directories)
+		found_pcap_dir=""
+
+		for pcap_dir in /usr/include/pcap /usr/local/include/pcap \
+		$prefix/include; do
+			if test -d $pcap_dir ; then
+				CPPFLAGS="$CPPFLAGS -I$pcap_dir"
+				found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
+				break
+			fi
+		done
+
+		if test "$found_pcap_dir" != "" ; then
+			AC_MSG_RESULT([$found_pcap_dir added to CPPFLAGS])
+		else
+			AC_MSG_RESULT([not found])
+		fi
 	fi
 
 	# Pcap header checks
-	AC_CHECK_HEADER(net/bpf.h,,
-	    AC_MSG_ERROR([[Header file net/bpf.h not found; if you installed libpcap from source, did you also do \"make install-incl\"?]]))
-	AC_CHECK_HEADER(pcap.h,, AC_MSG_ERROR(Header file pcap.h not found.))
+	AC_CHECK_HEADER(net/bpf.h, ,
+		AC_MSG_ERROR([[Header file net/bpf.h not found; if you installed libpcap from source, did you also do \"make install-incl\"?]]))
+	AC_CHECK_HEADER(pcap.h, ,
+		AC_MSG_ERROR([Header file pcap.h not found.]))
 
 	#
 	# Check to see if we find "pcap_open_live" in "-lpcap".
 	#
 	AC_CHECK_LIB(pcap, pcap_open_live,
-	  [
-	    PCAP_LIBS=-lpcap
+	  [PCAP_LIBS=-lpcap
 	    AC_DEFINE(HAVE_LIBPCAP)
 	  ], AC_MSG_ERROR(Library libpcap not found.),
 	  $SOCKET_LIBS $NSL_LIBS)
@@ -282,16 +300,23 @@
 #
 AC_DEFUN(AC_ETHEREAL_ZLIB_CHECK,
 [
-        AC_CHECK_HEADER(zlib.h,,enable_zlib=no)
+	_cppflags=${CPPFLAGS}
+	_ldflags=${LDFLAGS}
+
+	AC_ARG_WITH(zlib,
+	[  --with-zlib=DIR         use libz in DIR],[
+		if test -d "$withval"; then
+			CPPFLAGS="${CPPFLAGS} -I$withval/include"
+			LDFLAGS="${LDFLAGS} -L$withval/lib"
+		fi
+	])
 
-        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)
+	AC_CHECK_HEADER(zlib.h,
+    		AC_CHECK_LIB(z, gzread, ,[
+			enable_zlib=no
+			CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),[
+			enable_zlib=no
+			CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
 ])
 
 #
--- configure.in.orig	Wed Mar  7 20:20:32 2001
+++ configure.in	Wed Mar  7 21:11:17 2001
@@ -126,13 +126,8 @@
 # as various packages we use ("libpcap", "zlib", an SNMP library)
 # may have been installed under "/usr/local/include".
 #
-CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan -I/usr/local/include"
-CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan -I/usr/local/include"
-
-#
-# Arrange that we search for libraries in "/usr/local/lib".
-#
-AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
+CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan"
+CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I\$(top_srcdir)/epan"
 
 # Create DATAFILE_DIR #define for config.h
 DATAFILE_DIR=$sysconfdir
@@ -253,7 +248,7 @@
 # Enable/disable randpkt
 
 AC_ARG_ENABLE(randpkt,
-[  --enable-randpkt         build randpkt.  [default=no]],,enable_randpkt=no)
+[  --enable-randpkt        build randpkt.  [default=no]],,enable_randpkt=no)
 
 if test "x$enable_randpkt" = "xyes" ; then
 	randpkt_bin="randpkt"
@@ -350,7 +345,6 @@
 else
 	AC_MSG_RESULT(yes)
 	AC_ETHEREAL_SSL_CHECK
-	AC_MSG_CHECKING(SSL_LIBS=$SSL_LIBS)
 fi
 AC_SUBST(SSL_LIBS)
 
@@ -473,7 +467,7 @@
 
 dnl check for plugins directory - stolen from Amanda's configure.in
 AC_ARG_WITH(plugindir,
-  [  --with-plugindir=DIR   install plugins in DIR],
+  [  --with-plugindir=DIR    install plugins in DIR],
   [
   case "$withval" in
   "" | y | ye | yes | n | no)
--- wiretap/acinclude.m4.orig	Wed Mar  7 20:44:55 2001
+++ wiretap/acinclude.m4	Wed Mar  7 20:49:56 2001
@@ -207,26 +207,57 @@
 #
 AC_DEFUN(AC_WIRETAP_PCAP_CHECK,
 [
-	# Evidently, some systems have pcap.h, etc. in */include/pcap
-	AC_MSG_CHECKING(for extraneous pcap header directories)
-	found_pcap_dir=""
-	for pcap_dir in /usr/include/pcap /usr/local/include/pcap $prefix/include
-	do
-	  if test -d $pcap_dir ; then
-	    CFLAGS="$CFLAGS -I$pcap_dir"
-	    CPPFLAGS="$CPPFLAGS -I$pcap_dir"
-	    found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
-	  fi
-	done
-
-	if test "$found_pcap_dir" != "" ; then
-	  AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
-	else
-	  AC_MSG_RESULT(not found)
+	AC_ARG_WITH(libpcap-include,
+	[  --with-libpcap-include=DIR  use pcap includes in DIR],[
+		if test -d "$withval"; then
+			CPPFLAGS="${CPPFLAGS} -I$withval"
+		fi
+	])
+	AC_ARG_WITH(libpcap-lib,
+	[  --with-libpcap-lib=DIR      use pcap library in DIR],[
+		if test -d "$withval"; then
+			LDFLAGS="${LDFLAGS} -L$withval"
+		fi
+	])
+
+	# if --with-libpcap not explicitly set, search in
+	# pre-defined locations
+	if test "${with_libpcap_includes+set}" != set; then
+		# Evidently, some systems have pcap.h, etc. in */include/pcap
+		AC_MSG_CHECKING(for extraneous pcap header directories)
+		found_pcap_dir=""
+
+		for pcap_dir in /usr/include/pcap /usr/local/include/pcap \
+		$prefix/include; do
+			if test -d $pcap_dir ; then
+				CPPFLAGS="$CPPFLAGS -I$pcap_dir"
+				found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
+				break
+			fi
+		done
+
+		if test "$found_pcap_dir" != "" ; then
+			AC_MSG_RESULT([$found_pcap_dir added to CPPFLAGS])
+		else
+			AC_MSG_RESULT([not found])
+		fi
 	fi
 
-	# Pcap header check
-	AC_CHECK_HEADERS(pcap.h)
+	# Pcap header checks
+	AC_CHECK_HEADER(net/bpf.h, ,
+		AC_MSG_ERROR([[Header file net/bpf.h not found; if you installed libpcap from source, did you also do \"make install-incl\"?]]))
+	AC_CHECK_HEADER(pcap.h, ,
+		AC_MSG_ERROR([Header file pcap.h not found.]))
+
+	#
+	# Check to see if we find "pcap_open_live" in "-lpcap".
+	#
+	AC_CHECK_LIB(pcap, pcap_open_live,
+	  [PCAP_LIBS=-lpcap
+	    AC_DEFINE(HAVE_LIBPCAP)
+	  ], AC_MSG_ERROR(Library libpcap not found.),
+	  $SOCKET_LIBS $NSL_LIBS)
+	AC_SUBST(PCAP_LIBS)
 ])
 
 #
@@ -234,14 +265,21 @@
 #
 AC_DEFUN(AC_WIRETAP_ZLIB_CHECK,
 [
-        AC_CHECK_HEADER(zlib.h,,enable_zlib=no)
+	_cppflags=${CPPFLAGS}
+	_ldflags=${LDFLAGS}
+
+	AC_ARG_WITH(zlib,
+	[  --with-zlib=DIR         use libz in DIR],[
+		if test -d "$withval"; then
+			CPPFLAGS="${CPPFLAGS} -I$withval/include"
+			LDFLAGS="${LDFLAGS} -L$withval/lib"
+		fi
+	])
 
-        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)
+	AC_CHECK_HEADER(zlib.h,
+		AC_CHECK_LIB(z, gzread, ,[
+			enable_zlib=no
+			CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),[
+			enable_zlib=no
+			CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
 ])