#
# Check to see if we find "pcap_open_live" in "-lpcap".
+ # Also check for various additional libraries that libpcap might
+ # require.
#
AC_CHECK_LIB(pcap, pcap_open_live,
[
PCAP_LIBS=-lpcap
AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
], [
- AC_MSG_CHECKING([for pcap_open_live in -lpcap -lcfg -lodm])
+ ac_ethereal_extras_found=no
ac_save_LIBS="$LIBS"
- LIBS="-lpcap -lcfg -lodm"
- AC_TRY_LINK(
- [
+ for extras in "-lcfg -lodm" "-lpfring"
+ do
+ AC_MSG_CHECKING([for pcap_open_live in -lpcap with $extras])
+ LIBS="-lpcap $extras"
+ #
+ # XXX - can't we use AC_CHECK_LIB here?
+ #
+ AC_TRY_LINK(
+ [
# include <pcap.h>
- ],
- [
+ ],
+ [
pcap_open_live(NULL, 0, 0, 0, NULL);
- ],
- [
- AC_MSG_RESULT([yes])
- PCAP_LIBS="-lpcap -lcfg -lodm"
- AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
- ],
- [
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Library libpcap not found.])
- ])
+ ],
+ [
+ ac_ethereal_extras_found=yes
+ AC_MSG_RESULT([yes])
+ PCAP_LIBS="-lpcap $extras"
+ AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ])
+ if test x$ac_ethereal_extras_found = xyes
+ then
+ break
+ fi
+ done
+ if test x$ac_ethereal_extras_found = xno
+ then
+ AC_MSG_ERROR([Can't link with library libpcap.])
+ fi
LIBS=$ac_save_LIBS
], $SOCKET_LIBS $NSL_LIBS)
AC_SUBST(PCAP_LIBS)
ethereal_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$lua_dir/include"
ethereal_save_LIBS="$LIBS"
- LIBS="$LIBS -llua -llualib"
+ LIBS="$LIBS -L$lua_dir/lib -llua"
ethereal_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$lua_dir/lib"
else
ethereal_save_CPPFLAGS="$CPPFLAGS"
ethereal_save_LDFLAGS="$LDFLAGS"
ethereal_save_LIBS="$LIBS"
+ LIBS="$LIBS -llua"
fi
#
#
# let's check if the libs are there
#
- AC_CHECK_LIB(lua, lua_version,
+
+ # At least on Suse 9.3 systems, liblualib needs linking
+ # against libm.
+ LIBS="$LIBS $LUA_LIBS -lm"
+
+ AC_CHECK_LIB(lua, lua_call,
[
if test "x$lua_dir" != "x"
then
# LDFLAGS, and LIBS.
#
LUA_LIBS="-L$lua_dir/lib -llua"
- CFLAGS="-I$lua_dir/include $ethereal_save_CFLAGS"
-
+ LUA_INCLUDES="-I$lua_dir/include"
else
LUA_LIBS="-llua"
+ LUA_INCLUDES=""
fi
#
# we got lua, now look for lualib
#
- LIBS="$LIBS $LUA_LIBS -lm"
-
- AC_CHECK_LIB(lualib, luaopen_base,
+ AC_CHECK_LIB(lualib, luaL_openlib,
[
+ #
+ # we have 5.0
+ #
LUA_LIBS="$LUA_LIBS -llualib"
],[
- if test "x$lua_dir" != "x"
- then
- #
- # Restore the versions of CFLAGS, CPPFLAGS,
- # LDFLAGS, and LIBS before we added the
- # "--with-lua=" directory, as we didn't
- # actually find lua there.
- #
- CFLAGS="$ethereal_save_CFLAGS"
- CPPFLAGS="$ethereal_save_CPPFLAGS"
- LDFLAGS="$ethereal_save_LDFLAGS"
- LIBS="$ethereal_save_LIBS"
- LUA_LIBS=""
- fi
- # User requested --with-lua but it isn't available
- if test "x$want_lua" = "xyes"
- then
- AC_MSG_ERROR(Linking with liblualib failed.)
- fi
- want_lua=no
+ #
+ # no lualib, in 5.1 there's only liblua
+ # do we have 5.1?
+ #
+
+ LIBS="$ethereal_save_LIBS $LUA_LIBS"
+
+ AC_CHECK_LIB(lua, luaL_register,
+ [
+ #
+ # Lua 5.1 found
+ #
+ AC_DEFINE(HAVE_LUA_5_1, 1, [Define to use Lua 5.1])
+ ],[
+ #
+ # No, it is not 5.1
+ #
+ if test "x$lua_dir" != "x"
+ then
+ #
+ # Restore the versions of CFLAGS, CPPFLAGS,
+ # LDFLAGS, and LIBS before we added the
+ # "--with-lua=" directory, as we didn't
+ # actually find lua there.
+ #
+ CFLAGS="$ethereal_save_CFLAGS"
+ CPPFLAGS="$ethereal_save_CPPFLAGS"
+ LDFLAGS="$ethereal_save_LDFLAGS"
+ LIBS="$ethereal_save_LIBS"
+ LUA_LIBS=""
+ fi
+ # User requested --with-lua but it isn't available
+ if test "x$want_lua" = "xyes"
+ then
+ AC_MSG_ERROR(Linking with liblualib failed.)
+ fi
+ want_lua=no
+ ])
])
],[
#
fi
want_lua=no
])
-
+
+ CFLAGS="$ethereal_save_CFLAGS"
CPPFLAGS="$ethereal_save_CPPFLAGS"
LDFLAGS="$ethereal_save_LDFLAGS"
LIBS="$ethereal_save_LIBS"
AC_SUBST(LUA_LIBS)
+ AC_SUBST(LUA_INCLUDES)
fi
])