From bf059287f7eaf44e5342615dc6c4f7866e50b6c6 Mon Sep 17 00:00:00 2001
From: Subhendu Ghosh <sghosh@users.sourceforge.net>
Date: Wed, 4 Sep 2002 06:00:14 +0000
Subject: more Mysql patches

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

diff --git a/configure.in b/configure.in
index 7255204..a9ffeb1 100644
--- a/configure.in
+++ b/configure.in
@@ -155,13 +155,18 @@ else
 fi
 LIBS="$_SAVEDLIBS"
 
+
 dnl Check for mysql libraries
 _SAVEDLIBS="$LIBS"
 _SAVEDCPPFLAGS="$CPPFLAGS"
-CPPFLAGS="-I/usr/include"
-AC_ARG_WITH(mysqllibdir,--with-mysqllibdir=<dir> sets path to mysql libraries,[MYSQLLIBDIR=$withval])
-if test -n "$MYSQLLIBDIR"; then
-  AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR",,-L$MYSQLLIBDIR -lz)
+dnl CPPFLAGS="-I/usr/include"
+
+AC_ARG_WITH(mysql,--with-mysql=<dir> sets path to mysql installation (assumes lib/mysql and include subdirs),[MYSQL=$withval])
+if test -n "$MYSQL"; then
+  MYSQLLIBDIR=$MYSQL/lib/mysql
+  CPPFLAGS="-I$MYSQL/include"
+  AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz" check_mysql_LDFLAGS="-L$MYSQLLIBDIR ",,-L$MYSQLLIBDIR -lz)
+  AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
 elif test -f /usr/lib/libmysqlclient.so; then
   AC_CHECK_LIB(mysqlclient,mysql_init,MYSQLLIBS="-lmysqlclient -lz",,-lz)
   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient")
@@ -176,21 +181,23 @@ elif test -f /usr/lib/mysql/libmysqlclient.a; then
   AC_CHECK_LIB(mysqlclient,mysql_close,MYSQLLIBS="-lmysqlclient" check_mysql_LDFLAGS="-L/usr/lib/mysql",,-L/usr/lib/mysql)
 fi
 if test "$ac_cv_lib_mysqlclient_mysql_init" = "yes" -o "$ac_cv_lib_mysqlclient_mysql_close" = "yes"; then
-  AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h)
+  AC_CHECK_HEADERS(mysql/mysql.h mysql/errmsg.h, MYSQLINCLUDE="-I$MYSQL/include" )
   if test "$ac_cv_header_mysql_mysql_h" = "yes" -a "$ac_cv_header_mysql_errmsg_h" = "yes"; then
     EXTRAS="$EXTRAS check_mysql"
+	CPPFLAGS="$_SAVEDCPPFLAGS -I$MYSQL/include"
     AC_SUBST(MYSQLLIBS)
     AC_SUBST(check_mysql_LDFLAGS)
   else
     AC_MSG_WARN([Skipping mysql plugin])
     AC_MSG_WARN([install mysql client headers to compile this plugin (see Requirements).])
+    CPPFLAGS="$_SAVEDCPPFLAGS"
   fi
 else
   AC_MSG_WARN([Skipping mysql plugin])
   AC_MSG_WARN([install mysql client libs to compile this plugin (see Requirements).])
+  CPPFLAGS="$_SAVEDCPPFLAGS"
 fi
 LIBS="$_SAVEDLIBS"
-CPPFLAGS="$_SAVEDCPPFLAGS"
 
 dnl Check for OpenSSL location
 AC_PATH_PROG(OPENSSL,openssl)
-- 
cgit v0.10-9-g596f

