Don't break tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2ba247275a
commit
302b6f6e02
@ -147,7 +147,7 @@ def extmake(target)
|
|||||||
remove_const(:MAKEFILE_CONFIG)
|
remove_const(:MAKEFILE_CONFIG)
|
||||||
const_set(:MAKEFILE_CONFIG, mkconfig)
|
const_set(:MAKEFILE_CONFIG, mkconfig)
|
||||||
}
|
}
|
||||||
MakeMakefile.class_eval {
|
Object.class_eval {
|
||||||
remove_const(:CONFIG)
|
remove_const(:CONFIG)
|
||||||
const_set(:CONFIG, mkconfig)
|
const_set(:CONFIG, mkconfig)
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ def extmake(target)
|
|||||||
remove_const(:MAKEFILE_CONFIG)
|
remove_const(:MAKEFILE_CONFIG)
|
||||||
const_set(:MAKEFILE_CONFIG, mkconfig0)
|
const_set(:MAKEFILE_CONFIG, mkconfig0)
|
||||||
}
|
}
|
||||||
MakeMakefile.class_eval {
|
Object.class_eval {
|
||||||
remove_const(:CONFIG)
|
remove_const(:CONFIG)
|
||||||
const_set(:CONFIG, mkconfig0)
|
const_set(:CONFIG, mkconfig0)
|
||||||
}
|
}
|
||||||
|
423
lib/mkmf.rb
423
lib/mkmf.rb
@ -6,58 +6,15 @@ require 'rbconfig'
|
|||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'shellwords'
|
require 'shellwords'
|
||||||
|
|
||||||
# :stopdoc:
|
|
||||||
class String
|
|
||||||
# Wraps a string in escaped quotes if it contains whitespace.
|
|
||||||
def quote
|
|
||||||
/\s/ =~ self ? "\"#{self}\"" : "#{self}"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Generates a string used as cpp macro name.
|
|
||||||
def tr_cpp
|
|
||||||
strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P")
|
|
||||||
end
|
|
||||||
|
|
||||||
def funcall_style
|
|
||||||
/\)\z/ =~ self ? dup : "#{self}()"
|
|
||||||
end
|
|
||||||
|
|
||||||
def sans_arguments
|
|
||||||
self[/\A[^()]+/]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Array
|
|
||||||
# Wraps all strings in escaped quotes if they contain whitespace.
|
|
||||||
def quote
|
|
||||||
map {|s| s.quote}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# :startdoc:
|
|
||||||
|
|
||||||
##
|
|
||||||
# mkmf.rb is used by ruby C extensions to generate a Makefile which will
|
|
||||||
# correctly compile and link the C extension to ruby and a third-party
|
|
||||||
# library.
|
|
||||||
module MakeMakefile
|
|
||||||
|
|
||||||
# Makefile configuration options
|
|
||||||
CONFIG = RbConfig::MAKEFILE_CONFIG
|
CONFIG = RbConfig::MAKEFILE_CONFIG
|
||||||
ORIG_LIBPATH = ENV['LIB']
|
ORIG_LIBPATH = ENV['LIB']
|
||||||
|
|
||||||
# Filename extensions for C files
|
|
||||||
C_EXT = %w[c m]
|
C_EXT = %w[c m]
|
||||||
|
|
||||||
# Filename extensions for C++ files
|
|
||||||
|
|
||||||
CXX_EXT = %w[cc mm cxx cpp]
|
CXX_EXT = %w[cc mm cxx cpp]
|
||||||
if File::FNM_SYSCASE.zero?
|
if File::FNM_SYSCASE.zero?
|
||||||
CXX_EXT.concat(%w[C])
|
CXX_EXT.concat(%w[C])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Filename extensions for compiled source files
|
|
||||||
SRC_EXT = C_EXT + CXX_EXT
|
SRC_EXT = C_EXT + CXX_EXT
|
||||||
|
|
||||||
$static = nil
|
$static = nil
|
||||||
$config_h = '$(arch_hdrdir)/ruby/config.h'
|
$config_h = '$(arch_hdrdir)/ruby/config.h'
|
||||||
$default_static = $static
|
$default_static = $static
|
||||||
@ -118,12 +75,10 @@ module MakeMakefile
|
|||||||
def config_string(key, config = CONFIG)
|
def config_string(key, config = CONFIG)
|
||||||
s = config[key] and !s.empty? and block_given? ? yield(s) : s
|
s = config[key] and !s.empty? and block_given? ? yield(s) : s
|
||||||
end
|
end
|
||||||
module_function :config_string
|
|
||||||
|
|
||||||
def dir_re(dir)
|
def dir_re(dir)
|
||||||
Regexp.new('\$(?:\('+dir+'\)|\{'+dir+'\})(?:\$(?:\(target_prefix\)|\{target_prefix\}))?')
|
Regexp.new('\$(?:\('+dir+'\)|\{'+dir+'\})(?:\$(?:\(target_prefix\)|\{target_prefix\}))?')
|
||||||
end
|
end
|
||||||
module_function :dir_re
|
|
||||||
|
|
||||||
def relative_from(path, base)
|
def relative_from(path, base)
|
||||||
dir = File.join(path, "")
|
dir = File.join(path, "")
|
||||||
@ -134,7 +89,6 @@ module MakeMakefile
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Directories for installing various types of files
|
|
||||||
INSTALL_DIRS = [
|
INSTALL_DIRS = [
|
||||||
[dir_re('commondir'), "$(RUBYCOMMONDIR)"],
|
[dir_re('commondir'), "$(RUBYCOMMONDIR)"],
|
||||||
[dir_re('sitedir'), "$(RUBYCOMMONDIR)"],
|
[dir_re('sitedir'), "$(RUBYCOMMONDIR)"],
|
||||||
@ -222,6 +176,32 @@ module MakeMakefile
|
|||||||
|
|
||||||
CONFTEST_C = "conftest.c".freeze
|
CONFTEST_C = "conftest.c".freeze
|
||||||
|
|
||||||
|
class String
|
||||||
|
# Wraps a string in escaped quotes if it contains whitespace.
|
||||||
|
def quote
|
||||||
|
/\s/ =~ self ? "\"#{self}\"" : "#{self}"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Generates a string used as cpp macro name.
|
||||||
|
def tr_cpp
|
||||||
|
strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P")
|
||||||
|
end
|
||||||
|
|
||||||
|
def funcall_style
|
||||||
|
/\)\z/ =~ self ? dup : "#{self}()"
|
||||||
|
end
|
||||||
|
|
||||||
|
def sans_arguments
|
||||||
|
self[/\A[^()]+/]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
class Array
|
||||||
|
# Wraps all strings in escaped quotes if they contain whitespace.
|
||||||
|
def quote
|
||||||
|
map {|s| s.quote}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def rm_f(*files)
|
def rm_f(*files)
|
||||||
opt = (Hash === files.last ? [files.pop] : [])
|
opt = (Hash === files.last ? [files.pop] : [])
|
||||||
FileUtils.rm_f(Dir[*files.flatten], *opt)
|
FileUtils.rm_f(Dir[*files.flatten], *opt)
|
||||||
@ -232,8 +212,8 @@ module MakeMakefile
|
|||||||
FileUtils.rm_rf(Dir[*files.flatten], *opt)
|
FileUtils.rm_rf(Dir[*files.flatten], *opt)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns time stamp of the +target+ file if it exists and is newer than or
|
# Returns time stamp of the +target+ file if it exists and is newer
|
||||||
# equal to all of +times+.
|
# than or equal to all of +times+.
|
||||||
def modified?(target, times)
|
def modified?(target, times)
|
||||||
(t = File.mtime(target)) rescue return nil
|
(t = File.mtime(target)) rescue return nil
|
||||||
Array === times or times = [times]
|
Array === times or times = [times]
|
||||||
@ -475,7 +455,8 @@ MSG
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def try_link0(src, opt="", *opts, &b) # :nodoc:
|
# :nodoc:
|
||||||
|
def try_link0(src, opt="", *opts, &b)
|
||||||
cmd = link_command("", opt)
|
cmd = link_command("", opt)
|
||||||
if $universal
|
if $universal
|
||||||
require 'tmpdir'
|
require 'tmpdir'
|
||||||
@ -492,10 +473,10 @@ MSG
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the +src+ can be compiled as a C source and linked
|
# Returns whether or not the +src+ can be compiled as a C source and
|
||||||
# with its depending libraries successfully. +opt+ is passed to the linker
|
# linked with its depending libraries successfully.
|
||||||
# as options. Note that +$CFLAGS+ and +$LDFLAGS+ are also passed to the
|
# +opt+ is passed to the linker as options. Note that +$CFLAGS+ and +$LDFLAGS+
|
||||||
# linker.
|
# are also passed to the linker.
|
||||||
#
|
#
|
||||||
# If a block given, it is called with the source before compilation. You can
|
# If a block given, it is called with the source before compilation. You can
|
||||||
# modify the source in the block.
|
# modify the source in the block.
|
||||||
@ -508,9 +489,9 @@ MSG
|
|||||||
rm_f "conftest*", "c0x32*"
|
rm_f "conftest*", "c0x32*"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the +src+ can be compiled as a C source. +opt+ is
|
# Returns whether or not the +src+ can be compiled as a C source.
|
||||||
# passed to the C compiler as options. Note that +$CFLAGS+ is also passed to
|
# +opt+ is passed to the C compiler as options. Note that +$CFLAGS+ is
|
||||||
# the compiler.
|
# also passed to the compiler.
|
||||||
#
|
#
|
||||||
# If a block given, it is called with the source before compilation. You can
|
# If a block given, it is called with the source before compilation. You can
|
||||||
# modify the source in the block.
|
# modify the source in the block.
|
||||||
@ -523,12 +504,12 @@ MSG
|
|||||||
rm_f "conftest*"
|
rm_f "conftest*"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the +src+ can be preprocessed with the C
|
# Returns whether or not the +src+ can be preprocessed with the C preprocessor.
|
||||||
# preprocessor. +opt+ is passed to the preprocessor as options. Note that
|
# +opt+ is passed to the preprocessor as options. Note that +$CFLAGS+ is
|
||||||
# +$CFLAGS+ is also passed to the preprocessor.
|
# also passed to the preprocessor.
|
||||||
#
|
#
|
||||||
# If a block given, it is called with the source before preprocessing. You
|
# If a block given, it is called with the source before preprocessing. You can
|
||||||
# can modify the source in the block.
|
# modify the source in the block.
|
||||||
#
|
#
|
||||||
# [+src+] a String which contains a C source
|
# [+src+] a String which contains a C source
|
||||||
# [+opt+] a String which contains preprocessor options
|
# [+opt+] a String which contains preprocessor options
|
||||||
@ -538,7 +519,9 @@ MSG
|
|||||||
rm_f "conftest*"
|
rm_f "conftest*"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Object
|
||||||
alias_method :try_header, (config_string('try_header') || :try_cpp)
|
alias_method :try_header, (config_string('try_header') || :try_cpp)
|
||||||
|
end
|
||||||
|
|
||||||
def cpp_include(header)
|
def cpp_include(header)
|
||||||
if header
|
if header
|
||||||
@ -633,8 +616,8 @@ int main() {printf("%d\\n", conftest_const); return 0;}
|
|||||||
#
|
#
|
||||||
# [+func+] a String which contains a symbol name
|
# [+func+] a String which contains a symbol name
|
||||||
# [+libs+] a String which contains library names.
|
# [+libs+] a String which contains library names.
|
||||||
# [+headers+] a String or an Array of strings which contains names of header
|
# [+headers+] a String or an Array of strings which contains
|
||||||
# files.
|
# names of header files.
|
||||||
def try_func(func, libs, headers = nil, opt = "", &b)
|
def try_func(func, libs, headers = nil, opt = "", &b)
|
||||||
headers = cpp_include(headers)
|
headers = cpp_include(headers)
|
||||||
case func
|
case func
|
||||||
@ -684,8 +667,8 @@ int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return 0; }
|
|||||||
SRC
|
SRC
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the +src+ can be preprocessed with the C
|
# Returns whether or not the +src+ can be preprocessed with the C preprocessor and
|
||||||
# preprocessor and matches with +pat+.
|
# matches with +pat+.
|
||||||
#
|
#
|
||||||
# If a block given, it is called with the source before compilation. You can
|
# If a block given, it is called with the source before compilation. You can
|
||||||
# modify the source in the block.
|
# modify the source in the block.
|
||||||
@ -694,7 +677,8 @@ SRC
|
|||||||
# [+src+] a String which contains a C source
|
# [+src+] a String which contains a C source
|
||||||
# [+opt+] a String which contains preprocessor options
|
# [+opt+] a String which contains preprocessor options
|
||||||
#
|
#
|
||||||
# NOTE: When pat is a Regexp the matching will be checked in process,
|
# Note:
|
||||||
|
# When pat is a Regexp the matching will be checked in process,
|
||||||
# otherwise egrep(1) will be invoked to check it.
|
# otherwise egrep(1) will be invoked to check it.
|
||||||
def egrep_cpp(pat, src, opt = "", &b)
|
def egrep_cpp(pat, src, opt = "", &b)
|
||||||
src = create_tmpsrc(src, &b)
|
src = create_tmpsrc(src, &b)
|
||||||
@ -734,15 +718,13 @@ SRC
|
|||||||
SRC
|
SRC
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not:
|
# Returns whether or not
|
||||||
# * the +src+ can be compiled as a C source,
|
# * the +src+ can be compiled as a C source,
|
||||||
# * the result object can be linked with its depending libraries
|
# * the result object can be linked with its depending libraries successfully,
|
||||||
# successfully,
|
|
||||||
# * the linked file can be invoked as an executable
|
# * the linked file can be invoked as an executable
|
||||||
# * and the executable exits successfully
|
# * and the executable exits successfully
|
||||||
#
|
# +opt+ is passed to the linker as options. Note that +$CFLAGS+ and +$LDFLAGS+
|
||||||
# +opt+ is passed to the linker as options. Note that +$CFLAGS+ and
|
# are also passed to the linker.
|
||||||
# +$LDFLAGS+ are also passed to the linker.
|
|
||||||
#
|
#
|
||||||
# If a block given, it is called with the source before compilation. You can
|
# If a block given, it is called with the source before compilation. You can
|
||||||
# modify the source in the block.
|
# modify the source in the block.
|
||||||
@ -750,8 +732,8 @@ SRC
|
|||||||
# [+src+] a String which contains a C source
|
# [+src+] a String which contains a C source
|
||||||
# [+opt+] a String which contains linker options
|
# [+opt+] a String which contains linker options
|
||||||
#
|
#
|
||||||
# Returns true when the executable exits successfully, false when it fails,
|
# @return true when the executable exits successfully, false when it fails, or
|
||||||
# or nil when preprocessing, compilation or link fails.
|
# nil when preprocessing, compilation or link fails.
|
||||||
def try_run(src, opt = "", &b)
|
def try_run(src, opt = "", &b)
|
||||||
if try_link0(src, opt, &b)
|
if try_link0(src, opt, &b)
|
||||||
xsystem("./conftest")
|
xsystem("./conftest")
|
||||||
@ -868,15 +850,15 @@ SRC
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the given entry point +func+ can be found within
|
# Returns whether or not the given entry point +func+ can be found within
|
||||||
# +lib+. If +func+ is nil, the <code>main()</code> entry point is used by
|
# +lib+. If +func+ is nil, the 'main()' entry point is used by default.
|
||||||
# default. If found, it adds the library to list of libraries to be used
|
# If found, it adds the library to list of libraries to be used when linking
|
||||||
# when linking your extension.
|
# your extension.
|
||||||
#
|
#
|
||||||
# If +headers+ are provided, it will include those header files as the
|
# If +headers+ are provided, it will include those header files as the
|
||||||
# header files it looks in when searching for +func+.
|
# header files it looks in when searching for +func+.
|
||||||
#
|
#
|
||||||
# The real name of the library to be linked can be altered by
|
# The real name of the library to be linked can be altered by
|
||||||
# <code>--with-FOOlib</code> configuration option.
|
# '--with-FOOlib' configuration option.
|
||||||
#
|
#
|
||||||
def have_library(lib, func = nil, headers = nil, opt = "", &b)
|
def have_library(lib, func = nil, headers = nil, opt = "", &b)
|
||||||
func = "main" if !func or func.empty?
|
func = "main" if !func or func.empty?
|
||||||
@ -896,10 +878,9 @@ SRC
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the entry point +func+ can be found within the
|
# Returns whether or not the entry point +func+ can be found within the library
|
||||||
# library +lib+ in one of the +paths+ specified, where +paths+ is an array
|
# +lib+ in one of the +paths+ specified, where +paths+ is an array of strings.
|
||||||
# of strings. If +func+ is nil , then the <code>main()</code> function is
|
# If +func+ is nil , then the main() function is used as the entry point.
|
||||||
# used as the entry point.
|
|
||||||
#
|
#
|
||||||
# If +lib+ is found, then the path it was found on is added to the list of
|
# If +lib+ is found, then the path it was found on is added to the list of
|
||||||
# library paths searched and linked against.
|
# library paths searched and linked against.
|
||||||
@ -927,12 +908,12 @@ SRC
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the function +func+ can be found in the common
|
# Returns whether or not the function +func+ can be found in the common
|
||||||
# header files, or within any +headers+ that you provide. If found, a macro
|
# header files, or within any +headers+ that you provide. If found, a
|
||||||
# is passed as a preprocessor constant to the compiler using the function
|
# macro is passed as a preprocessor constant to the compiler using the
|
||||||
# name, in uppercase, prepended with +HAVE_+.
|
# function name, in uppercase, prepended with 'HAVE_'.
|
||||||
#
|
#
|
||||||
# For example, if <code>have_func('foo')</code> returned true, then the
|
# For example, if have_func('foo') returned true, then the HAVE_FOO
|
||||||
# +HAVE_FOO+ preprocessor macro would be passed to the compiler.
|
# preprocessor macro would be passed to the compiler.
|
||||||
#
|
#
|
||||||
def have_func(func, headers = nil, opt = "", &b)
|
def have_func(func, headers = nil, opt = "", &b)
|
||||||
checking_for checking_message(func.funcall_style, headers, opt) do
|
checking_for checking_message(func.funcall_style, headers, opt) do
|
||||||
@ -946,12 +927,12 @@ SRC
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the variable +var+ can be found in the common
|
# Returns whether or not the variable +var+ can be found in the common
|
||||||
# header files, or within any +headers+ that you provide. If found, a macro
|
# header files, or within any +headers+ that you provide. If found, a
|
||||||
# is passed as a preprocessor constant to the compiler using the variable
|
# macro is passed as a preprocessor constant to the compiler using the
|
||||||
# name, in uppercase, prepended with +HAVE_+.
|
# variable name, in uppercase, prepended with 'HAVE_'.
|
||||||
#
|
#
|
||||||
# For example, if <code>have_var('foo')</code> returned true, then the
|
# For example, if have_var('foo') returned true, then the HAVE_FOO
|
||||||
# +HAVE_FOO+ preprocessor macro would be passed to the compiler.
|
# preprocessor macro would be passed to the compiler.
|
||||||
#
|
#
|
||||||
def have_var(var, headers = nil, opt = "", &b)
|
def have_var(var, headers = nil, opt = "", &b)
|
||||||
checking_for checking_message(var, headers, opt) do
|
checking_for checking_message(var, headers, opt) do
|
||||||
@ -965,11 +946,11 @@ SRC
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the given +header+ file can be found on your system.
|
# Returns whether or not the given +header+ file can be found on your system.
|
||||||
# If found, a macro is passed as a preprocessor constant to the compiler
|
# If found, a macro is passed as a preprocessor constant to the compiler using
|
||||||
# using the header file name, in uppercase, prepended with +HAVE_+.
|
# the header file name, in uppercase, prepended with 'HAVE_'.
|
||||||
#
|
#
|
||||||
# For example, if <code>have_header('foo.h')</code> returned true, then the
|
# For example, if have_header('foo.h') returned true, then the HAVE_FOO_H
|
||||||
# +HAVE_FOO_H+ preprocessor macro would be passed to the compiler.
|
# preprocessor macro would be passed to the compiler.
|
||||||
#
|
#
|
||||||
def have_header(header, preheaders = nil, opt = "", &b)
|
def have_header(header, preheaders = nil, opt = "", &b)
|
||||||
checking_for header do
|
checking_for header do
|
||||||
@ -983,12 +964,11 @@ SRC
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the given +framework+ can be found on your system.
|
# Returns whether or not the given +framework+ can be found on your system.
|
||||||
# If found, a macro is passed as a preprocessor constant to the compiler
|
# If found, a macro is passed as a preprocessor constant to the compiler using
|
||||||
# using the framework name, in uppercase, prepended with +HAVE_FRAMEWORK_+.
|
# the framework name, in uppercase, prepended with 'HAVE_FRAMEWORK_'.
|
||||||
#
|
#
|
||||||
# For example, if <code>have_framework('Ruby')</code> returned true, then
|
# For example, if have_framework('Ruby') returned true, then the HAVE_FRAMEWORK_RUBY
|
||||||
# the +HAVE_FRAMEWORK_RUBY+ preprocessor macro would be passed to the
|
# preprocessor macro would be passed to the compiler.
|
||||||
# compiler.
|
|
||||||
#
|
#
|
||||||
def have_framework(fw, &b)
|
def have_framework(fw, &b)
|
||||||
checking_for fw do
|
checking_for fw do
|
||||||
@ -1007,8 +987,7 @@ SRC
|
|||||||
# provided, and returns whether or not it was found in those paths.
|
# provided, and returns whether or not it was found in those paths.
|
||||||
#
|
#
|
||||||
# If the header is found then the path it was found on is added to the list
|
# If the header is found then the path it was found on is added to the list
|
||||||
# of included directories that are sent to the compiler (via the
|
# of included directories that are sent to the compiler (via the -I switch).
|
||||||
# <code>-I</code> switch).
|
|
||||||
#
|
#
|
||||||
def find_header(header, *paths)
|
def find_header(header, *paths)
|
||||||
message = checking_message(header, paths)
|
message = checking_message(header, paths)
|
||||||
@ -1032,19 +1011,17 @@ SRC
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the struct of type +type+ contains +member+. If
|
# Returns whether or not the struct of type +type+ contains +member+. If
|
||||||
# it does not, or the struct type can't be found, then false is returned.
|
# it does not, or the struct type can't be found, then false is returned. You
|
||||||
# You may optionally specify additional +headers+ in which to look for the
|
# may optionally specify additional +headers+ in which to look for the struct
|
||||||
# struct (in addition to the common header files).
|
# (in addition to the common header files).
|
||||||
#
|
#
|
||||||
# If found, a macro is passed as a preprocessor constant to the compiler
|
# If found, a macro is passed as a preprocessor constant to the compiler using
|
||||||
# using the type name and the member name, in uppercase, prepended with
|
# the type name and the member name, in uppercase, prepended with 'HAVE_'.
|
||||||
# +HAVE_+.
|
|
||||||
#
|
#
|
||||||
# For example, if <code>have_struct_member('struct foo', 'bar')</code>
|
# For example, if have_struct_member('struct foo', 'bar') returned true, then the
|
||||||
# returned true, then the +HAVE_STRUCT_FOO_BAR+ preprocessor macro would be
|
# HAVE_STRUCT_FOO_BAR preprocessor macro would be passed to the compiler.
|
||||||
# passed to the compiler.
|
|
||||||
#
|
#
|
||||||
# +HAVE_ST_BAR+ is also defined for backward compatibility.
|
# HAVE_ST_BAR is also defined for backward compatibility.
|
||||||
#
|
#
|
||||||
def have_struct_member(type, member, headers = nil, opt = "", &b)
|
def have_struct_member(type, member, headers = nil, opt = "", &b)
|
||||||
checking_for checking_message("#{type}.#{member}", headers) do
|
checking_for checking_message("#{type}.#{member}", headers) do
|
||||||
@ -1088,11 +1065,11 @@ SRC
|
|||||||
# You may also pass additional flags to +opt+ which are then passed along to
|
# You may also pass additional flags to +opt+ which are then passed along to
|
||||||
# the compiler.
|
# the compiler.
|
||||||
#
|
#
|
||||||
# If found, a macro is passed as a preprocessor constant to the compiler
|
# If found, a macro is passed as a preprocessor constant to the compiler using
|
||||||
# using the type name, in uppercase, prepended with +HAVE_TYPE_+.
|
# the type name, in uppercase, prepended with 'HAVE_TYPE_'.
|
||||||
#
|
#
|
||||||
# For example, if <code>have_type('foo')</code> returned true, then the
|
# For example, if have_type('foo') returned true, then the HAVE_TYPE_FOO
|
||||||
# +HAVE_TYPE_FOO+ preprocessor macro would be passed to the compiler.
|
# preprocessor macro would be passed to the compiler.
|
||||||
#
|
#
|
||||||
def have_type(type, headers = nil, opt = "", &b)
|
def have_type(type, headers = nil, opt = "", &b)
|
||||||
checking_for checking_message(type, headers, opt) do
|
checking_for checking_message(type, headers, opt) do
|
||||||
@ -1120,7 +1097,7 @@ SRC
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not the constant +const+ is defined.
|
# Returns whether or not the Constant +const+ is defined.
|
||||||
#
|
#
|
||||||
# See also +have_const+
|
# See also +have_const+
|
||||||
#
|
#
|
||||||
@ -1141,19 +1118,19 @@ SRC
|
|||||||
|
|
||||||
# Returns whether or not the constant +const+ is defined. You may
|
# Returns whether or not the constant +const+ is defined. You may
|
||||||
# optionally pass the +type+ of +const+ as <code>[const, type]</code>,
|
# optionally pass the +type+ of +const+ as <code>[const, type]</code>,
|
||||||
# such as:
|
# like as:
|
||||||
#
|
#
|
||||||
# have_const(%w[PTHREAD_MUTEX_INITIALIZER pthread_mutex_t], "pthread.h")
|
# have_const(%w[PTHREAD_MUTEX_INITIALIZER pthread_mutex_t], "pthread.h")
|
||||||
#
|
#
|
||||||
# You may also pass additional +headers+ to check against in addition to the
|
# You may also pass additional +headers+ to check against in addition
|
||||||
# common header files, and additional flags to +opt+ which are then passed
|
# to the common header files, and additional flags to +opt+ which are
|
||||||
# along to the compiler.
|
# then passed along to the compiler.
|
||||||
#
|
#
|
||||||
# If found, a macro is passed as a preprocessor constant to the compiler
|
# If found, a macro is passed as a preprocessor constant to the compiler using
|
||||||
# using the type name, in uppercase, prepended with +HAVE_CONST_+.
|
# the type name, in uppercase, prepended with 'HAVE_CONST_'.
|
||||||
#
|
#
|
||||||
# For example, if <code>have_const('foo')</code> returned true, then the
|
# For example, if have_const('foo') returned true, then the HAVE_CONST_FOO
|
||||||
# +HAVE_CONST_FOO+ preprocessor macro would be passed to the compiler.
|
# preprocessor macro would be passed to the compiler.
|
||||||
#
|
#
|
||||||
def have_const(const, headers = nil, opt = "", &b)
|
def have_const(const, headers = nil, opt = "", &b)
|
||||||
checking_for checking_message([*const].compact.join(' '), headers, opt) do
|
checking_for checking_message([*const].compact.join(' '), headers, opt) do
|
||||||
@ -1161,8 +1138,8 @@ SRC
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# :stopdoc:
|
|
||||||
STRING_OR_FAILED_FORMAT = "%s"
|
STRING_OR_FAILED_FORMAT = "%s"
|
||||||
|
# :stopdoc:
|
||||||
def STRING_OR_FAILED_FORMAT.%(x)
|
def STRING_OR_FAILED_FORMAT.%(x)
|
||||||
x ? super : "failed"
|
x ? super : "failed"
|
||||||
end
|
end
|
||||||
@ -1185,16 +1162,15 @@ SRC
|
|||||||
|
|
||||||
# :startdoc:
|
# :startdoc:
|
||||||
|
|
||||||
# Returns the size of the given +type+. You may optionally specify
|
# Returns the size of the given +type+. You may optionally specify additional
|
||||||
# additional +headers+ to search in for the +type+.
|
# +headers+ to search in for the +type+.
|
||||||
#
|
#
|
||||||
# If found, a macro is passed as a preprocessor constant to the compiler
|
# If found, a macro is passed as a preprocessor constant to the compiler using
|
||||||
# using the type name, in uppercase, prepended with +SIZEOF_+, followed by
|
# the type name, in uppercase, prepended with 'SIZEOF_', followed by the type
|
||||||
# the type name, followed by <code>=X</code> where "X" is the actual size.
|
# name, followed by '=X' where 'X' is the actual size.
|
||||||
#
|
#
|
||||||
# For example, if <code>check_sizeof('mystruct')</code> returned 12, then
|
# For example, if check_sizeof('mystruct') returned 12, then the
|
||||||
# the <code>SIZEOF_MYSTRUCT=12</code> preprocessor macro would be passed to
|
# SIZEOF_MYSTRUCT=12 preprocessor macro would be passed to the compiler.
|
||||||
# the compiler.
|
|
||||||
#
|
#
|
||||||
def check_sizeof(type, headers = nil, opts = "", &b)
|
def check_sizeof(type, headers = nil, opts = "", &b)
|
||||||
typedef, member, prelude = typedef_expr(type, headers)
|
typedef, member, prelude = typedef_expr(type, headers)
|
||||||
@ -1210,20 +1186,20 @@ SRC
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the signedness of the given +type+. You may optionally specify
|
# Returns the signedness of the given +type+. You may optionally
|
||||||
# additional +headers+ to search in for the +type+.
|
# specify additional +headers+ to search in for the +type+.
|
||||||
#
|
#
|
||||||
# If the +type+ is found and is a numeric type, a macro is passed as a
|
# If the +type+ is found and is a numeric type, a macro is passed as a
|
||||||
# preprocessor constant to the compiler using the +type+ name, in uppercase,
|
# preprocessor constant to the compiler using the +type+ name, in
|
||||||
# prepended with +SIGNEDNESS_OF_+, followed by the +type+ name, followed by
|
# uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+
|
||||||
# <code>=X</code> where "X" is positive integer if the +type+ is unsigned
|
# name, followed by '=X' where 'X' is positive integer if the +type+ is
|
||||||
# and a negative integer if the +type+ is signed.
|
# unsigned, or negative integer if the +type+ is signed.
|
||||||
#
|
#
|
||||||
# For example, if +size_t+ is defined as unsigned, then
|
# For example, if size_t is defined as unsigned, then
|
||||||
# <code>check_signedness('size_t')</code> would return +1 and the
|
# check_signedness('size_t') would returned +1 and the
|
||||||
# <code>SIGNEDNESS_OF_SIZE_T=+1</code> preprocessor macro would be passed to
|
# SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the
|
||||||
# the compiler. The <code>SIGNEDNESS_OF_INT=-1</code> macro would be set
|
# compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is
|
||||||
# for <code>check_signedness('int')</code>
|
# done.
|
||||||
#
|
#
|
||||||
def check_signedness(type, headers = nil, opts = nil, &b)
|
def check_signedness(type, headers = nil, opts = nil, &b)
|
||||||
typedef, member, prelude = typedef_expr(type, headers)
|
typedef, member, prelude = typedef_expr(type, headers)
|
||||||
@ -1238,28 +1214,25 @@ SRC
|
|||||||
|
|
||||||
# Returns the convertible integer type of the given +type+. You may
|
# Returns the convertible integer type of the given +type+. You may
|
||||||
# optionally specify additional +headers+ to search in for the +type+.
|
# optionally specify additional +headers+ to search in for the +type+.
|
||||||
# _convertible_ means actually the same type, or typedef'd from the same
|
# _Convertible_ means actually same type, or typedefed from same type.
|
||||||
# type.
|
|
||||||
#
|
#
|
||||||
# If the +type+ is a integer type and the _convertible_ type is found,
|
# If the +type+ is a integer type and _convertible_ type is found,
|
||||||
# the following macros are passed as preprocessor constants to the compiler
|
# following macros are passed as preprocessor constants to the
|
||||||
# using the +type+ name, in uppercase.
|
# compiler using the +type+ name, in uppercase.
|
||||||
#
|
#
|
||||||
# * +TYPEOF_+, followed by the +type+ name, followed by <code>=X</code>
|
# * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X'
|
||||||
# where "X" is the found _convertible_ type name.
|
# is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP,
|
||||||
# * +TYP2NUM+ and +NUM2TYP+,
|
# where 'TYP' is the +type+ name in uppercase with replacing '_t'
|
||||||
# where +TYP+ is the +type+ name in uppercase with replacing an +_t+
|
# suffix with 'T', followed by '=X' where 'X' is the macro name to
|
||||||
# suffix with "T", followed by <code>=X</code> where "X" is the macro name
|
# convert +type+ to +Integer+ object, and vice versa.
|
||||||
# to convert +type+ to an Integer object, and vice versa.
|
|
||||||
#
|
#
|
||||||
# For example, if +foobar_t+ is defined as unsigned long, then
|
# For example, if foobar_t is defined as unsigned long, then
|
||||||
# <code>convertible_int("foobar_t")</code> would return "unsigned long", and
|
# convertible_int("foobar_t") would return "unsigned long", and define
|
||||||
# define these macros:
|
# macros:
|
||||||
#
|
#
|
||||||
# #define TYPEOF_FOOBAR_T unsigned long
|
# #define TYPEOF_FOOBAR_T unsigned long
|
||||||
# #define FOOBART2NUM ULONG2NUM
|
# #define FOOBART2NUM ULONG2NUM
|
||||||
# #define NUM2FOOBART NUM2ULONG
|
# #define NUM2FOOBART NUM2ULONG
|
||||||
#
|
|
||||||
def convertible_int(type, headers = nil, opts = nil, &b)
|
def convertible_int(type, headers = nil, opts = nil, &b)
|
||||||
type, macname = *type
|
type, macname = *type
|
||||||
checking_for("convertible type of #{type}", STRING_OR_FAILED_FORMAT) do
|
checking_for("convertible type of #{type}", STRING_OR_FAILED_FORMAT) do
|
||||||
@ -1324,7 +1297,7 @@ int t(void) {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));}
|
|||||||
SRC
|
SRC
|
||||||
end
|
end
|
||||||
|
|
||||||
# Used internally by the what_type? method to check if the _typeof_ GCC
|
# Used internally by the what_type? method to check if _typeof_ GCC
|
||||||
# extension is available.
|
# extension is available.
|
||||||
def have_typeof?
|
def have_typeof?
|
||||||
return $typeof if defined?($typeof)
|
return $typeof if defined?($typeof)
|
||||||
@ -1435,11 +1408,11 @@ SRC
|
|||||||
# :startdoc:
|
# :startdoc:
|
||||||
|
|
||||||
# Searches for the executable +bin+ on +path+. The default path is your
|
# Searches for the executable +bin+ on +path+. The default path is your
|
||||||
# +PATH+ environment variable. If that isn't defined, it will resort to
|
# PATH environment variable. If that isn't defined, it will resort to
|
||||||
# searching /usr/local/bin, /usr/ucb, /usr/bin and /bin.
|
# searching /usr/local/bin, /usr/ucb, /usr/bin and /bin.
|
||||||
#
|
#
|
||||||
# If found, it will return the full path, including the executable name, of
|
# If found, it will return the full path, including the executable name,
|
||||||
# where it was found.
|
# of where it was found.
|
||||||
#
|
#
|
||||||
# Note that this method does not actually affect the generated Makefile.
|
# Note that this method does not actually affect the generated Makefile.
|
||||||
#
|
#
|
||||||
@ -1464,13 +1437,11 @@ SRC
|
|||||||
|
|
||||||
# :startdoc:
|
# :startdoc:
|
||||||
|
|
||||||
# Tests for the presence of a <tt>--with-</tt>_config_ or
|
# Tests for the presence of a --with-<tt>config</tt> or --without-<tt>config</tt>
|
||||||
# <tt>--without-</tt>_config_ option. Returns true if the with option is
|
# option. Returns true if the with option is given, false if the without
|
||||||
# given, false if the without option is given, and the default value
|
# option is given, and the default value otherwise.
|
||||||
# otherwise.
|
|
||||||
#
|
#
|
||||||
# This can be useful for adding custom definitions, such as debug
|
# This can be useful for adding custom definitions, such as debug information.
|
||||||
# information.
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
#
|
#
|
||||||
@ -1499,13 +1470,11 @@ SRC
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tests for the presence of an <tt>--enable-</tt>_config_ or
|
# Tests for the presence of an --enable-<tt>config</tt> or
|
||||||
# <tt>--disable-</tt>_config_ option. Returns true if the enable option is
|
# --disable-<tt>config</tt> option. Returns true if the enable option is given,
|
||||||
# given, false if the disable option is given, and the default value
|
# false if the disable option is given, and the default value otherwise.
|
||||||
# otherwise.
|
|
||||||
#
|
#
|
||||||
# This can be useful for adding custom definitions, such as debug
|
# This can be useful for adding custom definitions, such as debug information.
|
||||||
# information.
|
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
#
|
#
|
||||||
@ -1525,10 +1494,10 @@ SRC
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generates a header file consisting of the various macro definitions
|
# Generates a header file consisting of the various macro definitions generated
|
||||||
# generated by other methods such as have_func and have_header. These are
|
# by other methods such as have_func and have_header. These are then wrapped in
|
||||||
# then wrapped in a custom <code>#ifndef</code> based on the +header+ file
|
# a custom #ifndef based on the +header+ file name, which defaults to
|
||||||
# name, which defaults to "extconf.h".
|
# 'extconf.h'.
|
||||||
#
|
#
|
||||||
# For example:
|
# For example:
|
||||||
#
|
#
|
||||||
@ -1573,17 +1542,16 @@ SRC
|
|||||||
$extconf_h = header
|
$extconf_h = header
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sets a +target+ name that the user can then use to configure various
|
# Sets a +target+ name that the user can then use to configure various 'with'
|
||||||
# "with" options with on the command line by using that name. For example,
|
# options with on the command line by using that name. For example, if the
|
||||||
# if the target is set to "foo", then the user could use the
|
# target is set to "foo", then the user could use the --with-foo-dir command
|
||||||
# <code>--with-foo-dir</code> command line option.
|
# line option.
|
||||||
#
|
#
|
||||||
# You may pass along additional "include" or "lib" defaults via the
|
# You may pass along additional 'include' or 'lib' defaults via the +idefault+
|
||||||
# +idefault+ and +ldefault+ parameters, respectively.
|
# and +ldefault+ parameters, respectively.
|
||||||
#
|
#
|
||||||
# Note that dir_config only adds to the list of places to search for
|
# Note that dir_config only adds to the list of places to search for libraries
|
||||||
# libraries and include files. It does not link the libraries into your
|
# and include files. It does not link the libraries into your application.
|
||||||
# application.
|
|
||||||
#
|
#
|
||||||
def dir_config(target, idefault=nil, ldefault=nil)
|
def dir_config(target, idefault=nil, ldefault=nil)
|
||||||
if dir = with_config(target + "-dir", (idefault unless ldefault))
|
if dir = with_config(target + "-dir", (idefault unless ldefault))
|
||||||
@ -1825,8 +1793,8 @@ all install static install-so install-rb: Makefile
|
|||||||
RULES
|
RULES
|
||||||
end
|
end
|
||||||
|
|
||||||
# Processes the data contents of the "depend" file. Each line of this file
|
# Processes the data contents of the "depend" file.
|
||||||
# is expected to be a file name.
|
# Each line of this file is expected to be a file name.
|
||||||
#
|
#
|
||||||
# Returns the output of findings, in Makefile format.
|
# Returns the output of findings, in Makefile format.
|
||||||
#
|
#
|
||||||
@ -1890,29 +1858,28 @@ RULES
|
|||||||
# preprocessor constants that you may have generated through other methods.
|
# preprocessor constants that you may have generated through other methods.
|
||||||
#
|
#
|
||||||
# The +target+ name should correspond the name of the global function name
|
# The +target+ name should correspond the name of the global function name
|
||||||
# defined within your C extension, minus the +Init_+. For example, if your
|
# defined within your C extension, minus the 'Init_'. For example, if your
|
||||||
# C extension is defined as +Init_foo+, then your target would simply be
|
# C extension is defined as 'Init_foo', then your target would simply be 'foo'.
|
||||||
# "foo".
|
|
||||||
#
|
#
|
||||||
# If any "/" characters are present in the target name, only the last name
|
# If any '/' characters are present in the target name, only the last name
|
||||||
# is interpreted as the target name, and the rest are considered toplevel
|
# is interpreted as the target name, and the rest are considered toplevel
|
||||||
# directory names, and the generated Makefile will be altered accordingly to
|
# directory names, and the generated Makefile will be altered accordingly to
|
||||||
# follow that directory structure.
|
# follow that directory structure.
|
||||||
#
|
#
|
||||||
# For example, if you pass "test/foo" as a target name, your extension will
|
# For example, if you pass 'test/foo' as a target name, your extension will
|
||||||
# be installed under the "test" directory. This means that in order to
|
# be installed under the 'test' directory. This means that in order to
|
||||||
# load the file within a Ruby program later, that directory structure will
|
# load the file within a Ruby program later, that directory structure will
|
||||||
# have to be followed, e.g. <code>require 'test/foo'</code>.
|
# have to be followed, e.g. "require 'test/foo'".
|
||||||
#
|
#
|
||||||
# The +srcprefix+ should be used when your source files are not in the same
|
# The +srcprefix+ should be used when your source files are not in the same
|
||||||
# directory as your build script. This will not only eliminate the need for
|
# directory as your build script. This will not only eliminate the need for
|
||||||
# you to manually copy the source files into the same directory as your
|
# you to manually copy the source files into the same directory as your build
|
||||||
# build script, but it also sets the proper +target_prefix+ in the generated
|
# script, but it also sets the proper +target_prefix+ in the generated
|
||||||
# Makefile.
|
# Makefile.
|
||||||
#
|
#
|
||||||
# Setting the +target_prefix+ will, in turn, install the generated binary in
|
# Setting the +target_prefix+ will, in turn, install the generated binary in
|
||||||
# a directory under your <code>RbConfig::CONFIG['sitearchdir']</code> that
|
# a directory under your RbConfig::CONFIG['sitearchdir'] that mimics your local
|
||||||
# mimics your local filesystem when you run <code>make install</code>.
|
# filesystem when you run 'make install'.
|
||||||
#
|
#
|
||||||
# For example, given the following file tree:
|
# For example, given the following file tree:
|
||||||
#
|
#
|
||||||
@ -1925,9 +1892,9 @@ RULES
|
|||||||
#
|
#
|
||||||
# create_makefile('test/foo', 'test')
|
# create_makefile('test/foo', 'test')
|
||||||
#
|
#
|
||||||
# That will set the +target_prefix+ in the generated Makefile to "test".
|
# That will set the +target_prefix+ in the generated Makefile to 'test'. That,
|
||||||
# That, in turn, will create the following file tree when installed via the
|
# in turn, will create the following file tree when installed via the
|
||||||
# <code>make install</code> command:
|
# 'make install' command:
|
||||||
#
|
#
|
||||||
# /path/to/ruby/sitearchdir/test/foo.so
|
# /path/to/ruby/sitearchdir/test/foo.so
|
||||||
#
|
#
|
||||||
@ -1936,8 +1903,8 @@ RULES
|
|||||||
# libraries may depend on the +target_prefix+ being set properly.
|
# libraries may depend on the +target_prefix+ being set properly.
|
||||||
#
|
#
|
||||||
# The +srcprefix+ argument can be used to override the default source
|
# The +srcprefix+ argument can be used to override the default source
|
||||||
# directory, i.e. the current directory. It is included as part of the
|
# directory, i.e. the current directory . It is included as part of the VPATH
|
||||||
# +VPATH+ and added to the list of +INCFLAGS+.
|
# and added to the list of INCFLAGS.
|
||||||
#
|
#
|
||||||
def create_makefile(target, srcprefix = nil)
|
def create_makefile(target, srcprefix = nil)
|
||||||
$target = target
|
$target = target
|
||||||
@ -2261,9 +2228,9 @@ site-install-rb: install-rb
|
|||||||
end
|
end
|
||||||
|
|
||||||
FailedMessage = <<MESSAGE
|
FailedMessage = <<MESSAGE
|
||||||
Could not create Makefile due to some reason, probably lack of necessary
|
Could not create Makefile due to some reason, probably lack of
|
||||||
libraries and/or headers. Check the mkmf.log file for more details. You may
|
necessary libraries and/or headers. Check the mkmf.log file for more
|
||||||
need configuration options.
|
details. You may need configuration options.
|
||||||
|
|
||||||
Provided configuration options:
|
Provided configuration options:
|
||||||
MESSAGE
|
MESSAGE
|
||||||
@ -2280,11 +2247,8 @@ MESSAGE
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Initializes mkmf for creating a makefile.
|
# :startdoc:
|
||||||
#
|
|
||||||
# Internal use only.
|
|
||||||
#
|
|
||||||
def make_makefile
|
|
||||||
init_mkmf
|
init_mkmf
|
||||||
|
|
||||||
$make = with_config("make-prog", ENV["MAKE"] || "make")
|
$make = with_config("make-prog", ENV["MAKE"] || "make")
|
||||||
@ -2312,9 +2276,6 @@ MESSAGE
|
|||||||
end
|
end
|
||||||
$configure_args["--topdir"] ||= $curdir
|
$configure_args["--topdir"] ||= $curdir
|
||||||
$ruby = arg_config("--ruby", File.join(RbConfig::CONFIG["bindir"], CONFIG["ruby_install_name"]))
|
$ruby = arg_config("--ruby", File.join(RbConfig::CONFIG["bindir"], CONFIG["ruby_install_name"]))
|
||||||
end
|
|
||||||
|
|
||||||
# :startdoc:
|
|
||||||
|
|
||||||
split = Shellwords.method(:shellwords).to_proc
|
split = Shellwords.method(:shellwords).to_proc
|
||||||
|
|
||||||
@ -2335,23 +2296,13 @@ MESSAGE
|
|||||||
COMMON_HEADERS = hdr.join("\n")
|
COMMON_HEADERS = hdr.join("\n")
|
||||||
COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
|
COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
|
||||||
|
|
||||||
# Default Makefile compile rules
|
|
||||||
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')
|
||||||
|
|
||||||
# Make command to compile a C file
|
|
||||||
COMPILE_C = config_string('COMPILE_C') || '$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<'
|
COMPILE_C = config_string('COMPILE_C') || '$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<'
|
||||||
|
|
||||||
# Make command to compile a C++ file
|
|
||||||
COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<'
|
COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<'
|
||||||
|
|
||||||
# Command for attempting to link libraries and frameworks specified in
|
|
||||||
# extconf.rb
|
|
||||||
TRY_LINK = config_string('TRY_LINK') ||
|
TRY_LINK = config_string('TRY_LINK') ||
|
||||||
"$(CC) #{OUTFLAG}conftest $(INCFLAGS) $(CPPFLAGS) " \
|
"$(CC) #{OUTFLAG}conftest $(INCFLAGS) $(CPPFLAGS) " \
|
||||||
"$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
|
"$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
|
||||||
|
|
||||||
# Makefile command for linking a library
|
|
||||||
LINK_SO = config_string('LINK_SO') ||
|
LINK_SO = config_string('LINK_SO') ||
|
||||||
if CONFIG["DLEXT"] == $OBJEXT
|
if CONFIG["DLEXT"] == $OBJEXT
|
||||||
"ld $(DLDFLAGS) -r -o $@ $(OBJS)\n"
|
"ld $(DLDFLAGS) -r -o $@ $(OBJS)\n"
|
||||||
@ -2359,22 +2310,14 @@ MESSAGE
|
|||||||
"$(LDSHARED) #{OUTFLAG}$@ $(OBJS) " \
|
"$(LDSHARED) #{OUTFLAG}$@ $(OBJS) " \
|
||||||
"$(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)"
|
"$(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Linker flag that adds a new library search path
|
|
||||||
LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"'
|
LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"'
|
||||||
RPATHFLAG = config_string('RPATHFLAG') || ''
|
RPATHFLAG = config_string('RPATHFLAG') || ''
|
||||||
|
|
||||||
# Linker flag that specifies a library in the library search path
|
|
||||||
LIBARG = config_string('LIBARG') || '-l%s'
|
LIBARG = config_string('LIBARG') || '-l%s'
|
||||||
|
|
||||||
# A definition of <code>main()</code> that does nothing. Used in extconf.rb
|
|
||||||
# to check for libraries, headers, etc.
|
|
||||||
MAIN_DOES_NOTHING = config_string('MAIN_DOES_NOTHING') || 'int main(void) {return 0;}'
|
MAIN_DOES_NOTHING = config_string('MAIN_DOES_NOTHING') || 'int main(void) {return 0;}'
|
||||||
UNIVERSAL_INTS = config_string('UNIVERSAL_INTS') {|s| Shellwords.shellwords(s)} ||
|
UNIVERSAL_INTS = config_string('UNIVERSAL_INTS') {|s| Shellwords.shellwords(s)} ||
|
||||||
%w[int short long long\ long]
|
%w[int short long long\ long]
|
||||||
|
|
||||||
sep = config_string('BUILD_FILE_SEPARATOR') {|s| ":/=#{s}" if s != "/"} || ""
|
sep = config_string('BUILD_FILE_SEPARATOR') {|s| ":/=#{s}" if s != "/"} || ""
|
||||||
# Default Makefile clean targets
|
|
||||||
CLEANINGS = "
|
CLEANINGS = "
|
||||||
clean-rb-default::
|
clean-rb-default::
|
||||||
clean-rb::
|
clean-rb::
|
||||||
@ -2392,13 +2335,7 @@ distclean: clean distclean-so distclean-rb-default distclean-rb
|
|||||||
|
|
||||||
realclean: distclean
|
realclean: distclean
|
||||||
"
|
"
|
||||||
end
|
|
||||||
|
|
||||||
include MakeMakefile
|
|
||||||
|
|
||||||
if not $extmk and /\A(extconf|makefile).rb\z/ =~ File.basename($0)
|
if not $extmk and /\A(extconf|makefile).rb\z/ =~ File.basename($0)
|
||||||
END {mkmf_failed($0)}
|
END {mkmf_failed($0)}
|
||||||
end
|
end
|
||||||
|
|
||||||
make_makefile
|
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class TestMkmf < Test::Unit::TestCase
|
|||||||
remove_const(:MAKEFILE_CONFIG)
|
remove_const(:MAKEFILE_CONFIG)
|
||||||
const_set(:MAKEFILE_CONFIG, mkconfig)
|
const_set(:MAKEFILE_CONFIG, mkconfig)
|
||||||
}
|
}
|
||||||
MakeMakefile.class_eval {
|
Object.class_eval {
|
||||||
remove_const(:CONFIG)
|
remove_const(:CONFIG)
|
||||||
const_set(:CONFIG, mkconfig)
|
const_set(:CONFIG, mkconfig)
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ class TestMkmf < Test::Unit::TestCase
|
|||||||
remove_const(:MAKEFILE_CONFIG)
|
remove_const(:MAKEFILE_CONFIG)
|
||||||
const_set(:MAKEFILE_CONFIG, mkconfig0)
|
const_set(:MAKEFILE_CONFIG, mkconfig0)
|
||||||
}
|
}
|
||||||
MakeMakefile.class_eval {
|
Object.class_eval {
|
||||||
remove_const(:CONFIG)
|
remove_const(:CONFIG)
|
||||||
const_set(:CONFIG, mkconfig0)
|
const_set(:CONFIG, mkconfig0)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user