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