]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - configure.ac
libext2fs: fix potential divide by zero bug caused by a lxcfs bug
[thirdparty/e2fsprogs.git] / configure.ac
index e4a17b952021ae0ad77e82ce02ee5bcc6b07ddcb..e00e8d0e0fb0a98b9408161da02077dac13411a7 100644 (file)
@@ -365,10 +365,10 @@ CFLAGS_STLIB="${CFLAGS_STLIB:-$CFLAGS}"
 LDFLAGS_SHLIB=${LDFLAGS_SHLIB:-$LDFLAGS}
 LDFLAGS_STATIC=${LDFLAGS_STATIC:-$LDFLAGS}
 AC_ARG_ENABLE([hardening],
-AS_HELP_STRING([--enable-hardening],[build for coverage testing using gcov]),
+AS_HELP_STRING([--enable-hardening],[build with hardening flags such as fortify]),
 if test "$enableval" = "yes"
 then
-       HARDEN_CFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-strong"
+       HARDEN_CFLAGS="-D_FORTIFY_SOURCE=3 -fstack-protector-strong"
        HARDEN_LDFLAGS=["-Wl,-z,relro -Wl,-z,now"]
        CFLAGS="$CFLAGS $HARDEN_CFLAGS -fPIE"
        CFLAGS_SHLIB="$CFLAGS_SHLIB $HARDEN_CFLAGS"
@@ -1301,10 +1301,39 @@ AC_SUBST(MAGIC_LIB)
 dnl
 dnl libarchive
 dnl
-AC_CHECK_LIB(archive, archive_read_new, [ARCHIVE_LIB=-larchive
-AC_CHECK_HEADERS([archive.h])])
-if test "$ac_cv_func_dlopen" = yes ; then
-   ARCHIVE_LIB=$DLOPEN_LIB
+AC_ARG_WITH([libarchive],
+AS_HELP_STRING([--without-libarchive],[disable use of libarchive]),
+[if test "$withval" = "no"
+then
+       try_libarchive=""
+       AC_MSG_RESULT([Disabling libarchive support])
+elif test "$withval" = "direct"
+then
+       try_libarchive="direct"
+       AC_MSG_RESULT([Testing for libarchive support (forced direct link)])
+else
+       try_libarchive="yes"
+       AC_MSG_RESULT([Testing for libarchive support (with dlopen)])
+fi]
+,
+try_libarchive="yes"
+AC_MSG_RESULT([Try testing for libarchive support (with dlopen) by default])
+)
+ARCHIVE_LIB=
+if test -n "$try_libarchive"
+then
+    AC_CHECK_LIB(archive, archive_read_new, [ARCHIVE_LIB=-larchive
+    AC_CHECK_HEADERS([archive.h])])
+    if test "$ac_cv_func_dlopen" = yes -a "$try_libarchive" != "direct"; then
+        ARCHIVE_LIB=$DLOPEN_LIB
+       AC_DEFINE(CONFIG_DLOPEN_LIBARCHIVE, 1,
+               [Define to 1 if using dlopen to access libarchive])
+
+    fi
+    if test "$ac_cv_header_archive_h" != "yes"
+    then
+        ARCHIVE_LIB=
+    fi
 fi
 AC_SUBST(ARCHIVE_LIB)
 dnl