diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-08 16:55:59 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-08 17:00:12 +0900 |
commit | c54d5872fbd95c04ab77b4c1d6f95974ddac0090 (patch) | |
tree | 2a6ce8400cb42cd43804a28954181c5e62668028 /lib | |
parent | a1bab3d1a3bf36e113267c212d7fb36710859674 (diff) | |
download | ruby-c54d5872fbd95c04ab77b4c1d6f95974ddac0090.tar.gz |
Configure directories for headers and libraries automatically
[EXPERIMENTAL]
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mkmf.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index cc22cf6151..ea5a8ac2ce 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -1007,6 +1007,7 @@ SRC # <code>--with-FOOlib</code> configuration option. # def have_library(lib, func = nil, headers = nil, opt = "", &b) + dir_config(lib) lib = with_config(lib+'lib', lib) checking_for checking_message(func && func.funcall_style, LIBARG%lib, opt) do if COMMON_LIBS.include?(lib) @@ -1032,6 +1033,7 @@ SRC # library paths searched and linked against. # def find_library(lib, func, *paths, &b) + dir_config(lib) lib = with_config(lib+'lib', lib) paths = paths.collect {|path| path.split(File::PATH_SEPARATOR)}.flatten checking_for checking_message(func && func.funcall_style, LIBARG%lib) do @@ -1105,6 +1107,7 @@ SRC # +HAVE_FOO_H+ preprocessor macro would be passed to the compiler. # def have_header(header, preheaders = nil, opt = "", &b) + dir_config(header[/.*?(?=\/)|.*?(?=\.)/]) checking_for header do if try_header(cpp_include(preheaders)+cpp_include(header), opt, &b) $defs.push(format("-DHAVE_%s", header.tr_cpp)) @@ -1748,6 +1751,10 @@ SRC # application. # def dir_config(target, idefault=nil, ldefault=nil) + if conf = $config_dirs[target] + return conf + end + if dir = with_config(target + "-dir", (idefault unless ldefault)) defaults = Array === dir ? dir : dir.split(File::PATH_SEPARATOR) idefault = ldefault = nil @@ -1778,7 +1785,7 @@ SRC end $LIBPATH = ldirs | $LIBPATH - [idir, ldir] + $config_dirs[target] = [idir, ldir] end # Returns compile/link information about an installed library in a @@ -2507,6 +2514,8 @@ site-install-rb: install-rb $enable_shared = config['ENABLE_SHARED'] == 'yes' $defs = [] $extconf_h = nil + $config_dirs = {} + if $warnflags = CONFIG['warnflags'] and CONFIG['GCC'] == 'yes' # turn warnings into errors only for bundled extensions. config['warnflags'] = $warnflags.gsub(/(\A|\s)-Werror[-=]/, '\1-W') @@ -2565,6 +2574,7 @@ site-install-rb: install-rb $extout_prefix ||= nil $arg_config.clear + $config_dirs.clear dir_config("opt") end |