1 dnl Tcl M4 Routines 2 3 dnl Must call AC_CANONICAL_HOST before calling us 4 AC_DEFUN([TCLEXT_FIND_TCLCONFIG], [ 5 AC_MSG_CHECKING([for path to tclConfig.sh]) 6 7 TCLCONFIGPATH="" 8 AC_ARG_WITH([tcl], AS_HELP_STRING([--with-tcl], [directory containing tcl configuration (tclConfig.sh)]), [ 9 if test "x$withval" = "xno"; then 10 AC_MSG_ERROR([cant build without tcl]) 11 fi 12 13 TCLCONFIGPATH="$withval" 14 ], [ 15 for dir in "/usr/$host_alias/lib" /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64; do 16 if test -f "$dir/tclConfig.sh"; then 17 TCLCONFIGPATH="$dir" 18 19 break 20 fi 21 done 22 ]) 23 24 if test -z "$TCLCONFIGPATH"; then 25 AC_MSG_ERROR([unable to locate tclConfig.sh. Try --with-tcl.]) 26 fi 27 28 for try_tclsh in "$TCLCONFIGPATH/../bin/tclsh" \ 29 "$TCLCONFIGPATH/../bin/tclsh8.6" \ 30 "$TCLCONFIGPATH/../bin/tclsh8.5" \ 31 "$TCLCONFIGPATH/../bin/tclsh8.4" \ 32 `which tclsh 2>/dev/null` \ 33 `which tclsh8.6 2>/dev/null` \ 34 `which tclsh8.5 2>/dev/null` \ 35 `which tclsh8.4 2>/dev/null` \ 36 tclsh; do 37 if test -x "$try_tclsh"; then 38 break 39 fi 40 done 41 TCLSH_PROG="${try_tclsh}" 42 43 AC_SUBST(TCLCONFIGPATH) 44 AC_SUBST(TCLSH_PROG) 45 46 AC_MSG_RESULT([$TCLCONFIGPATH]) 47 ]) 48 49 dnl Must define TCLCONFIGPATH before calling us (i.e., by TCLEXT_FIND_TCLCONFIG) 50 AC_DEFUN([TCLEXT_LOAD_TCLCONFIG], [ 51 AC_MSG_CHECKING([for working tclConfig.sh]) 52 53 if test -f "$TCLCONFIGPATH/tclConfig.sh"; then 54 . "$TCLCONFIGPATH/tclConfig.sh" 55 else 56 AC_MSG_ERROR([unable to load tclConfig.sh]) 57 fi 58 59 60 AC_MSG_RESULT([found]) 61 ]) 62 63 AC_DEFUN([TCLEXT_INIT], [ 64 AC_CANONICAL_HOST 65 66 TCLEXT_FIND_TCLCONFIG 67 TCLEXT_LOAD_TCLCONFIG 68 69 AC_DEFINE_UNQUOTED([MODULE_SCOPE], [static], [Define how to declare a function should only be visible to the current module]) 70 71 AC_ARG_ENABLE([stubs], AS_HELP_STRING([--disable-stubs], [disable use of Tcl stubs]), [ 72 if test "$enableval" = "no"; then 73 TCL_SUPPORTS_STUBS=0 74 else 75 TCL_SUPPORTS_STUBS=1 76 fi 77 ]) 78 79 if test "$TCL_SUPPORTS_STUBS" = "1"; then 80 AC_DEFINE([USE_TCL_STUBS], [1], [Define if you are using the Tcl Stubs Mechanism]) 81 82 TCL_STUB_LIB_SPEC="`eval echo "${TCL_STUB_LIB_SPEC}"`" 83 LIBS="${LIBS} ${TCL_STUB_LIB_SPEC}" 84 else 85 TCL_LIB_SPEC="`eval echo "${TCL_LIB_SPEC}"`" 86 LIBS="${LIBS} ${TCL_LIB_SPEC}" 87 fi 88 89 TCL_INCLUDE_SPEC="`eval echo "${TCL_INCLUDE_SPEC}"`" 90 91 CFLAGS="${CFLAGS} ${TCL_INCLUDE_SPEC}" 92 CPPFLAGS="${CPPFLAGS} ${TCL_INCLUDE_SPEC}" 93 DEFS="${DEFS} ${TCL_DEFS}" 94 95 dnl Needed for package installation 96 TCL_PACKAGE_PATH="`echo "${TCL_PACKAGE_PATH}" | sed 's@ *$''@@' | awk '{ print [$]1 }'`" 97 AC_SUBST(TCL_PACKAGE_PATH) 98 99 AC_SUBST(LIBS) 100 ]) |