dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Ck installation dnl to configure the system for the local environment. AC_INIT(ck.h) AC_PROG_INSTALL AC_PROG_RANLIB CC=${CC-cc} AC_HAVE_HEADERS(unistd.h limits.h) #-------------------------------------------------------------------- # 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 #------------------------------------------------------------------------------ # What type do signals return? Do we have sigaction ? #------------------------------------------------------------------------------ AC_RETSIGTYPE AC_HAVE_FUNCS(sigaction) #-------------------------------------------------------------------- # See if there was a command-line option for where Tcl is; if # not, assume that its top-level directory is a sibling of ours. #-------------------------------------------------------------------- AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.X binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd ../tcl8.0/unix ; pwd`) if test ! -d $TCL_BIN_DIR ; then AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR doesn't exist) fi #-------------------------------------------------------------------- # Read in configuration information generated by Tcl for shared # libraries, and arrange for it to be substituted into our # Makefile. #-------------------------------------------------------------------- if test -r $TCL_BIN_DIR/tclConfig.sh ; then file=$TCL_BIN_DIR/tclConfig.sh if test -d $TCL_BIN_DIR/../generic ; then TCL_DIR=`cd $TCL_BIN_DIR/../generic ; pwd` elif test -d $TCL_BIN_DIR/../include ; then TCL_DIR=`cd $TCL_BIN_DIR/../include ; pwd` else TCL_DIR=$TCL_BIN_DIR fi . $file 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 LD_SEARCH_FLAGS=$TCL_LD_SEARCH_FLAGS else TCL_DIR=$TCL_BIN_DIR TCL_LIB_FILE=libtcl.a TCL_LIB_VERSIONS_OK=no TCL_BUILD_LIB_SPEC="-L$TCL_BIN_DIR -ltcl" TCL_INCLUDE_SPEC="-I$TCL_DIR" fi AC_MSG_CHECKING([Ck version]) if test "${TCL_VERSION}" = "7.4"; then VERSION=4.0 CK_VERSION=4.0 CK_MAJOR_VERSION=4 CK_MINOR_VERSION=0 elif test "${TCL_VERSION}" = "7.5"; then VERSION=4.1 CK_VERSION=4.1 CK_MAJOR_VERSION=4 CK_MINOR_VERSION=1 elif test "${TCL_VERSION}" = "7.6"; then VERSION=4.2 CK_VERSION=4.2 CK_MAJOR_VERSION=4 CK_MINOR_VERSION=2 else # Assume Tcl8.0 or higher VERSION=$TCL_VERSION CK_VERSION=$VERSION CK_MAJOR_VERSION=$TCL_MAJOR_VERSION CK_MINOR_VERSION=$TCL_MINOR_VERSION fi AC_MSG_RESULT(${CK_VERSION}) #-------------------------------------------------------------------- # 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 ], [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 #--------------------------------------------------------------------- # Locate the curses header files and the curses library archive. # The order is: # ../ncurses # /usr/include and /usr/lib # /opt/ncurses # /usr/local # /usr/local/ncurses #--------------------------------------------------------------------- echo checking for curses/ncurses header files CURSESINCLUDES=nope USE_NCURSES=0 dirs="../ncurses/include /usr/include /usr/include/ncurses /opt/ncurses/include /usr/local/include /usr/local/include/ncurses" for i in $dirs ; do if test -r $i/ncurses.h; then AC_MSG_CHECKING([ncurses headers]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -I$i" AC_TRY_COMPILE([#include ], [int c; initscr(); c = ACS_ULCORNER; curs_set(1);], [AC_MSG_RESULT(yes) CURSESINCLUDES="-I$i"], AC_MSG_RESULT(no)) CFLAGS=$tk_oldCFlags if test "$CURSESINCLUDES" != nope; then USE_NCURSES=1 break fi fi if test -r $i/curses.h; then AC_MSG_CHECKING([curses headers]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -I$i" AC_TRY_COMPILE([#include ], [int c; initscr(); c = ACS_ULCORNER; curs_set(1);], [AC_MSG_RESULT(yes) CURSESINCLUDES="-I$i"], AC_MSG_RESULT(no)) CFLAGS=$tk_oldCFlags if test "$CURSESINCLUDES" != nope; then break fi fi done if test "$CURSESINCLUDES" = nope; then echo "Warning: couldn't find any curses header file." CURSESINCLUDES="# no header file found" else if test $USE_NCURSES = 1 ; then echo "using ncurses.h from $CURSESINCLUDES" else echo "using curses.h from $CURSESINCLUDES" fi fi echo checking for curses/ncurses library files CURSESLIBSW=nope dirs="../ncurses/lib /usr/lib /usr/lib/ncurses /opt/ncurses/lib /usr/local/lib /usr/local/ncurses/lib" for i in $dirs ; do if test $USE_NCURSES = 0 ; then if test -r $i/libcurses.a || test -r $i/libcurses$SHLIB_SUFFIX ; then AC_MSG_CHECKING([curses library]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $CURSESINCLUDES" if test "$i" = "/usr/lib" ; then LIBSW="-lcurses -ltermcap" else LIBSW="-L$i -lcurses -ltermcap" fi tk_oldLibs=$LIBS LIBS="$LIBSW" AC_TRY_LINK([#include ], [int c; initscr(); c = ACS_ULCORNER; curs_set(1);], [AC_MSG_RESULT(yes) CURSESLIBSW="$LIBSW"], AC_MSG_RESULT(no)) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs if test "$CURSESLIBSW" != nope; then break fi fi else if test -r $i/libncurses.a || test -r $i/libncurses$SHLIB_SUFFIX ; then AC_MSG_CHECKING([ncurses library]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $CURSESINCLUDES" if test "$i" = "/usr/lib" ; then LIBSW="-lncurses" else LIBSW="-L$i -lncurses" fi tk_oldLibs=$LIBS LIBS="$LIBSW" AC_TRY_LINK([#include ], [int c; initscr(); c = ACS_ULCORNER; curs_set(1);], [AC_MSG_RESULT(yes) CURSESLIBSW="$LIBSW"], AC_MSG_RESULT(no)) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs if test "$CURSESLIBSW" != nope; then break fi fi fi done if test "$CURSESLIBSW" = nope ; then echo "Warning: couldn't find the curses library archive. Using -lcurses." CURSESLIBSW="-lcurses -ltermcap" else echo "using curses library: $CURSESLIBSW" AC_MSG_CHECKING([curses scr_dump function]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $CURSESINCLUDES" tk_oldLibs=$LIBS LIBS="$CURSESLIBSW" if test $USE_NCURSES = 1 ; then AC_TRY_LINK([#include ], [int c; initscr(); scr_dump("xx");], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SCR_DUMP)], AC_MSG_RESULT(no)) else AC_TRY_LINK([#include ], [int c; initscr(); scr_dump("xx");], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SCR_DUMP)], AC_MSG_RESULT(no)) fi CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi if test $USE_NCURSES = 1 ; then USE_NCURSES="-DUSE_NCURSES" else USE_NCURSES="" fi #--------------------------------------------------------------------- # Check for GPM (General Purpose Mouse) #--------------------------------------------------------------------- AC_MSG_CHECKING([GPM library]) tk_oldLibs=$LIBS LIBS="-lgpm" AC_TRY_LINK([#include ], [Gpm_Connect conn; Gpm_Open(&conn, 0);], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GPM) CURSESLIBSW="$CURSESLIBSW -lgpm"], [AC_MSG_RESULT(no)]) LIBS=$tk_oldLibs #-------------------------------------------------------------------- # 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"])) #-------------------------------------------------------------------- # On Interactive the str(n)casecmp is burried in libinet.a #-------------------------------------------------------------------- AC_CHECK_FUNC(strncasecmp, , AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])) #-------------------------------------------------------------------- # 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 ], [FILE *f = stdin; f->_cnt = 0;], fcnt="_cnt", ) if test "$fcnt" = ""; then AC_TRY_COMPILE([#include ], [FILE *f = stdin; f->__cnt = 0;], fcnt="__cnt", ) fi if test "$fcnt" = ""; then AC_TRY_COMPILE([#include ], [FILE *f = stdin; f->_r = 0;], fcnt="_r", ) fi if test "$fcnt" = ""; then AC_TRY_COMPILE([#include ], [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 ], [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 ], [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"]) #-------------------------------------------------------------------- # If this system doesn't have a memmove procedure, use memcpy # instead. #-------------------------------------------------------------------- AC_CHECK_FUNC(memmove, , [AC_DEFINE(memmove, memcpy)]) #-------------------------------------------------------------------- # 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); }], tk_ok=1, tk_ok=0, tk_ok=0) if test "$tk_ok" = 1; then AC_MSG_RESULT(ok) else AC_MSG_RESULT(buggy) AC_DEFINE(strtod, fixstrtod) fi fi #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libck as a shared library instead of a static library. #-------------------------------------------------------------------- AC_ARG_ENABLE(shared, [ --enable-shared build libck as a shared library], [ok=$enableval], [ok=no]) if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then CK_SHLIB_CFLAGS="${SHLIB_CFLAGS}" eval "CK_LIB_FILE=libck${TCL_SHARED_LIB_SUFFIX}" MAKE_LIB="\${SHLIB_LD} -o ${CK_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}" RANLIB=":" else CK_SHLIB_CFLAGS="" eval "CK_LIB_FILE=libck${TCL_UNSHARED_LIB_SUFFIX}" # Fixup if suffix missing if test "$CK_LIB_FILE" = "libck" ; then CK_LIB_FILE=libck.a fi MAKE_LIB="ar cr ${CK_LIB_FILE} \${OBJS}" fi # 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. if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then CK_BUILD_LIB_SPEC="-L`pwd` -lck${VERSION}" CK_LIB_SPEC="-L${exec_prefix}/lib -lck${VERSION}" else CK_BUILD_LIB_SPEC="-L`pwd` -lck`echo ${VERSION} | tr -d .`" CK_LIB_SPEC="-L${exec_prefix}/lib -lck`echo ${VERSION} | tr -d .`" fi AC_SUBST(CC) AC_SUBST(DL_LIBS) AC_SUBST(LD_FLAGS) AC_SUBST(MATH_LIBS) AC_SUBST(MAKE_LIB) AC_SUBST(SHLIB_CFLAGS) AC_SUBST(SHLIB_LD) AC_SUBST(SHLIB_LD_LIBS) AC_SUBST(SHLIB_SUFFIX) AC_SUBST(SHLIB_VERSION) AC_SUBST(TCL_DIR) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_LIB) AC_SUBST(TCL_INCLUDE_SPEC) AC_SUBST(TCL_VERSION) AC_SUBST(TCL_BUILD_LIB_SPEC) AC_SUBST(CK_LD_SEARCH_FLAGS) AC_SUBST(CK_LIB_FILE) AC_SUBST(CK_LIB_SPEC) AC_SUBST(CK_MAJOR_VERSION) AC_SUBST(CK_MINOR_VERSION) AC_SUBST(CK_SHLIB_CFLAGS) AC_SUBST(CK_VERSION) AC_SUBST(CK_BUILD_LIB_SPEC) AC_SUBST(USE_NCURSES) AC_SUBST(CURSESINCLUDES) AC_SUBST(CURSESLIBSW) AC_OUTPUT(Makefile ckConfig.sh pkgIndex.tcl)