[Nagiosplug-devel] configure patch for older versions of MySQL

John T. Guthrie III guthrie at counterexample.org
Tue Oct 31 21:42:34 CET 2006


Hello all,

I recently tried compiling the nagios-plugins package on a Red Hat 9 box.
The version of MySQL on this machine was mysql-3.23.58-1.90.10.legacy.  It
turns out that the mysql_config program for this version of MySQL does not
have a --include flag.  I have verified this on a different machine
running 3.23.56 as well, so I am guessing that MySQL 3 and older lacked this
flag, but I can't prove that.  It turns out that this did not prevent
configure from completing its run.  Rather, some of the sed commands in the
configure file contained empty strings, so that the Makefile came out
garbled, causing all sorts of fun.  I am attaching a patch to the
configure.in file that will add in a new flag, --with-mysql-includedir=DIR,
to the generated configure script.  If mysql_config has a --include flag,
then the result of that gets used.  If not, then the script looks at
the --with-mysql-include flag.  If that is not present, or does not seem to
exist, then it makes a final desparation attempt using
$with_mysql/include/mysql.  If that doesn't work, then it gives up and exits.

Any comments?

John Guthrie
guthrie at counterexample.org
-------------- next part --------------
*** nagios-plugins-1.4.3/configure.in.orig	Thu Sep 21 21:51:49 2006
--- nagios-plugins-1.4.3/configure.in	Fri Sep 22 00:14:27 2006
***************
*** 274,280 ****
    else
      with_mysql=$MYSQLCONFIG
      EXTRAS="$EXTRAS check_mysql check_mysql_query"
!     MYSQLINCLUDE=`$MYSQLCONFIG --include`
      MYSQLLIBS=`$MYSQLCONFIG --libs`
      MYSQLCFLAGS=`$MYSQLCONFIG --cflags`
      AC_SUBST(MYSQLINCLUDE)
--- 274,318 ----
    else
      with_mysql=$MYSQLCONFIG
      EXTRAS="$EXTRAS check_mysql check_mysql_query"
! dnl Some ancient version of mysql_config don't have a --include option.
!     if $MYSQLCONFIG | grep \\--include 2>&1 >/dev/null ; then
!       MYSQLINCLUDE=`$MYSQLCONFIG --include`
!     else
!       AC_ARG_WITH(mysql-includedir,
! 	ACX_HELP_STRING([--with-mysql-includedir=DIR],
! 		[Include directory for mysql in case configure has problems locating it.  Expects DIR/mysql_version.h to exist.]),
! 	with_mysql_includedir=$withval,
! 	with_mysql_includedir=none)
!       echo "Apparently you have an old version of mysql_config...  It won't"
!       echo "tell me where it's include directory is.  Checking other locations..."
!       if test $with_mysql_includedir != "none" ; then
! 	echo "Trying $with_mysql_includedir..."
! 	if test -f $with_mysql_includedir/mysql_version.h ; then
! 	  echo "Found it!"
! 	  MYSQLINCLUDE="-I$with_mysql_includedir"
! 	else
! 	  echo "Trying $with_mysql/include/mysql as a last resort.."
! 	  if test -f $with_mysql/include/mysql/mysql_version.h ; then
! 	    echo "Found it!"
! 	    MYSQLINCLUDE="-I$with_mysql/include/mysql"
! 	  else
! 	    with_mysql_includedir=none
! 	  fi
! 	fi
!       fi
!       if test $with_mysql_includedir = "none" ; then
! 	echo "It appears that you have a version of MySQL whose mysql_config"
! 	echo "program won't reveal the location of the MySQL include"
! 	echo "directory.  In addition, the directory that you have specified"
! 	echo "using the --with-mysql-includedir option either does not exist,"
! 	echo "does not contain the file mysql_version.h, or has been"
! 	echo "specified incorrectly.  Given that I can not find a workable"
! 	echo "/usr/include/mysql directory either, I am going to quit at this"
! 	echo "point.  You may either try again with a different MySQL include"
! 	echo "directory or you may proceed without MySQL support."
! 	exit 1
!       fi
!     fi
      MYSQLLIBS=`$MYSQLCONFIG --libs`
      MYSQLCFLAGS=`$MYSQLCONFIG --cflags`
      AC_SUBST(MYSQLINCLUDE)


More information about the Devel mailing list