From c4c770ecb2cfc6a7b213812cfd0b1f56bff000a4 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 25 May 2006 23:44:08 +0000 Subject: * ruby.h, lib/mkmf.rb (create_header): clear command line options for macros moved to extconf.h. * ext/extmk.rb (extract_makefile, extmk): made RUBY_EXTCONF_H and EXTSTATIC permanent. * ext/{dbm,digest/*,socket,zlib}/extconf.rb: used $defs and $INCFLAGS. * {bcc32,win32,wince}/Makefile.sub (COMPILE_C, COMPILE_CXX): added $(INCFLAGS). git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/dbm/extconf.rb | 2 +- ext/digest/md5/extconf.rb | 3 +- ext/digest/rmd160/extconf.rb | 3 +- ext/digest/sha1/extconf.rb | 3 +- ext/digest/sha2/extconf.rb | 3 +- ext/extmk.rb | 8 +++- ext/socket/extconf.rb | 97 ++++++++++++++++---------------------------- ext/socket/socket.c | 2 +- ext/zlib/extconf.rb | 7 +--- 9 files changed, 52 insertions(+), 76 deletions(-) (limited to 'ext') diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb index 5a67603e6..19bfc1f6d 100644 --- a/ext/dbm/extconf.rb +++ b/ext/dbm/extconf.rb @@ -33,7 +33,7 @@ def db_check(db) if have_library(db, db_prefix("dbm_open")) || have_func(db_prefix("dbm_open")) for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"]) if have_header(hdr.dup) and have_type("DBM", hdr.dup, hsearch) - $CFLAGS += " " + hsearch + '-DDBM_HDR="<'+hdr+'>"' + $defs << hsearch << '-DDBM_HDR="<'+hdr+'>"' return true end end diff --git a/ext/digest/md5/extconf.rb b/ext/digest/md5/extconf.rb index 9acf7ba9c..981924118 100644 --- a/ext/digest/md5/extconf.rb +++ b/ext/digest/md5/extconf.rb @@ -3,7 +3,8 @@ require "mkmf" -$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.." +$defs << "-DHAVE_CONFIG_H" +$INCFLAGS << " -I$(srcdir)/.." $objs = [ "md5init.#{$OBJEXT}" ] diff --git a/ext/digest/rmd160/extconf.rb b/ext/digest/rmd160/extconf.rb index 5bc968385..9358dbd09 100644 --- a/ext/digest/rmd160/extconf.rb +++ b/ext/digest/rmd160/extconf.rb @@ -3,7 +3,8 @@ require "mkmf" -$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.." +$defs << "-DNDEBUG" << "-DHAVE_CONFIG_H" +$INCFLAGS << " -I$(srcdir)/.." $objs = [ "rmd160init.#{$OBJEXT}" ] diff --git a/ext/digest/sha1/extconf.rb b/ext/digest/sha1/extconf.rb index c249a415e..b93ac593a 100644 --- a/ext/digest/sha1/extconf.rb +++ b/ext/digest/sha1/extconf.rb @@ -3,7 +3,8 @@ require "mkmf" -$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.." +$defs << "-DHAVE_CONFIG_H" +$INCFLAGS << " -I$(srcdir)/.." $objs = [ "sha1init.#{$OBJEXT}" ] diff --git a/ext/digest/sha2/extconf.rb b/ext/digest/sha2/extconf.rb index 17fb9f2d1..7bb143e8d 100644 --- a/ext/digest/sha2/extconf.rb +++ b/ext/digest/sha2/extconf.rb @@ -3,7 +3,8 @@ require "mkmf" -$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.." +$defs << "-DHAVE_CONFIG_H" +$INCFLAGS << " -I$(srcdir)/.." $objs = [ "sha2.#{$OBJEXT}", diff --git a/ext/extmk.rb b/ext/extmk.rb index d33cbd912..c88a19803 100644 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -69,6 +69,8 @@ def extract_makefile(makefile, keep = true) return false end $target = target + $extconf_h = m[/^RUBY_EXTCONF_H[ \t]*=[ \t]*(\S+)/, 1] + $static = m[/^EXTSTATIC[ \t]*=[ \t]*(\S+)/, 1] || false /^STATIC_LIB[ \t]*=[ \t]*\S+/ =~ m or $static = nil $preload = Shellwords.shellwords(m[/^preload[ \t]*=[ \t]*(.*)/, 1] || "") $DLDFLAGS += " " + (m[/^DLDFLAGS[ \t]*=[ \t]*(.*)/, 1] || "") @@ -90,6 +92,7 @@ def extmake(target) else $static = false end + $default_static = $static unless $ignore return true if $nodynamic and not $static @@ -122,10 +125,13 @@ def extmake(target) CONFIG["srcdir"] = "$(hdrdir)/ext/#{$mdir}" CONFIG["topdir"] = $topdir begin - if (!(ok &&= extract_makefile(makefile)) || + $extconf_h = nil + ok &&= extract_makefile(makefile) + if (($extconf_h && !File.exist?($extconf_h)) || !(t = modified?(makefile, MTIMES)) || %W"#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb #{$srcdir}/depend".any? {|f| modified?(f, [t])}) then + $default_static = $static ok = false init_mkmf Logging::logfile 'mkmf.log' diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 28f38140b..5ee30a222 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -30,7 +30,7 @@ if /solaris/ =~ RUBY_PLATFORM and !try_compile("") headers << "sys/feature_tests.h" end -$ipv6 = false +ipv6 = false default_ipv6 = /cygwin/ !~ RUBY_PLATFORM if enable_config("ipv6", default_ipv6) if checking_for("ipv6") {try_link(< -EOF - $ipv6type = "inria" - $CFLAGS="-DINET6 "+$CFLAGS - elsif macro_defined?("__KAME__", < -EOF - $ipv6type = "kame" - $ipv6lib="inet6" - $ipv6libdir="/usr/local/v6/lib" - $ipv6trylibc=true - $CFLAGS="-DINET6 "+$CFLAGS - elsif File.directory? "/usr/inet6" - $ipv6type = "linux" - $ipv6lib="inet6" - $ipv6libdir="/usr/inet6/lib" - $CFLAGS="-DINET6 -I/usr/inet6/include "+$CFLAGS - elsif macro_defined?("_TOSHIBA_INET6", < -EOF - $ipv6type = "toshiba" - $ipv6lib="inet6" - $ipv6libdir="/usr/local/v6/lib" - $CFLAGS="-DINET6 "+$CFLAGS - elsif macro_defined?("__V6D__", < -EOF - $ipv6type = "v6d" - $ipv6lib="v6" - $ipv6libdir="/usr/local/v6/lib" - $CFLAGS="-DINET6 -I/usr/local/v6/include "+$CFLAGS - elsif macro_defined?("_ZETA_MINAMI_INET6", < -EOF - $ipv6type = "zeta" - $ipv6lib="inet6" - $ipv6libdir="/usr/local/v6/lib" - $CFLAGS="-DINET6 "+$CFLAGS - else - $ipv6lib=with_config("ipv6-lib", nil) - $ipv6libdir=with_config("ipv6-libdir", nil) - $CFLAGS="-DINET6 "+$CFLAGS +if ipv6 + ipv6lib = nil + class << (fmt = "unknown") + def %(s) s || self end end - - if $ipv6lib - if File.directory? $ipv6libdir and File.exist? "#{$ipv6libdir}/lib#{$ipv6lib}.a" - $LOCAL_LIBS = " -L#$ipv6libdir -l#$ipv6lib" - elsif !$ipv6trylibc - print <