From: Karl Fleischmann Date: Wed, 8 Jun 2022 09:06:14 +0000 (+0200) Subject: m4: Rewrite want_sqlite.m4 to use pkg_config X-Git-Tag: 2.4.0~3861 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1971c6acb283ebf4e25eeb49863f5e5ebce68c1;p=thirdparty%2Fdovecot%2Fcore.git m4: Rewrite want_sqlite.m4 to use pkg_config Manually checking for headers/libraries requires the user to know and pass non-default library-paths when configuring the project. Using pkg_config simplifies the macro and automatically sets the compiler/linker flags accordingly. --- diff --git a/configure.ac b/configure.ac index 6b5df34a61..991807631a 100644 --- a/configure.ac +++ b/configure.ac @@ -559,8 +559,6 @@ AC_SUBST(MYSQL_CFLAGS) AC_SUBST(MYSQL_LIBS) AC_SUBST(PGSQL_CFLAGS) AC_SUBST(PGSQL_LIBS) -AC_SUBST(SQLITE_CFLAGS) -AC_SUBST(SQLITE_LIBS) AC_SUBST(DICT_LIBS) AC_SUBST(CDB_LIBS) diff --git a/m4/want_sqlite.m4 b/m4/want_sqlite.m4 index 33652ccb55..13815747cd 100644 --- a/m4/want_sqlite.m4 +++ b/m4/want_sqlite.m4 @@ -1,20 +1,18 @@ AC_DEFUN([DOVECOT_WANT_SQLITE], [ - if test $want_sqlite != no; then - AC_CHECK_LIB(sqlite3, sqlite3_open, [ - AC_CHECK_HEADER(sqlite3.h, [ - SQLITE_LIBS="$SQLITE_LIBS -lsqlite3" - - AC_DEFINE(HAVE_SQLITE,, [Build with SQLite3 support]) - found_sql_drivers="$found_sql_drivers sqlite" - ], [ - if test $want_sqlite = yes; then - AC_MSG_ERROR(cannot build with SQLite support: sqlite3.h not found) - fi - ]) - ], [ - if test $want_sqlite = yes; then - AC_MSG_ERROR(cannot build with SQLite support: libsqlite3 not found) - fi - ]) - fi + have_sqlite=no + + AS_IF([test "$want_sqlite" != "no"], [ + PKG_CHECK_MODULES([SQLITE], [sqlite3], [have_sqlite=yes], [ + have_sqlite=no + + AS_IF([test "$want_sqlite" = "yes"], [ + AC_MSG_ERROR([cannot build with SQLite support: sqlite3 library not found]) + ]) + ]) + ]) + + AS_IF([test "$have_sqlite" != "no"], [ + found_sql_drivers="$found_sql_drivers sqlite" + AC_DEFINE(HAVE_SQLITE,, [Build with SQLite3 support]) + ]) ])