1dnl $Id: configure.in,v 1.1 2000/11/03 00:14:28 idiscovery Exp $
2dnl	This file is an input file used by the GNU "autoconf" program to
3dnl	generate the file "configure", which is run to configure the
4dnl	Makefile in this directory.
5
6AC_INIT(../../generic/tixInit.c)
7
8#--------------------------------------------------------------------
9#	Remove the ./config.cache file and rerun configure if
10#	the cache file belong to a different architecture
11#
12#	This doesn't seem to work in the Cygnus environment,
13#	it causes an error message about having more than
14#	one target, so I disabled it.	meissner@cygnus.com
15#----------------------------------------------------------------------
16#AC_CHECK_PROG(UNAME, uname -a, [uname -a], "")
17#if test "$UNAME" = ""; then
18#    AC_CHECK_PROG(UNAME, uname, [uname], "")
19#fi
20#
21#if test "$UNAME" != ""; then
22#    uname=`$UNAME`
23#    AC_MSG_CHECKING([cached value of \$uname])
24#    AC_CACHE_VAL(ac_cv_prog_uname, [nocached=1 ac_cv_prog_uname=`$UNAME`])
25#    if test "$nocached" = "1"; then
26#	AC_MSG_RESULT(no)
27#    else
28#	AC_MSG_RESULT(yes)
29#    fi
30#
31#    if test "$uname" != "$ac_cv_prog_uname"; then
32#        echo "Running on a different machine/architecture. Can't use cached values"
33#	echo "Removing config.cache and running configure again ..."
34#	rm -f config.cache
35#        CMDLINE="$0 $*"
36#	exec $CMDLINE
37#    fi
38#fi
39
40#----------------------------------------------------------------------
41# We don't want to use any relative path because we need to generate
42# Makefile's in subdirectories
43#----------------------------------------------------------------------
44if test "$INSTALL" = "./install.sh"; then
45    INSTALL=`pwd`/install.sh
46fi
47
48#--------------------------------------------------------------------
49#	Version information about this TIX release.
50#--------------------------------------------------------------------
51
52TIX_VERSION=8.1
53TIX_MAJOR_VERSION=8
54TIX_MINOR_VERSION=1
55
56BIN_VERSION=${TIX_VERSION}.8.2
57
58
59VERSION=${BIN_VERSION}
60
61#--------------------------------------------------------------------
62#	See if user wants to use gcc to compile Tix. This option must
63#	be used before any checking that uses the C compiler.
64#--------------------------------------------------------------------
65
66AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
67    [tix_ok=$enableval], [tix_ok=no])
68if test "$tix_ok" = "yes"; then
69    AC_PROG_CC
70else
71    CC=${CC-cc}
72AC_SUBST(CC)
73fi
74
75AC_PROG_INSTALL
76AC_PROG_RANLIB
77AC_HAVE_HEADERS(unistd.h limits.h)
78AC_PROG_MAKE_SET
79
80#--------------------------------------------------------------------
81#	unsigned char is not supported by some non-ANSI compilers.
82#--------------------------------------------------------------------
83
84AC_MSG_CHECKING([unsigned char])
85AC_TRY_COMPILE([#include <stdio.h>],[
86     unsigned char c = 'c';
87], tcl_ok=supported, tcl_ok=notsupported)
88
89AC_MSG_RESULT($tcl_ok)
90if test $tcl_ok = supported; then
91    AC_DEFINE(UCHAR_SUPPORTED)
92fi
93
94#--------------------------------------------------------------------
95#	Check whether there is an strcasecmp function on this system.
96#	This is a bit tricky because under SCO it's in -lsocket and
97#	under Sequent Dynix it's in -linet.
98#--------------------------------------------------------------------
99
100AC_CHECK_FUNC(strcasecmp, tcl_ok=1, tcl_ok=0)
101if test "$tcl_ok" = 0; then
102    AC_CHECK_LIB(socket, strcasecmp, tcl_ok=1, tcl_ok=0)
103fi
104if test "$tcl_ok" = 0; then
105    AC_CHECK_LIB(inet, strcasecmp, tcl_ok=1, tcl_ok=0)
106fi
107if test "$tcl_ok" = 0; then
108    AC_DEFINE(NO_STRCASECMP)
109fi
110
111# Check for Tcl and Tk.
112CYG_AC_PATH_TCLCONFIG
113CYG_AC_LOAD_TCLCONFIG
114CYG_AC_PATH_TKCONFIG
115CYG_AC_LOAD_TKCONFIG
116CYG_AC_PATH_TCLH
117# FIXME: consider only doing this if --with-x given.
118CYG_AC_PATH_TKH
119
120#--------------------------------------------------------------------
121#	Find out the top level source directory of the Tix package.
122#--------------------------------------------------------------------
123TIX_SRC_DIR=`cd ${srcdir}/../..; pwd`
124
125#--------------------------------------------------------------------
126#	See if we should compile SAM
127#--------------------------------------------------------------------
128
129AC_ARG_ENABLE(sam,
130    [  --enable-sam            build stand-alone modules],
131    [ok=$enableval], [ok=no])
132
133if test "$ok" = "yes"; then
134    TIX_BUILD_SAM="yes"
135    TIX_SAM_TARGETS='$(SAM_TARGETS)'
136else
137    TIX_BUILD_SAM="no"
138fi
139
140	    TIX_SAM_INSTALL=_install_sam_lib_
141
142IS_ITCL=0
143ITCL_BUILD_LIB_SPEC=""
144ITK_BUILD_LIB_SPEC=""
145TIX_EXE_FILE=tixwish
146TCL_SAMEXE_FILE=satclsh
147TK_SAMEXE_FILE=sawish
148TIX_SAMEXE_FILE=satixwish
149
150#--------------------------------------------------------------------
151#	Read in configuration information generated by Tcl for shared
152#	libraries, and arrange for it to be substituted into our
153#	Makefile.
154#--------------------------------------------------------------------
155
156CC=$TCL_CC
157SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
158SHLIB_LD=$TCL_SHLIB_LD
159SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
160SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
161SHLIB_VERSION=$TCL_SHLIB_VERSION
162
163DL_LIBS=$TCL_DL_LIBS
164LD_FLAGS=$TCL_LD_FLAGS
165TIX_LD_SEARCH_FLAGS=$TK_LD_SEARCH_FLAGS
166
167#--------------------------------------------------------------------
168#	Read in configuration information generated by Tk and arrange
169#	for it to be substituted into our Makefile.
170#--------------------------------------------------------------------
171
172TIX_DEFS="$TK_DEFS $TCL_DEFS"
173
174# Note:  in the following variable, it's important to use the absolute
175# path name of the Tcl directory rather than "..":  this is because
176# AIX remembers this path and will attempt to use it at run-time to look
177# up the Tcl library.
178
179if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
180    TIX_BUILD_LIB_SPEC="-L`pwd` -ltix${VERSION}"
181    TIX_BUILD_SAM_SPEC="-L`pwd` -ltixsam${VERSION}"
182    TCL_BUILD_SAM_SPEC="-L`pwd` -ltclsam${TCL_VERSION}"
183    TK_BUILD_SAM_SPEC="-L`pwd` -ltksam${TK_VERSION}"
184    TIX_LIB_SPEC="-L${exec_prefix}/lib -ltix${VERSION}"
185else
186    TIX_BUILD_LIB_SPEC="-L`pwd` -ltix`echo ${VERSION} | tr -d .`"
187    TIX_BUILD_SAM_SPEC="-L`pwd` -ltixsam`echo ${VERSION} | tr -d .`"
188    TCL_BUILD_SAM_SPEC="-L`pwd` -ltclsam`echo ${TCL_VERSION} | tr -d .`"
189    TK_BUILD_SAM_SPEC="-L`pwd` -ltksam`echo ${TK_VERSION} | tr -d .`"
190    TIX_LIB_SPEC="-L${exec_prefix}/lib -ltix`echo ${VERSION} | tr -d .`"
191fi
192
193#--------------------------------------------------------------------
194#	See if we should compile shared library.
195#--------------------------------------------------------------------
196
197AC_ARG_ENABLE(shared,
198    [  --enable-shared         build libtix as a shared library],
199    [ok=$enableval], [ok=no])
200
201if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then
202    TIX_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
203    TIX_RANLIB=":"
204
205    # The main Tix library
206    #
207    eval "TIX_LIB_FILE=libtix${TCL_SHARED_LIB_SUFFIX}"
208    TIX_MAKE_LIB="\${SHLIB_LD} -o ${TIX_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
209
210    # The Tcl SAM library
211    #
212    VERSION=8.2
213    eval "TCL_SAM_FILE=libtclsam${TCL_SHARED_LIB_SUFFIX}"
214    TCL_MAKE_SAM="\${SHLIB_LD} -o ${TCL_SAM_FILE} \${TCL_SAM_OBJS} ${SHLIB_LD_LIBS}"
215
216    # The Tk SAM library
217    #
218    VERSION=8.2
219    eval "TK_SAM_FILE=libtksam${TCL_SHARED_LIB_SUFFIX}"
220    TK_MAKE_SAM="\${SHLIB_LD} -o ${TK_SAM_FILE} \${TK_SAM_OBJS} ${SHLIB_LD_LIBS}"
221
222    # The Tix SAM library
223    #
224    VERSION=${BIN_VERSION}
225    eval "TIX_SAM_FILE=libtixsam${TCL_SHARED_LIB_SUFFIX}"
226    TIX_MAKE_SAM="\${SHLIB_LD} -o ${TIX_SAM_FILE} \${TIX_SAM_OBJS} ${SHLIB_LD_LIBS}"
227
228else
229    TIX_SHLIB_CFLAGS=""
230    TIX_RANLIB='$(RANLIB)'
231
232    # The main Tix library
233    #
234    eval "TIX_LIB_FILE=libtix${TCL_UNSHARED_LIB_SUFFIX}"
235    TIX_MAKE_LIB="ar cr ${TIX_LIB_FILE} \${OBJS}"
236
237    # The Tcl SAM library
238
239    VERSION=8.2
240    eval "TCL_SAM_FILE=libtclsam${TCL_UNSHARED_LIB_SUFFIX}"
241    TCL_MAKE_SAM="ar cr ${TCL_SAM_FILE} \${TCL_SAM_OBJS}"
242
243    # The Tk SAM library
244    #
245    VERSION=8.2
246    eval "TK_SAM_FILE=libtksam${TCL_UNSHARED_LIB_SUFFIX}"
247    TK_MAKE_SAM="ar cr ${TK_SAM_FILE} \${TK_SAM_OBJS}"
248
249    # The Tix SAM library
250    #
251    VERSION=${BIN_VERSION}
252    eval "TIX_SAM_FILE=libtixsam${TCL_UNSHARED_LIB_SUFFIX}"
253    TIX_MAKE_SAM="ar cr ${TIX_SAM_FILE} \${TIX_SAM_OBJS}"
254fi
255
256
257#--------------------------------------------------------------------
258#	Check for the existence of the -lsocket and -lnsl libraries.
259#	The order here is important, so that they end up in the right
260#	order in the command line generated by make.  Here are some
261#	special considerations:
262#	1. Use "connect" and "accept" to check for -lsocket, and
263#	   "gethostbyname" to check for -lnsl.
264#	2. Use each function name only once:  can't redo a check because
265#	   autoconf caches the results of the last check and won't redo it.
266#	3. Use -lnsl and -lsocket only if they supply procedures that
267#	   aren't already present in the normal libraries.  This is because
268#	   IRIX 5.2 has libraries, but they aren't needed and they're
269#	   bogus:  they goof up name resolution if used.
270#	4. On some SVR4 systems, can't use -lsocket without -lnsl too.
271#	   To get around this problem, check for both libraries together
272#	   if -lsocket doesn't work by itself.
273#--------------------------------------------------------------------
274
275checked=0
276for i in $TK_LIBS; do
277    if test "$i" = "-lsocket"; then
278	checked=1
279    fi
280done
281
282if test "$checked" = "0"; then
283    tcl_checkBoth=0
284    AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
285    if test "$tcl_checkSocket" = 1; then
286        AC_CHECK_LIB(socket, main, TK_LIBS="$TK_LIBS -lsocket",
287	    tcl_checkBoth=1)
288    fi
289    if test "$tcl_checkBoth" = 1; then
290        tk_oldLibs=$TK_LIBS
291        TK_LIBS="$TK_LIBS -lsocket -lnsl"
292        AC_CHECK_FUNC(accept, tcl_checkNsl=0, [TK_LIBS=$tk_oldLibs])
293    fi
294    AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main,
295        [TK_LIBS="$TK_LIBS -lnsl"]))
296fi
297
298#----------------------------------------------------------------------
299#	Substitution strings exported by TIX
300#----------------------------------------------------------------------
301AC_SUBST(SHELL)
302AC_SUBST(CC)
303AC_SUBST(RANLIB)
304AC_SUBST(TIX_RANLIB)
305AC_SUBST(SHLIB_CFLAGS)
306AC_SUBST(SHLIB_LD)
307AC_SUBST(SHLIB_LD_LIBS)
308AC_SUBST(SHLIB_SUFFIX)
309AC_SUBST(SHLIB_VERSION)
310AC_SUBST(DL_LIBS)
311AC_SUBST(LD_FLAGS)
312AC_SUBST(TCL_BUILD_LIB_SPEC)
313AC_SUBST(TCL_LIBS)
314AC_SUBST(TCL_VERSION)
315AC_SUBST(TCL_SRC_DIR)
316AC_SUBST(TCL_BIN_DIR)
317AC_SUBST(TK_BUILD_LIB_SPEC)
318AC_SUBST(TK_LIBS)
319AC_SUBST(TK_VERSION)
320AC_SUBST(TK_SRC_DIR)
321AC_SUBST(TK_BIN_DIR)
322AC_SUBST(TK_XINCLUDES)
323AC_SUBST(TIX_LD_SEARCH_FLAGS)
324AC_SUBST(TIX_MAJOR_VERSION)
325AC_SUBST(TIX_MINOR_VERSION)
326AC_SUBST(TIX_VERSION)
327AC_SUBST(TIX_SRC_DIR)
328AC_SUBST(TIX_SHLIB_CFLAGS)
329AC_SUBST(TIX_MAKE_LIB)
330AC_SUBST(TIX_LIB_FILE)
331AC_SUBST(TIX_BUILD_LIB_SPEC)
332AC_SUBST(TIX_LIB_SPEC)
333AC_SUBST(TIX_EXE_FILE)
334AC_SUBST(TIX_SAM_TARGETS)
335AC_SUBST(TIX_SAM_INSTALL)
336AC_SUBST(TCL_SAM_FILE)
337AC_SUBST(TCL_MAKE_SAM)
338AC_SUBST(TK_SAM_FILE)
339AC_SUBST(TK_MAKE_SAM)
340AC_SUBST(TIX_SAM_FILE)
341AC_SUBST(TIX_MAKE_SAM)
342AC_SUBST(TIX_DEFS)
343AC_SUBST(ITCL_BUILD_LIB_SPEC)
344AC_SUBST(ITK_BUILD_LIB_SPEC)
345AC_SUBST(TCL_SAMEXE_FILE)
346AC_SUBST(TK_SAMEXE_FILE)
347AC_SUBST(TIX_SAMEXE_FILE)
348AC_SUBST(TCL_BUILD_SAM_SPEC)
349AC_SUBST(TK_BUILD_SAM_SPEC)
350AC_SUBST(TIX_BUILD_SAM_SPEC)
351AC_SUBST(TCL_PACKAGE_PATH)
352
353# The "binary version" of Tix (see docs/Pkg.txt)
354TIX_VERSION_PKG=${BIN_VERSION}
355AC_SUBST(TIX_VERSION_PKG)
356
357TIXSAM_PKG_FILE="[[file join [file dirname \$dir] ${TIX_SAM_FILE}]]"
358# if test "$TIX_BUILD_SAM" = "yes"; then
359    TIX_SAM_PACKAGE_IFNEEDED="package ifneeded Tixsam ${TIX_VERSION_PKG} [[list load \"${TIXSAM_PKG_FILE}\" Tixsam]]"
360# fi
361
362# The package file, usually a shared library
363TIX_PKG_FILE="[[file join [file dirname \$dir] ${TIX_LIB_FILE}]]"
364AC_SUBST(TIX_PKG_FILE)
365AC_SUBST(TIX_SAM_PACKAGE_IFNEEDED)
366
367AC_OUTPUT(Makefile pkgIndex.tcl ../../tixConfig.sh)
368
369