/[ascend]/trunk/base/autotools/config/tcl.m4
ViewVC logotype

Contents of /trunk/base/autotools/config/tcl.m4

Parent Directory Parent Directory | Revision Log Revision Log


Revision 629 - (show annotations) (download)
Wed May 24 04:34:25 2006 UTC (14 years, 6 months ago) by johnpye
File size: 3180 byte(s)
Added changes to allow autotools build on ubuntu. There were some wrong assumptions
about file locations that I was able to correct using information in the 
tclConfig.sh and tkConfig.sh files. This will need testing on Fedora/Unix/etc.
1 AC_DEFUN(ASC_TCL,
2 [
3 #--------------------------------------------------------------------
4 # Look for Tcl
5 #--------------------------------------------------------------------
6
7 TCLINCLUDE=
8 TCLLIB=
9 TCLPACKAGE=
10
11 AC_ARG_WITH(tclconfig, AC_HELP_STRING([--without-tcl], [Disable Tcl])
12 AC_HELP_STRING([--with-tclconfig=path], [Set directory location of tclConfig.sh]), [with_tclconfig="$withval"], [with_tclconfig=])
13 AC_ARG_WITH(tcl,
14 [ --with-tcl=path Set location of Tcl package],[
15 TCLPACKAGE="$withval"], [TCLPACKAGE=yes])
16 AC_ARG_WITH(tclincl,[ --with-tclincl=path Set location of Tcl include directory],[
17 TCLINCLUDE="$ISYSTEM$withval"], [TCLINCLUDE=])
18 AC_ARG_WITH(tcllib,[ --with-tcllib=path Set location of Tcl library directory],[
19 TCLLIB="-L$withval"], [TCLLIB=])
20
21 # First, check for "--without-tcl" or "--with-tcl=no".
22 if test x"${TCLPACKAGE}" = xno -o x"${with_alllang}" = xno; then
23 AC_MSG_NOTICE([Disabling Tcl])
24 else
25 AC_MSG_CHECKING([for Tcl configuration])
26 # First check to see if --with-tclconfig was specified.
27 if test x"${with_tclconfig}" != x ; then
28 if test -f "${with_tclconfig}/tclConfig.sh" ; then
29 TCLCONFIG=`(cd ${with_tclconfig}; pwd)`
30 else
31 AC_MSG_ERROR([${with_tcl} directory doesn't contain tclConfig.sh])
32 fi
33 fi
34 # check in a few common install locations
35 if test x"${TCLCONFIG}" = x ; then
36 for i in `ls -d /usr/lib 2>/dev/null` \
37 `ls -d /usr/local/lib 2>/dev/null` ; do
38 if test -f "$i/tclConfig.sh" ; then
39 TCLCONFIG=`(cd $i; pwd)`
40 break
41 fi
42 done
43 fi
44 if test x"${TCLCONFIG}" = x ; then
45 AC_MSG_RESULT(no)
46 else
47 AC_MSG_RESULT(found $TCLCONFIG/tclConfig.sh)
48 . $TCLCONFIG/tclConfig.sh
49 if test -z "$TCLINCLUDE"; then
50 TCLINCLUDE=$TCL_INCLUDE_SPEC
51 fi
52 if test -z "$TCLLIB"; then
53 TCLLIB=$TCL_LIB_SPEC
54 fi
55 fi
56
57 if test -z "$TCLINCLUDE"; then
58 if test "x$TCLPACKAGE" != xyes; then
59 TCLINCLUDE="$ISYSTEM$TCLPACKAGE/include"
60 fi
61 fi
62
63 if test -z "$TCLLIB"; then
64 if test "x$TCLPACKAGE" != xyes; then
65 TCLLIB="-L$TCLPACKAGE/lib -ltcl"
66 fi
67 fi
68
69 AC_MSG_CHECKING(for Tcl header files)
70 if test -z "$TCLINCLUDE"; then
71 AC_TRY_CPP([#include <tcl.h>], , TCLINCLUDE="")
72 if test -z "$TCLINCLUDE"; then
73 dirs="/usr/local/include /usr/include /opt/local/include"
74 for i in $dirs ; do
75 if test -r $i/tcl.h; then
76 AC_MSG_RESULT($i)
77 TCLINCLUDE="$ISYSTEM$i"
78 break
79 fi
80 done
81 fi
82 if test -z "$TCLINCLUDE"; then
83 AC_MSG_RESULT(not found)
84 fi
85 else
86 AC_MSG_RESULT($TCLINCLUDE)
87 fi
88
89 AC_MSG_CHECKING(for Tcl library)
90 if test -z "$TCLLIB"; then
91 dirs="/usr/local/lib /usr/lib /opt/local/lib"
92 for i in $dirs ; do
93 if test -r $i/libtcl.a; then
94 AC_MSG_RESULT($i)
95 TCLLIB="-L$i -ltcl"
96 break
97 fi
98 done
99 if test -z "$TCLLIB"; then
100 AC_MSG_RESULT(not found)
101 fi
102 else
103 AC_MSG_RESULT($TCLLIB)
104 fi
105
106 # Cygwin (Windows) needs the library for dynamic linking
107 case $host in
108 *-*-cygwin* | *-*-mingw*) TCLDYNAMICLINKING="$TCLLIB";;
109 *)TCLDYNAMICLINKING="";;
110 esac
111 fi
112
113 NOTCLCONFIG=
114 if test x"${TCLCONFIG}" = x ; then
115 NOTCLCONFIG="# tclConfig.sh dir not found"
116 fi
117 AC_SUBST(TCLINCLUDE)
118 AC_SUBST(NOTCLCONFIG)
119 AC_SUBST(TCLCONFIG)
120 AC_SUBST(TCLLIB)
121 AC_SUBST(TCLDYNAMICLINKING)
122
123 ])

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22