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