4 sinclude(../bfd/aclocal.m4)
6 dnl CY_AC_PATH_TCLCONFIG and CY_AC_LOAD_TCLCONFIG should be invoked
7 dnl (in that order) before any other TCL macros. Similarly for TK.
9 dnl CYGNUS LOCAL: This gets the right posix flag for gcc
10 AC_DEFUN(CY_AC_TCL_LYNX_POSIX,
11 [AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
12 AC_MSG_CHECKING([if running LynxOS])
13 AC_CACHE_VAL(ac_cv_os_lynx,
16 * The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
18 #if defined(__Lynx__) || defined(Lynx)
21 ], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
23 if test "$ac_cv_os_lynx" = "yes" ; then
26 AC_MSG_CHECKING([whether -mposix or -X is available])
27 AC_CACHE_VAL(ac_cv_c_posix_flag,
30 * This flag varies depending on how old the compiler is.
31 * -X is for the old "cc" and "gcc" (based on 1.42).
32 * -mposix is for the new gcc (at least 2.5.8).
34 #if defined(__GNUC__) && __GNUC__ >= 2
37 ], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
38 CC="$CC $ac_cv_c_posix_flag"
39 AC_MSG_RESULT($ac_cv_c_posix_flag)
46 # Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
47 # makes configure think it's cross compiling. If --target wasn't used, then
48 # we can't configure, so something is wrong. We don't use the cache
49 # here cause if somebody fixes their compiler install, we want this to work.
50 AC_DEFUN(CY_AC_C_WORKS,
51 [# If we cannot compile and link a trivial program, we can't expect anything to work
52 AC_MSG_CHECKING(whether the compiler ($CC) actually works)
53 AC_TRY_COMPILE(, [/* don't need anything here */],
54 c_compiles=yes, c_compiles=no)
56 AC_TRY_LINK(, [/* don't need anything here */],
57 c_links=yes, c_links=no)
59 if test x"${c_compiles}" = x"no" ; then
60 AC_MSG_ERROR(the native compiler is broken and won't compile.)
63 if test x"${c_links}" = x"no" ; then
64 AC_MSG_ERROR(the native compiler is broken and won't link.)
69 AC_DEFUN(CY_AC_PATH_TCLH, [
71 # Ok, lets find the tcl source trees so we can use the headers
72 # Warning: transition of version 9 to 10 will break this algorithm
73 # because 10 sorts before 9. We also look for just tcl. We have to
74 # be careful that we don't match stuff like tclX by accident.
75 # the alternative search directory is involked by --with-tclinclude
78 AC_MSG_CHECKING(for Tcl private headers)
79 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory where tcl private headers are], with_tclinclude=${withval})
80 AC_CACHE_VAL(ac_cv_c_tclh,[
81 # first check to see if --with-tclinclude was specified
82 if test x"${with_tclinclude}" != x ; then
83 if test -f ${with_tclinclude}/tclInt.h ; then
84 ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
85 elif test -f ${with_tclinclude}/generic/tclInt.h ; then
86 ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
88 AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
92 # next check if it came with Tcl configuration file
93 if test x"${ac_cv_c_tclconfig}" = x ; then
94 if test -f $ac_cv_c_tclconfig/../generic/tclInt.h ; then
95 ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/..; pwd)`
99 # next check in private source directory
101 # since ls returns lowest version numbers first, reverse its output
102 if test x"${ac_cv_c_tclh}" = x ; then
105 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` \
106 ${srcdir}/../../tcl \
107 `ls -dr ${srcdir}/../../tcl[[7-9]]* 2>/dev/null` \
108 ${srcdir}/../../../tcl \
109 `ls -dr ${srcdir}/../../../tcl[[7-9]]* 2>/dev/null ` ; do
110 if test -f $i/generic/tclInt.h ; then
111 ac_cv_c_tclh=`(cd $i/generic; pwd)`
116 # finally check in a few common install locations
118 # since ls returns lowest version numbers first, reverse its output
119 if test x"${ac_cv_c_tclh}" = x ; then
121 `ls -dr /usr/local/src/tcl[[7-9]]* 2>/dev/null` \
122 `ls -dr /usr/local/lib/tcl[[7-9]]* 2>/dev/null` \
125 ${prefix}/include ; do
126 if test -f $i/generic/tclInt.h ; then
127 ac_cv_c_tclh=`(cd $i/generic; pwd)`
132 # see if one is installed
133 if test x"${ac_cv_c_tclh}" = x ; then
134 AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
137 if test x"${ac_cv_c_tclh}" = x ; then
138 TCLHDIR="# no Tcl private headers found"
139 AC_MSG_ERROR([Can't find Tcl private headers])
141 if test x"${ac_cv_c_tclh}" != x ; then
143 if test x"${ac_cv_c_tclh}" = x"installed" ; then
144 AC_MSG_RESULT([is installed])
147 AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
148 # this hack is cause the TCLHDIR won't print if there is a "-I" in it.
149 TCLHDIR="-I${ac_cv_c_tclh}"
157 AC_DEFUN(CY_AC_PATH_TCLCONFIG, [
159 # Ok, lets find the tcl configuration
160 # First, look for one uninstalled.
161 # the alternative search directory is invoked by --with-tclconfig
164 if test x"${no_tcl}" = x ; then
165 # we reset no_tcl in case something fails here
167 AC_ARG_WITH(tclconfig, [ --with-tclconfig directory containing tcl configuration (tclConfig.sh)],
168 with_tclconfig=${withval})
169 AC_MSG_CHECKING([for Tcl configuration])
170 AC_CACHE_VAL(ac_cv_c_tclconfig,[
172 # First check to see if --with-tclconfig was specified.
173 if test x"${with_tclconfig}" != x ; then
174 if test -f "${with_tclconfig}/tclConfig.sh" ; then
175 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
177 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
181 # then check for a private Tcl installation
182 if test x"${ac_cv_c_tclconfig}" = x ; then
185 `ls -dr ../tcl[[7-9]]* 2>/dev/null` \
187 `ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
189 `ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
190 if test -f "$i/unix/tclConfig.sh" ; then
191 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
196 # check in a few common install locations
197 if test x"${ac_cv_c_tclconfig}" = x ; then
198 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
199 if test -f "$i/tclConfig.sh" ; then
200 ac_cv_c_tclconfig=`(cd $i; pwd)`
205 # check in a few other private locations
206 if test x"${ac_cv_c_tclconfig}" = x ; then
209 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
210 if test -f "$i/unix/tclConfig.sh" ; then
211 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
217 if test x"${ac_cv_c_tclconfig}" = x ; then
218 TCLCONFIG="# no Tcl configs found"
219 AC_MSG_WARN(Can't find Tcl configuration definitions)
222 TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
223 AC_MSG_RESULT(found $TCLCONFIG)
228 # Defined as a separate macro so we don't have to cache the values
229 # from PATH_TCLCONFIG (because this can also be cached).
230 AC_DEFUN(CY_AC_LOAD_TCLCONFIG, [
233 AC_SUBST(TCL_VERSION)
234 AC_SUBST(TCL_MAJOR_VERSION)
235 AC_SUBST(TCL_MINOR_VERSION)
239 dnl not used, don't export to save symbols
240 dnl AC_SUBST(TCL_LIB_FILE)
242 dnl don't export, not used outside of configure
243 dnl AC_SUBST(TCL_LIBS)
244 dnl not used, don't export to save symbols
245 dnl AC_SUBST(TCL_PREFIX)
247 dnl not used, don't export to save symbols
248 dnl AC_SUBST(TCL_EXEC_PREFIX)
250 AC_SUBST(TCL_SHLIB_CFLAGS)
251 AC_SUBST(TCL_SHLIB_LD)
252 dnl don't export, not used outside of configure
253 AC_SUBST(TCL_SHLIB_LD_LIBS)
254 AC_SUBST(TCL_SHLIB_SUFFIX)
255 dnl not used, don't export to save symbols
256 AC_SUBST(TCL_DL_LIBS)
257 AC_SUBST(TCL_LD_FLAGS)
258 dnl don't export, not used outside of configure
259 AC_SUBST(TCL_LD_SEARCH_FLAGS)
260 AC_SUBST(TCL_COMPAT_OBJS)
262 AC_SUBST(TCL_BUILD_LIB_SPEC)
263 AC_SUBST(TCL_LIB_SPEC)
264 AC_SUBST(TCL_LIB_VERSIONS_OK)
266 dnl not used, don't export to save symbols
267 dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
269 dnl not used, don't export to save symbols
270 dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
273 # Warning: Tk definitions are very similar to Tcl definitions but
274 # are not precisely the same. There are a couple of differences,
275 # so don't do changes to Tcl thinking you can cut and paste it do
276 # the Tk differences and later simply substitute "Tk" for "Tcl".
278 # - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
279 # - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
280 # - Computing major/minor versions is different because Tk depends on
281 # headers to Tcl, Tk, and X.
282 # - Symbols in tkConfig.sh are different than tclConfig.sh
283 # - Acceptable for Tk to be missing but not Tcl.
285 AC_DEFUN(CY_AC_PATH_TKH, [
287 # Ok, lets find the tk source trees so we can use the headers
288 # If the directory (presumably symlink) named "tk" exists, use that one
289 # in preference to any others. Same logic is used when choosing library
290 # and again with Tcl. The search order is the best place to look first, then in
291 # decreasing significance. The loop breaks if the trigger file is found.
292 # Note the gross little conversion here of srcdir by cd'ing to the found
293 # directory. This converts the path from a relative to an absolute, so
294 # recursive cache variables for the path will work right. We check all
295 # the possible paths in one loop rather than many seperate loops to speed
297 # the alternative search directory is involked by --with-tkinclude
300 AC_MSG_CHECKING(for Tk private headers)
301 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where tk private headers are], with_tkinclude=${withval})
302 AC_CACHE_VAL(ac_cv_c_tkh,[
303 # first check to see if --with-tkinclude was specified
304 if test x"${with_tkinclude}" != x ; then
305 if test -f ${with_tkinclude}/tk.h ; then
306 ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
307 elif test -f ${with_tkinclude}/generic/tk.h ; then
308 ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
310 AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
314 # next check if it came with Tk configuration file
315 if test x"${ac_cv_c_tkconfig}" = x ; then
316 if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
317 ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
321 # next check in private source directory
323 # since ls returns lowest version numbers first, reverse its output
324 if test x"${ac_cv_c_tkh}" = x ; then
327 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
329 `ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
330 ${srcdir}/../../../tk \
331 `ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
332 if test -f $i/generic/tk.h ; then
333 ac_cv_c_tkh=`(cd $i/generic; pwd)`
338 # finally check in a few common install locations
340 # since ls returns lowest version numbers first, reverse its output
341 if test x"${ac_cv_c_tkh}" = x ; then
343 `ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
344 `ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
347 ${prefix}/include ; do
348 if test -f $i/generic/tk.h ; then
349 ac_cv_c_tkh=`(cd $i/generic; pwd)`
354 # see if one is installed
355 if test x"${ac_cv_c_tkh}" = x ; then
356 AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
359 if test x"${ac_cv_c_tkh}" != x ; then
361 if test x"${ac_cv_c_tkh}" = x"installed" ; then
362 AC_MSG_RESULT([is installed])
365 AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
366 # this hack is cause the TKHDIR won't print if there is a "-I" in it.
367 TKHDIR="-I${ac_cv_c_tkh}"
370 TKHDIR="# no Tk directory found"
371 AC_MSG_WARN([Can't find Tk private headers])
379 AC_DEFUN(CY_AC_PATH_TKCONFIG, [
381 # Ok, lets find the tk configuration
382 # First, look for one uninstalled.
383 # the alternative search directory is invoked by --with-tkconfig
386 if test x"${no_tk}" = x ; then
387 # we reset no_tk in case something fails here
389 AC_ARG_WITH(tkconfig, [ --with-tkconfig directory containing tk configuration (tkConfig.sh)],
390 with_tkconfig=${withval})
391 AC_MSG_CHECKING([for Tk configuration])
392 AC_CACHE_VAL(ac_cv_c_tkconfig,[
394 # First check to see if --with-tkconfig was specified.
395 if test x"${with_tkconfig}" != x ; then
396 if test -f "${with_tkconfig}/tkConfig.sh" ; then
397 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
399 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
403 # then check for a private Tk library
404 if test x"${ac_cv_c_tkconfig}" = x ; then
407 `ls -dr ../tk[[4-9]]* 2>/dev/null` \
409 `ls -dr ../../tk[[4-9]]* 2>/dev/null` \
411 `ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
412 if test -f "$i/unix/tkConfig.sh" ; then
413 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
418 # check in a few common install locations
419 if test x"${ac_cv_c_tkconfig}" = x ; then
420 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
421 if test -f "$i/tkConfig.sh" ; then
422 ac_cv_c_tkconfig=`(cd $i; pwd)`
427 # check in a few other private locations
428 if test x"${ac_cv_c_tkconfig}" = x ; then
431 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
432 if test -f "$i/unix/tkConfig.sh" ; then
433 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
439 if test x"${ac_cv_c_tkconfig}" = x ; then
440 TKCONFIG="# no Tk configs found"
441 AC_MSG_WARN(Can't find Tk configuration definitions)
444 TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
445 AC_MSG_RESULT(found $TKCONFIG)
451 # Defined as a separate macro so we don't have to cache the values
452 # from PATH_TKCONFIG (because this can also be cached).
453 AC_DEFUN(CY_AC_LOAD_TKCONFIG, [
454 if test -f "$TKCONFIG" ; then
459 dnl not actually used, don't export to save symbols
460 dnl AC_SUBST(TK_MAJOR_VERSION)
461 dnl AC_SUBST(TK_MINOR_VERSION)
464 dnl not used, don't export to save symbols
465 dnl AC_SUBST(TK_LIB_FILE)
467 dnl not used outside of configure
468 dnl AC_SUBST(TK_LIBS)
469 dnl not used, don't export to save symbols
470 dnl AC_SUBST(TK_PREFIX)
472 dnl not used, don't export to save symbols
473 dnl AC_SUBST(TK_EXEC_PREFIX)
475 AC_SUBST(TK_XINCLUDES)
477 AC_SUBST(TK_BUILD_LIB_SPEC)
478 AC_SUBST(TK_LIB_SPEC)