]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Tell compiler to adhere to C99 standards.
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Tue, 30 Oct 2018 08:46:59 +0000 (09:46 +0100)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Tue, 30 Oct 2018 08:55:14 +0000 (09:55 +0100)
Exception being newer cmake versions that will decay to gnu99 in
certain situations. This decay currently hides a warning in minigzip,
but using C99 with C_STANDARD_REQUIRED on could potentially introduce
unknown problems on other platforms, so for now we will allow this decay.

CMakeLists.txt
configure

index 86dbfd2eab4a0065b3576011051a4ab37e7919c8..dc416e0068818995f4a5104e973d880715ccb15a 100644 (file)
@@ -20,6 +20,15 @@ include(CheckCSourceCompiles)
 include(CheckCSourceRuns)
 include(FeatureSummary)
 
+# Enable C99
+if (CMAKE_VERSION VERSION_LESS "3.1")
+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+        set (CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
+    endif ()
+else ()
+    set (CMAKE_C_STANDARD 99)
+endif ()
+
 # make sure we use an appropriate BUILD_TYPE by default, "Release" to be exact
 # this should select the maximum generic optimisation on the current platform (i.e. -O3 for gcc/clang)
 if(NOT CMAKE_BUILD_TYPE)
index 6916880ec580fcc8619b2b044e1e29a1e03addf3..61c6282c69c78a145734e1c724bb5d355f4e6cf1 100755 (executable)
--- a/configure
+++ b/configure
@@ -257,6 +257,7 @@ show $cc -c $test.c
 if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then
   echo ... using gcc >> configure.log
   CC="$cc"
+  CFLAGS="${CFLAGS} -std=c99"
   # Re-check arch if gcc is a cross-compiler
   GCC_ARCH=`$CC -dumpmachine | sed 's/-.*//g'`
   case $GCC_ARCH in