Removed trailing whitespaces from .h and .c files using the
[obnox/wireshark/wip.git] / configure.in
index 3a298380b1f956c395d0534f7d2a037541951794..8a11548facc0bbbf04fcc5748bf21c440b81bf7f 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.149 2002/01/30 23:01:30 guy Exp $
+# $Id: configure.in,v 1.174 2002/08/28 00:37:17 jmayer Exp $
 dnl
 dnl Process this file with autoconf 2.13 or later to produce a
 dnl configure script; 2.12 doesn't generate a "configure" script that
@@ -13,23 +13,20 @@ AC_INIT(etypes.h)
 
 AC_PREREQ(2.13)
 
-AM_INIT_AUTOMAKE(ethereal, 0.9.0)
+AM_INIT_AUTOMAKE(ethereal, 0.9.6)
 
 dnl Check for CPU / vendor / OS
 AC_CANONICAL_HOST
 
 dnl Checks for programs.
-AC_ARG_WITH(gcc, [  --without-gcc           don't use gcc])
-if test -z "$CC" -a "$with_gcc" = no ; then
-    CC=cc
-    export CC
-fi
 AC_PROG_CC
 AC_PROG_CPP
-AC_PROG_RANLIB
+AC_LIBTOOL_DLOPEN
+AC_PROG_LIBTOOL
 AC_PROG_YACC
 AM_PROG_LEX
 AC_PATH_PROG(PERL, perl)
+AC_PATH_PROG(POD2MAN, pod2man)
 AC_PATH_PROG(LEX, flex)
 AC_PATH_PROG(PYTHON, python)
 
@@ -55,12 +52,20 @@ AC_SUBST(HAVE_SVR4_PACKAGING)
 AC_ETHEREAL_RPM_CHECK
 AC_SUBST(HAVE_RPM)
 
-# If we're running gcc, add '-Wall' to CFLAGS.
-AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS)
+#
+# If we're running gcc, add '-Wall -W' to CFLAGS, and add
+# '-D_U_="__attribute__((unused))"' as well, so we can use _U_ to
+# flag unused function arguments and not get warnings about them.
+#
+# Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
+# argument will compile with non-GCC compilers.
+#
+AC_MSG_CHECKING(to see if we can add '-Wall -W' to CFLAGS)
 if test x$GCC != x ; then
-  CFLAGS="-Wall -W -Wno-unused $CFLAGS"
+  CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W $CFLAGS"
   AC_MSG_RESULT(yes)
 else
+  CFLAGS="-D_U_=\"\" $CFLAGS"
   AC_MSG_RESULT(no)
 fi
 
@@ -160,11 +165,6 @@ AC_SUBST(DATAFILE_DIR)
 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
 # link directory.
 #
-# Also, make sure that "sed" does *NOT* refer to "/usr/bin/sed" or
-# "/usr/ucb/sed", as, on Solaris, both of them are inadequate to
-# handle, in libtool, a list of object files as large as the list
-# in Ethereal.
-#
 case "$host_os" in
   solaris*)
     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
@@ -174,34 +174,64 @@ case "$host_os" in
     else
       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
     fi
-    AC_MSG_CHECKING(whether one of /usr/bin/sed or /usr/ucb/sed will be used)
-    case `which sed` in
-      /usr/bin/sed|/usr/ucb/sed)
-        AC_MSG_RESULT(yes)
-        AC_MSG_ERROR([change your path to search /usr/xpg4/bin before /usr/bin (and /usr/ucb)])
-      ;;
-
-    *)
-      AC_MSG_RESULT(no)
-      ;;
-    esac
   ;;
 esac
 
+#
+# Check for versions of "sed" inadequate to handle, in libtool, a list
+# of object files as large as the list in Ethereal.
+#
+# On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
+# as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
+# symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
+# their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
+# is the only "sed" that comes with Solaris that can handle Ethereal.
+#
+# Add any checks here that are necessary for other OSes.
+#
+AC_ETHEREAL_GNU_SED_CHECK
+if test "$HAVE_GNU_SED" = no ; then
+       case "$host_os" in
+       solaris*)
+               AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
+               case `which sed` in
+                       /bin/sed|/usr/bin/sed|/usr/ucb/sed)
+                       AC_MSG_RESULT(yes)              
+                       AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
+                       ;;
+
+                       *)
+                       AC_MSG_RESULT(no)
+                       ;;
+               esac
+               ;;
 
-# Enable/disable tethereal
+       *)
+               :
+               ;;
+       esac
+fi
 
-GTK_OK=yes
+# Enable/disable tethereal
 
 AC_ARG_ENABLE(ethereal,
 [  --enable-ethereal       build GTK+-based ethereal.  [default=yes]],,enable_ethereal=yes)
 
+AC_ARG_ENABLE(gtk2,
+[  --enable-gtk2           build Glib2/Gtk2+-based (t)ethereal.  [default=no]],enable_gtk2=yes,enable_gtk2=no)
+
 # GTK checks
 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
 # programs to be built with GTK+.
 #
