aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ton Voon <tonvoon@users.sourceforge.net> 2007-03-30 14:08:27 +0000
committerGravatar Ton Voon <tonvoon@users.sourceforge.net> 2007-03-30 14:08:27 +0000
commita6b538664e7ab3d3ee5f26e3c48d444df91daa35 (patch)
tree10d5ef6f1ff037bfb7249cffea5204d2d7c90007
parent950f99c62a942f665bde95b9d606279ffa7804d7 (diff)
downloadmonitoring-plugins-a6b538664e7ab3d3ee5f26e3c48d444df91daa35.tar.gz
Fix AC_CHECK_LIB for mysql_init - add dependent libraries. mysql detection
separated into external m4 file git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1661 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--NEWS6
-rw-r--r--configure.in52
-rw-r--r--m4/np_mysqlclient.m471
3 files changed, 89 insertions, 40 deletions
diff --git a/NEWS b/NEWS
index 5e680637..0a6ee598 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
This file documents the major additions and syntax changes between releases.
+1.4.8 ??
+ Respects --without-world-permissions for setuid plugins
+ check_disk extra options for regex matching of filesystems and grouping of filesystems
+ for collective thresholds
+ Better configure test for mysqlclient availability
+
1.4.7 29th March 2007
check_procs uses /usr/ucb/ps if available - fixes pst3 problems on Solaris
Fixed MKINSTALLDIRS problem in po/
diff --git a/configure.in b/configure.in
index 81033a03..a53ef4f0 100644
--- a/configure.in
+++ b/configure.in
@@ -241,46 +241,18 @@ fi
LIBS="$_SAVEDLIBS"
dnl Check for mysql libraries
-dnl Default is to search path for mysql_config
-AC_ARG_WITH(mysql,
- ACX_HELP_STRING([--with-mysql=DIR],
- [Compiles mysql plugins. Expects DIR/bin/mysql_config]),
- with_mysql=$withval,
- with_mysql=yes)
-if test $with_mysql != "no" ; then
- if test -x $with_mysql/bin/mysql_config ; then
- MYSQLCONFIG="$with_mysql/bin/mysql_config"
- else
- AC_PATH_PROG(MYSQLCONFIG, mysql_config)
- fi
- if test -z "$MYSQLCONFIG"; then
- with_mysql="not found"
- AC_MSG_WARN([Skipping mysql plugin])
- AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
- else
- MYSQLINCLUDE=`$MYSQLCONFIG --include`
- # Mysql 3 does not support --include. --cflags should be sufficient
- if test $? -ne 0 ; then
- MYSQLINCLUDE=""
- TEMP_INCLUDE="-I$with_mysql/include" # Guessed location
- else
- TEMP_INCLUDE=$MYSQLINCLUDE
- fi
- MYSQLLIBS=`$MYSQLCONFIG --libs`
- MYSQLCFLAGS=`$MYSQLCONFIG --cflags`
- AC_SUBST(MYSQLINCLUDE)
- AC_SUBST(MYSQLLIBS)
- AC_SUBST(MYSQLCFLAGS)
- dnl Test for mysqlclient. Some redhat systems have mysql_config, but no headers
- _SAVEDCPPFLAGS=$CPPFLAGS
- _SAVEDLDFLAGS="$LDFLAGS"
- CPPFLAGS="$CPPFLAGS $TEMP_INCLUDE"
- LDFLAGS="$LDFLAGS $MYSQLLIBS"
- AC_CHECK_LIB([mysqlclient], [mysql_init], [with_mysql=$MYSQLCONFIG
-EXTRAS="$EXTRA check_mysql check_mysql_query"], [with_mysql="not found"])
- CPPFLAGS=$_SAVEDCPPFLAGS
- LDFLAGS=$_SAVEDLDFLAGS
- fi
+np_mysqlclient
+if test $with_mysql = "no" ; then
+ AC_MSG_WARN([Skipping mysql plugin])
+ AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
+else
+ EXTRAS="$EXTRA check_mysql check_mysql_query"
+ MYSQLINCLUDE="$np_mysql_include"
+ MYSQLLIBS="$np_mysql_libs"
+ MYSQLCFLAGS="$np_mysql_cflags"
+ AC_SUBST(MYSQLINCLUDE)
+ AC_SUBST(MYSQLLIBS)
+ AC_SUBST(MYSQLCFLAGS)
fi
dnl Check for AF_INET6 support - unistd.h required for Darwin
diff --git a/m4/np_mysqlclient.m4 b/m4/np_mysqlclient.m4
new file mode 100644
index 00000000..6bd51b83
--- /dev/null
+++ b/m4/np_mysqlclient.m4
@@ -0,0 +1,71 @@
+# np_mysqlclient.m4
+dnl Copyright (C) 2007 Nagios Plugins Team
+dnl This file is free software; the Nagios Plugin Team
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Test for mysql availability using mysql_config
+dnl Uses --with-mysql= yes(autodetection - default) | no | path
+dnl Sets 4 variables:
+dnl with_mysql = path/to/mysql_config (if found and can compile mysqlclient) or "no"
+dnl np_mysql_include = flags for include, from mysql_config --include (will be guessed as $with_mysql/include if --include not found)
+dnl np_mysql_libs = flags for libs, from mysql_config --libs
+dnl np_mysql_cflags = flags for cflags, from mysql_config --cflags
+dnl Also sets in config.h:
+dnl HAVE_MYSQLCLIENT
+dnl Copile your code with:
+dnl $(CC) $(np_mysql_include) code.c $(np_mysql_libs)
+
+AC_DEFUN([np_mysqlclient],
+[
+ AC_ARG_WITH(mysql,
+ ACX_HELP_STRING([--with-mysql=DIR],
+ [Locates mysql libraries. Expects DIR/bin/mysql_config. Default to search for mysql_config in PATH]),
+ with_mysql=$withval,
+ with_mysql=yes)
+
+ if test "x$with_mysql" != "xno" ; then
+ if test "x$with_mysql" = "xyes" ; then
+ AC_PATH_PROG(np_mysql_config, mysql_config)
+ else
+ if test -x $with_mysql/bin/mysql_config ; then
+ np_mysql_config="$with_mysql/bin/mysql_config"
+ fi
+ fi
+ if test -z "$np_mysql_config"; then
+ with_mysql="no"
+ else
+ np_mysql_include="`$np_mysql_config --include`"
+ # Mysql 3 does not support --include. --cflags should be sufficient
+ if test $? -ne 0; then
+ np_mysql_include="-I$with_mysql/include" # Guessed location
+ fi
+ np_mysql_libs="`$np_mysql_config --libs`"
+ np_mysql_cflags="`$np_mysql_config --cflags`"
+
+ dnl Test a mysql_init. Some systems have mysql_config, but no headers
+ _savedcppflags="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $np_mysql_include"
+
+ dnl Putting $np_mysql_libs as other libraries ensures that all mysql dependencies are linked in
+ dnl Although -lmysqlclient is duplicated, it is not a problem
+ AC_CHECK_LIB([mysqlclient], [mysql_init], [
+ with_mysql=$np_mysql_config
+ AC_DEFINE(HAVE_MYSQLCLIENT, 1, [Defined if mysqlclient is found and can compile])
+ ], [with_mysql=no], [$np_mysql_libs])
+ CPPFLAGS=$_savedcppflags
+
+ fi
+ fi
+])
+
+dnl Will take $1, find last occurrance of -LDIR and add DIR to LD_RUN_PATH
+AC_DEFUN([np_add_to_runpath],
+[
+ dnl Need [[ ]] so autoconf gives us just one set
+ np_libdir=`echo "$1" | sed -e 's/.*-L\([[^ ]]*\) .*/\1/'`
+ if test "x$np_libdir" != x ; then
+ LD_RUN_PATH="${np_libdir}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
+ fi
+])
+