summaryrefslogtreecommitdiff
path: root/ext/extmk.rb.in
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-04-24 06:21:58 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-04-24 06:21:58 +0000
commit4dfc822aecf894a4903fbeda58d618d1cc6c5d6a (patch)
tree9c7c69da43556dc26f823cf476c2598b89ee8cb2 /ext/extmk.rb.in
parenteccb4d021056cd77393885c5889c7ea2003f606a (diff)
* 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 'ext/extmk.rb.in')
-rw-r--r--ext/extmk.rb.in49
1 files changed, 22 insertions, 27 deletions
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index 3b40772..9e454cc 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -338,21 +338,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)
@@ -609,23 +615,12 @@ def extmake(target)
$local_flags = "-link /INCREMENTAL:no /EXPORT:Init_$(TARGET)"
end
$LOCAL_LIBS = "" # to be assigned in extconf.rb
- 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 = ""
- $CPPFLAGS = idir || ""
+ $CPPFLAGS = ""
$LDFLAGS = ""
- $LIBPATH = [ldir].compact
+ $LIBPATH = []
+
+ dir_config("opt")
begin
Dir.mkdir target unless File.directory?(target)