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
|
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(et2c.c)
if test "${prefix}" = "NONE"; then
prefix=/usr/local
fi
if test "${exec_prefix}" = "NONE"; then
exec_prefix=$prefix
fi
AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available],
[tk_ok=$enableval], [tk_ok=no])
if test "$tk_ok" = "yes"; then
AC_PROG_CC
else
CC=${CC-cc}
AC_SUBST(CC)
fi
AC_C_CROSS
#--------------------------------------------------------------------
# See if there was a command-line option for where Tcl and Tk are
#--------------------------------------------------------------------
AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl sources from DIR],
TCL_SRC_DIR=$withval)
AC_ARG_WITH(tk, [ --with-tk=DIR use Tk sources from DIR],
TK_SRC_DIR=$withval )
#--------------------------------------------------------------------
# Locate the "wish" program and use it to locate the Tcl library
# scripts
#--------------------------------------------------------------------
if test -n "$TK_SRC_DIR"
then
WISH=$TK_SRC_DIR/unix/wish
else
AC_PATH_PROGS(WISH, wish wish8.0 wish4.2 wish4.1 wish4.0, notfound)
fi
if test $WISH = notfound
then
AC_MSG_ERROR(Unable to find the Tcl/Tk "wish" program)
fi
AC_MSG_CHECKING(Tcl/Tk version)
changequote(<<<,>>>)dnl
if $WISH <<\END >et_temp
wm withdraw .
after 1000 {destroy .}
regsub {\.} $tk_version {} vers
puts "$vers [info tclversion] $tk_version [info library] $tk_library"
destroy .
END
changequote([,])dnl
then
read VERS TCL_VERS TK_VERS TCL_LIB TK_LIB <et_temp
ET_SRC=et$VERS.c
else
AC_MSG_ERROR(Unable to execute $WISH)
fi
rm -f et_temp
AC_MSG_RESULT(Tk$TK_VERS/Tcl$TCL_VERS)
#
# Gotta find the Tcl/Tk directories
#
if test -n "$TCL_SRC_DIR"
then
if test $VERS -ge 41
then
TCLTK_INC="$TCLTK_INC -I$TCL_SRC_DIR/generic"
LIBS="$LIBS -L$TCL_SRC_DIR/unix"
else
TCLTK_INC="$TCLTK_INC -I$TCL_SRC_DIR"
LIBS="$LIBS -L$TCL_SRC_DIR -L$TCL_SRC_DIR/../lib"
fi
fi
if test -n "$TK_SRC_DIR"
then
if test $VERS -ge 41
then
TCLTK_INC="$TCLTK_INC -I$TK_SRC_DIR/generic"
LIBS="$LIBS -L$TK_SRC_DIR/unix"
else
TCLTK_INC="$TCLTK_INC -I$TK_SRC_DIR"
LIBS="$LIBS -L$TK_SRC_DIR -L$TK_SRC_DIR/../lib"
fi
fi
#--------------------------------------------------------------------
# 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
AC_MSG_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
AC_MSG_RESULT($i)
XINCLUDES=" -I$i"
break
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
AC_MSG_RESULT(couldn't find any!)
XINCLUDES="# no include files found"
fi
if test "$no_x" = yes; then
AC_MSG_CHECKING(for X11 libraries)
XLIBSW=nope
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 -o -r $i/libX11.so -o -r $i/libX11.sl; then
AC_MSG_RESULT($i)
XLIBSW="-L$i -lX11"
x_libraries="$i"
break
fi
done
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
AC_MSG_RESULT(couldn't find any! Using -lX11.)
XLIBSW=-lX11
fi
#--------------------------------------------------------------------
# If the X library binaries are in a non-standard directory, and
# if a mechanism such as -R is available on this platform for
# specifying a runtime search path for shared libraries, add the X
# library location into that search path.
#--------------------------------------------------------------------
if test "$x_libraries" != "" -a "$LD_SEARCH_FLAGS" != ""; then
et_tmp=`sed -e "s|\\\${LIB_RUNTIME_DIR}|$x_libraries|" << EOF
$LD_SEARCH_FLAGS
EOF`
LD_SEARCH_FLAGS="$LD_SEARCH_FLAGS $et_tmp"
fi
#--------------------------------------------------------------------
# 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"])
et_checkBoth=0
AC_CHECK_FUNC(connect, et_checkSocket=0, et_checkSocket=1)
if test "$et_checkSocket" = 1; then
AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", et_checkBoth=1)
fi
if test "$et_checkBoth" = 1; then
et_oldLibs=$LIBS
LIBS="$LIBS -lsocket -lnsl"
AC_CHECK_FUNC(accept, et_checkNsl=0, [LIBS=$et_oldLibs])
fi
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
#--------------------------------------------------------------------
# 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"] ,,$MATH_LIBS)
#--------------------------------------------------------------------
# Load -ldl if it exists
#--------------------------------------------------------------------
AC_CHECK_LIB(dl, main)
#--------------------------------------------------------------------
# Locate the Tcl/Tk libraries
#--------------------------------------------------------------------
missing=false
AC_CHECK_LIB(tcl$TCL_VERS, main,, missing=true, $MATH_LIBS)
if $missing
then
missing=false
AC_CHECK_LIB(tcl, main,, missing=true, $MATH_LIBS)
fi
if $missing
then
AC_MSG_ERROR(Unable to locate the Tcl libraries. Try using --with-tcl=DIR)
fi
missing=false
AC_CHECK_LIB(tk$TK_VERS, main,, missing=true, $LIBS $XLIBSW $MATH_LIBS)
if $missing
then
missing=false
AC_CHECK_LIB(tk, main,, missing=true, $LIBS $XLIBSW $MATH_LIBS)
fi
if $missing
then
AC_MSG_ERROR(Unable to locate the Tk libraries. Try using --with-tk=DIR)
fi
AC_SUBST(ET_SRC)
AC_SUBST(TCL_LIB)
AC_SUBST(TK_LIB)
AC_SUBST(TCLTK_INC)
AC_SUBST(LD_SEARCH_FLAGS)
AC_SUBST(MATH_LIBS)
AC_SUBST(XINCLUDES)
AC_SUBST(XLIBSW)
AC_OUTPUT(Makefile doc/Makefile)
|