]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Restore support macOS prior 10.15
authorVladislav Shchapov <vladislav@shchapov.ru>
Sun, 23 Feb 2025 15:42:41 +0000 (20:42 +0500)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 1 Mar 2025 15:45:04 +0000 (16:45 +0100)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
.github/workflows/cmake.yml
CMakeLists.txt
configure

index a59aca64348871e79191fdf95b46f7f0b77e6ca0..b662f3932ec2266e8896cfe4c3501df43689dc80 100644 (file)
@@ -577,6 +577,13 @@ jobs:
             cmake-args: -G Ninja -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF
             codecov: win64_gcc_compat_no_opt
 
+          - name: macOS Clang (Target 10.10)
+            os: macos-13
+            compiler: clang
+            cxx-compiler: clang++
+            cmake-args: -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10
+            ldflags: -ld_classic
+
           - name: macOS Clang ASAN
             os: macos-13
             compiler: clang
index a4f07481aef0040fecf0dbfc4918d915523247b4..f1bc7ba4cec1f3a39a0949c5fa07fefb98f020a7 100644 (file)
@@ -436,10 +436,18 @@ endif()
 set(CMAKE_REQUIRED_DEFINITIONS)
 
 set(CMAKE_REQUIRED_DEFINITIONS -D_ISOC11_SOURCE=1)
+set(CMAKE_REQUIRED_FLAGS)
+if(APPLE)
+    check_c_compiler_flag(-Wunguarded-availability-new HAVE_W_UNGUARDED_AVAILABILITY_NEW)
+    if(HAVE_W_UNGUARDED_AVAILABILITY_NEW)
+        set(CMAKE_REQUIRED_FLAGS "-Wunguarded-availability-new -Werror")
+    endif()
+endif()
 check_symbol_exists(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
 if(HAVE_ALIGNED_ALLOC)
     add_definitions(-DHAVE_ALIGNED_ALLOC)
 endif()
+set(CMAKE_REQUIRED_FLAGS)
 set(CMAKE_REQUIRED_DEFINITIONS)
 
 if(WITH_SANITIZER STREQUAL "Address")
index 51762932498d5255e75a118ceaa661a3f74289a0..f68e243eae1c22ea67dd40be8f49c6a1c800d0f4 100755 (executable)
--- a/configure
+++ b/configure
@@ -718,6 +718,18 @@ else
 fi
 echo >> configure.log
 
+# Check for -Wunguarded-availability-new compiler support
+echo "" > test.c
+  cat > $test.c <<EOF
+int main() { return 0; }
+EOF
+if $cc $CFLAGS -Wunguarded-availability-new -c $test.c >> configure.log 2>&1; then
+  echo "Checking for -Wunguarded-availability-new... Yes." | tee -a configure.log
+  TEST_ALIGNED_ALLOC_FLAGS="$TEST_ALIGNED_ALLOC_FLAGS -Wunguarded-availability-new -Werror"
+else
+  echo "Checking for -Wunguarded-availability-new... No." | tee -a configure.log
+fi
+
 cat > $test.c <<EOF
 #define _ISOC11_SOURCE 1
 #include <stdlib.h>
@@ -728,7 +740,7 @@ int main(void) {
   return 0;
 }
 EOF
-if try $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then
+if try $CC $CFLAGS $TEST_ALIGNED_ALLOC_FLAGS -o $test $test.c $LDSHAREDLIBC; then
   echo "Checking for aligned_alloc... Yes." | tee -a configure.log
   CFLAGS="${CFLAGS} -DHAVE_ALIGNED_ALLOC"
   SFLAGS="${SFLAGS} -DHAVE_ALIGNED_ALLOC"