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

Contents of /trunk/base/autotools/config/tk.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: 3034 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_TK,
2 [
3 #--------------------------------------------------------------------
4 # Look for Tk
5 #--------------------------------------------------------------------
6
7 TKINCLUDE=
8 TKLIB=
9 TKPACKAGE=
10
11 AC_ARG_WITH(tkconfig, AC_HELP_STRING([--without-tk], [Disable Tk])
12 AC_HELP_STRING([--with-tkconfig=path], [Set directory location of tkConfig.sh]), [with_tkconfig="$withval"], [with_tkconfig=])
13 AC_ARG_WITH(tk,
14 [ --with-tk=path Set location of Tk package],[
15 TKPACKAGE="$withval"], [TKPACKAGE=yes])
16 AC_ARG_WITH(tkincl,[ --with-tkincl=path Set location of Tk include directory],[
17 TKINCLUDE="$ISYSTEM$withval"], [TKINCLUDE=])
18 AC_ARG_WITH(tklib,[ --with-tklib=path Set location of Tk library directory],[
19 TKLIB="-L$withval"], [TKLIB=])
20
21 # First, check for "--without-tk" or "--with-tk=no".
22 if test x"${TKPACKAGE}" = xno -o x"${with_alllang}" = xno; then
23 AC_MSG_NOTICE([Disabling Tk])
24 else
25 AC_MSG_CHECKING([for Tk configuration])
26 # First check to see if --with-tkconfig was specified.
27 if test x"${with_tkconfig}" != x ; then
28 if test -f "${with_tkconfig}/tkConfig.sh" ; then
29 TKCONFIG=`(cd ${with_tkconfig}; pwd)`
30 else
31 AC_MSG_ERROR([${with_tk} directory doesn't contain tkConfig.sh])
32 fi
33 fi
34 # check in a few common install locations
35 if test x"${TKCONFIG}" = 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/tkConfig.sh" ; then
39 TKCONFIG=`(cd $i; pwd)`
40 break
41 fi
42 done
43 fi
44 if test x"${TKCONFIG}" = x ; then
45 AC_MSG_RESULT(no)
46 else
47 AC_MSG_RESULT(found $TKCONFIG/tkConfig.sh)
48 . $TKCONFIG/tkConfig.sh
49 if test -z "$TKINCLUDE"; then
50 TKINCLUDE=$TK_INCLUDE_SPEC
51 fi
52 if test -z "$TKLIB"; then
53 TKLIB=$TK_LIB_SPEC
54 fi
55 fi
56
57 if test -z "$TKINCLUDE"; then
58 if test "x$TKPACKAGE" != xyes; then
59 TKINCLUDE="$ISYSTEM$TKPACKAGE/include"
60 fi
61 fi
62
63 if test -z "$TKLIB"; then
64 if test "x$TKPACKAGE" != xyes; then
65 TKLIB="-L$TKPACKAGE/lib -ltk"
66 fi
67 fi
68
69 AC_MSG_CHECKING(for Tk header files)
70 if test -z "$TKINCLUDE"; then
71 AC_TRY_CPP([#include <tk.h>], , TKINCLUDE="")
72 if test -z "$TKINCLUDE"; then
73 dirs="/usr/local/include /usr/include /opt/local/include"
74 for i in $dirs ; do
75 if test -r $i/tk.h; then
76 AC_MSG_RESULT($i)
77 TKINCLUDE="$ISYSTEM$i"
78 break
79 fi
80 done
81 fi
82 if test -z "$TKINCLUDE"; then
83 AC_MSG_RESULT(not found)
84 fi
85 else
86 AC_MSG_RESULT($TKINCLUDE)
87 fi
88
89 AC_MSG_CHECKING(for Tk library)
90 if test -z "$TKLIB"; then
91 dirs="/usr/local/lib /usr/lib /opt/local/lib"
92 for i in $dirs ; do
93 if test -r $i/libtk.a; then
94 AC_MSG_RESULT($i)
95 TKLIB="-L$i -ltk"
96 break
97 fi
98 done
99 if test -z "$TKLIB"; then
100 AC_MSG_RESULT(not found)
101 fi
102 else
103 AC_MSG_RESULT($TKLIB)
104 fi
105
106 # Cygwin (Windows) needs the library for dynamic linking
107 case $host in
108 *-*-cygwin* | *-*-mingw*) TKDYNAMICLINKING="$TKLIB";;
109 *)TKDYNAMICLINKING="";;
110 esac
111 fi
112
113 AC_MSG_CHECKING(for tkconfig)
114 AC_MSG_RESULT($TKCONFIG)
115
116 AC_SUBST(TKINCLUDE)
117 AC_SUBST(TKLIB)
118 AC_SUBST(TKCONFIG)
119 AC_SUBST(TKDYNAMICLINKING)
120
121 ])

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