File: tcltk.m4

package info (click to toggle)
gnu-smalltalk 3.1-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 33,300 kB
  • ctags: 13,999
  • sloc: ansic: 88,106; sh: 23,223; asm: 7,889; perl: 4,493; cpp: 3,539; awk: 1,483; yacc: 1,355; xml: 1,272; makefile: 1,192; lex: 843; sed: 258; objc: 124
file content (152 lines) | stat: -rw-r--r-- 5,396 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
dnl I'd like this to be edited in -*- Autoconf -*- mode...
dnl
AC_DEFUN([GST_HAVE_TCLTK], [

AC_ARG_WITH(tcl, 
	[  --with-tcl=path         set path to tclConfig.sh [default=ask tclsh]])

AC_ARG_WITH(tk, 
	[  --with-tk=path          set path to tkConfig.sh [default=same as Tcl]])

if test "x$with_tcl" = x || test "$with_tcl" = yes; then
  AC_MSG_CHECKING(for tclsh)
  exec AS_MESSAGE_FD([])>/dev/null
  AC_PATH_PROG(TCLSH, tclsh)
  test "$silent" != yes && exec AS_MESSAGE_FD([])>&1
  if test -n "$TCLSH"; then
    for i in ${TCLSH}*; do
      if test -x $i; then
        with_tcl=`echo 'puts $tcl_library' | $i 2> /dev/null`
        if test "x$with_tcl" != x; then
          # Assign the name we found to the TCLSH variable, and try
	  # to remove the last component from the path and to change
	  # /usr/share to /usr/lib
	  TCLSH=$i
          test -f "$with_tcl/tclConfig.sh" && break
          test -f "$with_tcl/../tclConfig.sh" && with_tcl="$with_tcl/.." && break
          test -f "$with_tcl/../../tclConfig.sh" && with_tcl="$with_tcl/../.." && break
          with_tcl=`echo "$with_tcl" | sed 's,\(.*\)/share,\1/lib,'`
          test -f "$with_tcl/tclConfig.sh" && break
          with_tcl=`echo "$with_tcl" | sed 's,/[^/]*/\{0,1\}$,,'`
          test -f "$with_tcl/tclConfig.sh" && break
          with_tcl=`echo "$with_tcl" | sed 's,/[^/]*/\{0,1\}$,,'`
          test -f "$with_tcl/tclConfig.sh" && break
        fi
	with_tcl=no
	TCLSH=no
      fi
    done
  else
    with_tcl=no
    TCLSH=no
  fi
  AC_MSG_RESULT($TCLSH)
fi
if test "x$with_tk" = x || test "$with_tk" = yes; then
  with_tk=`echo "$with_tcl" | sed -e 's/tcl/tk/g' -e 's/tktk/tcltk/g' -e 's/Tcl/Tk/g'`
  test -f "$with_tk/tkConfig.sh" || with_tk=no
fi
if test "$with_tcl" != no; then
  with_tcl=`cd $with_tcl && pwd`
  test -f "$with_tcl/tclConfig.sh" || with_tcl=no
fi
if test "$with_tk" != no; then
  with_tk=`cd $with_tk && pwd`
  test -f "$with_tk/tkConfig.sh" || with_tk=no
fi

AC_MSG_CHECKING(for Tcl 8.x)
AC_MSG_RESULT($with_tcl)
AC_MSG_CHECKING(for Tk 8.x)
AC_MSG_RESULT($with_tk)

save_cppflags="$CPPFLAGS"
save_libs="$LIBS"

AC_CACHE_CHECK(the include path for Tcl/Tk 8.x, gst_cv_tcltk_includes, [
  exec AS_MESSAGE_FD([])>/dev/null

  gst_cv_tcltk_includes="not found"

  if test "$with_tcl" != no && test "$with_tk" != no; then
    # Get the values we need from the Tcl/Tk configuration files
    . $with_tcl/tclConfig.sh
    . $with_tk/tkConfig.sh

    # search for the header files, because some implementations of tclConfig.sh
    # do not deliver correct header includes
    for trial in 0 1 2 3 4; do
      case $trial in
	0) gst_cv_tcltk_includes="$TK_XINCLUDES $TCL_INCLUDE_SPEC" ;;
        1) gst_cv_tcltk_includes="$TK_XINCLUDES -I$TCL_PREFIX/include"
	   test "$TCL_PREFIX" != "$TCL_EXEC_PREFIX" &&
	     gst_cv_tcltk_includes="$gst_cv_tcltk_includes -I$TCL_EXEC_PREFIX/include"
	   test "$TCL_PREFIX" != "$TK_PREFIX" &&
	     gst_cv_tcltk_includes="$gst_cv_tcltk_includes -I$TK_PREFIX/include"
	   test "$TK_PREFIX" != "$TK_EXEC_PREFIX" &&
	     gst_cv_tcltk_includes="$gst_cv_tcltk_includes -I$TK_EXEC_PREFIX/include" ;;
	2) gst_cv_tcltk_includes="$TK_XINCLUDES -I$TCL_SRC_DIR/.."
	   test "$TCL_SRC_DIR" != "$TK_SRC_DIR" &&
	     gst_cv_tcltk_includes="$gst_cv_tcltk_includes -I$TK_SRC_DIR/.." ;;
	3) gst_cv_tcltk_includes="$TK_XINCLUDES -I$TCL_SRC_DIR/include"
	   test "$TCL_SRC_DIR" != "$TK_SRC_DIR" &&
	     gst_cv_tcltk_includes="$gst_cv_tcltk_includes -I$TK_SRC_DIR/include" ;;
	4) gst_cv_tcltk_includes="$TK_XINCLUDES -I$TCL_PREFIX/include/tcl$TCL_VERSION -I$TK_PREFIX/include/tk$TK_VERSION"
	   test "$TCL_PREFIX" != "$TCL_EXEC_PREFIX" &&
	     gst_cv_tcltk_includes="$gst_cv_tcltk_includes -I$TCL_EXEC_PREFIX/include/tcl$TCL_VERSION"
	   test "$TK_PREFIX" != "$TK_EXEC_PREFIX" &&
	     gst_cv_tcltk_includes="$gst_cv_tcltk_includes -I$TK_EXEC_PREFIX/include/tk$TK_VERSION" ;;
      esac

      CPPFLAGS="$save_cppflags $gst_cv_tcltk_includes"
      AC_EGREP_CPP(everything_fine, [
#include <tcl.h>
#include <tk.h>
#ifdef TCL_MAJOR_VERSION
#ifdef TK_MAJOR_VERSION
#if ((TCL_MAJOR_VERSION == $TCL_MAJOR_VERSION) && (TCL_MINOR_VERSION == $TCL_MINOR_VERSION))
#if ((TK_MAJOR_VERSION == $TK_MAJOR_VERSION) && (TCL_MINOR_VERSION == $TCL_MINOR_VERSION))
    everything_fine
#endif
#endif
#endif
#endif], break)

      gst_cv_tcltk_includes="not found"
    done
  fi
    
  test "$silent" != yes && exec AS_MESSAGE_FD([])>&1
])

