https://bugs.gentoo.org/709616

--- a/configure.ac
+++ b/configure.ac
@@ -197,6 +197,10 @@ AC_CONFIG_FILES([
                  clamav-types.h
                  clamav-version.h])
 if test "x$enable_libclamav_only" != "xyes"; then
+    if test "$have_curl" = "no"; then
+        AC_MSG_ERROR([libcurl not found. libcurl (e.g. libcurl-devel) is required in order to build freshclam and clamsubmit.])
+    fi
+
     AC_CONFIG_FILES([
                      clamscan/Makefile
                      database/Makefile
--- a/m4/reorganization/libs/curl.m4
+++ b/m4/reorganization/libs/curl.m4
@@ -92,8 +92,6 @@ if test "X$have_curl" = "Xyes"; then
     )
 
     LDFLAGS="$save_LDFLAGS"
-else
-    AC_MSG_ERROR([libcurl not found. libcurl (e.g. libcurl-devel) is required in order to build freshclam and clamsubmit.])
 fi
 
 AC_SUBST([CLAMSUBMIT_LIBS])