diff --git a/lib/pkg-config.rb b/lib/pkg-config.rb index 542d67c..12bf118 100644 --- a/lib/pkg-config.rb +++ b/lib/pkg-config.rb @@ -120,11 +120,11 @@ def have_package(pkg, major=nil, minor=0, micro=0) Shellwords.shellwords(libraries)) dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(" ") $libs += " " + libraries - if /mswin/ =~ RUBY_PLATFORM - $DLDFLAGS += " " + dldflags - else - $LDFLAGS += " " + dldflags - end + # mkmf uses $LDFLAGS for both have_func()/try_link() and the + # final link (mswin's Makefile puts $(ldflags) into DLDFLAGS + # too), so /libpath: must go there on mswin as well. With + # $DLDFLAGS only, every link check against the package fails. + $LDFLAGS += " " + dldflags $CFLAGS += " " + cflags_only_other(pkg) if defined?($CXXFLAGS) $CXXFLAGS += " " + cflags_only_other(pkg)