subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phi...@apache.org
Subject svn commit: r1803127 - in /subversion/trunk: ./ build/ac-macros/ subversion/ subversion/libsvn_subr/ subversion/libsvn_subr/lz4/
Date Thu, 27 Jul 2017 00:04:28 GMT
Author: philip
Date: Thu Jul 27 00:04:27 2017
New Revision: 1803127

URL: http://svn.apache.org/viewvc?rev=1803127&view=rev
Log:
Build against the system LZ4 library by default instead of the
internal copy of the LZ4 code.  Add --with-lz4=PREFIX|internal
to allow the user to specify either where to find LZ4 or that
the internal copy be used.  The Windows build will continue to
use the internal LZ4 code.

* build/ac-macros/lz4.m4: New.

* aclocal.m4: Include lz4.m4.

* configure.ac: Call SVN_LZ4.

* Makefile.in
  (SVN_LZ4_LIBS, SVN_LZ4_INCLUDES): New.

* build.conf
  (libsvn_subr): Add lz4 to link.
  (lz4): New.

* subversion/libsvn_subr/lz4/lz4.h: Rename to ...

* subversion/libsvn_subr/lz4/lz4internal.h: ... this, include
   svn_private_config.h, protect with SVN_INTERNAL_LZ4.

* subversion/libsvn_subr/lz4/lz4.c: Include svn_private_config.h and
   lz4internal.h, protect with SVN_INTERNAL_LZ4.

* subversion/libsvn_subr/compress.c: Include system lz4.h or lz4internal.h.

* subversion/svn_private_config.hw: Define SVN_INTERNAL_LZ4 to
   enable internal copy of LZ4.

Added:
    subversion/trunk/build/ac-macros/lz4.m4
    subversion/trunk/subversion/libsvn_subr/lz4/lz4internal.h
      - copied, changed from r1803089, subversion/trunk/subversion/libsvn_subr/lz4/lz4.h
Removed:
    subversion/trunk/subversion/libsvn_subr/lz4/lz4.h
Modified:
    subversion/trunk/Makefile.in
    subversion/trunk/aclocal.m4
    subversion/trunk/build.conf
    subversion/trunk/configure.ac
    subversion/trunk/subversion/libsvn_subr/compress.c
    subversion/trunk/subversion/libsvn_subr/lz4/lz4.c
    subversion/trunk/subversion/svn_private_config.hw

Modified: subversion/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/trunk/Makefile.in?rev=1803127&r1=1803126&r2=1803127&view=diff
==============================================================================
--- subversion/trunk/Makefile.in (original)
+++ subversion/trunk/Makefile.in Thu Jul 27 00:04:27 2017
@@ -54,6 +54,7 @@ SVN_SERF_LIBS = @SVN_SERF_LIBS@
 SVN_SQLITE_LIBS = @SVN_SQLITE_LIBS@
 SVN_XML_LIBS = @SVN_XML_LIBS@
 SVN_ZLIB_LIBS = @SVN_ZLIB_LIBS@
+SVN_LZ4_LIBS = @SVN_LZ4_LIBS@
 
 LIBS = @LIBS@
 
@@ -130,7 +131,7 @@ INCLUDES = -I$(top_srcdir)/subversion/in
            @SVN_DB_INCLUDES@ @SVN_GNOME_KEYRING_INCLUDES@ \
            @SVN_KWALLET_INCLUDES@ @SVN_MAGIC_INCLUDES@ \
            @SVN_SASL_INCLUDES@ @SVN_SERF_INCLUDES@ @SVN_SQLITE_INCLUDES@ \
-           @SVN_XML_INCLUDES@ @SVN_ZLIB_INCLUDES@
+           @SVN_XML_INCLUDES@ @SVN_ZLIB_INCLUDES@ @SVN_LZ4_INCLUDES@
 
 APACHE_INCLUDES = @APACHE_INCLUDES@
 APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@

Modified: subversion/trunk/aclocal.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/aclocal.m4?rev=1803127&r1=1803126&r2=1803127&view=diff
==============================================================================
--- subversion/trunk/aclocal.m4 (original)
+++ subversion/trunk/aclocal.m4 Thu Jul 27 00:04:27 2017
@@ -44,6 +44,7 @@ sinclude(build/ac-macros/serf.m4)
 sinclude(build/ac-macros/sqlite.m4)
 sinclude(build/ac-macros/swig.m4)
 sinclude(build/ac-macros/zlib.m4)
+sinclude(build/ac-macros/lz4.m4)
 sinclude(build/ac-macros/kwallet.m4)
 sinclude(build/ac-macros/libsecret.m4)
 sinclude(build/ac-macros/macosx.m4)

