Code

Detect if check_mysql compile will work at ./configure time, due to some
authorTon Voon <tonvoon@users.sourceforge.net>
Tue, 6 Mar 2007 14:18:11 +0000 (14:18 +0000)
committerTon Voon <tonvoon@users.sourceforge.net>
Tue, 6 Mar 2007 14:18:11 +0000 (14:18 +0000)
Redhat systems distributing mysql_config, but not the include files

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1627 f882894a-f735-0410-b71e-b25c423dba1c

NEWS
configure.in

diff --git a/NEWS b/NEWS
index 67b6877ca09e444ccee75eee514c5a323705429b..310c08bcf9a9c60d5742f628945098d1cc67a3fc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ This file documents the major additions and syntax changes between releases.
 ??    ??
        Fixed MKINSTALLDIRS problem in po/
        Root plugins installed with world executable
+       ./configure now detects if possible to compile check_mysql
        check_sybase from contrib now maintained in NagiosExchange
 
 1.4.6 5th February 2007
index 5d1e75df29bb653597f064b3dac66ac836c28cb8..b0d1c97da8f2461ff0f67750d4cae522bd93a22c 100644 (file)
@@ -242,23 +242,31 @@ 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
-    with_mysql=$MYSQLCONFIG
-    EXTRAS="$EXTRAS check_mysql check_mysql_query"
     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
 fi
 
-AC_CHECK_HEADERS(unistd.h)
-
 dnl Check for AF_INET6 support - unistd.h required for Darwin
 AC_CACHE_CHECK([for IPv6 support], with_ipv6, [
        AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H