From 59b2d551e89d56df06933a428c35cf0b03b264a4 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 30 Jul 2003 13:35:23 +0000 Subject: [PATCH] * lib/mkmf.rb (dir_config): allow multiple directories separated by File::PATH_SEPARATOR. * lib/mkmf.rb (create_makefile): DLDFLAGS include $LDFLAGS again. [ruby-talk:76894] * lib/mkmf.rb (init_mkmf): not default $LDFLAGS to LDFLAGS for ruby itself, but default $DLDFLAGS to DLDFLAGS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ lib/mkmf.rb | 31 ++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08b61733cb..0f611d0c52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Wed Jul 30 22:35:19 2003 Nobuyoshi Nakada + + * lib/mkmf.rb (dir_config): allow multiple directories separated + by File::PATH_SEPARATOR. + + * lib/mkmf.rb (create_makefile): DLDFLAGS include $LDFLAGS again. + [ruby-talk:76894] + + * lib/mkmf.rb (init_mkmf): not default $LDFLAGS to LDFLAGS for + ruby itself, but default $DLDFLAGS to DLDFLAGS. + Wed Jul 30 16:17:06 2003 Yukihiro Matsumoto * marshal.c (w_object): marshal_dump should not take any diff --git a/lib/mkmf.rb b/lib/mkmf.rb index cf8a0a1ff1..d56fe8896e 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -587,23 +587,32 @@ end def dir_config(target, idefault=nil, ldefault=nil) if dir = with_config(target + "-dir", (idefault unless ldefault)) - idefault = dir + "/include" - ldefault = dir + "/lib" + defaults = dir.split(File::PATH_SEPARATOR) + idefault = ldefault = nil end idir = with_config(target + "-include", idefault) ldir = with_config(target + "-lib", ldefault) - if idir - idircflag = "-I" + idir - unless Shellwords.shellwords($CPPFLAGS).include?(idircflag) - $CPPFLAGS = idircflag + " " + $CPPFLAGS + idirs = idir ? idir.split(File::PATH_SEPARATOR) : [] + if defaults + idirs.concat(defaults.collect {|dir| dir + "/include"}) + idir = ([idir] + idirs).compact.join(File::PATH_SEPARATOR) + end + unless idirs.empty? + idirs.collect! {|dir| "-I" + dir} + idirs -= Shellwords.shellwords($CPPFLAGS) + unless idirs.empty? + $CPPFLAGS = (idirs << $CPPFLAGS).join(" ") end end - if ldir - $LIBPATH.concat [ldir] unless $LIBPATH.include?(ldir) + ldirs = ldir ? ldir.split(File::PATH_SEPARATOR) : [] + if defaults + ldirs.concat(defaults.collect {|dir| dir + "/lib"}) + ldir = ([ldir] + ldirs).compact.join(File::PATH_SEPARATOR) end + $LIBPATH |= ldirs [idir, ldir] end @@ -651,7 +660,7 @@ LIBRUBYARG_STATIC = #$LIBRUBYARG_STATIC CFLAGS = #{CONFIG['CCDLFLAGS'] unless $static} #$CFLAGS CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) #{$defs.join(" ")} #{$CPPFLAGS} CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']} -DLDFLAGS = #{CONFIG['DLDFLAGS']} #$DLDFLAGS +DLDFLAGS = #$LDFLAGS #{CONFIG['DLDFLAGS']} #$DLDFLAGS LDSHARED = #{CONFIG['LDSHARED']} AR = #{CONFIG['AR']} EXEEXT = #{CONFIG['EXEEXT']} @@ -871,9 +880,9 @@ def init_mkmf(config = CONFIG) $defs = [] $CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).dup $CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", config["CPPFLAGS"])).dup - $LDFLAGS = with_config("ldflags", arg_config("LDFLAGS", config["LDFLAGS"])).dup + $LDFLAGS = (with_config("ldflags") || "").dup $INCFLAGS = "-I#{$topdir}" - $DLDFLAGS = "" + $DLDFLAGS = (arg_config("DLDFLAGS") || "").dup $LIBEXT = config['LIBEXT'].dup $OBJEXT = config["OBJEXT"].dup $LIBS = "#{config['LIBS']} #{config['DLDLIBS']}"