Fix `md2man --test` on a fresh checkout.
[rsync.git] / configure.ac
index e22e17e91439452a3390fc594f28e015024452b1..03fad912cdeeaa812fbf23fc053ed9a1c4312f8c 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT([rsync],[3.2.0dev],[http://rsync.samba.org/bugzilla.html])
+AC_INIT([rsync],[3.2.0pre2],[http://rsync.samba.org/bugzilla.html])
 
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([byteorder.h])
@@ -48,6 +48,7 @@ AC_PROG_MKDIR_P
 AC_PROG_CC_STDC
 AC_SUBST(SHELL)
 AC_PATH_PROG([PERL], [perl])
+AC_PATH_PROG([PYTHON3], [python3])
 
 AC_DEFINE([_GNU_SOURCE], 1,
           [Define _GNU_SOURCE so that we get all necessary prototypes])
@@ -62,6 +63,38 @@ if test x"$enable_profile" = x"yes"; then
        CFLAGS="$CFLAGS -pg"
 fi
 
+AC_MSG_CHECKING([if md2man can create man pages])
+if test x"$ac_cv_path_PYTHON3" = x; then
+    AC_MSG_RESULT(no - python3 not found)
+    md2man_works=no
+else
+    md2man_out=`"$srcdir/md2man" --test "$srcdir/rsync.1.md" 2>&1`
+    if test $? = 0; then
+       AC_MSG_RESULT(yes)
+       md2man_works=yes
+    else
+       AC_MSG_RESULT(no)
+       md2man_works=no
+       echo "$md2man_out"
+    fi
+fi
+
+AC_MSG_CHECKING([if we require man-page building])
+AC_ARG_ENABLE([md2man],
+       AS_HELP_STRING([--disable-md2man],[disable md2man for man page creation]))
+if test x"$enable_md2man" != x"no"; then
+    if test -f "$srcdir/rsync.1"; then
+       AC_MSG_RESULT(optional)
+    else
+       AC_MSG_RESULT(required)
+       if test x"$md2man_works" = x"no"; then
+           AC_MSG_ERROR(You need python3 and the cmarkgfm OR commonmark python3 lib in order to build man pages.
+You can specify --disable-md2man if you want to skip building them.)
+       fi
+    fi
+else
+    AC_MSG_RESULT(no)
+fi
 
 # Specifically, this turns on panic_action handling.
 AC_ARG_ENABLE(maintainer-mode,
@@ -70,7 +103,6 @@ if test x"$enable_maintainer_mode" = x"yes"; then
        CFLAGS="$CFLAGS -DMAINTAINER_MODE"
 fi
 
-
 # This is needed for our included version of popt.  Kind of silly, but
 # I don't want our version too far out of sync.
 CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
@@ -135,13 +167,6 @@ else
 fi
 AC_DEFINE_UNQUOTED(RSYNC_RSH, "$RSYNC_RSH", [default -e command])
 
-AC_CHECK_PROG(HAVE_YODL2MAN, yodl2man, 1, 0)
-if test x$HAVE_YODL2MAN = x1; then
-    MAKE_MAN=man
-else
-    MAKE_MAN=man-copy
-fi
-
 # Some programs on solaris are only found in /usr/xpg4/bin (or work better than others versions).
 AC_PATH_PROG(SHELL_PATH, sh, /bin/sh, [/usr/xpg4/bin$PATH_SEPARATOR$PATH])
 AC_PATH_PROG(FAKEROOT_PATH, fakeroot, /usr/bin/fakeroot, [/usr/xpg4/bin$PATH_SEPARATOR$PATH])
@@ -170,31 +195,40 @@ SIMD=
 
 AC_MSG_CHECKING([whether to enable SIMD optimizations])
 AC_ARG_ENABLE(simd,
-    AS_HELP_STRING([--enable-simd],[enable SIMD optimizations]))
+    AS_HELP_STRING([--disable-simd],[disable SIMD optimizations (requires g++)]))
 
-if test x"$enable_simd" = x"yes"; then
+if test x"$enable_simd" != x"no"; then
     # For x86-64 SIMD, g++ is also required
-    if test x"$build_cpu" = x"x86_64" && test x"$CXX" = x"g++"; then
-        SIMD="$SIMD x86_64"
+    if test x"$build_cpu" = x"x86_64"; then
+       if test x"$CXX" = x"g++"; then
+           # AC_MSG_RESULT() called below
+           SIMD="$SIMD x86_64"
+       else
+           AC_MSG_RESULT(no)
+           case "$host_os" in
+           *linux*)
+               AC_MSG_ERROR(Failed to find g++ for SIMD speedups. Use --disable-simd to continue without it.)
+               ;;
+           *)
+               ;;
+           esac
+       fi
     fi
 fi
 
 if test x"$SIMD" != x""; then
     SIMD=`echo "$SIMD" | sed -e 's/^ *//'`
     AC_MSG_RESULT([yes ($SIMD)])
-       AC_DEFINE(HAVE_SIMD, 1, [Define to 1 to enable SIMD optimizations])
+    AC_DEFINE(HAVE_SIMD, 1, [Define to 1 to enable SIMD optimizations])
     SIMD=`echo "$SIMD" | sed -e 's/[[^ ]]\+/$(SIMD_&)/g'`
+    # We only use g++ for its target attribute dispatching, disable unneeded bulky features
+    CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-rtti"
 else
     AC_MSG_RESULT(no)
 fi
 
 AC_SUBST(SIMD)
 
-# We only use g++ for its target attribute dispatching, disable unneeded bulky features
-if test x"$CXXOBJ" != x""; then
-    CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-rtti"
-fi
-
 # arrgh. libc in some old debian version screwed up the largefile
 # stuff, getting byte range locking wrong
 AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[
@@ -243,7 +277,7 @@ ipv6lib=none
 ipv6trylibc=yes
 
 AC_ARG_ENABLE(ipv6,
-       AS_HELP_STRING([--disable-ipv6],[do not even try to use IPv6]))
+       AS_HELP_STRING([--disable-ipv6],[turn off IPv6 support]))
 if test x"$enable_ipv6" != x"no"; then
        AC_MSG_CHECKING([ipv6 stack type])
        for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta cygwin; do
@@ -381,7 +415,7 @@ AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h \
     netdb.h malloc.h float.h limits.h iconv.h libcharset.h langinfo.h \
     sys/acl.h acl/libacl.h attr/xattr.h sys/xattr.h sys/extattr.h \
     popt.h popt/popt.h linux/falloc.h netinet/in_systm.h netinet/ip.h \
-    zlib.h xxhash.h openssl/md4.h openssl/md5.h)
+    zlib.h xxhash.h openssl/md4.h openssl/md5.h zstd.h lz4.h)
 AC_HEADER_MAJOR_FIXED
 
 AC_MSG_CHECKING([whether to enable use of openssl crypto library])
