2
dnl This file is an input file used by the GNU "autoconf" program to
3
dnl generate the file "configure", which is run during Tk installation
4
dnl to configure the system for the local environment.
5
AC_INIT(../generic/tk.h)
6
# RCS: @(#) $Id: configure.in,v 1.26 1999/02/04 21:00:29 stanton Exp $
14
if test "${prefix}" = "NONE"; then
17
if test "${exec_prefix}" = "NONE"; then
20
TK_SRC_DIR=`cd $srcdir/..; pwd`
23
AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available],
24
[tk_ok=$enableval], [tk_ok=no])
25
if test "$tk_ok" = "yes"; then
32
AC_HAVE_HEADERS(unistd.h limits.h)
34
# set the warning flags depending on whether or not we are using gcc
35
if test "${GCC}" = "yes" ; then
36
# leave -Wimplicit-int out, the X libs generate so many of these warnings
37
# that they obscure everything else.
39
CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
44
#------------------------------------------------------------------------------
45
# If we're using GCC, see if the compiler understands -pipe. If so, use it.
46
# It makes compiling go faster. (This is only a performance feature.)
47
#------------------------------------------------------------------------------
49
if test -z "$no_pipe"; then
50
if test -n "$GCC"; then
51
AC_MSG_CHECKING([if the compiler understands -pipe])
61
#--------------------------------------------------------------------
62
# See if there was a command-line option for where Tcl is; if
63
# not, assume that its top-level directory is a sibling of ours.
64
#--------------------------------------------------------------------
66
AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.0 binaries from DIR],
67
TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd ../../tcl8.0$TK_PATCH_LEVEL/unix; pwd`)
68
if test ! -d $TCL_BIN_DIR; then
69
AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR doesn't exist)
71
if test ! -f $TCL_BIN_DIR/Makefile; then
72
AC_MSG_ERROR(There's no Makefile in $TCL_BIN_DIR; perhaps you didn't specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?)
75
#--------------------------------------------------------------------
76
# Read in configuration information generated by Tcl for shared
77
# libraries, and arrange for it to be substituted into our
79
#--------------------------------------------------------------------
81
file=$TCL_BIN_DIR/tclConfig.sh
84
# Set the default compiler switches based on the --enable-symbols option
86
AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols],
87
[tcl_ok=$enableval], [tcl_ok=no])
88
if test "$tcl_ok" = "yes"; then
89
CFLAGS_DEFAULT=CFLAGS_DEBUG
92
CFLAGS_DEFAULT=CFLAGS_OPTIMIZE
96
SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
97
SHLIB_LD=$TCL_SHLIB_LD
98
SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
99
SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
100
SHLIB_VERSION=$TCL_SHLIB_VERSION
102
LD_FLAGS=$TCL_LD_FLAGS
103
CFLAGS_DEBUG=$TCL_CFLAGS_DEBUG
104
CFLAGS_OPTIMIZE=$TCL_CFLAGS_OPTIMIZE
105
EXTRA_CFLAGS=$TCL_EXTRA_CFLAGS
107
LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}'
109
# If Tcl and Tk are installed in different places, adjust the library
110
# search path to reflect this.
112
if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
113
LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib"
116
#--------------------------------------------------------------------
117
# Supply a substitute for stdlib.h if it doesn't define strtol,
118
# strtoul, or strtod (which it doesn't in some versions of SunOS).
119
#--------------------------------------------------------------------
121
AC_MSG_CHECKING(stdlib.h)
122
AC_HEADER_EGREP(strtol, stdlib.h, tk_ok=yes, tk_ok=no)
123
AC_HEADER_EGREP(strtoul, stdlib.h, , tk_ok=no)
124
AC_HEADER_EGREP(strtod, stdlib.h, , tk_ok=no)
125
if test $tk_ok = no; then
126
AC_DEFINE(NO_STDLIB_H)
128
AC_MSG_RESULT($tk_ok)
130
#--------------------------------------------------------------------
131
# Include sys/select.h if it exists and if it supplies things
132
# that appear to be useful and aren't already in sys/types.h.
133
# This appears to be true only on the RS/6000 under AIX. Some
134
# systems like OSF/1 have a sys/select.h that's of no use, and
135
# other systems like SCO UNIX have a sys/select.h that's
136
# pernicious. If "fd_set" isn't defined anywhere then set a
138
#--------------------------------------------------------------------
140
AC_MSG_CHECKING([fd_set and sys/select])
141
AC_TRY_COMPILE([#include <sys/types.h>],
142
[fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
143
if test $tk_ok = no; then
144
AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
145
if test $tk_ok = yes; then
146
AC_DEFINE(HAVE_SYS_SELECT_H)
149
AC_MSG_RESULT($tk_ok)
150
if test $tk_ok = no; then
154
#--------------------------------------------------------------------
155
# Check for various typedefs and provide substitutes if
157
#--------------------------------------------------------------------
164
#------------------------------------------------------------------------------
165
# Find out about time handling differences.
166
#------------------------------------------------------------------------------
168
AC_CHECK_HEADERS(sys/time.h)
171
#--------------------------------------------------------------------
172
# Locate the X11 header files and the X11 library archive. Try
173
# the ac_path_x macro first, but if it doesn't find the X stuff
174
# (e.g. because there's no xmkmf program) then check through
175
# a list of possible directories. Under some conditions the
176
# autoconf macro will return an include directory that contains
177
# no include files, so double-check its result just to be safe.
178
#--------------------------------------------------------------------
182
if test "$no_x" = ""; then
183
if test "$x_includes" = ""; then
184
AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
186
if test ! -r $x_includes/X11/Intrinsic.h; then
187
not_really_there="yes"
191
if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
192
AC_MSG_CHECKING(for X11 header files)
193
XINCLUDES="# no special path needed"
194
AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
195
if test "$XINCLUDES" = nope; then
196
dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
198
if test -r $i/X11/Intrinsic.h; then
206
if test "$x_includes" != ""; then
207
XINCLUDES=-I$x_includes
209
XINCLUDES="# no special path needed"
212
if test "$XINCLUDES" = nope; then
213
AC_MSG_RESULT(couldn't find any!)
214
XINCLUDES="# no include files found"
217
if test "$no_x" = yes; then
218
AC_MSG_CHECKING(for X11 libraries)
220
dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
222
if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
230
if test "$x_libraries" = ""; then
233
XLIBSW="-L$x_libraries -lX11"
236
if test "$XLIBSW" = nope ; then
237
AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
239
if test "$XLIBSW" = nope ; then
240
AC_MSG_RESULT(couldn't find any! Using -lX11.)
244
#--------------------------------------------------------------------
245
# Various manipulations on the search path used at runtime to
246
# find shared libraries:
247
# 1. If the X library binaries are in a non-standard directory,
248
# add the X library location into that search path.
249
# 2. On systems such as AIX and Ultrix that use "-L" as the
250
# search path option, colons cannot be used to separate
251
# directories from each other. Change colons to " -L".
252
# 3. Create two sets of search flags, one for use in cc lines
253
# and the other for when the linker is invoked directly. In
254
# the second case, '-Wl,' must be stripped off and commas must
255
# be replaced by spaces.
256
#--------------------------------------------------------------------
258
if test "x${x_libraries}" != "x"; then
259
LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}"
261
if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then
262
LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'`
265
# The statement below is very tricky! It actually *evaluates* the
266
# string in TCL_LD_SEARCH_FLAGS, which causes a substitution of the
267
# variable LIB_RUNTIME_DIR.
269
eval "TK_CC_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
271
# The following case handles the differences between linking with "ld"
276
TK_LD_SEARCH_FLAGS=`echo ${TK_CC_SEARCH_FLAGS} |sed -e "s|-Wl,||g" -e "s|,| |g"`
279
TK_LD_SEARCH_FLAGS="${TK_CC_SEARCH_FLAGS}"
283
#--------------------------------------------------------------------
284
# Check for the existence of various libraries. The order here
285
# is important, so that then end up in the right order in the
286
# command line generated by make. The -lsocket and -lnsl libraries
287
# require a couple of special tricks:
288
# 1. Use "connect" and "accept" to check for -lsocket, and
289
# "gethostbyname" to check for -lnsl.
290
# 2. Use each function name only once: can't redo a check because
291
# autoconf caches the results of the last check and won't redo it.
292
# 3. Use -lnsl and -lsocket only if they supply procedures that
293
# aren't already present in the normal libraries. This is because
294
# IRIX 5.2 has libraries, but they aren't needed and they're
295
# bogus: they goof up name resolution if used.
296
# 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
297
# To get around this problem, check for both libraries together
298
# if -lsocket doesn't work by itself.
299
#--------------------------------------------------------------------
301
AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])
304
AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
305
if test "$tk_checkSocket" = 1; then
306
AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tk_checkBoth=1)
308
if test "$tk_checkBoth" = 1; then
310
LIBS="$LIBS -lsocket -lnsl"
311
AC_CHECK_FUNC(accept, tk_checkNsl=0, [LIBS=$tk_oldLibs])
313
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
315
#--------------------------------------------------------------------
316
# One more check related to the X libraries. The standard releases
317
# of Ultrix don't support the "xauth" mechanism, so send won't work
318
# unless TK_NO_SECURITY is defined. However, there are usually copies
319
# of the MIT X server available as well, which do support xauth.
320
# Check for the MIT stuff and use it if it exists.
322
# Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
323
# because it can't deal with the "-" in the library name.
324
#--------------------------------------------------------------------
326
if test -d /usr/include/mit ; then
327
AC_MSG_CHECKING([MIT X libraries])
329
CFLAGS="$CFLAGS -I/usr/include/mit"
331
LIBS="$LIBS -lX11-mit"
333
#include <X11/Xlib.h>
339
XINCLUDES="-I/usr/include/mit"
340
], AC_MSG_RESULT(no))
345
#--------------------------------------------------------------------
346
# On a few very rare systems, all of the libm.a stuff is
347
# already in libc.a. Set compiler flags accordingly.
348
# Also, Linux requires the "ieee" library for math to
349
# work right (and it must appear before "-lm").
350
#--------------------------------------------------------------------
353
AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
354
AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
356
#--------------------------------------------------------------------
357
# If this system doesn't have a memmove procedure, use memcpy
359
#--------------------------------------------------------------------
361
AC_CHECK_FUNC(memmove, , [AC_DEFINE(memmove, memcpy)])
363
#--------------------------------------------------------------------
364
# Figure out whether "char" is unsigned. If so, set a
365
# #define for __CHAR_UNSIGNED__.
366
#--------------------------------------------------------------------
370
#--------------------------------------------------------------------
371
# Under Solaris 2.4, strtod returns the wrong value for the
372
# terminating character under some conditions. Check for this
373
# and if the problem exists use a substitute procedure
374
# "fixstrtod" (provided by Tcl) that corrects the error.
375
#--------------------------------------------------------------------
377
AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0)
378
if test "$tk_strtod" = 1; then
379
AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
381
extern double strtod();
384
char *string = "NaN";
386
strtod(string, &term);
387
if ((term != string) && (term[-1] == 0)) {
391
}], tk_ok=1, tk_ok=0, tk_ok=0)
392
if test "$tk_ok" = 1; then
396
AC_DEFINE(strtod, fixstrtod)
400
#--------------------------------------------------------------------
401
# The statements below define a collection of symbols related to
402
# building libtk as a shared library instead of a static library.
403
#--------------------------------------------------------------------
405
AC_ARG_ENABLE(shared,
406
[ --enable-shared build libtk as a shared library],
407
[ok=$enableval], [ok=no])
408
if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then
410
TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
411
TK_LIB_FILE=libtk${TCL_SHARED_LIB_SUFFIX}
412
MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${SHLIB_LD_LIBS}"
417
TK_LIB_FILE=libtk${TCL_UNSHARED_LIB_SUFFIX}
418
MAKE_LIB="ar cr \${TK_LIB_FILE} \${OBJS}"
422
eval "TK_LIB_FILE=${TK_LIB_FILE}"
424
# Note: in the following variable, it's important to use the absolute
425
# path name of the Tcl directory rather than "..": this is because
426
# AIX remembers this path and will attempt to use it at run-time to look
427
# up the Tcl library.
429
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
430
TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}"
432
TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}"
434
TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}"
435
TK_LIB_SPEC="-L${exec_prefix}/lib ${TK_LIB_FLAG}"
437
AC_SUBST(CFLAGS_DEBUG)
438
AC_SUBST(CFLAGS_DEFAULT)
439
AC_SUBST(CFLAGS_OPTIMIZE)
440
AC_SUBST(CFLAGS_WARNING)
443
AC_SUBST(EXTRA_CFLAGS)
447
AC_SUBST(SHLIB_CFLAGS)
449
AC_SUBST(SHLIB_LD_LIBS)
450
AC_SUBST(SHLIB_SUFFIX)
451
AC_SUBST(SHLIB_VERSION)
452
AC_SUBST(TCL_BIN_DIR)
453
AC_SUBST(TCL_BUILD_LIB_SPEC)
455
AC_SUBST(TCL_LIB_FLAG)
456
AC_SUBST(TCL_SRC_DIR)
457
AC_SUBST(TCL_VERSION)
458
AC_SUBST(TK_BUILD_LIB_SPEC)
459
AC_SUBST(TK_CC_SEARCH_FLAGS)
460
AC_SUBST(TK_LD_SEARCH_FLAGS)
461
AC_SUBST(TK_LIB_FILE)
462
AC_SUBST(TK_LIB_FLAG)
463
AC_SUBST(TK_LIB_SPEC)
464
AC_SUBST(TK_MAJOR_VERSION)
465
AC_SUBST(TK_MINOR_VERSION)
466
AC_SUBST(TK_PATCH_LEVEL)
467
AC_SUBST(TK_SHLIB_CFLAGS)
472
AC_SUBST(TK_SHARED_BUILD)
474
AC_OUTPUT(Makefile tkConfig.sh)