From 56ddf3826189dad5ddedc2495b260382507c990a Mon Sep 17 00:00:00 2001 From: yamadapc Date: Tue, 4 Aug 2020 19:32:00 +1000 Subject: [PATCH] Fix zlib compilation on conan and AppleClang 12.0 I'm not sure what these replaces were doing. Disabled them if on AppleClang 12.0 or higher. Related to: - https://github.com/boostorg/build/issues/638 - https://github.com/madler/zlib/pull/509 --- recipes/zlib/1.2.11/conanfile.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/recipes/zlib/1.2.11/conanfile.py b/recipes/zlib/1.2.11/conanfile.py index 1dfd622f9b9a4..6646da497eeb4 100644 --- a/recipes/zlib/1.2.11/conanfile.py +++ b/recipes/zlib/1.2.11/conanfile.py @@ -89,15 +89,18 @@ def _build_zlib(self): tools.replace_in_file('gzguts.h', '#if defined(_WIN32) || defined(__CYGWIN__)', '#if defined(_WIN32) || defined(__MINGW32__)') - for filename in ['zconf.h', 'zconf.h.cmakein', 'zconf.h.in']: - tools.replace_in_file(filename, - '#ifdef HAVE_UNISTD_H ' - '/* may be set to #if 1 by ./configure */', - '#if defined(HAVE_UNISTD_H) && (1-HAVE_UNISTD_H-1 != 0)') - tools.replace_in_file(filename, - '#ifdef HAVE_STDARG_H ' - '/* may be set to #if 1 by ./configure */', - '#if defined(HAVE_STDARG_H) && (1-HAVE_STDARG_H-1 != 0)') + + is_apple_clang12 = self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) >= "12.0" + if not is_apple_clang12: + for filename in ['zconf.h', 'zconf.h.cmakein', 'zconf.h.in']: + tools.replace_in_file(filename, + '#ifdef HAVE_UNISTD_H ' + '/* may be set to #if 1 by ./configure */', + '#if defined(HAVE_UNISTD_H) && (1-HAVE_UNISTD_H-1 != 0)') + tools.replace_in_file(filename, + '#ifdef HAVE_STDARG_H ' + '/* may be set to #if 1 by ./configure */', + '#if defined(HAVE_STDARG_H) && (1-HAVE_STDARG_H-1 != 0)') tools.mkdir("_build") with tools.chdir("_build"): if self._use_autotools: