switched ax_lib_mysql.m4 to ax_lib_mariadb.m4 and made it mariadb specific

This commit is contained in:
hyung-hwan 2020-11-04 07:46:07 +00:00
parent debe2f8939
commit 088ea05e7b
11 changed files with 301 additions and 330 deletions

View File

@ -90,11 +90,11 @@ host_triplet = @host@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/m4/ax_lib_mariadb.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
@ -164,8 +164,8 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/ar-lib \
$(top_srcdir)/ac/compile $(top_srcdir)/ac/config.guess \
$(top_srcdir)/ac/config.sub $(top_srcdir)/ac/install-sh \
$(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing ac/ar-lib \
ac/compile ac/config.guess ac/config.sub ac/install-sh \
ac/ltmain.sh ac/missing
ac/compile ac/config.guess ac/config.sub ac/depcomp \
ac/install-sh ac/ltmain.sh ac/missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -253,14 +253,14 @@ LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MARIADB_CFLAGS = @MARIADB_CFLAGS@
MARIADB_CONFIG = @MARIADB_CONFIG@
MARIADB_LDFLAGS = @MARIADB_LDFLAGS@
MARIADB_LIBS = @MARIADB_LIBS@
MARIADB_VERSION = @MARIADB_VERSION@
MIO_PROJECT_AUTHOR = @MIO_PROJECT_AUTHOR@
MIO_PROJECT_URL = @MIO_PROJECT_URL@
MKDIR_P = @MKDIR_P@
MYSQL_CFLAGS = @MYSQL_CFLAGS@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
MYSQL_LIBS = @MYSQL_LIBS@
MYSQL_VERSION = @MYSQL_VERSION@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@

2
mio/aclocal.m4 vendored
View File

@ -1194,7 +1194,7 @@ AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/ax_check_sign.m4])
m4_include([m4/ax_lib_mysql.m4])
m4_include([m4/ax_lib_mariadb.m4])
m4_include([m4/ax_numval.m4])
m4_include([m4/ax_pthread.m4])
m4_include([m4/libtool.m4])

View File

@ -94,11 +94,11 @@ bin_PROGRAMS = mio-execd$(EXEEXT) mio-t01$(EXEEXT) mio-t02$(EXEEXT) \
subdir = bin
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/m4/ax_lib_mariadb.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
@ -278,14 +278,14 @@ LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MARIADB_CFLAGS = @MARIADB_CFLAGS@
MARIADB_CONFIG = @MARIADB_CONFIG@
MARIADB_LDFLAGS = @MARIADB_LDFLAGS@
MARIADB_LIBS = @MARIADB_LIBS@
MARIADB_VERSION = @MARIADB_VERSION@
MIO_PROJECT_AUTHOR = @MIO_PROJECT_AUTHOR@
MIO_PROJECT_URL = @MIO_PROJECT_URL@
MKDIR_P = @MKDIR_P@
MYSQL_CFLAGS = @MYSQL_CFLAGS@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
MYSQL_LIBS = @MYSQL_LIBS@
MYSQL_VERSION = @MYSQL_VERSION@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@

View File

@ -8,6 +8,7 @@
#include <signal.h>
#include <errno.h>
#include <assert.h>
#include <stdlib.h>
#define MAX_NUM_THRS 256
static int g_reuse_port = 0;

152
mio/configure vendored
View File

