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 For AC_LIB_HAVE_LINKFLAGS.
16 sinclude(../config/lib-ld.m4)
17 sinclude(../config/lib-prefix.m4)
18 sinclude(../config/lib-link.m4)
20 dnl CYGNUS LOCAL: This gets the right posix flag for gcc
21 AC_DEFUN([CY_AC_TCL_LYNX_POSIX],
22 [AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
23 AC_MSG_CHECKING([if running LynxOS])
24 AC_CACHE_VAL(ac_cv_os_lynx,
27 * The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
29 #if defined(__Lynx__) || defined(Lynx)
32 ], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
34 if test "$ac_cv_os_lynx" = "yes" ; then
37 AC_MSG_CHECKING([whether -mposix or -X is available])
38 AC_CACHE_VAL(ac_cv_c_posix_flag,
41 * This flag varies depending on how old the compiler is.
42 * -X is for the old "cc" and "gcc" (based on 1.42).
43 * -mposix is for the new gcc (at least 2.5.8).
45 #if defined(__GNUC__) && __GNUC__ >= 2
48 ], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
49 CC="$CC $ac_cv_c_posix_flag"
50 AC_MSG_RESULT($ac_cv_c_posix_flag)
57 # Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
58 # makes configure think it's cross compiling. If --target wasn't used, then
59 # we can't configure, so something is wrong. We don't use the cache
60 # here cause if somebody fixes their compiler install, we want this to work.
61 AC_DEFUN([CY_AC_C_WORKS],
62 [# If we cannot compile and link a trivial program, we can't expect anything to work
63 AC_MSG_CHECKING(whether the compiler ($CC) actually works)
64 AC_TRY_COMPILE(, [/* don't need anything here */],
65 c_compiles=yes, c_compiles=no)
67 AC_TRY_LINK(, [/* don't need anything here */],
68 c_links=yes, c_links=no)
70 if test x"${c_compiles}" = x"no" ; then
71 AC_MSG_ERROR(the native compiler is broken and won't compile.)
74 if test x"${c_links}" = x"no" ; then
75 AC_MSG_ERROR(the native compiler is broken and won't link.)
80 AC_DEFUN([CY_AC_PATH_TCLH], [
82 # Ok, lets find the tcl source trees so we can use the headers
83 # Warning: transition of version 9 to 10 will break this algorithm
84 # because 10 sorts before 9. We also look for just tcl. We have to
85 # be careful that we don't match stuff like tclX by accident.
86 # the alternative search directory is involked by --with-tclinclude
90 AC_MSG_CHECKING(for Tcl private headers. dir=${configdir})
91 AC_ARG_WITH(tclinclude, [ --with-tclinclude=DIR Directory where tcl private headers are], with_tclinclude=${withval})
92 AC_CACHE_VAL(ac_cv_c_tclh,[
93 # first check to see if --with-tclinclude was specified
94 if test x"${with_tclinclude}" != x ; then
95 if test -f ${with_tclinclude}/tclInt.h ; then
96 ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
97 elif test -f ${with_tclinclude}/generic/tclInt.h ; then
98 ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
100 AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
104 # next check if it came with Tcl configuration file
105 if test x"${ac_cv_c_tclconfig}" = x ; then
106 if test -f $ac_cv_c_tclconfig/../generic/tclInt.h ; then
107 ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/..; pwd)`
111 # next check in private source directory
113 # since ls returns lowest version numbers first, reverse its output
114 if test x"${ac_cv_c_tclh}" = x ; then
117 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` \
118 ${srcdir}/../../tcl \
119 `ls -dr ${srcdir}/../../tcl[[7-9]]* 2>/dev/null` \
120 ${srcdir}/../../../tcl \
121 `ls -dr ${srcdir}/../../../tcl[[7-9]]* 2>/dev/null ` ; do
122 if test -f $i/generic/tclInt.h ; then
123 ac_cv_c_tclh=`(cd $i/generic; pwd)`
128 # finally check in a few common install locations
130 # since ls returns lowest version numbers first, reverse its output
131 if test x"${ac_cv_c_tclh}" = x ; then
133 `ls -dr /usr/local/src/tcl[[7-9]]* 2>/dev/null` \
134 `ls -dr /usr/local/lib/tcl[[7-9]]* 2>/dev/null` \
137 ${prefix}/include ; do
138 if test -f $i/generic/tclInt.h ; then
139 ac_cv_c_tclh=`(cd $i/generic; pwd)`
144 # see if one is installed
145 if test x"${ac_cv_c_tclh}" = x ; then
146 AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
149 if test x"${ac_cv_c_tclh}" = x ; then
150 TCLHDIR="# no Tcl private headers found"
151 AC_MSG_ERROR([Can't find Tcl private headers])
153 if test x"${ac_cv_c_tclh}" != x ; then
155 if test x"${ac_cv_c_tclh}" = x"installed" ; then
156 AC_MSG_RESULT([is installed])
159 AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
160 # this hack is cause the TCLHDIR won't print if there is a "-I" in it.
161 TCLHDIR="-I${ac_cv_c_tclh}"
169 AC_DEFUN([CY_AC_PATH_TCLCONFIG], [
171 # Ok, lets find the tcl configuration
172 # First, look for one uninstalled.
173 # the alternative search directory is invoked by --with-tclconfig
176 if test x"${no_tcl}" = x ; then
177 # we reset no_tcl in case something fails here
179 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR Directory containing tcl configuration (tclConfig.sh)],
180 with_tclconfig=${withval})
181 AC_MSG_CHECKING([for Tcl configuration])
182 AC_CACHE_VAL(ac_cv_c_tclconfig,[
184 # First check to see if --with-tclconfig was specified.
185 if test x"${with_tclconfig}" != x ; then
186 if test -f "${with_tclconfig}/tclConfig.sh" ; then
187 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
189 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
193 # then check for a private Tcl installation
194 if test x"${ac_cv_c_tclconfig}" = x ; then
197 `ls -dr ../tcl[[7-9]]* 2>/dev/null` \
199 `ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
201 `ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
202 if test -f "$i/${configdir}/tclConfig.sh" ; then
203 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
208 # check in a few common install locations
209 if test x"${ac_cv_c_tclconfig}" = x ; then
210 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
211 if test -f "$i/tclConfig.sh" ; then
212 ac_cv_c_tclconfig=`(cd $i; pwd)`
217 # check in a few other private locations
218 if test x"${ac_cv_c_tclconfig}" = x ; then
221 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
222 if test -f "$i/${configdir}/tclConfig.sh" ; then
223 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
229 if test x"${ac_cv_c_tclconfig}" = x ; then
230 TCLCONFIG="# no Tcl configs found"
231 AC_MSG_WARN(Can't find Tcl configuration definitions)
234 TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
235 AC_MSG_RESULT(found $TCLCONFIG)
240 # Defined as a separate macro so we don't have to cache the values
241 # from PATH_TCLCONFIG (because this can also be cached).
242 AC_DEFUN([CY_AC_LOAD_TCLCONFIG], [
245 AC_SUBST(TCL_VERSION)
246 AC_SUBST(TCL_MAJOR_VERSION)
247 AC_SUBST(TCL_MINOR_VERSION)
251 dnl not used, don't export to save symbols
252 dnl AC_SUBST(TCL_LIB_FILE)
254 dnl don't export, not used outside of configure
255 dnl AC_SUBST(TCL_LIBS)
256 dnl not used, don't export to save symbols
257 dnl AC_SUBST(TCL_PREFIX)
259 dnl not used, don't export to save symbols
260 dnl AC_SUBST(TCL_EXEC_PREFIX)
262 AC_SUBST(TCL_SHLIB_CFLAGS)
263 AC_SUBST(TCL_SHLIB_LD)
264 dnl don't export, not used outside of configure
265 AC_SUBST(TCL_SHLIB_LD_LIBS)
266 AC_SUBST(TCL_SHLIB_SUFFIX)
267 dnl not used, don't export to save symbols
268 AC_SUBST(TCL_DL_LIBS)
269 AC_SUBST(TCL_LD_FLAGS)
270 dnl don't export, not used outside of configure
271 AC_SUBST(TCL_LD_SEARCH_FLAGS)
272 AC_SUBST(TCL_CC_SEARCH_FLAGS)
273 AC_SUBST(TCL_COMPAT_OBJS)
275 AC_SUBST(TCL_BUILD_LIB_SPEC)
276 AC_SUBST(TCL_LIB_SPEC)
277 AC_SUBST(TCL_LIB_VERSIONS_OK)
279 dnl not used, don't export to save symbols
280 dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
282 dnl not used, don't export to save symbols
283 dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
286 # Warning: Tk definitions are very similar to Tcl definitions but
287 # are not precisely the same. There are a couple of differences,
288 # so don't do changes to Tcl thinking you can cut and paste it do
289 # the Tk differences and later simply substitute "Tk" for "Tcl".
291 # - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
292 # - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
293 # - Computing major/minor versions is different because Tk depends on
294 # headers to Tcl, Tk, and X.
295 # - Symbols in tkConfig.sh are different than tclConfig.sh
296 # - Acceptable for Tk to be missing but not Tcl.
298 AC_DEFUN([CY_AC_PATH_TKH], [
300 # Ok, lets find the tk source trees so we can use the headers
301 # If the directory (presumably symlink) named "tk" exists, use that one
302 # in preference to any others. Same logic is used when choosing library
303 # and again with Tcl. The search order is the best place to look first, then in
304 # decreasing significance. The loop breaks if the trigger file is found.
305 # Note the gross little conversion here of srcdir by cd'ing to the found
306 # directory. This converts the path from a relative to an absolute, so
307 # recursive cache variables for the path will work right. We check all
308 # the possible paths in one loop rather than many seperate loops to speed
310 # the alternative search directory is involked by --with-tkinclude
313 AC_MSG_CHECKING(for Tk private headers)
314 AC_ARG_WITH(tkinclude, [ --with-tkinclude=DIR Directory where tk private headers are], with_tkinclude=${withval})
315 AC_CACHE_VAL(ac_cv_c_tkh,[
316 # first check to see if --with-tkinclude was specified
317 if test x"${with_tkinclude}" != x ; then
318 if test -f ${with_tkinclude}/tk.h ; then
319 ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
320 elif test -f ${with_tkinclude}/generic/tk.h ; then
321 ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
323 AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
327 # next check if it came with Tk configuration file
328 if test x"${ac_cv_c_tkconfig}" = x ; then
329 if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
330 ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
334 # next check in private source directory
336 # since ls returns lowest version numbers first, reverse its output
337 if test x"${ac_cv_c_tkh}" = x ; then
340 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
342 `ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
343 ${srcdir}/../../../tk \
344 `ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
345 if test -f $i/generic/tk.h ; then
346 ac_cv_c_tkh=`(cd $i/generic; pwd)`
351 # finally check in a few common install locations
353 # since ls returns lowest version numbers first, reverse its output
354 if test x"${ac_cv_c_tkh}" = x ; then
356 `ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
357 `ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
360 ${prefix}/include ; do
361 if test -f $i/generic/tk.h ; then
362 ac_cv_c_tkh=`(cd $i/generic; pwd)`
367 # see if one is installed
368 if test x"${ac_cv_c_tkh}" = x ; then
369 AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
372 if test x"${ac_cv_c_tkh}" != x ; then
374 if test x"${ac_cv_c_tkh}" = x"installed" ; then
375 AC_MSG_RESULT([is installed])
378 AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
379 # this hack is cause the TKHDIR won't print if there is a "-I" in it.
380 TKHDIR="-I${ac_cv_c_tkh}"
383 TKHDIR="# no Tk directory found"
384 AC_MSG_WARN([Can't find Tk private headers])
392 AC_DEFUN([CY_AC_PATH_TKCONFIG], [
394 # Ok, lets find the tk configuration
395 # First, look for one uninstalled.
396 # the alternative search directory is invoked by --with-tkconfig
399 if test x"${no_tk}" = x ; then
400 # we reset no_tk in case something fails here
402 AC_ARG_WITH(tkconfig, [ --with-tkconfig=DIR Directory containing tk configuration (tkConfig.sh)],
403 with_tkconfig=${withval})
404 AC_MSG_CHECKING([for Tk configuration])
405 AC_CACHE_VAL(ac_cv_c_tkconfig,[
407 # First check to see if --with-tkconfig was specified.
408 if test x"${with_tkconfig}" != x ; then
409 if test -f "${with_tkconfig}/tkConfig.sh" ; then
410 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
412 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
416 # then check for a private Tk library
417 if test x"${ac_cv_c_tkconfig}" = x ; then
420 `ls -dr ../tk[[4-9]]* 2>/dev/null` \
422 `ls -dr ../../tk[[4-9]]* 2>/dev/null` \
424 `ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
425 if test -f "$i/${configdir}/tkConfig.sh" ; then
426 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
431 # check in a few common install locations
432 if test x"${ac_cv_c_tkconfig}" = x ; then
433 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
434 if test -f "$i/tkConfig.sh" ; then
435 ac_cv_c_tkconfig=`(cd $i; pwd)`
440 # check in a few other private locations
441 if test x"${ac_cv_c_tkconfig}" = x ; then
444 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
445 if test -f "$i/${configdir}/tkConfig.sh" ; then
446 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
452 if test x"${ac_cv_c_tkconfig}" = x ; then
453 TKCONFIG="# no Tk configs found"
454 AC_MSG_WARN(Can't find Tk configuration definitions)
457 TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
458 AC_MSG_RESULT(found $TKCONFIG)
464 # Defined as a separate macro so we don't have to cache the values
465 # from PATH_TKCONFIG (because this can also be cached).
466 AC_DEFUN([CY_AC_LOAD_TKCONFIG], [
467 if test -f "$TKCONFIG" ; then
472 dnl not actually used, don't export to save symbols
473 dnl AC_SUBST(TK_MAJOR_VERSION)
474 dnl AC_SUBST(TK_MINOR_VERSION)
477 dnl not used, don't export to save symbols
478 dnl AC_SUBST(TK_LIB_FILE)
480 dnl not used outside of configure
481 dnl AC_SUBST(TK_LIBS)
482 dnl not used, don't export to save symbols
483 dnl AC_SUBST(TK_PREFIX)
485 dnl not used, don't export to save symbols
486 dnl AC_SUBST(TK_EXEC_PREFIX)
488 AC_SUBST(TK_BUILD_INCLUDES)
489 AC_SUBST(TK_XINCLUDES)
491 AC_SUBST(TK_BUILD_LIB_SPEC)
492 AC_SUBST(TK_LIB_SPEC)
495 # check for Itcl headers.
497 AC_DEFUN([CY_AC_PATH_ITCLCONFIG], [
499 # Ok, lets find the itcl configuration
500 # First, look for one uninstalled.
501 # the alternative search directory is invoked by --with-itclconfig
504 if test x"${no_itcl}" = x ; then
505 # we reset no_itcl in case something fails here
507 AC_ARG_WITH(itclconfig, [ --with-itclconfig Directory containing itcl configuration (itclConfig.sh)],
508 with_itclconfig=${withval})
509 AC_MSG_CHECKING([for Itcl configuration])
510 AC_CACHE_VAL(ac_cv_c_itclconfig,[
512 # First check to see if --with-itclconfig was specified.
513 if test x"${with_itclconfig}" != x ; then
514 if test -f "${with_itclconfig}/itclConfig.sh" ; then
515 ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
517 AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
521 # then check for a private Itcl library
522 if test x"${ac_cv_c_itclconfig}" = x ; then
525 `ls -dr ../itcl[[4-9]]*/itcl 2>/dev/null` \
527 `ls -dr ../../itcl[[4-9]]*/itcl 2>/dev/null` \
529 `ls -dr ../../../itcl[[4-9]]*/itcl 2>/dev/null` ; do
530 if test -f "$i/itclConfig.sh" ; then
531 ac_cv_c_itclconfig=`(cd $i; pwd)`
536 # check in a few common install locations
537 if test x"${ac_cv_c_itclconfig}" = x ; then
538 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
539 if test -f "$i/itclConfig.sh" ; then
540 ac_cv_c_itclconfig=`(cd $i; pwd)`
545 # check in a few other private locations
546 if test x"${ac_cv_c_itclconfig}" = x ; then
548 ${srcdir}/../itcl/itcl \
549 `ls -dr ${srcdir}/../itcl[[4-9]]*/itcl 2>/dev/null` ; do
550 if test -f "$i/itclConfig.sh" ; then
551 ac_cv_c_itclconfig=`(cd $i; pwd)`
557 if test x"${ac_cv_c_itclconfig}" = x ; then
558 ITCLCONFIG="# no Itcl configs found"
559 AC_MSG_WARN(Can't find Itcl configuration definitions)
562 ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
563 AC_MSG_RESULT(found $ITCLCONFIG)
568 # Defined as a separate macro so we don't have to cache the values
569 # from PATH_ITCLCONFIG (because this can also be cached).
570 AC_DEFUN([CY_AC_LOAD_ITCLCONFIG], [
571 if test -f "$ITCLCONFIG" ; then
575 AC_SUBST(ITCL_VERSION)
576 dnl not actually used, don't export to save symbols
577 dnl AC_SUBST(ITCL_MAJOR_VERSION)
578 dnl AC_SUBST(ITCL_MINOR_VERSION)
581 dnl not used, don't export to save symbols
582 dnl AC_SUBST(ITCL_LIB_FILE)
584 dnl not used outside of configure
585 dnl AC_SUBST(ITCL_LIBS)
586 dnl not used, don't export to save symbols
587 dnl AC_SUBST(ITCL_PREFIX)
589 dnl not used, don't export to save symbols
590 dnl AC_SUBST(ITCL_EXEC_PREFIX)
592 AC_SUBST(ITCL_BUILD_INCLUDES)
593 AC_SUBST(ITCL_BUILD_LIB_SPEC)
594 AC_SUBST(ITCL_LIB_SPEC)
597 # check for Itcl headers.
599 AC_DEFUN([CY_AC_PATH_ITCLH], [
600 AC_MSG_CHECKING(for Itcl private headers. srcdir=${srcdir})
601 if test x"${ac_cv_c_itclh}" = x ; then
602 for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
603 if test -f $i/generic/itcl.h ; then
604 ac_cv_c_itclh=`(cd $i/generic; pwd)`
609 if test x"${ac_cv_c_itclh}" = x ; then
610 ITCLHDIR="# no Itcl private headers found"
611 AC_MSG_ERROR([Can't find Itcl private headers])
613 if test x"${ac_cv_c_itclh}" != x ; then
614 ITCLHDIR="-I${ac_cv_c_itclh}"
616 # should always be here
617 # ITCLLIB="../itcl/itcl/unix/libitcl.a"
623 AC_DEFUN([CY_AC_PATH_ITKCONFIG], [
625 # Ok, lets find the itk configuration
626 # First, look for one uninstalled.
627 # the alternative search directory is invoked by --with-itkconfig
630 if test x"${no_itk}" = x ; then
631 # we reset no_itk in case something fails here
633 AC_ARG_WITH(itkconfig, [ --with-itkconfig Directory containing itk configuration (itkConfig.sh)],
634 with_itkconfig=${withval})
635 AC_MSG_CHECKING([for Itk configuration])
636 AC_CACHE_VAL(ac_cv_c_itkconfig,[
638 # First check to see if --with-itkconfig was specified.
639 if test x"${with_itkconfig}" != x ; then
640 if test -f "${with_itkconfig}/itkConfig.sh" ; then
641 ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
643 AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
647 # then check for a private Itk library
648 if test x"${ac_cv_c_itkconfig}" = x ; then
651 `ls -dr ../itcl[[4-9]]*/itk 2>/dev/null` \
653 `ls -dr ../../itcl[[4-9]]*/itk 2>/dev/null` \
655 `ls -dr ../../../itcl[[4-9]]*/itk 2>/dev/null` ; do
656 if test -f "$i/itkConfig.sh" ; then
657 ac_cv_c_itkconfig=`(cd $i; pwd)`
662 # check in a few common install locations
663 if test x"${ac_cv_c_itkconfig}" = x ; then
664 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
665 if test -f "$i/itkConfig.sh" ; then
666 ac_cv_c_itkconfig=`(cd $i; pwd)`
671 # check in a few other private locations
672 if test x"${ac_cv_c_itkconfig}" = x ; then
674 ${srcdir}/../itcl/itk \
675 `ls -dr ${srcdir}/../itcl[[4-9]]*/itk 2>/dev/null` ; do
676 if test -f "$i/itkConfig.sh" ; then
677 ac_cv_c_itkconfig=`(cd $i; pwd)`
683 if test x"${ac_cv_c_itkconfig}" = x ; then
684 ITKCONFIG="# no Itk configs found"
685 AC_MSG_WARN(Can't find Itk configuration definitions)
688 ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
689 AC_MSG_RESULT(found $ITKCONFIG)
695 # Defined as a separate macro so we don't have to cache the values
696 # from PATH_ITKCONFIG (because this can also be cached).
697 AC_DEFUN([CY_AC_LOAD_ITKCONFIG], [
698 if test -f "$ITKCONFIG" ; then
702 AC_SUBST(ITK_VERSION)
703 dnl not actually used, don't export to save symbols
704 dnl AC_SUBST(ITK_MAJOR_VERSION)
705 dnl AC_SUBST(ITK_MINOR_VERSION)
708 dnl not used, don't export to save symbols
709 dnl AC_SUBST(ITK_LIB_FILE)
711 dnl not used outside of configure
712 dnl AC_SUBST(ITK_LIBS)
713 dnl not used, don't export to save symbols
714 dnl AC_SUBST(ITK_PREFIX)
716 dnl not used, don't export to save symbols
717 dnl AC_SUBST(ITK_EXEC_PREFIX)
719 AC_SUBST(ITK_BUILD_INCLUDES)
720 AC_SUBST(ITK_BUILD_LIB_SPEC)
721 AC_SUBST(ITK_LIB_SPEC)
724 AC_DEFUN([CY_AC_PATH_ITKH], [
725 AC_MSG_CHECKING(for Itk private headers. srcdir=${srcdir})
726 if test x"${ac_cv_c_itkh}" = x ; then
727 for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
728 if test -f $i/generic/itk.h ; then
729 ac_cv_c_itkh=`(cd $i/generic; pwd)`
734 if test x"${ac_cv_c_itkh}" = x ; then
735 ITKHDIR="# no Itk private headers found"
736 AC_MSG_ERROR([Can't find Itk private headers])
738 if test x"${ac_cv_c_itkh}" != x ; then
739 ITKHDIR="-I${ac_cv_c_itkh}"
741 # should always be here
742 # ITKLIB="../itcl/itk/unix/libitk.a"
748 ## ----------------------------------------- ##
749 ## ANSIfy the C compiler whenever possible. ##
750 ## From Franc,ois Pinard ##
751 ## ----------------------------------------- ##
753 # Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
755 # This program is free software; you can redistribute it and/or modify
756 # it under the terms of the GNU General Public License as published by
757 # the Free Software Foundation; either version 2, or (at your option)
760 # This program is distributed in the hope that it will be useful,
761 # but WITHOUT ANY WARRANTY; without even the implied warranty of
762 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
763 # GNU General Public License for more details.
765 # You should have received a copy of the GNU General Public License
766 # along with this program; if not, write to the Free Software
767 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
768 # Boston, MA 02110-1301, USA.
772 # @defmac AC_PROG_CC_STDC
773 # @maindex PROG_CC_STDC
775 # If the C compiler in not in ANSI C mode by default, try to add an option
776 # to output variable @code{CC} to make it so. This macro tries various
777 # options that select ANSI C on some system or another. It considers the
778 # compiler to be in ANSI C mode if it handles function prototypes correctly.
780 # If you use this macro, you should check after calling it whether the C
781 # compiler has been set to accept ANSI C; if not, the shell variable
782 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
783 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
784 # program @code{ansi2knr}, which comes with Ghostscript.
787 AC_DEFUN([AM_PROG_CC_STDC],
788 [AC_REQUIRE([AC_PROG_CC])
789 AC_BEFORE([$0], [AC_C_INLINE])
790 AC_BEFORE([$0], [AC_C_CONST])
791 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
792 dnl a magic option to avoid problems with ANSI preprocessor commands
794 dnl FIXME: can't do this because then AC_AIX won't work due to a
795 dnl circular dependency.
796 dnl AC_BEFORE([$0], [AC_PROG_CPP])
797 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
798 AC_CACHE_VAL(am_cv_prog_cc_stdc,
799 [am_cv_prog_cc_stdc=no
801 # Don't try gcc -ansi; that turns off useful extensions and
802 # breaks some systems' header files.
804 # Ultrix and OSF/1 -std1
805 # HP-UX 10.20 and later -Ae
806 # HP-UX older versions -Aa -D_HPUX_SOURCE
807 # SVR4 -Xc -D__EXTENSIONS__
808 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
810 CC="$ac_save_CC $ac_arg"
814 #include <sys/types.h>
815 #include <sys/stat.h>
816 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
817 struct buf { int x; };
818 FILE * (*rcsopen) (struct buf *, struct stat *, int);
819 static char *e (p, i)
825 static char *f (char * (*g) (char **, int), char **p, ...)
830 s = g (p, va_arg (v,int));
834 int test (int i, double x);
835 struct s1 {int (*f) (int a);};
836 struct s2 {int (*f) (double a);};
837 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
841 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
843 [am_cv_prog_cc_stdc="$ac_arg"; break])
847 if test -z "$am_cv_prog_cc_stdc"; then
848 AC_MSG_RESULT([none needed])
850 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
852 case "x$am_cv_prog_cc_stdc" in
854 *) CC="$CC $am_cv_prog_cc_stdc" ;;
858 dnl From Bruno Haible.
862 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
863 dnl those with the standalone portable GNU libiconv installed).
865 AC_ARG_WITH([libiconv-prefix],
866 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
867 for dir in `echo "$withval" | tr : ' '`; do
868 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
869 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
873 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
874 am_cv_func_iconv="no, consider installing GNU libiconv"
876 AC_TRY_LINK([#include <stdlib.h>
878 [iconv_t cd = iconv_open("","");
879 iconv(cd,NULL,NULL,NULL,NULL);
881 am_cv_func_iconv=yes)
882 if test "$am_cv_func_iconv" != yes; then
885 AC_TRY_LINK([#include <stdlib.h>
887 [iconv_t cd = iconv_open("","");
888 iconv(cd,NULL,NULL,NULL,NULL);
891 am_cv_func_iconv=yes)
895 if test "$am_cv_func_iconv" = yes; then
896 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
897 AC_MSG_CHECKING([for iconv declaration])
898 AC_CACHE_VAL(am_cv_proto_iconv, [
906 #if defined(__STDC__) || defined(__cplusplus)
907 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
911 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
912 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);"])
913 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
914 AC_MSG_RESULT([$]{ac_t:-
915 }[$]am_cv_proto_iconv)
916 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
917 [Define as const if the declaration of iconv() needs const.])
920 if test "$am_cv_lib_iconv" = yes; then
926 dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva
927 dnl Version 1.3 (2001/03/02)
928 dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html
930 AC_DEFUN([AC_DEFINE_DIR], [
931 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
932 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
933 ac_define_dir=`eval echo [$]$2`
934 ac_define_dir=`eval echo [$]ac_define_dir`
936 AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
937 AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
940 dnl See whether we need a declaration for a function.
941 dnl The result is highly dependent on the INCLUDES passed in, so make sure
942 dnl to use a different cache variable name in this macro if it is invoked
943 dnl in a different context somewhere else.
944 dnl gcc_AC_CHECK_DECL(SYMBOL,
945 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
946 AC_DEFUN([gcc_AC_CHECK_DECL],
947 [AC_MSG_CHECKING([whether $1 is declared])
948 AC_CACHE_VAL(gcc_cv_have_decl_$1,
949 [AC_TRY_COMPILE([$4],
951 char *(*pfn) = (char *(*)) $1 ;
952 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
953 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
954 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
956 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
960 dnl Check multiple functions to see whether each needs a declaration.
961 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
962 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
963 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
964 AC_DEFUN([gcc_AC_CHECK_DECLS],
968 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
970 gcc_AC_CHECK_DECL($ac_func,
971 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
972 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
973 dnl It is possible that the include files passed in here are local headers
974 dnl which supply a backup declaration for the relevant prototype based on
975 dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
976 dnl will always return success. E.g. see libiberty.h's handling of
977 dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
978 dnl 1 so that any local headers used do not provide their own prototype
979 dnl during this test.
981 #define $ac_tr_decl 1
985 dnl Automatically generate config.h entries via autoheader.
987 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
988 [AC_DEFINE([HAVE_DECL_\&], 1,
989 [Define to 1 if we found this declaration otherwise define to 0.])])dnl