Bug #3834: ext/openssl fails to build in certain scenarios due to misorde=
red pkg-config check
http://redmine.ruby-lang.org/issues/show/3834

Author: Erik Hollensbe
Status: Open, Priority: Normal
Category: build, Target version: 1.9.3
ruby -v: HEAD

If mkmf via ext/openssl/extconf.rb is allowed to search for both headers =
and libs before consulting pkg-config, multiple installations of openssl =
will cause trouble during build time.

This is evident on my OS X 10.6 system with macports, gcc 4.2.1 from macp=
orts, openssl 1.0.0a from macports, and openssl 0.9.x provided by OS X. T=
he problem appears at a glance is that it will locate the 1.0 headers fir=
st, the 0.9 libs first, and then prepare the conftest programs with impro=
per ldflags based on its findings.

It's entirely probable there's a deeper autoconf, rbconfig, mkmf, or comp=
iler issue that I am missing, but the solution I found is in the attached=
 patch, which is to run pkg_config first, and in the event it fails, fall=
 back to the default header / lib search that was previously in place. I =
think this will work for situations where pkg-config isn't available for =
openssl, but I was unable to test that case.


----------------------------------------
http://redmine.ruby-lang.org
H4sICBEokUwAA3NzbF9jb21waWxlX2ZpeC5wYXRjaACtk9Fv0zAQxt/9V3xE
MFZlyZo0qniJmITEE4iHPQ4UXeNLYjVziu2urRj/OxfaFbGpaAIsWbbuPv98
98nWpmmQJK0JoEvehsthxdb7ftzXg21St8DiREIZq3mLN9k0z4ssTef1nDTl
yKbTeVGoJElOMlUcx6e5V1dIitlFliEelwISMA1e3hrbbhSAju646s3Ckdud
Rxs/1MtZHk2eplpt9gm2WiWO/boPKPeijkmzO48eCpCZdqJ9kJ2dlXi1uand
bhUGCJJpN8u/pGR3b/HtXgL3v98m6wWiT4K7vv5QkdYV9X2lTcs++Gjy/TFZ
LoTM52FH5CFSGWvCT56Y8mLPVAmwtj17j9WyrUYnTXvsLZqArP5z27GKj/78
LQJQ8aGKQ1kSep7rv4T/3/cn7H92Pj66fegT47iVALWMqCxLvOu4XsqDRTM4
UX1dG8caPqzlwzVketYpRPfZRo8Of6QlN5LHhrx9HVA7pjCq35stQsdg5wbn
QYvhjtPjed7KH87UD3mw6pvRAwAA