From: Vladislav Shchapov Date: Sun, 23 Feb 2025 15:42:41 +0000 (+0500) Subject: Restore support macOS prior 10.15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bed7b2097c1533129e7e3622f27888ac7fd7ed6c;p=thirdparty%2Fzlib-ng.git Restore support macOS prior 10.15 Signed-off-by: Vladislav Shchapov --- diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 90e222a6..99adb45f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -570,6 +570,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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 36741306..4f058f09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -425,10 +425,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") diff --git a/configure b/configure index 3487d092..ea7c0969 100755 --- a/configure +++ b/configure @@ -714,6 +714,18 @@ else fi echo >> configure.log +# Check for -Wunguarded-availability-new compiler support +echo "" > test.c + cat > $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 < @@ -724,7 +736,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"