AC_CACHE_CHECK(how to link with Tcl/Tk 8.x, gst_cv_tcltk_libs, [
  gst_cv_tcltk_libs="not found"
  exec AS_MESSAGE_FD([])>/dev/null

  if test "$gst_cv_tcltk_includes" != "not found"; then
    # The indirection is required by Tcl/Tk
    gst_cv_tcltk_libs="$TCL_LIBS $TK_XLIBSW $TCL_LIB_SPEC $TK_LIB_SPEC"
    gst_cv_tcltk_libs=`eval echo $gst_cv_tcltk_libs`

    CPPFLAGS="$save_cppflags $gst_cv_tcltk_includes"
    LIBS="$save_libs $gst_cv_tcltk_libs"
    AC_CHECK_FUNC(Tcl_ObjSetVar2, , gst_cv_tcltk_libs="not found")
    AC_CHECK_FUNC(Tk_CreatePhotoImageFormat, , gst_cv_tcltk_libs="not found")
  fi

  test "$silent" != yes && exec AS_MESSAGE_FD([])>&1
])

CPPFLAGS="$save_cppflags"
LIBS="$save_libs"

if test "$gst_cv_tcltk_libs" != "not found"; then
  LIBTCLTK="$gst_cv_tcltk_libs"
  INCTCLTK="$gst_cv_tcltk_includes"
  AC_DEFINE(HAVE_TCLTK, 1,
    [Define if your system has Tcl/Tk, 8.0 or later, installed.])
fi

AC_SUBST(LIBTCLTK)
AC_SUBST(INCTCLTK)
])dnl