From 0a2bf5f1e256de7f030668c6130379cbd0d6d708 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 9 Jan 2023 18:41:02 +0900 Subject: [PATCH] [ruby/zlib] Check for functions with arguments and the header With arguments, mkmf skips compilation check for the function as RHS. https://github.com/ruby/zlib/commit/9ed9d6d36e --- ext/zlib/extconf.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb index 5477f49178..1254c62a17 100644 --- a/ext/zlib/extconf.rb +++ b/ext/zlib/extconf.rb @@ -11,10 +11,9 @@ require 'rbconfig' dir_config 'zlib' libs = $libs -if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and - have_header('zlib.h') then - have_zlib = true -else +have_zlib = %w'z libz zlib1 zlib zdll zlibwapi'.any? {|z| have_library(z, 'deflateReset(NULL)', 'zlib.h')} + +unless have_zlib $libs = libs unless File.directory?(zsrc = "#{$srcdir}/zlib") dirs = Dir.open($srcdir) {|z| z.grep(/\Azlib-\d+[.\d]*\z/) {|x|"#{$srcdir}/#{x}"}}