910970ab |
1 | #------------------------------------------------------------------------ |
2 | # Check for TCL |
3 | # Options: --with-tcl= : Specify location of tclConfig.sh |
4 | # --without-tcl= : Skip check for TCL, assume not installed |
5 | # Defines: |
6 | # HAVE_TCL : yes/no |
7 | # Everything from tclConfig.sh |
8 | #------------------------------------------------------------------------ |
9 | AC_DEFUN([SC_TCL_CFG], [ |
10 | AC_ARG_WITH(tcl, |
11 | AC_HELP_STRING([--with-tcl=PATH],[Directory containing tclConfig.sh]) |
12 | AC_HELP_STRING([--without-tcl], [Assume no tcl libraries available]) , |
13 | [with_tcl="${withval}";require_tcl=yes],[with_tcl=yes;require_tcl=no]) |
14 | |
15 | # If user requested disabling of tcl check |
16 | if test "xno" = "x$with_tcl"; then |
17 | HAVE_TCL=no |
18 | require_tcl=no |
19 | # Otherwise... |
20 | else |
21 | HAVE_TCL=no |
22 | # Search for tclConfig.sh |
23 | if test "xyes" != "x$with_tcl"; then |
24 | # If user specified location |
25 | . "${with_tcl}/tclConfig.sh" || AC_MSG_ERROR("Cannot read file: ${with_tcl}/tclConfig.sh") |
26 | HAVE_TCL=yes |
27 | else |
28 | # Search for tclConfig.sh in usual spots |
29 | tcl_cfg_file= |
30 | AC_MSG_CHECKING([for tclConfig.sh]) |
31 | for i in /usr /usr/local ${prefix} /opt/sfw /usr/tcltk; do |
32 | if test -d $i; then |
33 | for j in $i/lib $i/lib/tcl $i/lib/tcl[[8-9]].[[0-9]] $i/lib/itcl; do |
34 | if test -r "$j/tclConfig.sh"; then |
35 | tcl_cfg_file="$j/tclConfig.sh" |
36 | break |
37 | fi |
38 | done |
39 | fi |
40 | if test "x" != "x$tcl_cfg_file"; then |
41 | break |
42 | fi |
43 | done |
44 | AC_MSG_RESULT("$tcl_cfg_file") |
45 | |
46 | if test "x" != "x$tcl_cfg_file"; then |
47 | . "$tcl_cfg_file" || AC_MSG_ERROR("Cannot read file: $tcl_cfg_file") |
48 | HAVE_TCL=yes |
49 | |
50 | # if TCL_INCLUDE_SPEC wasn't defined, try to define it using TCL_INC_DIR |
51 | if test "x" = "x$TCL_INCLUDE_SPEC"; then |
52 | inc_path=`expr "x$TCL_INC_DIR" : "x\(.*\)/tcl-private/generic"` |
53 | if test "x" != "$inc_path"; then |
54 | TCL_INCLUDE_SPEC="-I$inc_path" |
55 | elif test "x" != "x$TCL_INC_DIR"; then |
56 | TCL_INCLUDE_SPEC="-I$TCL_INC_DIR" |
57 | fi |
58 | fi |
59 | else |
60 | HAVE_TCL=no |
61 | fi |
62 | fi |
63 | |
64 | # Check for tcl.h |
65 | AC_LANG_C |
66 | save_CPPFLAGS="$CPPFLAGS" |
67 | CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC" |
68 | AC_CHECK_HEADER([tcl.h],[],[HAVE_TCL=no]) |
69 | CPPFLAGS="$save_CPPFLAGS" |
70 | |
71 | if test "xyes" = "x$require_tcl"; then |
72 | if test "xno" = "x$HAVE_TCL"; then |
73 | AC_MSG_ERROR([TCL not found.]) |
74 | fi |
75 | fi |
76 | fi |
77 | ]) |
78 | |
79 | |
80 | #------------------------------------------------------------------------ |
81 | # Check for Tk |
82 | # Options: --with-tk= : Specify location of Tk |
83 | # --without-tk= : Skip check for Tk, assume not installed |
84 | # Defines: |
85 | # HAVE_TK : yes/no |
86 | # Everything from tkConfig.sh |
87 | #------------------------------------------------------------------------ |
88 | AC_DEFUN([SC_TK_CFG], [ |
89 | AC_ARG_WITH(tk, |
90 | AC_HELP_STRING([--with-tk=PATH],[Directory containing tkConfig.sh]) |
91 | AC_HELP_STRING([--without-tk], [Assume no Tk libraries available]) , |
92 | [with_tk="${withval}";require_tk=yes],[with_tk=yes;require_tk=no]) |
93 | |
94 | # If user requested disabling of Tk check |
95 | if test "xno" = "x$with_tk"; then |
96 | HAVE_TK=no |
97 | require_tk=no |
98 | # Otherwise... |
99 | else |
100 | HAVE_TK=no |
101 | # Search for tkConfig.sh |
102 | if test "xyes" != "x$with_tk"; then |
103 | # If user specified location |
104 | . "${with_tk}/tkConfig.sh" || AC_MSG_ERROR("Cannot read file: ${with_tk}/tkConfig.sh") |
105 | HAVE_TK=yes |
106 | else |
107 | # Search for tkConfig.sh in usual spots |
108 | tk_cfg_file= |
109 | AC_MSG_CHECKING([for tkConfig.sh]) |
110 | for i in /usr /usr/local ${prefix} /opt/sfw /usr/tcltk; do |
111 | if test -d $i; then |
112 | for j in $i/lib $i/lib/tk $i/lib/tk[[8-9]].[[0-9]] $i/lib/itcl; do |
113 | if test -r "$j/tkConfig.sh"; then |
114 | tk_cfg_file="$j/tkConfig.sh" |
115 | break |
116 | fi |
117 | done |
118 | fi |
119 | if test "x" != "x$tk_cfg_file"; then |
120 | break |
121 | fi |
122 | done |
123 | AC_MSG_RESULT("$tk_cfg_file") |
124 | |
125 | if test "x" != "x$tk_cfg_file"; then |
126 | . "$tk_cfg_file" || AC_MSG_ERROR("Cannot read file: $tk_cfg_file") |
127 | HAVE_TK=yes |
128 | |
129 | # if TK_INCLUDE_SPEC wasn't defined, try to define it using TK_INC_DIR |
130 | if test "x" = "x$TK_INCLUDE_SPEC"; then |
131 | inc_path=`expr "x$TK_INC_DIR" : "x\(.*\)/tk-private/generic"` |
132 | if test "x" != "$inc_path"; then |
133 | TK_INCLUDE_SPEC="-I$inc_path" |
134 | elif test "x" != "x$TK_INC_DIR"; then |
135 | TK_INCLUDE_SPEC="-I$TK_INC_DIR" |
136 | fi |
137 | fi |
138 | else |
139 | HAVE_TK=no |
140 | fi |
141 | fi |
142 | |
143 | # Check for tk.h |
144 | AC_LANG_C |
145 | HAVE_TK=yes |
146 | save_CPPFLAGS="$CPPFLAGS" |
147 | CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC $TK_INCLUDE_SPEC" |
148 | AC_CHECK_HEADER([tk.h],[],[HAVE_TK=no]) |
149 | CPPFLAGS="$save_CPPFLAGS" |
150 | |
151 | if test "xyes" = "x$require_tk"; then |
152 | if test "xno" = "x$HAVE_TK"; then |
153 | AC_MSG_ERROR([Tk not found.]) |
154 | fi |
155 | fi |
156 | fi |
157 | ]) |