summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--ext/extmk.rb.in49
-rw-r--r--lib/mkmf.rb48
3 files changed, 52 insertions, 53 deletions
diff --git a/ChangeLog b/ChangeLog
index 976f9ab947..7bb838f49d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Apr 24 15:18:49 2001 Akinori MUSHA <knu@iDaemons.org>
+
+ * 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].
+
Sun Apr 22 17:44:37 2001 WATANABE Hirofumi <eban@ruby-lang.org>
* configure.in: add -mieee to CFLAGS on Linux/Alpha
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index 3b40772bf3..9e454cc429 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)
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")