@@ -391,8 +425,7 @@ AH_TEMPLATE([USE_OPENSSL],
 [Undefine if you do not want to use openssl crypto library.  By default this is defined.])
 if test x"$enable_openssl" != x"no" && test x"$ac_cv_header_openssl_md4_h" = x"yes" && test x"$ac_cv_header_openssl_md5_h" = x"yes"; then
     AC_MSG_RESULT(yes)
-    AC_SEARCH_LIBS(MD5_Init, crypto)
-    AC_DEFINE(USE_OPENSSL)
+    AC_SEARCH_LIBS(MD5_Init, crypto, [AC_DEFINE(USE_OPENSSL)])
 else
     AC_MSG_RESULT(no)
 fi
@@ -402,10 +435,60 @@ AC_ARG_ENABLE([xxhash],
        AS_HELP_STRING([--disable-xxhash],[disable xxhash checksums]))
 AH_TEMPLATE([SUPPORT_XXHASH],
 [Undefine if you do not want xxhash checksums.  By default this is defined.])
-if test x"$enable_xxhash" != x"no" && test x"$ac_cv_header_xxhash_h" = x"yes"; then
-    AC_MSG_RESULT(yes)
-    AC_SEARCH_LIBS(XXH64_createState, xxhash)
-    AC_DEFINE(SUPPORT_XXHASH)
+if test x"$enable_xxhash" != x"no"; then
+    if test x"$ac_cv_header_xxhash_h" = x"yes"; then
+       AC_MSG_RESULT(yes)
+       AC_SEARCH_LIBS(XXH64_createState, xxhash,
+           [AC_DEFINE(SUPPORT_XXHASH)],
+           [AC_MSG_ERROR(Failed to find XXH64_createState function in xxhash lib.
+Use --disable-xxhash to continue without xxhash checksums.)])
+    else
+       AC_MSG_RESULT(no)
+       AC_MSG_ERROR(Failed to find xxhash.h for xxhash checksum support.
+Use --disable-xxhash to continue without it.)
+    fi
+else
+    AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING([whether to enable zstd compression])
+AC_ARG_ENABLE([zstd],
+        AC_HELP_STRING([--disable-zstd], [disable zstd compression]))
+AH_TEMPLATE([SUPPORT_ZSTD],
+[Undefine if you do not want zstd compression.  By default this is defined.])
+if test x"$enable_zstd" != x"no"; then
+    if test x"$ac_cv_header_zstd_h" = x"yes"; then
+       AC_MSG_RESULT(yes)
+       AC_SEARCH_LIBS(ZSTD_minCLevel, zstd,
+           [AC_DEFINE(SUPPORT_ZSTD)],
+           [AC_MSG_ERROR(Failed to find ZSTD_minCLevel function in zstd lib.
+Use --disable-zstd to continue without zstd compression.)])
+    else
+       AC_MSG_RESULT(no)
+       AC_MSG_ERROR(Failed to find zstd.h for zstd compression support.
+Use --disable-zstd to continue without it.)
+    fi
+else
+    AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING([whether to enable LZ4 compression])
+AC_ARG_ENABLE([lz4],
+        AC_HELP_STRING([--disable-lz4], [disable LZ4 compression]))
+AH_TEMPLATE([SUPPORT_LZ4],
+[Undefine if you do not want LZ4 compression.  By default this is defined.])
+if test x"$enable_lz4" != x"no"; then
+    if test x"$ac_cv_header_lz4_h" = x"yes"; then
+       AC_MSG_RESULT(yes)
+       AC_SEARCH_LIBS(LZ4_compress_default, lz4,
+           [AC_DEFINE(SUPPORT_LZ4)],
+           [AC_MSG_ERROR(Failed to find LZ4_compress_default function in lz4 lib.
+Use --disable-lz4 to continue without lz4 compression.)])
+    else
+       AC_MSG_RESULT(no)
+       AC_MSG_ERROR(Failed to find lz4.h for lz4 compression support.
+Use --disable-lz4 to continue without it.)
+    fi
 else
     AC_MSG_RESULT(no)
 fi
