From b3b735446741fe89ee837d0522dd0d5b68167d92 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Tue, 21 Mar 2006 11:42:59 +0000 Subject: mysql discovery based on mysql_config (Johan Fischer - 1359414) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1333 f882894a-f735-0410-b71e-b25c423dba1c --- CHANGES | 2 ++ REQUIREMENTS | 1 + THANKS.in | 1 + configure.in | 71 ++++++----------------------------------------- plugins/Makefile.am | 2 ++ plugins/tests/Makefile.am | 2 +- 6 files changed, 16 insertions(+), 63 deletions(-) diff --git a/CHANGES b/CHANGES index 743fafeb..c334546e 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,8 @@ This file documents the major additions and syntax changes between releases. 1.4.3 Setuid plugins (check_dhcp, check_icmp) separated into plugins-root/. Run make install as root to install check_mysql_query added to run arbitrary SQL commands, with threshold checking + ./configure --with-mysql option deprecated. To get mysql compiling, must have mysql_config in PATH + libtool now required for development systems 1.4.2 Fix for Redhat ES4 for check_dns and check_dig diff --git a/REQUIREMENTS b/REQUIREMENTS index f16de936..fbd213b6 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS @@ -39,6 +39,7 @@ check_mysql, check_mysql_query: Lib: libmysql, libmysqlclient Redhat Powertools Source: mysql-3.20.32a-3.i386.rpm, mysql-devel-3.20.32a-3.i386.rpm (these seem to be broken, however) RPMS from www.mysql.org work better + Must have mysql_config in PATH check_pqsql: - Requires the PostgreSQL libraries available from diff --git a/THANKS.in b/THANKS.in index 1373142b..1fd52c90 100644 --- a/THANKS.in +++ b/THANKS.in @@ -176,3 +176,4 @@ Gerhard Lausser Jon Vandegrift Jason Crawford Steven Kreuzer +Johan Fischer diff --git a/configure.in b/configure.in index e02dc895..87b8e2cc 100644 --- a/configure.in +++ b/configure.in @@ -254,72 +254,19 @@ fi LIBS="$_SAVEDLIBS" dnl Check for mysql libraries -_SAVEDLIBS="$LIBS" -_SAVEDCPPFLAGS="$CPPFLAGS" -FOUNDMYSQL="no" -AC_ARG_WITH(mysql, - ACX_HELP_STRING([--with-mysql=DIR], - [sets path to mysql installation (assumes lib/lib64 and include subdirs)]), - MYSQL=$withval,) -# Find the mysql client libs -if test -n "$MYSQL"; then - MYSQLLIBDIR=$MYSQL/lib - MYSQLLIB64DIR=$MYSQL/lib64 -elif test -f /usr/lib/libmysqlclient.so -o -f /usr/lib/libmysqlclient.a ; then - MYSQL="/usr" - MYSQLLIBDIR=$MYSQL/lib - MYSQLLIB64DIR=$MYSQL/lib64 -elif test -f /usr/lib/mysql/libmysqlclient.so -o -f /usr/lib/mysql/libmysqlclient.a ; then - MYSQL="/usr" - MYSQLLIBDIR=$MYSQL/lib/mysql - MYSQLLIB64DIR=$MYSQL/lib64/mysql -elif test -f /usr/local/lib/libmysqlclient.so -o -f /usr/local/lib/libmysqlclient.a ; then - MYSQL="/usr/local" - MYSQLLIBDIR=$MYSQL/lib - MYSQLLIB64DIR=$MYSQL/lib64 -elif test -f /usr/local/lib/mysql/libmysqlclient.so -o -f /usr/local/lib/mysql/libmysqlclient.a ; then - MYSQL="/usr/local" - MYSQLLIBDIR=$MYSQL/lib/mysql - MYSQLLIB64DIR=$MYSQL/lib64/mysql -elif test -f /usr/local/mysql/lib/libmysqlclient.so -o -f /usr/local/mysql/lib/libmysqlclient.a ; then - MYSQL="/usr/local/mysql" - MYSQLLIBDIR=$MYSQL/lib - MYSQLLIB64DIR=$MYSQL/lib64 -fi - -# Check libs okay -if test -n "$MYSQL" ; then - CPPFLAGS="-L$MYSQLLIBDIR -L$MYSQLLIB64DIR" - AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz) - AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient") -fi - -# Check headers okay -if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then - CPPFLAGS="-I$MYSQL/include" - AC_CHECK_HEADERS(mysql.h errmsg.h, FOUNDMYSQL="yes" MYSQLINCLUDE="-I$MYSQL/include") - if test x"$FOUNDMYSQL" != x"yes" ; then - AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, FOUNDMYSQL="yes" MYSQLINCLUDE="-I$MYSQL/include/mysql") - fi -fi - -# Setup mysql plugins -if test $FOUNDMYSQL = "yes" ; then +AC_PATH_PROG(MYSQLCONFIG, mysql_config) +if test -z "$MYSQLCONFIG"; then + AC_MSG_WARN([Skipping mysql plugin]) + AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).]) +else EXTRAS="$EXTRAS check_mysql check_mysql_query" - if test -d $MYSQLLIB64DIR ; then - MYSQLLIBS="-L$MYSQLLIB64DIR -rpath $MYSQLLIB64DIR $MYSQLLIBS" - fi - if test -d $MYSQLLIBDIR ; then - MYSQLLIBS="-L$MYSQLLIBDIR -rpath $MYSQLLIBDIR $MYSQLLIBS" - fi + MYSQLINCLUDE=`$MYSQLCONFIG --include` + MYSQLLIBS=`$MYSQLCONFIG --libs` + MYSQLCFLAGS=`$MYSQLCONFIG --cflags` AC_SUBST(MYSQLINCLUDE) AC_SUBST(MYSQLLIBS) -else - AC_MSG_WARN([Skipping mysql plugin]) - AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).]) + AC_SUBST(MYSQLCFLAGS) fi -CPPFLAGS="$_SAVEDCPPFLAGS" -LIBS="$_SAVEDLIBS" AC_CHECK_HEADERS(unistd.h) diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 9a1f6d09..dc01ff2d 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -63,8 +63,10 @@ check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) check_load_LDADD = $(BASEOBJS) popen.o check_mrtg_LDADD = $(BASEOBJS) check_mrtgtraf_LDADD = $(BASEOBJS) +check_mysql_CFLAGS = $(MYSQLCFLAGS) check_mysql_CPPFLAGS = $(MYSQLINCLUDE) check_mysql_LDADD = $(NETLIBS) $(MYSQLLIBS) +check_mysql_query_CFLAGS = $(MYSQLCFLAGS) check_mysql_query_CPPFLAGS = $(MYSQLINCLUDE) check_mysql_query_LDADD = $(NETLIBS) $(MYSQLLIBS) check_nagios_LDADD = $(BASEOBJS) runcmd.o diff --git a/plugins/tests/Makefile.am b/plugins/tests/Makefile.am index d3e74945..8ed3fc1d 100644 --- a/plugins/tests/Makefile.am +++ b/plugins/tests/Makefile.am @@ -15,7 +15,7 @@ LIBS = @LIBINTL@ test_utils_SOURCES = test_utils.c test_utils_CFLAGS = -g -I.. -test_utils_LDFLAGS = -rpath /usr/local/lib -ltap +test_utils_LDFLAGS = -L/usr/local/lib -ltap test_utils_LDADD = ../utils.o test: ${noinst_PROGRAMS} -- cgit v1.2.3-74-g34f1