diff --git a/Makefile.in b/Makefile.in index 467c2dc8..997dc0c6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -90,12 +90,12 @@ build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_sqlite3.m4 \ - $(top_srcdir)/m4/ax_with_curses.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/lnav_common.m4 \ $(top_srcdir)/m4/lnav_with_jemalloc.m4 \ $(top_srcdir)/m4/lnav_with_pcre.m4 \ $(top_srcdir)/m4/lnav_with_readline.m4 \ + $(top_srcdir)/m4/lnav_with_sqlite3.m4 \ $(top_srcdir)/m4/lnav_with_yajl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -306,7 +306,6 @@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_CMD = @SQLITE3_CMD@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_LIBS = @SQLITE3_LIBS@ -SQLITE3_VERSION = @SQLITE3_VERSION@ STATIC_LDFLAGS = @STATIC_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ diff --git a/aclocal.m4 b/aclocal.m4 index b8facb75..25b6d8b7 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1385,10 +1385,10 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -m4_include([m4/ax_sqlite3.m4]) m4_include([m4/ax_with_curses.m4]) m4_include([m4/lnav_common.m4]) m4_include([m4/lnav_with_jemalloc.m4]) m4_include([m4/lnav_with_pcre.m4]) m4_include([m4/lnav_with_readline.m4]) +m4_include([m4/lnav_with_sqlite3.m4]) m4_include([m4/lnav_with_yajl.m4]) diff --git a/configure b/configure index ab84beb9..052e2944 100755 --- a/configure +++ b/configure @@ -630,7 +630,6 @@ LIBOBJS USE_INCLUDED_YAJL_FALSE USE_INCLUDED_YAJL_TRUE STATIC_LDFLAGS -SQLITE3_VERSION SQLITE3_LIBS SQLITE3_LDFLAGS SQLITE3_CFLAGS @@ -1421,8 +1420,7 @@ Optional Packages: --with-pcre[=prefix] --with-readline[=prefix] compile xmlreadline part (via libreadline check) - --with-sqlite3=[ARG] use SQLite 3 library [default=yes], optionally - specify the prefix for sqlite3 library + --with-sqlite3=[prefix] compile with sqlite3 Some influential environment variables: CXX C++ compiler command @@ -7856,91 +7854,159 @@ fi - # Check whether --with-sqlite3 was given. if test "${with_sqlite3+set}" = set; then : withval=$with_sqlite3; - if test "$withval" = "no"; then - WANT_SQLITE3="no" - elif test "$withval" = "yes"; then - WANT_SQLITE3="yes" - ac_sqlite3_path="" - else - WANT_SQLITE3="yes" - ac_sqlite3_path="$withval" +else + with_sqlite3="yes" + +fi + + + case "$with_sqlite3" in #( + no) : + as_fn_error $? "sqlite3 required to build" "$LINENO" 5 ;; #( + yes) : + ;; #( + *) : + + if test "x$CPPFLAGS" = "x"; then + test "x$verbose" = "xyes" && echo " setting CPPFLAGS to \""-I$with_sqlite3/include"\"" + CPPFLAGS=""-I$with_sqlite3/include"" + else + ats_addto_bugger=""-I$with_sqlite3/include"" + for i in $ats_addto_bugger; do + ats_addto_duplicate="0" + for j in $CPPFLAGS; do + if test "x$i" = "x$j"; then + ats_addto_duplicate="1" + break fi + done + if test $ats_addto_duplicate = "0"; then + test "x$verbose" = "xyes" && echo " adding \"$i\" to CPPFLAGS" + CPPFLAGS="$CPPFLAGS $i" + fi + done + fi + + SQLITE3_LDFLAGS="-L$with_sqlite3/lib" + SQLITE3_CFLAGS="-I$with_sqlite3/include" + LDFLAGS="-L$with_sqlite3/lib $LDFLAGS" + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sqlite3_open" >&5 +$as_echo_n "checking for library containing sqlite3_open... " >&6; } +if ${ac_cv_search_sqlite3_open+:} false; then : + $as_echo_n "(cached) " >&6 else - WANT_SQLITE3="yes" + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* 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 sqlite3_open (); +int +main () +{ +return sqlite3_open (); + ; + return 0; +} +_ACEOF +for ac_lib in '' sqlite3; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_sqlite3_open=$ac_res fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_sqlite3_open+:} false; then : + break +fi +done +if ${ac_cv_search_sqlite3_open+:} false; then : +else + ac_cv_search_sqlite3_open=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sqlite3_open" >&5 +$as_echo "$ac_cv_search_sqlite3_open" >&6; } +ac_res=$ac_cv_search_sqlite3_open +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + SQLITE3_LIBS="-lsqlite3" +else + as_fn_error $? "sqlite3 library not found" "$LINENO" 5 - SQLITE3_CFLAGS="" - SQLITE3_LDFLAGS="" - SQLITE3_LIBS="" - SQLITE3_VERSION="" +fi - if test "x$WANT_SQLITE3" = "xyes"; then - ac_sqlite3_header="sqlite3.h" + for ac_header in sqlite3.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default" +if test "x$ac_cv_header_sqlite3_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SQLITE3_H 1 +_ACEOF - sqlite3_version_req="3.0.0" - sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([0-9]*\.[0-9]*\)'` - sqlite3_version_req_major=`expr $sqlite3_version_req : '\([0-9]*\)'` - sqlite3_version_req_minor=`expr $sqlite3_version_req : '[0-9]*\.\([0-9]*\)'` - sqlite3_version_req_micro=`expr $sqlite3_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` - if test "x$sqlite3_version_req_micro" = "x" ; then - sqlite3_version_req_micro="0" - fi +else + as_fn_error $? "sqlite3 headers not found" "$LINENO" 5 - sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \ - \+ $sqlite3_version_req_minor \* 1000 \ - \+ $sqlite3_version_req_micro` +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLite3 library >= $sqlite3_version_req" >&5 -$as_echo_n "checking for SQLite3 library >= $sqlite3_version_req... " >&6; } +done - if test "$ac_sqlite3_path" != ""; then - ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib" - ac_sqlite3_cppflags="-I$ac_sqlite3_path/include" - else - for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do - if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \ - && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then - ac_sqlite3_path=$ac_sqlite3_path_tmp - ac_sqlite3_cppflags="-I$ac_sqlite3_path_tmp/include" - ac_sqlite3_ldflags="-L$ac_sqlite3_path_tmp/lib" - break; - fi - done - fi - ac_sqlite3_ldflags="$ac_sqlite3_ldflags" - ac_sqlite3_libs="-lsqlite3" + sqlite3_version_req="3.0.0" + sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([0-9]*\.[0-9]*\)'` + sqlite3_version_req_major=`expr $sqlite3_version_req : '\([0-9]*\)'` + sqlite3_version_req_minor=`expr $sqlite3_version_req : '[0-9]*\.\([0-9]*\)'` + sqlite3_version_req_micro=`expr $sqlite3_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + if test "x$sqlite3_version_req_micro" = "x" ; then + sqlite3_version_req_micro="0" + fi - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $ac_sqlite3_cppflags" + sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \ + \+ $sqlite3_version_req_minor \* 1000 \ + \+ $sqlite3_version_req_micro` - ac_ext=cpp + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLite3 library >= $sqlite3_version_req" >&5 +$as_echo_n "checking for SQLite3 library >= $sqlite3_version_req... " >&6; } + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include + #include int main () { -#if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number) -// Everything is okay -#else -# error SQLite version is too old -#endif + #if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number) + // Everything is okay + #else + # error SQLite version is too old + #endif ; @@ -7950,74 +8016,39 @@ main () _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - success="yes" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } - succees="no" + as_fn_error $? "SQLite3 version >= $sqlite3_version_req is required" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - CPPFLAGS="$saved_CPPFLAGS" - - if test "$success" = "yes"; then - - SQLITE3_CFLAGS="$ac_sqlite3_cppflags" - SQLITE3_LDFLAGS="$ac_sqlite3_ldflags" - SQLITE3_LIBS="$ac_sqlite3_libs" - - ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header" - - if test "x$ac_sqlite3_header_path" != "x"; then - ac_sqlite3_version=`cat $ac_sqlite3_header_path \ - | grep '#define.*SQLITE_VERSION.*\"' | sed -e 's/.* "//' \ - | sed -e 's/"//'` - if test $ac_sqlite3_version != ""; then - SQLITE3_VERSION=$ac_sqlite3_version - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can not find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!" >&5 -$as_echo "$as_me: WARNING: Can not find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!" >&2;} - fi - fi - - -$as_echo "#define HAVE_SQLITE3 /**/" >>confdefs.h - - fi - fi - + 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 -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 *) diff --git a/src/Makefile.in b/src/Makefile.in index 73e9dc77..08fc1dee 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -125,12 +125,12 @@ noinst_PROGRAMS = bin2c$(EXEEXT) ptimec$(EXEEXT) lnav-test$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_sqlite3.m4 \ - $(top_srcdir)/m4/ax_with_curses.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/lnav_common.m4 \ $(top_srcdir)/m4/lnav_with_jemalloc.m4 \ $(top_srcdir)/m4/lnav_with_pcre.m4 \ $(top_srcdir)/m4/lnav_with_readline.m4 \ + $(top_srcdir)/m4/lnav_with_sqlite3.m4 \ $(top_srcdir)/m4/lnav_with_yajl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -391,7 +391,6 @@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_CMD = @SQLITE3_CMD@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_LIBS = @SQLITE3_LIBS@ -SQLITE3_VERSION = @SQLITE3_VERSION@ STATIC_LDFLAGS = @STATIC_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ diff --git a/src/config.h.in b/src/config.h.in index 1d92585c..5010ea21 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -76,8 +76,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_READLINE_READLINE_H -/* sqlite3 */ -#undef HAVE_SQLITE3 +/* Define to 1 if you have the header file. */ +#undef HAVE_SQLITE3_H /* Have the sqlite3_stmt_readonly function */ #undef HAVE_SQLITE3_STMT_READONLY diff --git a/test/Makefile.in b/test/Makefile.in index 141c4295..71b9ae71 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -119,12 +119,12 @@ TESTS = test_ansi_scrubber$(EXEEXT) test_auto_fd$(EXEEXT) \ test_data_parser.sh test_yajlpp$(EXEEXT) subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_sqlite3.m4 \ - $(top_srcdir)/m4/ax_with_curses.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_with_curses.m4 \ $(top_srcdir)/m4/lnav_common.m4 \ $(top_srcdir)/m4/lnav_with_jemalloc.m4 \ $(top_srcdir)/m4/lnav_with_pcre.m4 \ $(top_srcdir)/m4/lnav_with_readline.m4 \ + $(top_srcdir)/m4/lnav_with_sqlite3.m4 \ $(top_srcdir)/m4/lnav_with_yajl.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -602,7 +602,6 @@ SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ SQLITE3_CMD = @SQLITE3_CMD@ SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ SQLITE3_LIBS = @SQLITE3_LIBS@ -SQLITE3_VERSION = @SQLITE3_VERSION@ STATIC_LDFLAGS = @STATIC_LDFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@