-if test "x$enable_ethereal" = "xyes" ; then
+if test "x$enable_gtk2" = "xyes" -a "x$enable_ethereal" = "xyes" ; then
+       GTK_OK=two
+       AM_PATH_GTK_2_0(2.0.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
+elif test "x$enable_gtk2" = "xno" -a "x$enable_ethereal" = "xyes" ; then
+       GTK_OK=one
        AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
+else
+       GTK_OK=no
 fi
 
 # GLib checks
@@ -214,7 +244,14 @@ fi
 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
 # programs to be built with GLib.
 #
-if test "$GTK_OK" = "yes" -a "x$enable_ethereal" = "xyes" ; then
+if test "$GTK_OK" = "two" ; then
+       ethereal_bin="ethereal"
+       ethereal_man="ethereal.1"
+       ethereal_SUBDIRS="gtk"   # <--- change to gtk2, if we can't use the same directory
+
+       # Ignore GLIB_CFLAGS
+       AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
+elif test "$GTK_OK" = "one" ; then
        ethereal_bin="ethereal"
        ethereal_man="ethereal.1"
        ethereal_SUBDIRS="gtk"
@@ -226,7 +263,11 @@ else
        ethereal_bin=""
        ethereal_man=""
        # Honor GLIB_CFLAGS
-       AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
+       if test "x$enable_gtk2" = "xyes" ; then
+               AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
+       else
+               AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
+       fi
 fi
 
 #
@@ -337,7 +378,7 @@ AC_SUBST(text2pcap_man)
 # Enable/disable idl2eth
 
 AC_ARG_ENABLE(idl2eth,
-[  --enable-idl2eth      build idl2eth.  [default=yes]],,enable_idl2eth=yes)
+[  --enable-idl2eth        build idl2eth.  [default=yes]],,enable_idl2eth=yes)
 
 if test "x$enable_idl2eth" = "xyes" ; then
        idl2eth_bin="idl2eth"
@@ -413,16 +454,34 @@ else
 fi
 
 dnl zlib check
-AC_ARG_ENABLE(zlib,
-[  --enable-zlib           use zlib to read compressed data.  [default=yes]],,enable_zlib=yes)
-
 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
-if test "x$enable_zlib" = "xno" ; then
+
+AC_ARG_WITH(zlib,
+[  --with-zlib[=DIR]       use zlib (located in directory DIR, if supplied) to read compressed data.  [default=yes, if present]],
+[
+       if test $withval = no
+       then
+               want_zlib=no
+       elif test $withval = yes
+       then
+               want_zlib=yes
+       else
+               want_zlib=yes
+               zlib_dir=$withval
+       fi
+],[
+       #
+       # Use zlib if it's present, otherwise don't.
+       #
+       want_zlib=ifpresent
+       zlib_dir=
+])
+if test "x$want_zlib" = "xno" ; then
         AC_MSG_RESULT(no)
 else
         AC_MSG_RESULT(yes)
         AC_ETHEREAL_ZLIB_CHECK
-       if test "x$enable_zlib" = "xno" ; then
+       if test "x$want_zlib" = "xno" ; then
                AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
        fi
 fi
@@ -475,82 +534,37 @@ else
 fi
 AC_SUBST(SSL_LIBS)
 
-dnl SNMP Check
-AC_ARG_ENABLE(snmp,
-[  --enable-snmp           use SNMP library, if available.  [default=yes]],,enable_snmp=yes)
-
+dnl UCD SNMP Check
 SNMP_LIBS=''
-AC_MSG_CHECKING(whether to use SNMP library if available)
-if test "x$enable_snmp" = "xno" ; then
-       AC_MSG_RESULT(no)
-else
-       AC_MSG_RESULT(yes)
-       AC_ETHEREAL_UCDSNMP_CHECK
-       AC_CHECK_HEADERS(ucd-snmp/snmp.h ucd-snmp/version.h snmp/snmp.h snmp/version.h)
+AC_MSG_CHECKING(whether to use UCD SNMP/NET-SNMP library if available)
 
