Branch: Tag:

2014-12-04

2014-12-04 19:23:45 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Mysql: Support the MariaDB client library.

The MariaDB client library is a forward port of the LGPL
mysql client library from MySQL 3.23 to support modern
MySQL and MariaDB.

13:   # libmysql.a libmysqllib.a   # libstrings.a libmystrings.a   # + # MariaDB-Client 1.0.0 + # ------------------------------------------------------------------- + # /usr/local/lib + # /usr/local/mariadbclient/include + # libmariadbclient.a + #         AC_INIT(mysql.c)
36:   else    PIKE_FEATURE_NODEP(Mysql)    +  AC_PATH_PROG(MARIADB_CONFIG,${ac_tool_prefix}mariadb_config,no) +  if test "x${MARIADB_CONFIG}" = "xno"; then +     AC_MSG_CHECKING(for Mysql directory prefix)    AC_CACHE_VAL(pike_cv_mysql_lib_dir_prefix, [    pike_cv_mysql_lib_dir_prefix=no
108:    CPPFLAGS="${CPPFLAGS} -I$pike_cv_mysql_include_dir"    fi    fi +  else +  echo "MariaDB found. Attempting to use." +  # MariaDB +  # NB: mariadb_config doens't distinguish between +  # LDFLAGS and LIBS +  MARIADB_LIBS="" +  set ignored `${MARIADB_CONFIG} --libs_r` +  while test "$#" -gt 1; do +  case "$2" in +  -L*) +  echo "Adding `echo $2 | sed -e 's/^-L//'` to the library search path." +  LDFLAGS="${LDFLAGS} $2 `echo $2 | sed -e 's/^-L/-R/'`" +  ;; +  -R*) +  echo "Adding `echo $2 | sed -e 's/^-R//'` to the library runtime search path." +  LDFLAGS="${LDFLAGS} $2" +  ;; +  -lmaria*) +  # 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." +  MARIADB_LIBS="${MARIADB_LIBS} $2" +  ;; +  esac +  shift +  done +  echo "Adding `${MARIADB_CONFIG} --include` to CPPFLAGS." +  CPPFLAGS="${CPPFLAGS} `${MARIADB_CONFIG} --include`" +  fi    -  +     # Header file       AC_CHECK_HEADERS(winsock2.h winsock.h mysql.h mysql/mysql.h errmsg.h mysql/errmsg.h,,,[
200:    ])    ])    +  # Needed for libmariadbclient.a 1.0.0. +  AC_SEARCH_LIBS(OPENSSL_config, crypto) +     AC_SEARCH_LIBS(_db_doprnt_, dbug)    AC_SEARCH_LIBS(my_init, mysys)       # mysql 3.23.x libmysqlclient requires zlib...    AC_SEARCH_LIBS(compress, z)    -  +  if test "x${MARIADB_CONFIG}" = "x"; then :; else +  LIBS="${MARIADB_LIBS} ${LIBS}" +  fi +     # Try a couple of mysqlclient libs    # in order of age, newest first.   
283:   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    # static version. We prefer the dynamic one so check libmysql first.
304:    ])    ])    ]) +  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    # Check version match