diff --git a/configure.ac b/configure.ac
index 6726e91..22337a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,10 @@ AH_TEMPLATE([OMIT_READOSM],
             [Should be defined in order to disable ReadOSM support.])
 AH_TEMPLATE([ENABLE_LIBXML2],
             [Should be defined in order to enable LIBXML2 support.])
+
+PKG_CHECK_MODULES([SQLITE3], [sqlite3], , AC_MSG_ERROR(['sqlite3 is required but it doesn't seem to be installed on this system.]))
+CFLAGS="$CFLAGS $SQLITE3_CFLAGS"
+LIBS="$LIBS $SQLITE3_LIBS"
 AH_TEMPLATE([HAVE_DECL_SQLITE_CONFIG_URI],
             [depending on SQLite library version.])
 AH_TEMPLATE([HAVE_DECL_SQLITE_DBSTATUS_LOOKASIDE_USED],
@@ -104,7 +108,6 @@ AC_FUNC_STRFTIME
 AC_CHECK_FUNCS([memset sqrt strcasecmp strerror strncasecmp strstr fdatasync ftruncate getcwd gettimeofday localtime_r memmove strerror])
  
 # Checks for installed libraries
-AC_CHECK_LIB(sqlite3,sqlite3_prepare_v2,,AC_MSG_ERROR(['libsqlite3' is required but it doesn't seem to be installed on this system.]),-lm)
 
 AC_CONFIG_FILES([Makefile])
 
@@ -144,8 +147,7 @@ AC_ARG_ENABLE(readosm, [AS_HELP_STRING(
   [--enable-readosm], [enables ReadOSM inclusion [default=yes]])],
   [], [enable_readosm=yes])
 if test x"$enable_readosm" != "xno"; then
-  AC_SUBST(LIBREADOSM_LIBS)PKG_CHECK_MODULES([LIBREADOSM], [readosm], , AC_MSG_ERROR(['libreadosm' is required but it doesn't seem to be installed on this system.]))
-  AC_SEARCH_LIBS(readosm_version,readosm,,AC_MSG_ERROR(['libreadosm' (>= v.1.1.0) is required but an older version was found.]))
+  PKG_CHECK_MODULES([LIBREADOSM], [readosm], , AC_MSG_ERROR(['libreadosm' is required but it doesn't seem to be installed on this system.]))
   AC_SUBST(LIBREADOSM_CFLAGS)
   AC_SUBST(LIBREADOSM_LIBS)
 else
