Add "-L" flags to LDFLAGS, not LIBS, and get rid of all the exotic

searching that tries to figure out in what directory libpcap lives - we
should treat "-L" just like "-I", rather than adding a ton of
complication to do it the way the autoconf maintainers think, for some
reason, it should be done (by adding "-L" flags to LIBS - "-L" flags
don't specify libraries, so I have no clue why they think they belong in
LIBS; they specify a search path for libraries, just as "-I" flags
specify a search path for header files, so they strike me as "flags to
the linker" rather than "libraries", and LDFLAGS, unlike LIBS, appears
before *all* "-l" flags, including those specified by PCAP_LIBS and so
on).

svn path=/trunk/; revision=1516
This commit is contained in:
Guy Harris 2000-01-21 06:18:16 +00:00
parent 622e0ef550
commit d9f1ce299f
2 changed files with 7 additions and 60 deletions

View File

@ -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.19 2000/01/15 21:01:04 guy Exp $
dnl $Id: acinclude.m4,v 1.20 2000/01/21 06:18:15 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
@ -266,67 +266,14 @@ AC_DEFUN(AC_ETHEREAL_PCAP_CHECK,
AC_CHECK_HEADER(pcap.h,, AC_MSG_ERROR(Header file pcap.h not found.))
#
# Try various directories to find libpcap
# 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)
],
[
#
# 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
ethereal_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"
AC_DEFINE(HAVE_LIBPCAP)
LIBS="$ethereal_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="$ethereal_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"
AC_DEFINE(HAVE_LIBPCAP)
LIBS="$ethereal_save_LIBS"
],
AC_MSG_ERROR(Library libpcap not found.),
$SOCKET_LIBS $NSL_LIBS)
], $SOCKET_LIBS $NSL_LIBS)
], $SOCKET_LIBS $NSL_LIBS)
], AC_MSG_ERROR(Library libpcap not found.),
$SOCKET_LIBS $NSL_LIBS)
AC_SUBST(PCAP_LIBS)
])
@ -391,7 +338,7 @@ AC_DEFUN(AC_ETHEREAL_UCDSNMP_CHECK,
AC_MSG_RESULT(added $d to paths)
CFLAGS="$CFLAGS -I${ucdsnmpdir}/include"
CPPFLAGS="$CPPFLAGS -I${ucdsnmpdir}/include"
LIBS="$LIBS -L${ucdsnmpdir}/lib"
AC_ETHEREAL_ADD_DASH_L(LDFLAGS, ${ucdsnmpdir}/lib)
fi
fi
])

View File

@ -1,4 +1,4 @@
# $Id: configure.in,v 1.78 2000/01/16 00:13:24 guy Exp $
# $Id: configure.in,v 1.79 2000/01/21 06:18:16 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
@ -52,7 +52,7 @@ CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I/usr/local/inclu
#
# Arrange that we search for libraries in "/usr/local/lib".
#
AC_ETHEREAL_ADD_DASH_L(LIBS, /usr/local/lib)
AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
# Create DATAFILE_DIR #define for config.h
DATAFILE_DIR=$sysconfdir