]> git.sur5r.net Git - bacula/bacula/commitdiff
Tweak recompile configure.in Branch-7.0
authorKern Sibbald <kern@sibbald.com>
Tue, 14 Jun 2016 06:58:43 +0000 (08:58 +0200)
committerKern Sibbald <kern@sibbald.com>
Tue, 14 Jun 2016 06:58:43 +0000 (08:58 +0200)
bacula/configure

index dc167330f11b8da229bfb4d361b457ae6a051d7d..cfab19d997400bd720d5adb9317f22289959cbf2 100755 (executable)
@@ -24058,24 +24058,27 @@ $as_echo_n "checking for MySQL support... " >&6; }
 # Check whether --with-mysql was given.
 if test "${with_mysql+set}" = set; then :
   withval=$with_mysql;
+  HAVE_LIBSR="no"
   if test "$withval" != "no"; then
-        if test "$withval" = "yes"; then
-#
-# This code is very broken on older systems
-#
-#           MYSQL_CONFIG=`which mysql_config 2>/dev/null`
-#           if test "x${MYSQL_CONFIG}" != x; then
-#              MYSQL_BINDIR="${MYSQL_CONFIG%/*}"
-#              ${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_r | sed -e 's/.*-L//' -e 's/ .*//'`
-#                 MYSQL_INCDIR=`${MYSQL_CONFIG} --include | sed -e 's/-I//'`
-#              fi
-#           fi
-#           if [ "x${MYSQL_LIB}" = x -o "x${MYSQL_INCDIR}" = x ]; then
+     if test "$withval" = "yes"; then
+        MYSQL_CONFIG=`which mysql_config 2>/dev/null`
+        if test "x${MYSQL_CONFIG}" != x; then
+           MYSQL_BINDIR="${MYSQL_CONFIG%/*}"
+           ${MYSQL_CONFIG} --libs_r >/dev/null 2>&1
+           if test $? = 0; then
+              MYSQL_LIBDIR=`${MYSQL_CONFIG} --libs_r`
+              MYSQL_INCDIR=`${MYSQL_CONFIG} --include`
+              HAVE_LIBSR="yes"
+           else
+              ${MYSQL_CONFIG} --variable=pkglibdir > /dev/null 2>&1
+              if test $? = 0 ; then
+                 MYSQL_LIBDIR=`${MYSQL_CONFIG} --variable=pkglibdir`
+                 MYSQL_INCDIR=`${MYSQL_CONFIG} --variable=pkgincludedir`
+              fi
+           fi
+        fi
+        # if something wrong fall back to old method
+        if test "x${MYSQL_LIBDIR}" = x -o "x${MYSQL_INCDIR}" = x ; then
            if 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 \
@@ -24135,106 +24138,120 @@ if test "${with_mysql+set}" = set; then :
 $as_echo "no" >&6; }
               as_fn_error $? "Unable to find mysql.h in standard locations" "$LINENO" 5
            fi
-        else
-           if test -f $withval/include/mysql/mysql.h; then
-              MYSQL_INCDIR=$withval/include/mysql
-              if test -f $withval/lib64/mysql/libmysqlclient_r.a \
-                   -o -f $withval/lib64/mysql/libmysqlclient_r.so; then
-                 MYSQL_LIBDIR=$withval/lib64/mysql
-              elif test -f $withval/lib64/libmysqlclient_r.a \
-                   -o -f $withval/lib64/libmysqlclient_r.so; then
-                 MYSQL_LIBDIR=$withval/lib64
-              elif test -f $withval/lib/libmysqlclient_r.a \
-                   -o -f $withval/lib/libmysqlclient_r.so; then
-                 MYSQL_LIBDIR=$withval/lib
-              else
-                 MYSQL_LIBDIR=$withval/lib/mysql
-              fi
-              MYSQL_BINDIR=$withval/bin
-           elif test -f $withval/include/mysql.h; then
-              MYSQL_INCDIR=$withval/include
-              if test -f $withval/lib64/libmysqlclient_r.a \
-                   -o -f $withval/lib64/libmysqlclient_r.so; then
-                 MYSQL_LIBDIR=$withval/lib64
-              else
-                 MYSQL_LIBDIR=$withval/lib
-              fi
-              MYSQL_BINDIR=$withval/bin
-           elif test -f $withval/mysql.h; then
-                            MYSQL_INCDIR=$withval
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Got with-mysql variable $MYSQL_INCDIR checking MySQL version" >&5
+        fi
+     else
+        if test -f $withval/include/mysql/mysql.h; then
+           MYSQL_INCDIR=$withval/include/mysql
+           if test -f $withval/lib64/mysql/libmysqlclient_r.a \
+                -o -f $withval/lib64/mysql/libmysqlclient_r.so; then
+              MYSQL_LIBDIR=$withval/lib64/mysql
+           elif test -f $withval/lib64/libmysqlclient_r.a \
+                -o -f $withval/lib64/libmysqlclient_r.so; then
+              MYSQL_LIBDIR=$withval/lib64
+           elif test -f $withval/lib/libmysqlclient_r.a \
+                -o -f $withval/lib/libmysqlclient_r.so; then
+              MYSQL_LIBDIR=$withval/lib
+           else
+              MYSQL_LIBDIR=$withval/lib/mysql
+           fi
+           MYSQL_BINDIR=$withval/bin
+        elif test -f $withval/include/mysql.h; then
+           MYSQL_INCDIR=$withval/include
+           if test -f $withval/lib64/libmysqlclient_r.a \
+                -o -f $withval/lib64/libmysqlclient_r.so; then
+              MYSQL_LIBDIR=$withval/lib64
+           else
+              MYSQL_LIBDIR=$withval/lib
+           fi
+           MYSQL_BINDIR=$withval/bin
+        elif test -f $withval/mysql.h; then
+                      MYSQL_INCDIR=$withval
+           { $as_echo "$as_me:${as_lineno-$LINENO}: Got with-mysql variable $MYSQL_INCDIR checking MySQL version" >&5
 $as_echo "$as_me: Got with-mysql variable $MYSQL_INCDIR checking MySQL version" >&6;}
