[conf] check for sqlite3_stmt_readonly

This commit is contained in:
Timothy Stack 2014-03-12 20:36:14 -07:00
parent f9adcc34b1
commit 454503ed53
4 changed files with 89 additions and 0 deletions

78
configure vendored
View File

@ -2116,6 +2116,73 @@ fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $2 innocuous_$2
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $2 (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $2
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$2 || defined __stub___$2
choke me
#endif
int
main ()
{
return $2 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@ -7251,6 +7318,17 @@ if test x"$SQLITE3_LIBS" = x""; then
as_fn_error $? "The sqlite3 developement package must be installed." "$LINENO" 5
fi
OLD_LIBS="$LIBS"
LIBS="$LIBS ${SQLITE3_LIBS}"
ac_fn_c_check_func "$LINENO" "sqlite3_stmt_readonly" "ac_cv_func_sqlite3_stmt_readonly"
if test "x$ac_cv_func_sqlite3_stmt_readonly" = xyes; then :
$as_echo "#define HAVE_SQLITE3_STMT_READONLY /**/" >>confdefs.h
fi
LIBS="$OLD_LIBS"
case "$host_os" in
*)
# AC_DEFINE([_XOPEN_SOURCE], [500], [Need pread])

View File

@ -99,6 +99,12 @@ if test x"$SQLITE3_LIBS" = x""; then
AC_MSG_ERROR([The sqlite3 developement package must be installed.])
fi
OLD_LIBS="$LIBS"
LIBS="$LIBS ${SQLITE3_LIBS}"
AC_CHECK_FUNC(sqlite3_stmt_readonly,
AC_DEFINE([HAVE_SQLITE3_STMT_READONLY], [], [Have the sqlite3_stmt_readonly function]))
LIBS="$OLD_LIBS"
case "$host_os" in
*)
# AC_DEFINE([_XOPEN_SOURCE], [500], [Need pread])

View File

@ -76,6 +76,9 @@
/* sqlite3 */
#undef HAVE_SQLITE3
/* Have the sqlite3_stmt_readonly function */
#undef HAVE_SQLITE3_STMT_READONLY
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

View File

@ -2251,10 +2251,12 @@ string execute_sql(string sql, string &alt_msg)
"in the log view");
}
}
#ifdef HAVE_SQLITE3_STMT_READONLY
else if (sqlite3_stmt_readonly(stmt.in())) {
retval = "No rows matched";
alt_msg = "";
}
#endif
}
if (!(lnav_data.ld_flags & LNF_HEADLESS)) {