From 5c5b6b9ff54914e7dd5959281adb7a1220d3cef0 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 14 Jun 2016 08:58:43 +0200 Subject: [PATCH] Tweak recompile configure.in --- bacula/configure | 239 +++++++++++++++++++++++++---------------------- 1 file changed, 129 insertions(+), 110 deletions(-) diff --git a/bacula/configure b/bacula/configure index dc167330f1..cfab19d997 100755 --- a/bacula/configure +++ b/bacula/configure @@ -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 -- 2.39.5