-              case $MYSQL_INCDIR in
-                 *mysql55*)
-                     { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming MacPorts MySQL 5.5 variant installed" >&5
+           case $MYSQL_INCDIR in
+              *mysql55*)
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming MacPorts MySQL 5.5 variant installed" >&5
 $as_echo "$as_me: Assuming MacPorts MySQL 5.5 variant installed" >&6;}
-                                          if test -f $prefix/lib/mysql55/mysql/libmysqlclient_r.a \
-                          -o -f $prefix/lib/mysql55/mysql/libmysqlclient_r.so; then
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: Found MySQL 5.5 library in $prefix/lib/mysql55/mysql" >&5
+                                    if test -f $prefix/lib/mysql55/mysql/libmysqlclient_r.a \
+                       -o -f $prefix/lib/mysql55/mysql/libmysqlclient_r.so; then
+                     { $as_echo "$as_me:${as_lineno-$LINENO}: Found MySQL 5.5 library in $prefix/lib/mysql55/mysql" >&5
 $as_echo "$as_me: Found MySQL 5.5 library in $prefix/lib/mysql55/mysql" >&6;}
-                        MYSQL_LIBDIR=$prefix/lib/mysql55/mysql
-                     fi
-                     MYSQL_BINDIR=$prefix/lib/mysql55/bin
-                 ;;
-                 *mysql51*)
-                     { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming MacPorts MySQL 5.1 variant installed" >&5
+                     MYSQL_LIBDIR=$prefix/lib/mysql55/mysql
+                  fi
+                  MYSQL_BINDIR=$prefix/lib/mysql55/bin
+              ;;
+              *mysql51*)
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: Assuming MacPorts MySQL 5.1 variant installed" >&5
 $as_echo "$as_me: Assuming MacPorts MySQL 5.1 variant installed" >&6;}
-                                          if test -f $prefix/lib/mysql51/mysql/libmysqlclient_r.a \
-                          -o -f $prefix/lib/mysql51/mysql/libmysqlclient_r.so; then
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: Found MySQL 5.1 library in $prefix/lib/mysql55/mysql" >&5
+                                    if test -f $prefix/lib/mysql51/mysql/libmysqlclient_r.a \
+                       -o -f $prefix/lib/mysql51/mysql/libmysqlclient_r.so; then
+                     { $as_echo "$as_me:${as_lineno-$LINENO}: Found MySQL 5.1 library in $prefix/lib/mysql55/mysql" >&5
 $as_echo "$as_me: Found MySQL 5.1 library in $prefix/lib/mysql55/mysql" >&6;}
-                        MYSQL_LIBDIR=$prefix/lib/mysql51/mysql
-                     fi
-                     MYSQL_BINDIR=$prefix/lib/mysql51/bin
-                 ;;
-              esac
-              if test -z "${MYSQL_LIBDIR}" ; then
-                 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-                 as_fn_error $? "MySQL $withval - unable to find MySQL libraries" "$LINENO" 5
-              fi
-           else
+                     MYSQL_LIBDIR=$prefix/lib/mysql51/mysql
+                  fi
+                  MYSQL_BINDIR=$prefix/lib/mysql51/bin
+              ;;
+           esac
+           if test -z "${MYSQL_LIBDIR}" ; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-              as_fn_error $? "Invalid MySQL directory $withval - unable to find mysql.h under $withval" "$LINENO" 5
+              as_fn_error $? "MySQL $withval - unable to find MySQL libraries" "$LINENO" 5
            fi
-        fi
-     MYSQL_INCLUDE=-I$MYSQL_INCDIR
-     if test -f $MYSQL_LIBDIR/libmysqlclient_r.a \
-          -o -f $MYSQL_LIBDIR/libmysqlclient_r.so; then
-        if test x$use_libtool != xno; then
-           MYSQL_LIBS="-R $MYSQL_LIBDIR -L$MYSQL_LIBDIR -lmysqlclient_r -lz"
         else
