From bd2f5cc8668585e368750107769c02fc0d67d48d Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 19 Dec 2021 23:36:13 -0330 Subject: [PATCH] Make configure script use system libsqlite3, if requested (disabled by default). --- Makefile | 3 +-- configure | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 829083687..46953a66f 100644 --- a/Makefile +++ b/Makefile @@ -176,8 +176,7 @@ MODULES += \ src/emucore \ src/emucore/tia \ src/emucore/tia/frame-manager \ - src/common/repository/sqlite \ - src/sqlite + src/common/repository/sqlite ###################################################################### # The build rules follow - normally you should have no need to diff --git a/configure b/configure index 9343873c0..6adffc492 100755 --- a/configure +++ b/configure @@ -22,6 +22,7 @@ _build_joystick=yes _build_cheats=yes _build_httplib=yes _build_png=yes +_build_sqlite3=yes _build_zip=yes _build_static=no _build_profile=no @@ -206,6 +207,7 @@ Optional Features: --disable-png --enable-zip enable/disable ZIP file support [enabled] --disable-zip + --use-system-sqlite use libsqlite3 installed on system [disabled] --enable-windowed enable/disable windowed rendering modes [enabled] --disable-windowed --enable-shared build shared binary [enabled] @@ -250,6 +252,7 @@ for ac_option in $@; do --disable-png) _build_png=no ;; --enable-zip) _build_zip=yes ;; --disable-zip) _build_zip=no ;; + --use-system-sqlite) _build_sqlite3=no ;; --enable-windowed) _build_windowed=yes ;; --disable-windowed) _build_windowed=no ;; --enable-shared) _build_static=no ;; @@ -618,7 +621,7 @@ if test "$_build_zip" = yes ; then #include int main(void) { return strcmp(ZLIB_VERSION, zlibVersion()); } EOF - cc_check $LDFLAGS $CXXFLAGS $ZLIB_CFLAGS $ZLIB_LIBS -lz && _zlib=yes + cc_check $LDFLAGS $CXXFLAGS $ZLIB_CFLAGS $ZLIB_LIBS `pkg-config --libs zlib` && _zlib=yes if test "$_zlib" = yes ; then echo "$_zlib" @@ -657,6 +660,30 @@ else _build_png=no fi +# +# Check for sqlite3 +# +_libsqlite3=no +echocheck "libsqlite3" +if test "$_build_sqlite3" = no ; then + cat > $TMPC << EOF +#include +#include +int main(void) { return printf("%s\n", SQLITE_VERSION); } +EOF + cc_check $LDFLAGS $CXXFLAGS `pkg-config --libs sqlite3` && _libsqlite3=yes + + if test "$_libsqlite3" = yes ; then + echo "$_libsqlite3 (WIP, not complete)" + else + echo "built-in" + _build_sqlite3=yes + fi +else + echo "built-in" + _build_sqlite3=yes +fi + # # figure out installation directories # @@ -784,7 +811,7 @@ SQLITE_LIB="$SRC/sqlite" JSON="$SRC/json" HTTP_LIB="$SRC/httplib" -INCLUDES="-I$CORE -I$COMMON -I$TV -I$TIA -I$TIA_FRAME_MANAGER -I$JSON -I$SQLITE_REPO -I$SQLITE_LIB" +INCLUDES="-I$CORE -I$COMMON -I$TV -I$TIA -I$TIA_FRAME_MANAGER -I$JSON -I$SQLITE_REPO" INCLUDES="$INCLUDES `$_sdlconfig --cflags`" if test "$_build_static" = yes ; then @@ -866,17 +893,24 @@ fi if test "$_build_png" = yes ; then DEFINES="$DEFINES -DPNG_SUPPORT" if test "$_libpng" = yes ; then - LIBS="$LIBS -lpng" + LIBS="$LIBS `pkg-config --libs libpng`" else MODULES="$MODULES $LIBPNG" INCLUDES="$INCLUDES -I$LIBPNG" fi fi +if test "$_libsqlite3" = yes ; then + LIBS="$LIBS `pkg-config --libs sqlite3`" +else + MODULES="$MODULES $SQLITE_LIB" + INCLUDES="$INCLUDES -I$SQLITE_LIB" +fi + if test "$_build_zip" = yes ; then DEFINES="$DEFINES -DZIP_SUPPORT" if test "$_zlib" = yes ; then - LIBS="$LIBS -lz" + LIBS="$LIBS `pkg-config --libs zlib`" else MODULES="$MODULES $ZLIB" INCLUDES="$INCLUDES -I$ZLIB"