-       #
-       # If we found both UCD and CMU SNMP headers, die, as both
-       # packages install the SNMP library as "libsnmp", so either
-       # only one of them is present or they're in different
-       # directories, and we run the risk of picking up the headers
-       # from one and the library from another.
-       #
-       if test "$ac_cv_header_ucd_snmp_snmp_h" = yes -a \
-          "$ac_cv_header_snmp_snmp_h" = yes ; then
-           AC_MSG_ERROR([Both UCD and CMU SNMP libraries found - uninstall one of them.])
+AC_ARG_WITH(ucdsnmp,
+[  --with-ucdsnmp[=DIR]    use UCD SNMP/NET-SNMP client library (located in directory DIR, if supplied).  [default=yes, if present]],
+[
+       if test $withval = no
+       then
+               want_ucdsnmp=no
+       elif test $withval = yes
+       then
+               want_ucdsnmp=yes
+       else
+               want_ucdsnmp=yes
+               ucdsnmp_dir=$withval
        fi
-       
-       #
-       # Look for the string 'sbuf' in ucd-snmp/mib.h.  If found, assume
-       # we've encountered a Red Hat-modified version of UCD SNMP.
-       #
-       # XXX - Check for 'binit()' in parse.h
-       #
-       AC_EGREP_HEADER(sprint_objid.*sbuf, ucd-snmp/mib.h, 
-         AC_DEFINE(RED_HAT_MODIFIED_UCD_SNMP))
-
-
+],[
        #
-       # This may require "-lkstat" on Solaris, sigh.
+       # Set "want_ucdsnmp" to "ifpresent" to make the default "use it
+       # if you find it, otherwise don't".
        #
-       AC_CHECK_LIB(snmp, sprint_objid,
-         SNMP_LIBS=-lsnmp,
-         [
-           #
-           # Throw away the cached "we didn't find it" answer.
-           #
-           unset ac_cv_lib_snmp_sprint_objid
-           AC_CHECK_LIB(snmp, sprint_objid,
-             [
-               #
-               # Throw away the cached "we found it" answer, so that if
-               # we rerun "configure", we don't just blow off this check
-               # and blithely assume that we don't need "-lkstat".
-               #
-               # XXX - autoconf really needs a way to test for a given
-               # routine in a given library *and* to test whether additional
-               # "-L"/"-R"/whatever flags are needed *before* the "-l"
-               # flag for the library and to test whether additional libraries
-               # are needed after the library *and* to cache all that
-               # information.
-               #
-               unset ac_cv_lib_snmp_sprint_objid
-               SNMP_LIBS="-lsnmp -lkstat"
-             ],,$SOCKET_LIBS $NSL_LIBS $SSL_LIBS -lkstat
-           )
-         ], $SOCKET_LIBS $NSL_LIBS $SSL_LIBS
-       )
+       want_ucdsnmp=ifpresent
+       ucdsnmp_dir=
+])
 
-       #
-       # If we have SNMP header files but didn't find "sprint_objid()",
-       # fail, as there's something wrong (perhaps the user needs to
-       # specify "--with-ssl").
-       #
-       if test '(' "$ac_cv_header_ucd_snmp_snmp_h" = yes -o \
-          "$ac_cv_header_snmp_snmp_h" = yes ')' -a \
-          "$ac_cv_lib_snmp_sprint_objid" = no; then
-           AC_MSG_ERROR([SNMP header files found, but sprint_objid not found in SNMP library.])
-       fi
+if test "x$want_ucdsnmp" = "xno" ; then
+       AC_MSG_RESULT(no)
+else
+       AC_MSG_RESULT(yes)
+       AC_ETHEREAL_UCDSNMP_CHECK
 fi
 AC_SUBST(SNMP_LIBS)
 
@@ -636,7 +650,8 @@ dnl
 dnl check whether plugins should be enabled and, if they should be,
 dnl check for plugins directory - stolen from Amanda's configure.in
 dnl
-PLUGIN_DIR="$libdir/ethereal/plugins/$VERSION"
+plugindir="$libdir/ethereal/plugins/$VERSION"
+PLUGIN_DIR="$plugindir"
 AC_ARG_WITH(plugins,
   [  --with-plugins[=DIR]    support plugins (installed in DIR, if supplied).],
   [
@@ -675,9 +690,9 @@ else
   AC_DEFINE(PLUGIN_DIR,NULL)
 fi
 AC_SUBST(PLUGIN_DIR)
+AC_SUBST(plugindir)
 
 dnl libtool defs
-AC_LIBTOOL_DLOPEN
 AM_PROG_LIBTOOL
 AC_SUBST(LIBTOOL_DEPS)
 
@@ -696,9 +711,10 @@ AC_OUTPUT(
   packaging/svr4/checkinstall
   packaging/svr4/pkginfo
   plugins/Makefile
+  plugins/docsis/Makefile
+  plugins/giop/Makefile
   plugins/gryphon/Makefile
   plugins/mgcp/Makefile
-  plugins/giop/Makefile
   tools/Makefile
   tools/lemon/Makefile
   ,)
@@ -712,14 +728,18 @@ else
        setuid_message="no"
 fi
 
+if test "x$want_libz" = "no" ; then
+       zlib_message="no"
+else
+       zlib_message="yes"
+fi
+
 if test "x$SNMP_LIBS" = "x" ; then
        snmp_libs_message="no"
 else
        snmp_libs_message="yes"
 fi
 
-
-
 echo ""
 echo "The Ethereal package has been configured with the following options."
 echo "                    Build ethereal : $enable_ethereal"
@@ -734,6 +754,6 @@ echo ""
 echo "                    Install setuid : $setuid_message"
 echo "                       Use plugins : $have_plugins"
 echo "                  Use pcap library : $want_pcap"
-echo "                  Use zlib library : $enable_zlib"
+echo "                  Use zlib library : $zlib_message"
 echo "          Use IPv6 name resolution : $enable_ipv6"
-echo "                  Use SNMP library : $snmp_libs_message"
+echo "              Use UCD SNMP library : $snmp_libs_message"