diff options
author | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-10 09:30:50 +0000 |
---|---|---|
committer | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-10 09:30:50 +0000 |
commit | 0618c23e7803251ceae36e9e5cb8e7a01633c23f (patch) | |
tree | d9d85aae01336d981a3bd2e8f7aa86f887653641 /lib/mkmf.rb | |
parent | 7687b581711d93a356b81f8a78be78abfeebf29e (diff) | |
download | ruby-0618c23e7803251ceae36e9e5cb8e7a01633c23f.tar.gz ruby-0618c23e7803251ceae36e9e5cb8e7a01633c23f.tar.xz ruby-0618c23e7803251ceae36e9e5cb8e7a01633c23f.zip |
* ext/extmk.rb, lib/mkmf.rb ($INCFLAGS): new var for -I$(topdir).
* lib/mkmf.rb: add #define WIN32_LEAN_AND_MEAN to improve compile
times.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r-- | lib/mkmf.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index fb2ce78ee..1e6a14481 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -68,7 +68,7 @@ else STDERR.print "can't find header files for ruby.\n" exit 1 end -$topdir = $top_srcdir = $hdrdir +$topdir = $hdrdir # $hdrdir.gsub!('/', '\\') if RUBY_PLATFORM =~ /mswin32|bccwin32/ CFLAGS = CONFIG["CFLAGS"] @@ -89,9 +89,9 @@ else CPPOUTFILE = '-o conftest.i' end -$LINK = "#{CONFIG['CC']} #{OUTFLAG}conftest -I#{$hdrdir} -I#{$top_srcdir} #{CFLAGS} %s %s #{CONFIG['LDFLAGS']} %s conftest.c %s %s #{CONFIG['LIBS']}" -$CC = "#{CONFIG['CC']} -c #{CONFIG['CPPFLAGS']} %s -I#{$hdrdir} -I#{$top_srcdir} #{CFLAGS} %s %s conftest.c" -$CPP = "#{CONFIG['CPP']} #{CONFIG['CPPFLAGS']} %s -I#{$hdrdir} -I#{$top_srcdir} #{CFLAGS} %s %s %s conftest.c" +$LINK = "#{CONFIG['CC']} #{OUTFLAG}conftest %s -I#{$hdrdir} %s #{CFLAGS} %s #{CONFIG['LDFLAGS']} %s conftest.c %s %s #{CONFIG['LIBS']}" +$CC = "#{CONFIG['CC']} -c #{CONFIG['CPPFLAGS']} %s -I#{$hdrdir} %s #{CFLAGS} %s %s conftest.c" +$CPP = "#{CONFIG['CPP']} #{CONFIG['CPPFLAGS']} %s -I#{$hdrdir} %s #{CFLAGS} %s %s %s conftest.c" def rm_f(*files) targets = [] @@ -175,7 +175,7 @@ def try_link0(src, opt="") $LIBPATH.each {|d| $LDFLAGS << " -L" + d} end begin - xsystem(format($LINK, $CFLAGS, $CPPFLAGS, $LDFLAGS, opt, $LOCAL_LIBS)) + xsystem(format($LINK, $INCFLAGS, $CPPFLAGS, $CFLAGS, $LDFLAGS, opt, $LOCAL_LIBS)) ensure $LDFLAGS = ldflags ENV['LIB'] = ORIG_LIBPATH if /mswin32|bccwin32/ =~ RUBY_PLATFORM @@ -198,7 +198,7 @@ def try_compile(src, opt="") cfile.print src cfile.close begin - xsystem(format($CC, $CPPFLAGS, $CFLAGS, opt)) + xsystem(format($CC, $INCFLAGS, $CPPFLAGS, $CFLAGS, opt)) ensure rm_f "conftest*" end @@ -209,7 +209,7 @@ def try_cpp(src, opt="") cfile.print src cfile.close begin - xsystem(format($CPP, $CPPFLAGS, $CFLAGS, CPPOUTFILE, opt)) + xsystem(format($CPP, $INCFLAGS, $CPPFLAGS, $CFLAGS, CPPOUTFILE, opt)) ensure rm_f "conftest*" end @@ -220,7 +220,7 @@ def egrep_cpp(pat, src, opt="") cfile.print src cfile.close begin - xpopen(format($CPP, $CFLAGS, $CPPFLAGS, '', opt)) do |f| + xpopen(format($CPP, $INCFLAGS, $CPPFLAGS, $CFLAGS, '', opt)) do |f| if Regexp === pat puts(" ruby -ne 'print if /#{pat.source}/'") f.grep(pat) {|l| @@ -335,6 +335,7 @@ def have_library(lib, func="main") return true end r = try_link(<<"SRC", libs) +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock.h> int main() { return 0; } @@ -342,6 +343,7 @@ int t() { #{func}(); return 0; } SRC unless r r = try_link(<<"SRC", libs) +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock.h> int main() { return 0; } @@ -395,6 +397,7 @@ def have_func(func, header=nil) src = if /mswin32|bccwin32|mingw/ =~ RUBY_PLATFORM r = <<"SRC" +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock.h> SRC @@ -445,6 +448,7 @@ def have_struct_member(type, member, header=nil) src = if /mswin32|bccwin32|mingw/ =~ RUBY_PLATFORM r = <<"SRC" +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock.h> SRC @@ -856,6 +860,7 @@ $CFLAGS = with_config("cflags", arg_config("CFLAGS", "")) $CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", "")) $LDFLAGS = with_config("ldflags", arg_config("LDFLAGS", "")) $LIBPATH = [] +$INCFLAGS = "" dir_config("opt") |