зеркало из https://github.com/github/ruby.git
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@10193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
1a8871fa13
Коммит
e34b2a73e6
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
Fri May 26 08:40:03 2006 nobuyoshi nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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).
|
||||||
|
|
||||||
Thu May 25 01:52:07 2006 nobuyoshi nakada <nobu@ruby-lang.org>
|
Thu May 25 01:52:07 2006 nobuyoshi nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/mkmf.rb (pkg_config): particular config commands support.
|
* lib/mkmf.rb (pkg_config): particular config commands support.
|
||||||
|
|
|
@ -392,8 +392,8 @@ s,@LIBPATHFLAG@, -L"%s",;t t
|
||||||
s,@RPATHFLAG@,,;t t
|
s,@RPATHFLAG@,,;t t
|
||||||
s,@LIBARG@,%s.lib,;t t
|
s,@LIBARG@,%s.lib,;t t
|
||||||
s,@LINK_SO@,$$(LDSHARED) $$(DLDFLAGS) $$(LIBPATH) $$(OBJS), $$(@:/=\), nul, $$(LIBS) $$(LOCAL_LIBS), $$(DEFFILE), $$(RESFILE),;t t
|
s,@LINK_SO@,$$(LDSHARED) $$(DLDFLAGS) $$(LIBPATH) $$(OBJS), $$(@:/=\), nul, $$(LIBS) $$(LOCAL_LIBS), $$(DEFFILE), $$(RESFILE),;t t
|
||||||
s,@COMPILE_C@,$$(CC) $$(CFLAGS) $$(CPPFLAGS) -c $$(<:/=\),;t t
|
s,@COMPILE_C@,$$(CC) $$(INCFLAGS) $$(CFLAGS) $$(CPPFLAGS) -c $$(<:/=\),;t t
|
||||||
s,@COMPILE_CXX@,$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) -P -c $$(<:/=\),;t t
|
s,@COMPILE_CXX@,$$(CXX) $$(INCFLAGS) $$(CXXFLAGS) $$(CPPFLAGS) -P -c $$(<:/=\),;t t
|
||||||
s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: {$$(topdir)}.%s{}.%s: {$$(hdrdir)}.%s{}.%s: .%s.%s:,;t t
|
s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: {$$(topdir)}.%s{}.%s: {$$(hdrdir)}.%s{}.%s: .%s.%s:,;t t
|
||||||
s,@RULE_SUBST@,{.;$$(VPATH)}%s,;t t
|
s,@RULE_SUBST@,{.;$$(VPATH)}%s,;t t
|
||||||
s,@COMMON_LIBS@,m advapi32 avicap32 avifil32 cap comctl32 comdlg32 dlcapi gdi32 glu32 imagehlp imm32 inetmib1 kernel32 loadperf lsapi32 lz32 mapi32 mgmtapi mpr msacm32 msvfw32 nddeapi netapi32 ole32 oleaut32 oledlg olepro32 opengl32 pdh pkpd32 rasapi32 rasdlg rassapi rpcrt4 setupapi shell32 shfolder snmpapi sporder tapi32 url user32 vdmdbg version win32spl winmm wintrust wsock32,;t t
|
s,@COMMON_LIBS@,m advapi32 avicap32 avifil32 cap comctl32 comdlg32 dlcapi gdi32 glu32 imagehlp imm32 inetmib1 kernel32 loadperf lsapi32 lz32 mapi32 mgmtapi mpr msacm32 msvfw32 nddeapi netapi32 ole32 oleaut32 oledlg olepro32 opengl32 pdh pkpd32 rasapi32 rasdlg rassapi rpcrt4 setupapi shell32 shfolder snmpapi sporder tapi32 url user32 vdmdbg version win32spl winmm wintrust wsock32,;t t
|
||||||
|
|
|
@ -33,7 +33,7 @@ def db_check(db)
|
||||||
if have_library(db, db_prefix("dbm_open")) || have_func(db_prefix("dbm_open"))
|
if have_library(db, db_prefix("dbm_open")) || have_func(db_prefix("dbm_open"))
|
||||||
for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"])
|
for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"])
|
||||||
if have_header(hdr.dup) and have_type("DBM", hdr.dup, hsearch)
|
if have_header(hdr.dup) and have_type("DBM", hdr.dup, hsearch)
|
||||||
$CFLAGS += " " + hsearch + '-DDBM_HDR="<'+hdr+'>"'
|
$defs << hsearch << '-DDBM_HDR="<'+hdr+'>"'
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
require "mkmf"
|
require "mkmf"
|
||||||
|
|
||||||
$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
|
$defs << "-DHAVE_CONFIG_H"
|
||||||
|
$INCFLAGS << " -I$(srcdir)/.."
|
||||||
|
|
||||||
$objs = [ "md5init.#{$OBJEXT}" ]
|
$objs = [ "md5init.#{$OBJEXT}" ]
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
require "mkmf"
|
require "mkmf"
|
||||||
|
|
||||||
$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
|
$defs << "-DNDEBUG" << "-DHAVE_CONFIG_H"
|
||||||
|
$INCFLAGS << " -I$(srcdir)/.."
|
||||||
|
|
||||||
$objs = [ "rmd160init.#{$OBJEXT}" ]
|
$objs = [ "rmd160init.#{$OBJEXT}" ]
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
require "mkmf"
|
require "mkmf"
|
||||||
|
|
||||||
$CFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
|
$defs << "-DHAVE_CONFIG_H"
|
||||||
|
$INCFLAGS << " -I$(srcdir)/.."
|
||||||
|
|
||||||
$objs = [ "sha1init.#{$OBJEXT}" ]
|
$objs = [ "sha1init.#{$OBJEXT}" ]
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
require "mkmf"
|
require "mkmf"
|
||||||
|
|
||||||
$CPPFLAGS << " -DHAVE_CONFIG_H -I#{File.dirname(__FILE__)}/.."
|
$defs << "-DHAVE_CONFIG_H"
|
||||||
|
$INCFLAGS << " -I$(srcdir)/.."
|
||||||
|
|
||||||
$objs = [
|
$objs = [
|
||||||
"sha2.#{$OBJEXT}",
|
"sha2.#{$OBJEXT}",
|
||||||
|
|
|
@ -69,6 +69,8 @@ def extract_makefile(makefile, keep = true)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
$target = target
|
$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
|
/^STATIC_LIB[ \t]*=[ \t]*\S+/ =~ m or $static = nil
|
||||||
$preload = Shellwords.shellwords(m[/^preload[ \t]*=[ \t]*(.*)/, 1] || "")
|
$preload = Shellwords.shellwords(m[/^preload[ \t]*=[ \t]*(.*)/, 1] || "")
|
||||||
$DLDFLAGS += " " + (m[/^DLDFLAGS[ \t]*=[ \t]*(.*)/, 1] || "")
|
$DLDFLAGS += " " + (m[/^DLDFLAGS[ \t]*=[ \t]*(.*)/, 1] || "")
|
||||||
|
@ -90,6 +92,7 @@ def extmake(target)
|
||||||
else
|
else
|
||||||
$static = false
|
$static = false
|
||||||
end
|
end
|
||||||
|
$default_static = $static
|
||||||
|
|
||||||
unless $ignore
|
unless $ignore
|
||||||
return true if $nodynamic and not $static
|
return true if $nodynamic and not $static
|
||||||
|
@ -122,10 +125,13 @@ def extmake(target)
|
||||||
CONFIG["srcdir"] = "$(hdrdir)/ext/#{$mdir}"
|
CONFIG["srcdir"] = "$(hdrdir)/ext/#{$mdir}"
|
||||||
CONFIG["topdir"] = $topdir
|
CONFIG["topdir"] = $topdir
|
||||||
begin
|
begin
|
||||||
if (!(ok &&= extract_makefile(makefile)) ||
|
$extconf_h = nil
|
||||||
|
ok &&= extract_makefile(makefile)
|
||||||
|
if (($extconf_h && !File.exist?($extconf_h)) ||
|
||||||
!(t = modified?(makefile, MTIMES)) ||
|
!(t = modified?(makefile, MTIMES)) ||
|
||||||
%W"#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb #{$srcdir}/depend".any? {|f| modified?(f, [t])})
|
%W"#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb #{$srcdir}/depend".any? {|f| modified?(f, [t])})
|
||||||
then
|
then
|
||||||
|
$default_static = $static
|
||||||
ok = false
|
ok = false
|
||||||
init_mkmf
|
init_mkmf
|
||||||
Logging::logfile 'mkmf.log'
|
Logging::logfile 'mkmf.log'
|
||||||
|
|
|
@ -26,7 +26,7 @@ if /solaris/ =~ RUBY_PLATFORM and !try_compile("")
|
||||||
headers << "sys/feature_tests.h"
|
headers << "sys/feature_tests.h"
|
||||||
end
|
end
|
||||||
|
|
||||||
$ipv6 = false
|
ipv6 = false
|
||||||
default_ipv6 = /cygwin/ !~ RUBY_PLATFORM
|
default_ipv6 = /cygwin/ !~ RUBY_PLATFORM
|
||||||
if enable_config("ipv6", default_ipv6)
|
if enable_config("ipv6", default_ipv6)
|
||||||
if checking_for("ipv6") {try_link(<<EOF)}
|
if checking_for("ipv6") {try_link(<<EOF)}
|
||||||
|
@ -37,63 +37,45 @@ main()
|
||||||
socket(AF_INET6, SOCK_STREAM, 0);
|
socket(AF_INET6, SOCK_STREAM, 0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
$CPPFLAGS+=" -DENABLE_IPV6"
|
$defs << "-DENABLE_IPV6" << "-DINET6"
|
||||||
$ipv6 = true
|
ipv6 = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
$ipv6type = nil
|
if ipv6
|
||||||
$ipv6lib = nil
|
ipv6lib = nil
|
||||||
$ipv6libdir = nil
|
class << (fmt = "unknown")
|
||||||
$ipv6trylibc = nil
|
def %(s) s || self end
|
||||||
if $ipv6
|
|
||||||
if have_macro("IPV6_INRIA_VERSION", "netinet/in.h")
|
|
||||||
$ipv6type = "inria"
|
|
||||||
$CPPFLAGS="-DINET6 "+$CPPFLAGS
|
|
||||||
elsif have_macro("__KAME__", "netinet/in.h")
|
|
||||||
$ipv6type = "kame"
|
|
||||||
$ipv6lib="inet6"
|
|
||||||
$ipv6libdir="/usr/local/v6/lib"
|
|
||||||
$ipv6trylibc=true
|
|
||||||
$CPPFLAGS="-DINET6 "+$CPPFLAGS
|
|
||||||
elsif File.directory? "/usr/inet6"
|
|
||||||
$ipv6type = "linux"
|
|
||||||
$ipv6lib="inet6"
|
|
||||||
$ipv6libdir="/usr/inet6/lib"
|
|
||||||
$CPPFLAGS="-DINET6 -I/usr/inet6/include "+$CPPFLAGS
|
|
||||||
elsif have_macro("_TOSHIBA_INET6", "sys/param.h")
|
|
||||||
$ipv6type = "toshiba"
|
|
||||||
$ipv6lib="inet6"
|
|
||||||
$ipv6libdir="/usr/local/v6/lib"
|
|
||||||
$CPPFLAGS="-DINET6 "+$CPPFLAGS
|
|
||||||
elsif have_macro("__V6D__", "/usr/local/v6/include/sys/v6config.h")
|
|
||||||
$ipv6type = "v6d"
|
|
||||||
$ipv6lib="v6"
|
|
||||||
$ipv6libdir="/usr/local/v6/lib"
|
|
||||||
$CFLAGS="-I/usr/local/v6/include "+$CFLAGS
|
|
||||||
$CPPFLAGS="-DINET6 "+$CPPFLAGS
|
|
||||||
elsif have_macro("_ZETA_MINAMI_INET6", "sys/param.h")
|
|
||||||
$ipv6type = "zeta"
|
|
||||||
$ipv6lib="inet6"
|
|
||||||
$ipv6libdir="/usr/local/v6/lib"
|
|
||||||
$CPPFLAGS="-DINET6 "+$CPPFLAGS
|
|
||||||
else
|
|
||||||
$ipv6lib=with_config("ipv6-lib", nil)
|
|
||||||
$ipv6libdir=with_config("ipv6-libdir", nil)
|
|
||||||
$CPPFLAGS="-DINET6 "+$CPPFLAGS
|
|
||||||
end
|
end
|
||||||
|
idirs, ldirs = dir_config("inet6", %w[/usr/inet6 /usr/local/v6].find {|d| File.directory?(d)})
|
||||||
if $ipv6lib
|
checking_for("ipv6 type", fmt) do
|
||||||
if File.directory? $ipv6libdir and File.exist? "#{$ipv6libdir}/lib#{$ipv6lib}.a"
|
if have_macro("IPV6_INRIA_VERSION", "netinet/in.h")
|
||||||
$LOCAL_LIBS = " -L#$ipv6libdir -l#$ipv6lib"
|
"inria"
|
||||||
elsif !$ipv6trylibc
|
elsif have_macro("__KAME__", "netinet/in.h")
|
||||||
abort <<EOS
|
have_library(ipv6lib = "inet6")
|
||||||
Fatal: no #$ipv6lib library found. cannot continue.
|
"kame"
|
||||||
You need to fetch lib#{$ipv6lib}.a from appropriate
|
elsif have_macro("_TOSHIBA_INET6", "sys/param.h")
|
||||||
|
have_library(ipv6lib = "inet6") and "toshiba"
|
||||||
|
elsif have_macro("__V6D__", "sys/v6config.h")
|
||||||
|
have_library(ipv6lib = "v6") and "v6d"
|
||||||
|
elsif have_macro("_ZETA_MINAMI_INET6", "sys/param.h")
|
||||||
|
have_library(ipv6lib = "inet6") and "zeta"
|
||||||
|
elsif ipv6lib = with_config("ipv6-lib")
|
||||||
|
warn <<EOS
|
||||||
|
--with-ipv6-lib and --with-ipv6-libdir option will be obsolete, use
|
||||||
|
--with-inet6lib and --with-inet6-{include,lib} options instead.
|
||||||
|
EOS
|
||||||
|
find_library(ipv6lib, nil, with_config("ipv6-libdir", ldirs)) and
|
||||||
|
ipv6lib
|
||||||
|
elsif have_library("inet6")
|
||||||
|
"inet6"
|
||||||
|
end
|
||||||
|
end or not ipv6lib or abort <<EOS
|
||||||
|
|
||||||
|
Fatal: no #{ipv6lib} library found. cannot continue.
|
||||||
|
You need to fetch lib#{ipv6lib}.a from appropriate
|
||||||
ipv6 kit and compile beforehand.
|
ipv6 kit and compile beforehand.
|
||||||
EOS
|
EOS
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if have_struct_member("struct sockaddr_in", "sin_len", headers)
|
if have_struct_member("struct sockaddr_in", "sin_len", headers)
|
||||||
|
@ -219,7 +201,7 @@ main()
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
if $ipv6 and not getaddr_info_ok
|
if ipv6 and not getaddr_info_ok
|
||||||
abort <<EOS
|
abort <<EOS
|
||||||
|
|
||||||
Fatal: --enable-ipv6 is specified, and your OS seems to support IPv6 feature.
|
Fatal: --enable-ipv6 is specified, and your OS seems to support IPv6 feature.
|
||||||
|
|
|
@ -2094,7 +2094,7 @@ static VALUE
|
||||||
sock_s_socketpair(klass, domain, type, protocol)
|
sock_s_socketpair(klass, domain, type, protocol)
|
||||||
VALUE klass, domain, type, protocol;
|
VALUE klass, domain, type, protocol;
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32) && !defined(__BEOS__) && !defined(__EMX__) && !defined(__QNXNTO__)
|
#if defined HAVE_SOCKETPAIR
|
||||||
int d, t, sp[2];
|
int d, t, sp[2];
|
||||||
|
|
||||||
setup_domain_and_type(domain, &d, type, &t);
|
setup_domain_and_type(domain, &d, type, &t);
|
||||||
|
|
|
@ -54,12 +54,7 @@ if %w'z libz zlib zdll'.find {|z| have_library(z, 'deflateReset')} and
|
||||||
message "#{OS_NAMES[os_code]}\n"
|
message "#{OS_NAMES[os_code]}\n"
|
||||||
defines << "OS_CODE=#{os_code}"
|
defines << "OS_CODE=#{os_code}"
|
||||||
|
|
||||||
defines = defines.collect{|d|' -D'+d}.join
|
$defs.concat(defines.collect{|d|' -D'+d})
|
||||||
if $CPPFLAGS then
|
|
||||||
$CPPFLAGS += defines
|
|
||||||
else
|
|
||||||
$CFLAGS += defines
|
|
||||||
end
|
|
||||||
|
|
||||||
create_makefile('zlib')
|
create_makefile('zlib')
|
||||||
|
|
||||||
|
|
58
lib/mkmf.rb
58
lib/mkmf.rb
|
@ -14,6 +14,7 @@ if /mswin|bccwin|mingw|msdosdjgpp|human|os2/ !~ CONFIG['build_os']
|
||||||
end
|
end
|
||||||
SRC_EXT = %w[c m] << CXX_EXT
|
SRC_EXT = %w[c m] << CXX_EXT
|
||||||
$static = $config_h = nil
|
$static = $config_h = nil
|
||||||
|
$default_static = $static
|
||||||
|
|
||||||
unless defined? $configure_args
|
unless defined? $configure_args
|
||||||
$configure_args = {}
|
$configure_args = {}
|
||||||
|
@ -273,15 +274,13 @@ def link_command(ldflags, opt="", libpath=$LIBPATH)
|
||||||
end
|
end
|
||||||
|
|
||||||
def cc_command(opt="")
|
def cc_command(opt="")
|
||||||
RbConfig::expand("$(CC) -c #$INCFLAGS -I$(hdrdir) " \
|
RbConfig::expand("$(CC) #$INCFLAGS #$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_C}",
|
||||||
"#$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} #{CONFTEST_C}",
|
CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote))
|
||||||
CONFIG.merge('hdrdir' => $hdrdir.quote))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def cpp_command(outfile, opt="")
|
def cpp_command(outfile, opt="")
|
||||||
RbConfig::expand("$(CPP) #$INCFLAGS -I$(hdrdir) " \
|
RbConfig::expand("$(CPP) #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
|
||||||
"#$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
|
CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote))
|
||||||
CONFIG.merge('hdrdir' => $hdrdir.quote))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def libpathflag(libpath=$LIBPATH)
|
def libpathflag(libpath=$LIBPATH)
|
||||||
|
@ -828,21 +827,24 @@ end
|
||||||
|
|
||||||
def create_header(header = "extconf.h")
|
def create_header(header = "extconf.h")
|
||||||
message "creating %s\n", header
|
message "creating %s\n", header
|
||||||
if $defs.length > 0
|
sym = header.tr("a-z./\055", "A-Z___")
|
||||||
sym = header.tr("a-z./\055", "A-Z___")
|
hdr = ["#ifndef #{sym}\n#define #{sym}\n"]
|
||||||
open(header, "w") do |hfile|
|
for line in $defs
|
||||||
hfile.print "#ifndef #{sym}\n#define #{sym}\n"
|
case line
|
||||||
for line in $defs
|
when /^-D([^=]+)(?:=(.*))?/
|
||||||
case line
|
hdr << "#define #$1 #{$2 ? Shellwords.shellwords($2)[0] : 1}\n"
|
||||||
when /^-D([^=]+)(?:=(.*))?/
|
when /^-U(.*)/
|
||||||
hfile.print "#define #$1 #{$2 || 1}\n"
|
hdr << "#undef #$1\n"
|
||||||
when /^-U(.*)/
|
|
||||||
hfile.print "#undef #$1\n"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
hfile.print "#endif\n"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
hdr << "#endif\n"
|
||||||
|
hdr = hdr.join
|
||||||
|
unless (IO.read(header) == hdr rescue false)
|
||||||
|
open(header, "w") do |hfile|
|
||||||
|
hfile.write(hdr)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
$extconf_h = header
|
||||||
end
|
end
|
||||||
|
|
||||||
def dir_config(target, idefault=nil, ldefault=nil)
|
def dir_config(target, idefault=nil, ldefault=nil)
|
||||||
|
@ -961,6 +963,7 @@ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
|
||||||
else
|
else
|
||||||
sep = ""
|
sep = ""
|
||||||
end
|
end
|
||||||
|
extconf_h = $extconf_h ? "-DRUBY_EXTCONF_H=\\\"$(RUBY_EXTCONF_H)\\\" " : ""
|
||||||
mk << %{
|
mk << %{
|
||||||
CC = #{CONFIG['CC']}
|
CC = #{CONFIG['CC']}
|
||||||
CXX = #{CONFIG['CXX']}
|
CXX = #{CONFIG['CXX']}
|
||||||
|
@ -969,8 +972,10 @@ LIBRUBY_A = #{CONFIG['LIBRUBY_A']}
|
||||||
LIBRUBYARG_SHARED = #$LIBRUBYARG_SHARED
|
LIBRUBYARG_SHARED = #$LIBRUBYARG_SHARED
|
||||||
LIBRUBYARG_STATIC = #$LIBRUBYARG_STATIC
|
LIBRUBYARG_STATIC = #$LIBRUBYARG_STATIC
|
||||||
|
|
||||||
|
RUBY_EXTCONF_H = #{$extconf_h}
|
||||||
CFLAGS = #{CONFIG['CCDLFLAGS'] unless $static} #$CFLAGS #$ARCH_FLAG
|
CFLAGS = #{CONFIG['CCDLFLAGS'] unless $static} #$CFLAGS #$ARCH_FLAG
|
||||||
CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir) #{$defs.join(" ")} #{$CPPFLAGS}
|
INCFLAGS = -I. #$INCFLAGS
|
||||||
|
CPPFLAGS = #{extconf_h}#{$CPPFLAGS}
|
||||||
CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
|
CXXFLAGS = $(CFLAGS) #{CONFIG['CXXFLAGS']}
|
||||||
DLDFLAGS = #$LDFLAGS #$DLDFLAGS #$ARCH_FLAG
|
DLDFLAGS = #$LDFLAGS #$DLDFLAGS #$ARCH_FLAG
|
||||||
LDSHARED = #{CONFIG['LDSHARED']}
|
LDSHARED = #{CONFIG['LDSHARED']}
|
||||||
|
@ -1096,6 +1101,7 @@ SRCS = #{srcs.collect(&File.method(:basename)).join(' ')}
|
||||||
OBJS = #{$objs}
|
OBJS = #{$objs}
|
||||||
TARGET = #{target}
|
TARGET = #{target}
|
||||||
DLLIB = #{dllib}
|
DLLIB = #{dllib}
|
||||||
|
EXTSTATIC = #{$default_static != $static && $static || ""}
|
||||||
STATIC_LIB = #{staticlib unless $static.nil?}
|
STATIC_LIB = #{staticlib unless $static.nil?}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1269,6 +1275,7 @@ site-install-rb: install-rb
|
||||||
headers.each {|h| h.sub!(/.*/) {|*m| RULE_SUBST % m}}
|
headers.each {|h| h.sub!(/.*/) {|*m| RULE_SUBST % m}}
|
||||||
end
|
end
|
||||||
headers << $config_h if $config_h
|
headers << $config_h if $config_h
|
||||||
|
headers << "$(RUBY_EXTCONF_H)" if $extconf_h
|
||||||
mfile.print "$(OBJS): ", headers.join(' '), "\n"
|
mfile.print "$(OBJS): ", headers.join(' '), "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1282,11 +1289,12 @@ def init_mkmf(config = CONFIG)
|
||||||
$arg_config = []
|
$arg_config = []
|
||||||
$enable_shared = config['ENABLE_SHARED'] == 'yes'
|
$enable_shared = config['ENABLE_SHARED'] == 'yes'
|
||||||
$defs = []
|
$defs = []
|
||||||
|
$extconf_h = nil
|
||||||
$CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).dup
|
$CFLAGS = with_config("cflags", arg_config("CFLAGS", config["CFLAGS"])).dup
|
||||||
$ARCH_FLAG = with_config("arch_flag", arg_config("ARCH_FLAG", config["ARCH_FLAG"])).dup
|
$ARCH_FLAG = with_config("arch_flag", arg_config("ARCH_FLAG", config["ARCH_FLAG"])).dup
|
||||||
$CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", config["CPPFLAGS"])).dup
|
$CPPFLAGS = with_config("cppflags", arg_config("CPPFLAGS", config["CPPFLAGS"])).dup
|
||||||
$LDFLAGS = (with_config("ldflags") || "").dup
|
$LDFLAGS = (with_config("ldflags") || "").dup
|
||||||
$INCFLAGS = "-I$(topdir)"
|
$INCFLAGS = "-I$(topdir) -I$(hdrdir) -I$(srcdir)"
|
||||||
$DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS", config["DLDFLAGS"])).dup
|
$DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS", config["DLDFLAGS"])).dup
|
||||||
$LIBEXT = config['LIBEXT'].dup
|
$LIBEXT = config['LIBEXT'].dup
|
||||||
$OBJEXT = config["OBJEXT"].dup
|
$OBJEXT = config["OBJEXT"].dup
|
||||||
|
@ -1377,10 +1385,10 @@ COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
|
||||||
|
|
||||||
COMPILE_RULES = config_string('COMPILE_RULES', &split) || %w[.%s.%s:]
|
COMPILE_RULES = config_string('COMPILE_RULES', &split) || %w[.%s.%s:]
|
||||||
RULE_SUBST = config_string('RULE_SUBST')
|
RULE_SUBST = config_string('RULE_SUBST')
|
||||||
COMPILE_C = config_string('COMPILE_C') || '$(CC) $(CFLAGS) $(CPPFLAGS) -c $<'
|
COMPILE_C = config_string('COMPILE_C') || '$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<'
|
||||||
COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<'
|
COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<'
|
||||||
TRY_LINK = config_string('TRY_LINK') ||
|
TRY_LINK = config_string('TRY_LINK') ||
|
||||||
"$(CC) #{OUTFLAG}conftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS) " \
|
"$(CC) #{OUTFLAG}conftest $(INCFLAGS) $(CPPFLAGS) " \
|
||||||
"$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
|
"$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
|
||||||
LINK_SO = config_string('LINK_SO') ||
|
LINK_SO = config_string('LINK_SO') ||
|
||||||
if CONFIG["DLEXT"] == $OBJEXT
|
if CONFIG["DLEXT"] == $OBJEXT
|
||||||
|
@ -1399,7 +1407,7 @@ clean:
|
||||||
@-$(RM) $(CLEANLIBS#{sep}) $(CLEANOBJS#{sep}) $(CLEANFILES#{sep})
|
@-$(RM) $(CLEANLIBS#{sep}) $(CLEANOBJS#{sep}) $(CLEANFILES#{sep})
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
@-$(RM) Makefile extconf.h conftest.* mkmf.log
|
@-$(RM) Makefile #{$extconf_h} conftest.* mkmf.log
|
||||||
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES#{sep})
|
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES#{sep})
|
||||||
|
|
||||||
realclean: distclean
|
realclean: distclean
|
||||||
|
|
3
ruby.h
3
ruby.h
|
@ -22,6 +22,9 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#ifdef RUBY_EXTCONF_H
|
||||||
|
#include RUBY_EXTCONF_H
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NORETURN_STYLE_NEW 1
|
#define NORETURN_STYLE_NEW 1
|
||||||
#ifndef NORETURN
|
#ifndef NORETURN
|
||||||
|
|
|
@ -447,8 +447,8 @@ s,@LINK_SO@,$$(LDSHARED) -Fe$$(@) $$(OBJS) $$(LIBS) $$(LOCAL_LIBS) $$(DLDFLAGS),
|
||||||
s,@LINK_SO@,$(MANIFESTTOOL) -manifest $$(@).manifest -outputresource:$$(@);2,;t t
|
s,@LINK_SO@,$(MANIFESTTOOL) -manifest $$(@).manifest -outputresource:$$(@);2,;t t
|
||||||
s,@LINK_SO@,@$$(RM) $$(@:/=\).manifest,;t t
|
s,@LINK_SO@,@$$(RM) $$(@:/=\).manifest,;t t
|
||||||
!endif
|
!endif
|
||||||
s,@COMPILE_C@,$$(CC) $$(CFLAGS) $$(CPPFLAGS) -c -Tc$$(<:\=/),;t t
|
s,@COMPILE_C@,$$(CC) $$(INCFLAGS) $$(CFLAGS) $$(CPPFLAGS) -c -Tc$$(<:\=/),;t t
|
||||||
s,@COMPILE_CXX@,$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) -c -Tp$$(<:\=/),;t t
|
s,@COMPILE_CXX@,$$(CXX) $$(INCFLAGS) $$(CXXFLAGS) $$(CPPFLAGS) -c -Tp$$(<:\=/),;t t
|
||||||
s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: {$$(topdir)}.%s{}.%s: {$$(hdrdir)}.%s{}.%s: .%s.%s:,;t t
|
s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: {$$(topdir)}.%s{}.%s: {$$(hdrdir)}.%s{}.%s: .%s.%s:,;t t
|
||||||
s,@RULE_SUBST@,{.;$$(srcdir);$$(topdir);$$(hdrdir)}%s,;t t
|
s,@RULE_SUBST@,{.;$$(srcdir);$$(topdir);$$(hdrdir)}%s,;t t
|
||||||
s,@TRY_LINK@,$$(CC) -Feconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS) -link $$(LDFLAGS) $$(LIBPATH) $$(XLDFLAGS),;t t
|
s,@TRY_LINK@,$$(CC) -Feconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS) -link $$(LDFLAGS) $$(LIBPATH) $$(XLDFLAGS),;t t
|
||||||
|
|
|
@ -412,8 +412,8 @@ s,@LIBPATHFLAG@, -libpath:"%s",;t t
|
||||||
s,@RPATHFLAG@,,;t t
|
s,@RPATHFLAG@,,;t t
|
||||||
s,@LIBARG@,%s.lib,;t t
|
s,@LIBARG@,%s.lib,;t t
|
||||||
s,@LINK_SO@,$$(LDSHARED) -Fe$$(@) $$(OBJS) $$(LIBS) $$(LOCAL_LIBS) $$(DLDFLAGS),;t t
|
s,@LINK_SO@,$$(LDSHARED) -Fe$$(@) $$(OBJS) $$(LIBS) $$(LOCAL_LIBS) $$(DLDFLAGS),;t t
|
||||||
s,@COMPILE_C@,$$(CC) $$(CFLAGS) $$(CPPFLAGS) -c -Tc$$(<:\=/),;t t
|
s,@COMPILE_C@,$$(CC) $$(INCFLAGS) $$(CFLAGS) $$(CPPFLAGS) -c -Tc$$(<:\=/),;t t
|
||||||
s,@COMPILE_CXX@,$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) -c -Tp$$(<:\=/),;t t
|
s,@COMPILE_CXX@,$$(CXX) $$(INCFLAGS) $$(CXXFLAGS) $$(CPPFLAGS) -c -Tp$$(<:\=/),;t t
|
||||||
s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: {$$(topdir)}.%s{}.%s: {$$(hdrdir)}.%s{}.%s: .%s.%s:,;t t
|
s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: {$$(topdir)}.%s{}.%s: {$$(hdrdir)}.%s{}.%s: .%s.%s:,;t t
|
||||||
s,@RULE_SUBST@,{.;$$(srcdir);$$(topdir);$$(hdrdir)}%s,;t t
|
s,@RULE_SUBST@,{.;$$(srcdir);$$(topdir);$$(hdrdir)}%s,;t t
|
||||||
s,@TRY_LINK@,$$(CC) -Feconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS) -link $$(LDFLAGS) $$(LIBPATH) $$(XLDFLAGS),;t t
|
s,@TRY_LINK@,$$(CC) -Feconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS) -link $$(LDFLAGS) $$(LIBPATH) $$(XLDFLAGS),;t t
|
||||||
|
|
Загрузка…
Ссылка в новой задаче