1dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
14dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
15
16dnl gdb/configure.in uses BFD_NEED_DECLARATION, so get its definition.
17sinclude(../bfd/acinclude.m4)
18
19dnl This gets the standard macros, like the TCL, TK, etc ones.
20sinclude(../config/acinclude.m4)
21
22dnl CYGNUS LOCAL: This gets the right posix flag for gcc
23AC_DEFUN([CY_AC_TCL_LYNX_POSIX],
24[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
25AC_MSG_CHECKING([if running LynxOS])
26AC_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)
32yes
33#endif
34], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
35#
36if 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)
55fi
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.
63AC_DEFUN([CY_AC_C_WORKS],
64[# If we cannot compile and link a trivial program, we can't expect anything to work
65AC_MSG_CHECKING(whether the compiler ($CC) actually works)
66AC_TRY_COMPILE(, [/* don't need anything here */],
67        c_compiles=yes, c_compiles=no)
68
69AC_TRY_LINK(, [/* don't need anything here */],
70        c_links=yes, c_links=no)
71
72if test x"${c_compiles}" = x"no" ; then
73  AC_MSG_ERROR(the native compiler is broken and won't compile.)
74fi
75
76if test x"${c_links}" = x"no" ; then
77  AC_MSG_ERROR(the native compiler is broken and won't link.)
78fi
79AC_MSG_RESULT(yes)
80])
81
82AC_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
91no_tcl=true
92AC_MSG_CHECKING(for Tcl private headers. dir=${configdir})
93AC_ARG_WITH(tclinclude, [  --with-tclinclude=DIR   Directory where tcl private headers are], with_tclinclude=${withval})
94AC_CACHE_VAL(ac_cv_c_tclh,[
95# first check to see if --with-tclinclude was specified
96if 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
104fi
105
106# next check if it came with Tcl configuration file
107if 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
111fi
112
113# next check in private source directory
114#
115# since ls returns lowest version numbers first, reverse its output
116if 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
129fi
130# finally check in a few common install locations
131#
132# since ls returns lowest version numbers first, reverse its output
133if 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
145fi
146# see if one is installed
147if test x"${ac_cv_c_tclh}" = x ; then
148   AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
149fi
150])
151if 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])
154fi
155if 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
165fi
166
167AC_SUBST(TCLHDIR)
168])
169
170
171AC_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
178if 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
239fi
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).
244AC_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
253dnl not used, don't export to save symbols
254dnl    AC_SUBST(TCL_LIB_FILE)
255
256dnl don't export, not used outside of configure
257dnl     AC_SUBST(TCL_LIBS)
258dnl not used, don't export to save symbols
259dnl    AC_SUBST(TCL_PREFIX)
260
261dnl not used, don't export to save symbols
262dnl    AC_SUBST(TCL_EXEC_PREFIX)
263
264    AC_SUBST(TCL_SHLIB_CFLAGS)
265    AC_SUBST(TCL_SHLIB_LD)
266dnl don't export, not used outside of configure
267    AC_SUBST(TCL_SHLIB_LD_LIBS)
268    AC_SUBST(TCL_SHLIB_SUFFIX)
269dnl not used, don't export to save symbols
270    AC_SUBST(TCL_DL_LIBS)
271    AC_SUBST(TCL_LD_FLAGS)
272dnl don't export, not used outside of configure
273    AC_SUBST(TCL_LD_SEARCH_FLAGS)
274    AC_SUBST(TCL_CC_SEARCH_FLAGS)
275    AC_SUBST(TCL_COMPAT_OBJS)
276    AC_SUBST(TCL_RANLIB)
277    AC_SUBST(TCL_BUILD_LIB_SPEC)
278    AC_SUBST(TCL_LIB_SPEC)
279    AC_SUBST(TCL_LIB_VERSIONS_OK)
280
281dnl not used, don't export to save symbols
282dnl    AC_SUBST(TCL_SHARED_LIB_SUFFIX)
283
284dnl not used, don't export to save symbols
285dnl    AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
286])
287
288# Warning: Tk definitions are very similar to Tcl definitions but
289# are not precisely the same.  There are a couple of differences,
290# so don't do changes to Tcl thinking you can cut and paste it do
291# the Tk differences and later simply substitute "Tk" for "Tcl".
292# Known differences:
293#  - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
294#  - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
295#  - Computing major/minor versions is different because Tk depends on
296#    headers to Tcl, Tk, and X.
297#  - Symbols in tkConfig.sh are different than tclConfig.sh
298#  - Acceptable for Tk to be missing but not Tcl.
299
300AC_DEFUN([CY_AC_PATH_TKH], [
301#
302# Ok, lets find the tk source trees so we can use the headers
303# If the directory (presumably symlink) named "tk" exists, use that one
304# in preference to any others.  Same logic is used when choosing library
305# and again with Tcl. The search order is the best place to look first, then in
306# decreasing significance. The loop breaks if the trigger file is found.
307# Note the gross little conversion here of srcdir by cd'ing to the found
308# directory. This converts the path from a relative to an absolute, so
309# recursive cache variables for the path will work right. We check all
310# the possible paths in one loop rather than many seperate loops to speed
311# things up.
312# the alternative search directory is involked by --with-tkinclude
313#
314no_tk=true
315AC_MSG_CHECKING(for Tk private headers)
316AC_ARG_WITH(tkinclude, [  --with-tkinclude=DIR    Directory where tk private headers are], with_tkinclude=${withval})
317AC_CACHE_VAL(ac_cv_c_tkh,[
318# first check to see if --with-tkinclude was specified
319if test x"${with_tkinclude}" != x ; then
320  if test -f ${with_tkinclude}/tk.h ; then
321    ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
322  elif test -f ${with_tkinclude}/generic/tk.h ; then
323    ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
324  else
325    AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
326  fi
327fi
328
329# next check if it came with Tk configuration file
330if test x"${ac_cv_c_tkconfig}" = x ; then
331  if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
332    ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
333  fi
334fi
335
336# next check in private source directory
337#
338# since ls returns lowest version numbers first, reverse its output
339if test x"${ac_cv_c_tkh}" = x ; then
340  for i in \
341		${srcdir}/../tk \
342		`ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
343		${srcdir}/../../tk \
344		`ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
345		${srcdir}/../../../tk \
346		`ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
347    if test -f $i/generic/tk.h ; then
348      ac_cv_c_tkh=`(cd $i/generic; pwd)`
349      break
350    fi
351  done
352fi
353# finally check in a few common install locations
354#
355# since ls returns lowest version numbers first, reverse its output
356if test x"${ac_cv_c_tkh}" = x ; then
357  for i in \
358		`ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
359		`ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
360		/usr/local/src/tk \
361		/usr/local/lib/tk \
362		${prefix}/include ; do
363    if test -f $i/generic/tk.h ; then
364      ac_cv_c_tkh=`(cd $i/generic; pwd)`
365      break
366    fi
367  done
368fi
369# see if one is installed
370if test x"${ac_cv_c_tkh}" = x ; then
371   AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
372fi
373])
374if test x"${ac_cv_c_tkh}" != x ; then
375  no_tk=""
376  if test x"${ac_cv_c_tkh}" = x"installed" ; then
377    AC_MSG_RESULT([is installed])
378    TKHDIR=""
379  else
380    AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
381    # this hack is cause the TKHDIR won't print if there is a "-I" in it.
382    TKHDIR="-I${ac_cv_c_tkh}"
383  fi
384else
385  TKHDIR="# no Tk directory found"
386  AC_MSG_WARN([Can't find Tk private headers])
387  no_tk=true
388fi
389
390AC_SUBST(TKHDIR)
391])
392
393
394AC_DEFUN([CY_AC_PATH_TKCONFIG], [
395#
396# Ok, lets find the tk configuration
397# First, look for one uninstalled.
398# the alternative search directory is invoked by --with-tkconfig
399#
400
401if test x"${no_tk}" = x ; then
402  # we reset no_tk in case something fails here
403  no_tk=true
404  AC_ARG_WITH(tkconfig, [  --with-tkconfig=DIR     Directory containing tk configuration (tkConfig.sh)],
405         with_tkconfig=${withval})
406  AC_MSG_CHECKING([for Tk configuration])
407  AC_CACHE_VAL(ac_cv_c_tkconfig,[
408
409  # First check to see if --with-tkconfig was specified.
410  if test x"${with_tkconfig}" != x ; then
411    if test -f "${with_tkconfig}/tkConfig.sh" ; then
412      ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
413    else
414      AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
415    fi
416  fi
417
418  # then check for a private Tk library
419  if test x"${ac_cv_c_tkconfig}" = x ; then
420    for i in \
421		../tk \
422		`ls -dr ../tk[[4-9]]* 2>/dev/null` \
423		../../tk \
424		`ls -dr ../../tk[[4-9]]* 2>/dev/null` \
425		../../../tk \
426		`ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
427      if test -f "$i/${configdir}/tkConfig.sh" ; then
428        ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
429	break
430      fi
431    done
432  fi
433  # check in a few common install locations
434  if test x"${ac_cv_c_tkconfig}" = x ; then
435    for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
436      if test -f "$i/tkConfig.sh" ; then
437        ac_cv_c_tkconfig=`(cd $i; pwd)`
438	break
439      fi
440    done
441  fi
442  # check in a few other private locations
443  if test x"${ac_cv_c_tkconfig}" = x ; then
444    for i in \
445		${srcdir}/../tk \
446		`ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
447      if test -f "$i/${configdir}/tkConfig.sh" ; then
448        ac_cv_c_tkconfig=`(cd $i/${configdir}; pwd)`
449	break
450      fi
451    done
452  fi
453  ])
454  if test x"${ac_cv_c_tkconfig}" = x ; then
455    TKCONFIG="# no Tk configs found"
456    AC_MSG_WARN(Can't find Tk configuration definitions)
457  else
458    no_tk=
459    TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
460    AC_MSG_RESULT(found $TKCONFIG)
461  fi
462fi
463
464])
465
466# Defined as a separate macro so we don't have to cache the values
467# from PATH_TKCONFIG (because this can also be cached).
468AC_DEFUN([CY_AC_LOAD_TKCONFIG], [
469    if test -f "$TKCONFIG" ; then
470      . $TKCONFIG
471    fi
472
473    AC_SUBST(TK_VERSION)
474dnl not actually used, don't export to save symbols
475dnl    AC_SUBST(TK_MAJOR_VERSION)
476dnl    AC_SUBST(TK_MINOR_VERSION)
477    AC_SUBST(TK_DEFS)
478
479dnl not used, don't export to save symbols
480    dnl AC_SUBST(TK_LIB_FILE)
481
482dnl not used outside of configure
483dnl    AC_SUBST(TK_LIBS)
484dnl not used, don't export to save symbols
485dnl    AC_SUBST(TK_PREFIX)
486
487dnl not used, don't export to save symbols
488dnl    AC_SUBST(TK_EXEC_PREFIX)
489
490    AC_SUBST(TK_BUILD_INCLUDES)
491    AC_SUBST(TK_XINCLUDES)
492    AC_SUBST(TK_XLIBSW)
493    AC_SUBST(TK_BUILD_LIB_SPEC)
494    AC_SUBST(TK_LIB_SPEC)
495])
496
497# check for Itcl headers.
498
499AC_DEFUN([CY_AC_PATH_ITCLCONFIG], [
500#
501# Ok, lets find the itcl configuration
502# First, look for one uninstalled.
503# the alternative search directory is invoked by --with-itclconfig
504#
505
506if test x"${no_itcl}" = x ; then
507  # we reset no_itcl in case something fails here
508  no_itcl=true
509  AC_ARG_WITH(itclconfig, [  --with-itclconfig       Directory containing itcl configuration (itclConfig.sh)],
510         with_itclconfig=${withval})
511  AC_MSG_CHECKING([for Itcl configuration])
512  AC_CACHE_VAL(ac_cv_c_itclconfig,[
513
514  # First check to see if --with-itclconfig was specified.
515  if test x"${with_itclconfig}" != x ; then
516    if test -f "${with_itclconfig}/itclConfig.sh" ; then
517      ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
518    else
519      AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
520    fi
521  fi
522
523  # then check for a private Itcl library
524  if test x"${ac_cv_c_itclconfig}" = x ; then
525    for i in \
526		../itcl/itcl \
527		`ls -dr ../itcl[[4-9]]*/itcl 2>/dev/null` \
528		../../itcl \
529		`ls -dr ../../itcl[[4-9]]*/itcl 2>/dev/null` \
530		../../../itcl \
531		`ls -dr ../../../itcl[[4-9]]*/itcl 2>/dev/null` ; do
532      if test -f "$i/itclConfig.sh" ; then
533        ac_cv_c_itclconfig=`(cd $i; pwd)`
534	break
535      fi
536    done
537  fi
538  # check in a few common install locations
539  if test x"${ac_cv_c_itclconfig}" = x ; then
540    for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
541      if test -f "$i/itclConfig.sh" ; then
542        ac_cv_c_itclconfig=`(cd $i; pwd)`
543	break
544      fi
545    done
546  fi
547  # check in a few other private locations
548  if test x"${ac_cv_c_itclconfig}" = x ; then
549    for i in \
550		${srcdir}/../itcl/itcl \
551		`ls -dr ${srcdir}/../itcl[[4-9]]*/itcl 2>/dev/null` ; do
552      if test -f "$i/itclConfig.sh" ; then
553        ac_cv_c_itclconfig=`(cd $i; pwd)`
554	break
555      fi
556    done
557  fi
558  ])
559  if test x"${ac_cv_c_itclconfig}" = x ; then
560    ITCLCONFIG="# no Itcl configs found"
561    AC_MSG_WARN(Can't find Itcl configuration definitions)
562  else
563    no_itcl=
564    ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
565    AC_MSG_RESULT(found $ITCLCONFIG)
566  fi
567fi
568])
569
570# Defined as a separate macro so we don't have to cache the values
571# from PATH_ITCLCONFIG (because this can also be cached).
572AC_DEFUN([CY_AC_LOAD_ITCLCONFIG], [
573    if test -f "$ITCLCONFIG" ; then
574      . $ITCLCONFIG
575    fi
576
577    AC_SUBST(ITCL_VERSION)
578dnl not actually used, don't export to save symbols
579dnl    AC_SUBST(ITCL_MAJOR_VERSION)
580dnl    AC_SUBST(ITCL_MINOR_VERSION)
581    AC_SUBST(ITCL_DEFS)
582
583dnl not used, don't export to save symbols
584    dnl AC_SUBST(ITCL_LIB_FILE)
585
586dnl not used outside of configure
587dnl    AC_SUBST(ITCL_LIBS)
588dnl not used, don't export to save symbols
589dnl    AC_SUBST(ITCL_PREFIX)
590
591dnl not used, don't export to save symbols
592dnl    AC_SUBST(ITCL_EXEC_PREFIX)
593
594    AC_SUBST(ITCL_BUILD_INCLUDES)
595    AC_SUBST(ITCL_BUILD_LIB_SPEC)
596    AC_SUBST(ITCL_LIB_SPEC)
597])
598
599# check for Itcl headers.
600
601AC_DEFUN([CY_AC_PATH_ITCLH], [
602AC_MSG_CHECKING(for Itcl private headers. srcdir=${srcdir})
603if test x"${ac_cv_c_itclh}" = x ; then
604  for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do
605    if test -f $i/generic/itcl.h ; then
606      ac_cv_c_itclh=`(cd $i/generic; pwd)`
607      break
608    fi
609  done
610fi
611if test x"${ac_cv_c_itclh}" = x ; then
612  ITCLHDIR="# no Itcl private headers found"
613  AC_MSG_ERROR([Can't find Itcl private headers])
614fi
615if test x"${ac_cv_c_itclh}" != x ; then
616     ITCLHDIR="-I${ac_cv_c_itclh}"
617fi
618# should always be here
619#     ITCLLIB="../itcl/itcl/unix/libitcl.a"
620AC_SUBST(ITCLHDIR)
621#AC_SUBST(ITCLLIB)
622])
623
624
625AC_DEFUN([CY_AC_PATH_ITKCONFIG], [
626#
627# Ok, lets find the itk configuration
628# First, look for one uninstalled.
629# the alternative search directory is invoked by --with-itkconfig
630#
631
632if test x"${no_itk}" = x ; then
633  # we reset no_itk in case something fails here
634  no_itk=true
635  AC_ARG_WITH(itkconfig, [  --with-itkconfig        Directory containing itk configuration (itkConfig.sh)],
636         with_itkconfig=${withval})
637  AC_MSG_CHECKING([for Itk configuration])
638  AC_CACHE_VAL(ac_cv_c_itkconfig,[
639
640  # First check to see if --with-itkconfig was specified.
641  if test x"${with_itkconfig}" != x ; then
642    if test -f "${with_itkconfig}/itkConfig.sh" ; then
643      ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
644    else
645      AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
646    fi
647  fi
648
649  # then check for a private Itk library
650  if test x"${ac_cv_c_itkconfig}" = x ; then
651    for i in \
652		../itcl/itk \
653		`ls -dr ../itcl[[4-9]]*/itk 2>/dev/null` \
654		../../itk \
655		`ls -dr ../../itcl[[4-9]]*/itk 2>/dev/null` \
656		../../../itk \
657		`ls -dr ../../../itcl[[4-9]]*/itk 2>/dev/null` ; do
658      if test -f "$i/itkConfig.sh" ; then
659        ac_cv_c_itkconfig=`(cd $i; pwd)`
660	break
661      fi
662    done
663  fi
664  # check in a few common install locations
665  if test x"${ac_cv_c_itkconfig}" = x ; then
666    for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
667      if test -f "$i/itkConfig.sh" ; then
668        ac_cv_c_itkconfig=`(cd $i; pwd)`
669	break
670      fi
671    done
672  fi
673  # check in a few other private locations
674  if test x"${ac_cv_c_itkconfig}" = x ; then
675    for i in \
676		${srcdir}/../itcl/itk \
677		`ls -dr ${srcdir}/../itcl[[4-9]]*/itk 2>/dev/null` ; do
678      if test -f "$i/itkConfig.sh" ; then
679        ac_cv_c_itkconfig=`(cd $i; pwd)`
680	break
681      fi
682    done
683  fi
684  ])
685  if test x"${ac_cv_c_itkconfig}" = x ; then
686    ITKCONFIG="# no Itk configs found"
687    AC_MSG_WARN(Can't find Itk configuration definitions)
688  else
689    no_itk=
690    ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
691    AC_MSG_RESULT(found $ITKCONFIG)
692  fi
693fi
694
695])
696
697# Defined as a separate macro so we don't have to cache the values
698# from PATH_ITKCONFIG (because this can also be cached).
699AC_DEFUN([CY_AC_LOAD_ITKCONFIG], [
700    if test -f "$ITKCONFIG" ; then
701      . $ITKCONFIG
702    fi
703
704    AC_SUBST(ITK_VERSION)
705dnl not actually used, don't export to save symbols
706dnl    AC_SUBST(ITK_MAJOR_VERSION)
707dnl    AC_SUBST(ITK_MINOR_VERSION)
708    AC_SUBST(ITK_DEFS)
709
710dnl not used, don't export to save symbols
711    dnl AC_SUBST(ITK_LIB_FILE)
712
713dnl not used outside of configure
714dnl    AC_SUBST(ITK_LIBS)
715dnl not used, don't export to save symbols
716dnl    AC_SUBST(ITK_PREFIX)
717
718dnl not used, don't export to save symbols
719dnl    AC_SUBST(ITK_EXEC_PREFIX)
720
721    AC_SUBST(ITK_BUILD_INCLUDES)
722    AC_SUBST(ITK_BUILD_LIB_SPEC)
723    AC_SUBST(ITK_LIB_SPEC)
724])
725
726AC_DEFUN([CY_AC_PATH_ITKH], [
727AC_MSG_CHECKING(for Itk private headers. srcdir=${srcdir})
728if test x"${ac_cv_c_itkh}" = x ; then
729  for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do
730    if test -f $i/generic/itk.h ; then
731      ac_cv_c_itkh=`(cd $i/generic; pwd)`
732      break
733    fi
734  done
735fi
736if test x"${ac_cv_c_itkh}" = x ; then
737  ITKHDIR="# no Itk private headers found"
738  AC_MSG_ERROR([Can't find Itk private headers])
739fi
740if test x"${ac_cv_c_itkh}" != x ; then
741     ITKHDIR="-I${ac_cv_c_itkh}"
742fi
743# should always be here
744#     ITKLIB="../itcl/itk/unix/libitk.a"
745AC_SUBST(ITKHDIR)
746#AC_SUBST(ITKLIB)
747])
748
749
750dnl sinclude(../gettext.m4) already included by bfd/acinclude.m4
751dnl The lines below arrange for aclocal not to bring gettext.m4's
752dnl CY_GNU_GETTEXT into aclocal.m4.
753ifelse(yes,no,[
754AC_DEFUN([CY_GNU_GETTEXT],)
755])
756
757
758# Copyright 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
759
760# This program is free software; you can redistribute it and/or modify
761# it under the terms of the GNU General Public License as published by
762# the Free Software Foundation; either version 2, or (at your option)
763# any later version.
764
765# This program is distributed in the hope that it will be useful,
766# but WITHOUT ANY WARRANTY; without even the implied warranty of
767# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
768# GNU General Public License for more details.
769
770# You should have received a copy of the GNU General Public License
771# along with this program; if not, write to the Free Software
772# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
773# 02111-1307, USA.
774
775# serial 1
776
777# @defmac AC_PROG_CC_STDC
778# @maindex PROG_CC_STDC
779# @ovindex CC
780# If the C compiler in not in ANSI C mode by default, try to add an option
781# to output variable @code{CC} to make it so.  This macro tries various
782# options that select ANSI C on some system or another.  It considers the
783# compiler to be in ANSI C mode if it handles function prototypes correctly.
784#
785# If you use this macro, you should check after calling it whether the C
786# compiler has been set to accept ANSI C; if not, the shell variable
787# @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
788# code in ANSI C, you can make an un-ANSIfied copy of it by using the
789# program @code{ansi2knr}, which comes with Ghostscript.
790# @end defmac
791
792AC_DEFUN([AM_PROG_CC_STDC],
793[AC_REQUIRE([AC_PROG_CC])
794AC_BEFORE([$0], [AC_C_INLINE])
795AC_BEFORE([$0], [AC_C_CONST])
796dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
797dnl a magic option to avoid problems with ANSI preprocessor commands
798dnl like #elif.
799dnl FIXME: can't do this because then AC_AIX won't work due to a
800dnl circular dependency.
801dnl AC_BEFORE([$0], [AC_PROG_CPP])
802AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
803AC_CACHE_VAL(am_cv_prog_cc_stdc,
804[am_cv_prog_cc_stdc=no
805ac_save_CC="$CC"
806# Don't try gcc -ansi; that turns off useful extensions and
807# breaks some systems' header files.
808# AIX			-qlanglvl=ansi
809# Ultrix and OSF/1	-std1
810# HP-UX 10.20 and later	-Ae
811# HP-UX older versions	-Aa -D_HPUX_SOURCE
812# SVR4			-Xc -D__EXTENSIONS__
813for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
814do
815  CC="$ac_save_CC $ac_arg"
816  AC_TRY_COMPILE(
817[#include <stdarg.h>
818#include <stdio.h>
819#include <sys/types.h>
820#include <sys/stat.h>
821/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
822struct buf { int x; };
823FILE * (*rcsopen) (struct buf *, struct stat *, int);
824static char *e (p, i)
825     char **p;
826     int i;
827{
828  return p[i];
829}
830static char *f (char * (*g) (char **, int), char **p, ...)
831{
832  char *s;
833  va_list v;
834  va_start (v,p);
835  s = g (p, va_arg (v,int));
836  va_end (v);
837  return s;
838}
839int test (int i, double x);
840struct s1 {int (*f) (int a);};
841struct s2 {int (*f) (double a);};
842int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
843int argc;
844char **argv;
845], [
846return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
847],
848[am_cv_prog_cc_stdc="$ac_arg"; break])
849done
850CC="$ac_save_CC"
851])
852if test -z "$am_cv_prog_cc_stdc"; then
853  AC_MSG_RESULT([none needed])
854else
855  AC_MSG_RESULT([$am_cv_prog_cc_stdc])
856fi
857case "x$am_cv_prog_cc_stdc" in
858  x|xno) ;;
859  *) CC="$CC $am_cv_prog_cc_stdc" ;;
860esac
861])
862
863dnl From Bruno Haible.
864
865AC_DEFUN([AM_ICONV],
866[
867  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
868  dnl those with the standalone portable GNU libiconv installed).
869
870  AC_ARG_WITH([libiconv-prefix],
871[  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
872    for dir in `echo "$withval" | tr : ' '`; do
873      if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
874      if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
875    done
876   ])
877
878  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
879    am_cv_func_iconv="no, consider installing GNU libiconv"
880    am_cv_lib_iconv=no
881    AC_TRY_LINK([#include <stdlib.h>
882#include <iconv.h>],
883      [iconv_t cd = iconv_open("","");
884       iconv(cd,NULL,NULL,NULL,NULL);
885       iconv_close(cd);],
886      am_cv_func_iconv=yes)
887    if test "$am_cv_func_iconv" != yes; then
888      am_save_LIBS="$LIBS"
889      LIBS="$LIBS -liconv"
890      AC_TRY_LINK([#include <stdlib.h>
891#include <iconv.h>],
892        [iconv_t cd = iconv_open("","");
893         iconv(cd,NULL,NULL,NULL,NULL);
894         iconv_close(cd);],
895        am_cv_lib_iconv=yes
896        am_cv_func_iconv=yes)
897      LIBS="$am_save_LIBS"
898    fi
899  ])
900  if test "$am_cv_func_iconv" = yes; then
901    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
902    AC_MSG_CHECKING([for iconv declaration])
903    AC_CACHE_VAL(am_cv_proto_iconv, [
904      AC_TRY_COMPILE([
905#include <stdlib.h>
906#include <iconv.h>
907extern
908#ifdef __cplusplus
909"C"
910#endif
911#if defined(__STDC__) || defined(__cplusplus)
912size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
913#else
914size_t iconv();
915#endif
916], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
917      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);"])
918    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
919    AC_MSG_RESULT([$]{ac_t:-
920         }[$]am_cv_proto_iconv)
921    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
922      [Define as const if the declaration of iconv() needs const.])
923  fi
924  LIBICONV=
925  if test "$am_cv_lib_iconv" = yes; then
926    LIBICONV="-liconv"
927  fi
928  AC_SUBST(LIBICONV)
929])
930
931# AC_GNU_SOURCE
932# -------------
933# FIXME: Remove thise once we start using Autoconf 2.5x (x>=4).
934AC_DEFUN([AC_GNU_SOURCE],
935[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
936AC_BEFORE([$0], [AC_TRY_RUN])dnl
937AC_DEFINE([_GNU_SOURCE])
938])
939
940dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva
941dnl Version 1.3 (2001/03/02)
942dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html
943
944AC_DEFUN([AC_DEFINE_DIR], [
945  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
946  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
947  ac_define_dir=`eval echo [$]$2`
948  ac_define_dir=`eval echo [$]ac_define_dir`
949  ifelse($3, ,
950    AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
951    AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
952])
953
954dnl See whether we need a declaration for a function.
955dnl The result is highly dependent on the INCLUDES passed in, so make sure
956dnl to use a different cache variable name in this macro if it is invoked
957dnl in a different context somewhere else.
958dnl gcc_AC_CHECK_DECL(SYMBOL,
959dnl 	[ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
960AC_DEFUN([gcc_AC_CHECK_DECL],
961[AC_MSG_CHECKING([whether $1 is declared])
962AC_CACHE_VAL(gcc_cv_have_decl_$1,
963[AC_TRY_COMPILE([$4],
964[#ifndef $1
965char *(*pfn) = (char *(*)) $1 ;
966#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
967if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
968  AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
969else
970  AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
971fi
972])dnl
973
974dnl Check multiple functions to see whether each needs a declaration.
975dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
976dnl gcc_AC_CHECK_DECLS(SYMBOLS,
977dnl 	[ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
978AC_DEFUN([gcc_AC_CHECK_DECLS],
979[for ac_func in $1
980do
981changequote(, )dnl
982  ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
983changequote([, ])dnl
984gcc_AC_CHECK_DECL($ac_func,
985  [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
986  [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
987dnl It is possible that the include files passed in here are local headers
988dnl which supply a backup declaration for the relevant prototype based on
989dnl the definition of (or lack of) the HAVE_DECL_ macro.  If so, this test
990dnl will always return success.  E.g. see libiberty.h's handling of
991dnl `basename'.  To avoid this, we define the relevant HAVE_DECL_ macro to
992dnl 1 so that any local headers used do not provide their own prototype
993dnl during this test.
994#undef $ac_tr_decl
995#define $ac_tr_decl 1
996  $4
997)
998done
999dnl Automatically generate config.h entries via autoheader.
1000if test x = y ; then
1001  patsubst(translit([$1], [a-z], [A-Z]), [\w+],
1002    [AC_DEFINE([HAVE_DECL_\&], 1,
1003      [Define to 1 if we found this declaration otherwise define to 0.])])dnl
1004fi
1005])
1006
1007
1008# Add --enable-maintainer-mode option to configure.
1009# From Jim Meyering
1010
1011# serial 1
1012
1013AC_DEFUN(AM_MAINTAINER_MODE,
1014[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1015  dnl maintainer-mode is disabled by default
1016  AC_ARG_ENABLE(maintainer-mode,
1017[  --enable-maintainer-mode enable make rules and dependencies not useful
1018                          (and sometimes confusing) to the casual installer],
1019      USE_MAINTAINER_MODE=$enableval,
1020      USE_MAINTAINER_MODE=no)
1021  AC_MSG_RESULT($USE_MAINTAINER_MODE)
1022  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1023  MAINT=$MAINTAINER_MODE_TRUE
1024  AC_SUBST(MAINT)dnl
1025]
1026)
1027
1028# Define a conditional.
1029
1030AC_DEFUN(AM_CONDITIONAL,
1031[AC_SUBST($1_TRUE)
1032AC_SUBST($1_FALSE)
1033if $2; then
1034  $1_TRUE=
1035  $1_FALSE='#'
1036else
1037  $1_TRUE='#'
1038  $1_FALSE=
1039fi])
1040
1041