Ethereal-dev: [Ethereal-dev] Eliminating acconfig.h

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

From: Pavel Roskin <proski@xxxxxxx>
Date: Tue, 25 Feb 2003 18:59:06 -0500 (EST)
Hello!

This patch eliminates acconfig.h, which is an archaism.  Even autoconf
2.13 supports descriptions in AC_DEFINE.  Later versions print a warning
if acconfig.h is used.

All three directories that have acconfig.h are affected.  The changes are:

All calls to AC_DEFINE have descriptions now.  The descriptions are used
by autoheader as comments in config.h.in.

An unquoted call to AC_MSG_ERROR has been fixed.  It's very important to
quote the arguments of Autoconf macros if they contain other macros.  If
you don't do it, macros are expanded in the wrong order, and you are not
guaranteed that the configure script is correct.

The logic for defining HAVE_SOME_SNMP has been moved to configure.in.

Don't forget to remove all three instances of acconfig.h from CVS.  No
changes in makefiles are necessary.

-- 
Regards,
Pavel Roskin
--- acinclude.m4
+++ acinclude.m4
@@ -88,7 +88,7 @@
 #include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
 ac_cv_ethereal_struct_sa_len=yes, ac_cv_ethereal_struct_sa_len=no)])
 if test $ac_cv_ethereal_struct_sa_len = yes; then
-  AC_DEFINE(HAVE_SA_LEN)
+  AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
 fi
 ])
 
@@ -323,8 +323,8 @@
 	AC_CHECK_LIB(pcap, pcap_open_live,
 	  [
 	    PCAP_LIBS=-lpcap
-	    AC_DEFINE(HAVE_LIBPCAP)
-	  ], AC_MSG_ERROR(Library libpcap not found.),
+	    AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
+	  ], [AC_MSG_ERROR(Library libpcap not found.)],
 	  $SOCKET_LIBS $NSL_LIBS)
 	AC_SUBST(PCAP_LIBS)
 ])
@@ -353,7 +353,7 @@
 	LIBS="$ac_save_LIBS"
 	if test "$ac_cv_pcap_version_defined" = yes ; then
 		AC_MSG_RESULT(yes)
-		AC_DEFINE(HAVE_PCAP_VERSION)
+		AC_DEFINE(HAVE_PCAP_VERSION, 1, [Define if libpcap version is known])
 	else
 		AC_MSG_RESULT(no)
 	fi
@@ -461,7 +461,7 @@
 			else
 				LIBS="-lz $LIBS"
 			fi
