ccba64e299bf8c890fc80906170fe78da2b69c7c
[tclrobot.git] / configure.in
1 dnl (c) Index Data 1996-2000
2 dnl See the file LICENSE for details.
3 dnl $Id: configure.in,v 1.6 2001/01/23 12:05:07 adam Exp $
4 AC_INIT(hswitch.c)
5 dnl ------ Substitutions
6 AC_SUBST(CC)
7 AC_SUBST(TCLLIB)
8 AC_SUBST(TCLINC)
9 AC_SUBST(SHLIB_CFLAGS)
10 AC_SUBST(SHLIB_LD)
11 AC_SUBST(SHLIB_SUFFIX)
12 AC_SUBST(SHLIB_VERSION)
13 AC_PROG_INSTALL
14 dnl
15 dnl ------ look for Tcl
16 tclconfig=NONE
17 tryprefix=NONE
18 AC_ARG_WITH(tclconfig, [  --with-tclconfig        Path for tclConfig.sh/tkConfig.sh], [tclconfig=$withval])
19 if test "x$tclconfig" = xNONE; then
20         saveprefix=${prefix}
21         AC_PREFIX_PROGRAM(tclsh)
22         if test "x$prefix" = xNONE; then
23                 AC_PREFIX_PROGRAM(tclsh8.3)
24         fi
25         if test "x$prefix" = xNONE; then
26                 AC_PREFIX_PROGRAM(tclsh8.2)
27         fi
28         if test "x$prefix" = xNONE; then
29                 AC_PREFIX_PROGRAM(tclsh8.1)
30         fi
31         if test "x$prefix" = xNONE; then
32                 AC_PREFIX_PROGRAM(tclsh8.0)
33         fi
34         if test "x$prefix" = xNONE; then
35                 AC_PREFIX_PROGRAM(tclsh7.6)
36         fi
37         if test "x$prefix" = xNONE; then
38                 AC_PREFIX_PROGRAM(tclsh7.5)
39         fi
40         if test "x$prefix" = xNONE; then
41                 prefix=/usr/local
42         fi
43         tclconfig=${prefix}/lib
44         tryprefix=${prefix}
45         prefix=${saveprefix}
46 fi
47 if test -r ${tclconfig}/tclConfig.sh; then
48         AC_MSG_CHECKING(for Tcl)
49         . ${tclconfig}/tclConfig.sh
50         TCLLIB="${TCL_LIB_SPEC} ${TCL_LIBS}"
51         TCLINC=-I${TCL_PREFIX}/include
52         RANLIB=$TCL_RANLIB
53         SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
54         SHLIB_LD=$TCL_SHLIB_LD
55         SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
56         SHLIB_VERSION=$TCL_SHLIB_VERSION
57         AC_MSG_RESULT($TCL_VERSION)
58         CC=$TCL_CC
59 else
60         AC_PROG_CC
61         SHLIB_CFLAGS=""
62         SHLIB_LD="shared-linker"
63         SHLIB_SUFFIX=""
64         SHLIB_VERSION=""
65         AC_PROG_RANLIB
66         AC_MSG_CHECKING(for Tcl)
67         TCL_VERSION=nope
68         for i in "" 7.4 7.5 7.6 8.0; do
69                 if test -r ${tryprefix}/lib/libtcl${i}.a; then
70                         TCL_VERSION=$i
71                 fi
72         done
73         if test "$TCL_VERSION" = nope; then
74                 AC_MSG_WARN(Didn't find Tcl)
75                 TCL_LIB_SPEC=-ltcl
76                 TCLINC=" # -I.. Tcl/Tk include path"
77         else
78                 if test "$TCL_VERSION" = ""; then
79                         AC_MSG_RESULT(7.3)
80                 else
81                         AC_MSG_RESULT($TCL_VERSION)
82                 fi
83                 TCL_LIB_SPEC=${tryprefix}/lib/libtcl${TCL_VERSION}.a
84                 TCLINC=-I${tryprefix}/include
85         fi
86         TCLLIB="${TCL_LIB_SPEC} ${LIBS} -lm"
87 fi
88 AC_OUTPUT(Makefile)