configure: alias sqlite3_prepare_v2 to sqlite3_prepare if SQLite < 3.3.11

This should fix the build on all platforms with an older SQLite

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@88981 d073be05-634f-4543-b044-5fe20cf6d1d6
This commit is contained in:
Clemens Lang
2012-01-16 01:52:49 +00:00
parent 1d50d64e8b
commit 1f64018a61
4 changed files with 163 additions and 2 deletions
Vendored
+73
View File
@@ -1064,3 +1064,76 @@ AC_DEFUN([MP_WERROR],[
fi
AC_SUBST([CFLAGS_WERROR])
])
#------------------------------------------------------------------------
# MP_CHECK_SQLITE_VERSION --
#
# Check for a specific SQLite version and execute commands depending on availability
#
# Arguments:
# Required SQLite version for the test to succeed
# then-commands to execute if the version is equal to or higher than the threshold
# else-commands to execute if the version is lower than the threshold (optional)
#
# Requires:
# MP_SQLITE3_FLAGS
#
# Depends:
# AC_LANG_SOURCE
#
# Results:
# availability of SQLITE_VERSION_NUMBER is cached
# sets mp_sqlite_version_ge_$1 to yes or no
#
#------------------------------------------------------------------------
AC_DEFUN(MP_CHECK_SQLITE_VERSION, [
AC_REQUIRE([MP_SQLITE3_FLAGS])
AC_MSG_CHECKING([for SQLite >= $1])
mp_check_sqlite_version_cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $CFLAGS_SQLITE3"
AC_CACHE_VAL(mp_cv_sqlite_version_defined, [
AC_PREPROC_IFELSE(
[AC_LANG_SOURCE(
[[
#include <sqlite3.h>
#ifndef SQLITE_VERSION_NUMBER
# error "SQLITE_VERSION_NUMBER undefined"
#endif
]]
)],
[mp_cv_sqlite_version_defined="yes"],
[AC_MSG_ERROR("SQLITE_VERSION_NUMBER undefined or sqlite3.h not found")]
)
])
if test x"${mp_cv_sqlite_version_defined}" = "xno"; then
AC_MSG_RESULT([SQLite version not found])
mp_sqlite_version_ge_$1="no"
else
AC_CACHE_VAL(mp_cv_sqlite_version_ge_$1, [
AC_PREPROC_IFELSE(
[AC_LANG_SOURCE(
[[
#include <sqlite3.h>
#if (SQLITE_VERSION_NUMBER >= $1)
/* Everything is fine */
#else
# error "SQLite version too old"
#endif
]]
)],
[mp_cv_sqlite_version_ge_$1="yes"],
[mp_cv_sqlite_version_ge_$1="no"]
)
])
AC_MSG_RESULT(${mp_cv_sqlite_version_ge_$1})
mp_sqlite_version_ge_$1=${mp_cv_sqlite_version_ge_$1}
fi
CPPFLAGS=$mp_check_sqlite_version_cppflags_save
])
Vendored
+79
View File
@@ -9680,6 +9680,85 @@ $as_echo "$mp_cv_sqlite3_dir" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLite >= 3003011" >&5
$as_echo_n "checking for SQLite >= 3003011... " >&6; }
mp_check_sqlite_version_cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $CFLAGS_SQLITE3"
if ${mp_cv_sqlite_version_defined+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sqlite3.h>
#ifndef SQLITE_VERSION_NUMBER
# error "SQLITE_VERSION_NUMBER undefined"
#endif
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
mp_cv_sqlite_version_defined="yes"
else
as_fn_error $? "\"SQLITE_VERSION_NUMBER undefined or sqlite3.h not found\"" "$LINENO" 5
fi
rm -f conftest.err conftest.i conftest.$ac_ext
fi
if test x"${mp_cv_sqlite_version_defined}" = "xno"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: SQLite version not found" >&5
$as_echo "SQLite version not found" >&6; }
mp_sqlite_version_ge_3003011="no"
else
if ${mp_cv_sqlite_version_ge_3003011+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sqlite3.h>
#if (SQLITE_VERSION_NUMBER >= 3003011)
/* Everything is fine */
#else
# error "SQLite version too old"
#endif
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
mp_cv_sqlite_version_ge_3003011="yes"
else
mp_cv_sqlite_version_ge_3003011="no"
fi
rm -f conftest.err conftest.i conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mp_cv_sqlite_version_ge_3003011}" >&5
$as_echo "${mp_cv_sqlite_version_ge_3003011}" >&6; }
mp_sqlite_version_ge_3003011=${mp_cv_sqlite_version_ge_3003011}
fi
CPPFLAGS=$mp_check_sqlite_version_cppflags_save
if test "x${mp_sqlite_version_ge_3003011}" = "xno"; then
$as_echo "#define sqlite3_prepare_v2 sqlite3_prepare" >>confdefs.h
fi
# Determine if we need to install some bundled packages
OUR_INCLUDED_PACKAGES=
+6 -1
View File
@@ -231,7 +231,7 @@ AC_ARG_ENABLE(readline, AS_HELP_STRING([--enable-readline],[Enable addition of r
[
AC_CHECK_LIB([readline], [readline], [
READLINE_LIBS=-lreadline
AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the `readline' library (-lreadline).])
AC_DEFINE([HAVE_LIBREADLINE], [1], [Define to 1 if you have the 'readline' library (-lreadline).])
])
AC_CHECK_DECLS([rl_username_completion_function,rl_filename_completion_function,rl_completion_matches,username_completion_function,filename_completion_function,completion_matches], [], [],
[
@@ -271,6 +271,11 @@ MP_LIBCURL_FLAGS
## sqlite3
MP_SQLITE3_FLAGS
MP_CHECK_SQLITE_VERSION(3003011)
if test "x${mp_sqlite_version_ge_3003011}" = "xno"; then
AC_DEFINE([sqlite3_prepare_v2], [sqlite3_prepare], [define sqlite3_prepare to sqlite_prepare_v2 if the latter is not available])
fi
# Determine if we need to install some bundled packages
OUR_INCLUDED_PACKAGES=
+5 -1
View File
@@ -89,7 +89,7 @@
/* Define if you have the `md' library (-lmd). */
#undef HAVE_LIBMD
/* Define to 1 if you have the `readline' library (-lreadline). */
/* Define to 1 if you have the 'readline' library (-lreadline). */
#undef HAVE_LIBREADLINE
/* Define to 1 if you have the <limits.h> header file. */
@@ -269,3 +269,7 @@
/* Attribute to mark unused variables */
#undef UNUSED
/* define sqlite3_prepare to sqlite_prepare_v2 if the latter is not available
*/
#undef sqlite3_prepare_v2