[issue45774] Detect SQLite in configure.ac

Christian Heimes report at bugs.python.org
Tue Nov 9 17:46:50 EST 2021


Christian Heimes <lists at cheimes.de> added the comment:

Your solution looks very similar to my WIP patch:

AC_CHECK_HEADERS([sqlite3.h],
  [AC_SEARCH_LIBS([sqlite3_version], [sqlite3])]
)

AS_VAR_IF([ac_cv_search_sqlite3_version], [no], [], [
  # found a working sqlite3.h and sqlite3 library
  # ac_cv_search_sqlite3_version != no
  LIBS="$LIBS $ac_cv_search_sqlite3_version"
  
  AC_CACHE_CHECK([for sqlite3 version >= 3.7.15], [ac_cv_lib_sqlite3_supported], [
    AC_LINK_IFELSE([
      AC_LANG_PROGRAM([
        #include <sqlite3.h>
        #if SQLITE_VERSION_NUMBER < 3007015
          #error "sqlite version is too old"
        #endif], []
      )
    ], [ac_cv_lib_sqlite3_supported=yes], [ac_cv_lib_sqlite3_supported=no])
  ])
  
  AC_CACHE_CHECK([for sqlite3_enable_load_extension], [ac_cv_lib_sqlite3_sqlite3_enable_load_extension], [
    AC_LINK_IFELSE(
      [AC_LANG_PROGRAM([#include <sqlite3.h>], [void *x = sqlite3_enable_load_extension])],
      [ac_cv_lib_sqlite3_sqlite3_enable_load_extension=yes],
      [ac_cv_lib_sqlite3_sqlite3_enable_load_extension=no])
  ])
])

LIBS=$LIBS_SAVE

AS_VAR_IF([ac_cv_lib_sqlite3_supported], [yes],
  [AC_DEFINE([HAVE_LIBSQLITE3], [1], [Define to 1 if you have the `sqlite3' library (-lsqlite3).])]
)

AS_VAR_IF([ac_cv_lib_sqlite3_sqlite3_enable_load_extension], [yes],
  [AC_DEFINE([HAVE_SQLITE3_ENABLE_LOAD_EXTENSION], [1], 
             [Define to 1 if `sqlite3' library supports sqlite3_enable_load_extension.])]
)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45774>
_______________________________________


More information about the Python-bugs-list mailing list