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