Merge pull request #1022 from lz4/uname

make UNAME externally definable
This commit is contained in:
Yann Collet 2021-09-20 16:04:07 -07:00 committed by GitHub
commit e2009622dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 14 deletions

View File

@ -109,7 +109,7 @@ cmake:
endif # POSIX_ENV endif # POSIX_ENV
ifneq (,$(filter MSYS%,$(shell uname))) ifneq (,$(filter MSYS%,$(shell $(UNAME))))
HOST_OS = MSYS HOST_OS = MSYS
CMAKE_PARAMS = -G"MSYS Makefiles" CMAKE_PARAMS = -G"MSYS Makefiles"
endif endif

View File

@ -30,7 +30,9 @@
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c # - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
# ################################################################ # ################################################################
TARGET_OS ?= $(shell uname) UNAME ?= uname
TARGET_OS ?= $(shell $(UNAME))
ifeq ($(TARGET_OS),) ifeq ($(TARGET_OS),)
TARGET_OS ?= $(OS) TARGET_OS ?= $(OS)
endif endif
@ -67,7 +69,7 @@ WINDRES = windres
endif endif
#determine if dev/nul based on host environment #determine if dev/nul based on host environment
ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell uname))) ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME))))
VOID := /dev/null VOID := /dev/null
else else
ifneq (,$(filter Windows%,$(OS))) ifneq (,$(filter Windows%,$(OS)))
@ -77,7 +79,7 @@ VOID := /dev/null
endif endif
endif endif
ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW% CYGWIN% MSYS%,$(shell uname))) ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW% CYGWIN% MSYS%,$(shell $(UNAME))))
POSIX_ENV = Yes POSIX_ENV = Yes
else else
POSIX_ENV = No POSIX_ENV = No
@ -87,7 +89,7 @@ endif
ifeq ($(WINBASED),yes) ifeq ($(WINBASED),yes)
LN_SF = cp -p LN_SF = cp -p
else else
ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell uname))) ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME))))
LN_SF = cp -p LN_SF = cp -p
else else
ifneq (,$(filter Windows%,$(OS))) ifneq (,$(filter Windows%,$(OS)))
@ -98,7 +100,7 @@ LN_SF = ln -sf
endif endif
endif endif
ifneq (,$(filter $(shell uname),SunOS)) ifneq (,$(filter $(shell $(UNAME)),SunOS))
INSTALL ?= ginstall INSTALL ?= ginstall
else else
INSTALL ?= install INSTALL ?= install

View File

@ -393,7 +393,7 @@ int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
<pre><b></b><p> <pre><b></b><p>
It's possible to have input and output sharing the same buffer, It's possible to have input and output sharing the same buffer,
for highly contrained memory environments. for highly constrained memory environments.
In both cases, it requires input to lay at the end of the buffer, In both cases, it requires input to lay at the end of the buffer,
and decompression to start at beginning of the buffer. and decompression to start at beginning of the buffer.
Buffer size must feature some margin, hence be larger than final size. Buffer size must feature some margin, hence be larger than final size.
@ -459,7 +459,7 @@ int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
size_t prefixSize; size_t prefixSize;
} LZ4_streamDecode_t_internal; } LZ4_streamDecode_t_internal;
</b></pre><BR> </b></pre><BR>
<pre><b>#define LZ4_STREAMSIZE 16416 </b>/* static size, for inter-version compatibility */<b> <pre><b>#define LZ4_STREAMSIZE ((1UL << LZ4_MEMORY_USAGE) + 32) </b>/* static size, for inter-version compatibility */<b>
#define LZ4_STREAMSIZE_VOIDP (LZ4_STREAMSIZE / sizeof(void*)) #define LZ4_STREAMSIZE_VOIDP (LZ4_STREAMSIZE / sizeof(void*))
union LZ4_stream_u { union LZ4_stream_u {
void* table[LZ4_STREAMSIZE_VOIDP]; void* table[LZ4_STREAMSIZE_VOIDP];

View File

@ -140,7 +140,8 @@ LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx);
The version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL. The version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL.
The function will provide a pointer to a fully allocated LZ4F_cctx object. The function will provide a pointer to a fully allocated LZ4F_cctx object.
If @return != zero, there was an error during context creation. If @return != zero, there was an error during context creation.
Object can release its memory using LZ4F_freeCompressionContext(); Object can be released using LZ4F_freeCompressionContext();
Note: LZ4F_freeCompressionContext() works with NULL pointers (do nothing).
</p></pre><BR> </p></pre><BR>
@ -182,8 +183,7 @@ LZ4F_errorCode_t LZ4F_freeCompressionContext(LZ4F_cctx* cctx);
Important rule: dstCapacity MUST be large enough to ensure operation success even in worst case situations. Important rule: dstCapacity MUST be large enough to ensure operation success even in worst case situations.
This value is provided by LZ4F_compressBound(). This value is provided by LZ4F_compressBound().
If this condition is not respected, LZ4F_compress() will fail (result is an errorCode). If this condition is not respected, LZ4F_compress() will fail (result is an errorCode).
LZ4F_compressUpdate() doesn't guarantee error recovery. After an error, the state is left in a UB state, and must be re-initialized or freed.
When an error occurs, compression context must be freed or resized.
`cOptPtr` is optional : NULL can be provided, in which case all options are set to default. `cOptPtr` is optional : NULL can be provided, in which case all options are set to default.
@return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered). @return : number of bytes written into `dstBuffer` (it can be zero, meaning input data was just buffered).
or an error code if it fails (which can be tested using LZ4F_isError()) or an error code if it fails (which can be tested using LZ4F_isError())

View File

@ -55,7 +55,8 @@ CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
include ../Makefile.inc include ../Makefile.inc
ifeq ($(TARGET_OS)$(shell uname -r),SunOS5.10) OS_VERSION ?= $(UNAME) -r
ifeq ($(TARGET_OS)$(shell $(OS_VERSION)),SunOS5.10)
LDFLAGS += -lrt LDFLAGS += -lrt
endif endif

View File

@ -145,14 +145,14 @@ checkTag: checkTag.c $(LZ4DIR)/lz4.h
ifeq ($(POSIX_ENV),Yes) ifeq ($(POSIX_ENV),Yes)
MD5:=md5sum MD5:=md5sum
ifneq (,$(filter $(shell uname), Darwin )) ifneq (,$(filter $(shell $(UNAME)), Darwin ))
MD5:=md5 -r MD5:=md5 -r
endif endif
# note : we should probably settle on a single compare utility # note : we should probably settle on a single compare utility
CMP:=cmp CMP:=cmp
DIFF:=diff DIFF:=diff
ifneq (,$(filter $(shell uname),SunOS)) ifneq (,$(filter $(shell $(UNAME)),SunOS))
DIFF:=gdiff DIFF:=gdiff
endif endif