diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-01-15 09:46:28 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-01-15 09:46:28 +0000 |
commit | eacc4cad718b395b2f3f6789dea215d4a4044e6d (patch) | |
tree | ab007de703959ee29e43532acb5beceab756a844 | |
parent | 486e259d949f5f8147d34a08bf9c26e89fbc005e (diff) |
Arrange that, on Solaris, we link with "-lkstat" if necessary when
linking with "-lsnmp".
Link only Ethereal and Tethereal with "-lpcap"; don't link editcap, or
any of the test programs that the configure script builds, with it
(because that means you also have to arrange that those test programs be
linked with @SOCKET_LIBS@ and @NSL_LIBS@) - i.e., don't add it to LIBS,
add it to PCAP_LIBS, and use that only for programs that need it.
svn path=/trunk/; revision=1484
-rw-r--r-- | Makefile.am | 10 | ||||
-rw-r--r-- | acinclude.m4 | 90 | ||||
-rw-r--r-- | configure.in | 53 |
3 files changed, 124 insertions, 29 deletions
diff --git a/Makefile.am b/Makefile.am index 946429e64c..95ba9f7e32 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.153 2000/01/15 08:08:19 guy Exp $ +# $Id: Makefile.am,v 1.154 2000/01/15 09:46:27 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@zing.org> @@ -289,9 +289,9 @@ ethereal_DEPENDENCIES = \ ethereal_LDADD = \ $(ethereal_optional_objects) \ $(ethereal_additional_libs) \ - @SNMP_A@ \ + @SNMP_LIBS@ \ @LIBLTDL@ "-dlopen" self \ - "-dlopen" plugins/gryphon/gryphon.la @GTK_LIBS@ + "-dlopen" plugins/gryphon/gryphon.la @PCAP_LIBS@ @GTK_LIBS@ ethereal_LDFLAGS = -export-dynamic @@ -315,10 +315,10 @@ tethereal_DEPENDENCIES = \ tethereal_LDADD = wiretap/libwiretap.a \ $(ethereal_optional_objects) \ $(tethereal_additional_libs) \ - @SNMP_A@ \ + @SNMP_LIBS@ \ @LIBLTDL@ "-dlopen" self \ "-dlopen" plugins/gryphon/gryphon.la @GLIB_LIBS@ -lm \ - @SOCKET_LIBS@ @NSL_LIBS@ + @PCAP_LIBS@ @SOCKET_LIBS@ @NSL_LIBS@ tethereal_LDFLAGS = -export-dynamic diff --git a/acinclude.m4 b/acinclude.m4 index 68a78585a0..d1a7c80e9f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2,7 +2,7 @@ dnl Macros that test for specific features. dnl This file is part of the Autoconf packaging for Ethereal. dnl Copyright (C) 1998-2000 by Gerald Combs. dnl -dnl $Id: acinclude.m4,v 1.16 2000/01/15 08:08:20 guy Exp $ +dnl $Id: acinclude.m4,v 1.17 2000/01/15 09:46:28 guy Exp $ dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -51,6 +51,26 @@ dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. # +# AC_ETHEREAL_ADD_DASH_L +# +# Add to the variable specified as the first argument a "-L" flag for the +# directory specified as the second argument, and, on Solaris, add a +# "-R" flag for it as well. +# +# XXX - IRIX, and other OSes, may require some flag equivalent to +# "-R" here. +# +AC_DEFUN(AC_ETHEREAL_ADD_DASH_L, +[$1="$$1 -L$2" +case "$host_os" in + solaris*) + $1="$$1 -R$2" + ;; +esac +]) + + +# # AC_ETHEREAL_STRUCT_SA_LEN # dnl AC_STRUCT_ST_BLKSIZE extracted from the file in question, @@ -228,25 +248,81 @@ AC_DEFUN(AC_ETHEREAL_PCAP_CHECK, for pcap_dir in /usr/include/pcap /usr/local/include/pcap $prefix/include do if test -d $pcap_dir ; then - LIBS="$LIBS -L$pcap_dir" CFLAGS="$CFLAGS -I$pcap_dir" CPPFLAGS="$CPPFLAGS -I$pcap_dir" - found_pcap_dir=" $found_pcap_dir -L$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 LIBS and CFLAGS) + AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS) else AC_MSG_RESULT(not found) fi - # Pcap checks + # 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_LIB(pcap, pcap_open_live,, AC_MSG_ERROR(Library libpcap not found.), - $SOCKET_LIBS $NSL_LIBS) + + # + # Try various directories to find libpcap + # + AC_CHECK_LIB(pcap, pcap_open_live, + PCAP_LIBS=-lpcap, + [ + # + # Throw away the cached "we didn't find it" + # answer, and see if it's in "/usr/local/lib". + # + unset ac_cv_lib_pcap_pcap_open_live + save_LIBS="$LIBS" + AC_ETHEREAL_ADD_DASH_L(LIBS, /usr/local/lib) + AC_CHECK_LIB(pcap, pcap_open_live, + [ + # + # Throw away the cached "we found it" answer, so that if + # we rerun "configure", we don't just blow off the above + # checks and blithely assume that we don't need to search + # "/usr/local/lib". + # + # 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_pcap_pcap_open_live + AC_ETHEREAL_ADD_DASH_L(PCAP_LIBS, /usr/local/lib) + PCAP_LIBS="$PCAP_LIBS -lpcap" + LIBS="$save_LIBS" + ], + [ + # + # Throw away the cached "we didn't find it" + # answer, and see if it's in "$prefix/lib". + # + unset ac_cv_lib_pcap_pcap_open_live + LIBS="$save_LIBS -L$prefix/lib" + AC_CHECK_LIB(pcap, pcap_open_live, + [ + # + # Throw away the cached "we found it" answer, so that if + # we rerun "configure", we don't just blow off the above + # checks and blithely assume that we don't need to search + # "$prefix/lib". + # + unset ac_cv_lib_pcap_pcap_open_live + AC_ETHEREAL_ADD_DASH_L(PCAP_LIBS, $prefix/lib) + PCAP_LIBS="$PCAP_LIBS -lpcap" + LIBS="$save_LIBS" + ], + AC_MSG_ERROR(Library libpcap not found.), + $SOCKET_LIBS $NSL_LIBS) + ], $SOCKET_LIBS $NSL_LIBS) + ], $SOCKET_LIBS $NSL_LIBS) + AC_SUBST(PCAP_LIBS) ]) # diff --git a/configure.in b/configure.in index 0def4a8f83..27fd59c55d 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.75 2000/01/15 08:08:20 guy Exp $ +# $Id: configure.in,v 1.76 2000/01/15 09:46:28 guy 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 @@ -50,18 +50,9 @@ CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I/usr/local/include" CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I/usr/local/include" # -# Arrange that we search for libraries in "/usr/local/lib", and set -# a "-R" flag as appropriate. +# Arrange that we search for libraries in "/usr/local/lib". # -# XXX - IRIX, and other OSes, may require some flag equivalent to -# "-R" here. -# -LIBS="$LIBS -L/usr/local/lib" -case "$host_os" in - solaris*) - LIBS="$LIBS -R/usr/local/lib" - ;; -esac +AC_ETHEREAL_ADD_DASH_L(LIBS, /usr/local/lib) # Create DATAFILE_DIR #define for config.h DATAFILE_DIR=$sysconfdir @@ -173,7 +164,7 @@ dnl SNMP Check AC_ARG_ENABLE(snmp, [ --enable-snmp use SNMP library, if available. [default=yes]],,enable_snmp=yes) -SNMP_A='' +SNMP_LIBS='' AC_MSG_CHECKING(whether to use SNMP library if available) if test "x$enable_snmp" = "xno" ; then AC_MSG_RESULT(no) @@ -181,12 +172,40 @@ 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) + + # + # This may require "-lkstat" on Solaris, sigh. + # AC_CHECK_LIB(snmp, sprint_objid, - [ - SNMP_A=-lsnmp - ], ) + 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 -lkstat + ) + ], $SOCKET_LIBS $NSL_LIBS + ) + fi -AC_SUBST(SNMP_A) +AC_SUBST(SNMP_LIBS) dnl Checks for typedefs, structures, and compiler characteristics. # AC_C_CONST |