1 2AC_ARG_ENABLE([bzip2], 3[AS_HELP_STRING([--disable-bzip2], [do not include bzip2 support])], 4want_bzip2=$enableval, want_bzip2="yes") 5 6bzip_check="ok" 7if test "$want_bzip2" = "yes" 8then 9 AC_LIB_LINKFLAGS([bz2]) 10 save_LDFLAGS="$LDFLAGS" 11 # Only add -L if prefix is not empty 12 test -z "$LIBBZ2_PREFIX" || LDFLAGS="$LDFLAGS -L$LIBBZ2_PREFIX/$acl_libdirstem"; 13 14 have_bzprefix="no" 15 AC_CHECK_LIB([bz2], [BZ2_bzDecompressInit], [have_bzprefix="yes"]) 16 if test "x$have_bzprefix" = "xno"; then 17 AC_DEFINE([NOBZ2PREFIX],1,[bzip funtions do not have bz2 prefix]) 18 fi 19 LDFLAGS="$save_LDFLAGS" 20 if test "$HAVE_LIBBZ2" = "yes"; then 21 AC_CHECK_HEADER([bzlib.h], 22 [AC_C_CVE_2008_1372], 23 [ac_cv_c_cve_2008_1372="no"]) 24 if test "$ac_cv_c_cve_2008_1372" = "bugged"; then 25 AC_MSG_WARN([****** bzip2 libraries are affected by the CVE-2008-1372 bug]) 26 AC_MSG_WARN([****** We strongly suggest you to update to bzip2 1.0.5.]) 27 AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!]) 28 bzip_check="bugged (CVE-2008-1372)" 29 fi 30 if test "$ac_cv_c_cve_2008_1372" = "linkfailed"; then 31 dnl This shouldn't happen 32 dnl We failed to link but libtool may still be able to link, so don't disable bzip2 just yet 33 AC_MSG_WARN([****** Unable to link bzip2 testcase]) 34 AC_MSG_WARN([****** You may be affected by CVE-2008-1372 bug, but I need to be able to link a testcase to verify]) 35 AC_MSG_WARN([****** It is recommended to fix your build environment so that we can run the testcase!]) 36 AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!]) 37 bzip_check="link failed (CVE-2008-1372)" 38 fi 39 40 case "$ac_cv_c_cve_2008_1372" in 41 ok|bugged|linkfailed) 42 ;; 43 *) 44 HAVE_LIBBZ2=no 45 ;; 46 esac 47 fi 48 49 if test "$HAVE_LIBBZ2" = "yes"; then 50 AC_C_CVE_2010_0405 51 if test "$ac_cv_c_cve_2010_0405" = "bugged"; then 52 AC_MSG_WARN([****** bzip2 libraries are affected by the CVE-2010-0405 bug]) 53 AC_MSG_WARN([****** We strongly suggest you to update bzip2]) 54 AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!]) 55 bzip_check="bugged (CVE-2010-0405)" 56 fi 57 if test "$ac_cv_c_cve_2010_0405" = "linkfailed"; then 58 dnl This shouldn't happen 59 dnl We failed to link but libtool may still be able to link, so don't disable bzip2 just yet 60 AC_MSG_WARN([****** Unable to link bzip2 testcase]) 61 AC_MSG_WARN([****** You may be affected by CVE-2010-0405 bug, but I need to be able to link a testcase to verify]) 62 AC_MSG_WARN([****** It is recommended to fix your build environment so that we can run the testcase!]) 63 AC_MSG_WARN([****** Please do not report stability problems to the ClamAV developers!]) 64 bzip_check="link failed (CVE-2010-0405)" 65 fi 66 67 case "$ac_cv_c_cve_2010_0405" in 68 ok|bugged|linkfailed) 69 LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS $LTLIBBZ2" 70 AC_DEFINE([HAVE_BZLIB_H],1,[have bzip2]) 71 ;; 72 *) 73 AC_MSG_WARN([****** bzip2 support disabled]) 74 ;; 75 esac 76 77 else 78 AC_MSG_WARN([****** bzip2 support disabled]) 79 fi 80fi 81 82AM_CONDITIONAL([HAVE_LIBBZ2], test "x$HAVE_LIBBZ2" = "xyes") 83