Commit bc164f62 authored by Mateusz Loskot's avatar Mateusz Loskot

Removed no longer supported autotools-based build configuration.

parent cf764fa7
$Id: README,v 1.2 2006/11/08 20:08:14 mloskot Exp $
This directory is dedicated for:
- VC++ project files
- Jam files for bjam builder (just like in Boost)
- other building systems contributed by SOCI team and users
'm4' directory is dedicated to store private m4 macros.
This directory is passed in -I option to aclocal
launched by ./autogen.sh
# $Id: ax_boost_base.m4,v 1.2 2007/06/23 01:51:22 mloskot Exp $
#
##### http://autoconf-archive.cryp.to/ax_boost_base.html
#
# SYNOPSIS
#
# AX_BOOST_BASE([MINIMUM-VERSION])
#
# DESCRIPTION
#
# Test for the Boost C++ libraries of a particular version (or newer)
#
# If no path to the installed boost library is given the macro
# searchs under /usr, /usr/local, and /opt, and evaluates the
# $BOOST_ROOT environment variable. Further documentation is
# available at <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
#
# And sets:
#
# HAVE_BOOST
#
# LAST MODIFICATION
#
# 2007-03-15
#
# COPYLEFT
#
# Copyright (c) 2007 Thomas Porschberg <thomas@randspringer.de>
#
# 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_BOOST_BASE],
[
AC_ARG_WITH(
[boost],
AS_HELP_STRING([--with-boost@<:@=ARG@:>@], [use Boost @<:@default=yes@:>@, optionally specify path to Boost root directory]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ac_boost_path=""
else
want_boost="yes"
ac_boost_path="$withval"
fi
],
[want_boost="yes"])
if test "x$want_boost" = "xyes"; then
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
boost_lib_version_req_sub_minor="0"
fi
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
AC_MSG_CHECKING(for Boost base libraries >= $boost_lib_version_req)
succeeded=no
dnl first we check the system location for boost libraries
dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM
if test "$ac_boost_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_path/lib"
BOOST_CPPFLAGS="-I$ac_boost_path/include"
else
for ac_boost_path_tmp in /usr /usr/local /opt ; do
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
break;
fi
done
fi
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
dnl if we found no boost with system layout we search for boost libraries
dnl built and installed without the --layout=system option or for a staged(not installed) version
if test "x$succeeded" != "xyes"; then
_version=0
if test "$ac_boost_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_path/lib"
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
_version=$_version_tmp
fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
done
fi
else
for ac_boost_path in /usr /usr/local /opt ; do
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
_version=$_version_tmp
best_path=$ac_boost_path
fi
done
fi
done
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
BOOST_LDFLAGS="-L$best_path/lib"
if test "x$BOOST_ROOT" != "x"; then
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "$V_CHECK" = "1" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
fi
fi
fi
fi
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
fi
if test "$succeeded" != "yes" ; then
if test "$_version" = "0" ; then
AC_MSG_ERROR([[We could not detect the Boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged Boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
else
AC_MSG_NOTICE([Your Boost libraries seems too old (version $_version).])
fi
else
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
AC_DEFINE(HAVE_BOOST, [1], [define if the Boost library is available])
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])
# ===========================================================================
# http://autoconf-archive.cryp.to/ax_boost_date_time.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_DATE_TIME
#
# DESCRIPTION
#
# Test for Date_Time library from the Boost C++ libraries. The macro
# requires a preceding call to AX_BOOST_BASE. Further documentation is
# available at <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_DATE_TIME_LIB)
#
# And sets:
#
# HAVE_BOOST_DATE_TIME
#
# LAST MODIFICATION
#
# 2008-04-12
#
# COPYLEFT
#
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2008 Michael Tindal
#
# 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_BOOST_DATE_TIME],
[
AC_ARG_WITH([boost-date-time],
AS_HELP_STRING([--with-boost-date-time@<:@=special-lib@:>@],
[use the Date_Time library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-date-time=boost_date_time-gcc-mt-d-1_33_1 ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_date_time_lib=""
else
want_boost="yes"
ax_boost_user_date_time_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(whether the Boost::Date_Time library is available,
ax_cv_boost_date_time,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/date_time/gregorian/gregorian_types.hpp>]],
[[using namespace boost::gregorian; date d(2002,Jan,10);
return 0;
]]),
ax_cv_boost_date_time=yes, ax_cv_boost_date_time=no)
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_date_time" = "xyes"; then
AC_DEFINE(HAVE_BOOST_DATE_TIME,,[define if the Boost::Date_Time library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
if test "x$ax_boost_user_date_time_lib" = "x"; then
for libextension in `ls $BOOSTLIBDIR/libboost_date_time*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_date_time.*\)\.so.*$;\1;' -e 's;^lib\(boost_date_time.*\)\.a*$;\1;'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
[link_date_time="no"])
done
if test "x$link_date_time" != "xyes"; then
for libextension in `ls $BOOSTLIBDIR/boost_date_time*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_date_time.*\)\.dll.*$;\1;' -e 's;^\(boost_date_time.*\)\.a*$;\1;'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
[link_date_time="no"])
done
fi
else
for ax_lib in $ax_boost_user_date_time_lib boost_date_time-$ax_boost_user_date_time_lib; do
AC_CHECK_LIB($ax_lib, main,
[BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
[link_date_time="no"])
done
fi
if test "x$link_date_time" != "xyes"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])
dnl $Id: ax_cxx_toolset.m4,v 1.2 2006/08/30 14:28:55 mloskot Exp $
dnl
dnl @synopsis AX_CXX_TOOLSET([])
dnl
dnl The AC_CXX_TOOLSET_INFO macro runs simple tests to detect C++ compiler.
dnl It sets four variables with compiler vendor name, abbreviation,
dnl toolset (based on toolset names used in Boost library)
dnl and compiler command.
dnl
dnl Currently, only GNU C/C++ and Microsoft Visual C++ are supported.
dnl
dnl This macro does not take any parameters.
dnl
dnl This macro sets following variables:
dnl
dnl CXX_TOOLSET_VENDOR
dnl CXX_TOOLSET_FULLNAME
dnl CXX_TOOLSET_NAME
dnl CXX_TOOLSET_COMMAND
dnl
dnl No AC_SUBST are called.
dnl
dnl The idea of this macro is based on AX_COMPILER_VENDOR macro
dnl developed and copyrighted by Ludovic Courtès <ludo@chbouib.org>
dnl Source: http://autoconf-archive.cryp.to/ac_cxx_compiler_vendor.html
dnl
dnl @category CXX
dnl @author Mateusz Loskot <mateusz@loskot.net>
dnl @version 2006-08-30
dnl @license AllPermissive
dnl
dnl Generic compiler detector
dnl
AC_DEFUN([AX_C_IFDEF],
[
AC_COMPILE_IFELSE(
[#ifndef $1
#error "Compiler definition macro $1 is undefined!"
#endif], [$2], [$3])
])
dnl
dnl Visual C++ compiler detector
dnl
dnl TODO - mloskot: It has not been tested with Autoconf + Visual C++.
dnl I even don't know if it's feasible and well-working to use
dnl Autoconf with Visual C++ toolset.
dnl If anyone knows how to test it, please give me a note. Thanks!
dnl
AC_DEFUN([AX_C_IFDEF_MSVC],
[
AC_COMPILE_IFELSE(
[
#ifndef $1
#error "Compiler definition macro $1 is undefined!"
#endif
],
[
AC_COMPILE_IFELSE([#if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1200-1202 == eVC++4
#error "Macro test _MSC_VER < 1300 is false, it is not VC++ 6.0!"
#endif
],
[
ac_cxx_msvc_toolset=vc60
$2
],
[
AC_COMPILE_IFELSE([#if _MSC_VER <= 1300 // 1300 == VC++ 7.0
#error "Macro test _MSC_VER <= 1300 is false, it is not VC++ 7.0!"
#endif
],
[
dnl Visual C++ 6.0 detected
ac_cxx_msvc_toolset=vc70
$2
],
[
AC_COMPILE_IFELSE([#if _MSC_VER <= 1300 // 1300 == VC++ 7.0
#error "Macro test _MSC_VER <= 1300 is false, it is not VC++ 7.0!"
#endif
],
[
dnl Visual C++ 7.0 detected
ac_cxx_msvc_toolset=vc70
$2
],
[
AC_COMPILE_IFELSE([#if _MSC_VER < 1310 // 1310 == VC++ 7.1
#error "Macro test _MSC_VER < 1310 is false, it is not VC++ 7.1!"
#endif
],
[
dnl Visual C++ 7.1 detected
ac_cxx_msvc_toolset=vc71
$2
],
[
AC_COMPILE_IFELSE([#if _MSC_VER <= 1400 // 1400 == VC++ 8.0
#error "Macro test _MSC_VER < 1400 is false, it is not VC++ 8.0!"
#endif
],
[
dnl Visual C++ 8.0 detected
ac_cxx_msvc_toolset=vc80
$2
],
[$3])
])
])
])
])
],
[$3])
])
AC_DEFUN([AX_CXX_TOOLSET],
[
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([AC_PROG_CXXCPP])
AC_CACHE_CHECK([the C++ compiler vendor],
[ac_cxx_toolset_vendor],
[
AC_LANG_PUSH([C++])
dnl GNU C/C++
AX_C_IFDEF([__GNUG__],
[
ac_cxx_toolset_vendor="Free Software Foundation"
ac_cxx_toolset_fullname="GNU C/C++ Compiler"
ac_cxx_toolset_name="gcc"
ac_cxx_toolset_cmd="g++"
],
[
dnl Microsoft Visual C++
AX_C_IFDEF_MSVC([_MSC_VER],
[
ac_cxx_toolset_vendor="Microsoft"
ac_cxx_toolset_fullname="Visual C++"
ac_cxx_toolset_name=$ac_cxx_msvc_toolset
ac_cxx_toolset_cmd="cl"
],
[
ac_cxx_toolset_vendor=unknown
ac_cxx_toolset_fullname=unknown
ac_cxx_toolset_name=unknown
ac_cxx_toolset_cmd=unknown
])
])
AC_LANG_POP()
])
dnl
dnl Output variables
dnl
CXX_TOOLSET_VENDOR=$ac_cxx_toolset_vendor
CXX_TOOLSET_FULLNAME=$ac_cxx_toolset_fullname
CXX_TOOLSET_NAME=$ac_cxx_toolset_name
CXX_TOOLSET_COMMAND=$ac_cxx_toolset_cmd
])
dnl $Id: ax_firebird.m4,v 1.3 2007/06/23 01:51:22 mloskot Exp $
dnl
dnl @synopsis AX_LIB_FIREBIRD([MINIMUM-VERSION])
dnl
dnl Test for the Firebird client library of a particular version (or newer)
dnl
dnl This macro takes only one optional argument, required version
dnl of Firebird library. If required version is not
dnl passed, then 1.5.0 is used in test of existance of Firebird
dnl client library.
dnl
dnl For more information about Firebird API versioning check:
dnl API Identifies Client Version
dnl http://www.firebirdsql.org/rlsnotes20/rnfbtwo-apiods.html
dnl
dnl If no intallation prefix to the installed Firebird library is given
dnl the macro searches under /usr, /usr/local, and /opt.
dnl
dnl This macro calls:
dnl
dnl AC_SUBST(FIREBIRD_CFLAGS)
dnl AC_SUBST(FIREBIRD_LDFLAGS)
dnl AC_SUBST(FIREBIRD_VERSION)
dnl
dnl And sets:
dnl
dnl HAVE_FIREBIRD
dnl
dnl @category InstalledPackages
dnl @category Cxx
dnl @author Mateusz Loskot <mateusz@loskot.net>
dnl @version $Date: 2007/06/23 01:51:22 $
dnl @license AllPermissive
dnl
dnl $Id: ax_firebird.m4,v 1.3 2007/06/23 01:51:22 mloskot Exp $
dnl
AC_DEFUN([AX_LIB_FIREBIRD],
[
AC_ARG_WITH([firebird],
AC_HELP_STRING(
[--with-firebird=@<:@ARG@:>@],
[use Firebird client library @<:@default=yes@:>@, optionally specify the prefix for firebird library]
),
[
if test "$withval" = "no"; then
WANT_FIREBIRD="no"
elif test "$withval" = "yes"; then
WANT_FIREBIRD="yes"
ac_firebird_path=""
else
WANT_FIREBIRD="yes"
ac_firebird_path="$withval"
fi
],
[WANT_FIREBIRD="yes"]
)
FIREBIRD_CFLAGS=""
FIREBIRD_LDFLAGS=""
FIREBIRD_VERSION=""
if test "x$WANT_FIREBIRD" = "xyes"; then
ac_firebird_header="ibase.h"
firebird_version_req=ifelse([$1], [], [3.0.0], [$1])
firebird_version_req_shorten=`expr $firebird_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
firebird_version_req_major=`expr $firebird_version_req : '\([[0-9]]*\)'`
firebird_version_req_minor=`expr $firebird_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
firebird_version_req_micro=`expr $firebird_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$firebird_version_req_micro" = "x" ; then
firebird_version_req_micro="0"
fi
dnl FB_API_VER represents the version of Firebird as follows:
dnl - Any version of Interbase, or Firebird 1.0.x: 10
dnl - Firebird 1.5.x: 15
dnl - Firebird 2.0.x: 20
firebird_version_req_number=`expr $firebird_version_req_major \+ $firebird_version_req_minor`
AC_MSG_CHECKING([for Firebird client library >= $firebird_version_req])
if test "$ac_firebird_path" != ""; then
ac_firebird_ldflags="-L$ac_firebird_path/lib"
ac_firebird_cppflags="-I$ac_firebird_path/include"
else
for ac_firebird_path_tmp in /usr /usr/local /opt ; do
if test -f "$ac_firebird_path_tmp/include/$ac_firebird_header" \
&& test -r "$ac_firebird_path_tmp/include/$ac_firebird_header"; then
ac_firebird_path=$ac_firebird_path_tmp
ac_firebird_cppflags="-I$ac_firebird_path_tmp/include"
ac_firebird_ldflags="-L$ac_firebird_path_tmp/lib"
break;
fi
done
fi
ac_firebird_header_path="$ac_firebird_path/include/$ac_firebird_header"
if test ! -f "$ac_firebird_header_path"; then
AC_MSG_RESULT([no])
success="no"
else
ac_firebird_ldflags="$ac_firebird_ldflags -lfbclient -lpthread"
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $ac_firebird_cppflags"
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM([[@%:@include <ibase.h>]],
[[
#if (FB_API_VER >= $firebird_version_req_number)
// Everything is okay
#else
# error Firebird version is too old
#endif
]]
)
],
[
AC_MSG_RESULT([yes])
success="yes"
],
[
AC_MSG_RESULT([not found])
succees="no"
]
)
AC_LANG_POP([C++])
CPPFLAGS="$saved_CPPFLAGS"
if test "$success" = "yes"; then
FIREBIRD_CFLAGS="$ac_firebird_cppflags"
FIREBIRD_LDFLAGS="$ac_firebird_ldflags"
dnl Retrieve Firebird release version
ac_firebird_version=`cat $ac_firebird_header_path | \
grep '#define.*FB_API_VER.*' | \
sed -e 's/.* //'`
if test -n "$ac_firebird_version"; then
ac_firebird_version_major=`expr $ac_firebird_version \/ 10`
ac_firebird_version_minor=`expr $ac_firebird_version \% 10`
FIREBIRD_VERSION="$ac_firebird_version_major.$ac_firebird_version_minor.x"
else
AC_MSG_WARN([Could not find FB_API_VER macro in $ac_firebird_header to get Firebird version.])
fi
AC_SUBST([FIREBIRD_CFLAGS])
AC_SUBST([FIREBIRD_LDFLAGS])
AC_SUBST([FIREBIRD_VERSION])
AC_DEFINE([HAVE_FIREBIRD], [1], [Define to 1 if FireBird libraries are available])
fi
fi
fi
])
dnl $Id: ax_mysql.m4,v 1.3 2007/06/23 01:51:22 mloskot Exp $
dnl
dnl @synopsis AX_LIB_MYSQL([MINIMUM-VERSION])
dnl
dnl This macro provides tests of availability of MySQL client library
dnl of particular version or newer.
dnl
dnl AX_LIB_MYSQL macro takes only one argument which is optional. If there is no
dnl required version passed, then macro does not run version test.
dnl
dnl The --with-mysql option takes one of three possible values:
dnl no - do not check for MySQL client library
dnl yes - do check for MySQL library in standard locations
dnl (mysql_config should be in the PATH)
dnl path - complete path to mysql_config utility, use this option
dnl if mysql_config can't be found in the PATH
dnl
dnl This macro calls:
dnl
dnl AC_SUBST(MYSQL_CFLAGS)
dnl AC_SUBST(MYSQL_LDFLAGS)
dnl AC_SUBST(MYSQL_VERSION)
dnl
dnl And sets:
dnl
dnl HAVE_MYSQL
dnl
dnl @category InstalledPackages
dnl @category Cxx
dnl @author Mateusz Loskot <mateusz@loskot.net>
dnl @version $Date: 2007/06/23 01:51:22 $
dnl @license AllPermissive
dnl
dnl $Id: ax_mysql.m4,v 1.3 2007/06/23 01:51:22 mloskot Exp $
dnl
AC_DEFUN([AX_LIB_MYSQL],
[
AC_ARG_WITH([mysql],
AC_HELP_STRING([--with-mysql=@<:@ARG@:>@],
[use MySQL client library @<:@default=yes@:>@, 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="yes"]
)
MYSQL_CFLAGS=""
MYSQL_LDFLAGS=""
MYSQL_VERSION=""
dnl
dnl Check MySQL libraries (libpq)
dnl
if test "$want_mysql" = "yes"; then
if test -z "$MYSQL_CONFIG" -o test; then
AC_PATH_PROG([MYSQL_CONFIG], [mysql_config], [])
fi
dnl MYSQL_CONFIG is provided but it does not point to executable file
if test ! -x "$MYSQL_CONFIG"; then
AC_MSG_ERROR([$MYSQL_CONFIG does not exist or it is not an exectuable file])
MYSQL_CONFIG="no"
found_mysql="no"
fi
if test "$MYSQL_CONFIG" != "no"; then
AC_MSG_CHECKING([for MySQL libraries])
MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`"
MYSQL_LDFLAGS="`$MYSQL_CONFIG --libs`"
MYSQL_VERSION=`$MYSQL_CONFIG --version`
AC_DEFINE([HAVE_MYSQL], [1], [Define to 1 if MySQL libraries are available])
found_mysql="yes"
AC_MSG_RESULT([yes])
else
found_mysql="no"
AC_MSG_RESULT([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`