/* Set if have PQputCopyData */
 #undef HAVE_PQ_COPY
 
+/* Set if have sqlite3_threadsafe */
+#undef HAVE_SQLITE3_THREADSAFE
+
 /* Define to 1 if you have the `prctl' function. */
 #undef HAVE_PRCTL
 
 
    if test $DB_PROG = sqlite3; then
       A=`test -f $SQL_LIB && nm $DB_PROG_LIB | grep pthread_mutex_lock`
       pkg=$?
+      AC_CHECK_LIB(sqlite3, sqlite3_threadsafe, AC_DEFINE(HAVE_SQLITE3_THREADSAFE, 1, [Set if have sqlite3_threadsafe]))
    fi
 
    if test $pkg = 0; then
 
 void db_check_backend_thread_safe()
 {
 #ifdef HAVE_BATCH_FILE_INSERT
+# ifdef HAVE_SQLITE3_THREADSAFE
    if (!sqlite3_threadsafe()) {
       Emsg0(M_ABORT, 0, _("SQLite3 client library must be thread-safe "
                           "when using BatchMode.\n"));
    }
+# endif
 #endif
 }