Branch: Tag:

2014-10-10

2014-10-10 13:08:12 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Mysql: Improved library detection.

MariaDB is often installed without the mariadb client library
(but with the mysql client library), so search for the mysql
client library if the mariadb client library can't be found.

Also adds searching for reentrant versions of the client libraries.

Fixes compilation issues on machines with MariaDB server but
not MariaDB client.

144:    -lmaria*)    # We handle the client library itself later.    ;; +  -lmysql*) +  # We handle the client library itself later. +  ;;    *)    # NB: We need to buffer libs to get them in the correct order.    echo "Adding $2 to LIBS."
359:   fi   ])    -  if test "x${MARIADB_CONFIG}" = "xno"; then -  # libmysql.lib is the name for the libmysql.dll wrapper in the -  # windows releases. There's also a mysqlclient.lib which contain the +  TRY_MYSQLCLIENT="yes" +  if test "x${MARIADB_CONFIG}" = "xno"; then :; else +  # Try the MariaDB client libraries. +  # NB: These are distributed separately from the MariaDB server. +  TRY_MYSQLCLIENT="no" +  AC_CHECK_SQLLIB(mariadbclient_r, [ +  LIBS="-lmariadbclient_r $LIBS" +  ], [ +  AC_CHECK_SQLLIB(mariadbclient, [ +  LIBS="-lmariadbclient $LIBS" +  ], [ +  AC_CHECK_SQLLIB(mariadb_r, [ +  LIBS="-lmariadb_r $LIBS" +  ], [ +  AC_CHECK_SQLLIB(mariadb, [ +  LIBS="-lmariadb $LIBS" +  ], [ +  # Fallback to using the MySQL client libraries. +  # NB: These are distributed together with the MariaDB server. +  TRY_MYSQLCLIENT="yes" +  ]) +  ]) +  ]) +  ]) +  fi +  +  if test "x${TRY_MYSQLCLIENT}" = "xyes"; then +  # libmysql.lib is the name of the libmysql.dll wrapper in the +  # windows releases. There's also a mysqlclient.lib which contains the    # static version. We prefer the dynamic one so check libmysql first.    AC_CHECK_SQLLIB(libmysql, [    LIBS="-llibmysql $LIBS"    ], [ -  +  AC_CHECK_SQLLIB(mysqlclient_r, [ +  LIBS="-lmysqlclient_r $LIBS" +  ], [    AC_CHECK_SQLLIB(mysqlclient, [    LIBS="-lmysqlclient $LIBS"    ], [
381:    ])    ])    ]) -  else -  AC_CHECK_SQLLIB(mariadbclient, [ -  LIBS="-lmariadbclient $LIBS" -  ], [ -  AC_CHECK_SQLLIB(mariadb, [ -  LIBS="-lmariadb $LIBS" -  ], [ -  PIKE_FEATURE_NODEP(Mysql) -  pike_cv_mysql="no" +     ]) -  ]) +     fi       if test x$pike_cv_mysql = xno; then :; else