diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-24 06:21:58 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-24 06:21:58 +0000 |
commit | 4dfc822aecf894a4903fbeda58d618d1cc6c5d6a (patch) | |
tree | 9c7c69da43556dc26f823cf476c2598b89ee8cb2 /lib | |
parent | eccb4d021056cd77393885c5889c7ea2003f606a (diff) | |
download | ruby-4dfc822aecf894a4903fbeda58d618d1cc6c5d6a.tar.gz |
* ext/extmk.rb.in, lib/mkmf.rb: (dir_config) do not add the
specified include directory if already included in $CPPFLAGS.
* ext/extmk.rb.in, lib/mkmf.rb: (dir_config) return a more useful
value, [include_dir, lib_dir].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mkmf.rb | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index a9ce9b55bb..d1f830aca6 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -336,21 +336,27 @@ def dir_config(target, idefault=nil, ldefault=nil) idefault = default + "/include" ldefault = default + "/lib" end - dir = with_config("%s-dir"%target, default) - if dir - idir = " -I"+dir+"/include" - ldir = dir+"/lib" - end - unless idir - dir = with_config("%s-include"%target, idefault) - idir = " -I"+dir if dir + + dir = with_config(target + "-dir", default) + + idir, ldir = if dir then [ + dir + "/include", + dir + "/lib" + ] else [ + with_config(target + "-include", idefault), + with_config(target + "-lib", ldefault) + ] end + + if idir + idircflag = "-I" + idir + $CPPFLAGS += " " + idircflag unless $CPPFLAGS.split.include?(idircflag) end - unless ldir - ldir = with_config("%s-lib"%target, ldefault) + + if ldir + $LIBPATH << ldir unless $LIBPATH.include?(ldir) end - $CPPFLAGS += idir if idir - $LIBPATH |= [ldir] if ldir + [idir, ldir] end def create_makefile(target, srcdir = File.dirname($0)) @@ -581,20 +587,10 @@ $LOCAL_LIBS = "" $defs = [] $make = with_config("make-prog", ENV["MAKE"] || "make") -dir = with_config("opt-dir") -if dir - idir = "-I"+dir+"/include" - ldir = dir+"/lib" -end -unless idir - dir = with_config("opt-include") - idir = "-I"+dir if dir -end -unless ldir - ldir = with_config("opt-lib") -end $CFLAGS = with_config("cflags", "") -$CPPFLAGS = [with_config("cppflags", ""), idir].compact.join(" ") +$CPPFLAGS = with_config("cppflags", "") $LDFLAGS = with_config("ldflags", "") -$LIBPATH = [ldir].compact +$LIBPATH = [] + +dir_config("opt") |