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)
23 dnl For ACX_PKGVERSION and ACX_BUGURL.
24 sinclude(../config/acx.m4)
27 # Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
28 # makes configure think it's cross compiling. If --target wasn't used, then
29 # we can't configure, so something is wrong. We don't use the cache
30 # here cause if somebody fixes their compiler install, we want this to work.
31 AC_DEFUN([CY_AC_C_WORKS],
32 [# If we cannot compile and link a trivial program, we can't expect anything to work
33 AC_MSG_CHECKING(whether the compiler ($CC) actually works)
34 AC_TRY_COMPILE(, [/* don't need anything here */],
35 c_compiles=yes, c_compiles=no)
37 AC_TRY_LINK(, [/* don't need anything here */],
38 c_links=yes, c_links=no)
40 if test x"${c_compiles}" = x"no" ; then
41 AC_MSG_ERROR(the native compiler is broken and won't compile.)
44 if test x"${c_links}" = x"no" ; then
45 AC_MSG_ERROR(the native compiler is broken and won't link.)
50 AC_DEFUN([CY_AC_PATH_TCLH], [
52 # Ok, lets find the tcl source trees so we can use the headers
53 # Warning: transition of version 9 to 10 will break this algorithm
54 # because 10 sorts before 9. We also look for just tcl. We have to
55 # be careful that we don't match stuff like tclX by accident.
56 # the alternative search directory is involked by --with-tclinclude
60 AC_MSG_CHECKING(for Tcl private headers. dir=${configdir})
61 AC_ARG_WITH(tclinclude, [ --with-tclinclude=DIR Directory where tcl private headers are], with_tclinclude=${withval})
62 AC_CACHE_VAL(ac_cv_c_tclh,[
63 # first check to see if --with-tclinclude was specified
64 if test x"${with_tclinclude}" != x ; then
65 if test -f ${with_tclinclude}/tclInt.h ; then
66 ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
67 elif test -f ${with_tclinclude}/generic/tclInt.h ; then
68 ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
70 AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
74 # next check if it came with Tcl configuration file
75 if test x"${ac_cv_c_tclconfig}" = x ; then
76 if test -f $ac_cv_c_tclconfig/../generic/tclInt.h ; then
77 ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/..; pwd)`
81 # next check in private source directory
83 # since ls returns lowest version numbers first, reverse its output
84 if test x"${ac_cv_c_tclh}" = x ; then
87 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` \
89 `ls -dr ${srcdir}/../../tcl[[7-9]]* 2>/dev/null` \
90 ${srcdir}/../../../tcl \
91 `ls -dr ${srcdir}/../../../tcl[[7-9]]* 2>/dev/null ` ; do
92 if test -f $i/generic/tclInt.h ; then
93 ac_cv_c_tclh=`(cd $i/generic; pwd)`
98 # finally check in a few common install locations
100 # since ls returns lowest version numbers first, reverse its output
101 if test x"${ac_cv_c_tclh}" = x ; then
103 `ls -dr /usr/local/src/tcl[[7-9]]* 2>/dev/null` \
104 `ls -dr /usr/local/lib/tcl[[7-9]]* 2>/dev/null` \
107 ${prefix}/include ; do
108 if test -f $i/generic/tclInt.h ; then
109 ac_cv_c_tclh=`(cd $i/generic; pwd)`
114 # see if one is installed
115 if test x"${ac_cv_c_tclh}" = x ; then
116 AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
119 if test x"${ac_cv_c_tclh}" = x ; then
120 TCLHDIR="# no Tcl private headers found"
121 AC_MSG_ERROR([Can't find Tcl private headers])
123 if test x"${ac_cv_c_tclh}" != x ; then
125 if test x"${ac_cv_c_tclh}" = x"installed" ; then
126 AC_MSG_RESULT([is installed])
129 AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
130 # this hack is cause the TCLHDIR won't print if there is a "-I" in it.
131 TCLHDIR="-I${ac_cv_c_tclh}"
139 AC_DEFUN([CY_AC_PATH_TCLCONFIG], [
141 # Ok, lets find the tcl configuration
142 # First, look for one uninstalled.
143 # the alternative search directory is invoked by --with-tclconfig
146 if test x"${no_tcl}" = x ; then
147 # we reset no_tcl in case something fails here
149 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR Directory containing tcl configuration (tclConfig.sh)],
150 with_tclconfig=${withval})
151 AC_MSG_CHECKING([for Tcl configuration])
152 AC_CACHE_VAL(ac_cv_c_tclconfig,[
154 # First check to see if --with-tclconfig was specified.
155 if test x"${with_tclconfig}" != x ; then
156 if test -f "${with_tclconfig}/tclConfig.sh" ; then
157 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
159 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
163 # then check for a private Tcl installation
164 if test x"${ac_cv_c_tclconfig}" = x ; then
167 `ls -dr ../tcl[[7-9]]* 2>/dev/null` \
169 `ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
171 `ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
172 if test -f "$i/${configdir}/tclConfig.sh" ; then
173 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
178 # check in a few common install locations
179 if test x"${ac_cv_c_tclconfig}" = x ; then
180 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
181 if test -f "$i/tclConfig.sh" ; then
182 ac_cv_c_tclconfig=`(cd $i; pwd)`
187 # check in a few other private locations
188 if test x"${ac_cv_c_tclconfig}" = x ; then
191 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
192 if test -f "$i/${configdir}/tclConfig.sh" ; then
193 ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
199 if test x"${ac_cv_c_tclconfig}" = x ; then
200 TCLCONFIG="# no Tcl configs found"
201 AC_MSG_WARN(Can't find Tcl configuration definitions)
204 TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
205 AC_MSG_RESULT(found $TCLCONFIG)
210 # Defined as a separate macro so we don't have to cache the values
211 # from PATH_TCLCONFIG (because this can also be cached).
212 AC_DEFUN([CY_AC_LOAD_TCLCONFIG], [
215 AC_SUBST(TCL_VERSION)
216 AC_SUBST(TCL_MAJOR_VERSION)
217 AC_SUBST(TCL_MINOR_VERSION)
221 dnl not used, don't export to save symbols
222 dnl AC_SUBST(TCL_LIB_FILE)
224 dnl don't export, not used outside of configure
225 dnl AC_SUBST(TCL_LIBS)
226 dnl not used, don't export to save symbols
227 dnl AC_SUBST(TCL_PREFIX)
229 dnl not used, don't export to save symbols
230 dnl AC_SUBST(TCL_EXEC_PREFIX)
232 AC_SUBST(TCL_SHLIB_CFLAGS)
233 AC_SUBST(TCL_SHLIB_LD)
234 dnl don't export, not used outside of configure
235 AC_SUBST(TCL_SHLIB_LD_LIBS)
236 AC_SUBST(TCL_SHLIB_SUFFIX)
237 dnl not used, don't export to save symbols
238 AC_SUBST(TCL_DL_LIBS)
239 AC_SUBST(TCL_LD_FLAGS)
240 dnl don't export, not used outside of configure
241 AC_SUBST(TCL_LD_SEARCH_FLAGS)
242 AC_SUBST(TCL_CC_SEARCH_FLAGS)
243 AC_SUBST(TCL_COMPAT_OBJS)
245 AC_SUBST(TCL_BUILD_LIB_SPEC)
246 AC_SUBST(TCL_LIB_SPEC)
247 AC_SUBST(TCL_LIB_VERSIONS_OK)
249 dnl not used, don't export to save symbols
250 dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
252 dnl not used, don't export to save symbols
253 dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
256 # Warning: Tk definitions are very similar to Tcl definitions but
257 # are not precisely the same. There are a couple of differences,
258 # so don't do changes to Tcl thinking you can cut and paste it do
259 # the Tk differences and later simply substitute "Tk" for "Tcl".
261 # - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
262 # - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
263 # - Computing major/minor versions is different because Tk depends on
264 # headers to Tcl, Tk, and X.
265 # - Symbols in tkConfig.sh are different than tclConfig.sh
266 # - Acceptable for Tk to be missing but not Tcl.
268 AC_DEFUN([CY_AC_PATH_TKH], [
270 # Ok, lets find the tk source trees so we can use the headers
271 # If the directory (presumably symlink) named "tk" exists, use that one
272 # in preference to any others. Same logic is used when choosing library
273 # and again with Tcl. The search order is the best place to look first, then in
274 # decreasing significance. The loop breaks if the trigger file is found.
275 # Note the gross little conversion here of srcdir by cd'ing to the found
276 # directory. This converts the path from a relative to an absolute, so
277 # recursive cache variables for the path will work right. We check all
278 # the possible paths in one loop rather than many seperate loops to speed
280 # the alternative search directory is involked by --with-tkinclude
283 AC_MSG_CHECKING(for Tk private headers)
284 AC_ARG_WITH(tkinclude, [ --with-tkinclude=DIR Directory where tk private headers are], with_tkinclude=${withval})
285 AC_CACHE_VAL(ac_cv_c_tkh,[
286 # first check to see if --with-tkinclude was specified
287 if test x"${with_tkinclude}" != x ; then
288 if test -f ${with_tkinclude}/tk.h ; then
289 ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
290 elif test -f ${with_tkinclude}/generic/tk.h ; then
291 ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
293 AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
297 # next check if it came with Tk configuration file
298 if test x"${ac_cv_c_tkconfig}" = x ; then
299 if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
300 ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
304 # next check in private source directory
306 # since ls returns lowest version numbers first, reverse its output
307 if test x"${ac_cv_c_tkh}" = x ; then
310 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
312 `ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
313 ${srcdir}/../../../tk \
314 `ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
315 if test -f $i/generic/tk.h ; then
316 ac_cv_c_tkh=`(cd $i/generic; pwd)`
321 # finally check in a few common install locations
323 # since ls returns lowest version numbers first, reverse its output
324 if test x"${ac_cv_c_tkh}" = x ; then
326 `ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
327 `ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
330 ${prefix}/include ; do
331 if test -f $i/generic/tk.h ; then
332 ac_cv_c_tkh=`(cd $i/generic; pwd)`
337 # see if one is installed
338 if test x"${ac_cv_c_tkh}" = x ; then
339 AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
342 if test x"${ac_cv_c_tkh}" != x ; then
344 if test x"${ac_cv_c_tkh}" = x"installed" ; then
345 AC_MSG_RESULT([is installed])
348 AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
349 # this hack is cause the TKHDIR won't print if there is a "-I" in it.
350 TKHDIR="-I${ac_cv_c_tkh}"
353 TKHDIR="# no Tk directory found"
354 AC_MSG_WARN([Can't find Tk private headers])
362 AC_DEFUN([CY_AC_PATH_TKCONFIG], [
364 # Ok, lets find the tk configuration
365 # First, look for one uninstalled.
366 # the alternative search directory is invoked by --with-tkconfig
369 if test x"${no_tk}" = x ; then
370 # we reset no_tk in case something fails here
372 AC_ARG_WITH(tkconfig, [ --with-tkconfig=DIR Directory containing tk configuration (tkConfig.sh)],
373 with_tkconfig=${withval})
374 AC_MSG_CHECKING([for Tk configuration])
375 AC_CACHE_VAL(ac_cv_c_tkconfig,[
377 # First check to see if --with-tkconfig was specified.
378 if test x"${with_tkconfig}" != x ; then
379 if test -f "${with_tkconfig}/tkConfig.sh" ; then
380 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
382 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
386 # then check for a private Tk library
387 if test x"${ac_cv_c_tkconfig}" = x ; then
390 `ls -dr ../tk[[4-9]]* 2>/dev/null` \
392 `ls -dr ../../tk[[4-9]]* 2>/dev/null` \
394 `ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
395 if test -f "$i/${configdir}/tkConfig.sh" ; then
396 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
401 # check in a few common install locations
402 if test x"${ac_cv_c_tkconfig}" = x ; then
403 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
404 if test -f "$i/tkConfig.sh" ; then
405 ac_cv_c_tkconfig=`(cd $i; pwd)`
410 # check in a few other private locations
411 if test x"${ac_cv_c_tkconfig}" = x ; then
414 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
415 if test -f "$i/${configdir}/tkConfig.sh" ; then
416 ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
422 if test x"${ac_cv_c_tkconfig}" = x ; then
423 TKCONFIG="# no Tk configs found"
424 AC_MSG_WARN(Can't find Tk configuration definitions)
427 TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
428 AC_MSG_RESULT(found $TKCONFIG)
434 # Defined as a separate macro so we don't have to cache the values
435 # from PATH_TKCONFIG (because this can also be cached).
436 AC_DEFUN([CY_AC_LOAD_TKCONFIG], [
437 if test -f "$TKCONFIG" ; then
442 dnl not actually used, don't export to save symbols
443 dnl AC_SUBST(TK_MAJOR_VERSION)
444 dnl AC_SUBST(TK_MINOR_VERSION)
447 dnl not used, don't export to save symbols
448 dnl AC_SUBST(TK_LIB_FILE)
450 dnl not used outside of configure
451 dnl AC_SUBST(TK_LIBS)
452 dnl not used, don't export to save symbols
453 dnl AC_SUBST(TK_PREFIX)
455 dnl not used, don't export to save symbols
456 dnl AC_SUBST(TK_EXEC_PREFIX)
458 AC_SUBST(TK_BUILD_INCLUDES)
459 AC_SUBST(TK_XINCLUDES)
461 AC_SUBST(TK_BUILD_LIB_SPEC)
462 AC_SUBST(TK_LIB_SPEC)
465 # check for Itcl headers.
467 AC_DEFUN([CY_AC_PATH_ITCLCONFIG], [
469 # Ok, lets find the itcl configuration
470 # First, look for one uninstalled.
471 # the alternative search directory is invoked by --with-itclconfig
474 if test x"${no_itcl}" = x ; then
475 # we reset no_itcl in case something fails here
477 AC_ARG_WITH(itclconfig, [ --with-itclconfig Directory containing itcl configuration (itclConfig.sh)],
478 with_itclconfig=${withval})
479 AC_MSG_CHECKING([for Itcl configuration])
480 AC_CACHE_VAL(ac_cv_c_itclconfig,[
482 # First check to see if --with-itclconfig was specified.
483 if test x"${with_itclconfig}" != x ; then
484 if test -f "${with_itclconfig}/itclConfig.sh" ; then
485 ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
487 AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
491 # then check for a private Itcl library
492 if test x"${ac_cv_c_itclconfig}" = x ; then
495 `ls -dr ../itcl[[4-9]]*/itcl 2>/dev/null` \
497 `ls -dr ../../itcl[[4-9]]*/itcl 2>/dev/null` \
499 `ls -dr ../../../itcl[[4-9]]*/itcl 2>/dev/null` ; do
500 if test -f "$i/itclConfig.sh" ; then
501 ac_cv_c_itclconfig=`(cd $i; pwd)`
506 # check in a few common install locations
507 if test x"${ac_cv_c_itclconfig}" = x ; then
508 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
509 if test -f "$i/itclConfig.sh" ; then
510 ac_cv_c_itclconfig=`(cd $i; pwd)`
515 # check in a few other private locations
516 if test x"${ac_cv_c_itclconfig}" = x ; then
518 ${srcdir}/../itcl/itcl \
519 `ls -dr ${srcdir}/../itcl[[4-9]]*/itcl 2>/dev/null` ; do
520 if test -f "$i/itclConfig.sh" ; then
521 ac_cv_c_itclconfig=`(cd $i; pwd)`
527 if test x"${ac_cv_c_itclconfig}" = x ; then
528 ITCLCONFIG="# no Itcl configs found"
529 AC_MSG_WARN(Can't find Itcl configuration definitions)
532 ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
533 AC_MSG_RESULT(found $ITCLCONFIG)
538 # Defined as a separate macro so we don't have to cache the values
539 # from PATH_ITCLCONFIG (because this can also be cached).
540 AC_DEFUN([CY_AC_LOAD_ITCLCONFIG], [
541 if test -f "$ITCLCONFIG" ; then
545 AC_SUBST(ITCL_VERSION)
546 dnl not actually used, don't export to save symbols
547 dnl AC_SUBST(ITCL_MAJOR_VERSION)
548 dnl AC_SUBST(ITCL_MINOR_VERSION)
551 dnl not used, don't export to save symbols
552 dnl AC_SUBST(ITCL_LIB_FILE)
554 dnl not used outside of configure
555 dnl AC_SUBST(ITCL_LIBS)
556 dnl not used, don't export to save symbols
557 dnl AC_SUBST(ITCL_PREFIX)
559 dnl not used, don't export to save symbols
560 dnl AC_SUBST(ITCL_EXEC_PREFIX)
562 AC_SUBST(ITCL_BUILD_INCLUDES)
563 AC_SUBST(ITCL_BUILD_LIB_SPEC)
564 AC_SUBST(ITCL_LIB_SPEC)
567 # check for Itcl headers.
569 AC_DEFUN([CY_AC_PATH_ITCLH], [
570 AC_MSG_CHECKING(for Itcl private headers. srcdir=${srcdir})
571 if test x"${ac_cv_c_itclh}" = x ; then
572 for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
573 if test -f $i/generic/itcl.h ; then
574 ac_cv_c_itclh=`(cd $i/generic; pwd)`
579 if test x"${ac_cv_c_itclh}" = x ; then
580 ITCLHDIR="# no Itcl private headers found"
581 AC_MSG_ERROR([Can't find Itcl private headers])
583 if test x"${ac_cv_c_itclh}" != x ; then
584 ITCLHDIR="-I${ac_cv_c_itclh}"
586 # should always be here
587 # ITCLLIB="../itcl/itcl/unix/libitcl.a"
593 AC_DEFUN([CY_AC_PATH_ITKCONFIG], [
595 # Ok, lets find the itk configuration
596 # First, look for one uninstalled.
597 # the alternative search directory is invoked by --with-itkconfig
600 if test x"${no_itk}" = x ; then
601 # we reset no_itk in case something fails here
603 AC_ARG_WITH(itkconfig, [ --with-itkconfig Directory containing itk configuration (itkConfig.sh)],
604 with_itkconfig=${withval})
605 AC_MSG_CHECKING([for Itk configuration])
606 AC_CACHE_VAL(ac_cv_c_itkconfig,[
608 # First check to see if --with-itkconfig was specified.
609 if test x"${with_itkconfig}" != x ; then
610 if test -f "${with_itkconfig}/itkConfig.sh" ; then
611 ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
613 AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
617 # then check for a private Itk library
618 if test x"${ac_cv_c_itkconfig}" = x ; then
621 `ls -dr ../itcl[[4-9]]*/itk 2>/dev/null` \
623 `ls -dr ../../itcl[[4-9]]*/itk 2>/dev/null` \
625 `ls -dr ../../../itcl[[4-9]]*/itk 2>/dev/null` ; do
626 if test -f "$i/itkConfig.sh" ; then
627 ac_cv_c_itkconfig=`(cd $i; pwd)`
632 # check in a few common install locations
633 if test x"${ac_cv_c_itkconfig}" = x ; then
634 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
635 if test -f "$i/itkConfig.sh" ; then
636 ac_cv_c_itkconfig=`(cd $i; pwd)`
641 # check in a few other private locations
642 if test x"${ac_cv_c_itkconfig}" = x ; then
644 ${srcdir}/../itcl/itk \
645 `ls -dr ${srcdir}/../itcl[[4-9]]*/itk 2>/dev/null` ; do
646 if test -f "$i/itkConfig.sh" ; then
647 ac_cv_c_itkconfig=`(cd $i; pwd)`
653 if test x"${ac_cv_c_itkconfig}" = x ; then
654 ITKCONFIG="# no Itk configs found"
655 AC_MSG_WARN(Can't find Itk configuration definitions)
658 ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
659 AC_MSG_RESULT(found $ITKCONFIG)
665 # Defined as a separate macro so we don't have to cache the values
666 # from PATH_ITKCONFIG (because this can also be cached).
667 AC_DEFUN([CY_AC_LOAD_ITKCONFIG], [
668 if test -f "$ITKCONFIG" ; then
672 AC_SUBST(ITK_VERSION)
673 dnl not actually used, don't export to save symbols
674 dnl AC_SUBST(ITK_MAJOR_VERSION)
675 dnl AC_SUBST(ITK_MINOR_VERSION)
678 dnl not used, don't export to save symbols
679 dnl AC_SUBST(ITK_LIB_FILE)
681 dnl not used outside of configure
682 dnl AC_SUBST(ITK_LIBS)
683 dnl not used, don't export to save symbols
684 dnl AC_SUBST(ITK_PREFIX)
686 dnl not used, don't export to save symbols
687 dnl AC_SUBST(ITK_EXEC_PREFIX)
689 AC_SUBST(ITK_BUILD_INCLUDES)
690 AC_SUBST(ITK_BUILD_LIB_SPEC)
691 AC_SUBST(ITK_LIB_SPEC)
694 AC_DEFUN([CY_AC_PATH_ITKH], [
695 AC_MSG_CHECKING(for Itk private headers. srcdir=${srcdir})
696 if test x"${ac_cv_c_itkh}" = x ; then
697 for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
698 if test -f $i/generic/itk.h ; then
699 ac_cv_c_itkh=`(cd $i/generic; pwd)`
704 if test x"${ac_cv_c_itkh}" = x ; then
705 ITKHDIR="# no Itk private headers found"
706 AC_MSG_ERROR([Can't find Itk private headers])
708 if test x"${ac_cv_c_itkh}" != x ; then
709 ITKHDIR="-I${ac_cv_c_itkh}"
711 # should always be here
712 # ITKLIB="../itcl/itk/unix/libitk.a"
718 ## ----------------------------------------- ##
719 ## ANSIfy the C compiler whenever possible. ##
720 ## From Franc,ois Pinard ##
721 ## ----------------------------------------- ##
723 # Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
725 # This program is free software; you can redistribute it and/or modify
726 # it under the terms of the GNU General Public License as published by
727 # the Free Software Foundation; either version 2, or (at your option)
730 # This program is distributed in the hope that it will be useful,
731 # but WITHOUT ANY WARRANTY; without even the implied warranty of
732 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
733 # GNU General Public License for more details.
735 # You should have received a copy of the GNU General Public License
736 # along with this program; if not, write to the Free Software
737 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
738 # Boston, MA 02110-1301, USA.
742 # @defmac AC_PROG_CC_STDC
743 # @maindex PROG_CC_STDC
745 # If the C compiler in not in ANSI C mode by default, try to add an option
746 # to output variable @code{CC} to make it so. This macro tries various
747 # options that select ANSI C on some system or another. It considers the
748 # compiler to be in ANSI C mode if it handles function prototypes correctly.
750 # If you use this macro, you should check after calling it whether the C
751 # compiler has been set to accept ANSI C; if not, the shell variable
752 # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
753 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
754 # program @code{ansi2knr}, which comes with Ghostscript.
757 AC_DEFUN([AM_PROG_CC_STDC],
758 [AC_REQUIRE([AC_PROG_CC])
759 AC_BEFORE([$0], [AC_C_INLINE])
760 AC_BEFORE([$0], [AC_C_CONST])
761 dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
762 dnl a magic option to avoid problems with ANSI preprocessor commands
764 dnl FIXME: can't do this because then AC_AIX won't work due to a
765 dnl circular dependency.
766 dnl AC_BEFORE([$0], [AC_PROG_CPP])
767 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
768 AC_CACHE_VAL(am_cv_prog_cc_stdc,
769 [am_cv_prog_cc_stdc=no
771 # Don't try gcc -ansi; that turns off useful extensions and
772 # breaks some systems' header files.
774 # Ultrix and OSF/1 -std1
775 # HP-UX 10.20 and later -Ae
776 # HP-UX older versions -Aa -D_HPUX_SOURCE
777 # SVR4 -Xc -D__EXTENSIONS__
778 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
780 CC="$ac_save_CC $ac_arg"
784 #include <sys/types.h>
785 #include <sys/stat.h>
786 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
787 struct buf { int x; };
788 FILE * (*rcsopen) (struct buf *, struct stat *, int);
789 static char *e (p, i)
795 static char *f (char * (*g) (char **, int), char **p, ...)
800 s = g (p, va_arg (v,int));
804 int test (int i, double x);
805 struct s1 {int (*f) (int a);};
806 struct s2 {int (*f) (double a);};
807 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
811 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
813 [am_cv_prog_cc_stdc="$ac_arg"; break])
817 if test -z "$am_cv_prog_cc_stdc"; then
818 AC_MSG_RESULT([none needed])
820 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
822 case "x$am_cv_prog_cc_stdc" in
824 *) CC="$CC $am_cv_prog_cc_stdc" ;;
828 dnl From Bruno Haible.
832 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
833 dnl those with the standalone portable GNU libiconv installed).
835 AC_ARG_WITH([libiconv-prefix],
836 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
837 for dir in `echo "$withval" | tr : ' '`; do
838 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
839 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
843 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
844 am_cv_func_iconv="no, consider installing GNU libiconv"
846 AC_TRY_LINK([#include <stdlib.h>
848 [iconv_t cd = iconv_open("","");
849 iconv(cd,NULL,NULL,NULL,NULL);
851 am_cv_func_iconv=yes)
852 if test "$am_cv_func_iconv" != yes; then
855 AC_TRY_LINK([#include <stdlib.h>
857 [iconv_t cd = iconv_open("","");
858 iconv(cd,NULL,NULL,NULL,NULL);
861 am_cv_func_iconv=yes)
865 if test "$am_cv_func_iconv" = yes; then
866 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
867 AC_MSG_CHECKING([for iconv declaration])
868 AC_CACHE_VAL(am_cv_proto_iconv, [
876 #if defined(__STDC__) || defined(__cplusplus)
877 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
881 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
882 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);"])
883 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
884 AC_MSG_RESULT([$]{ac_t:-
885 }[$]am_cv_proto_iconv)
886 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
887 [Define as const if the declaration of iconv() needs const.])
890 if test "$am_cv_lib_iconv" = yes; then
896 dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva
897 dnl Version 1.3 (2001/03/02)
898 dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html
900 AC_DEFUN([AC_DEFINE_DIR], [
901 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
902 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
903 ac_define_dir=`eval echo [$]$2`
904 ac_define_dir=`eval echo [$]ac_define_dir`
906 AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
907 AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
910 dnl See whether we need a declaration for a function.
911 dnl The result is highly dependent on the INCLUDES passed in, so make sure
912 dnl to use a different cache variable name in this macro if it is invoked
913 dnl in a different context somewhere else.
914 dnl gcc_AC_CHECK_DECL(SYMBOL,
915 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
916 AC_DEFUN([gcc_AC_CHECK_DECL],
917 [AC_MSG_CHECKING([whether $1 is declared])
918 AC_CACHE_VAL(gcc_cv_have_decl_$1,
919 [AC_TRY_COMPILE([$4],
921 char *(*pfn) = (char *(*)) $1 ;
922 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
923 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
924 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
926 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
930 dnl Check multiple functions to see whether each needs a declaration.
931 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
932 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
933 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
934 AC_DEFUN([gcc_AC_CHECK_DECLS],
938 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
940 gcc_AC_CHECK_DECL($ac_func,
941 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
942 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
943 dnl It is possible that the include files passed in here are local headers
944 dnl which supply a backup declaration for the relevant prototype based on
945 dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
946 dnl will always return success. E.g. see libiberty.h's handling of
947 dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
948 dnl 1 so that any local headers used do not provide their own prototype
949 dnl during this test.
951 #define $ac_tr_decl 1
955 dnl Automatically generate config.h entries via autoheader.
957 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
958 [AC_DEFINE([HAVE_DECL_\&], 1,
959 [Define to 1 if we found this declaration otherwise define to 0.])])dnl