lua plugin: first version
[collectd.git] / configure.in
index 6249f96..b866639 100644 (file)
@@ -91,6 +91,10 @@ if test "x$ac_system" = "xSolaris"
 then
        AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
 fi
+if test "x$ac_system" = "xAIX"
+then
+       AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
+fi
 
 # Where to install .pc files.
 pkgconfigdir="${libdir}/pkgconfig"
@@ -568,6 +572,16 @@ socket_needs_socket="no"
 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
 
+clock_gettime_needs_rt="no"
+clock_gettime_needs_posix4="no"
+AC_CHECK_FUNCS(clock_gettime,
+    [],
+    AC_CHECK_LIB(rt, clock_gettime,
+        [clock_gettime_needs_rt="yes"],
+        AC_CHECK_LIB(posix4, clock_gettime,
+            [clock_gettime_needs_posix4="yes"],
+            AC_MSG_ERROR(cannot find clock_gettime))))
+
 nanosleep_needs_rt="no"
 nanosleep_needs_posix4="no"
 AC_CHECK_FUNCS(nanosleep,
@@ -577,8 +591,9 @@ AC_CHECK_FUNCS(nanosleep,
         AC_CHECK_LIB(posix4, nanosleep,
             [nanosleep_needs_posix4="yes"],
             AC_MSG_ERROR(cannot find nanosleep))))
-AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
-AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$nanosleep_needs_posix4" = "xyes")
+
+AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
+AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
 
 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
@@ -1193,6 +1208,12 @@ fi
 if test "x$with_perfstat" = "xyes"
 then
         AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
+        # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
+        AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
+        if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
+        then
+               AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
+        fi
 fi
 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
 
@@ -1337,6 +1358,66 @@ fi
 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=""
@@ -4548,6 +4629,8 @@ AC_PLUGIN([java],        [$with_java],         [Embed the Java Virtual Machine])
 AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
 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([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])
@@ -4798,6 +4881,7 @@ Configuration:
     libjvm  . . . . . . . $with_java
     libkstat  . . . . . . $with_kstat
     libkvm  . . . . . . . $with_libkvm
+    liblua  . . . . . . . $with_liblua
     libmemcached  . . . . $with_libmemcached
     libmodbus . . . . . . $with_libmodbus
     libmysql  . . . . . . $with_libmysql
@@ -4873,6 +4957,8 @@ Configuration:
     libvirt . . . . . . . $enable_libvirt
     load  . . . . . . . . $enable_load
     logfile . . . . . . . $enable_logfile
+    lpar... . . . . . . . $enable_lpar
+    lua . . . . . . . . . $enable_lua
     madwifi . . . . . . . $enable_madwifi
     match_empty_counter . $enable_match_empty_counter
     match_hashed  . . . . $enable_match_hashed