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