summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 @@
1This file documents the major additions and syntax changes between releases. 1This file documents the major additions and syntax changes between releases.
2 2
31.4.8 ??
4 Respects --without-world-permissions for setuid plugins
5 check_disk extra options for regex matching of filesystems and grouping of filesystems
6 for collective thresholds
7 Better configure test for mysqlclient availability
8
31.4.7 29th March 2007 91.4.7 29th March 2007
4 check_procs uses /usr/ucb/ps if available - fixes pst3 problems on Solaris 10 check_procs uses /usr/ucb/ps if available - fixes pst3 problems on Solaris
5 Fixed MKINSTALLDIRS problem in po/ 11 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
241LIBS="$_SAVEDLIBS" 241LIBS="$_SAVEDLIBS"
242 242
243dnl Check for mysql libraries 243dnl Check for mysql libraries
244dnl Default is to search path for mysql_config 244np_mysqlclient
245AC_ARG_WITH(mysql, 245if test $with_mysql = "no" ; then
246 ACX_HELP_STRING([--with-mysql=DIR], 246 AC_MSG_WARN([Skipping mysql plugin])
247 [Compiles mysql plugins. Expects DIR/bin/mysql_config]), 247 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
248 with_mysql=$withval, 248else
249 with_mysql=yes) 249 EXTRAS="$EXTRA check_mysql check_mysql_query"
250if test $with_mysql != "no" ; then 250 MYSQLINCLUDE="$np_mysql_include"
251 if test -x $with_mysql/bin/mysql_config ; then 251 MYSQLLIBS="$np_mysql_libs"
252 MYSQLCONFIG="$with_mysql/bin/mysql_config" 252 MYSQLCFLAGS="$np_mysql_cflags"
253 else 253 AC_SUBST(MYSQLINCLUDE)
254 AC_PATH_PROG(MYSQLCONFIG, mysql_config) 254 AC_SUBST(MYSQLLIBS)
255 fi 255 AC_SUBST(MYSQLCFLAGS)
256 if test -z "$MYSQLCONFIG"; then
257 with_mysql="not found"
258 AC_MSG_WARN([Skipping mysql plugin])
259 AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
260 else
261 MYSQLINCLUDE=`$MYSQLCONFIG --include`
262 # Mysql 3 does not support --include. --cflags should be sufficient
263 if test $? -ne 0 ; then
264 MYSQLINCLUDE=""
265 TEMP_INCLUDE="-I$with_mysql/include" # Guessed location
266 else
267 TEMP_INCLUDE=$MYSQLINCLUDE
268 fi
269 MYSQLLIBS=`$MYSQLCONFIG --libs`
270 MYSQLCFLAGS=`$MYSQLCONFIG --cflags`
271 AC_SUBST(MYSQLINCLUDE)
272 AC_SUBST(MYSQLLIBS)
273 AC_SUBST(MYSQLCFLAGS)
274 dnl Test for mysqlclient. Some redhat systems have mysql_config, but no headers
275 _SAVEDCPPFLAGS=$CPPFLAGS
276 _SAVEDLDFLAGS="$LDFLAGS"
277 CPPFLAGS="$CPPFLAGS $TEMP_INCLUDE"
278 LDFLAGS="$LDFLAGS $MYSQLLIBS"
279 AC_CHECK_LIB([mysqlclient], [mysql_init], [with_mysql=$MYSQLCONFIG
280EXTRAS="$EXTRA check_mysql check_mysql_query"], [with_mysql="not found"])
281 CPPFLAGS=$_SAVEDCPPFLAGS
282 LDFLAGS=$_SAVEDLDFLAGS
283 fi
284fi 256fi
285 257
286dnl Check for AF_INET6 support - unistd.h required for Darwin 258dnl 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 @@
1# np_mysqlclient.m4
2dnl Copyright (C) 2007 Nagios Plugins Team
3dnl This file is free software; the Nagios Plugin Team
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl Test for mysql availability using mysql_config
8dnl Uses --with-mysql= yes(autodetection - default) | no | path
9dnl Sets 4 variables:
10dnl with_mysql = path/to/mysql_config (if found and can compile mysqlclient) or "no"
11dnl np_mysql_include = flags for include, from mysql_config --include (will be guessed as $with_mysql/include if --include not found)
12dnl np_mysql_libs = flags for libs, from mysql_config --libs
13dnl np_mysql_cflags = flags for cflags, from mysql_config --cflags
14dnl Also sets in config.h:
15dnl HAVE_MYSQLCLIENT
16dnl Copile your code with:
17dnl $(CC) $(np_mysql_include) code.c $(np_mysql_libs)
18
19AC_DEFUN([np_mysqlclient],
20[
21 AC_ARG_WITH(mysql,
22 ACX_HELP_STRING([--with-mysql=DIR],
23 [Locates mysql libraries. Expects DIR/bin/mysql_config. Default to search for mysql_config in PATH]),
24 with_mysql=$withval,
25 with_mysql=yes)
26
27 if test "x$with_mysql" != "xno" ; then
28 if test "x$with_mysql" = "xyes" ; then
29 AC_PATH_PROG(np_mysql_config, mysql_config)
30 else
31 if test -x $with_mysql/bin/mysql_config ; then
32 np_mysql_config="$with_mysql/bin/mysql_config"
33 fi
34 fi
35 if test -z "$np_mysql_config"; then
36 with_mysql="no"
37 else
38 np_mysql_include="`$np_mysql_config --include`"
39 # Mysql 3 does not support --include. --cflags should be sufficient
40 if test $? -ne 0; then
41 np_mysql_include="-I$with_mysql/include" # Guessed location
42 fi
43 np_mysql_libs="`$np_mysql_config --libs`"
44 np_mysql_cflags="`$np_mysql_config --cflags`"
45
46 dnl Test a mysql_init. Some systems have mysql_config, but no headers
47 _savedcppflags="$CPPFLAGS"
48 CPPFLAGS="$CPPFLAGS $np_mysql_include"
49
50 dnl Putting $np_mysql_libs as other libraries ensures that all mysql dependencies are linked in
51 dnl Although -lmysqlclient is duplicated, it is not a problem
52 AC_CHECK_LIB([mysqlclient], [mysql_init], [
53 with_mysql=$np_mysql_config
54 AC_DEFINE(HAVE_MYSQLCLIENT, 1, [Defined if mysqlclient is found and can compile])
55 ], [with_mysql=no], [$np_mysql_libs])
56 CPPFLAGS=$_savedcppflags
57
58 fi
59 fi
60])
61
62dnl Will take $1, find last occurrance of -LDIR and add DIR to LD_RUN_PATH
63AC_DEFUN([np_add_to_runpath],
64[
65 dnl Need [[ ]] so autoconf gives us just one set
66 np_libdir=`echo "$1" | sed -e 's/.*-L\([[^ ]]*\) .*/\1/'`
67 if test "x$np_libdir" != x ; then
68 LD_RUN_PATH="${np_libdir}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
69 fi
70])
71