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