comparison acsupport/acinclude.m4 @ 595:c2d1fd823f09

Update autoconf macro for Tcl, and regenerate affected files
author bartv
date Wed, 12 Feb 2003 17:22:10 +0000
parents d82de0ee8e07
children a2fb80f5315f
comparison
equal deleted inserted replaced
594:7df7eb129a74 595:c2d1fd823f09
8 dnl eCos packages. 8 dnl eCos packages.
9 dnl 9 dnl
10 dnl ==================================================================== 10 dnl ====================================================================
11 dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN#### 11 dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN####
12 dnl ---------------------------------------------------------------------------- 12 dnl ----------------------------------------------------------------------------
13 dnl Copyright (C) 2002 Bart Veer 13 dnl Copyright (C) 2002, 2003 Bart Veer
14 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. 14 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15 dnl 15 dnl
16 dnl This file is part of the eCos host tools. 16 dnl This file is part of the eCos host tools.
17 dnl 17 dnl
18 dnl This program is free software; you can redistribute it and/or modify it 18 dnl This program is free software; you can redistribute it and/or modify it
124 AC_MSG_CHECKING("for Visual C++") 124 AC_MSG_CHECKING("for Visual C++")
125 MSVC="no"; 125 MSVC="no";
126 if test "${CC}" = "cl" ; then 126 if test "${CC}" = "cl" ; then
127 MSVC="yes" 127 MSVC="yes"
128 CXX="cl" 128 CXX="cl"
129 MSVC_SRCDIR=${srcdir}
129 ECOS_MSVC_PATH(MSVC_SRCDIR) 130 ECOS_MSVC_PATH(MSVC_SRCDIR)
130 AC_SUBST(MSVC_SRCDIR) 131 AC_SUBST(MSVC_SRCDIR)
131 ecos_INCLUDES="${ecos_INCLUDES} \"-I${msvc_srcdir}\"" 132 ecos_INCLUDES="${ecos_INCLUDES} \"-I${MSVC_SRCDIR}\""
132 ecos_LDADD="-link" 133 ecos_LDADD="-link"
133 ecos_LIBS="advapi32.lib" 134 ecos_LIBS="advapi32.lib"
134 fi 135 fi
135 AM_CONDITIONAL(MSVC, test "${MSVC}" = "yes") 136 AM_CONDITIONAL(MSVC, test "${MSVC}" = "yes")
136 if test "${MSVC}" = "yes" ; then 137 if test "${MSVC}" = "yes" ; then
363 done 364 done
364 ]) 365 ])
365 366
366 dnl ==================================================================== 367 dnl ====================================================================
367 dnl Work out details of the Tcl/tk installation that should be used. 368 dnl Work out details of the Tcl/tk installation that should be used.
369 dnl In theory this is simple: when Tcl is installed in <tcl_prefix>
370 dnl (usually /usr) there should be a file <tcl_prefix>/lib/tclConfig.sh
371 dnl which defines exactly how to build Tcl-based applications. Of course
372 dnl Tcl may be installed anywhere, not just in /usr, so it is necessary
373 dnl to do some searching. There is a command-line argument
374 dnl --with-tcl=<path> to specify the Tcl installation, so the macro
375 dnl can search for <with_tcl>/lib/tclConfig.sh, <prefix>/lib/tclConfig.sh
376 dnl and /usr/lib/tclConfig.sh
377 dnl
378 dnl Unfortunately not all systems use this convention. For example,
379 dnl at the time of writing Debian installs tclConfig.sh in a versioned
380 dnl subdirectory /usr/lib/tcl8.3/tclConfig.sh. Hence there is an
381 dnl additional argument --with-tcl-version=<vsn> which is used to
382 dnl extend the search path.
383 dnl
384 dnl For VC++ builds the situation is different again. Tcl may be
385 dnl installed anywhere, so the data in tclConfig.sh is not useful
386 dnl (and that file may not be provided at all). Instead --with-tcl
387 dnl must be used to specify the path. Alternatively separate paths
388 dnl for headers and libraries can be specified using --with-tcl-header
389 dnl and --with-tcl-lib. Usually it will also be necessary to specify
390 dnl the library version number using --with-tcl-version.
391
368 dnl This adds two main command-line options, --with-tcl=<prefix> to 392 dnl This adds two main command-line options, --with-tcl=<prefix> to
369 dnl specify the Tcl install directory, and --with-tcl-version=<vsn> 393 dnl specify the Tcl install directory, and --with-tcl-version=<vsn>
370 dnl to control which version of Tcl should be used. For finer-grained 394 dnl to control which version of Tcl should be used. For finer-grained
371 dnl control there are additional options --with-tcl-header and 395 dnl control there are additional options --with-tcl-header and
372 dnl --with-tcl-version. It is assumed that Tcl and Tk are installed 396 dnl --with-tcl-version. It is assumed that Tcl and Tk are installed
399 AC_DEFUN(ECOS_PATH_TCL, [ 423 AC_DEFUN(ECOS_PATH_TCL, [
400 424
401 AC_REQUIRE([ECOS_PROG_MSVC]) 425 AC_REQUIRE([ECOS_PROG_MSVC])
402 AC_REQUIRE([AC_CYGWIN]) 426 AC_REQUIRE([AC_CYGWIN])
403 427
404 ecos_tcl_version=""
405 ecos_tcl_incdir=""
406 ecos_tcl_libdir=""
407 ecos_tk_libs="" 428 ecos_tk_libs=""
408 ecos_tk_libdir="" 429 ecos_tk_libdir=""
409 430
410 dnl Look for the version of Tcl. If none is specified, default to 431 dnl Where is the Tcl installation, and what version should be used?
411 dnl 8.0 under VC++ and cygwin, nothing under Unix. A version has to be
412 dnl specified under NT because there is no symbolic link from libtcl.a
413 dnl to whatever happens to be the most recent installed version.
414
415 AC_MSG_CHECKING([for Tcl version])
416 AC_ARG_WITH(tcl-version,[ --with-tcl-version=<vsn> version of Tcl to be used],[
417 ecos_tcl_version=${with_tcl_version}
418 ],[
419 if test "${MSVC}" = "yes" ; then
420 ecos_tcl_version=80
421 elif test "${ac_cv_cygwin}" = "yes" ; then
422 ecos_tcl_version=80
423 else
424 ecos_tcl_version=""
425 fi
426 ])
427 AC_MSG_RESULT([${ecos_tcl_version}])
428
429 dnl Where is the Tcl installation?
430 AC_MSG_CHECKING(for Tcl installation) 432 AC_MSG_CHECKING(for Tcl installation)
431
432 AC_ARG_WITH(tcl-header,[ --with-tcl-header=<path> location of Tcl header])
433 AC_ARG_WITH(tcl-lib,[ --with-tcl-lib=<path> location of Tcl libraries])
434 AC_ARG_WITH(tcl,[ --with-tcl=<path> location of Tcl header and libraries]) 433 AC_ARG_WITH(tcl,[ --with-tcl=<path> location of Tcl header and libraries])
434 AC_ARG_WITH(tcl-version,[ --with-tcl-version=<vsn> version of Tcl to be used])
435 435
436 dnl If using VC++ then there are no sensible default directories 436 dnl If using VC++ then there are no sensible default directories
437 dnl to search for a Tcl installation. Instead the user must 437 dnl to search for a Tcl installation. Instead the user must
438 dnl supply either --with-tcl, or both --with-tcl-header and 438 dnl supply either --with-tcl, or both --with-tcl-header and
439 dnl --with-tcl-lib. 439 dnl --with-tcl-lib.
440 dnl 440 dnl
441 dnl Also when using VC++ there is no tclConfig.sh file to 441 dnl Also when using VC++ there is no tclConfig.sh file to
442 dnl consult about which libraries are needed. Instead that 442 dnl consult about which libraries are needed. Instead that
443 dnl information is hard-wired here. 443 dnl information is hard-wired here.
444
445 if test "${MSVC}" = "yes" ; then 444 if test "${MSVC}" = "yes" ; then
446 445 AC_ARG_WITH(tcl-header,[ --with-tcl-header=<path> location of Tcl header])
446 AC_ARG_WITH(tcl-lib,[ --with-tcl-lib=<path> location of Tcl libraries])
447 ecos_tcl_incdir=""
448 ecos_tcl_libdir=""
449 if test "${with_tcl_version+set}" != set ; then
450 AC_MSG_ERROR(You must specify a Tcl version using --with-tcl-version=<vsn>)
451 fi
447 if test "${with_tcl_header+set}" = set ; then 452 if test "${with_tcl_header+set}" = set ; then
448 ecos_tcl_incdir=${with_tcl_header} 453 ecos_tcl_incdir=${with_tcl_header}
449 elif test "${with_tcl+set}" = set ; then 454 elif test "${with_tcl+set}" = set ; then
450 ecos_tcl_incdir="${with_tcl}/include" 455 ecos_tcl_incdir="${with_tcl}/include"
451 else 456 else
452 AC_MSG_ERROR(You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-header=<path>) 457 AC_MSG_ERROR(You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-header=<path>)
453 fi 458 fi
454
455 dnl Sanity check, make sure that there is a tcl.h header file.
456 dnl If not then there is no point in proceeding.
457 if test \! -r "${ecos_tcl_incdir}/tcl.h" ; then
458 AC_MSG_ERROR([unable to locate Tcl header file tcl.h])
459 fi
460 ecos_msvc_tcl_incdir="${ecos_tcl_incdir}"
461 ECOS_MSVC_PATH(ecos_msvc_tcl_incdir)
462 ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_msvc_tcl_incdir}\""
463
464 if test "${with_tcl_lib+set}" = set; then 459 if test "${with_tcl_lib+set}" = set; then
465 ecos_tcl_libdir=${with_tcl_lib} 460 ecos_tcl_libdir=${with_tcl_lib}
466 elif test "${with_tcl+set}" = set; then 461 elif test "${with_tcl+set}" = set; then
467 ecos_tcl_libdir="${with_tcl}/lib" 462 ecos_tcl_libdir="${with_tcl}/lib"
468 else 463 else
469 AC_MSG_ERROR(You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-lib=<path>) 464 AC_MSG_ERROR(You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-lib=<path>)
470 fi 465 fi
466
467 dnl Sanity check, make sure that there is a tcl.h header file.
468 dnl If not then there is no point in proceeding.
469 if test \! -r "${ecos_tcl_incdir}/tcl.h" ; then
470 AC_MSG_ERROR([unable to locate Tcl header file tcl.h])
471 fi
472
473 ECOS_MSVC_PATH(ecos_tcl_incdir)
471 ECOS_MSVC_PATH(ecos_tcl_libdir) 474 ECOS_MSVC_PATH(ecos_tcl_libdir)
472 ecos_LIBS="${ecos_LIBS} tcl${ecos_tcl_version}.lib" 475 ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_tcl_incdir}\""
476 ecos_LIBS="${ecos_LIBS} tcl${with_tcl_version}.lib"
473 ecos_LDADD="${ecos_LDADD} \"-libpath=${ecos_tcl_libdir}\"" 477 ecos_LDADD="${ecos_LDADD} \"-libpath=${ecos_tcl_libdir}\""
474 478
475 dnl FIXME: what libraries are needed for a tk application under VC++? 479 dnl FIXME: what libraries are needed for a tk application under VC++?
476 dnl and can the version be determined more accurately? 480 dnl and can the version be determined more accurately?
477 ecos_tk_libs="" 481 ecos_tk_libs=""
478 482
479 else 483 else
480 dnl Depending on the installation there are a number of reasonable locations for tcl.h 484 dnl Try to find tclConfig.sh
481 dnl so this code performs a search. 485 possibles=""
482 possibles="${with_tcl_header} ${with_tcl}/include ${prefix}/include /usr/include/tcl${ecos_tcl_version} /usr/include" 486 if test "${with_tcl+set}" = set ; then
483 AC_FIND_FILE("tcl.h", ${possibles}, ecos_tcl_incdir) 487 possibles="${with_tcl}/lib"
484 if test \! -r "${ecos_tcl_incdir}/tcl.h" ; then 488 if test "${with_tcl_version+set}" = set ; then
485 AC_MSG_ERROR(unable to locate Tcl header file tcl.h) 489 possibles="${possibles} ${with_tcl}/lib/tcl${with_tcl_version}"
486 else 490 fi
487 dnl On Unix systems -I/usr/include is unnecessary, and can cause problems on hosts 491 fi
488 dnl where gcc is not the platform's default compiler because of the use of 492 possibles="${possibles} ${prefix}/lib"
489 dnl unfixed headers. Hence it is explicitly removed here. Similarly 493 if test "${with_tcl_version+set}" = set ; then
490 dnl -I/usr/lib serves no purpose, although it should be harmless. 494 possibles="${possibles} ${prefix}/lib/tcl${with_tcl_version}"
491 dnl Under cygwin this check may be wrong, should the mount table 495 fi
492 dnl be set up such that /usr/include points at the main cygwin 496 possibles="${possibles} /usr/lib"
493 dnl headers. That assumes that gcc under cygwin does not have 497 if test "${with_tcl_version+set}" = set ; then
494 dnl /usr/include in its default path, an untested assumption. 498 possibles="${possibles} /usr/lib/tcl${with_tcl_version}"
495 if test "${ecos_tcl_incdir}" != "/usr/include" ; then 499 fi
496 ecos_INCLUDES="${ecos_INCLUDES} -I${ecos_tcl_incdir}" 500 AC_FIND_FILE("tclConfig.sh", ${possibles}, tclconfig)
497 fi 501 if test \! -r "${tclconfig}/tclConfig.sh" ; then
498 fi 502 AC_MSG_ERROR(unable to locate Tcl configuration file tclConfig.sh)
499 possibles="${with_tcl_lib} ${with_tcl}/lib ${libdir} ${prefix}/lib /usr/lib/tcl${ecos_tcl_version} /usr/lib" 503 else
500 AC_FIND_FILE("tclConfig.sh", ${possibles}, ecos_tcl_libdir) 504 . ${tclconfig}/tclConfig.sh
501 if test \! -r "${ecos_tcl_libdir}/tclConfig.sh" ; then 505
502 AC_MSG_ERROR(unable to locate Tcl config file tclConfig.sh) 506 dnl Now we need to figure out where to find the Tcl header files.
503 else 507 dnl tclConfig.sh may define a variable TCL_INC_DIR, otherwise
504 . ${ecos_tcl_libdir}/tclConfig.sh 508 dnl use TCL_PREFIX/include
505 dnl Arguably if ecos_tcl_version is not set then it should be 509 if test -z "${TCL_INC_DIR}" ; then
506 dnl here using TCL_VERSION, tying executables to a specific 510 ecos_tcl_incdir="${TCL_PREFIX}/include"
507 dnl release. That avoids problems if the system has multiple 511 else
508 dnl Tcl installations, e.g. the system install plus a more 512 ecos_tcl_incdir="${TCL_INC_DIR}"
509 dnl recent private install. However it would introduce a 513 fi
510 dnl problem if the system install gets upgraded, executables 514 if test \! -r "${ecos_tcl_incdir}/tcl.h" ; then
511 dnl would still try to use the old version and would need 515 AC_MSG_ERROR(unable to locate Tcl header file tcl.h)
512 dnl to be rebuilt. 516 else
513 dnl 517 dnl On Unix systems -I/usr/include is unnecessary, and can
514 dnl For now, do not set ecos_tcl_version automatically. The 518 dnl cause problems on hosts where gcc is not the platform's
515 dnl user can override this. 519 dnl default compiler because of the use of unfixed headers.
516 ecos_LIBS="${ecos_LIBS} -ltcl${ecos_tcl_version} ${TCL_LIBS}" 520 dnl Hence it is explicitly removed here.
517 ecos_LDADD="${ecos_LDADD} -L${ecos_tcl_libdir}" 521 if test "${ecos_tcl_incdir}" != "/usr/include" ; then
518 fi 522 ecos_INCLUDES="${ecos_INCLUDES} -I${ecos_tcl_incdir}"
519 523 fi
520 possible_tk_libdir=`echo ${ecos_tcl_libdir} | sed -e 's,tcl,tk,'` 524 fi
521 possibles="${ecos_tcl_libdir} ${possible_tk_libdir}" 525
522 AC_FIND_FILE("tkConfig.sh", ${possibles}, ecos_tk_libdir) 526 dnl There should be a variable TCL_LIB_SPEC which defines
523 if test \! -r "${ecos_tk_libdir}/tkConfig.sh" ; then 527 dnl exactly how to link with Tcl. Unfortunately this is not
524 AC_MSG_ERROR(unable to locate Tk config file tkConfig.sh) 528 dnl 100% guaranteed, so a backup solution is still needed.
525 else 529 dnl NOTE: there is also TCL_LIBS defining additional libraries
526 . ${ecos_tk_libdir}/tkConfig.sh 530 dnl such as -ldl. That may have to be added to ecos_LIBS.
527 ecos_tk_libs="-L${ecos_tk_libdir} -ltk${ecos_tcl_version} ${TK_LIBS}" 531 if test -z "${TCL_LIB_SPEC}" -a "${with_tcl_version+set}" = set ; then
528 dnl Remove any library duplicates. It is not quite clear why, 532 AC_FIND_FILE("libtcl${with_tcl_version}.a", ${possibles}, libtcl)
529 dnl but they seem to cause problems. 533 if test -r "${libtcl}/libtcl${with_tcl_version}.a" ; then
530 for lib in ${TCL_LIBS} ; do 534 TCL_LIB_SPEC="-L${libtcl} -ltcl${with_tcl_version}"
531 ecos_tk_libs=`echo ${ecos_tk_libs} | sed -e "s!${lib}!!"` 535 fi
532 done 536 fi
533 fi 537 if test -z "${TCL_LIB_SPEC}" ; then
534 fi 538 AC_FIND_FILE("libtcl.a", ${possibles}, libtcl)
535 539 if test -r "${libtcl}/libtcl.a" ; then
536 AC_MSG_RESULT([-I${ecos_tcl_incdir} -L${ecos_tcl_libdir}]) 540 TCL_LIB_SPEC="-L${libtcl} -ltcl"
537 541 fi
542 fi
543 if test -z "${TCL_LIB_SPEC}" ; then
544 AC_MSG_ERROR(${tclconfig}/tclConfig.sh does not define TCL_LIB_SPEC, and unable to find libtcl.a)
545 fi
546 ecos_LIBS="${ecos_LIBS} ${TCL_LIB_SPEC}"
547
548 dnl Next, look for tkConfig.sh
549 possibles=`echo ${possibles} | sed -e 's,tcl,tk,g'`
550 AC_FIND_FILE("tkConfig.sh", ${possibles}, tkconfig)
551 if test \! -r "${tkconfig}/tkConfig.sh" ; then
552 AC_MSG_ERROR(unable to locate Tk config file tkConfig.sh)
553 else
554 . ${tkconfig}/tkConfig.sh
555 if test -z "${TK_INC_DIR}" ; then
556 if test "${TK_PREFIX}" = "/usr" ; then
557 ecos_tk_includes="${TK_XINCLUDES}"
558 else
559 ecos_tk_includes="-I${TK_PREFIX}/include ${TK_XINCLUDES}"
560 fi
561 else
562 ecos_tk_includes="-I${TK_INC_DIR} ${TK_XINCLUDES}"
563 fi
564
565 dnl As with TCL_LIB_SPEC, TK_LIB_SPEC may be empty
566 if test -z "${TK_LIB_SPEC}" -a "${with_tcl_version+set}" = set ; then
567 AC_FIND_FILE("libtk${with_tcl_version}.a", ${possibles}, libtk)
568 if test -r "${libtk}/libtk${with_tcl_version}.a" ; then
569 TK_LIB_SPEC="-L${libtk} -ltk${with_tcl_version}"
570 fi
571 fi
572 if test -z "${TK_LIB_SPEC}" ; then
573 AC_FIND_FILE("libtk.a", ${possibles}, libtk)
574 if test -r "${libtk}/libtk.a" ; then
575 TK_LIB_SPEC="-L${libtk} -ltk"
576 fi
577 fi
578 if test -z "${TK_LIB_SPEC}" ; then
579 AC_MSG_ERROR(${tkconfig}/tkConfig.sh does not define TK_LIB_SPEC, and unable to find libtk.a)
580 fi
581 ecos_tk_libs="${TK_LIB_SPEC} ${TK_LIBS}"
582 fi
583 fi
584 fi
585
586 AC_MSG_RESULT([-I${ecos_tcl_incdir} ${TCL_LIB_SPEC}])
587 AC_SUBST(ecos_tk_includes)
538 AC_SUBST(ecos_tk_libs) 588 AC_SUBST(ecos_tk_libs)
539 ]) 589 ])
540 590
541 dnl ==================================================================== 591 dnl ====================================================================
542 dnl Search for the infrastructure headers. Usually these can be picked 592 dnl Search for the infrastructure headers. Usually these can be picked
583 ecos_infra_incdir="${infra_builddir}" 633 ecos_infra_incdir="${infra_builddir}"
584 else 634 else
585 AC_MSG_ERROR([infrastructure headers not found]) 635 AC_MSG_ERROR([infrastructure headers not found])
586 fi 636 fi
587 if test "${MSVC}" = "yes" ; then 637 if test "${MSVC}" = "yes" ; then
588 ecos_msvc_infra_incdir = ${ecos_infra_incdir} 638 ecos_msvc_infra_incdir=${ecos_infra_incdir}
589 ECOS_MSVC_PATH(ecos_msvc_infra_incdir) 639 ECOS_MSVC_PATH(ecos_msvc_infra_incdir)
590 ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_msvc_infra_incdir}\"" 640 ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_msvc_infra_incdir}\""
591 else 641 else
592 ecos_INCLUDES="${ecos_INCLUDES} -I${ecos_infra_incdir}" 642 ecos_INCLUDES="${ecos_INCLUDES} -I${ecos_infra_incdir}"
593 fi 643 fi
666 fi 716 fi
667 if test \! -r "${ecos_libcdl_incdir}/cdl.hxx" ; then 717 if test \! -r "${ecos_libcdl_incdir}/cdl.hxx" ; then
668 AC_MSG_ERROR([libcdl headers not found]) 718 AC_MSG_ERROR([libcdl headers not found])
669 fi 719 fi
670 if test "${MSVC}" = "yes" ; then 720 if test "${MSVC}" = "yes" ; then
671 ecos_msvc_libcdl_incdir = "${ecos_libcdl_incdir}" 721 ecos_msvc_libcdl_incdir="${ecos_libcdl_incdir}"
672 ECOS_MSVC_PATH(ecos_msvc_libcdl_incdir) 722 ECOS_MSVC_PATH(ecos_msvc_libcdl_incdir)
673 ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_msvc_libcdl_incdir}\"" 723 ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_msvc_libcdl_incdir}\""
674 else 724 else
675 ecos_INCLUDES="${ecos_INCLUDES} -I${ecos_libcdl_incdir}" 725 ecos_INCLUDES="${ecos_INCLUDES} -I${ecos_libcdl_incdir}"
676 fi 726 fi