mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
This commit was generated by cvs2svn to compensate for changes in r372,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9c5b1986a3
commit
210367ec88
140 changed files with 25635 additions and 14037 deletions
|
@ -1,19 +1,27 @@
|
|||
# extconf.rb for tcltklib
|
||||
|
||||
have_library("socket", "socket")
|
||||
have_library("nsl", "gethostbyname")
|
||||
require 'mkmf'
|
||||
|
||||
def search_file(var, include, *path)
|
||||
have_library("nsl", "t_open")
|
||||
have_library("socket", "socket")
|
||||
have_library("dl", "dlopen")
|
||||
have_library("m", "log")
|
||||
|
||||
$includes = []
|
||||
def search_header(include, *path)
|
||||
pwd = Dir.getwd
|
||||
begin
|
||||
for i in path.reverse!
|
||||
for i in path.sort!.reverse!
|
||||
dir = Dir[i]
|
||||
for path in dir
|
||||
for path in dir.sort!.reverse!
|
||||
next unless File.directory? path
|
||||
Dir.chdir path
|
||||
files = Dir[include]
|
||||
if files.size > 0
|
||||
var << path
|
||||
return files.pop
|
||||
unless $includes.include? path
|
||||
$includes << path
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -22,58 +30,56 @@ def search_file(var, include, *path)
|
|||
end
|
||||
end
|
||||
|
||||
$includes = []
|
||||
search_file($includes,
|
||||
"tcl.h",
|
||||
"/usr/include/tcl*",
|
||||
"/usr/include",
|
||||
"/usr/local/include/tcl*",
|
||||
"/usr/local/include")
|
||||
search_file($includes,
|
||||
"tk.h",
|
||||
"/usr/include/tk*",
|
||||
"/usr/include",
|
||||
"/usr/local/include/tk*",
|
||||
"/usr/local/include")
|
||||
search_file($includes,
|
||||
"X11/Xlib.h",
|
||||
"/usr/include",
|
||||
"/usr/X11*/include",
|
||||
"/usr/include",
|
||||
"/usr/X11*/include")
|
||||
search_header("tcl.h",
|
||||
"/usr/include/tcl{,8*,7*}",
|
||||
"/usr/include",
|
||||
"/usr/local/include/tcl{,8*,7*}",
|
||||
"/usr/local/include")
|
||||
search_header("tk.h",
|
||||
"/usr/include/tk{,8*,4*}",
|
||||
"/usr/include",
|
||||
"/usr/local/include/tk{,8*,4*}",
|
||||
"/usr/local/include")
|
||||
search_header("X11/Xlib.h",
|
||||
"/usr/include/X11*",
|
||||
"/usr/include",
|
||||
"/usr/openwin/include",
|
||||
"/usr/X11*/include")
|
||||
|
||||
$CFLAGS = "-Wall " + $includes.collect{|path| "-I" + path}.join(" ")
|
||||
$CFLAGS = $includes.collect{|path| "-I" + path}.join(" ")
|
||||
|
||||
$libraries = []
|
||||
tcllibfile = search_file($libraries,
|
||||
"libtcl{,7*,8*}.{a,so}",
|
||||
"/usr/lib",
|
||||
"/usr/local/lib")
|
||||
if tcllibfile
|
||||
tcllibfile.sub!(/^lib/, '')
|
||||
tcllibfile.sub!(/\.(a|so)$/, '')
|
||||
def search_lib(file, func, *path)
|
||||
for i in path.reverse!
|
||||
dir = Dir[i]
|
||||
for path in dir.sort!.reverse!
|
||||
$LDFLAGS = $libraries.collect{|p| "-L" + p}.join(" ") + " -L" + path
|
||||
files = Dir[path+"/"+file]
|
||||
if files.size > 0
|
||||
for lib in files.sort!.reverse!
|
||||
lib = File::basename(lib)
|
||||
lib.sub!(/^lib/, '')
|
||||
lib.sub!(/\.(a|so)$/, '')
|
||||
if have_library(lib, func)
|
||||
unless $libraries.include? path
|
||||
$libraries << path
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return false;
|
||||
end
|
||||
tklibfile = search_file($libraries,
|
||||
"libtk{,4*,8*}.{a,so}",
|
||||
"/usr/lib",
|
||||
"/usr/local/lib")
|
||||
if tklibfile
|
||||
tklibfile.sub!(/^lib/, '')
|
||||
tklibfile.sub!(/\.(a|so)$/, '')
|
||||
end
|
||||
search_file($libraries,
|
||||
"libX11.{a,so}",
|
||||
"/usr/lib",
|
||||
"/usr/X11*/lib")
|
||||
|
||||
$LDFLAGS = $libraries.collect{|path| "-L" + path}.join(" ")
|
||||
|
||||
have_library("dl", "dlopen")
|
||||
if have_header("tcl.h") &&
|
||||
have_header("tk.h") &&
|
||||
have_library("X11", "XOpenDisplay") &&
|
||||
have_library("m", "log") &&
|
||||
have_library(tcllibfile, "Tcl_FindExecutable") &&
|
||||
have_library(tklibfile, "Tk_Init")
|
||||
if have_header("tcl.h") && have_header("tk.h") &&
|
||||
search_lib("libX11.{so,a}", "XOpenDisplay",
|
||||
"/usr/lib", "/usr/openwin/lib", "/usr/X11*/lib") &&
|
||||
search_lib("libtcl{8*,7*,}.{so,a}", "Tcl_FindExecutable",
|
||||
"/usr/lib", "/usr/local/lib") &&
|
||||
search_lib("libtk{8*,4*,}.{so,a}", "Tk_Init",
|
||||
"/usr/lib", "/usr/local/lib")
|
||||
$LDFLAGS = $libraries.collect{|path| "-L" + path}.join(" ")
|
||||
create_makefile("tcltklib")
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue