summaryrefslogtreecommitdiff
path: root/tix/unix/tk8.3/configure.in
blob: 701c794d28bf6ac4c1c6793306bc912361e15fab (plain)
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
dnl	This file is an input file used by the GNU "autoconf" program to
dnl	generate the file "configure", which is run to configure the
dnl	Makefile in this directory.

AC_INIT(../../generic/tixInit.c)

#--------------------------------------------------------------------
#	Remove the ./config.cache file and rerun configure if
#	the cache file belong to a different architecture
#
#	This doesn't seem to work in the Cygnus environment,
#	it causes an error message about having more than
#	one target, so I disabled it.	meissner@cygnus.com
#----------------------------------------------------------------------
#AC_CHECK_PROG(UNAME, uname -a, [uname -a], "")
#if test "$UNAME" = ""; then
#    AC_CHECK_PROG(UNAME, uname, [uname], "")
#fi
#
#if test "$UNAME" != ""; then
#    uname=`$UNAME`
#    AC_MSG_CHECKING([cached value of \$uname])
#    AC_CACHE_VAL(ac_cv_prog_uname, [nocached=1 ac_cv_prog_uname=`$UNAME`])
#    if test "$nocached" = "1"; then
#	AC_MSG_RESULT(no)
#    else
#	AC_MSG_RESULT(yes)
#    fi
#
#    if test "$uname" != "$ac_cv_prog_uname"; then
#        echo "Running on a different machine/architecture. Can't use cached values"
#	echo "Removing config.cache and running configure again ..."
#	rm -f config.cache
#        CMDLINE="$0 $*"
#	exec $CMDLINE
#    fi
#fi

#----------------------------------------------------------------------
# We don't want to use any relative path because we need to generate
# Makefile's in subdirectories
#----------------------------------------------------------------------
if test "$INSTALL" = "./install.sh"; then
    INSTALL=`pwd`/install.sh
fi

#--------------------------------------------------------------------
#	Version information about this TIX release.
#--------------------------------------------------------------------

TIX_VERSION=4.1
TIX_MAJOR_VERSION=4
TIX_MINOR_VERSION=1

BIN_VERSION=${TIX_VERSION}.8.1


VERSION=${BIN_VERSION}

#--------------------------------------------------------------------
#	See if user wants to use gcc to compile Tix. This option must
#	be used before any checking that uses the C compiler.
#--------------------------------------------------------------------

AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
    [tix_ok=$enableval], [tix_ok=no])
if test "$tix_ok" = "yes"; then
    AC_PROG_CC
else
    CC=${CC-cc}
AC_SUBST(CC)
fi

AC_PROG_INSTALL
AC_PROG_RANLIB
AC_HAVE_HEADERS(unistd.h limits.h)
AC_PROG_MAKE_SET

#--------------------------------------------------------------------
#	unsigned char is not supported by some non-ANSI compilers.
#--------------------------------------------------------------------

AC_MSG_CHECKING([unsigned char])
AC_TRY_COMPILE([#include <stdio.h>],[
     unsigned char c = 'c';
], tcl_ok=supported, tcl_ok=notsupported)

AC_MSG_RESULT($tcl_ok)
if test $tcl_ok = supported; then
    AC_DEFINE(UCHAR_SUPPORTED)
fi

#--------------------------------------------------------------------
#	Check whether there is an strcasecmp function on this system.
#	This is a bit tricky because under SCO it's in -lsocket and
#	under Sequent Dynix it's in -linet.
#--------------------------------------------------------------------

AC_CHECK_FUNC(strcasecmp, tcl_ok=1, tcl_ok=0)
if test "$tcl_ok" = 0; then
    AC_CHECK_LIB(socket, strcasecmp, tcl_ok=1, tcl_ok=0)
fi
if test "$tcl_ok" = 0; then
    AC_CHECK_LIB(inet, strcasecmp, tcl_ok=1, tcl_ok=0)
fi
if test "$tcl_ok" = 0; then
    AC_DEFINE(NO_STRCASECMP)
fi

# Check for Tcl and Tk.
CYG_AC_PATH_TCLCONFIG
CYG_AC_LOAD_TCLCONFIG
CYG_AC_PATH_TKCONFIG
CYG_AC_LOAD_TKCONFIG
CYG_AC_PATH_TCLH
# FIXME: consider only doing this if --with-x given.
CYG_AC_PATH_TKH

#--------------------------------------------------------------------
#	Find out the top level source directory of the Tix package.
#--------------------------------------------------------------------
TIX_SRC_DIR=`cd ${srcdir}/../..; pwd`

#--------------------------------------------------------------------
#	See if we should compile SAM
#--------------------------------------------------------------------

AC_ARG_ENABLE(sam,
    [  --enable-sam            build stand-alone modules],
    [ok=$enableval], [ok=no])

if test "$ok" = "yes"; then
    TIX_BUILD_SAM="yes"
    TIX_SAM_TARGETS='$(SAM_TARGETS)'
else
    TIX_BUILD_SAM="no"
fi

	    TIX_SAM_INSTALL=_install_sam_lib_

IS_ITCL=0
ITCL_BUILD_LIB_SPEC=""
ITK_BUILD_LIB_SPEC=""
TIX_EXE_FILE=tixwish
TCL_SAMEXE_FILE=satclsh
TK_SAMEXE_FILE=sawish
TIX_SAMEXE_FILE=satixwish

#--------------------------------------------------------------------
#	Read in configuration information generated by Tcl for shared
#	libraries, and arrange for it to be substituted into our
#	Makefile.
#--------------------------------------------------------------------

CC=$TCL_CC
SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
SHLIB_LD=$TCL_SHLIB_LD
SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
SHLIB_VERSION=$TCL_SHLIB_VERSION

DL_LIBS=$TCL_DL_LIBS
LD_FLAGS=$TCL_LD_FLAGS
TIX_LD_SEARCH_FLAGS=$TCL_LD_SEARCH_FLAGS

#--------------------------------------------------------------------
#	Read in configuration information generated by Tk and arrange
#	for it to be substituted into our Makefile.
#--------------------------------------------------------------------

TIX_DEFS="$TK_DEFS $TCL_DEFS"

# Note:  in the following variable, it's important to use the absolute
# path name of the Tcl directory rather than "..":  this is because
# AIX remembers this path and will attempt to use it at run-time to look
# up the Tcl library.

TIX_BUILD_LOCATION="`pwd`"
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
    TIX_BUILD_LIB_SPEC="-L`pwd` -ltix${VERSION}"
    TIX_BUILD_SAM_SPEC="-L`pwd` -ltixsam${VERSION}"
    TCL_BUILD_SAM_SPEC="-L`pwd` -ltclsam${TCL_VERSION}"
    TK_BUILD_SAM_SPEC="-L`pwd` -ltksam${TK_VERSION}"
    TIX_LIB_SPEC="-L${exec_prefix}/lib -ltix${VERSION}"
else
    TIX_BUILD_LIB_SPEC="-L`pwd` -ltix`echo ${VERSION} | tr -d .`"
    TIX_BUILD_SAM_SPEC="-L`pwd` -ltixsam`echo ${VERSION} | tr -d .`"
    TCL_BUILD_SAM_SPEC="-L`pwd` -ltclsam`echo ${TCL_VERSION} | tr -d .`"
    TK_BUILD_SAM_SPEC="-L`pwd` -ltksam`echo ${TK_VERSION} | tr -d .`"
    TIX_LIB_SPEC="-L${exec_prefix}/lib -ltix`echo ${VERSION} | tr -d .`"
fi

#--------------------------------------------------------------------
#	See if we should compile shared library.
#--------------------------------------------------------------------

AC_ARG_ENABLE(shared,
    [  --enable-shared         build libtix as a shared library],
    [ok=$enableval], [ok=no])

if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then
    TIX_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
    TIX_RANLIB=":"

    # The main Tix library
    #
    eval "TIX_LIB_FILE=libtix${TCL_SHARED_LIB_SUFFIX}"
    TIX_MAKE_LIB="\${SHLIB_LD} -o ${TIX_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"

    # The Tcl SAM library
    #
    VERSION=8.1
    eval "TCL_SAM_FILE=libtclsam${TCL_SHARED_LIB_SUFFIX}"
    TCL_MAKE_SAM="\${SHLIB_LD} -o ${TCL_SAM_FILE} \${TCL_SAM_OBJS} ${SHLIB_LD_LIBS}"
    
    # The Tk SAM library
    #
    VERSION=8.1
    eval "TK_SAM_FILE=libtksam${TCL_SHARED_LIB_SUFFIX}"
    TK_MAKE_SAM="\${SHLIB_LD} -o ${TK_SAM_FILE} \${TK_SAM_OBJS} ${SHLIB_LD_LIBS}"
    
    # The Tix SAM library
    #
    VERSION=${BIN_VERSION}
    eval "TIX_SAM_FILE=libtixsam${TCL_SHARED_LIB_SUFFIX}"
    TIX_MAKE_SAM="\${SHLIB_LD} -o ${TIX_SAM_FILE} \${TIX_SAM_OBJS} ${SHLIB_LD_LIBS}"

else
    TIX_SHLIB_CFLAGS=""
    TIX_RANLIB='$(RANLIB)'

    # The main Tix library
    #
    eval "TIX_LIB_FILE=libtix${TCL_UNSHARED_LIB_SUFFIX}"
    TIX_MAKE_LIB="ar cr ${TIX_LIB_FILE} \${OBJS}"

    # The Tcl SAM library
    
    VERSION=8.1
    eval "TCL_SAM_FILE=libtclsam${TCL_UNSHARED_LIB_SUFFIX}"
    TCL_MAKE_SAM="ar cr ${TCL_SAM_FILE} \${TCL_SAM_OBJS}"
    
    # The Tk SAM library
    #
    VERSION=8.1
    eval "TK_SAM_FILE=libtksam${TCL_UNSHARED_LIB_SUFFIX}"
    TK_MAKE_SAM="ar cr ${TK_SAM_FILE} \${TK_SAM_OBJS}"
    
    # The Tix SAM library
    #
    VERSION=${BIN_VERSION}
    eval "TIX_SAM_FILE=libtixsam${TCL_UNSHARED_LIB_SUFFIX}"
    TIX_MAKE_SAM="ar cr ${TIX_SAM_FILE} \${TIX_SAM_OBJS}"
fi

TIX_LIB_FULL_PATH="`pwd`/${TIX_LIB_FILE}"

#--------------------------------------------------------------------
#	Check for the existence of the -lsocket and -lnsl libraries.
#	The order here is important, so that they end up in the right
#	order in the command line generated by make.  Here are some
#	special considerations:
#	1. Use "connect" and "accept" to check for -lsocket, and
#	   "gethostbyname" to check for -lnsl.
#	2. Use each function name only once:  can't redo a check because
#	   autoconf caches the results of the last check and won't redo it.
#	3. Use -lnsl and -lsocket only if they supply procedures that
#	   aren't already present in the normal libraries.  This is because
#	   IRIX 5.2 has libraries, but they aren't needed and they're
#	   bogus:  they goof up name resolution if used.
#	4. On some SVR4 systems, can't use -lsocket without -lnsl too.
#	   To get around this problem, check for both libraries together
#	   if -lsocket doesn't work by itself.
#--------------------------------------------------------------------

checked=0
for i in $TK_LIBS; do
    if test "$i" = "-lsocket"; then
	checked=1
    fi
done

if test "$checked" = "0"; then
    tcl_checkBoth=0
    AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
    if test "$tcl_checkSocket" = 1; then
        AC_CHECK_LIB(socket, main, TK_LIBS="$TK_LIBS -lsocket",
	    tcl_checkBoth=1)
    fi
    if test "$tcl_checkBoth" = 1; then
        tk_oldLibs=$TK_LIBS
        TK_LIBS="$TK_LIBS -lsocket -lnsl"
        AC_CHECK_FUNC(accept, tcl_checkNsl=0, [TK_LIBS=$tk_oldLibs])
    fi
    AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main,
        [TK_LIBS="$TK_LIBS -lnsl"]))
fi

#----------------------------------------------------------------------
#	Substitution strings exported by TIX
#----------------------------------------------------------------------
AC_SUBST(CC)
AC_SUBST(RANLIB)
AC_SUBST(TIX_RANLIB)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_LD_LIBS)
AC_SUBST(SHLIB_SUFFIX)
AC_SUBST(SHLIB_VERSION)
AC_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LOCATION)

# The "binary version" of Tix (see docs/Pkg.txt)
TIX_VERSION_PKG=${BIN_VERSION}
AC_SUBST(TIX_VERSION_PKG)

TIXSAM_PKG_FILE="[[file join [file dirname \$dir] ${TIX_SAM_FILE}]]"
if test "$TIX_BUILD_SAM" = "yes"; then
    TIX_SAM_PACKAGE_IFNEEDED="package ifneeded Tixsam ${TIX_VERSION_PKG} [[list load \"${TIXSAM_PKG_FILE}\" Tixsam]]"
fi

# The package file, usually a shared library
TIX_PKG_FILE="[[file join [file dirname \$dir] ${TIX_LIB_FILE}]]"
AC_SUBST(TIX_PKG_FILE)
AC_SUBST(TIX_SAM_PACKAGE_IFNEEDED)

AC_OUTPUT(Makefile pkgIndex.tcl ../../tixConfig.sh)