]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix mysql config for older versions of mysql+config.
authorMarco van Wieringen <mvw@planets.elm.net>
Sun, 22 Apr 2012 17:16:51 +0000 (19:16 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:50:37 +0000 (14:50 +0200)
On older versions of mysql_config the newly used
flags are not supported. So we test if the new flag
is supported and otherwise fallback to a kludge with
some sed strings to get the info we want from the
older mysql_config options.

This fixes problems on :

Centos 6
RHEL 6
SLES 11sp1
SLES 11sp2
OpenSuse 11.4

bacula/autoconf/bacula-macros/db.m4

index 76a474898967e504c98f8ed1d1df289b836b8567..7ef55517d615fa28923eab798de5e2b53d50c539 100644 (file)
@@ -326,10 +326,16 @@ AC_HELP_STRING([--with-mysql@<:@=DIR@:>@], [Include MySQL support. DIR is the My
   if test "$withval" != "no"; then
         if test "$withval" = "yes"; then
            MYSQL_CONFIG=`which mysql_config 2>/dev/null`
-           if test "x$MYSQL_CONFIG" != x; then
+           if test "x${MYSQL_CONFIG}" != x; then
               MYSQL_BINDIR="${MYSQL_CONFIG%/*}"
-              MYSQL_LIBDIR=`"$MYSQL_CONFIG" --variable=pkglibdir`
-              MYSQL_INCDIR=`"$MYSQL_CONFIG" --variable=pkgincludedir`
+              ${MYSQL_CONFIG} --variable=pkglibdir > /dev/null 2>&1
+              if test $? = 0 ; then
+                 MYSQL_LIBDIR=`${MYSQL_CONFIG} --variable=pkglibdir`
+                 MYSQL_INCDIR=`${MYSQL_CONFIG} --variable=pkgincludedir`
+              else
+                 MYSQL_LIBDIR=`${MYSQL_CONFIG} --libs | sed -e 's/.*-L//' -e 's/ .*//'`
+                 MYSQL_INCDIR=`${MYSQL_CONFIG} --include | sed -e 's/-I//'`
+              fi
            elif test -f /usr/local/mysql/include/mysql/mysql.h; then
               MYSQL_INCDIR=/usr/local/mysql/include/mysql
               if test -f /usr/local/mysql/lib64/mysql/libmysqlclient_r.a \