@ -644,11 +644,11 @@ PACKAGE_VERSION_PATCH
PACKAGE_VERSION_MINOR
PACKAGE_VERSION_MAJOR
QUADMATH_LIBS
MYSQL_LIBS
MYSQL_LDFLAGS
MYSQL_CFLAGS
MYSQL_VERSION
MYSQL_CONFIG
MARIADB_LIBS
MARIADB_LDFLAGS
MARIADB_CFLAGS
MARIADB_VERSION
MARIADB_CONFIG
UNWIND_LIBS
ENABLE_MARIADB_FALSE
ENABLE_MARIADB_TRUE
@ -797,7 +797,7 @@ enable_libtool_lock
enable_largefile
enable_ssl
enable_mariadb
with_mysql
with_mariadb
enable_debug
enable_wide_char
enable_libunwind
@ -1463,8 +1463,8 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot[=DIR] Search for dependent libraries within DIR (or the
compiler's sysroot if not specified).
--with-mysql[=ARG] use MySQL client library [default=no], optionally
specify path to mysql_config
--with-mariadb-config[=PATH]
specify path to the mariadb_config utility
Some influential environment variables:
CC C compiler command
@ -15741,47 +15741,36 @@ fi
fi
MYSQL_CONFIG="no"
MARIADB_CONFIG=""
# Check whether --with-mysql was given.
if test "${with_mysql+set}" = set; then :
withval=$with_mysql;
if test "$withval" = "no"; then
want_mysql="no"
elif test "$withval" = "yes"; then
want_mysql="yes"
# Check whether --with-mariadb was given.
if test "${with_mariadb+set}" = set; then :
withval=$with_mariadb; MARIADB_CONFIG="$withval"
else
want_mysql="yes"
MYSQL_CONFIG="$withval"
fi
else
want_mysql="no"
MARIADB_CONFIG=""
fi
MYSQL_CFLAGS=""
MYSQL_LDFLAGS=""
MYSQL_LIBS=""
MYSQL_VERSION=""
MARIADB_CFLAGS=""
MARIADB_LDFLAGS=""
MARIADB_LIBS=""
MARIADB_VERSION=""
if test "$want_mysql" = "yes"; then
for ac_prog in mysql_config mariadb_config
for ac_prog in mariadb_config
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MYSQL_CONFIG+:} false; then :
if ${ac_cv_path_MARIADB_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $MYSQL_CONFIG in
case $MARIADB_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_MYSQL_CONFIG="$MYSQL_CONFIG" # Let the user override the test with a path.
ac_cv_path_MARIADB_CONFIG="$MARIADB_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@ -15791,7 +15780,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MYSQL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
ac_cv_path_MARIADB_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@ -15802,32 +15791,32 @@ IFS=$as_save_IFS
;;
esac
fi
MYSQL_CONFIG=$ac_cv_path_MYSQL_CONFIG
if test -n "$MYSQL_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MYSQL_CONFIG" >&5
$as_echo "$MYSQL_CONFIG" >&6; }
MARIADB_CONFIG=$ac_cv_path_MARIADB_CONFIG
if test -n "$MARIADB_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MARIADB_CONFIG" >&5
$as_echo "$MARIADB_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$MYSQL_CONFIG" && break
test -n "$MARIADB_CONFIG" && break
done
if test -x "$MYSQL_CONFIG"; then
MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`"
_full_libmysql_libs="`$MYSQL_CONFIG --libs`"
if test -x "$MARIADB_CONFIG"; then
MARIADB_CFLAGS="`$MARIADB_CONFIG --cflags`"
_full_libmariadb_libs="`$MARIADB_CONFIG --libs`"
_save_mysql_ldflags="${LDFLAGS}"
_save_mysql_cflags="${CFLAGS}"
LDFLAGS="${LDFLAGS} ${_full_libmysql_libs}"
CFLAGS="${CFLAGS} ${MYSQL_CFLAGS}"
_save_mariadb_ldflags="${LDFLAGS}"
_save_mariadb_cflags="${CFLAGS}"
LDFLAGS="${LDFLAGS} ${_full_libmariadb_libs}"
CFLAGS="${CFLAGS} ${MARIADB_CFLAGS}"
for i in $_full_libmysql_libs; do
for i in $_full_libmariadb_libs; do
case $i in
-lmysqlclient|-lperconaserverclient|-lmariadbclient|-lmariadb)
-lmariadb|-lperconaserverclient)
_lib_name="`echo "$i" | cut -b3-`"
as_ac_Lib=`$as_echo "ac_cv_lib_$_lib_name''_main" | $as_tr_sh`
@ -15864,7 +15853,7 @@ eval ac_res=\$$as_ac_Lib
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
MYSQL_LIBS="-l${_lib_name} ${MYSQL_LIBS}"
MARIADB_LIBS="-l${_lib_name} ${MARIADB_LIBS}"
else
@ -15875,11 +15864,11 @@ fi
;;
-L*)
MYSQL_LDFLAGS="${MYSQL_LDFLAGS} $i"
MARIADB_LDFLAGS="${MARIADB_LDFLAGS} $i"
;;
-R*)
MYSQL_LDFLAGS="${MYSQL_LDFLAGS} -Wl,$i"
MARIADB_LDFLAGS="${MARIADB_LDFLAGS} -Wl,$i"
;;
-l*)
@ -15918,7 +15907,7 @@ eval ac_res=\$$as_ac_Lib
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
MYSQL_LIBS="${MYSQL_LIBS} ${i}"
MARIADB_LIBS="${MARIADB_LIBS} ${i}"
else
@ -15930,55 +15919,54 @@ fi
esac
done
LDFLAGS="${_save_mysql_ldflags}"
CFLAGS="${_save_mysql_cflags}"
unset _save_mysql_ldflags
unset _save_mysql_cflags
LDFLAGS="${_save_mariadb_ldflags}"
CFLAGS="${_save_mariadb_cflags}"
unset _save_mariadb_ldflags
unset _save_mariadb_cflags
MYSQL_VERSION=`$MYSQL_CONFIG --version`
MARIADB_VERSION=`$MARIADB_CONFIG --version`
$as_echo "#define HAVE_MYSQL 1" >>confdefs.h
$as_echo "#define HAVE_MARIADB 1" >>confdefs.h
found_mysql="yes"
found_mariadb="yes"
else
found_mysql="no"
fi
found_mariadb="no"
fi
mysql_version_req=
mariadb_version_req=
if test "$found_mysql" = "yes" -a -n "$mysql_version_req"; then
if test "$found_mariadb" = "yes" -a -n "$mariadb_version_req"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if MySQL version is >= $mysql_version_req" >&5
$as_echo_n "checking if MySQL version is >= $mysql_version_req... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if MariaDB version is >= $mariadb_version_req" >&5
$as_echo_n "checking if MariaDB version is >= $mariadb_version_req... " >&6; }
mysql_version_req_major=`expr $mysql_version_req : '\([0-9]*\)'`
mysql_version_req_minor=`expr $mysql_version_req : '[0-9]*\.\([0-9]*\)'`
mysql_version_req_micro=`expr $mysql_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
if test "x$mysql_version_req_micro" = "x"; then
mysql_version_req_micro="0"
mariadb_version_req_major=`expr $mariadb_version_req : '\([0-9]*\)'`
mariadb_version_req_minor=`expr $mariadb_version_req : '[0-9]*\.\([0-9]*\)'`
mariadb_version_req_micro=`expr $mariadb_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
if test "x$mariadb_version_req_micro" = "x"; then
mariadb_version_req_micro="0"
fi
mysql_version_req_number=`expr $mysql_version_req_major \* 1000000 \
\+ $mysql_version_req_minor \* 1000 \
\+ $mysql_version_req_micro`
mariadb_version_req_number=`expr $mariadb_version_req_major \* 1000000 \
\+ $mariadb_version_req_minor \* 1000 \
\+ $mariadb_version_req_micro`
mysql_version_major=`expr $MYSQL_VERSION : '\([0-9]*\)'`
mysql_version_minor=`expr $MYSQL_VERSION : '[0-9]*\.\([0-9]*\)'`
mysql_version_micro=`expr $MYSQL_VERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
if test "x$mysql_version_micro" = "x"; then
mysql_version_micro="0"
mariadb_version_major=`expr $MARIADB_VERSION : '\([0-9]*\)'`
mariadb_version_minor=`expr $MARIADB_VERSION : '[0-9]*\.\([0-9]*\)'`
mariadb_version_micro=`expr $MARIADB_VERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
if test "x$mariadb_version_micro" = "x"; then
mariadb_version_micro="0"
fi
mysql_version_number=`expr $mysql_version_major \* 1000000 \
\+ $mysql_version_minor \* 1000 \
\+ $mysql_version_micro`
mariadb_version_number=`expr $mariadb_version_major \* 1000000 \
\+ $mariadb_version_minor \* 1000 \
\+ $mariadb_version_micro`
mysql_version_check=`expr $mysql_version_number \>\= $mysql_version_req_number`
if test "$mysql_version_check" = "1"; then
mariadb_version_check=`expr $mariadb_version_number \>\= $mariadb_version_req_number`
if test "$mariadb_version_check" = "1"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else

View File

@ -324,8 +324,8 @@ then
AC_SUBST(UNWIND_LIBS)
fi
dnl libmysqlclient
AX_LIB_MYSQL
dnl libmariadb
AX_LIB_MARIADB
AC_STRUCT_DIRENT_D_TYPE
AC_CHECK_MEMBERS([DIR.d_fd, DIR.dd_fd],,,[[#include <dirent.h>]])

View File

@ -95,9 +95,9 @@ libmio_la_LIBADD = $(LIBADD_LIB_COMMON) $(SSL_LIBS) $(SOCKET_LIBS) $(SENDFILE_LI
if ENABLE_MARIADB
include_HEADERS += mio-mar.h
libmio_la_SOURCES += mar.c mar-cli.c
libmio_la_CFLAGS += $(MYSQL_CFLAGS)
libmio_la_LDFLAGS += $(MYSQL_LDFLAGS)
libmio_la_LIBADD += $(MYSQL_LIBS)
libmio_la_CFLAGS += $(MARIADB_CFLAGS)
libmio_la_LDFLAGS += $(MARIADB_LDFLAGS)
libmio_la_LIBADD += $(MARIADB_LIBS)
endif
if ENABLE_SSL

View File

@ -91,18 +91,18 @@ build_triplet = @build@
host_triplet = @host@
@ENABLE_MARIADB_TRUE@am__append_1 = mio-mar.h
@ENABLE_MARIADB_TRUE@am__append_2 = mar.c mar-cli.c
@ENABLE_MARIADB_TRUE@am__append_3 = $(MYSQL_CFLAGS)
@ENABLE_MARIADB_TRUE@am__append_4 = $(MYSQL_LDFLAGS)
@ENABLE_MARIADB_TRUE@am__append_5 = $(MYSQL_LIBS)
@ENABLE_MARIADB_TRUE@am__append_3 = $(MARIADB_CFLAGS)
@ENABLE_MARIADB_TRUE@am__append_4 = $(MARIADB_LDFLAGS)
@ENABLE_MARIADB_TRUE@am__append_5 = $(MARIADB_LIBS)
@ENABLE_SSL_TRUE@am__append_6 = $(SSL_LIBS)
subdir = lib
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
$(top_srcdir)/m4/ax_lib_mariadb.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__include_HEADERS_DIST) \
@ -318,14 +318,14 @@ LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MARIADB_CFLAGS = @MARIADB_CFLAGS@
MARIADB_CONFIG = @MARIADB_CONFIG@
MARIADB_LDFLAGS = @MARIADB_LDFLAGS@
MARIADB_LIBS = @MARIADB_LIBS@
MARIADB_VERSION = @MARIADB_VERSION@
MIO_PROJECT_AUTHOR = @MIO_PROJECT_AUTHOR@
MIO_PROJECT_URL = @MIO_PROJECT_URL@
MKDIR_P = @MKDIR_P@
MYSQL_CFLAGS = @MYSQL_CFLAGS@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
MYSQL_LIBS = @MYSQL_LIBS@
MYSQL_VERSION = @MYSQL_VERSION@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@

View File

@ -322,6 +322,9 @@
/* Define to 1 if you have the `makecontext' function. */
#undef HAVE_MAKECONTEXT
/* Define to 1 if MariaDB libraries are available */
#undef HAVE_MARIADB
/* Define to 1 if you have the `mbrlen' function. */
#undef HAVE_MBRLEN
@ -343,9 +346,6 @@
/* Define to 1 if you have the `munmap' function. */
#undef HAVE_MUNMAP
/* Define to 1 if MySQL libraries are available */
#undef HAVE_MYSQL
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP

