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