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