File: extconf.rb

package info (click to toggle)
ruby 1.4.3-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,068 kB
  • ctags: 7,509
  • sloc: ansic: 60,668; ruby: 23,106; yacc: 4,122; sh: 1,753; lisp: 997; makefile: 597; sed: 68; awk: 36; tcl: 31; perl: 17; python: 6
file content (49 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# extconf.rb for tcltklib

require 'mkmf'

have_library("nsl", "t_open")
have_library("socket", "socket")
have_library("dl", "dlopen")
have_library("m", "log") 

dir_config("tk")
dir_config("tcl")
dir_config("X11")

tklib = with_config("tklib")
tcllib = with_config("tcllib")

def find_tcl(tcllib)
  paths = ["/usr/local/lib", "/usr/pkg"]
  func = "Tcl_FindExecutable"
  if tcllib
    find_library(tcllib, func, *paths)
  else
    find_library("tcl", func, *paths) or
      find_library("tcl8.2", func, *paths) or
      find_library("tcl8.0", func, *paths) or
      find_library("tcl7.6", func, *paths)
  end
end

def find_tk(tklib)
  paths = ["/usr/local/lib", "/usr/pkg"]
  func = "Tk_Init"
  if tklib
    find_library(tklib, func, *paths)
  else
    find_library("tk", func, *paths) or
      find_library("tk8.2", func, *paths) or
      find_library("tk8.0", func, *paths) or
      find_library("tk4.2", func, *paths)
  end
end

if have_header("tcl.h") && have_header("tk.h") &&
    (/mswin32/ =~ RUBY_PLATFORM || find_library("X11", "XOpenDisplay",
	"/usr/X11/lib", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
    find_tcl(tcllib) &&
    find_tk(tklib)
  create_makefile("tcltklib")
end