@@ -748,7 +831,7 @@ AC_ARG_ENABLE(iconv,
     AS_HELP_STRING([--disable-iconv],[disable rsync's --iconv option]),
     [], [enable_iconv=$enable_iconv_open])
 AH_TEMPLATE([ICONV_OPTION],
-[Define if you want the --iconv option.  Specifing a value will set the
+[Define if you want the --iconv option.  Specifying a value will set the
 default iconv setting (a NULL means no --iconv processing by default).])
 if test x"$enable_iconv" != x"no"; then
        if test x"$enable_iconv" = x"yes"; then
@@ -921,7 +1004,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
 void foo(const char *format, ...) {
        va_list ap;
        int len;
-       char buf[5];
+       static char buf[] = "12345678901234567890";
 
        va_start(ap, format);
        len = vsnprintf(0, 0, format, ap);
@@ -1181,8 +1264,3 @@ AC_OUTPUT
 AC_MSG_RESULT()
 AC_MSG_RESULT([    rsync ${RSYNC_VERSION} configuration successful])
 AC_MSG_RESULT()
-if test x$HAVE_YODL2MAN != x1; then
-    AC_MSG_RESULT([    Note that yodl2man was not found, so pre-existing manpage files will be])
-    AC_MSG_RESULT([    used w/o change (if available) -- no .yo file changes will be used.])
-    AC_MSG_RESULT()
-fi