aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2006-01-31 22:22:05 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2006-01-31 22:22:05 +0000
commitc8dd927e0c6dd23f065c965f08e4921ed2635fda (patch)
tree2c4b99a172f89f5f443d783e7e2cd448eec1019d
parent42bf48fa74032b40af0c750daf9e0daca6c23d68 (diff)
It was hard.. but at the end I won (or at least i believe so...).
After install hello_world.lua works. svn path=/trunk/; revision=17137
-rw-r--r--Makefile.am21
-rw-r--r--acinclude.m4143
-rw-r--r--configure.in43
-rw-r--r--plugins/Makefile.am8
-rw-r--r--plugins/lua/Makefile.am26
5 files changed, 225 insertions, 16 deletions
diff --git a/Makefile.am b/Makefile.am
index f0eb98b2fd..6b8960ba52 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -178,6 +178,13 @@ PLATFORM_SRC = capture-pcap-util-unix.c
include Makefile.common
if HAVE_PLUGINS
+
+if HAVE_LIBLUA
+lua_lib = plugins/lua/lua.la
+else # HAVE_LIBLUA
+lua_lib =
+endif # HAVE_LIBLUA
+
plugin_libs = \
plugins/acn/acn.la \
plugins/agentx/agentx.la \
@@ -190,7 +197,9 @@ plugin_libs = \
plugins/giop/coseventcomm.la \
plugins/gryphon/gryphon.la \
plugins/irda/irda.la \
+ $(lua_lib) \
plugins/lwres/lwres.la \
+ plugins/mate/mate.la \
plugins/megaco/megaco.la \
plugins/mgcp/mgcp.la \
plugins/opsi/opsi.la \
@@ -200,12 +209,20 @@ plugin_libs = \
plugins/rlm/rlm.la \
plugins/rtnet/rtnet.la \
plugins/rudp/rudp.la \
+ plugins/stats_tree/stats_tree.la \
plugins/v5ua/v5ua.la
if ENABLE_STATIC
plugin_ldadd = $(plugin_libs)
else # ENABLE_STATIC
+
+if HAVE_LIBLUA
+lua_ldadd = "-dlopen" plugins/lua/lua.la
+else # HAVE_LIBLUA
+lua_ldadd =
+endif # HAVE_LIBLUA
+
plugin_ldadd = \
"-dlopen" self \
"-dlopen" plugins/acn/acn.la \
@@ -218,8 +235,11 @@ plugin_ldadd = \
"-dlopen" plugins/giop/cosnaming.la \
"-dlopen" plugins/giop/coseventcomm.la \
"-dlopen" plugins/gryphon/gryphon.la \
+ "-dlopen" plugins/h223/h223.la \
"-dlopen" plugins/irda/irda.la \
+ $(lua_ldadd) \
"-dlopen" plugins/lwres/lwres.la \
+ "-dlopen" plugins/mate/mate.la \
"-dlopen" plugins/megaco/megaco.la \
"-dlopen" plugins/mgcp/mgcp.la \
"-dlopen" plugins/opsi/opsi.la \
@@ -229,6 +249,7 @@ plugin_ldadd = \
"-dlopen" plugins/rlm/rlm.la \
"-dlopen" plugins/rtnet/rtnet.la \
"-dlopen" plugins/rudp/rudp.la \
+ "-dlopen" plugins/stats_tree/stats_tree.la \
"-dlopen" plugins/v5ua/v5ua.la
endif # ENABLE_STATIC
diff --git a/acinclude.m4 b/acinclude.m4
index 3dd200675e..2e15ce5eb1 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -736,6 +736,149 @@ AC_DEFUN([AC_ETHEREAL_LIBPCRE_CHECK],
])
#
+# AC_ETHEREAL_LIBLUA_CHECK
+#
+AC_DEFUN([AC_ETHEREAL_LIBLUA_CHECK],[
+
+ if test "x$lua_dir" != "x"
+ then
+ #
+ # The user specified a directory in which liblua resides,
+ # so add the "include" subdirectory of that directory to
+ # the include file search path and the "lib" subdirectory
+ # of that directory to the library search path.
+ #
+ # XXX - if there's also a liblua in a directory that's
+ # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
+ # make us find the version in the specified directory,
+ # as the compiler and/or linker will search that other
+ # directory before it searches the specified directory.
+ #
+ ethereal_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -I$lua_dir/include"
+ ethereal_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -I$lua_dir/include"
+ ethereal_save_LIBS="$LIBS"
+ LIBS="$LIBS -llua -llualib"
+ ethereal_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -L$lua_dir/lib"
+ else
+ #
+ # The user specified no directory in which liblua resides,
+ # so just add "-llua -lliblua" to the used libs.
+ #
+ ethereal_save_CFLAGS="$CFLAGS"
+ ethereal_save_CPPFLAGS="$CPPFLAGS"
+ ethereal_save_LDFLAGS="$LDFLAGS"
+ ethereal_save_LIBS="$LIBS"
+ fi
+
+ #
+ # Make sure we have "lua.h", "lualib.h" and "lauxlib.h". If we don't, it means we probably
+ # don't have liblua, so don't use it.
+ #
+ AC_CHECK_HEADERS(lua.h lualib.h lauxlib.h,,
+ [
+ if test "x$lua_dir" != "x"
+ then
+ #
+ # The user used "--with-lua=" to specify a directory
+ # containing liblua, but we didn't find the header file
+ # there; that either means they didn't specify the
+ # right directory or are confused about whether liblua
+ # is, in fact, installed. Report the error and give up.
+ #
+ AC_MSG_ERROR([liblua header not found in directory specified in --with-lua])
+ else
+ if test "x$want_lua" = "xyes"
+ then
+ #
+ # The user tried to force us to use the library, but we
+ # couldn't find the header file; report an error.
+ #
+ AC_MSG_ERROR(Header file lua.h not found.)
+ else
+ #
+ # We couldn't find the header file; don't use the
+ # library, as it's probably not present.
+ #
+ want_lua=no
+ fi
+ fi
+ ])
+
+ if test "x$want_lua" != "xno"
+ then
+ #
+ # Well, we at least have the lua header file.
+ #
+ # let's check if the libs are there
+ #
+ AC_CHECK_LIB(lua, lua_version,
+ [
+ if test "x$lua_dir" != "x"
+ then
+ #
+ # Put the "-I" and "-L" flags for lua at
+ # the beginning of CFLAGS, CPPFLAGS,
+ # LDFLAGS, and LIBS.
+ #
+ LUA_LIBS="-L$lua_dir/lib -llua"
+ CFLAGS="-I$lua_dir/include $ethereal_save_CFLAGS"
+
+ else
+ LUA_LIBS="-llua"
+ fi
+
+ #
+ # we got lua, now look for lualib
+ #
+
+ AC_CHECK_LIB(lualib, luaopen_base,
+ [
+ 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
+ want_lua=no
+ ])
+ ],[
+ #
+ # 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=""
+ want_lua=no
+ ])
+
+
+ CPPFLAGS="$ethereal_save_CPPFLAGS"
+ LDFLAGS="$ethereal_save_LDFLAGS"
+ LIBS="$ethereal_save_LIBS"
+ AC_SUBST(LUA_LIBS)
+
+ fi
+])
+
+#
# AC_ETHEREAL_NETSNMP_CHECK
#
AC_DEFUN([AC_ETHEREAL_NETSNMP_CHECK],
diff --git a/configure.in b/configure.in
index cabd6fc37d..3d52e711bc 100644
--- a/configure.in
+++ b/configure.in
@@ -749,6 +749,41 @@ else
fi
+dnl lua check
+AC_MSG_CHECKING(whether to use liblua for the lua scripting plugin)
+
+AC_ARG_WITH(lua,
+[ --with-lua[[=DIR]] use liblua (located in directory DIR, if supplied) for the lua scripting plugin. [[default=no]]],
+[
+ if test $withval = no
+ then
+ want_lua=no
+ elif test $withval = yes
+ then
+ want_lua=yes
+ else
+ want_lua=yes
+ lua_dir=$withval
+ fi
+],[
+ #
+ # Use liblua if it's present, otherwise don't.
+ #
+ want_lua=no
+ lua_dir=
+])
+if test "x$want_lua" = "xno" ; then
+ AC_MSG_RESULT(no)
+else
+ AC_MSG_RESULT(yes)
+ AC_ETHEREAL_LIBLUA_CHECK
+ if test "x$want_lua" = "xno" ; then
+ AC_MSG_RESULT(liblua not found - disabling support for the lua scripting plugin)
+ fi
+fi
+AM_CONDITIONAL(HAVE_LIBLUA, test x$want_lua = xyes)
+
+
dnl ipv6 check
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 use ipv6 name resolution, if available. [default=yes]],enable_ipv6=$enableval,enable_ipv6=yes)
@@ -1256,6 +1291,7 @@ AC_OUTPUT(
plugins/gryphon/Makefile
plugins/h223/Makefile
plugins/irda/Makefile
+ plugins/lua/Makefile
plugins/lwres/Makefile
plugins/mate/Makefile
plugins/megaco/Makefile
@@ -1294,6 +1330,12 @@ else
pcre_message="yes"
fi
+if test "x$want_lua" = "xyes" -a "x$have_plugins" = "xyes" ; then
+ lua_message="yes"
+else
+ lua_message="no"
+fi
+
if test "x$want_ssl" = "xno" ; then
ssl_message="no"
else
@@ -1335,6 +1377,7 @@ echo " Build dftest : $enable_dftest"
echo ""
echo " Install setuid : $setuid_message"
echo " Use plugins : $have_plugins"
+echo " Build lua plugin : $lua_message"
echo " Use GTK+ v2 library : $enable_gtk2"
if test "x$enable_gtk2" = "xyes" ; then
echo " Use threads : $enable_threads"
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 5ba7ff100a..7e36571163 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -21,6 +21,13 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+if HAVE_LIBLUA
+lua_dir = \
+ lua
+else # HAVE_LIBLUA
+lua_dir =
+endif # HAVE_LIBLUA
+
SUBDIRS = \
acn \
agentx \
@@ -33,6 +40,7 @@ SUBDIRS = \
gryphon \
h223 \
irda \
+ $(lua_dir) \
lwres \
mate \
megaco \
diff --git a/plugins/lua/Makefile.am b/plugins/lua/Makefile.am
index 65e050f3bd..1e3bde5c4a 100644
--- a/plugins/lua/Makefile.am
+++ b/plugins/lua/Makefile.am
@@ -21,30 +21,30 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-INCLUDES = -I$(top_srcdir) -I./lua-5.0.2/include
+INCLUDES = -I$(top_srcdir)
plugindir = @plugindir@
plugin_LTLIBRARIES = lua.la
lua_la_SOURCES = \
- lua_tvb.c \
- lua_proto.c \
- lua_tree.c \
- lua_pinfo.c \
- lua_tap.c \
- packet-lua.c \
- packet-lua.h \
+ lua_tvb.c \
+ lua_proto.c \
+ lua_tree.c \
+ lua_pinfo.c \
+ lua_tap.c \
+ packet-lua.c \
+ packet-lua.h \
plugin.c
lua_la_LDFLAGS = -module -avoid-version
-lua_la_LIBADD = @PLUGIN_LIBS@
+lua_la_LIBADD = @PLUGIN_LIBS@ @LUA_LIBS@
# Libs must be cleared, or else libtool won't create a shared module.
# If your module needs to be linked against any particular libraries,
# add them here.
-LIBS = -L./lua-5.0.2/lib -llua -llualib
+LIBS =
CLEANFILES = \
@@ -62,9 +62,3 @@ EXTRA_DIST = \
dummy:
touch dummy
-GUNZIP = gzip -d
-TAR = tar
-
-lua-5.0.2: lua-5.0.2.tar.gz
- $(GUNZIP) lua-5.0.2.tar.gz | $(TAR) xf -
-