Modified: subversion/trunk/build.conf
URL: http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1803127&r1=1803126&r2=1803127&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Thu Jul 27 00:04:27 2017
@@ -371,7 +371,7 @@ type = lib
 install = fsmod-lib
 path = subversion/libsvn_subr
 sources = *.c lz4/*.c
-libs = aprutil apriconv apr xml zlib apr_memcache sqlite magic intl
+libs = aprutil apriconv apr xml zlib apr_memcache sqlite magic intl lz4
 msvc-libs = kernel32.lib advapi32.lib shfolder.lib ole32.lib
             crypt32.lib version.lib
 msvc-export = 
@@ -1483,6 +1483,10 @@ type = lib
 external-lib = $(SVN_ZLIB_LIBS)
 msvc-static = yes
 
+[lz4]
+type = lib
+external-lib = $(SVN_LZ4_LIBS)
+
 [apr_memcache]
 type = lib
 external-lib = $(SVN_APR_MEMCACHE_LIBS)

Added: subversion/trunk/build/ac-macros/lz4.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/lz4.m4?rev=1803127&view=auto
==============================================================================
--- subversion/trunk/build/ac-macros/lz4.m4 (added)
+++ subversion/trunk/build/ac-macros/lz4.m4 Thu Jul 27 00:04:27 2017
@@ -0,0 +1,88 @@
+dnl ===================================================================
+dnl   Licensed to the Apache Software Foundation (ASF) under one
+dnl   or more contributor license agreements.  See the NOTICE file
+dnl   distributed with this work for additional information
+dnl   regarding copyright ownership.  The ASF licenses this file
+dnl   to you under the Apache License, Version 2.0 (the
+dnl   "License"); you may not use this file except in compliance
+dnl   with the License.  You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl   Unless required by applicable law or agreed to in writing,
+dnl   software distributed under the License is distributed on an
+dnl   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+dnl   KIND, either express or implied.  See the License for the
+dnl   specific language governing permissions and limitations
+dnl   under the License.
+dnl ===================================================================
+dnl
+dnl The default behaviour is to use pkg-config to look for an LZ4
+dnl library and if that fails to simply try linking -llz4.
+dnl
+dnl The user can specify --with-lz4=PREFIX to look in PREFIX or
+dnl --with-lz4=internal to use the internal copy of the LZ4 code.
+
+AC_DEFUN(SVN_LZ4,
+[
+  AC_ARG_WITH([lz4],
+    [AS_HELP_STRING([--with-lz4=PREFIX|internal],
+                    [look for lz4 in PREFIX or use the internal code])],
+    [lz4_prefix="$withval"],
+    [lz4_prefix=std])
+
+  if test "$lz4_prefix" = "internal"; then
+    AC_MSG_NOTICE([using internal lz4])
+    AC_DEFINE([SVN_INTERNAL_LZ4], [1],
+               [Define to use internal LZ4 code])
+  else
+    if test "$lz4_prefix" = "std"; then
+      SVN_LZ4_STD
+    else
+      SVN_LZ4_PREFIX
+    fi
+    if test "$lz4_found" != "yes"; then
+      AC_MSG_ERROR([Subversion requires LZ4])
+    fi
+  fi
+  AC_SUBST(SVN_LZ4_INCLUDES)
+  AC_SUBST(SVN_LZ4_LIBS)
+])
+
+AC_DEFUN(SVN_LZ4_STD,
+[
+  if test -n "$PKG_CONFIG"; then
+    AC_MSG_CHECKING([for lz4 library via pkg-config])
+    if $PKG_CONFIG liblz4 --exists; then
+      AC_MSG_RESULT([yes])
+      lz4_found=yes
+      SVN_LZ4_INCLUDES=`$PKG_CONFIG liblz4 --cflags`
+      SVN_LZ4_LIBS=`$PKG_CONFIG liblz4 --libs`
+      SVN_LZ4_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($SVN_LZ4_LIBS)`"
+    fi
+  else
+    AC_MSG_NOTICE([lz4 configuration without pkg-config])
+    AC_CHECK_LIB(lz4, LZ4_decompress_safe, [
+      AC_MSG_RESULT([yes])
+      lz4_found=yes
+      SVN_LZ4_LIBS="-llz4"
+    ])
+  fi
+])
+
+AC_DEFUN(SVN_LZ4_PREFIX,
+[
+  AC_MSG_NOTICE([lz4 configuration via prefix])
+  save_cppflags="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS -I$lz4_prefix/include"
+  save_ldflags="$LDFLAGS"
+  LDFLAGS="$LDFLAGS -L$lz4_prefix/lib"
+  AC_CHECK_LIB(lz4, LZ4_decompress_safe, [
+    AC_MSG_RESULT([yes])
+    lz4_found=yes
+    SVN_LZ4_INCLUDES="-I$lz4_prefix/include"
+    SVN_LZ4_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS(-L$lz4_prefix/lib)` -llz4"
+  ])
+  LDFLAGS="$save_ldflags"
+  CPPFLAGS="$save_cppflags"
+])

Modified: subversion/trunk/configure.ac
URL: http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1803127&r1=1803126&r2=1803127&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Thu Jul 27 00:04:27 2017
@@ -1216,6 +1216,8 @@ AS_HELP_STRING([--with-editor=PATH],
 
 SVN_LIB_Z
 
+SVN_LZ4
+
 MOD_ACTIVATION=""
 AC_ARG_ENABLE(mod-activation,
 AS_HELP_STRING([--enable-mod-activation],

Modified: subversion/trunk/subversion/libsvn_subr/compress.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/compress.c?rev=1803127&r1=1803126&r2=1803127&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/compress.c (original)
+++ subversion/trunk/subversion/libsvn_subr/compress.c Thu Jul 27 00:04:27 2017
@@ -25,13 +25,18 @@
 #include <string.h>
 #include <assert.h>
 #include <zlib.h>
-#include "lz4/lz4.h"
 
 #include "private/svn_subr_private.h"
 #include "private/svn_error_private.h"
 
 #include "svn_private_config.h"
 
+#if SVN_INTERNAL_LZ4
+#include "lz4/lz4internal.h"
+#else
+#include <lz4.h>
+#endif
+
 const char *
 svn_zlib__compiled_version(void)
 {

Modified: subversion/trunk/subversion/libsvn_subr/lz4/lz4.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/lz4/lz4.c?rev=1803127&r1=1803126&r2=1803127&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/lz4/lz4.c (original)
+++ subversion/trunk/subversion/libsvn_subr/lz4/lz4.c Thu Jul 27 00:04:27 2017
@@ -1,3 +1,5 @@
+#include "svn_private_config.h"
+#if SVN_INTERNAL_LZ4
 /*
    LZ4 - Fast LZ compression algorithm
    Copyright (C) 2011-2016, Yann Collet.
@@ -89,7 +91,7 @@
 /*-************************************
 *  Dependency
 **************************************/
