1998-01-16 07:19:09 -05:00
|
|
|
# extconf.rb for tcltklib
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
require 'mkmf'
|
|
|
|
|
2000-08-08 01:06:24 -04:00
|
|
|
if RUBY_PLATFORM !~ /mswin32|mingw|cygwin/
|
2000-05-13 12:13:31 -04:00
|
|
|
have_library("nsl", "t_open")
|
|
|
|
have_library("socket", "socket")
|
|
|
|
have_library("dl", "dlopen")
|
|
|
|
have_library("m", "log")
|
|
|
|
end
|
1998-01-16 07:19:09 -05:00
|
|
|
|
1999-08-13 01:37:52 -04:00
|
|
|
dir_config("tk")
|
|
|
|
dir_config("tcl")
|
|
|
|
dir_config("X11")
|
1998-01-16 07:19:09 -05:00
|
|
|
|
1999-08-13 01:37:52 -04:00
|
|
|
tklib = with_config("tklib")
|
|
|
|
tcllib = with_config("tcllib")
|
2000-08-08 01:06:24 -04:00
|
|
|
stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs")
|
1998-01-16 07:19:09 -05:00
|
|
|
|
2000-08-08 01:06:24 -04:00
|
|
|
def find_tcl(tcllib, stubs)
|
2000-09-22 14:15:52 -04:00
|
|
|
paths = ["/usr/local/lib", "/usr/pkg", "/usr/lib"]
|
2000-08-08 01:06:24 -04:00
|
|
|
func = stubs ? "Tcl_InitStubs" : "Tcl_FindExecutable"
|
1999-08-13 01:37:52 -04:00
|
|
|
if tcllib
|
|
|
|
find_library(tcllib, func, *paths)
|
2000-09-22 14:15:52 -04:00
|
|
|
elsif RUBY_PLATFORM =~ /mswin32|mingw|cygwin/
|
|
|
|
find_library("tcl", func, *paths) or
|
2000-10-03 04:56:50 -04:00
|
|
|
find_library("tcl84", func, *paths) or
|
2000-09-22 14:15:52 -04:00
|
|
|
find_library("tcl83", func, *paths) or
|
|
|
|
find_library("tcl82", func, *paths) or
|
|
|
|
find_library("tcl80", func, *paths) or
|
|
|
|
find_library("tcl76", func, *paths)
|
1999-08-13 01:37:52 -04:00
|
|
|
else
|
|
|
|
find_library("tcl", func, *paths) or
|
2000-10-03 04:56:50 -04:00
|
|
|
find_library("tcl8.4", func, *paths) or
|
2000-05-24 00:34:26 -04:00
|
|
|
find_library("tcl8.3", func, *paths) or
|
1999-11-04 03:39:57 -05:00
|
|
|
find_library("tcl8.2", func, *paths) or
|
1999-08-13 01:37:52 -04:00
|
|
|
find_library("tcl8.0", func, *paths) or
|
|
|
|
find_library("tcl7.6", func, *paths)
|
|
|
|
end
|
|
|
|
end
|
1998-01-16 07:19:09 -05:00
|
|
|
|
2000-08-08 01:06:24 -04:00
|
|
|
def find_tk(tklib, stubs)
|
2000-09-22 14:15:52 -04:00
|
|
|
paths = ["/usr/local/lib", "/usr/pkg", "/usr/lib"]
|
2000-08-08 01:06:24 -04:00
|
|
|
func = stubs ? "Tk_InitStubs" : "Tk_Init"
|
1999-08-13 01:37:52 -04:00
|
|
|
if tklib
|
|
|
|
find_library(tklib, func, *paths)
|
2000-09-22 14:15:52 -04:00
|
|
|
elsif RUBY_PLATFORM =~ /mswin32|mingw|cygwin/
|
|
|
|
find_library("tk", func, *paths) or
|
2000-10-03 04:56:50 -04:00
|
|
|
find_library("tk84", func, *paths) or
|
2000-09-22 14:15:52 -04:00
|
|
|
find_library("tk83", func, *paths) or
|
|
|
|
find_library("tk82", func, *paths) or
|
|
|
|
find_library("tk80", func, *paths) or
|
|
|
|
find_library("tk42", func, *paths)
|
1999-08-13 01:37:52 -04:00
|
|
|
else
|
|
|
|
find_library("tk", func, *paths) or
|
2000-10-03 04:56:50 -04:00
|
|
|
find_library("tk8.4", func, *paths) or
|
2000-05-24 00:34:26 -04:00
|
|
|
find_library("tk8.3", func, *paths) or
|
1999-11-04 03:39:57 -05:00
|
|
|
find_library("tk8.2", func, *paths) or
|
1999-08-13 01:37:52 -04:00
|
|
|
find_library("tk8.0", func, *paths) or
|
|
|
|
find_library("tk4.2", func, *paths)
|
1999-01-19 23:59:39 -05:00
|
|
|
end
|
1998-01-16 07:19:09 -05:00
|
|
|
end
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
if have_header("tcl.h") && have_header("tk.h") &&
|
2000-05-13 12:13:31 -04:00
|
|
|
(/mswin32|mingw|cygwin/ =~ RUBY_PLATFORM || find_library("X11", "XOpenDisplay",
|
1999-08-13 01:37:52 -04:00
|
|
|
"/usr/X11/lib", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
|
2000-08-08 01:06:24 -04:00
|
|
|
find_tcl(tcllib, stubs) &&
|
|
|
|
find_tk(tklib, stubs)
|
2000-08-09 17:27:10 -04:00
|
|
|
$CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs
|
1998-01-16 07:19:09 -05:00
|
|
|
create_makefile("tcltklib")
|
|
|
|
end
|