169
mio/m4/ax_lib_mariadb.m4 generated Normal file
View File

@ -0,0 +1,169 @@
##### BASED ON http://autoconf-archive.cryp.to/ax_lib_mariadb.html
#
# SYNOPSIS
#
# AX_LIB_MARIADB([MINIMUM-VERSION])
#
# DESCRIPTION
#
# This macro provides tests of availability of MariaDB client library
# of particular version or newer.
#
# AX_LIB_MARIADB macro takes only one argument which is optional. If
# there is no required version passed, then macro does not run
# version test.
#
# The --with-mariadb-config option takes one of three possible values:
#
# path - complete path to mariadb_config utility, use this option if
# mariadb_config can't be found in the PATH
#
# This macro calls:
#
# AC_SUBST(MARIADB_CFLAGS)
# AC_SUBST(MARIADB_LDFLAGS)
# AC_SUBST(MARIADB_LIBS)
# AC_SUBST(MARIADB_VERSION)
#
# And sets:
#
# HAVE_MARIADB
#
# LAST MODIFICATION
#
# 2020-11-04 Chung, Hyung-Hwan
# 2006-07-16 Mateusz Loskot
#
# COPYLEFT
#
# Copyright (c) 2006 Mateusz Loskot <mateusz@loskot.net>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved.
AC_DEFUN([AX_LIB_MARIADB],
[
MARIADB_CONFIG=""
AC_ARG_WITH([mariadb],
AC_HELP_STRING([--with-mariadb-config@<:@=PATH@:>@], [specify path to the mariadb_config utility]),
[ MARIADB_CONFIG="$withval" ],
[MARIADB_CONFIG=""]
)
MARIADB_CFLAGS=""
MARIADB_LDFLAGS=""
MARIADB_LIBS=""
MARIADB_VERSION=""
dnl
dnl Check MariaDB libraries
dnl
AC_PATH_PROGS(MARIADB_CONFIG, mariadb_config)
if test -x "$MARIADB_CONFIG"; then
MARIADB_CFLAGS="`$MARIADB_CONFIG --cflags`"
_full_libmariadb_libs="`$MARIADB_CONFIG --libs`"
_save_mariadb_ldflags="${LDFLAGS}"
_save_mariadb_cflags="${CFLAGS}"
LDFLAGS="${LDFLAGS} ${_full_libmariadb_libs}"
CFLAGS="${CFLAGS} ${MARIADB_CFLAGS}"
for i in $_full_libmariadb_libs; do
case $i in
-lmariadb|-lperconaserverclient)
_lib_name="`echo "$i" | cut -b3-`"
AC_CHECK_LIB($_lib_name, main, [
MARIADB_LIBS="-l${_lib_name} ${MARIADB_LIBS}"
],[
AC_MSG_ERROR([Not found $_lib_name library])
])
;;
-L*)
MARIADB_LDFLAGS="${MARIADB_LDFLAGS} $i"
;;
-R*)
MARIADB_LDFLAGS="${MARIADB_LDFLAGS} -Wl,$i"
;;
-l*)
_lib_name="`echo "$i" | cut -b3-`"
AC_CHECK_LIB($_lib_name, main, [
MARIADB_LIBS="${MARIADB_LIBS} ${i}"
],[
AC_MSG_ERROR([Not found $i library])
])
;;
esac
done
LDFLAGS="${_save_mariadb_ldflags}"
CFLAGS="${_save_mariadb_cflags}"
unset _save_mariadb_ldflags
unset _save_mariadb_cflags
MARIADB_VERSION=`$MARIADB_CONFIG --version`
AC_DEFINE([HAVE_MARIADB], [1],
[Define to 1 if MariaDB libraries are available])
found_mariadb="yes"
else
found_mariadb="no"
fi
dnl
dnl Check if required version of MariaDB is available
dnl
mariadb_version_req=ifelse([$1], [], [], [$1])
if test "$found_mariadb" = "yes" -a -n "$mariadb_version_req"; then
AC_MSG_CHECKING([if MariaDB version is >= $mariadb_version_req])
dnl Decompose required version string of MariaDB
dnl and calculate its number representation
mariadb_version_req_major=`expr $mariadb_version_req : '\([[0-9]]*\)'`
mariadb_version_req_minor=`expr $mariadb_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
mariadb_version_req_micro=`expr $mariadb_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$mariadb_version_req_micro" = "x"; then
mariadb_version_req_micro="0"
fi
mariadb_version_req_number=`expr $mariadb_version_req_major \* 1000000 \
\+ $mariadb_version_req_minor \* 1000 \
\+ $mariadb_version_req_micro`
dnl Decompose version string of installed MariaDB
dnl and calculate its number representation
mariadb_version_major=`expr $MARIADB_VERSION : '\([[0-9]]*\)'`
mariadb_version_minor=`expr $MARIADB_VERSION : '[[0-9]]*\.\([[0-9]]*\)'`
mariadb_version_micro=`expr $MARIADB_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$mariadb_version_micro" = "x"; then
mariadb_version_micro="0"
fi
mariadb_version_number=`expr $mariadb_version_major \* 1000000 \
\+ $mariadb_version_minor \* 1000 \
\+ $mariadb_version_micro`
mariadb_version_check=`expr $mariadb_version_number \>\= $mariadb_version_req_number`
if test "$mariadb_version_check" = "1"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
AC_SUBST([MARIADB_VERSION])
AC_SUBST([MARIADB_CFLAGS])
AC_SUBST([MARIADB_LDFLAGS])
AC_SUBST([MARIADB_LIBS])
])

187
mio/m4/ax_lib_mysql.m4 generated
View File

@ -1,187 +0,0 @@
##### http://autoconf-archive.cryp.to/ax_lib_mysql.html
#
# SYNOPSIS
#
# AX_LIB_MYSQL([MINIMUM-VERSION])
#
# DESCRIPTION
#
# This macro provides tests of availability of MySQL client library
# of particular version or newer.
#
# AX_LIB_MYSQL macro takes only one argument which is optional. If
# there is no required version passed, then macro does not run
# version test.
#
# The --with-mysql option takes one of three possible values:
#
# no - do not check for MySQL client library
#
# yes - do check for MySQL library in standard locations
# (mysql_config should be in the PATH)
#
# path - complete path to mysql_config utility, use this option if
# mysql_config can't be found in the PATH
#
# This macro calls:
#
# AC_SUBST(MYSQL_CFLAGS)
# AC_SUBST(MYSQL_LDFLAGS)
# AC_SUBST(MYSQL_LIBS)
# AC_SUBST(MYSQL_VERSION)
#
# And sets:
#
# HAVE_MYSQL
#
# LAST MODIFICATION
#
# 2006-07-16
#
# COPYLEFT
#
# Copyright (c) 2006 Mateusz Loskot <mateusz@loskot.net>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved.
AC_DEFUN([AX_LIB_MYSQL],
[
MYSQL_CONFIG="no"
AC_ARG_WITH([mysql],
AC_HELP_STRING([--with-mysql@<:@=ARG@:>@],
[use MySQL client library @<:@default=no@:>@, optionally specify path to mysql_config]
),
[
if test "$withval" = "no"; then
want_mysql="no"
elif test "$withval" = "yes"; then
want_mysql="yes"
else
want_mysql="yes"
MYSQL_CONFIG="$withval"
fi
],
[want_mysql="no"]
)
MYSQL_CFLAGS=""
MYSQL_LDFLAGS=""
MYSQL_LIBS=""
MYSQL_VERSION=""
dnl
dnl Check MySQL libraries
dnl
if test "$want_mysql" = "yes"; then
AC_PATH_PROGS(MYSQL_CONFIG, mysql_config mariadb_config)
if test -x "$MYSQL_CONFIG"; then
MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`"
_full_libmysql_libs="`$MYSQL_CONFIG --libs`"
_save_mysql_ldflags="${LDFLAGS}"
_save_mysql_cflags="${CFLAGS}"
LDFLAGS="${LDFLAGS} ${_full_libmysql_libs}"
CFLAGS="${CFLAGS} ${MYSQL_CFLAGS}"
for i in $_full_libmysql_libs; do
case $i in
-lmysqlclient|-lperconaserverclient|-lmariadbclient|-lmariadb)
_lib_name="`echo "$i" | cut -b3-`"
AC_CHECK_LIB($_lib_name, main, [
MYSQL_LIBS="-l${_lib_name} ${MYSQL_LIBS}"
],[
AC_MSG_ERROR([Not found $_lib_name library])
])
;;
-L*)
MYSQL_LDFLAGS="${MYSQL_LDFLAGS} $i"
;;
-R*)
MYSQL_LDFLAGS="${MYSQL_LDFLAGS} -Wl,$i"
;;
-l*)
_lib_name="`echo "$i" | cut -b3-`"
AC_CHECK_LIB($_lib_name, main, [
MYSQL_LIBS="${MYSQL_LIBS} ${i}"
],[
AC_MSG_ERROR([Not found $i library])
])
;;
esac
done
LDFLAGS="${_save_mysql_ldflags}"
CFLAGS="${_save_mysql_cflags}"
unset _save_mysql_ldflags
unset _save_mysql_cflags
MYSQL_VERSION=`$MYSQL_CONFIG --version`
AC_DEFINE([HAVE_MYSQL], [1],
[Define to 1 if MySQL libraries are available])
found_mysql="yes"
else
found_mysql="no"
fi
fi
dnl
dnl Check if required version of MySQL is available
dnl
mysql_version_req=ifelse([$1], [], [], [$1])
if test "$found_mysql" = "yes" -a -n "$mysql_version_req"; then
AC_MSG_CHECKING([if MySQL version is >= $mysql_version_req])
dnl Decompose required version string of MySQL
dnl and calculate its number representation
mysql_version_req_major=`expr $mysql_version_req : '\([[0-9]]*\)'`
mysql_version_req_minor=`expr $mysql_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
mysql_version_req_micro=`expr $mysql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$mysql_version_req_micro" = "x"; then
mysql_version_req_micro="0"
fi
mysql_version_req_number=`expr $mysql_version_req_major \* 1000000 \
\+ $mysql_version_req_minor \* 1000 \
\+ $mysql_version_req_micro`
dnl Decompose version string of installed MySQL
dnl and calculate its number representation
mysql_version_major=`expr $MYSQL_VERSION : '\([[0-9]]*\)'`
mysql_version_minor=`expr $MYSQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'`
mysql_version_micro=`expr $MYSQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$mysql_version_micro" = "x"; then
mysql_version_micro="0"
fi
mysql_version_number=`expr $mysql_version_major \* 1000000 \
\+ $mysql_version_minor \* 1000 \
\+ $mysql_version_micro`
mysql_version_check=`expr $mysql_version_number \>\= $mysql_version_req_number`
if test "$mysql_version_check" = "1"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
AC_SUBST([MYSQL_VERSION])
AC_SUBST([MYSQL_CFLAGS])
AC_SUBST([MYSQL_LDFLAGS])
AC_SUBST([MYSQL_LIBS])
])