2002-11-26 Martin M. Hunt <hunt@redhat.com>
[external/binutils.git] / gdb / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
14 dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
15
16 dnl gdb/configure.in uses BFD_NEED_DECLARATION, so get its definition.
17 sinclude(../bfd/acinclude.m4)
18
19 dnl This gets the standard macros, like the TCL, TK, etc ones.
20 sinclude(../config/acinclude.m4)
21
22 dnl CYGNUS LOCAL: This gets the right posix flag for gcc
23 AC_DEFUN(CY_AC_TCL_LYNX_POSIX,
24 [AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
25 AC_MSG_CHECKING([if running LynxOS])
26 AC_CACHE_VAL(ac_cv_os_lynx,
27 [AC_EGREP_CPP(yes,
28 [/*
29  * The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
30  */
31 #if defined(__Lynx__) || defined(Lynx)
32 yes
33 #endif
34 ], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
35 #
36 if test "$ac_cv_os_lynx" = "yes" ; then
37   AC_MSG_RESULT(yes)
38   AC_DEFINE(LYNX)
39   AC_MSG_CHECKING([whether -mposix or -X is available])
40   AC_CACHE_VAL(ac_cv_c_posix_flag,
41   [AC_TRY_COMPILE(,[
42   /*
43    * This flag varies depending on how old the compiler is.
44    * -X is for the old "cc" and "gcc" (based on 1.42).
45    * -mposix is for the new gcc (at least 2.5.8).
46    */
47   #if defined(__GNUC__) && __GNUC__ >= 2
48   choke me
49   #endif
50   ], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
51   CC="$CC $ac_cv_c_posix_flag"
52   AC_MSG_RESULT($ac_cv_c_posix_flag)
53   else
54   AC_MSG_RESULT(no)
55 fi
56 ])
57
58 #
59 # Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
60 # makes configure think it's cross compiling. If --target wasn't used, then
61 # we can't configure, so something is wrong. We don't use the cache
62 # here cause if somebody fixes their compiler install, we want this to work.
63 AC_DEFUN(CY_AC_C_WORKS,
64 [# If we cannot compile and link a trivial program, we can't expect anything to work
65 AC_MSG_CHECKING(whether the compiler ($CC) actually works)
66 AC_TRY_COMPILE(, [/* don't need anything here */],
67         c_compiles=yes, c_compiles=no)
68
69 AC_TRY_LINK(, [/* don't need anything here */],
70         c_links=yes, c_links=no)
71
72 if test x"${c_compiles}" = x"no" ; then
73   AC_MSG_ERROR(the native compiler is broken and won't compile.)
74 fi
75
76 if test x"${c_links}" = x"no" ; then
77   AC_MSG_ERROR(the native compiler is broken and won't link.)
78 fi
79 AC_MSG_RESULT(yes)
80 ])
81
82 AC_DEFUN(CY_AC_PATH_TCLH, [
83 #
84 # Ok, lets find the tcl source trees so we can use the headers
85 # Warning: transition of version 9 to 10 will break this algorithm
86 # because 10 sorts before 9. We also look for just tcl. We have to
87 # be careful that we don't match stuff like tclX by accident.
88 # the alternative search directory is involked by --with-tclinclude
89 #
90
91 no_tcl=true
92 AC_MSG_CHECKING(for Tcl private headers. dir=${configdir})
93 AC_ARG_WITH(tclinclude, [  --with-tclinclude=DIR   Directory where tcl private headers are], with_tclinclude=${withval})
94 AC_CACHE_VAL(ac_cv_c_tclh,[
95 # first check to see if --with-tclinclude was specified
96 if test x"${with_tclinclude}" != x ; then
97   if test -f ${with_tclinclude}/tclInt.h ; then
98     ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
99   elif test -f ${with_tclinclude}/generic/tclInt.h ; then
100     ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
101   else
102     AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
103   fi
104 fi
105
106 # next check if it came with Tcl configuration file
107 if test x"${ac_cv_c_tclconfig}" = x ; then
108   if test -f $ac_cv_c_tclconfig/../generic/tclInt.h ; then
109     ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/..; pwd)`
110   fi
111 fi
112
113 # next check in private source directory
114 #
115 # since ls returns lowest version numbers first, reverse its output
116 if test x"${ac_cv_c_tclh}" = x ; then
117   for i in \
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` \
122                 ${srcdir}/../../../tcl \
123                 `ls -dr ${srcdir}/../../../tcl[[7-9]]* 2>/dev/null ` ; do
124     if test -f $i/generic/tclInt.h ; then
125       ac_cv_c_tclh=`(cd $i/generic; pwd)`
126       break
127     fi
128   done
129 fi
130 # finally check in a few common install locations
131 #
132 # since ls returns lowest version numbers first, reverse its output
133 if test x"${ac_cv_c_tclh}" = x ; then
134   for i in \
135                 `ls -dr /usr/local/src/tcl[[7-9]]* 2>/dev/null` \
136                 `ls -dr /usr/local/lib/tcl[[7-9]]* 2>/dev/null` \
137                 /usr/local/src/tcl \
138                 /usr/local/lib/tcl \
139                 ${prefix}/include ; do
140     if test -f $i/generic/tclInt.h ; then
141       ac_cv_c_tclh=`(cd $i/generic; pwd)`
142       break
143     fi
144   done
145 fi
146 # see if one is installed
147 if test x"${ac_cv_c_tclh}" = x ; then
148    AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
149 fi
150 ])
151 if test x"${ac_cv_c_tclh}" = x ; then
152   TCLHDIR="# no Tcl private headers found"
153   AC_MSG_ERROR([Can't find Tcl private headers])
154 fi
155 if test x"${ac_cv_c_tclh}" != x ; then
156   no_tcl=""
157   if test x"${ac_cv_c_tclh}" = x"installed" ; then
158     AC_MSG_RESULT([is installed])
159     TCLHDIR=""
160   else
161     AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
162     # this hack is cause the TCLHDIR won't print if there is a "-I" in it.
163     TCLHDIR="-I${ac_cv_c_tclh}"
164   fi
165 fi
166
167 AC_SUBST(TCLHDIR)
168 ])
169
170
171 AC_DEFUN(CY_AC_PATH_TCLCONFIG, [
172 #
173 # Ok, lets find the tcl configuration
174 # First, look for one uninstalled.  
175 # the alternative search directory is invoked by --with-tclconfig
176 #
177
178 if test x"${no_tcl}" = x ; then
179   # we reset no_tcl in case something fails here
180   no_tcl=true
181   AC_ARG_WITH(tclconfig, [  --with-tclconfig=DIR    Directory containing tcl configuration (tclConfig.sh)],
182          with_tclconfig=${withval})
183   AC_MSG_CHECKING([for Tcl configuration])
184   AC_CACHE_VAL(ac_cv_c_tclconfig,[
185
186   # First check to see if --with-tclconfig was specified.
187   if test x"${with_tclconfig}" != x ; then
188     if test -f "${with_tclconfig}/tclConfig.sh" ; then
189       ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
190     else
191       AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
192     fi
193   fi
194
195   # then check for a private Tcl installation
196   if test x"${ac_cv_c_tclconfig}" = x ; then
197     for i in \
198                 ../tcl \
199                 `ls -dr ../tcl[[7-9]]* 2>/dev/null` \
200                 ../../tcl \
201                 `ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
202                 ../../../tcl \
203                 `ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
204       if test -f "$i/${configdir}/tclConfig.sh" ; then
205         ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
206         break
207       fi
208     done
209   fi
210   # check in a few common install locations
211   if test x"${ac_cv_c_tclconfig}" = x ; then
212     for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
213       if test -f "$i/tclConfig.sh" ; then
214         ac_cv_c_tclconfig=`(cd $i; pwd)`
215         break
216       fi
217     done
218   fi
219   # check in a few other private locations
220   if test x"${ac_cv_c_tclconfig}" = x ; then
221     for i in \
222                 ${srcdir}/../tcl \
223                 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
224       if test -f "$i/${configdir}/tclConfig.sh" ; then
225         ac_cv_c_tclconfig=`(cd $i/${configdir}; pwd)`
226         break
227       fi
228     done
229   fi
230   ])
231   if test x"${ac_cv_c_tclconfig}" = x ; then
232     TCLCONFIG="# no Tcl configs found"
233     AC_MSG_WARN(Can't find Tcl configuration definitions)
234   else
235     no_tcl=
236     TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
237     AC_MSG_RESULT(found $TCLCONFIG)
238   fi
239 fi
240 ])
241
242 # Defined as a separate macro so we don't have to cache the values
243 # from PATH_TCLCONFIG (because this can also be cached).
244 AC_DEFUN(CY_AC_LOAD_TCLCONFIG, [
245     . $TCLCONFIG
246
247     AC_SUBST(TCL_VERSION)
248     AC_SUBST(TCL_MAJOR_VERSION)
249     AC_SUBST(TCL_MINOR_VERSION)
250     AC_SUBST(TCL_CC)
251     AC_SUBST(TCL_DEFS)
252
253 dnl not used, don't export to save symbols
254 dnl    AC_SUBST(TCL_LIB_FILE)
255
256 dnl don't export, not used outside of configure
257 dnl     AC_SUBST(TCL_LIBS)
258 dnl not used, don't export to save symbols
259 dnl    AC_SUBST(TCL_PREFIX)
260
261 dnl not used, don't export to save symbols
262 dnl    AC_SUBST(TCL_EXEC_PREFIX)
263
264     AC_SUBST(TCL_SHLIB_CFLAGS)
265     AC_SUBST(TCL_SHLIB_LD)
266 dnl don't export, not used outside of configure
267     AC_SUBST(TCL_SHLIB_LD_LIBS)
268     AC_SUBST(TCL_SHLIB_SUFFIX)
269 dnl not used, don't export to save symbols
270     AC_SUBST(TCL_DL_LIBS)
271     AC_SUBST(TCL_LD_FLAGS)
272 dnl don't export, not used outside of configure
273     AC_SUBST(TCL_LD_SEARCH_FLAGS)
274     AC_SUBST(TCL_COMPAT_OBJS)
275     AC_SUBST(TCL_RANLIB)
276     AC_SUBST(TCL_BUILD_LIB_SPEC)
277     AC_SUBST(TCL_LIB_SPEC)
278     AC_SUBST(TCL_LIB_VERSIONS_OK)
279
280 dnl not used, don't export to save symbols
281 dnl    AC_SUBST(TCL_SHARED_LIB_SUFFIX)
282
283 dnl not used, don't export to save symbols
284 dnl    AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
285 ])
286
287 # Warning: Tk definitions are very similar to Tcl definitions but
288 # are not precisely the same.  There are a couple of differences,
289 # so don't do changes to Tcl thinking you can cut and paste it do 
290 # the Tk differences and later simply substitute "Tk" for "Tcl".
291 # Known differences:
292 #  - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
293 #  - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
294 #  - Computing major/minor versions is different because Tk depends on
295 #    headers to Tcl, Tk, and X.
296 #  - Symbols in tkConfig.sh are different than tclConfig.sh
297 #  - Acceptable for Tk to be missing but not Tcl.
298
299 AC_DEFUN(CY_AC_PATH_TKH, [
300 #
301 # Ok, lets find the tk source trees so we can use the headers
302 # If the directory (presumably symlink) named "tk" exists, use that one
303 # in preference to any others.  Same logic is used when choosing library
304 # and again with Tcl. The search order is the best place to look first, then in
305 # decreasing significance. The loop breaks if the trigger file is found.
306 # Note the gross little conversion here of srcdir by cd'ing to the found
307 # directory. This converts the path from a relative to an absolute, so
308 # recursive cache variables for the path will work right. We check all
309 # the possible paths in one loop rather than many seperate loops to speed
310 # things up.
311 # the alternative search directory is involked by --with-tkinclude
312 #
313 no_tk=true
314 AC_MSG_CHECKING(for Tk private headers)
315 AC_ARG_WITH(tkinclude, [  --with-tkinclude=DIR    Directory where tk private headers are], with_tkinclude=${withval})
316 AC_CACHE_VAL(ac_cv_c_tkh,[
317 # first check to see if --with-tkinclude was specified
318 if test x"${with_tkinclude}" != x ; then
319   if test -f ${with_tkinclude}/tk.h ; then
320     ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
321   elif test -f ${with_tkinclude}/generic/tk.h ; then
322     ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
323   else
324     AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
325   fi
326 fi
327
328 # next check if it came with Tk configuration file
329 if test x"${ac_cv_c_tkconfig}" = x ; then
330   if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
331     ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
332   fi
333 fi
334
335 # next check in private source directory
336 #
337 # since ls returns lowest version numbers first, reverse its output
338 if test x"${ac_cv_c_tkh}" = x ; then
339   for i in \
340                 ${srcdir}/../tk \
341                 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
342                 ${srcdir}/../../tk \
343                 `ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
344                 ${srcdir}/../../../tk \
345                 `ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
346     if test -f $i/generic/tk.h ; then
347       ac_cv_c_tkh=`(cd $i/generic; pwd)`
348       break
349     fi
350   done
351 fi
352 # finally check in a few common install locations
353 #
354 # since ls returns lowest version numbers first, reverse its output
355 if test x"${ac_cv_c_tkh}" = x ; then
356   for i in \
357                 `ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
358                 `ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
359                 /usr/local/src/tk \
360                 /usr/local/lib/tk \
361                 ${prefix}/include ; do
362     if test -f $i/generic/tk.h ; then
363       ac_cv_c_tkh=`(cd $i/generic; pwd)`
364       break
365     fi
366   done
367 fi
368 # see if one is installed
369 if test x"${ac_cv_c_tkh}" = x ; then
370    AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
371 fi
372 ])
373 if test x"${ac_cv_c_tkh}" != x ; then
374   no_tk=""
375   if test x"${ac_cv_c_tkh}" = x"installed" ; then
376     AC_MSG_RESULT([is installed])
377     TKHDIR=""
378   else
379     AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
380     # this hack is cause the TKHDIR won't print if there is a "-I" in it.
381     TKHDIR="-I${ac_cv_c_tkh}"
382   fi
383 else
384   TKHDIR="# no Tk directory found"
385   AC_MSG_WARN([Can't find Tk private headers])
386   no_tk=true
387 fi
388
389 AC_SUBST(TKHDIR)
390 ])
391
392
393 AC_DEFUN(CY_AC_PATH_TKCONFIG, [
394 #
395 # Ok, lets find the tk configuration
396 # First, look for one uninstalled.  
397 # the alternative search directory is invoked by --with-tkconfig
398 #
399
400 if test x"${no_tk}" = x ; then
401   # we reset no_tk in case something fails here
402   no_tk=true
403   AC_ARG_WITH(tkconfig, [  --with-tkconfig=DIR     Directory containing tk configuration (tkConfig.sh)],
404          with_tkconfig=${withval})
405   AC_MSG_CHECKING([for Tk configuration])
406   AC_CACHE_VAL(ac_cv_c_tkconfig,[
407
408   # First check to see if --with-tkconfig was specified.
409   if test x"${with_tkconfig}" != x ; then
410     if test -f "${with_tkconfig}/tkConfig.sh" ; then
411       ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
412     else
413       AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
414     fi
415   fi
416
417   # then check for a private Tk library
418   if test x"${ac_cv_c_tkconfig}" = x ; then
419     for i in \
420                 ../tk \
421                 `ls -dr ../tk[[4-9]]* 2>/dev/null` \
422                 ../../tk \
423                 `ls -dr ../../tk[[4-9]]* 2>/dev/null` \
424                 ../../../tk \
425                 `ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
426       if test -f "$i/${configdir}/tkConfig.sh" ; then
427         ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
428         break
429       fi
430     done
431   fi
432   # check in a few common install locations
433   if test x"${ac_cv_c_tkconfig}" = x ; then
434     for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
435       if test -f "$i/tkConfig.sh" ; then
436         ac_cv_c_tkconfig=`(cd $i; pwd)`
437         break
438       fi
439     done
440   fi
441   # check in a few other private locations
442   if test x"${ac_cv_c_tkconfig}" = x ; then
443     for i in \
444                 ${srcdir}/../tk \
445                 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
446       if test -f "$i/${configdir}/tkConfig.sh" ; then
447         ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
448         break
449       fi
450     done
451   fi
452   ])
453   if test x"${ac_cv_c_tkconfig}" = x ; then
454     TKCONFIG="# no Tk configs found"
455     AC_MSG_WARN(Can't find Tk configuration definitions)
456   else
457     no_tk=
458     TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
459     AC_MSG_RESULT(found $TKCONFIG)
460   fi
461 fi
462
463 ])
464
465 # Defined as a separate macro so we don't have to cache the values
466 # from PATH_TKCONFIG (because this can also be cached).
467 AC_DEFUN(CY_AC_LOAD_TKCONFIG, [
468     if test -f "$TKCONFIG" ; then
469       . $TKCONFIG
470     fi
471
472     AC_SUBST(TK_VERSION)
473 dnl not actually used, don't export to save symbols
474 dnl    AC_SUBST(TK_MAJOR_VERSION)
475 dnl    AC_SUBST(TK_MINOR_VERSION)
476     AC_SUBST(TK_DEFS)
477
478 dnl not used, don't export to save symbols
479     dnl AC_SUBST(TK_LIB_FILE)
480
481 dnl not used outside of configure
482 dnl    AC_SUBST(TK_LIBS)
483 dnl not used, don't export to save symbols
484 dnl    AC_SUBST(TK_PREFIX)
485
486 dnl not used, don't export to save symbols
487 dnl    AC_SUBST(TK_EXEC_PREFIX)
488
489     AC_SUBST(TK_BUILD_INCLUDES)
490     AC_SUBST(TK_XINCLUDES)
491     AC_SUBST(TK_XLIBSW)
492     AC_SUBST(TK_BUILD_LIB_SPEC)
493     AC_SUBST(TK_LIB_SPEC)
494 ])
495
496 # check for Itcl headers. 
497
498 AC_DEFUN(CY_AC_PATH_ITCLCONFIG, [
499 #
500 # Ok, lets find the itcl configuration
501 # First, look for one uninstalled.  
502 # the alternative search directory is invoked by --with-itclconfig
503 #
504
505 if test x"${no_itcl}" = x ; then
506   # we reset no_itcl in case something fails here
507   no_itcl=true
508   AC_ARG_WITH(itclconfig, [  --with-itclconfig       Directory containing itcl configuration (itclConfig.sh)],
509          with_itclconfig=${withval})
510   AC_MSG_CHECKING([for Itcl configuration])
511   AC_CACHE_VAL(ac_cv_c_itclconfig,[
512
513   # First check to see if --with-itclconfig was specified.
514   if test x"${with_itclconfig}" != x ; then
515     if test -f "${with_itclconfig}/itclConfig.sh" ; then
516       ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
517     else
518       AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
519     fi
520   fi
521
522   # then check for a private Itcl library
523   if test x"${ac_cv_c_itclconfig}" = x ; then
524     for i in \
525                 ../itcl/itcl \
526                 `ls -dr ../itcl[[4-9]]*/itcl 2>/dev/null` \
527                 ../../itcl \
528                 `ls -dr ../../itcl[[4-9]]*/itcl 2>/dev/null` \
529                 ../../../itcl \
530                 `ls -dr ../../../itcl[[4-9]]*/itcl 2>/dev/null` ; do
531       if test -f "$i/itclConfig.sh" ; then
532         ac_cv_c_itclconfig=`(cd $i; pwd)`
533         break
534       fi
535     done
536   fi
537   # check in a few common install locations
538   if test x"${ac_cv_c_itclconfig}" = x ; then
539     for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
540       if test -f "$i/itclConfig.sh" ; then
541         ac_cv_c_itclconfig=`(cd $i; pwd)`
542         break
543       fi
544     done
545   fi
546   # check in a few other private locations
547   if test x"${ac_cv_c_itclconfig}" = x ; then
548     for i in \
549                 ${srcdir}/../itcl/itcl \
550                 `ls -dr ${srcdir}/../itcl[[4-9]]*/itcl 2>/dev/null` ; do
551       if test -f "$i/itclConfig.sh" ; then
552         ac_cv_c_itclconfig=`(cd $i; pwd)`
553         break
554       fi
555     done
556   fi
557   ])
558   if test x"${ac_cv_c_itclconfig}" = x ; then
559     ITCLCONFIG="# no Itcl configs found"
560     AC_MSG_WARN(Can't find Itcl configuration definitions)
561   else
562     no_itcl=
563     ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
564     AC_MSG_RESULT(found $ITCLCONFIG)
565   fi
566 fi
567 ])
568
569 # Defined as a separate macro so we don't have to cache the values
570 # from PATH_ITCLCONFIG (because this can also be cached).
571 AC_DEFUN(CY_AC_LOAD_ITCLCONFIG, [
572     if test -f "$ITCLCONFIG" ; then
573       . $ITCLCONFIG
574     fi
575
576     AC_SUBST(ITCL_VERSION)
577 dnl not actually used, don't export to save symbols
578 dnl    AC_SUBST(ITCL_MAJOR_VERSION)
579 dnl    AC_SUBST(ITCL_MINOR_VERSION)
580     AC_SUBST(ITCL_DEFS)
581
582 dnl not used, don't export to save symbols
583     dnl AC_SUBST(ITCL_LIB_FILE)
584
585 dnl not used outside of configure
586 dnl    AC_SUBST(ITCL_LIBS)
587 dnl not used, don't export to save symbols
588 dnl    AC_SUBST(ITCL_PREFIX)
589
590 dnl not used, don't export to save symbols
591 dnl    AC_SUBST(ITCL_EXEC_PREFIX)
592
593     AC_SUBST(ITCL_BUILD_INCLUDES)
594     AC_SUBST(ITCL_BUILD_LIB_SPEC)
595     AC_SUBST(ITCL_LIB_SPEC)
596 ])
597
598 # check for Itcl headers. 
599
600 AC_DEFUN(CY_AC_PATH_ITCLH, [
601 AC_MSG_CHECKING(for Itcl private headers. srcdir=${srcdir})
602 if test x"${ac_cv_c_itclh}" = x ; then
603   for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
604     if test -f $i/generic/itcl.h ; then
605       ac_cv_c_itclh=`(cd $i/generic; pwd)`
606       break
607     fi
608   done
609 fi
610 if test x"${ac_cv_c_itclh}" = x ; then
611   ITCLHDIR="# no Itcl private headers found"
612   AC_MSG_ERROR([Can't find Itcl private headers])
613 fi
614 if test x"${ac_cv_c_itclh}" != x ; then
615      ITCLHDIR="-I${ac_cv_c_itclh}"
616 fi
617 # should always be here
618 #     ITCLLIB="../itcl/itcl/unix/libitcl.a"
619 AC_SUBST(ITCLHDIR)
620 #AC_SUBST(ITCLLIB)
621 ])
622
623
624 AC_DEFUN(CY_AC_PATH_ITKCONFIG, [
625 #
626 # Ok, lets find the itk configuration
627 # First, look for one uninstalled.  
628 # the alternative search directory is invoked by --with-itkconfig
629 #
630
631 if test x"${no_itk}" = x ; then
632   # we reset no_itk in case something fails here
633   no_itk=true
634   AC_ARG_WITH(itkconfig, [  --with-itkconfig        Directory containing itk configuration (itkConfig.sh)],
635          with_itkconfig=${withval})
636   AC_MSG_CHECKING([for Itk configuration])
637   AC_CACHE_VAL(ac_cv_c_itkconfig,[
638
639   # First check to see if --with-itkconfig was specified.
640   if test x"${with_itkconfig}" != x ; then
641     if test -f "${with_itkconfig}/itkConfig.sh" ; then
642       ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
643     else
644       AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
645     fi
646   fi
647
648   # then check for a private Itk library
649   if test x"${ac_cv_c_itkconfig}" = x ; then
650     for i in \
651                 ../itcl/itk \
652                 `ls -dr ../itcl[[4-9]]*/itk 2>/dev/null` \
653                 ../../itk \
654                 `ls -dr ../../itcl[[4-9]]*/itk 2>/dev/null` \
655                 ../../../itk \
656                 `ls -dr ../../../itcl[[4-9]]*/itk 2>/dev/null` ; do
657       if test -f "$i/itkConfig.sh" ; then
658         ac_cv_c_itkconfig=`(cd $i; pwd)`
659         break
660       fi
661     done
662   fi
663   # check in a few common install locations
664   if test x"${ac_cv_c_itkconfig}" = x ; then
665     for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
666       if test -f "$i/itkConfig.sh" ; then
667         ac_cv_c_itkconfig=`(cd $i; pwd)`
668         break
669       fi
670     done
671   fi
672   # check in a few other private locations
673   if test x"${ac_cv_c_itkconfig}" = x ; then
674     for i in \
675                 ${srcdir}/../itcl/itk \
676                 `ls -dr ${srcdir}/../itcl[[4-9]]*/itk 2>/dev/null` ; do
677       if test -f "$i/itkConfig.sh" ; then
678         ac_cv_c_itkconfig=`(cd $i; pwd)`
679         break
680       fi
681     done
682   fi
683   ])
684   if test x"${ac_cv_c_itkconfig}" = x ; then
685     ITKCONFIG="# no Itk configs found"
686     AC_MSG_WARN(Can't find Itk configuration definitions)
687   else
688     no_itk=
689     ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
690     AC_MSG_RESULT(found $ITKCONFIG)
691   fi
692 fi
693
694 ])
695
696 # Defined as a separate macro so we don't have to cache the values
697 # from PATH_ITKCONFIG (because this can also be cached).
698 AC_DEFUN(CY_AC_LOAD_ITKCONFIG, [
699     if test -f "$ITKCONFIG" ; then
700       . $ITKCONFIG
701     fi
702
703     AC_SUBST(ITK_VERSION)
704 dnl not actually used, don't export to save symbols
705 dnl    AC_SUBST(ITK_MAJOR_VERSION)
706 dnl    AC_SUBST(ITK_MINOR_VERSION)
707     AC_SUBST(ITK_DEFS)
708
709 dnl not used, don't export to save symbols
710     dnl AC_SUBST(ITK_LIB_FILE)
711
712 dnl not used outside of configure
713 dnl    AC_SUBST(ITK_LIBS)
714 dnl not used, don't export to save symbols
715 dnl    AC_SUBST(ITK_PREFIX)
716
717 dnl not used, don't export to save symbols
718 dnl    AC_SUBST(ITK_EXEC_PREFIX)
719
720     AC_SUBST(ITK_BUILD_INCLUDES)
721     AC_SUBST(ITK_BUILD_LIB_SPEC)
722     AC_SUBST(ITK_LIB_SPEC)
723 ])
724
725 AC_DEFUN(CY_AC_PATH_ITKH, [
726 AC_MSG_CHECKING(for Itk private headers. srcdir=${srcdir})
727 if test x"${ac_cv_c_itkh}" = x ; then
728   for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
729     if test -f $i/generic/itk.h ; then
730       ac_cv_c_itkh=`(cd $i/generic; pwd)`
731       break
732     fi
733   done
734 fi
735 if test x"${ac_cv_c_itkh}" = x ; then
736   ITKHDIR="# no Itk private headers found"
737   AC_MSG_ERROR([Can't find Itk private headers])
738 fi
739 if test x"${ac_cv_c_itkh}" != x ; then
740      ITKHDIR="-I${ac_cv_c_itkh}"
741 fi
742 # should always be here
743 #     ITKLIB="../itcl/itk/unix/libitk.a"
744 AC_SUBST(ITKHDIR)
745 #AC_SUBST(ITKLIB)
746 ])
747
748
749 dnl sinclude(../gettext.m4) already included by bfd/acinclude.m4
750 dnl The lines below arrange for aclocal not to bring gettext.m4's
751 dnl CY_GNU_GETTEXT into aclocal.m4.
752 ifelse(yes,no,[
753 AC_DEFUN([CY_GNU_GETTEXT],)
754 ])
755
756 dnl From Bruno Haible.
757
758 AC_DEFUN([AM_ICONV],
759 [
760   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
761   dnl those with the standalone portable GNU libiconv installed).
762
763   AC_ARG_WITH([libiconv-prefix],
764 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
765     for dir in `echo "$withval" | tr : ' '`; do
766       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
767       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
768     done
769    ])
770
771   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
772     am_cv_func_iconv="no, consider installing GNU libiconv"
773     am_cv_lib_iconv=no
774     AC_TRY_LINK([#include <stdlib.h>
775 #include <iconv.h>],
776       [iconv_t cd = iconv_open("","");
777        iconv(cd,NULL,NULL,NULL,NULL);
778        iconv_close(cd);],
779       am_cv_func_iconv=yes)
780     if test "$am_cv_func_iconv" != yes; then
781       am_save_LIBS="$LIBS"
782       LIBS="$LIBS -liconv"
783       AC_TRY_LINK([#include <stdlib.h>
784 #include <iconv.h>],
785         [iconv_t cd = iconv_open("","");
786          iconv(cd,NULL,NULL,NULL,NULL);
787          iconv_close(cd);],
788         am_cv_lib_iconv=yes
789         am_cv_func_iconv=yes)
790       LIBS="$am_save_LIBS"
791     fi
792   ])
793   if test "$am_cv_func_iconv" = yes; then
794     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
795     AC_MSG_CHECKING([for iconv declaration])
796     AC_CACHE_VAL(am_cv_proto_iconv, [
797       AC_TRY_COMPILE([
798 #include <stdlib.h>
799 #include <iconv.h>
800 extern
801 #ifdef __cplusplus
802 "C"
803 #endif
804 #if defined(__STDC__) || defined(__cplusplus)
805 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
806 #else
807 size_t iconv();
808 #endif
809 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
810       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);"])
811     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
812     AC_MSG_RESULT([$]{ac_t:-
813          }[$]am_cv_proto_iconv)
814     AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
815       [Define as const if the declaration of iconv() needs const.])
816   fi
817   LIBICONV=
818   if test "$am_cv_lib_iconv" = yes; then
819     LIBICONV="-liconv"
820   fi
821   AC_SUBST(LIBICONV)
822 ])
823
824
825 # Copyright 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
826
827 # This program is free software; you can redistribute it and/or modify
828 # it under the terms of the GNU General Public License as published by
829 # the Free Software Foundation; either version 2, or (at your option)
830 # any later version.
831
832 # This program is distributed in the hope that it will be useful,
833 # but WITHOUT ANY WARRANTY; without even the implied warranty of
834 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
835 # GNU General Public License for more details.
836
837 # You should have received a copy of the GNU General Public License
838 # along with this program; if not, write to the Free Software
839 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
840 # 02111-1307, USA.
841
842 # serial 1
843
844 # @defmac AC_PROG_CC_STDC
845 # @maindex PROG_CC_STDC
846 # @ovindex CC
847 # If the C compiler in not in ANSI C mode by default, try to add an option
848 # to output variable @code{CC} to make it so.  This macro tries various
849 # options that select ANSI C on some system or another.  It considers the
850 # compiler to be in ANSI C mode if it handles function prototypes correctly.
851 #
852 # If you use this macro, you should check after calling it whether the C
853 # compiler has been set to accept ANSI C; if not, the shell variable
854 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
855 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
856 # program @code{ansi2knr}, which comes with Ghostscript.
857 # @end defmac
858
859 AC_DEFUN([AM_PROG_CC_STDC],
860 [AC_REQUIRE([AC_PROG_CC])
861 AC_BEFORE([$0], [AC_C_INLINE])
862 AC_BEFORE([$0], [AC_C_CONST])
863 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
864 dnl a magic option to avoid problems with ANSI preprocessor commands
865 dnl like #elif.
866 dnl FIXME: can't do this because then AC_AIX won't work due to a
867 dnl circular dependency.
868 dnl AC_BEFORE([$0], [AC_PROG_CPP])
869 AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
870 AC_CACHE_VAL(am_cv_prog_cc_stdc,
871 [am_cv_prog_cc_stdc=no
872 ac_save_CC="$CC"
873 # Don't try gcc -ansi; that turns off useful extensions and
874 # breaks some systems' header files.
875 # AIX                   -qlanglvl=ansi
876 # Ultrix and OSF/1      -std1
877 # HP-UX 10.20 and later -Ae
878 # HP-UX older versions  -Aa -D_HPUX_SOURCE
879 # SVR4                  -Xc -D__EXTENSIONS__
880 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
881 do
882   CC="$ac_save_CC $ac_arg"
883   AC_TRY_COMPILE(
884 [#include <stdarg.h>
885 #include <stdio.h>
886 #include <sys/types.h>
887 #include <sys/stat.h>
888 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
889 struct buf { int x; };
890 FILE * (*rcsopen) (struct buf *, struct stat *, int);
891 static char *e (p, i)
892      char **p;
893      int i;
894 {
895   return p[i];
896 }
897 static char *f (char * (*g) (char **, int), char **p, ...)
898 {
899   char *s;
900   va_list v;
901   va_start (v,p);
902   s = g (p, va_arg (v,int));
903   va_end (v);
904   return s;
905 }
906 int test (int i, double x);
907 struct s1 {int (*f) (int a);};
908 struct s2 {int (*f) (double a);};
909 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
910 int argc;
911 char **argv;
912 ], [
913 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
914 ],
915 [am_cv_prog_cc_stdc="$ac_arg"; break])
916 done
917 CC="$ac_save_CC"
918 ])
919 if test -z "$am_cv_prog_cc_stdc"; then
920   AC_MSG_RESULT([none needed])
921 else
922   AC_MSG_RESULT([$am_cv_prog_cc_stdc])
923 fi
924 case "x$am_cv_prog_cc_stdc" in
925   x|xno) ;;
926   *) CC="$CC $am_cv_prog_cc_stdc" ;;
927 esac
928 ])
929
930 # Add --enable-maintainer-mode option to configure.
931 # From Jim Meyering
932
933 # serial 1
934
935 AC_DEFUN(AM_MAINTAINER_MODE,
936 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
937   dnl maintainer-mode is disabled by default
938   AC_ARG_ENABLE(maintainer-mode,
939 [  --enable-maintainer-mode enable make rules and dependencies not useful
940                           (and sometimes confusing) to the casual installer],
941       USE_MAINTAINER_MODE=$enableval,
942       USE_MAINTAINER_MODE=no)
943   AC_MSG_RESULT($USE_MAINTAINER_MODE)
944   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
945   MAINT=$MAINTAINER_MODE_TRUE
946   AC_SUBST(MAINT)dnl
947 ]
948 )
949
950 # Define a conditional.
951
952 AC_DEFUN(AM_CONDITIONAL,
953 [AC_SUBST($1_TRUE)
954 AC_SUBST($1_FALSE)
955 if $2; then
956   $1_TRUE=
957   $1_FALSE='#'
958 else
959   $1_TRUE='#'
960   $1_FALSE=
961 fi])
962