1 dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
2 dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
4 dnl gdb/configure.in uses BFD_NEED_DECLARATION, so get its definition.
5 sinclude(../bfd/bfd.m4)
7 dnl This gets the standard macros, like the TCL, TK, etc ones.
8 sinclude(../config/acinclude.m4)
10 dnl This gets GCC_HEADER_STDINT.
11 sinclude(../config/stdint.m4)
13 sinclude(../config/gettext-sister.m4)
15 dnl CYGNUS LOCAL: This gets the right posix flag for gcc
16 AC_DEFUN([CY_AC_TCL_LYNX_POSIX],
17 [AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
18 AC_MSG_CHECKING([if running LynxOS])
19 AC_CACHE_VAL(ac_cv_os_lynx,
22 * The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
24 #if defined(__Lynx__) || defined(Lynx)
27 ], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
29 if test "$ac_cv_os_lynx" = "yes" ; then
32 AC_MSG_CHECKING([whether -mposix or -X is available])
33 AC_CACHE_VAL(ac_cv_c_posix_flag,
36 * This flag varies depending on how old the compiler is.
37 * -X is for the old "cc" and "gcc" (based on 1.42).
38 * -mposix is for the new gcc (at least 2.5.8).
40 #if defined(__GNUC__) && __GNUC__ >= 2
43 ], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
44 CC="$CC $ac_cv_c_posix_flag"
45 AC_MSG_RESULT($ac_cv_c_posix_flag)
52 # Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
53 # makes configure think it's cross compiling. If --target wasn't used, then
54 # we can't configure, so something is wrong. We don't use the cache
55 # here cause if somebody fixes their compiler install, we want this to work.
56 AC_DEFUN([CY_AC_C_WORKS],
57 [# If we cannot compile and link a trivial program, we can't expect anything to work
58 AC_MSG_CHECKING(whether the compiler ($CC) actually works)
59 AC_TRY_COMPILE(, [/* don't need anything here */],
60 c_compiles=yes, c_compiles=no)
62 AC_TRY_LINK(, [/* don't need anything here */],
63 c_links=yes, c_links=no)
65 if test x"${c_compiles}" = x"no" ; then
66 AC_MSG_ERROR(the native compiler is broken and won't compile.)
69 if test x"${c_links}" = x"no" ; then
70 AC_MSG_ERROR(the native compiler is broken and won't link.)
75 AC_DEFUN([CY_AC_PATH_TCLH], [
77 # Ok, lets find the tcl source trees so we can use the headers
78 # Warning: transition of version 9 to 10 will break this algorithm
79 # because 10 sorts before 9. We also look for just tcl. We have to
80 # be careful that we don't match stuff like tclX by accident.
81 # the alternative search directory is involked by --with-tclinclude
85 AC_MSG_CHECKING(for Tcl private headers. dir=${configdir})
86 AC_ARG_WITH(tclinclude, [ --with-tclinclude=DIR Directory where tcl private headers are], with_tclinclude=${withval})
87 AC_CACHE_VAL(ac_cv_c_tclh,[
88 # first check to see if --with-tclinclude was specified
89 if test x"${with_tclinclude}" != x ; then
90 if test -f ${with_tclinclude}/tclInt.h ; then
91 ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
92 elif test -f ${with_tclinclude}/generic/tclInt.h ; then
93 ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
95 AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
99 # next check if it came with Tcl configuration file
100 if test x"${ac_cv_c_tclconfig}" = x ; then
101 if test -f $ac_cv_c_tclconfig/../generic/tclInt.h ; then
102 ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/..; pwd)`
106 # next check in private source directory
108 # since ls returns lowest version numbers first, reverse its output
109 if test x"${ac_cv_c_tclh}" = x ; then
112 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` \
113 ${srcdir}/../../tcl \
114 `ls -dr ${srcdir}/../../tcl[[7-9]]* 2>/dev/null` \
115 ${srcdir}/../../../tcl \
116 `ls -dr ${srcdir}/../../../tcl[[7-9]]* 2>/dev/null ` ; do
117 if test -f $i/generic/tclInt.h ; then
118 ac_cv_c_tclh=`(cd $i/generic; pwd)`
123 # finally check in a few common install locations
125 # since ls returns lowest version numbers first, reverse its output
126 if test x"${ac_cv_c_tclh}" = x ; then
128 `ls -dr /usr/local/src/tcl[[7-9]]* 2>/dev/null` \
129 `ls -dr /usr/local/lib/tcl[[7-9]]* 2>/dev/null` \
132 ${prefix}/include ; do
133 if test -f $i/generic/tclInt.h ; then
134 ac_cv_c_tclh=`(cd $i/generic; pwd)`
139 # see if one is installed
140 if test x"${ac_cv_c_tclh}" = x ; then
141 AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
144 if test x"${ac_cv_c_tclh}" = x ; then
145 TCLHDIR="# no Tcl private headers found"
146 AC_MSG_ERROR([Can't find Tcl private headers])
148 if test x"${ac_cv_c_tclh}" != x ; then
150 if test x"${ac_cv_c_tclh}" = x"installed" ; then
151 AC_MSG_RESULT([is installed])
154 AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
155 # this hack is cause the TCLHDIR won't print if there is a "-I" in it.
156 TCLHDIR="-I${ac_cv_c_tclh}"
164 AC_DEFUN([CY_AC_PATH_TCLCONFIG], [
166 # Ok, lets find the tcl configuration
167 # First, look for one uninstalled.
168 # the alternative search directory is invoked by --with-tclconfig
171 if test x"${no_tcl}" = x ; then
172 # we reset no_tcl in case something fails here
174 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR Directory containing tcl configuration (tclConfig.sh)],
175 with_tclconfig=${withval})
176 AC_MSG_CHECKING([for Tcl configuration])
177 AC_CACHE_VAL(ac_cv_c_tclconfig,[
179 # First check to see if --with-tclconfig was specified.
180 if test x"${with_tclconfig}" != x ; then
181 if test -f "${with_tclconfig}/tclConfig.sh" ; then
182 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
184 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
188 # then check for a private Tcl installation
189 if test x"${ac_cv_c_tclconfig}" = x ; then
192 `ls -dr ../tcl[[7-9]]* 2>/dev/null` \
194 `ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
196 `ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
197 if test -f "$i/${configdir}/tclConfig.sh" ; then
198 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
203 # check in a few common install locations
204 if test x"${ac_cv_c_tclconfig}" = x ; then
205 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
206 if test -f "$i/tclConfig.sh" ; then
207 ac_cv_c_tclconfig=`(cd $i; pwd)`
212 # check in a few other private locations
213 if test x"${ac_cv_c_tclconfig}" = x ; then
216 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
217 if test -f "$i/${configdir}/tclConfig.sh" ; then
218 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
224 if test x"${ac_cv_c_tclconfig}" = x ; then
225 TCLCONFIG="# no Tcl configs found"
226 AC_MSG_WARN(Can't find Tcl configuration definitions)
229 TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
230 AC_MSG_RESULT(found $TCLCONFIG)
235 # Defined as a separate macro so we don't have to cache the values
236 # from PATH_TCLCONFIG (because this can also be cached).
237 AC_DEFUN([CY_AC_LOAD_TCLCONFIG], [
240 AC_SUBST(TCL_VERSION)
241 AC_SUBST(TCL_MAJOR_VERSION)
242 AC_SUBST(TCL_MINOR_VERSION)
246 dnl not used, don't export to save symbols
247 dnl AC_SUBST(TCL_LIB_FILE)
249 dnl don't export, not used outside of configure
250 dnl AC_SUBST(TCL_LIBS)
251 dnl not used, don't export to save symbols
252 dnl AC_SUBST(TCL_PREFIX)
254 dnl not used, don't export to save symbols
255 dnl AC_SUBST(TCL_EXEC_PREFIX)
257 AC_SUBST(TCL_SHLIB_CFLAGS)
258 AC_SUBST(TCL_SHLIB_LD)
259 dnl don't export, not used outside of configure
260 AC_SUBST(TCL_SHLIB_LD_LIBS)
261 AC_SUBST(TCL_SHLIB_SUFFIX)
262 dnl not used, don't export to save symbols
263 AC_SUBST(TCL_DL_LIBS)
264 AC_SUBST(TCL_LD_FLAGS)
265 dnl don't export, not used outside of configure
266 AC_SUBST(TCL_LD_SEARCH_FLAGS)
267 AC_SUBST(TCL_CC_SEARCH_FLAGS)
268 AC_SUBST(TCL_COMPAT_OBJS)
270 AC_SUBST(TCL_BUILD_LIB_SPEC)
271 AC_SUBST(TCL_LIB_SPEC)
272 AC_SUBST(TCL_LIB_VERSIONS_OK)
274 dnl not used, don't export to save symbols
275 dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
277 dnl not used, don't export to save symbols
278 dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
281 # Warning: Tk definitions are very similar to Tcl definitions but
282 # are not precisely the same. There are a couple of differences,
283 # so don't do changes to Tcl thinking you can cut and paste it do
284 # the Tk differences and later simply substitute "Tk" for "Tcl".
286 # - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
287 # - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
288 # - Computing major/minor versions is different because Tk depends on
289 # headers to Tcl, Tk, and X.
290 # - Symbols in tkConfig.sh are different than tclConfig.sh
291 # - Acceptable for Tk to be missing but not Tcl.
293 AC_DEFUN([CY_AC_PATH_TKH], [
295 # Ok, lets find the tk source trees so we can use the headers
296 # If the directory (presumably symlink) named "tk" exists, use that one
297 # in preference to any others. Same logic is used when choosing library
298 # and again with Tcl. The search order is the best place to look first, then in
299 # decreasing significance. The loop breaks if the trigger file is found.
300 # Note the gross little conversion here of srcdir by cd'ing to the found
301 # directory. This converts the path from a relative to an absolute, so
302 # recursive cache variables for the path will work right. We check all
303 # the possible paths in one loop rather than many seperate loops to speed
305 # the alternative search directory is involked by --with-tkinclude
308 AC_MSG_CHECKING(for Tk private headers)
309 AC_ARG_WITH(tkinclude, [ --with-tkinclude=DIR Directory where tk private headers are], with_tkinclude=${withval})
310 AC_CACHE_VAL(ac_cv_c_tkh,[
311 # first check to see if --with-tkinclude was specified
312 if test x"${with_tkinclude}" != x ; then
313 if test -f ${with_tkinclude}/tk.h ; then
314 ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
315 elif test -f ${with_tkinclude}/generic/tk.h ; then
316 ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
318 AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
322 # next check if it came with Tk configuration file
323 if test x"${ac_cv_c_tkconfig}" = x ; then
324 if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
325 ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
329 # next check in private source directory
331 # since ls returns lowest version numbers first, reverse its output
332 if test x"${ac_cv_c_tkh}" = x ; then
335 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
337 `ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
338 ${srcdir}/../../../tk \
339 `ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
340 if test -f $i/generic/tk.h ; then
341 ac_cv_c_tkh=`(cd $i/generic; pwd)`
346 # finally check in a few common install locations
348 # since ls returns lowest version numbers first, reverse its output
349 if test x"${ac_cv_c_tkh}" = x ; then
351 `ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
352 `ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
355 ${prefix}/include ; do
356 if test -f $i/generic/tk.h ; then
357 ac_cv_c_tkh=`(cd $i/generic; pwd)`
362 # see if one is installed
363 if test x"${ac_cv_c_tkh}" = x ; then
364 AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
367 if test x"${ac_cv_c_tkh}" != x ; then
369 if test x"${ac_cv_c_tkh}" = x"installed" ; then
370 AC_MSG_RESULT([is installed])
373 AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
374 # this hack is cause the TKHDIR won't print if there is a "-I" in it.
375 TKHDIR="-I${ac_cv_c_tkh}"
378 TKHDIR="# no Tk directory found"
379 AC_MSG_WARN([Can't find Tk private headers])
387 AC_DEFUN([CY_AC_PATH_TKCONFIG], [
389 # Ok, lets find the tk configuration
390 # First, look for one uninstalled.
391 # the alternative search directory is invoked by --with-tkconfig
394 if test x"${no_tk}" = x ; then
395 # we reset no_tk in case something fails here
397 AC_ARG_WITH(tkconfig, [ --with-tkconfig=DIR Directory containing tk configuration (tkConfig.sh)],
398 with_tkconfig=${withval})
399 AC_MSG_CHECKING([for Tk configuration])
400 AC_CACHE_VAL(ac_cv_c_tkconfig,[
402 # First check to see if --with-tkconfig was specified.
403 if test x"${with_tkconfig}" != x ; then
404 if test -f "${with_tkconfig}/tkConfig.sh" ; then
405 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
407 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
411 # then check for a private Tk library
412 if test x"${ac_cv_c_tkconfig}" = x ; then
415 `ls -dr ../tk[[4-9]]* 2>/dev/null` \
417 `ls -dr ../../tk[[4-9]]* 2>/dev/null` \
419 `ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
420 if test -f "$i/${configdir}/tkConfig.sh" ; then
421 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
426 # check in a few common install locations
427 if test x"${ac_cv_c_tkconfig}" = x ; then
428 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
429 if test -f "$i/tkConfig.sh" ; then
430 ac_cv_c_tkconfig=`(cd $i; pwd)`
435 # check in a few other private locations
436 if test x"${ac_cv_c_tkconfig}" = x ; then
439 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
440 if test -f "$i/${configdir}/tkConfig.sh" ; then
441 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
447 if test x"${ac_cv_c_tkconfig}" = x ; then
448 TKCONFIG="# no Tk configs found"
449 AC_MSG_WARN(Can't find Tk configuration definitions)
452 TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
453 AC_MSG_RESULT(found $TKCONFIG)
459 # Defined as a separate macro so we don't have to cache the values
460 # from PATH_TKCONFIG (because this can also be cached).
461 AC_DEFUN([CY_AC_LOAD_TKCONFIG], [
462 if test -f "$TKCONFIG" ; then
467 dnl not actually used, don't export to save symbols
468 dnl AC_SUBST(TK_MAJOR_VERSION)
469 dnl AC_SUBST(TK_MINOR_VERSION)
472 dnl not used, don't export to save symbols
473 dnl AC_SUBST(TK_LIB_FILE)
475 dnl not used outside of configure
476 dnl AC_SUBST(TK_LIBS)
477 dnl not used, don't export to save symbols
478 dnl AC_SUBST(TK_PREFIX)
480 dnl not used, don't export to save symbols
481 dnl AC_SUBST(TK_EXEC_PREFIX)
483 AC_SUBST(TK_BUILD_INCLUDES)
484 AC_SUBST(TK_XINCLUDES)
486 AC_SUBST(TK_BUILD_LIB_SPEC)
487 AC_SUBST(TK_LIB_SPEC)
490 # check for Itcl headers.
492 AC_DEFUN([CY_AC_PATH_ITCLCONFIG], [
494 # Ok, lets find the itcl configuration
495 # First, look for one uninstalled.
496 # the alternative search directory is invoked by --with-itclconfig
499 if test x"${no_itcl}" = x ; then
500 # we reset no_itcl in case something fails here
502 AC_ARG_WITH(itclconfig, [ --with-itclconfig Directory containing itcl configuration (itclConfig.sh)],
503 with_itclconfig=${withval})
504 AC_MSG_CHECKING([for Itcl configuration])
505 AC_CACHE_VAL(ac_cv_c_itclconfig,[
507 # First check to see if --with-itclconfig was specified.
508 if test x"${with_itclconfig}" != x ; then
509 if test -f "${with_itclconfig}/itclConfig.sh" ; then
510 ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
512 AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
516 # then check for a private Itcl library
517 if test x"${ac_cv_c_itclconfig}" = x ; then
520 `ls -dr ../itcl[[4-9]]*/itcl 2>/dev/null` \
522 `ls -dr ../../itcl[[4-9]]*/itcl 2>/dev/null` \
524 `ls -dr ../../../itcl[[4-9]]*/itcl 2>/dev/null` ; do
525 if test -f "$i/itclConfig.sh" ; then
526 ac_cv_c_itclconfig=`(cd $i; pwd)`
531 # check in a few common install locations
532 if test x"${ac_cv_c_itclconfig}" = x ; then
533 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
534 if test -f "$i/itclConfig.sh" ; then
535 ac_cv_c_itclconfig=`(cd $i; pwd)`
540 # check in a few other private locations
541 if test x"${ac_cv_c_itclconfig}" = x ; then
543 ${srcdir}/../itcl/itcl \
544 `ls -dr ${srcdir}/../itcl[[4-9]]*/itcl 2>/dev/null` ; do
545 if test -f "$i/itclConfig.sh" ; then
546 ac_cv_c_itclconfig=`(cd $i; pwd)`
552 if test x"${ac_cv_c_itclconfig}" = x ; then
553 ITCLCONFIG="# no Itcl configs found"
554 AC_MSG_WARN(Can't find Itcl configuration definitions)
557 ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
558 AC_MSG_RESULT(found $ITCLCONFIG)
563 # Defined as a separate macro so we don't have to cache the values
564 # from PATH_ITCLCONFIG (because this can also be cached).
565 AC_DEFUN([CY_AC_LOAD_ITCLCONFIG], [
566 if test -f "$ITCLCONFIG" ; then
570 AC_SUBST(ITCL_VERSION)
571 dnl not actually used, don't export to save symbols
572 dnl AC_SUBST(ITCL_MAJOR_VERSION)
573 dnl AC_SUBST(ITCL_MINOR_VERSION)
576 dnl not used, don't export to save symbols
577 dnl AC_SUBST(ITCL_LIB_FILE)
579 dnl not used outside of configure
580 dnl AC_SUBST(ITCL_LIBS)
581 dnl not used, don't export to save symbols
582 dnl AC_SUBST(ITCL_PREFIX)
584 dnl not used, don't export to save symbols
585 dnl AC_SUBST(ITCL_EXEC_PREFIX)
587 AC_SUBST(ITCL_BUILD_INCLUDES)
588 AC_SUBST(ITCL_BUILD_LIB_SPEC)
589 AC_SUBST(ITCL_LIB_SPEC)
592 # check for Itcl headers.
594 AC_DEFUN([CY_AC_PATH_ITCLH], [
595 AC_MSG_CHECKING(for Itcl private headers. srcdir=${srcdir})
596 if test x"${ac_cv_c_itclh}" = x ; then
597 for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
598 if test -f $i/generic/itcl.h ; then
599 ac_cv_c_itclh=`(cd $i/generic; pwd)`
604 if test x"${ac_cv_c_itclh}" = x ; then
605 ITCLHDIR="# no Itcl private headers found"
606 AC_MSG_ERROR([Can't find Itcl private headers])
608 if test x"${ac_cv_c_itclh}" != x ; then
609 ITCLHDIR="-I${ac_cv_c_itclh}"
611 # should always be here
612 # ITCLLIB="../itcl/itcl/unix/libitcl.a"
618 AC_DEFUN([CY_AC_PATH_ITKCONFIG], [
620 # Ok, lets find the itk configuration
621 # First, look for one uninstalled.
622 # the alternative search directory is invoked by --with-itkconfig
625 if test x"${no_itk}" = x ; then
626 # we reset no_itk in case something fails here
628 AC_ARG_WITH(itkconfig, [ --with-itkconfig Directory containing itk configuration (itkConfig.sh)],
629 with_itkconfig=${withval})
630 AC_MSG_CHECKING([for Itk configuration])
631 AC_CACHE_VAL(ac_cv_c_itkconfig,[
633 # First check to see if --with-itkconfig was specified.
634 if test x"${with_itkconfig}" != x ; then
635 if test -f "${with_itkconfig}/itkConfig.sh" ; then
636 ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
638 AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
642 # then check for a private Itk library
643 if test x"${ac_cv_c_itkconfig}" = x ; then
646 `ls -dr ../itcl[[4-9]]*/itk 2>/dev/null` \
648 `ls -dr ../../itcl[[4-9]]*/itk 2>/dev/null` \
650 `ls -dr ../../../itcl[[4-9]]*/itk 2>/dev/null` ; do
651 if test -f "$i/itkConfig.sh" ; then
652 ac_cv_c_itkconfig=`(cd $i; pwd)`
657 # check in a few common install locations
658 if test x"${ac_cv_c_itkconfig}" = x ; then
659 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
660 if test -f "$i/itkConfig.sh" ; then
661 ac_cv_c_itkconfig=`(cd $i; pwd)`
666 # check in a few other private locations
667 if test x"${ac_cv_c_itkconfig}" = x ; then
669 ${srcdir}/../itcl/itk \
670 `ls -dr ${srcdir}/../itcl[[4-9]]*/itk 2>/dev/null` ; do
671 if test -f "$i/itkConfig.sh" ; then
672 ac_cv_c_itkconfig=`(cd $i; pwd)`
678 if test x"${ac_cv_c_itkconfig}" = x ; then
679 ITKCONFIG="# no Itk configs found"
680 AC_MSG_WARN(Can't find Itk configuration definitions)
683 ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
684 AC_MSG_RESULT(found $ITKCONFIG)
690 # Defined as a separate macro so we don't have to cache the values
691 # from PATH_ITKCONFIG (because this can also be cached).
692 AC_DEFUN([CY_AC_LOAD_ITKCONFIG], [
693 if test -f "$ITKCONFIG" ; then
697 AC_SUBST(ITK_VERSION)
698 dnl not actually used, don't export to save symbols
699 dnl AC_SUBST(ITK_MAJOR_VERSION)
700 dnl AC_SUBST(ITK_MINOR_VERSION)
703 dnl not used, don't export to save symbols
704 dnl AC_SUBST(ITK_LIB_FILE)
706 dnl not used outside of configure
707 dnl AC_SUBST(ITK_LIBS)
708 dnl not used, don't export to save symbols
709 dnl AC_SUBST(ITK_PREFIX)
711 dnl not used, don't export to save symbols
712 dnl AC_SUBST(ITK_EXEC_PREFIX)
714 AC_SUBST(ITK_BUILD_INCLUDES)
715 AC_SUBST(ITK_BUILD_LIB_SPEC)
716 AC_SUBST(ITK_LIB_SPEC)
719 AC_DEFUN([CY_AC_PATH_ITKH], [
720 AC_MSG_CHECKING(for Itk private headers. srcdir=${srcdir})
721 if test x"${ac_cv_c_itkh}" = x ; then
722 for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
723 if test -f $i/generic/itk.h ; then
724 ac_cv_c_itkh=`(cd $i/generic; pwd)`
729 if test x"${ac_cv_c_itkh}" = x ; then
730 ITKHDIR="# no Itk private headers found"
731 AC_MSG_ERROR([Can't find Itk private headers])
733 if test x"${ac_cv_c_itkh}" != x ; then
734 ITKHDIR="-I${ac_cv_c_itkh}"
736 # should always be here
737 # ITKLIB="../itcl/itk/unix/libitk.a"
743 ## ----------------------------------------- ##
744 ## ANSIfy the C compiler whenever possible. ##
745 ## From Franc,ois Pinard ##
746 ## ----------------------------------------- ##
748 # Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
750 # This program is free software; you can redistribute it and/or modify
751 # it under the terms of the GNU General Public License as published by
752 # the Free Software Foundation; either version 2, or (at your option)
755 # This program is distributed in the hope that it will be useful,
756 # but WITHOUT ANY WARRANTY; without even the implied warranty of
757 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
758 # GNU General Public License for more details.
760 # You should have received a copy of the GNU General Public License
761 # along with this program; if not, write to the Free Software
762 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
763 # Boston, MA 02110-1301, USA.
767 # @defmac AC_PROG_CC_STDC
768 # @maindex PROG_CC_STDC
770 # If the C compiler in not in ANSI C mode by default, try to add an option
771 # to output variable @code{CC} to make it so. This macro tries various
772 # options that select ANSI C on some system or another. It considers the
773 # compiler to be in ANSI C mode if it handles function prototypes correctly.
775 # If you use this macro, you should check after calling it whether the C
776 # compiler has been set to accept ANSI C; if not, the shell variable
777 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
778 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
779 # program @code{ansi2knr}, which comes with Ghostscript.
782 AC_DEFUN([AM_PROG_CC_STDC],
783 [AC_REQUIRE([AC_PROG_CC])
784 AC_BEFORE([$0], [AC_C_INLINE])
785 AC_BEFORE([$0], [AC_C_CONST])
786 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
787 dnl a magic option to avoid problems with ANSI preprocessor commands
789 dnl FIXME: can't do this because then AC_AIX won't work due to a
790 dnl circular dependency.
791 dnl AC_BEFORE([$0], [AC_PROG_CPP])
792 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
793 AC_CACHE_VAL(am_cv_prog_cc_stdc,
794 [am_cv_prog_cc_stdc=no
796 # Don't try gcc -ansi; that turns off useful extensions and
797 # breaks some systems' header files.
799 # Ultrix and OSF/1 -std1
800 # HP-UX 10.20 and later -Ae
801 # HP-UX older versions -Aa -D_HPUX_SOURCE
802 # SVR4 -Xc -D__EXTENSIONS__
803 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
805 CC="$ac_save_CC $ac_arg"
809 #include <sys/types.h>
810 #include <sys/stat.h>
811 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
812 struct buf { int x; };
813 FILE * (*rcsopen) (struct buf *, struct stat *, int);
814 static char *e (p, i)
820 static char *f (char * (*g) (char **, int), char **p, ...)
825 s = g (p, va_arg (v,int));
829 int test (int i, double x);
830 struct s1 {int (*f) (int a);};
831 struct s2 {int (*f) (double a);};
832 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
836 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
838 [am_cv_prog_cc_stdc="$ac_arg"; break])
842 if test -z "$am_cv_prog_cc_stdc"; then
843 AC_MSG_RESULT([none needed])
845 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
847 case "x$am_cv_prog_cc_stdc" in
849 *) CC="$CC $am_cv_prog_cc_stdc" ;;
853 dnl From Bruno Haible.
857 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
858 dnl those with the standalone portable GNU libiconv installed).
860 AC_ARG_WITH([libiconv-prefix],
861 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
862 for dir in `echo "$withval" | tr : ' '`; do
863 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
864 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
868 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
869 am_cv_func_iconv="no, consider installing GNU libiconv"
871 AC_TRY_LINK([#include <stdlib.h>
873 [iconv_t cd = iconv_open("","");
874 iconv(cd,NULL,NULL,NULL,NULL);
876 am_cv_func_iconv=yes)
877 if test "$am_cv_func_iconv" != yes; then
880 AC_TRY_LINK([#include <stdlib.h>
882 [iconv_t cd = iconv_open("","");
883 iconv(cd,NULL,NULL,NULL,NULL);
886 am_cv_func_iconv=yes)
890 if test "$am_cv_func_iconv" = yes; then
891 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
892 AC_MSG_CHECKING([for iconv declaration])
893 AC_CACHE_VAL(am_cv_proto_iconv, [
901 #if defined(__STDC__) || defined(__cplusplus)
902 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
906 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
907 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
908 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
909 AC_MSG_RESULT([$]{ac_t:-
910 }[$]am_cv_proto_iconv)
911 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
912 [Define as const if the declaration of iconv() needs const.])
915 if test "$am_cv_lib_iconv" = yes; then
921 dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva
922 dnl Version 1.3 (2001/03/02)
923 dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html
925 AC_DEFUN([AC_DEFINE_DIR], [
926 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
927 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
928 ac_define_dir=`eval echo [$]$2`
929 ac_define_dir=`eval echo [$]ac_define_dir`
931 AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
932 AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
935 dnl See whether we need a declaration for a function.
936 dnl The result is highly dependent on the INCLUDES passed in, so make sure
937 dnl to use a different cache variable name in this macro if it is invoked
938 dnl in a different context somewhere else.
939 dnl gcc_AC_CHECK_DECL(SYMBOL,
940 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
941 AC_DEFUN([gcc_AC_CHECK_DECL],
942 [AC_MSG_CHECKING([whether $1 is declared])
943 AC_CACHE_VAL(gcc_cv_have_decl_$1,
944 [AC_TRY_COMPILE([$4],
946 char *(*pfn) = (char *(*)) $1 ;
947 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
948 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
949 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
951 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
955 dnl Check multiple functions to see whether each needs a declaration.
956 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
957 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
958 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
959 AC_DEFUN([gcc_AC_CHECK_DECLS],
963 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
965 gcc_AC_CHECK_DECL($ac_func,
966 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
967 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
968 dnl It is possible that the include files passed in here are local headers
969 dnl which supply a backup declaration for the relevant prototype based on
970 dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
971 dnl will always return success. E.g. see libiberty.h's handling of
972 dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
973 dnl 1 so that any local headers used do not provide their own prototype
974 dnl during this test.
976 #define $ac_tr_decl 1
980 dnl Automatically generate config.h entries via autoheader.
982 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
983 [AC_DEFINE([HAVE_DECL_\&], 1,
984 [Define to 1 if we found this declaration otherwise define to 0.])])dnl