-			AC_DEFINE(HAVE_LIBZ)
+			AC_DEFINE(HAVE_LIBZ, 1, [Define to use libz library])
 		],[
 			if test "x$zlib_dir" != "x"
 			then
@@ -592,7 +592,8 @@
 		#
 		# We found it, so we have UCD SNMP.
 		#
-		AC_DEFINE(HAVE_UCD_SNMP)
+		AC_DEFINE(HAVE_UCD_SNMP, 1, [Define to enable support for UCD-SNMP])
+		have_ucd_snmp="yes"
 	],[
 		#
 		# No, we don't have it.
--- configure.in
+++ configure.in
@@ -172,7 +172,7 @@
     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
     eval echo "$datafiledir"
 )`
-AC_DEFINE_UNQUOTED(DATAFILE_DIR, "$datafiledir")
+AC_DEFINE_UNQUOTED(DATAFILE_DIR, "$datafiledir", [Directory for data])
 
 #
 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
@@ -598,7 +598,8 @@
 		CFLAGS="$CFLAGS `net-snmp-config --cflags`"
 		CPPFLAGS="$CPPLAGS `net-snmp-config --cflags`"
 		SNMP_LIBS=`net-snmp-config --libs`
-		AC_DEFINE(HAVE_NET_SNMP)
+		AC_DEFINE(HAVE_NET_SNMP, 1, [Define to enable support for NET-SNMP])
+		have_net_snmp="yes"
 		AC_MSG_RESULT(yes (net-snmp))
 	else
 		# technically, we should retry ucd-snmp but it's
@@ -618,6 +619,10 @@
 	fi
 fi
 
+if test "x$have_net_snmp" = "xyes" && test "x$have_ucd_snmp" = "xyes"; then
+	AC_DEFINE(HAVE_SOME_SNMP, 1, [Define to if some SNMP support is to be used])
+fi
+
 AC_SUBST(SNMP_LIBS)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -640,7 +645,9 @@
 SNPRINTF_C=""
 SNPRINTF_O=""
 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
-  SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
+  [SNPRINTF_O="snprintf.o"
+   AC_DEFINE(NEED_SNPRINTF_H, 1, [Define if sprintf.h needs to be included])
+])
 if test "$ac_cv_func_snprintf" = no ; then
   SNPRINTF_C="snprintf.c"
   SNPRINTF_O="snprintf.o"
@@ -649,7 +656,9 @@
 AC_SUBST(SNPRINTF_O)
 
 AC_CHECK_FUNC(strerror, STRERROR_O="",
-  STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
+  [STRERROR_O="strerror.o"
+   AC_DEFINE(NEED_STRERROR_H, 1, [Define if strerror.h needs to be included])
+])
 if test "$ac_cv_func_strerror" = no ; then
   STRERROR_C="strerror.c"
   STRERROR_O="strerror.o"
@@ -685,7 +694,9 @@
 AC_SUBST(MKSTEMP_O)
 
 AC_CHECK_FUNC(strptime, STRPTIME_O="",
-  STRPTIME_O="strptime.o" [AC_DEFINE(NEED_STRPTIME_H)])
+  [STRPTIME_O="strptime.o"
+   AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included])
+])
 if test "$ac_cv_func_strptime" = no ; then
   STRPTIME_C="strptime.c"
   STRPTIME_O="strptime.o"
@@ -730,7 +741,7 @@
 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
 if test x$have_plugins = xyes
 then
-  AC_DEFINE(HAVE_PLUGINS)
+  AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled])
   plugindir=`(
     test "x$prefix" = xNONE && prefix=$ac_default_prefix
     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
--- epan/configure.in
+++ epan/configure.in
@@ -113,7 +113,7 @@
     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
     eval echo "$DATAFILE_DIR"
 )`
-AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
+AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR", [Directory for data])
 AC_SUBST(DATAFILE_DIR)
 
 AC_ARG_ENABLE(gtk2,
@@ -149,7 +149,7 @@
 if test "$ac_cv_func_inet_aton" = no ; then
   INET_ATON_C="inet_aton.c"
   INET_ATON_O="inet_aton.o"
-  AC_DEFINE(NEED_INET_ATON_H)
+  AC_DEFINE(NEED_INET_ATON_H, 1, [Define if inet/aton.h needs to be included])
 fi
 AC_SUBST(INET_ATON_C)
 AC_SUBST(INET_ATON_O)
@@ -190,12 +190,14 @@
 if test "$ac_cv_func_inet_ntop" = no ; then
   INET_NTOP_C="inet_ntop.c"
   INET_NTOP_O="inet_ntop.o"
-  AC_DEFINE(NEED_INET_V6DEFS_H)
+  AC_DEFINE(NEED_INET_V6DEFS_H, 1, [Define if inet/v6defs.h needs to be included])
 fi
 AC_SUBST(INET_NTOP_C)
 AC_SUBST(INET_NTOP_O)
 
-AC_CHECK_FUNC(strptime, , [AC_DEFINE(NEED_STRPTIME_H)])
+AC_CHECK_FUNC(strptime, ,
+  [AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included])
+])
 
 #
 # Check whether GLib modules are supported, to determine whether we
@@ -254,7 +256,7 @@
 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
 if test x$have_plugins = xyes
 then
-  AC_DEFINE(HAVE_PLUGINS)
+  AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled])
 fi
 
 AC_OUTPUT(
--- wiretap/acinclude.m4
+++ wiretap/acinclude.m4
@@ -183,7 +183,7 @@
 			else
 				LIBS="-lz $LIBS"
 			fi
-			AC_DEFINE(HAVE_LIBZ)
+			AC_DEFINE(HAVE_LIBZ, 1, [Define to use libz library])
 		],[
 			if test "x$zlib_dir" != "x"
 			then