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