336 lines
11 KiB
Plaintext
336 lines
11 KiB
Plaintext
dnl This file is an input file used by the GNU "autoconf" program to
|
|
dnl generate the file "configure", which is run during Tk installation
|
|
dnl to configure the system for the local environment.
|
|
AC_INIT(tk.h)
|
|
|
|
# @(#) configure.in 1.17 95/06/27 21:54:20
|
|
|
|
AC_PROG_INSTALL
|
|
AC_PROG_RANLIB
|
|
AC_PREFIX_PROGRAM(wish)
|
|
CC=${CC-cc}
|
|
AC_SUBST(CC)
|
|
AC_HAVE_HEADERS(unistd.h limits.h)
|
|
|
|
#--------------------------------------------------------------------
|
|
# Include sys/select.h if it exists and if it supplies things
|
|
# that appear to be useful and aren't already in sys/types.h.
|
|
# This appears to be true only on the RS/6000 under AIX. Some
|
|
# systems like OSF/1 have a sys/select.h that's of no use, and
|
|
# other systems like SCO UNIX have a sys/select.h that's
|
|
# pernicious. If "fd_set" isn't defined anywhere then set a
|
|
# special flag.
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_MSG_CHECKING([fd_set and sys/select])
|
|
AC_TRY_COMPILE([#include <sys/types.h>],
|
|
[fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
|
|
if test $tk_ok = no; then
|
|
AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
|
|
if test $tk_ok = yes; then
|
|
AC_DEFINE(HAVE_SYS_SELECT_H)
|
|
fi
|
|
fi
|
|
AC_MSG_RESULT($tk_ok)
|
|
if test $tk_ok = no; then
|
|
AC_DEFINE(NO_FD_SET)
|
|
fi
|
|
|
|
#--------------------------------------------------------------------
|
|
# Supply a substitute for stdlib.h if it doesn't define strtol,
|
|
# strtoul, or strtod (which it doesn't in some versions of SunOS).
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_MSG_CHECKING(stdlib.h)
|
|
AC_HEADER_EGREP(strtol, stdlib.h, tk_ok=yes, tk_ok=no)
|
|
AC_HEADER_EGREP(strtoul, stdlib.h, , tk_ok=no)
|
|
AC_HEADER_EGREP(strtod, stdlib.h, , tk_ok=no)
|
|
if test $tk_ok = no; then
|
|
AC_DEFINE(NO_STDLIB_H)
|
|
fi
|
|
AC_MSG_RESULT($tk_ok)
|
|
|
|
#--------------------------------------------------------------------
|
|
# Check for various typedefs and provide substitutes if
|
|
# they don't exist.
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_MODE_T
|
|
AC_PID_T
|
|
AC_SIZE_T
|
|
AC_UID_T
|
|
|
|
#--------------------------------------------------------------------
|
|
# Locate the X11 header files and the X11 library archive. Try
|
|
# the ac_path_x macro first, but if it doesn't find the X stuff
|
|
# (e.g. because there's no xmkmf program) then check through
|
|
# a list of possible directories. Under some conditions the
|
|
# autoconf macro will return an include directory that contains
|
|
# no include files, so double-check its result just to be safe.
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_PATH_X
|
|
not_really_there=""
|
|
if test "$no_x" = ""; then
|
|
if test "$x_includes" = ""; then
|
|
AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
|
|
else
|
|
if test ! -r $x_includes/X11/Intrinsic.h; then
|
|
not_really_there="yes"
|
|
fi
|
|
fi
|
|
fi
|
|
if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
|
|
echo checking for X11 header files
|
|
XINCLUDES="# no special path needed"
|
|
AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
|
|
if test "$XINCLUDES" = nope; then
|
|
dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include /usr/sww/include"
|
|
for i in $dirs ; do
|
|
if test -r $i/X11/Intrinsic.h; then
|
|
XINCLUDES=" -I$i"
|
|
fi
|
|
done
|
|
fi
|
|
else
|
|
if test "$x_includes" != ""; then
|
|
XINCLUDES=-I$x_includes
|
|
else
|
|
XINCLUDES="# no special path needed"
|
|
fi
|
|
fi
|
|
if test "$XINCLUDES" = nope; then
|
|
echo "Warning: couldn't find any X11 include files."
|
|
XINCLUDES="# no include files found"
|
|
fi
|
|
AC_SUBST(XINCLUDES)
|
|
|
|
if test "$no_x" = yes; then
|
|
XLIBSW=nope
|
|
if test "$XLIBSW" = nope; then
|
|
dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
|
|
for i in $dirs ; do
|
|
if test -r $i/libX11.a; then
|
|
XLIBSW="-L$i -lX11"
|
|
fi
|
|
done
|
|
fi
|
|
else
|
|
if test "$x_libraries" = ""; then
|
|
XLIBSW=-lX11
|
|
else
|
|
XLIBSW="-L$x_libraries -lX11"
|
|
fi
|
|
fi
|
|
if test "$XLIBSW" = nope ; then
|
|
AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
|
|
fi
|
|
if test "$XLIBSW" = nope ; then
|
|
echo "Warning: couldn't find the X11 library archive. Using -lX11."
|
|
XLIBSW=-lX11
|
|
fi
|
|
AC_SUBST(XLIBSW)
|
|
|
|
#--------------------------------------------------------------------
|
|
# Check for the existence of various libraries. The order here
|
|
# is important, so that then end up in the right order in the
|
|
# command line generated by make. The -lsocket and -lnsl libraries
|
|
# require a couple of special tricks:
|
|
# 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.
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])
|
|
|
|
tk_checkBoth=0
|
|
AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
|
|
if test "$tk_checkSocket" = 1; then
|
|
AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tk_checkBoth=1)
|
|
fi
|
|
if test "$tk_checkBoth" = 1; then
|
|
tk_oldLibs=$LIBS
|
|
LIBS="$LIBS -lsocket -lnsl"
|
|
AC_CHECK_FUNC(accept, tk_checkNsl=0, [LIBS=$tk_oldLibs])
|
|
fi
|
|
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
|
|
|
|
#--------------------------------------------------------------------
|
|
# One more check related to the X libraries. The standard releases
|
|
# of Ultrix don't support the "xauth" mechanism, so send won't work
|
|
# unless TK_NO_SECURITY is defined. However, there are usually copies
|
|
# of the MIT X server available as well, which do support xauth.
|
|
# Check for the MIT stuff and use it if it exists.
|
|
#
|
|
# Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
|
|
# because it can't deal with the "-" in the library name.
|
|
#--------------------------------------------------------------------
|
|
|
|
if test -d /usr/include/mit ; then
|
|
AC_MSG_CHECKING([MIT X libraries])
|
|
tk_oldCFlags=$CFLAGS
|
|
CFLAGS="$CFLAGS -I/usr/include/mit"
|
|
tk_oldLibs=$LIBS
|
|
LIBS="$LIBS -lX11-mit"
|
|
AC_TRY_LINK([
|
|
#include <X11/Xlib.h>
|
|
], [
|
|
XOpenDisplay(0);
|
|
], [
|
|
AC_MSG_RESULT(yes)
|
|
XLIBSW="-lX11-mit"
|
|
XINCLUDES="-I/usr/include/mit"
|
|
], AC_MSG_RESULT(no))
|
|
CFLAGS=$tk_oldCFlags
|
|
LIBS=$tk_oldLibs
|
|
fi
|
|
|
|
#--------------------------------------------------------------------
|
|
# Figure out how to find out whether a FILE structure contains
|
|
# buffered readable data. Some known names for the count field:
|
|
# _cnt: Most UNIX systems
|
|
# __cnt: HPUX
|
|
# _r: BSD
|
|
# readCount: Sprite
|
|
# Or, in GNU libc there are two fields, _gptr and _egptr, which
|
|
# have to be compared.
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_MSG_CHECKING([count field in FILE structures])
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->_cnt = 0;], fcnt="_cnt", )
|
|
if test "$fcnt" = ""; then
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->__cnt = 0;], fcnt="__cnt", )
|
|
fi
|
|
if test "$fcnt" = ""; then
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->_r = 0;], fcnt="_r", )
|
|
fi
|
|
if test "$fcnt" = ""; then
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->readCount = 0;], fcnt="readCount", )
|
|
fi
|
|
if test "$fcnt" != ""; then
|
|
AC_DEFINE_UNQUOTED(TK_FILE_COUNT, $fcnt)
|
|
fi
|
|
if test "$fcnt" = ""; then
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->_gptr = f->egptr;],
|
|
tk_ok=yes, tk_ok=no)
|
|
if test $tk_ok = yes; then
|
|
AC_DEFINE(TK_FILE_GPTR)
|
|
fcnt="_gptr/_egptr"
|
|
fi
|
|
fi
|
|
if test "$fcnt" = ""; then
|
|
AC_TRY_COMPILE([#include <stdio.h>],
|
|
[FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
|
|
tk_ok=yes, tk_ok=no)
|
|
if test $tk_ok = yes; then
|
|
AC_DEFINE(TK_FILE_READ_PTR)
|
|
fcnt="_IO_read_ptr/_IO_read_end"
|
|
fi
|
|
fi
|
|
if test "$fcnt" = ""; then
|
|
AC_MSG_RESULT([not found; must supply TkReadDataPending procedure])
|
|
else
|
|
AC_MSG_RESULT("$fcnt")
|
|
fi
|
|
|
|
#--------------------------------------------------------------------
|
|
# On a few very rare systems, all of the libm.a stuff is
|
|
# already in libc.a. Set compiler flags accordingly.
|
|
# Also, Linux requires the "ieee" library for math to
|
|
# work right (and it must appear before "-lm").
|
|
#--------------------------------------------------------------------
|
|
|
|
MATH_LIBS=""
|
|
AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
|
|
AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
|
|
AC_SUBST(MATH_LIBS)
|
|
|
|
#--------------------------------------------------------------------
|
|
# If this system doesn't have a memmove procedure, use memcpy
|
|
# instead.
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_CHECK_FUNC(memmove, , [AC_DEFINE(memmove, memcpy)])
|
|
|
|
#--------------------------------------------------------------------
|
|
# Figure out whether "char" is unsigned. If so, set a
|
|
# #define.
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_MSG_CHECKING(type of "char")
|
|
AC_TRY_RUN([
|
|
int main()
|
|
{
|
|
char c;
|
|
int i;
|
|
c = 0377;
|
|
i = c;
|
|
if (i == -1) {
|
|
exit(0);
|
|
}
|
|
exit(1);
|
|
}], tk_signed=1, tk_signed=0)
|
|
if test $tk_signed = 0; then
|
|
AC_DEFINE(CHAR_UNSIGNED)
|
|
AC_MSG_RESULT(unsigned)
|
|
else
|
|
AC_MSG_RESULT(signed)
|
|
fi
|
|
|
|
#--------------------------------------------------------------------
|
|
# SGI systems don't use the BSD form of the gettimeofday function,
|
|
# but they have a BSDgettimeofday function that can be used instead.
|
|
#
|
|
# Also, check for the existence of a gettimeofday declaration,
|
|
# to tkPort.h can declare it if it isn't already declared.
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_CHECK_FUNC(BSDgettimeofday, AC_DEFINE(HAVE_BSDGETTIMEOFDAY))
|
|
AC_MSG_CHECKING([for gettimeofday declaration])
|
|
AC_EGREP_HEADER(gettimeofday, sys/time.h, AC_MSG_RESULT(present), [
|
|
AC_MSG_RESULT(missing)
|
|
AC_DEFINE(GETTOD_NOT_DECLARED)
|
|
])
|
|
|
|
#--------------------------------------------------------------------
|
|
# Under Solaris 2.4, strtod returns the wrong value for the
|
|
# terminating character under some conditions. Check for this
|
|
# and if the problem exists use a substitute procedure
|
|
# "fixstrtod" (provided by Tcl) that corrects the error.
|
|
#--------------------------------------------------------------------
|
|
|
|
AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0)
|
|
if test "$tk_strtod" = 1; then
|
|
AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
|
|
AC_TRY_RUN([
|
|
extern double strtod();
|
|
int main()
|
|
{
|
|
char *string = "NaN";
|
|
char *term;
|
|
strtod(string, &term);
|
|
if ((term != string) && (term[-1] == 0)) {
|
|
exit(1);
|
|
}
|
|
exit(0);
|
|
}], AC_MSG_RESULT(ok), [
|
|
AC_MSG_RESULT(buggy)
|
|
AC_DEFINE(strtod, fixstrtod)
|
|
])
|
|
fi
|
|
|
|
AC_OUTPUT(Makefile)
|