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 autoconf bugfixes
11 sinclude(../config/override.m4)
13 dnl This gets GCC_HEADER_STDINT.
14 sinclude(../config/stdint.m4)
16 sinclude(../config/gettext-sister.m4)
18 dnl For AC_LIB_HAVE_LINKFLAGS.
19 sinclude(../config/lib-ld.m4)
20 sinclude(../config/lib-prefix.m4)
21 sinclude(../config/lib-link.m4)
24 # Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
25 # makes configure think it's cross compiling. If --target wasn't used, then
26 # we can't configure, so something is wrong. We don't use the cache
27 # here cause if somebody fixes their compiler install, we want this to work.
28 AC_DEFUN([CY_AC_C_WORKS],
29 [# If we cannot compile and link a trivial program, we can't expect anything to work
30 AC_MSG_CHECKING(whether the compiler ($CC) actually works)
31 AC_TRY_COMPILE(, [/* don't need anything here */],
32 c_compiles=yes, c_compiles=no)
34 AC_TRY_LINK(, [/* don't need anything here */],
35 c_links=yes, c_links=no)
37 if test x"${c_compiles}" = x"no" ; then
38 AC_MSG_ERROR(the native compiler is broken and won't compile.)
41 if test x"${c_links}" = x"no" ; then
42 AC_MSG_ERROR(the native compiler is broken and won't link.)
47 AC_DEFUN([CY_AC_PATH_TCLH], [
49 # Ok, lets find the tcl source trees so we can use the headers
50 # Warning: transition of version 9 to 10 will break this algorithm
51 # because 10 sorts before 9. We also look for just tcl. We have to
52 # be careful that we don't match stuff like tclX by accident.
53 # the alternative search directory is involked by --with-tclinclude
57 AC_MSG_CHECKING(for Tcl private headers. dir=${configdir})
58 AC_ARG_WITH(tclinclude, [ --with-tclinclude=DIR Directory where tcl private headers are], with_tclinclude=${withval})
59 AC_CACHE_VAL(ac_cv_c_tclh,[
60 # first check to see if --with-tclinclude was specified
61 if test x"${with_tclinclude}" != x ; then
62 if test -f ${with_tclinclude}/tclInt.h ; then
63 ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
64 elif test -f ${with_tclinclude}/generic/tclInt.h ; then
65 ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
67 AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
71 # next check if it came with Tcl configuration file
72 if test x"${ac_cv_c_tclconfig}" = x ; then
73 if test -f $ac_cv_c_tclconfig/../generic/tclInt.h ; then
74 ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/..; pwd)`
78 # next check in private source directory
80 # since ls returns lowest version numbers first, reverse its output
81 if test x"${ac_cv_c_tclh}" = x ; then
84 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` \
86 `ls -dr ${srcdir}/../../tcl[[7-9]]* 2>/dev/null` \
87 ${srcdir}/../../../tcl \
88 `ls -dr ${srcdir}/../../../tcl[[7-9]]* 2>/dev/null ` ; do
89 if test -f $i/generic/tclInt.h ; then
90 ac_cv_c_tclh=`(cd $i/generic; pwd)`
95 # finally check in a few common install locations
97 # since ls returns lowest version numbers first, reverse its output
98 if test x"${ac_cv_c_tclh}" = x ; then
100 `ls -dr /usr/local/src/tcl[[7-9]]* 2>/dev/null` \
101 `ls -dr /usr/local/lib/tcl[[7-9]]* 2>/dev/null` \
104 ${prefix}/include ; do
105 if test -f $i/generic/tclInt.h ; then
106 ac_cv_c_tclh=`(cd $i/generic; pwd)`
111 # see if one is installed
112 if test x"${ac_cv_c_tclh}" = x ; then
113 AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
116 if test x"${ac_cv_c_tclh}" = x ; then
117 TCLHDIR="# no Tcl private headers found"
118 AC_MSG_ERROR([Can't find Tcl private headers])
120 if test x"${ac_cv_c_tclh}" != x ; then
122 if test x"${ac_cv_c_tclh}" = x"installed" ; then
123 AC_MSG_RESULT([is installed])
126 AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
127 # this hack is cause the TCLHDIR won't print if there is a "-I" in it.
128 TCLHDIR="-I${ac_cv_c_tclh}"
136 AC_DEFUN([CY_AC_PATH_TCLCONFIG], [
138 # Ok, lets find the tcl configuration
139 # First, look for one uninstalled.
140 # the alternative search directory is invoked by --with-tclconfig
143 if test x"${no_tcl}" = x ; then
144 # we reset no_tcl in case something fails here
146 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR Directory containing tcl configuration (tclConfig.sh)],
147 with_tclconfig=${withval})
148 AC_MSG_CHECKING([for Tcl configuration])
149 AC_CACHE_VAL(ac_cv_c_tclconfig,[
151 # First check to see if --with-tclconfig was specified.
152 if test x"${with_tclconfig}" != x ; then
153 if test -f "${with_tclconfig}/tclConfig.sh" ; then
154 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
156 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
160 # then check for a private Tcl installation
161 if test x"${ac_cv_c_tclconfig}" = x ; then
164 `ls -dr ../tcl[[7-9]]* 2>/dev/null` \
166 `ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
168 `ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
169 if test -f "$i/${configdir}/tclConfig.sh" ; then
170 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
175 # check in a few common install locations
176 if test x"${ac_cv_c_tclconfig}" = x ; then
177 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
178 if test -f "$i/tclConfig.sh" ; then
179 ac_cv_c_tclconfig=`(cd $i; pwd)`
184 # check in a few other private locations
185 if test x"${ac_cv_c_tclconfig}" = x ; then
188 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
189 if test -f "$i/${configdir}/tclConfig.sh" ; then
190 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
196 if test x"${ac_cv_c_tclconfig}" = x ; then
197 TCLCONFIG="# no Tcl configs found"
198 AC_MSG_WARN(Can't find Tcl configuration definitions)
201 TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
202 AC_MSG_RESULT(found $TCLCONFIG)
207 # Defined as a separate macro so we don't have to cache the values
208 # from PATH_TCLCONFIG (because this can also be cached).
209 AC_DEFUN([CY_AC_LOAD_TCLCONFIG], [
212 AC_SUBST(TCL_VERSION)
213 AC_SUBST(TCL_MAJOR_VERSION)
214 AC_SUBST(TCL_MINOR_VERSION)
218 dnl not used, don't export to save symbols
219 dnl AC_SUBST(TCL_LIB_FILE)
221 dnl don't export, not used outside of configure
222 dnl AC_SUBST(TCL_LIBS)
223 dnl not used, don't export to save symbols
224 dnl AC_SUBST(TCL_PREFIX)
226 dnl not used, don't export to save symbols
227 dnl AC_SUBST(TCL_EXEC_PREFIX)
229 AC_SUBST(TCL_SHLIB_CFLAGS)
230 AC_SUBST(TCL_SHLIB_LD)
231 dnl don't export, not used outside of configure
232 AC_SUBST(TCL_SHLIB_LD_LIBS)
233 AC_SUBST(TCL_SHLIB_SUFFIX)
234 dnl not used, don't export to save symbols
235 AC_SUBST(TCL_DL_LIBS)
236 AC_SUBST(TCL_LD_FLAGS)
237 dnl don't export, not used outside of configure
238 AC_SUBST(TCL_LD_SEARCH_FLAGS)
239 AC_SUBST(TCL_CC_SEARCH_FLAGS)
240 AC_SUBST(TCL_COMPAT_OBJS)
242 AC_SUBST(TCL_BUILD_LIB_SPEC)
243 AC_SUBST(TCL_LIB_SPEC)
244 AC_SUBST(TCL_LIB_VERSIONS_OK)
246 dnl not used, don't export to save symbols
247 dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
249 dnl not used, don't export to save symbols
250 dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
253 # Warning: Tk definitions are very similar to Tcl definitions but
254 # are not precisely the same. There are a couple of differences,
255 # so don't do changes to Tcl thinking you can cut and paste it do
256 # the Tk differences and later simply substitute "Tk" for "Tcl".
258 # - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
259 # - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
260 # - Computing major/minor versions is different because Tk depends on
261 # headers to Tcl, Tk, and X.
262 # - Symbols in tkConfig.sh are different than tclConfig.sh
263 # - Acceptable for Tk to be missing but not Tcl.
265 AC_DEFUN([CY_AC_PATH_TKH], [
267 # Ok, lets find the tk source trees so we can use the headers
268 # If the directory (presumably symlink) named "tk" exists, use that one
269 # in preference to any others. Same logic is used when choosing library
270 # and again with Tcl. The search order is the best place to look first, then in
271 # decreasing significance. The loop breaks if the trigger file is found.
272 # Note the gross little conversion here of srcdir by cd'ing to the found
273 # directory. This converts the path from a relative to an absolute, so
274 # recursive cache variables for the path will work right. We check all
275 # the possible paths in one loop rather than many seperate loops to speed
277 # the alternative search directory is involked by --with-tkinclude
280 AC_MSG_CHECKING(for Tk private headers)
281 AC_ARG_WITH(tkinclude, [ --with-tkinclude=DIR Directory where tk private headers are], with_tkinclude=${withval})
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 elif test -f ${with_tkinclude}/generic/tk.h ; then
288 ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
290 AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
294 # next check if it came with Tk configuration file
295 if test x"${ac_cv_c_tkconfig}" = x ; then
296 if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
297 ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
301 # next check in private source directory
303 # since ls returns lowest version numbers first, reverse its output
304 if test x"${ac_cv_c_tkh}" = x ; then
307 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
309 `ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
310 ${srcdir}/../../../tk \
311 `ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
312 if test -f $i/generic/tk.h ; then
313 ac_cv_c_tkh=`(cd $i/generic; pwd)`
318 # finally check in a few common install locations
320 # since ls returns lowest version numbers first, reverse its output
321 if test x"${ac_cv_c_tkh}" = x ; then
323 `ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
324 `ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
327 ${prefix}/include ; do
328 if test -f $i/generic/tk.h ; then
329 ac_cv_c_tkh=`(cd $i/generic; pwd)`
334 # see if one is installed
335 if test x"${ac_cv_c_tkh}" = x ; then
336 AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
339 if test x"${ac_cv_c_tkh}" != x ; then
341 if test x"${ac_cv_c_tkh}" = x"installed" ; then
342 AC_MSG_RESULT([is installed])
345 AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
346 # this hack is cause the TKHDIR won't print if there is a "-I" in it.
347 TKHDIR="-I${ac_cv_c_tkh}"
350 TKHDIR="# no Tk directory found"
351 AC_MSG_WARN([Can't find Tk private headers])
359 AC_DEFUN([CY_AC_PATH_TKCONFIG], [
361 # Ok, lets find the tk configuration
362 # First, look for one uninstalled.
363 # the alternative search directory is invoked by --with-tkconfig
366 if test x"${no_tk}" = x ; then
367 # we reset no_tk in case something fails here
369 AC_ARG_WITH(tkconfig, [ --with-tkconfig=DIR Directory containing tk configuration (tkConfig.sh)],
370 with_tkconfig=${withval})
371 AC_MSG_CHECKING([for Tk configuration])
372 AC_CACHE_VAL(ac_cv_c_tkconfig,[
374 # First check to see if --with-tkconfig was specified.
375 if test x"${with_tkconfig}" != x ; then
376 if test -f "${with_tkconfig}/tkConfig.sh" ; then
377 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
379 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
383 # then check for a private Tk library
384 if test x"${ac_cv_c_tkconfig}" = x ; then
387 `ls -dr ../tk[[4-9]]* 2>/dev/null` \
389 `ls -dr ../../tk[[4-9]]* 2>/dev/null` \
391 `ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
392 if test -f "$i/${configdir}/tkConfig.sh" ; then
393 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
398 # check in a few common install locations
399 if test x"${ac_cv_c_tkconfig}" = x ; then
400 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
401 if test -f "$i/tkConfig.sh" ; then
402 ac_cv_c_tkconfig=`(cd $i; pwd)`
407 # check in a few other private locations
408 if test x"${ac_cv_c_tkconfig}" = x ; then
411 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
412 if test -f "$i/${configdir}/tkConfig.sh" ; then
413 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
419 if test x"${ac_cv_c_tkconfig}" = x ; then
420 TKCONFIG="# no Tk configs found"
421 AC_MSG_WARN(Can't find Tk configuration definitions)
424 TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
425 AC_MSG_RESULT(found $TKCONFIG)
431 # Defined as a separate macro so we don't have to cache the values
432 # from PATH_TKCONFIG (because this can also be cached).
433 AC_DEFUN([CY_AC_LOAD_TKCONFIG], [
434 if test -f "$TKCONFIG" ; then
439 dnl not actually used, don't export to save symbols
440 dnl AC_SUBST(TK_MAJOR_VERSION)
441 dnl AC_SUBST(TK_MINOR_VERSION)
444 dnl not used, don't export to save symbols
445 dnl AC_SUBST(TK_LIB_FILE)
447 dnl not used outside of configure
448 dnl AC_SUBST(TK_LIBS)
449 dnl not used, don't export to save symbols
450 dnl AC_SUBST(TK_PREFIX)
452 dnl not used, don't export to save symbols
453 dnl AC_SUBST(TK_EXEC_PREFIX)
455 AC_SUBST(TK_BUILD_INCLUDES)
456 AC_SUBST(TK_XINCLUDES)
458 AC_SUBST(TK_BUILD_LIB_SPEC)
459 AC_SUBST(TK_LIB_SPEC)
462 # check for Itcl headers.
464 AC_DEFUN([CY_AC_PATH_ITCLCONFIG], [
466 # Ok, lets find the itcl configuration
467 # First, look for one uninstalled.
468 # the alternative search directory is invoked by --with-itclconfig
471 if test x"${no_itcl}" = x ; then
472 # we reset no_itcl in case something fails here
474 AC_ARG_WITH(itclconfig, [ --with-itclconfig Directory containing itcl configuration (itclConfig.sh)],
475 with_itclconfig=${withval})
476 AC_MSG_CHECKING([for Itcl configuration])
477 AC_CACHE_VAL(ac_cv_c_itclconfig,[
479 # First check to see if --with-itclconfig was specified.
480 if test x"${with_itclconfig}" != x ; then
481 if test -f "${with_itclconfig}/itclConfig.sh" ; then
482 ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
484 AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
488 # then check for a private Itcl library
489 if test x"${ac_cv_c_itclconfig}" = x ; then
492 `ls -dr ../itcl[[4-9]]*/itcl 2>/dev/null` \
494 `ls -dr ../../itcl[[4-9]]*/itcl 2>/dev/null` \
496 `ls -dr ../../../itcl[[4-9]]*/itcl 2>/dev/null` ; do
497 if test -f "$i/itclConfig.sh" ; then
498 ac_cv_c_itclconfig=`(cd $i; pwd)`
503 # check in a few common install locations
504 if test x"${ac_cv_c_itclconfig}" = x ; then
505 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
506 if test -f "$i/itclConfig.sh" ; then
507 ac_cv_c_itclconfig=`(cd $i; pwd)`
512 # check in a few other private locations
513 if test x"${ac_cv_c_itclconfig}" = x ; then
515 ${srcdir}/../itcl/itcl \
516 `ls -dr ${srcdir}/../itcl[[4-9]]*/itcl 2>/dev/null` ; do
517 if test -f "$i/itclConfig.sh" ; then
518 ac_cv_c_itclconfig=`(cd $i; pwd)`
524 if test x"${ac_cv_c_itclconfig}" = x ; then
525 ITCLCONFIG="# no Itcl configs found"
526 AC_MSG_WARN(Can't find Itcl configuration definitions)
529 ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
530 AC_MSG_RESULT(found $ITCLCONFIG)
535 # Defined as a separate macro so we don't have to cache the values
536 # from PATH_ITCLCONFIG (because this can also be cached).
537 AC_DEFUN([CY_AC_LOAD_ITCLCONFIG], [
538 if test -f "$ITCLCONFIG" ; then
542 AC_SUBST(ITCL_VERSION)
543 dnl not actually used, don't export to save symbols
544 dnl AC_SUBST(ITCL_MAJOR_VERSION)
545 dnl AC_SUBST(ITCL_MINOR_VERSION)
548 dnl not used, don't export to save symbols
549 dnl AC_SUBST(ITCL_LIB_FILE)
551 dnl not used outside of configure
552 dnl AC_SUBST(ITCL_LIBS)
553 dnl not used, don't export to save symbols
554 dnl AC_SUBST(ITCL_PREFIX)
556 dnl not used, don't export to save symbols
557 dnl AC_SUBST(ITCL_EXEC_PREFIX)
559 AC_SUBST(ITCL_BUILD_INCLUDES)
560 AC_SUBST(ITCL_BUILD_LIB_SPEC)
561 AC_SUBST(ITCL_LIB_SPEC)
564 # check for Itcl headers.
566 AC_DEFUN([CY_AC_PATH_ITCLH], [
567 AC_MSG_CHECKING(for Itcl private headers. srcdir=${srcdir})
568 if test x"${ac_cv_c_itclh}" = x ; then
569 for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
570 if test -f $i/generic/itcl.h ; then
571 ac_cv_c_itclh=`(cd $i/generic; pwd)`
576 if test x"${ac_cv_c_itclh}" = x ; then
577 ITCLHDIR="# no Itcl private headers found"
578 AC_MSG_ERROR([Can't find Itcl private headers])
580 if test x"${ac_cv_c_itclh}" != x ; then
581 ITCLHDIR="-I${ac_cv_c_itclh}"
583 # should always be here
584 # ITCLLIB="../itcl/itcl/unix/libitcl.a"
590 AC_DEFUN([CY_AC_PATH_ITKCONFIG], [
592 # Ok, lets find the itk configuration
593 # First, look for one uninstalled.
594 # the alternative search directory is invoked by --with-itkconfig
597 if test x"${no_itk}" = x ; then
598 # we reset no_itk in case something fails here
600 AC_ARG_WITH(itkconfig, [ --with-itkconfig Directory containing itk configuration (itkConfig.sh)],
601 with_itkconfig=${withval})
602 AC_MSG_CHECKING([for Itk configuration])
603 AC_CACHE_VAL(ac_cv_c_itkconfig,[
605 # First check to see if --with-itkconfig was specified.
606 if test x"${with_itkconfig}" != x ; then
607 if test -f "${with_itkconfig}/itkConfig.sh" ; then
608 ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
610 AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
614 # then check for a private Itk library
615 if test x"${ac_cv_c_itkconfig}" = x ; then
618 `ls -dr ../itcl[[4-9]]*/itk 2>/dev/null` \
620 `ls -dr ../../itcl[[4-9]]*/itk 2>/dev/null` \
622 `ls -dr ../../../itcl[[4-9]]*/itk 2>/dev/null` ; do
623 if test -f "$i/itkConfig.sh" ; then
624 ac_cv_c_itkconfig=`(cd $i; pwd)`
629 # check in a few common install locations
630 if test x"${ac_cv_c_itkconfig}" = x ; then
631 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
632 if test -f "$i/itkConfig.sh" ; then
633 ac_cv_c_itkconfig=`(cd $i; pwd)`
638 # check in a few other private locations
639 if test x"${ac_cv_c_itkconfig}" = x ; then
641 ${srcdir}/../itcl/itk \
642 `ls -dr ${srcdir}/../itcl[[4-9]]*/itk 2>/dev/null` ; do
643 if test -f "$i/itkConfig.sh" ; then
644 ac_cv_c_itkconfig=`(cd $i; pwd)`
650 if test x"${ac_cv_c_itkconfig}" = x ; then
651 ITKCONFIG="# no Itk configs found"
652 AC_MSG_WARN(Can't find Itk configuration definitions)
655 ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
656 AC_MSG_RESULT(found $ITKCONFIG)
662 # Defined as a separate macro so we don't have to cache the values
663 # from PATH_ITKCONFIG (because this can also be cached).
664 AC_DEFUN([CY_AC_LOAD_ITKCONFIG], [
665 if test -f "$ITKCONFIG" ; then
669 AC_SUBST(ITK_VERSION)
670 dnl not actually used, don't export to save symbols
671 dnl AC_SUBST(ITK_MAJOR_VERSION)
672 dnl AC_SUBST(ITK_MINOR_VERSION)
675 dnl not used, don't export to save symbols
676 dnl AC_SUBST(ITK_LIB_FILE)
678 dnl not used outside of configure
679 dnl AC_SUBST(ITK_LIBS)
680 dnl not used, don't export to save symbols
681 dnl AC_SUBST(ITK_PREFIX)
683 dnl not used, don't export to save symbols
684 dnl AC_SUBST(ITK_EXEC_PREFIX)
686 AC_SUBST(ITK_BUILD_INCLUDES)
687 AC_SUBST(ITK_BUILD_LIB_SPEC)
688 AC_SUBST(ITK_LIB_SPEC)
691 AC_DEFUN([CY_AC_PATH_ITKH], [
692 AC_MSG_CHECKING(for Itk private headers. srcdir=${srcdir})
693 if test x"${ac_cv_c_itkh}" = x ; then
694 for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
695 if test -f $i/generic/itk.h ; then
696 ac_cv_c_itkh=`(cd $i/generic; pwd)`
701 if test x"${ac_cv_c_itkh}" = x ; then
702 ITKHDIR="# no Itk private headers found"
703 AC_MSG_ERROR([Can't find Itk private headers])
705 if test x"${ac_cv_c_itkh}" != x ; then
706 ITKHDIR="-I${ac_cv_c_itkh}"
708 # should always be here
709 # ITKLIB="../itcl/itk/unix/libitk.a"
715 ## ----------------------------------------- ##
716 ## ANSIfy the C compiler whenever possible. ##
717 ## From Franc,ois Pinard ##
718 ## ----------------------------------------- ##
720 # Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
722 # This program is free software; you can redistribute it and/or modify
723 # it under the terms of the GNU General Public License as published by
724 # the Free Software Foundation; either version 2, or (at your option)
727 # This program is distributed in the hope that it will be useful,
728 # but WITHOUT ANY WARRANTY; without even the implied warranty of
729 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
730 # GNU General Public License for more details.
732 # You should have received a copy of the GNU General Public License
733 # along with this program; if not, write to the Free Software
734 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
735 # Boston, MA 02110-1301, USA.
739 # @defmac AC_PROG_CC_STDC
740 # @maindex PROG_CC_STDC
742 # If the C compiler in not in ANSI C mode by default, try to add an option
743 # to output variable @code{CC} to make it so. This macro tries various
744 # options that select ANSI C on some system or another. It considers the
745 # compiler to be in ANSI C mode if it handles function prototypes correctly.
747 # If you use this macro, you should check after calling it whether the C
748 # compiler has been set to accept ANSI C; if not, the shell variable
749 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
750 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
751 # program @code{ansi2knr}, which comes with Ghostscript.
754 AC_DEFUN([AM_PROG_CC_STDC],
755 [AC_REQUIRE([AC_PROG_CC])
756 AC_BEFORE([$0], [AC_C_INLINE])
757 AC_BEFORE([$0], [AC_C_CONST])
758 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
759 dnl a magic option to avoid problems with ANSI preprocessor commands
761 dnl FIXME: can't do this because then AC_AIX won't work due to a
762 dnl circular dependency.
763 dnl AC_BEFORE([$0], [AC_PROG_CPP])
764 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
765 AC_CACHE_VAL(am_cv_prog_cc_stdc,
766 [am_cv_prog_cc_stdc=no
768 # Don't try gcc -ansi; that turns off useful extensions and
769 # breaks some systems' header files.
771 # Ultrix and OSF/1 -std1
772 # HP-UX 10.20 and later -Ae
773 # HP-UX older versions -Aa -D_HPUX_SOURCE
774 # SVR4 -Xc -D__EXTENSIONS__
775 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
777 CC="$ac_save_CC $ac_arg"
781 #include <sys/types.h>
782 #include <sys/stat.h>
783 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
784 struct buf { int x; };
785 FILE * (*rcsopen) (struct buf *, struct stat *, int);
786 static char *e (p, i)
792 static char *f (char * (*g) (char **, int), char **p, ...)
797 s = g (p, va_arg (v,int));
801 int test (int i, double x);
802 struct s1 {int (*f) (int a);};
803 struct s2 {int (*f) (double a);};
804 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
808 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
810 [am_cv_prog_cc_stdc="$ac_arg"; break])
814 if test -z "$am_cv_prog_cc_stdc"; then
815 AC_MSG_RESULT([none needed])
817 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
819 case "x$am_cv_prog_cc_stdc" in
821 *) CC="$CC $am_cv_prog_cc_stdc" ;;
825 dnl From Bruno Haible.
829 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
830 dnl those with the standalone portable GNU libiconv installed).
832 AC_ARG_WITH([libiconv-prefix],
833 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
834 for dir in `echo "$withval" | tr : ' '`; do
835 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
836 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
840 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
841 am_cv_func_iconv="no, consider installing GNU libiconv"
843 AC_TRY_LINK([#include <stdlib.h>
845 [iconv_t cd = iconv_open("","");
846 iconv(cd,NULL,NULL,NULL,NULL);
848 am_cv_func_iconv=yes)
849 if test "$am_cv_func_iconv" != yes; then
852 AC_TRY_LINK([#include <stdlib.h>
854 [iconv_t cd = iconv_open("","");
855 iconv(cd,NULL,NULL,NULL,NULL);
858 am_cv_func_iconv=yes)
862 if test "$am_cv_func_iconv" = yes; then
863 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
864 AC_MSG_CHECKING([for iconv declaration])
865 AC_CACHE_VAL(am_cv_proto_iconv, [
873 #if defined(__STDC__) || defined(__cplusplus)
874 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
878 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
879 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);"])
880 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
881 AC_MSG_RESULT([$]{ac_t:-
882 }[$]am_cv_proto_iconv)
883 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
884 [Define as const if the declaration of iconv() needs const.])
887 if test "$am_cv_lib_iconv" = yes; then
893 dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva
894 dnl Version 1.3 (2001/03/02)
895 dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html
897 AC_DEFUN([AC_DEFINE_DIR], [
898 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
899 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
900 ac_define_dir=`eval echo [$]$2`
901 ac_define_dir=`eval echo [$]ac_define_dir`
903 AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
904 AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
907 dnl See whether we need a declaration for a function.
908 dnl The result is highly dependent on the INCLUDES passed in, so make sure
909 dnl to use a different cache variable name in this macro if it is invoked
910 dnl in a different context somewhere else.
911 dnl gcc_AC_CHECK_DECL(SYMBOL,
912 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
913 AC_DEFUN([gcc_AC_CHECK_DECL],
914 [AC_MSG_CHECKING([whether $1 is declared])
915 AC_CACHE_VAL(gcc_cv_have_decl_$1,
916 [AC_TRY_COMPILE([$4],
918 char *(*pfn) = (char *(*)) $1 ;
919 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
920 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
921 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
923 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
927 dnl Check multiple functions to see whether each needs a declaration.
928 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
929 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
930 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
931 AC_DEFUN([gcc_AC_CHECK_DECLS],
935 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
937 gcc_AC_CHECK_DECL($ac_func,
938 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
939 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
940 dnl It is possible that the include files passed in here are local headers
941 dnl which supply a backup declaration for the relevant prototype based on
942 dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
943 dnl will always return success. E.g. see libiberty.h's handling of
944 dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
945 dnl 1 so that any local headers used do not provide their own prototype
946 dnl during this test.
948 #define $ac_tr_decl 1
952 dnl Automatically generate config.h entries via autoheader.
954 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
955 [AC_DEFINE([HAVE_DECL_\&], 1,
956 [Define to 1 if we found this declaration otherwise define to 0.])])dnl