AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
# }}}
-
-
-
-# --with-lua {{{
-with_lua_cflags=""
-with_lua_ldflags=""
-with_lua_libs=""
-AC_ARG_WITH(lua, [AS_HELP_STRING([--with-lua@<:@=PREFIX@:>@], [Path to lua library.])],
-[
- if test "x$withval" != "xno" && test "x$withval" != "xyes"
- then
- with_lua_cflags="-I$withval/include"
- with_lua_ldflags="-L$withval/lib"
- with_lua="yes"
- else
- with_lua="$withval"
- fi
-],
-[
- with_lua="yes"
-])
-
-SAVE_CFLAGS="$CFLAGS"
-SAVE_LDFLAGS="$LDFLAGS"
-CFLAGS="$SAVE_CFLAGS $with_lua_cflags"
-LDFLAGS="$SAVE_LDFLAGS $with_lua_ldflags"
-if test "x$with_lua" = "xyes"
-then
- AC_CHECK_LIB(lua, lua_settop,
- [
- AC_DEFINE(HAVE_LUA, 1, [Define to 1 if you have the lua library (-llua).])
- ], [with_lua="no (lua not found)"])
-fi
-if test "x$with_lua" = "xyes"
-then
- AC_CHECK_HEADERS(lua.h,
- [
- AC_DEFINE(HAVE_LUA_H, 1, [Define to 1 if you have the <lua.h> header file.])
- ], [with_lua="no (lua.h not found)"])
-fi
-
-CFLAGS="$SAVE_CFLAGS"
-LDFLAGS="$SAVE_LDFLAGS"
-
-if test "x$with_lua" = "xyes"
-then
- BUILD_WITH_LUA_CFLAGS="$with_lua_cflags"
- BUILD_WITH_LUA_LDFLAGS="$with_lua_ldflags"
- BUILD_WITH_LUA_LIBS="$with_lua_libs"
- AC_SUBST(BUILD_WITH_LUA_CFLAGS)
- AC_SUBST(BUILD_WITH_LUA_LDFLAGS)
- AC_SUBST(BUILD_WITH_LUA_LIBS)
-fi
-AM_CONDITIONAL(BUILD_WITH_LUA, test "x$with_lua" = "xyes")
-# }}}
-
-
-
-
-
# --with-libcurl {{{
with_curl_config="curl-config"
with_curl_cflags=""
AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
# }}}
+# --with-liblua {{{
+with_liblua_config="lua-config50"
+with_liblua_cppflags=""
+with_liblua_ldflags=""
+with_liblua_libs=""
+AC_ARG_WITH(liblua, [AS_HELP_STRING([--with-liblua@<:@=lua-config50@:>@], [Path to the Lua config script.])],
+[
+ if test "x$withval" = "xno" || test "x$withval" = "xyes"
+ then
+ with_liblua="$withval"
+ else
+ if test -f "$withval" && test -x "$withval"
+ then
+ with_liblua_config="$withval"
+ with_liblua="yes"
+ else if test -x "$withval/bin/lua-config50"
+ then
+ with_liblua_config="$withval/bin/lua-config50"
+ with_liblua="yes"
+ else
+ AC_MSG_ERROR("not an executable: $withval")
+ fi; fi
+ fi
+],
+[
+ with_liblua="yes"
+])
+if test "x$with_liblua" = "xyes"
+then
+ with_liblua_cppflags=`$with_liblua_config --include 2>/dev/null`
+ lua_config_status=$?
+
+ if test $lua_config_status -ne 0
+ then
+ with_liblua="no ($with_liblua_config failed)"
+ else
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_liblua_cppflags"
+
+ AC_CHECK_HEADERS(lua.h, [], [with_liblua="no (lua.h not found)"], [])
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+ fi
+fi
+if test "x$with_liblua" = "xyes"
+then
+ with_liblua_ldflags=`$with_liblua_config --libs-only-L 2>/dev/null`
+ lua_config_status=$?
+
+ if test $lua_config_status -ne 0
+ then
+ with_liblua="no ($with_liblua_config failed)"
+ fi
+fi
+if test "x$with_liblua" = "xyes"
+then
+ with_liblua_libs=`$with_liblua_config --libs-only-l 2>/dev/null`
+ lua_config_status=$?
+
+ if test $lua_config_status -ne 0
+ then
+ with_liblua="no ($with_liblua_config failed)"
+ else
+ SAVE_LDFLAGS="$LDFLAGS"
+ SAVE_LIBS="$LIBS"
+ LDFLAGS="$SAVE_LDFLAGS $with_liblua_ldflags"
+ LIBS="$LIBS $with_liblua_libs"
+
+ AC_CHECK_FUNC(lua_settop, [with_liblua="yes"], [with_liblua="no (symbol 'lua_settop' not found)"])
+
+ LDFLAGS="$SAVE_LDFLAGS"
+ LIBS="$SAVE_LIBS"
+ fi
+fi
+if test "x$with_liblua" = "xyes"
+then
+ BUILD_WITH_LIBLUA_CPPFLAGS="$with_liblua_cppflags"
+ BUILD_WITH_LIBLUA_LDFLAGS="$with_liblua_ldflags"
+ BUILD_WITH_LIBLUA_LIBS="$with_liblua_libs"
+ AC_SUBST(BUILD_WITH_LIBLUA_CPPFLAGS)
+ AC_SUBST(BUILD_WITH_LIBLUA_LDFLAGS)
+ AC_SUBST(BUILD_WITH_LIBLUA_LIBS)
+fi
+AM_CONDITIONAL(BUILD_WITH_LUA, test "x$with_liblua" = "xyes")
+# }}}
+
# --with-libmemcached {{{
with_libmemcached_cppflags=""
with_libmemcached_ldflags=""
AC_PLUGIN([load], [$plugin_load], [System load])
AC_PLUGIN([logfile], [yes], [File logging plugin])
AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
-AC_PLUGIN([lua], [$with_lua], [lua plugin])
+AC_PLUGIN([lua], [$with_liblua], [Lua plugin])
AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
AC_PLUGIN([match_hashed], [yes], [The hashed match])
collectd_DEPENDENCIES += apache.la
endif
-if BUILD_PLUGIN_LUA
-pkglib_LTLIBRARIES += lua.la
-lua_la_SOURCES = lua.c
-lua_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LUA_CFLAGS)
-lua_la_LDFLAGS = -module -avoid-version
-lua_la_LIBADD = $(BUILD_WITH_LUA_LIBS)
-collectd_LDADD += "-dlopen" lua.la
-collectd_DEPENDENCIES += lua.la
-endif
-
-
if BUILD_PLUGIN_APCUPS
pkglib_LTLIBRARIES += apcups.la
apcups_la_SOURCES = apcups.c
lpar_la_LIBADD = -lperfstat
endif
+if BUILD_PLUGIN_LUA
+pkglib_LTLIBRARIES += lua.la
+lua_la_SOURCES = lua.c
+lua_la_CPPFLAGS = $(AM_CPPFLAGS) $(BUILD_WITH_LIBLUA_CPPFLAGS)
+lua_la_LDFLAGS = -module -avoid-version $(BUILD_WITH_LIBLUA_LDFLAGS)
+lua_la_LIBADD = $(BUILD_WITH_LIBLUA_LIBS)
+collectd_LDADD += "-dlopen" lua.la
+collectd_DEPENDENCIES += lua.la
+endif
+
if BUILD_PLUGIN_MADWIFI
pkglib_LTLIBRARIES += madwifi.la
madwifi_la_SOURCES = madwifi.c madwifi.h