-#include "lz4.h"
+#include "lz4internal.h"
 /* see also "memory routines" below */
 
 
@@ -1463,3 +1465,4 @@ int LZ4_decompress_fast_withPrefix64k(co
 }
 
 #endif   /* LZ4_COMMONDEFS_ONLY */
+#endif /* SVN_INTERNAL_LZ4 */

Copied: subversion/trunk/subversion/libsvn_subr/lz4/lz4internal.h (from r1803089, subversion/trunk/subversion/libsvn_subr/lz4/lz4.h)
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/lz4/lz4internal.h?p2=subversion/trunk/subversion/libsvn_subr/lz4/lz4internal.h&p1=subversion/trunk/subversion/libsvn_subr/lz4/lz4.h&r1=1803089&r2=1803127&rev=1803127&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/lz4/lz4.h (original)
+++ subversion/trunk/subversion/libsvn_subr/lz4/lz4internal.h Thu Jul 27 00:04:27 2017
@@ -1,3 +1,5 @@
+#include "svn_private_config.h"
+#if SVN_INTERNAL_LZ4
 /*
  *  LZ4 - Fast LZ compression algorithm
  *  Header File
@@ -461,3 +463,4 @@ LZ4_DEPRECATED("use LZ4_decompress_fast_
 #endif
 
 #endif /* LZ4_H_2983827168210 */
+#endif /* SVN_INTERNAL_LZ4 */

Modified: subversion/trunk/subversion/svn_private_config.hw
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn_private_config.hw?rev=1803127&r1=1803126&r2=1803127&view=diff
==============================================================================
--- subversion/trunk/subversion/svn_private_config.hw (original)
+++ subversion/trunk/subversion/svn_private_config.hw Thu Jul 27 00:04:27 2017
@@ -77,6 +77,9 @@
 /* The default HTTP library to use */
 #define DEFAULT_HTTP_LIBRARY "serf"
 
+/* Use the internal LZ4 code */
+#define SVN_INTERNAL_LZ4 1
+
 /* Define to the Python/C API format character suitable for apr_int64_t */
 #if defined(_WIN64)
 #define SVN_APR_INT64_T_PYCFMT "l"



Mime
View raw message