-           MYSQL_LIBS="-L$MYSQL_LIBDIR -lmysqlclient_r -lz"
+           { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+           as_fn_error $? "Invalid MySQL directory $withval - unable to find mysql.h under $withval" "$LINENO" 5
         fi
-        DB_LIBS="${DB_LIBS} ${MYSQL_LIBS}"
      fi
-     MYSQL_LIB=$MYSQL_LIBDIR/libmysqlclient_r.a
+     if test "x${MYSQL_LIBDIR}" != x; then
+        MYSQL_INCLUDE=-I$MYSQL_INCDIR
+        if test "x$HAVE_LIBSR" = "xyes"; then
+           DB_LIBS="${DB_LIBS} ${MYSQL_LIBS}"
+           MYSQL_LIBS="$MYSQL_LIBDIR"
+           MYSQL_INCLUDE="$MYSQL_INCDIR"
+           if test -z "${batch_insert_db_backends}"; then
+              batch_insert_db_backends="MySQL"
+           else
+              batch_insert_db_backends="${batch_insert_db_backends} MySQL"
+           fi
+        elif test -f $MYSQL_LIBDIR/libmysqlclient_r.a \
+               -o -f $MYSQL_LIBDIR/libmysqlclient_r.so; then
+           if test x$use_libtool != xno; then
+              MYSQL_LIBS="-R $MYSQL_LIBDIR -L$MYSQL_LIBDIR -lmysqlclient_r -lz"
+           else
+              MYSQL_LIBS="-L$MYSQL_LIBDIR -lmysqlclient_r -lz"
+           fi
+           DB_LIBS="${DB_LIBS} ${MYSQL_LIBS}"
+        fi
+        if test "x${MYSQL_LIBS}" = x; then
+           MYSQL_LIBS=$MYSQL_LIBDIR/libmysqlclient_r.a
+        fi
 
 
 $as_echo "#define HAVE_MYSQL 1" >>confdefs.h
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
-     if test -z "${db_backends}" ; then
-         db_backends="MySQL"
-     else
-         db_backends="${db_backends} MySQL"
-     fi
-     if test -z "${DB_BACKENDS}" ; then
-         DB_BACKENDS="mysql"
-     else
-         DB_BACKENDS="${DB_BACKENDS} mysql"
-     fi
+        if test -z "${db_backends}" ; then
+            db_backends="MySQL"
+        else
+            db_backends="${db_backends} MySQL"
+        fi
+        if test -z "${DB_BACKENDS}" ; then
+            DB_BACKENDS="mysql"
+        else
+            DB_BACKENDS="${DB_BACKENDS} mysql"
+        fi
 
-                    if test "x$support_batch_insert" = "xyes"; then
-                  saved_LDFLAGS="${LDFLAGS}"
-         LDFLAGS="${saved_LDFLAGS} -L$MYSQL_LIBDIR"
-         saved_LIBS="${LIBS}"
-         LIBS="${saved_LIBS} -lz"
+                                if test "x$HAVE_LIBSR" = "xno"; then
+          if test "x$support_batch_insert" = "xyes"; then
+                        saved_LDFLAGS="${LDFLAGS}"
+            LDFLAGS="${saved_LDFLAGS} -L$MYSQL_LIBDIR"
+            saved_LIBS="${LIBS}"
+            LIBS="${saved_LIBS} -lz"
 
-         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql_thread_safe in -lmysqlclient_r" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mysql_thread_safe in -lmysqlclient_r" >&5
 $as_echo_n "checking for mysql_thread_safe in -lmysqlclient_r... " >&6; }
 if ${ac_cv_lib_mysqlclient_r_mysql_thread_safe+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -24276,20 +24293,22 @@ $as_echo "#define HAVE_MYSQL_THREAD_SAFE 1" >>confdefs.h
 
 fi
 
-         if test "x$ac_cv_lib_mysqlclient_r_mysql_thread_safe" = "xyes"; then
-             if test -z "${batch_insert_db_backends}"; then
-                 batch_insert_db_backends="MySQL"
-             else
-                 batch_insert_db_backends="${batch_insert_db_backends} MySQL"
-             fi
-         fi
+            if test "x$ac_cv_lib_mysqlclient_r_mysql_thread_safe" = "xyes"; then
+                if test -z "${batch_insert_db_backends}"; then
+                    batch_insert_db_backends="MySQL"
+                else
+                    batch_insert_db_backends="${batch_insert_db_backends} MySQL"
+                fi
+            fi
 
-                  LDFLAGS="${saved_LDFLAGS}"
-         LIBS="${saved_LIBS}"
-     fi
-  else
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+                        LDFLAGS="${saved_LDFLAGS}"
+            LIBS="${saved_LIBS}"
+          fi
+        fi
+     else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
+     fi
   fi
 
 else