summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Sauthoff <mail@georg.so>2016-08-27 08:47:50 (GMT)
committerGeorg Sauthoff <mail@georg.so>2016-08-27 13:24:50 (GMT)
commit681d5010d53cc2631ad96afa5dfc7ea70f13e5de (patch)
treebe253ab252efdf971f3e4e49dc144b7ac8be80fe
parent584e1fe92ade602404d668a9d83e9264709d5dbe (diff)
downloadlz4-681d5010d53cc2631ad96afa5dfc7ea70f13e5de.zip
lz4-681d5010d53cc2631ad96afa5dfc7ea70f13e5de.tar.gz
lz4-681d5010d53cc2631ad96afa5dfc7ea70f13e5de.tar.bz2
use gnu c99 to get both c99 and POSIX
when compiling with gcc fixes fileno() implicitly defined on Linx and compile error on Solaris 10
-rw-r--r--cmake_unofficial/CMakeLists.txt22
-rw-r--r--examples/Makefile2
-rw-r--r--lib/Makefile2
3 files changed, 14 insertions, 12 deletions
diff --git a/cmake_unofficial/CMakeLists.txt b/cmake_unofficial/CMakeLists.txt
index 3f113b1..af39cb0 100644
--- a/cmake_unofficial/CMakeLists.txt
+++ b/cmake_unofficial/CMakeLists.txt
@@ -92,21 +92,23 @@ endif()
#warnings
if(MSVC)
-ADD_DEFINITIONS("-W4")
+ ADD_DEFINITIONS("-W4")
endif()
if(GNU_COMPATIBLE_COMPILER)
-ADD_DEFINITIONS("-Wall")
+ ADD_DEFINITIONS("-Wall")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
-ADD_DEFINITIONS("-Wextra")
-ADD_DEFINITIONS("-Wundef")
-ADD_DEFINITIONS("-Wshadow")
-ADD_DEFINITIONS("-Wcast-align")
-ADD_DEFINITIONS("-Wstrict-prototypes")
+ ADD_DEFINITIONS("-Wextra")
+ ADD_DEFINITIONS("-Wundef")
+ ADD_DEFINITIONS("-Wshadow")
+ ADD_DEFINITIONS("-Wcast-align")
+ ADD_DEFINITIONS("-Wstrict-prototypes")
endif(CMAKE_COMPILER_IS_GNUCXX)
-if(GNU_COMPATIBLE_COMPILER AND
- (NOT CMAKE_SYSTEM_NAME MATCHES "SunOS"))
-ADD_DEFINITIONS("-std=c99")
+if(GNU_COMPATIBLE_COMPILER)
+ # we need gnu99 instead of c99 on Linux and Solaris
+ # to get C99 and POSIX definitions
+ # an alternative with cmake >= 3.1/3.2 is the C_STANDARD property
+ ADD_DEFINITIONS("-std=gnu99")
endif()
ADD_DEFINITIONS("-DLZ4_VERSION=\"${CPACK_PACKAGE_VERSION_PATCH}\"")
INCLUDE_DIRECTORIES (${LZ4_DIR})
diff --git a/examples/Makefile b/examples/Makefile
index 1e4f075..c8caf24 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -28,7 +28,7 @@
# ##########################################################################
CFLAGS ?= -O3
-CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes
+CFLAGS += -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes
FLAGS := -I../lib $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
TESTFILE= Makefile
diff --git a/lib/Makefile b/lib/Makefile
index 879d2b3..52e0f95 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -41,7 +41,7 @@ DESTDIR?=
PREFIX ?= /usr/local
CPPFLAGS= -DXXH_NAMESPACE=LZ4_
CFLAGS ?= -O3
-CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wcast-qual -Wstrict-prototypes -pedantic
+CFLAGS += -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wcast-qual -Wstrict-prototypes -pedantic
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
LIBDIR?= $(PREFIX)/lib