1 |
578 |
markom |
dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
|
2 |
|
|
dnl CYGNUS LOCAL: This gets the right posix flag for gcc
|
3 |
|
|
AC_DEFUN(CY_AC_TCL_LYNX_POSIX,
|
4 |
|
|
[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
|
5 |
|
|
AC_MSG_CHECKING([to see if this is LynxOS])
|
6 |
|
|
AC_CACHE_VAL(ac_cv_os_lynx,
|
7 |
|
|
[AC_EGREP_CPP(yes,
|
8 |
|
|
[/*
|
9 |
|
|
* The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
|
10 |
|
|
*/
|
11 |
|
|
#if defined(__Lynx__) || defined(Lynx)
|
12 |
|
|
yes
|
13 |
|
|
#endif
|
14 |
|
|
], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
|
15 |
|
|
#
|
16 |
|
|
if test "$ac_cv_os_lynx" = "yes" ; then
|
17 |
|
|
AC_MSG_RESULT(yes)
|
18 |
|
|
AC_DEFINE(LYNX)
|
19 |
|
|
AC_MSG_CHECKING([whether -mposix or -X is available])
|
20 |
|
|
AC_CACHE_VAL(ac_cv_c_posix_flag,
|
21 |
|
|
[AC_TRY_COMPILE(,[
|
22 |
|
|
/*
|
23 |
|
|
* This flag varies depending on how old the compiler is.
|
24 |
|
|
* -X is for the old "cc" and "gcc" (based on 1.42).
|
25 |
|
|
* -mposix is for the new gcc (at least 2.5.8).
|
26 |
|
|
*/
|
27 |
|
|
#if defined(__GNUC__) && __GNUC__ >= 2
|
28 |
|
|
choke me
|
29 |
|
|
#endif
|
30 |
|
|
], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
|
31 |
|
|
CC="$CC $ac_cv_c_posix_flag"
|
32 |
|
|
AC_MSG_RESULT($ac_cv_c_posix_flag)
|
33 |
|
|
else
|
34 |
|
|
AC_MSG_RESULT(no)
|
35 |
|
|
fi
|
36 |
|
|
])
|
37 |
|
|
|
38 |
|
|
AC_DEFUN(CY_AC_PATH_TCLH, [
|
39 |
|
|
#
|
40 |
|
|
# Ok, lets find the tcl source trees so we can use the headers
|
41 |
|
|
# Warning: transition of version 9 to 10 will break this algorithm
|
42 |
|
|
# because 10 sorts before 9. We also look for just tcl. We have to
|
43 |
|
|
# be careful that we don't match stuff like tclX by accident.
|
44 |
|
|
# the alternative search directory is involked by --with-tclinclude
|
45 |
|
|
#
|
46 |
|
|
no_tcl=true
|
47 |
|
|
AC_MSG_CHECKING(for Tcl private headers)
|
48 |
|
|
AC_ARG_WITH(tclinclude, [ --with-tclinclude directory where tcl private headers are], with_tclinclude=${withval})
|
49 |
|
|
AC_CACHE_VAL(ac_cv_c_tclh,[
|
50 |
|
|
# first check to see if --with-tclinclude was specified
|
51 |
|
|
if test x"${with_tclinclude}" != x ; then
|
52 |
|
|
if test -f ${with_tclinclude}/tclInt.h ; then
|
53 |
|
|
ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
|
54 |
|
|
else
|
55 |
|
|
AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
|
56 |
|
|
fi
|
57 |
|
|
fi
|
58 |
|
|
# next check in private source directory
|
59 |
|
|
#
|
60 |
|
|
# since ls returns lowest version numbers first, reverse its output
|
61 |
|
|
if test x"${ac_cv_c_tclh}" = x ; then
|
62 |
|
|
for i in \
|
63 |
|
|
${srcdir}/../tcl \
|
64 |
|
|
`ls -dr ${srcdir}/../tcl[[0-9]]* 2>/dev/null` \
|
65 |
|
|
${srcdir}/../../tcl \
|
66 |
|
|
`ls -dr ${srcdir}/../../tcl[[0-9]]* 2>/dev/null` \
|
67 |
|
|
${srcdir}/../../../tcl \
|
68 |
|
|
`ls -dr ${srcdir}/../../../tcl[[0-9]]* 2>/dev/null ` ; do
|
69 |
|
|
if test -f $i/tclInt.h ; then
|
70 |
|
|
ac_cv_c_tclh=`(cd $i; pwd)`
|
71 |
|
|
break
|
72 |
|
|
fi
|
73 |
|
|
done
|
74 |
|
|
fi
|
75 |
|
|
# finally check in a few common install locations
|
76 |
|
|
#
|
77 |
|
|
# since ls returns lowest version numbers first, reverse its output
|
78 |
|
|
if test x"${ac_cv_c_tclh}" = x ; then
|
79 |
|
|
for i in \
|
80 |
|
|
`ls -dr /usr/local/src/tcl[[0-9]]* 2>/dev/null` \
|
81 |
|
|
`ls -dr /usr/local/lib/tcl[[0-9]]* 2>/dev/null` \
|
82 |
|
|
/usr/local/src/tcl \
|
83 |
|
|
/usr/local/lib/tcl \
|
84 |
|
|
${prefix}/include ; do
|
85 |
|
|
if test -f $i/tclInt.h ; then
|
86 |
|
|
ac_cv_c_tclh=`(cd $i; pwd)`
|
87 |
|
|
break
|
88 |
|
|
fi
|
89 |
|
|
done
|
90 |
|
|
fi
|
91 |
|
|
# see if one is installed
|
92 |
|
|
if test x"${ac_cv_c_tclh}" = x ; then
|
93 |
|
|
AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
|
94 |
|
|
fi
|
95 |
|
|
])
|
96 |
|
|
if test x"${ac_cv_c_tclh}" = x ; then
|
97 |
|
|
TCLHDIR="# no Tcl private headers found"
|
98 |
|
|
AC_MSG_ERROR([Can't find Tcl private headers])
|
99 |
|
|
fi
|
100 |
|
|
if test x"${ac_cv_c_tclh}" != x ; then
|
101 |
|
|
no_tcl=""
|
102 |
|
|
if test x"${ac_cv_c_tkh}" = x"installed" ; then
|
103 |
|
|
AC_MSG_RESULT([is installed])
|
104 |
|
|
TCLHDIR=""
|
105 |
|
|
else
|
106 |
|
|
AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
|
107 |
|
|
# this hack is cause the TCLHDIR won't print if there is a "-I" in it.
|
108 |
|
|
TCLHDIR="-I${ac_cv_c_tclh}"
|
109 |
|
|
fi
|
110 |
|
|
fi
|
111 |
|
|
|
112 |
|
|
AC_MSG_CHECKING([Tcl version])
|
113 |
|
|
rm -rf tclmajor tclminor
|
114 |
|
|
orig_includes="$CPPFLAGS"
|
115 |
|
|
|
116 |
|
|
if test x"${TCLHDIR}" != x ; then
|
117 |
|
|
CPPFLAGS="$CPPFLAGS $TCLHDIR"
|
118 |
|
|
fi
|
119 |
|
|
|
120 |
|
|
AC_TRY_RUN([
|
121 |
|
|
#include <stdio.h>
|
122 |
|
|
#include "tcl.h"
|
123 |
|
|
main() {
|
124 |
|
|
FILE *maj = fopen("tclmajor","w");
|
125 |
|
|
FILE *min = fopen("tclminor","w");
|
126 |
|
|
fprintf(maj,"%d",TCL_MAJOR_VERSION);
|
127 |
|
|
fprintf(min,"%d",TCL_MINOR_VERSION);
|
128 |
|
|
fclose(maj);
|
129 |
|
|
fclose(min);
|
130 |
|
|
return 0;
|
131 |
|
|
}],
|
132 |
|
|
tclmajor=`cat tclmajor`
|
133 |
|
|
tclminor=`cat tclminor`
|
134 |
|
|
tclversion=$tclmajor.$tclminor
|
135 |
|
|
AC_MSG_RESULT($tclversion)
|
136 |
|
|
rm -f tclmajor tclminor
|
137 |
|
|
,
|
138 |
|
|
AC_MSG_RESULT([can't happen])
|
139 |
|
|
,
|
140 |
|
|
AC_MSG_ERROR([can't be cross compiled])
|
141 |
|
|
)
|
142 |
|
|
CPPFLAGS="${orig_includes}"
|
143 |
|
|
|
144 |
|
|
AC_PROVIDE([$0])
|
145 |
|
|
AC_SUBST(TCLHDIR)
|
146 |
|
|
])
|
147 |
|
|
AC_DEFUN(CY_AC_PATH_TCLLIB, [
|
148 |
|
|
#
|
149 |
|
|
# Ok, lets find the tcl library
|
150 |
|
|
# First, look for one uninstalled.
|
151 |
|
|
# the alternative search directory is invoked by --with-tcllib
|
152 |
|
|
#
|
153 |
|
|
|
154 |
|
|
if test $tclmajor -ge 7 -a $tclminor -ge 4 ; then
|
155 |
|
|
installedtcllibroot=tcl$tclversion
|
156 |
|
|
else
|
157 |
|
|
installedtcllibroot=tcl
|
158 |
|
|
fi
|
159 |
|
|
|
160 |
|
|
if test x"${no_tcl}" = x ; then
|
161 |
|
|
# we reset no_tcl incase something fails here
|
162 |
|
|
no_tcl=true
|
163 |
|
|
AC_ARG_WITH(tcllib, [ --with-tcllib directory where the tcl library is],
|
164 |
|
|
with_tcllib=${withval})
|
165 |
|
|
AC_MSG_CHECKING([for Tcl library])
|
166 |
|
|
AC_CACHE_VAL(ac_cv_c_tcllib,[
|
167 |
|
|
# First check to see if --with-tcllib was specified.
|
168 |
|
|
# This requires checking for both the installed and uninstalled name-styles
|
169 |
|
|
# since we have no idea if it's installed or not.
|
170 |
|
|
if test x"${with_tcllib}" != x ; then
|
171 |
|
|
if test -f "${with_tcllib}/lib$installedtcllibroot.so" ; then
|
172 |
|
|
ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.so
|
173 |
|
|
elif test -f "${with_tcllib}/libtcl.so" ; then
|
174 |
|
|
ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.so
|
175 |
|
|
# then look for a freshly built statically linked library
|
176 |
|
|
# if Makefile exists we assume its configured and libtcl will be built first.
|
177 |
|
|
elif test -f "${with_tcllib}/lib$installedtcllibroot.a" ; then
|
178 |
|
|
ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.a
|
179 |
|
|
elif test -f "${with_tcllib}/libtcl.a" ; then
|
180 |
|
|
ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.a
|
181 |
|
|
else
|
182 |
|
|
AC_MSG_ERROR([${with_tcllib} directory doesn't contain libraries])
|
183 |
|
|
fi
|
184 |
|
|
fi
|
185 |
|
|
# then check for a private Tcl library
|
186 |
|
|
# Since these are uninstalled, use the simple lib name root.
|
187 |
|
|
if test x"${ac_cv_c_tcllib}" = x ; then
|
188 |
|
|
for i in \
|
189 |
|
|
../tcl \
|
190 |
|
|
`ls -dr ../tcl[[0-9]]* 2>/dev/null` \
|
191 |
|
|
../../tcl \
|
192 |
|
|
`ls -dr ../../tcl[[0-9]]* 2>/dev/null` \
|
193 |
|
|
../../../tcl \
|
194 |
|
|
`ls -dr ../../../tcl[[0-9]]* 2>/dev/null` ; do
|
195 |
|
|
# first look for a freshly built dynamically linked library
|
196 |
|
|
if test -f "$i/libtcl.so" ; then
|
197 |
|
|
ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so
|
198 |
|
|
break
|
199 |
|
|
# then look for a freshly built statically linked library
|
200 |
|
|
# if Makefile exists we assume its configured and libtcl will be built first.
|
201 |
|
|
elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then
|
202 |
|
|
ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a
|
203 |
|
|
break
|
204 |
|
|
fi
|
205 |
|
|
done
|
206 |
|
|
fi
|
207 |
|
|
# check in a few common install locations
|
208 |
|
|
if test x"${ac_cv_c_tcllib}" = x ; then
|
209 |
|
|
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
|
210 |
|
|
# first look for a freshly built dynamically linked library
|
211 |
|
|
if test -f "$i/lib$installedtcllibroot.so" ; then
|
212 |
|
|
ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.so
|
213 |
|
|
break
|
214 |
|
|
# then look for a freshly built statically linked library
|
215 |
|
|
# if Makefile exists we assume its configured and libtcl will be built first.
|
216 |
|
|
elif test -f "$i/lib$installedtcllibroot.a" -o -f "$i/Makefile" ; then
|
217 |
|
|
ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.a
|
218 |
|
|
break
|
219 |
|
|
fi
|
220 |
|
|
done
|
221 |
|
|
fi
|
222 |
|
|
# check in a few other private locations
|
223 |
|
|
if test x"${ac_cv_c_tcllib}" = x ; then
|
224 |
|
|
for i in \
|
225 |
|
|
${srcdir}/../tcl \
|
226 |
|
|
`ls -dr ${srcdir}/../tcl[[0-9]]* 2>/dev/null` ; do
|
227 |
|
|
# first look for a freshly built dynamically linked library
|
228 |
|
|
if test -f "$i/libtcl.so" ; then
|
229 |
|
|
ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so
|
230 |
|
|
break
|
231 |
|
|
# then look for a freshly built statically linked library
|
232 |
|
|
# if Makefile exists we assume its configured and libtcl will be built first.
|
233 |
|
|
elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then
|
234 |
|
|
ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a
|
235 |
|
|
break
|
236 |
|
|
fi
|
237 |
|
|
done
|
238 |
|
|
fi
|
239 |
|
|
|
240 |
|
|
# see if one is conveniently installed with the compiler
|
241 |
|
|
if test x"${ac_cv_c_tcllib}" = x ; then
|
242 |
|
|
orig_libs="$LIBS"
|
243 |
|
|
LIBS="$LIBS -l$installedtcllibroot -lm"
|
244 |
|
|
AC_TRY_RUN([
|
245 |
|
|
Tcl_AppInit()
|
246 |
|
|
{ exit(0); }], ac_cv_c_tcllib="-l$installedtcllibroot", ac_cv_c_tcllib=""
|
247 |
|
|
, ac_cv_c_tclib="-l$installedtcllibroot")
|
248 |
|
|
LIBS="${orig_libs}"
|
249 |
|
|
fi
|
250 |
|
|
])
|
251 |
|
|
if test x"${ac_cv_c_tcllib}" = x ; then
|
252 |
|
|
TCLLIB="# no Tcl library found"
|
253 |
|
|
AC_MSG_WARN(Can't find Tcl library)
|
254 |
|
|
else
|
255 |
|
|
TCLLIB=${ac_cv_c_tcllib}
|
256 |
|
|
AC_MSG_RESULT(found $TCLLIB)
|
257 |
|
|
no_tcl=
|
258 |
|
|
fi
|
259 |
|
|
fi
|
260 |
|
|
|
261 |
|
|
AC_PROVIDE([$0])
|
262 |
|
|
AC_SUBST(TCLLIB)
|
263 |
|
|
])
|
264 |
|
|
AC_DEFUN(CY_AC_PATH_TKH, [
|
265 |
|
|
#
|
266 |
|
|
# Ok, lets find the tk source trees so we can use the headers
|
267 |
|
|
# If the directory (presumably symlink) named "tk" exists, use that one
|
268 |
|
|
# in preference to any others. Same logic is used when choosing library
|
269 |
|
|
# and again with Tcl. The search order is the best place to look first, then in
|
270 |
|
|
# decreasing significance. The loop breaks if the trigger file is found.
|
271 |
|
|
# Note the gross little conversion here of srcdir by cd'ing to the found
|
272 |
|
|
# directory. This converts the path from a relative to an absolute, so
|
273 |
|
|
# recursive cache variables for the path will work right. We check all
|
274 |
|
|
# the possible paths in one loop rather than many seperate loops to speed
|
275 |
|
|
# things up.
|
276 |
|
|
# the alternative search directory is invoked by --with-tkinclude
|
277 |
|
|
#
|
278 |
|
|
AC_MSG_CHECKING(for Tk private headers)
|
279 |
|
|
AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where the tk private headers are],
|
280 |
|
|
with_tkinclude=${withval})
|
281 |
|
|
no_tk=true
|
282 |
|
|
AC_CACHE_VAL(ac_cv_c_tkh,[
|
283 |
|
|
# first check to see if --with-tkinclude was specified
|
284 |
|
|
if test x"${with_tkinclude}" != x ; then
|
285 |
|
|
if test -f ${with_tkinclude}/tk.h ; then
|
286 |
|
|
ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
|
287 |
|
|
else
|
288 |
|
|
AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
|
289 |
|
|
fi
|
290 |
|
|
fi
|
291 |
|
|
# next check in private source directory
|
292 |
|
|
#
|
293 |
|
|
# since ls returns lowest version numbers first, reverse the entire list
|
294 |
|
|
# and search for the worst fit, overwriting it with better fits as we find them
|
295 |
|
|
if test x"${ac_cv_c_tkh}" = x ; then
|
296 |
|
|
for i in \
|
297 |
|
|
${srcdir}/../tk \
|
298 |
|
|
`ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` \
|
299 |
|
|
${srcdir}/../../tk \
|
300 |
|
|
`ls -dr ${srcdir}/../../tk[[0-9]]* 2>/dev/null` \
|
301 |
|
|
${srcdir}/../../../tk \
|
302 |
|
|
`ls -dr ${srcdir}/../../../tk[[0-9]]* 2>/dev/null ` ; do
|
303 |
|
|
if test -f $i/tk.h ; then
|
304 |
|
|
ac_cv_c_tkh=`(cd $i; pwd)`
|
305 |
|
|
break
|
306 |
|
|
fi
|
307 |
|
|
done
|
308 |
|
|
fi
|
309 |
|
|
# finally check in a few common install locations
|
310 |
|
|
#
|
311 |
|
|
# since ls returns lowest version numbers first, reverse the entire list
|
312 |
|
|
# and search for the worst fit, overwriting it with better fits as we find them
|
313 |
|
|
if test x"${ac_cv_c_tkh}" = x ; then
|
314 |
|
|
for i in \
|
315 |
|
|
`ls -dr /usr/local/src/tk[[0-9]]* 2>/dev/null` \
|
316 |
|
|
`ls -dr /usr/local/lib/tk[[0-9]]* 2>/dev/null` \
|
317 |
|
|
/usr/local/src/tk \
|
318 |
|
|
/usr/local/lib/tk \
|
319 |
|
|
${prefix}/include ; do
|
320 |
|
|
if test -f $i/tk.h ; then
|
321 |
|
|
ac_cv_c_tkh=`(cd $i; pwd)`
|
322 |
|
|
break
|
323 |
|
|
fi
|
324 |
|
|
done
|
325 |
|
|
fi
|
326 |
|
|
# see if one is installed
|
327 |
|
|
if test x"${ac_cv_c_tkh}" = x ; then
|
328 |
|
|
AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed)
|
329 |
|
|
fi
|
330 |
|
|
])
|
331 |
|
|
if test x"${ac_cv_c_tkh}" != x ; then
|
332 |
|
|
no_tk=""
|
333 |
|
|
if test x"${ac_cv_c_tkh}" = x"installed" ; then
|
334 |
|
|
AC_MSG_RESULT([is installed])
|
335 |
|
|
TKHDIR=""
|
336 |
|
|
else
|
337 |
|
|
AC_MSG_RESULT([found in $ac_cv_c_tkh])
|
338 |
|
|
# this hack is cause the TKHDIR won't print if there is a "-I" in it.
|
339 |
|
|
TKHDIR="-I${ac_cv_c_tkh}"
|
340 |
|
|
fi
|
341 |
|
|
else
|
342 |
|
|
TKHDIR="# no Tk directory found"
|
343 |
|
|
AC_MSG_WARN([Can't find Tk private headers])
|
344 |
|
|
no_tk=true
|
345 |
|
|
fi
|
346 |
|
|
|
347 |
|
|
# if Tk is installed, extract the major/minor version
|
348 |
|
|
if test x"${no_tk}" = x ; then
|
349 |
|
|
AC_MSG_CHECKING([Tk version])
|
350 |
|
|
rm -rf tkmajor tkminor
|
351 |
|
|
orig_includes="$CPPFLAGS"
|
352 |
|
|
|
353 |
|
|
if test x"${TCLHDIR}" != x ; then
|
354 |
|
|
CPPFLAGS="$CPPFLAGS $TCLHDIR"
|
355 |
|
|
fi
|
356 |
|
|
if test x"${TKHDIR}" != x ; then
|
357 |
|
|
CPPFLAGS="$CPPFLAGS $TKHDIR"
|
358 |
|
|
fi
|
359 |
|
|
if test x"${x_includes}" != x -a x"${x_includes}" != xNONE ; then
|
360 |
|
|
CPPFLAGS="$CPPFLAGS -I$x_includes"
|
361 |
|
|
fi
|
362 |
|
|
|
363 |
|
|
AC_TRY_RUN([
|
364 |
|
|
#include <stdio.h>
|
365 |
|
|
#include "tk.h"
|
366 |
|
|
main() {
|
367 |
|
|
FILE *maj = fopen("tkmajor","w");
|
368 |
|
|
FILE *min = fopen("tkminor","w");
|
369 |
|
|
fprintf(maj,"%d",TK_MAJOR_VERSION);
|
370 |
|
|
fprintf(min,"%d",TK_MINOR_VERSION);
|
371 |
|
|
fclose(maj);
|
372 |
|
|
fclose(min);
|
373 |
|
|
return 0;
|
374 |
|
|
}],
|
375 |
|
|
tkmajor=`cat tkmajor`
|
376 |
|
|
tkminor=`cat tkminor`
|
377 |
|
|
tkversion=$tkmajor.$tkminor
|
378 |
|
|
AC_MSG_RESULT($tkversion)
|
379 |
|
|
rm -f tkmajor tkminor
|
380 |
|
|
,
|
381 |
|
|
AC_MSG_ERROR([
|
382 |
|
|
cannot compile a simple X program - suspect your xmkmf is
|
383 |
|
|
misconfigured and is incorrectly reporting the location of your X
|
384 |
|
|
include or libraries - report this to your system admin]) ,
|
385 |
|
|
AC_MSG_ERROR([can't be cross compiled])
|
386 |
|
|
)
|
387 |
|
|
CPPFLAGS="${orig_includes}"
|
388 |
|
|
fi
|
389 |
|
|
|
390 |
|
|
AC_PROVIDE([$0])
|
391 |
|
|
AC_SUBST(TKHDIR)
|
392 |
|
|
])
|
393 |
|
|
dnl for some reason, AC_REQUIRE() seems to choke autoconf
|
394 |
|
|
AC_DEFUN(CY_AC_PATH_TKLIB, [
|
395 |
|
|
dnl AC_REQUIRE(CY_AC_PATH_TCL)
|
396 |
|
|
#
|
397 |
|
|
# Ok, lets find the tk library
|
398 |
|
|
# First, look for the latest private (uninstalled) copy
|
399 |
|
|
# Notice that the destinations in backwards priority since the tests have
|
400 |
|
|
# no break.
|
401 |
|
|
# Then we look for either .a, .so, or Makefile. A Makefile is acceptable
|
402 |
|
|
# is it indicates the target has been configured and will (probably)
|
403 |
|
|
# soon be built. This allows an entire tree of Tcl software to be
|
404 |
|
|
# configured at once and then built.
|
405 |
|
|
# the alternative search directory is invoked by --with-tklib
|
406 |
|
|
#
|
407 |
|
|
|
408 |
|
|
if test x"${no_tk}" = x ; then
|
409 |
|
|
# reset no_tk incase something fails here
|
410 |
|
|
no_tk="true"
|
411 |
|
|
|
412 |
|
|
if test $tkmajor -ge 4 ; then
|
413 |
|
|
installedtklibroot=tk$tkversion
|
414 |
|
|
else
|
415 |
|
|
installedtkllibroot=tk
|
416 |
|
|
fi
|
417 |
|
|
|
418 |
|
|
AC_ARG_WITH(tklib, [ --with-tklib directory where the tk library is],
|
419 |
|
|
with_tklib=${withval})
|
420 |
|
|
AC_MSG_CHECKING([for Tk library])
|
421 |
|
|
AC_CACHE_VAL(ac_cv_c_tklib,[
|
422 |
|
|
# first check to see if --with-tklib was specified
|
423 |
|
|
# This requires checking for both the installed and uninstalled name-styles
|
424 |
|
|
# since we have no idea if it's installed or not.
|
425 |
|
|
if test x"${with_tklib}" != x ; then
|
426 |
|
|
if test -f "${with_tklib}/lib$installedtklibroot.so" ; then
|
427 |
|
|
ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.so
|
428 |
|
|
no_tk=""
|
429 |
|
|
elif test -f "${with_tklib}/libtk.so" ; then
|
430 |
|
|
ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.so
|
431 |
|
|
no_tk=""
|
432 |
|
|
# then look for a freshly built statically linked library
|
433 |
|
|
# if Makefile exists we assume its configured and libtk will be built
|
434 |
|
|
elif test -f "${with_tklib}/lib$installedtklibroot.a" ; then
|
435 |
|
|
ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.a
|
436 |
|
|
no_tk=""
|
437 |
|
|
elif test -f "${with_tklib}/libtk.a" ; then
|
438 |
|
|
ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.a
|
439 |
|
|
no_tk=""
|
440 |
|
|
else
|
441 |
|
|
AC_MSG_ERROR([${with_tklib} directory doesn't contain libraries])
|
442 |
|
|
fi
|
443 |
|
|
fi
|
444 |
|
|
# then check for a private Tk library
|
445 |
|
|
# Since these are uninstalled, use the simple lib name root.
|
446 |
|
|
if test x"${ac_cv_c_tklib}" = x ; then
|
447 |
|
|
for i in \
|
448 |
|
|
../tk \
|
449 |
|
|
`ls -dr ../tk[[0-9]]* 2>/dev/null` \
|
450 |
|
|
../../tk \
|
451 |
|
|
`ls -dr ../../tk[[0-9]]* 2>/dev/null` \
|
452 |
|
|
../../../tk \
|
453 |
|
|
`ls -dr ../../../tk[[0-9]]* 2>/dev/null` ; do
|
454 |
|
|
# first look for a freshly built dynamically linked library
|
455 |
|
|
if test -f "$i/libtk.so" ; then
|
456 |
|
|
ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so
|
457 |
|
|
no_tk=
|
458 |
|
|
break
|
459 |
|
|
# then look for a freshly built statically linked library
|
460 |
|
|
# if Makefile exists we assume its configured and libtk will be built
|
461 |
|
|
elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then
|
462 |
|
|
ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a
|
463 |
|
|
no_tk=""
|
464 |
|
|
break
|
465 |
|
|
fi
|
466 |
|
|
done
|
467 |
|
|
fi
|
468 |
|
|
# finally check in a few common install locations
|
469 |
|
|
if test x"${ac_cv_c_tklib}" = x ; then
|
470 |
|
|
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
|
471 |
|
|
# first look for a freshly built dynamically linked library
|
472 |
|
|
if test -f "$i/lib$installedtklibroot.so" ; then
|
473 |
|
|
ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.so
|
474 |
|
|
no_tk=""
|
475 |
|
|
break
|
476 |
|
|
# then look for a freshly built statically linked library
|
477 |
|
|
# if Makefile exists, we assume it's configured and libtcl will be built
|
478 |
|
|
elif test -f "$i/lib$installedtklibroot.a" -o -f "$i/Makefile" ; then
|
479 |
|
|
ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.a
|
480 |
|
|
no_tk=""
|
481 |
|
|
break
|
482 |
|
|
fi
|
483 |
|
|
done
|
484 |
|
|
fi
|
485 |
|
|
# check in a few other private locations
|
486 |
|
|
if test x"${ac_cv_c_tklib}" = x ; then
|
487 |
|
|
for i in \
|
488 |
|
|
${srcdir}/../tk \
|
489 |
|
|
`ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` ; do
|
490 |
|
|
# first look for a freshly built dynamically linked library
|
491 |
|
|
if test -f "$i/libtk.so" ; then
|
492 |
|
|
ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so
|
493 |
|
|
no_tk=""
|
494 |
|
|
break
|
495 |
|
|
# then look for a freshly built statically linked library
|
496 |
|
|
# if Makefile exists, we assume it's configured and libtcl will be built
|
497 |
|
|
elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then
|
498 |
|
|
ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a
|
499 |
|
|
no_tk=""
|
500 |
|
|
break
|
501 |
|
|
fi
|
502 |
|
|
done
|
503 |
|
|
fi
|
504 |
|
|
# see if one is conveniently installed with the compiler
|
505 |
|
|
if test x"${ac_cv_c_tklib}" = x ; then
|
506 |
|
|
dnl AC_REQUIRE(AC_PATH_X)
|
507 |
|
|
orig_libs="$LIBS"
|
508 |
|
|
LIBS="$LIBS -l$installedtklibroot $x_libraries $ac_cv_c_tcllib -lm"
|
509 |
|
|
AC_TRY_RUN([
|
510 |
|
|
Tcl_AppInit()
|
511 |
|
|
{ exit(0); }], ac_cv_c_tklib="-l$installedtklibroot", ac_cv_c_tklib=""
|
512 |
|
|
, ac_cv_c_tklib="-l$installedtklibroot")
|
513 |
|
|
LIBS="${orig_libs}"
|
514 |
|
|
fi
|
515 |
|
|
])
|
516 |
|
|
if test x"${ac_cv_c_tklib}" = x ; then
|
517 |
|
|
TKLIB="# no Tk library found"
|
518 |
|
|
AC_MSG_WARN(Can't find Tk library)
|
519 |
|
|
else
|
520 |
|
|
TKLIB=$ac_cv_c_tklib
|
521 |
|
|
AC_MSG_RESULT(found $TKLIB)
|
522 |
|
|
no_tk=
|
523 |
|
|
fi
|
524 |
|
|
fi
|
525 |
|
|
AC_PROVIDE([$0])
|
526 |
|
|
AC_SUBST(TKLIB)
|
527 |
|
|
])
|
528 |
|
|
AC_DEFUN(CY_AC_PATH_TK, [
|
529 |
|
|
CY_AC_PATH_TKH
|
530 |
|
|
CY_AC_PATH_TKLIB
|
531 |
|
|
])
|
532 |
|
|
AC_DEFUN(CY_AC_PATH_TCL, [
|
533 |
|
|
CY_AC_PATH_TCLH
|
534 |
|
|
CY_AC_PATH_TCLLIB
|
535 |
|
|
])
|