Blame configure.in

Packit a69f91
dnl
Packit a69f91
dnl Process this file with autoconf to produce a configure script.
Packit a69f91
dnl
Packit a69f91
AC_REVISION($Id: configure.in,v 5.82 2013/11/04 19:03:00 andreas_kupries Exp $)
Packit a69f91
Packit a69f91
AC_INIT([expect],[5.45.4])
Packit a69f91
Packit a69f91
TEA_INIT([3.9])
Packit a69f91
Packit a69f91
AC_CONFIG_AUX_DIR(tclconfig)
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# Configure script for package 'Expect'.
Packit a69f91
# TEA compliant.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# Load the tclConfig.sh file
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_PATH_TCLCONFIG
Packit a69f91
TEA_LOAD_TCLCONFIG
Packit a69f91
Packit a69f91
# expectk has been removed from the distribution as Tcl has supported
Packit a69f91
# dynamic extensions everywhere for a while.  We still allow 'expect'
Packit a69f91
# to be built for the die-hard users, but expectk is just wish with
Packit a69f91
# package require Expect
Packit a69f91
if test "${with_tk+set}" = set ; then
Packit a69f91
    AC_MSG_WARN([With Tk request ignored - use package require Tk & Expect])
Packit a69f91
fi
Packit a69f91
Packit a69f91
#-----------------------------------------------------------------------
Packit a69f91
# Handle the --prefix=... option by defaulting to what Tcl gave.
Packit a69f91
# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
Packit a69f91
#-----------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_PREFIX
Packit a69f91
Packit a69f91
#-----------------------------------------------------------------------
Packit a69f91
# Standard compiler checks.
Packit a69f91
# This sets up CC by using the CC env var, or looks for gcc otherwise.
Packit a69f91
# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
Packit a69f91
# the basic setup necessary to compile executables.
Packit a69f91
#-----------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_SETUP_COMPILER
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# __CHANGE__
Packit a69f91
# Choose which headers you need.  Extension authors should try very
Packit a69f91
# hard to only rely on the Tcl public header files.  Internal headers
Packit a69f91
# contain private data structures and are subject to change without
Packit a69f91
# notice.
Packit a69f91
# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
#TEA_PUBLIC_TCL_HEADERS
Packit a69f91
TEA_PRIVATE_TCL_HEADERS
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# You can add more files to clean if your extension creates any extra
Packit a69f91
# files by extending CLEANFILES.
Packit a69f91
# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure
Packit a69f91
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
Packit a69f91
#
Packit a69f91
# A few miscellaneous platform-specific items:
Packit a69f91
# TEA_ADD_* any platform specific compiler/build info here.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_ADD_CLEANFILES([pkgIndex.tcl])
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# Check whether --enable-threads or --disable-threads was given.
Packit a69f91
# So far only Tcl responds to this one.
Packit a69f91
#
Packit a69f91
# Hook for when threading is supported in Expect.  The --enable-threads
Packit a69f91
# flag currently has no effect.
Packit a69f91
#------------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_ENABLE_THREADS
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# The statement below defines a collection of symbols related to
Packit a69f91
# building as a shared library instead of a static library.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_ENABLE_SHARED
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# This macro figures out what flags to use with the compiler/linker
Packit a69f91
# when building shared/static debug/optimized objects.  This information
Packit a69f91
# can be taken from the tclConfig.sh file, but this figures it all out.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_CONFIG_CFLAGS
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# Set the default compiler switches based on the --enable-symbols option.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_ENABLE_SYMBOLS
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# Everyone should be linking against the Tcl stub library.  If you
Packit a69f91
# can't for some reason, remove this definition.  If you aren't using
Packit a69f91
# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
Packit a69f91
# link against the non-stubbed Tcl library.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
AC_DEFINE(USE_TCL_STUBS)
Packit a69f91
AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs])
Packit a69f91
Packit a69f91
#-------------------------------------------------------------------------
Packit a69f91
# Check for system header files.
Packit a69f91
#-------------------------------------------------------------------------
Packit a69f91
Packit a69f91
AC_CHECK_HEADER(sys/select.h,    AC_DEFINE(HAVE_SYS_SELECT_H))
Packit a69f91
AC_CHECK_HEADER(sys/sysmacros.h, AC_DEFINE(HAVE_SYSMACROS_H))
Packit a69f91
Packit a69f91
# Oddly, some systems have stdarg but don't support prototypes
Packit a69f91
# Tcl avoids the whole issue by not using stdarg on UNIX at all!
Packit a69f91
Packit a69f91
dnl AC_CHECK_HEADER(stdarg.h, AC_DEFINE(HAVE_STDARG_H))
Packit a69f91
Packit a69f91
AC_CHECK_HEADER(varargs.h, AC_DEFINE(HAVE_VARARGS_H))
Packit a69f91
Packit a69f91
# If no stropts.h, then the svr4 implementation is broken.
Packit a69f91
# At least it is on my Debian "potato" system. - Rob Savoye
Packit a69f91
Packit a69f91
AC_CHECK_HEADER(sys/stropts.h,   AC_DEFINE(HAVE_STROPTS_H), svr4_ptys_broken=1)
Packit a69f91
AC_CHECK_HEADER(sys/sysconfig.h, AC_DEFINE(HAVE_SYSCONF_H))
Packit a69f91
AC_CHECK_HEADER(sys/fcntl.h,     AC_DEFINE(HAVE_SYS_FCNTL_H))
Packit a69f91
AC_CHECK_HEADER(sys/ptem.h,      AC_DEFINE(HAVE_SYS_PTEM_H))
Packit a69f91
AC_CHECK_HEADER(sys/strredir.h,  AC_DEFINE(HAVE_STRREDIR_H))
Packit a69f91
AC_CHECK_HEADER(sys/strpty.h,    AC_DEFINE(HAVE_STRPTY_H))
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([for sys/bsdtypes.h])
Packit a69f91
if test "ISC_${ISC}" = "ISC_1"   ;    then
Packit a69f91
   AC_MSG_RESULT(yes)
Packit a69f91
   # if on ISC 1, we need <sys/bsdtypes.h> to get FD_SET macros
Packit a69f91
   AC_HAVE_HEADERS(sys/bsdtypes.h)
Packit a69f91
else
Packit a69f91
   AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
#-------------------------------------------------------------------------
Packit a69f91
# What type do signals return?
Packit a69f91
#-------------------------------------------------------------------------
Packit a69f91
Packit a69f91
AC_TYPE_SIGNAL
Packit a69f91
Packit a69f91
#-------------------------------------------------------------------------
Packit a69f91
#       Find out all about time handling differences.
Packit a69f91
#-------------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_TIME_HANDLER
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
#	The check below checks whether <sys/wait.h> defines the type
Packit a69f91
#	"union wait" correctly.  It's needed because of weirdness in
Packit a69f91
#	HP-UX where "union wait" is defined in both the BSD and SYS-V
Packit a69f91
#	environments.  Checking the usability of WIFEXITED seems to do
Packit a69f91
#	the trick.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([union wait])
Packit a69f91
AC_CACHE_VAL(tcl_cv_union_wait,
Packit a69f91
    AC_TRY_LINK([#include <sys/types.h> 
Packit a69f91
#include <sys/wait.h>], [
Packit a69f91
union wait x;
Packit a69f91
WIFEXITED(x);	/* Generates compiler error if WIFEXITED uses an int. */
Packit a69f91
			 ], tcl_cv_union_wait=yes, tcl_cv_union_wait=no))
Packit a69f91
AC_MSG_RESULT($tcl_cv_union_wait)
Packit a69f91
if test $tcl_cv_union_wait = no; then
Packit a69f91
    AC_DEFINE(NO_UNION_WAIT)
Packit a69f91
fi
Packit a69f91
Packit a69f91
######################################################################
Packit a69f91
# required by Sequent ptx2
Packit a69f91
Packit a69f91
AC_CHECK_FUNC(gethostname, gethostname=1 , gethostname=0)
Packit a69f91
if test $gethostname -eq 0 ; then
Packit a69f91
  AC_CHECK_LIB(inet, gethostname, LIBS="$LIBS -linet")
Packit a69f91
fi
Packit a69f91
Packit a69f91
######################################################################
Packit a69f91
# required by Fischman's ISC 4.0
Packit a69f91
Packit a69f91
AC_CHECK_FUNC(socket, socket=1 , socket=0)
Packit a69f91
if test $socket -eq 0 ; then
Packit a69f91
  AC_CHECK_LIB(inet, socket, LIBS="$LIBS -linet")
Packit a69f91
fi
Packit a69f91
Packit a69f91
######################################################################
Packit a69f91
Packit a69f91
AC_CHECK_FUNC(select, select=1 , select=0)
Packit a69f91
if test $select -eq 0 ; then
Packit a69f91
  AC_CHECK_LIB(inet, select, LIBS="$LIBS -linet")
Packit a69f91
fi
Packit a69f91
Packit a69f91
######################################################################
Packit a69f91
Packit a69f91
AC_CHECK_FUNC(getpseudotty, getpseudotty=1 , getpseudotty=0)
Packit a69f91
if test $getpseudotty -eq 0 ; then
Packit a69f91
  AC_CHECK_LIB(seq, getpseudotty)
Packit a69f91
fi
Packit a69f91
Packit a69f91
######################################################################
Packit a69f91
# Check for FreeBSD/NetBSD openpty()
Packit a69f91
unset ac_cv_func_openpty
Packit a69f91
Packit a69f91
AC_CHECK_FUNC(openpty, AC_DEFINE(HAVE_OPENPTY) openpty=1 , openpty=0)
Packit a69f91
if test $openpty -eq 0 ; then
Packit a69f91
  AC_CHECK_LIB(util, openpty, [
Packit a69f91
	# we only need to define OPENPTY once, but since we are overriding
Packit a69f91
	# the default behavior, we must also handle augment LIBS too.
Packit a69f91
	# This needn't be done in the 2nd and 3rd tests.
Packit a69f91
	AC_DEFINE(HAVE_OPENPTY)
Packit a69f91
	LIBS="$LIBS -lutil"
Packit a69f91
  ])
Packit a69f91
fi
Packit a69f91
Packit a69f91
######################################################################
Packit a69f91
# End of library/func checking
Packit a69f91
######################################################################
Packit a69f91
Packit a69f91
# Hand patches to library/func checking.
Packit a69f91
dnl From: Michael Kuhl <mkuhl@legato.com>
Packit a69f91
dnl To get expect to compile on a Sequent NUMA-Q running DYNIX/ptx v4.4.2.
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if running Sequent running SVR4])
Packit a69f91
if test "$host_alias" = "i386-sequent-sysv4" ; then
Packit a69f91
 LIBS="-lnsl -lsocket -lm"
Packit a69f91
 AC_MSG_RESULT(yes)
Packit a69f91
else
Packit a69f91
 AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# From here on comes original expect configure code.
Packit a69f91
# At the end we will have another section of TEA 3.2 code.
Packit a69f91
#
Packit a69f91
# Note specialities
Packit a69f91
#
Packit a69f91
# - Runs a sub configure (Dbgconfigure) for the expect tcl debugger
Packit a69f91
#
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
dnl AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
Packit a69f91
AC_CANONICAL_SYSTEM
Packit a69f91
Packit a69f91
# If `configure' is invoked (in)directly via `make', ensure that it
Packit a69f91
# encounters no `make' conflicts.
Packit a69f91
#
Packit a69f91
Packit a69f91
dnl unset MFLAGS MAKEFLAGS
Packit a69f91
MFLAGS=
Packit a69f91
MAKEFLAGS=
Packit a69f91
Packit a69f91
# An explanation is in order for the strange things going on with the
Packit a69f91
# various LIBS.  There are three separate definitions for LIBS.  The
Packit a69f91
# reason is that some systems require shared libraries include
Packit a69f91
# references to their dependent libraries, i.e., any additional
Packit a69f91
# libraries that must be linked to.  And some systems get upset if the
Packit a69f91
# references are repeated on the link line.  So therefore, we create
Packit a69f91
# one for Expect, one for Expect and Tcl, and one for building Expect's own
Packit a69f91
# shared library.  Tcl's tclConfig.sh insists that any shared libs
Packit a69f91
# that it "helps" build must pass the libraries as LIBS (see comment
Packit a69f91
# near end of this configure file).  I would do but since we're close
Packit a69f91
# to hitting config's max symbols, we take one short cut and pack the
Packit a69f91
# LIBS into EXP_SHLIB_LD_LIBS (which is basically what Tcl wants to do
Packit a69f91
# for us).  The point, however, is that there's no separate LIBS or
Packit a69f91
# EXP_LIBS symbol passed out of configure.  One additional point for
Packit a69f91
# confusion is that LIBS is what configure uses to do all library
Packit a69f91
# tests, so we have to swap definitions of LIBS periodically.  When we
Packit a69f91
# are swapping out the one for Expect's shared library, we save it in
Packit a69f91
# EXP_LIBS.  Sigh.
Packit a69f91
Packit a69f91
eval "LIBS=\"$TCL_LIBS\""
Packit a69f91
Packit a69f91
if test "${with_tcl+set}" = set ; then
Packit a69f91
    case "${with_tcl}" in
Packit a69f91
	..*)
Packit a69f91
	    AC_MSG_WARN([Specify absolute path to --with-tcl for subdir configuration])
Packit a69f91
	    ;;
Packit a69f91
    esac
Packit a69f91
fi
Packit a69f91
Packit a69f91
# these are the other subdirectories we need to configure
Packit a69f91
AC_CONFIG_SUBDIRS(testsuite)
Packit a69f91
Packit a69f91
AC_TYPE_PID_T
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if running Mach])
Packit a69f91
mach=0
Packit a69f91
case "${host}" in
Packit a69f91
  # Both Next and pure Mach behave identically with respect
Packit a69f91
  # to a few things, so just lump them together as "mach"
Packit a69f91
  *-*-mach*)		mach=1 ;;
Packit a69f91
  *-*-next*)		mach=1 ; next=1 ;;
Packit a69f91
esac
Packit a69f91
Packit a69f91
if test $mach -eq 1 ; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if running MachTen])
Packit a69f91
# yet another Mach clone
Packit a69f91
if test -r /MachTen ; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  mach=1
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if on Pyramid])
Packit a69f91
if test -r /bin/pyr ; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  pyr=1
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
  pyr=0
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if on Apollo])
Packit a69f91
if test -r /usr/apollo/bin ; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  apollo=1
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
  apollo=0
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if on Interactive])
Packit a69f91
if test "x`(uname -s) 2>/dev/null`" = xIUNIX; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  iunix=1
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
  iunix=0
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([stty to use])
Packit a69f91
if test -r /usr/local/bin/stty ; then
Packit a69f91
  STTY_BIN=/usr/local/bin/stty
Packit a69f91
else
Packit a69f91
  STTY_BIN=/bin/stty
Packit a69f91
fi
Packit a69f91
AC_MSG_RESULT($STTY_BIN)
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if stty reads stdout])
Packit a69f91
Packit a69f91
# On some systems stty can't be run in the background (svr4) or get it
Packit a69f91
# wrong because they fail to complain (next, mach), so don't attempt
Packit a69f91
# the test on some systems.
Packit a69f91
Packit a69f91
stty_reads_stdout=""
Packit a69f91
case "${host}" in
Packit a69f91
  *-*-solaris*)		stty_reads_stdout=0 ;;
Packit a69f91
  *-*-irix*)		stty_reads_stdout=0 ;;
Packit a69f91
  *-*-sco3.2v[[45]]*)	stty_reads_stdout=1 ;;
Packit a69f91
  i[[3456]]86-*-sysv4.2MP)	stty_reads_stdout=0 ;;
Packit a69f91
  *-*-linux*)		stty_reads_stdout=0 ;;
Packit a69f91
  # Not sure about old convex but 5.2 definitely reads from stdout
Packit a69f91
  c[[12]]-*-*)		stty_reads_stdout=1 ;;
Packit a69f91
  *-*-aix[[34]]*)	stty_reads_stdout=0 ;;
Packit a69f91
  *-*-hpux9*)		stty_reads_stdout=0 ;;
Packit a69f91
  *-*-hpux10*)		stty_reads_stdout=0 ;;
Packit a69f91
  *-*-osf[[234]]*)	stty_reads_stdout=0 ;;
Packit a69f91
  *-*-ultrix4.4)	stty_reads_stdout=0 ;;
Packit a69f91
  *-*-dgux*)		stty_reads_stdout=0 ;;
Packit a69f91
esac
Packit a69f91
Packit a69f91
if test $mach -eq 1 ; then
Packit a69f91
  stty_reads_stdout=1
Packit a69f91
fi
Packit a69f91
if test $apollo -eq 1 ; then
Packit a69f91
  stty_reads_stdout=1
Packit a69f91
fi
Packit a69f91
if test $pyr -eq 1 ; then
Packit a69f91
  stty_reads_stdout=1
Packit a69f91
fi
Packit a69f91
Packit a69f91
# if we still don't know, test
Packit a69f91
if test x"${stty_reads_stdout}" = x"" ; then
Packit a69f91
  $STTY_BIN > /dev/null             2> /dev/null ; a=$?
Packit a69f91
  $STTY_BIN < /dev/tty  > /dev/null 2> /dev/null ; b=$?
Packit a69f91
  if test $a -ne 0 -a $b -ne 0; then
Packit a69f91
    stty_reads_stdout=1
Packit a69f91
  else
Packit a69f91
    stty_reads_stdout=0
Packit a69f91
  fi
Packit a69f91
fi
Packit a69f91
Packit a69f91
if test ${stty_reads_stdout} -eq 1 ; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  AC_DEFINE(STTY_READS_STDOUT)
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
# Solaris 2.4 and later requires __EXTENSIONS__ in order to see all sorts
Packit a69f91
# of traditional but nonstandard stuff in header files.
Packit a69f91
AC_MSG_CHECKING([if running Solaris])
Packit a69f91
solaris=0
Packit a69f91
case "${host}" in
Packit a69f91
  *-*-solaris*)		solaris=1;;
Packit a69f91
esac
Packit a69f91
Packit a69f91
if test $solaris -eq 1 ; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  AC_DEFINE(SOLARIS)
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
# On Interactive UNIX, -Xp must be added to LIBS in order to find strftime.
Packit a69f91
# This test should really be done by Tcl.  So just check Tcl's definition.
Packit a69f91
# If defective, add to all three LIBS.  (It's not actually necessary for
Packit a69f91
# EXP_LIBS since -Xp will just be ignored the way that EXP_LIBS is used in
Packit a69f91
# the Makefile, but we include it for consistency.)
Packit a69f91
Packit a69f91
if test $iunix -eq 1 ; then
Packit a69f91
  AC_CHECK_FUNC(strftime, , [
Packit a69f91
	LIBS="${LIBS} -Xp" 
Packit a69f91
	])
Packit a69f91
fi
Packit a69f91
Packit a69f91
######################################################################
Packit a69f91
#
Packit a69f91
# Look for various header files
Packit a69f91
#
Packit a69f91
Packit a69f91
#
Packit a69f91
# Look for functions that may be missing
Packit a69f91
#
Packit a69f91
dnl AC_CHECK_FUNC(memcpy, AC_DEFINE(HAVE_MEMCPY))
Packit a69f91
AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE))
Packit a69f91
AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF))
Packit a69f91
AC_CHECK_FUNC(strftime, AC_DEFINE(HAVE_STRFTIME))
Packit a69f91
AC_CHECK_FUNC(strchr, AC_DEFINE(HAVE_STRCHR))
Packit a69f91
AC_CHECK_FUNC(timezone, AC_DEFINE(HAVE_TIMEZONE))
Packit a69f91
AC_CHECK_FUNC(siglongjmp, AC_DEFINE(HAVE_SIGLONGJMP))
Packit a69f91
Packit a69f91
# dnl check for memcpy by hand
Packit a69f91
# because Unixware 2.0 handles it specially and refuses to compile
Packit a69f91
# autoconf's automatic test that is a call with no arguments
Packit a69f91
AC_MSG_CHECKING([for memcpy])
Packit a69f91
AC_TRY_LINK(,[
Packit a69f91
char *s1, *s2;
Packit a69f91
memcpy(s1,s2,0);
Packit a69f91
],
Packit a69f91
	AC_MSG_RESULT(yes)
Packit a69f91
	AC_DEFINE(HAVE_MEMCPY)
Packit a69f91
	,
Packit a69f91
	AC_MSG_RESULT(no)
Packit a69f91
)
Packit a69f91
Packit a69f91
# Some systems only define WNOHANG if _POSIX_SOURCE is defined
Packit a69f91
# The following merely tests that sys/wait.h can be included
Packit a69f91
# and if so that WNOHANG is not defined.  The only place I've
Packit a69f91
# seen this is ISC.
Packit a69f91
AC_MSG_CHECKING([if WNOHANG requires _POSIX_SOURCE])
Packit a69f91
AC_TRY_RUN([
Packit a69f91
#include <sys/wait.h>
Packit a69f91
main() {
Packit a69f91
#ifndef WNOHANG
Packit a69f91
	return 0;
Packit a69f91
#else
Packit a69f91
	return 1;
Packit a69f91
#endif
Packit a69f91
}],
Packit a69f91
	AC_MSG_RESULT(yes)
Packit a69f91
	AC_DEFINE(WNOHANG_REQUIRES_POSIX_SOURCE)
Packit a69f91
,
Packit a69f91
	AC_MSG_RESULT(no)
Packit a69f91
,
Packit a69f91
	AC_MSG_ERROR([Expect can't be cross compiled])
Packit a69f91
)
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if any value exists for WNOHANG])
Packit a69f91
rm -rf wnohang
Packit a69f91
AC_TRY_RUN([
Packit a69f91
#include <stdio.h>
Packit a69f91
#include <sys/wait.h>
Packit a69f91
main() {
Packit a69f91
#ifdef WNOHANG
Packit a69f91
	FILE *fp = fopen("wnohang","w");
Packit a69f91
	fprintf(fp,"%d",WNOHANG);
Packit a69f91
	fclose(fp);
Packit a69f91
	return 0;
Packit a69f91
#else
Packit a69f91
	return 1;
Packit a69f91
#endif
Packit a69f91
}],
Packit a69f91
	AC_MSG_RESULT(yes)
Packit a69f91
	AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, `cat wnohang`)
Packit a69f91
	rm -f wnohang
Packit a69f91
,
Packit a69f91
	AC_MSG_RESULT(no)
Packit a69f91
	AC_DEFINE(WNOHANG_BACKUP_VALUE, 1)
Packit a69f91
,
Packit a69f91
	AC_MSG_ERROR([Expect can't be cross compiled])
Packit a69f91
)
Packit a69f91
Packit a69f91
#
Packit a69f91
# check how signals work
Packit a69f91
#
Packit a69f91
Packit a69f91
# Check for the data type of the mask used in select().
Packit a69f91
# This picks up HP braindamage which defines fd_set and then 
Packit a69f91
# proceeds to ignore it and use int.
Packit a69f91
# Pattern matching on int could be loosened.
Packit a69f91
# Can't use ac_header_egrep since that doesn't see prototypes with K&R cpp.
Packit a69f91
AC_MSG_CHECKING([mask type of select])
Packit a69f91
if egrep "select\(size_t, int" /usr/include/sys/time.h >/dev/null 2>&1; then
Packit a69f91
  AC_MSG_RESULT(int)
Packit a69f91
  AC_DEFINE(SELECT_MASK_TYPE, int)
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(none)
Packit a69f91
  AC_DEFINE(SELECT_MASK_TYPE, fd_set)
Packit a69f91
fi
Packit a69f91
Packit a69f91
dnl # Check for the data type of the function used in signal(). This
Packit a69f91
dnl # must be before the test for rearming.
Packit a69f91
dnl # echo checking return type of signal handlers
Packit a69f91
dnl AC_HEADER_EGREP([(void|sighandler_t).*signal], signal.h, retsigtype=void,AC_DEFINE(RETSIGTYPE, int) retsigtype=int)
Packit a69f91
Packit a69f91
# FIXME: check if alarm exists
Packit a69f91
AC_MSG_CHECKING([if signals need to be re-armed])
Packit a69f91
AC_TRY_RUN([
Packit a69f91
#include <signal.h>
Packit a69f91
#define RETSIGTYPE $retsigtype
Packit a69f91
Packit a69f91
int signal_rearms = 0;
Packit a69f91
Packit a69f91
RETSIGTYPE
Packit a69f91
child_sigint_handler(n)
Packit a69f91
int n;
Packit a69f91
{
Packit a69f91
}
Packit a69f91
Packit a69f91
RETSIGTYPE
Packit a69f91
parent_sigint_handler(n)
Packit a69f91
int n;
Packit a69f91
{
Packit a69f91
signal_rearms++;
Packit a69f91
}
Packit a69f91
Packit a69f91
main()
Packit a69f91
{
Packit a69f91
	signal(SIGINT,parent_sigint_handler);
Packit a69f91
Packit a69f91
	if (0 == fork()) {
Packit a69f91
		signal(SIGINT,child_sigint_handler);
Packit a69f91
		kill(getpid(),SIGINT);
Packit a69f91
		kill(getpid(),SIGINT);
Packit a69f91
		kill(getppid(),SIGINT);
Packit a69f91
	} else {
Packit a69f91
		int status;
Packit a69f91
Packit a69f91
		wait(&status);
Packit a69f91
		unlink("core");
Packit a69f91
		exit(signal_rearms);
Packit a69f91
	}
Packit a69f91
}],
Packit a69f91
	AC_MSG_RESULT(yes)
Packit a69f91
	AC_DEFINE(REARM_SIG)
Packit a69f91
,
Packit a69f91
	AC_MSG_RESULT(no)
Packit a69f91
, AC_MSG_WARN([Expect can't be cross compiled])
Packit a69f91
)
Packit a69f91
Packit a69f91
# HPUX7 has trouble with the big cat so split it
Packit a69f91
# Owen Rees <rtor@ansa.co.uk> 29Mar93 
Packit a69f91
SEDDEFS="${SEDDEFS}CONFEOF
Packit a69f91
cat >> conftest.sed <
Packit a69f91
"
Packit a69f91
#
Packit a69f91
Packit a69f91
# There are multiple versions of getpty, alas.
Packit a69f91
# I don't remember who has the first one, but Convex just added one
Packit a69f91
# so check for it.  Unfortunately, there is no header so the only
Packit a69f91
# reasonable way to make sure is to look it we are on a Convex.
Packit a69f91
AC_MSG_CHECKING([if on Convex])
Packit a69f91
convex=0
Packit a69f91
case "${host}" in
Packit a69f91
  c[[12]]-*-*)		convex=1;;
Packit a69f91
esac
Packit a69f91
Packit a69f91
if test $convex -eq 1 ; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  AC_DEFINE(CONVEX)
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if on HP])
Packit a69f91
if test "x`(uname) 2>/dev/null`" = xHP-UX; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  hp=1
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
  hp=0
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([sane default stty arguments])
Packit a69f91
DEFAULT_STTY_ARGS="sane"
Packit a69f91
Packit a69f91
if test $mach -eq 1 ; then
Packit a69f91
	DEFAULT_STTY_ARGS="cooked"
Packit a69f91
fi
Packit a69f91
Packit a69f91
if test $hp -eq 1 ; then
Packit a69f91
	DEFAULT_STTY_ARGS="sane kill ?"
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_RESULT($DEFAULT_STTY_ARG)
Packit a69f91
Packit a69f91
# Look for various features to determine what kind of pty
Packit a69f91
# we have. For some weird reason, ac_compile_check would not
Packit a69f91
# work, but ac_test_program does.
Packit a69f91
#
Packit a69f91
AC_MSG_CHECKING([for HP style pty allocation])
Packit a69f91
# following test fails on DECstations and other things that don't grok -c
Packit a69f91
# but that's ok, since they don't have PTYMs anyway
Packit a69f91
if test -r /dev/ptym/ptyp0 2>/dev/null ; then
Packit a69f91
    AC_MSG_RESULT(yes)
Packit a69f91
    AC_DEFINE(HAVE_PTYM)
Packit a69f91
else
Packit a69f91
    AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([for HP style pty trapping])
Packit a69f91
AC_HEADER_EGREP([struct.*request_info], sys/ptyio.h,
Packit a69f91
	AC_MSG_RESULT(yes)
Packit a69f91
	AC_DEFINE(HAVE_PTYTRAP)
Packit a69f91
,
Packit a69f91
	AC_MSG_RESULT(no)
Packit a69f91
)
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([for AIX new-style pty allocation])
Packit a69f91
if test -r /dev/ptc -a -r /dev/pts ; then
Packit a69f91
    AC_MSG_RESULT(yes)
Packit a69f91
    AC_DEFINE(HAVE_PTC_PTS)
Packit a69f91
else
Packit a69f91
    AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([for SGI old-style pty allocation])
Packit a69f91
if test -r /dev/ptc -a ! -r /dev/pts ; then
Packit a69f91
    AC_MSG_RESULT(yes)
Packit a69f91
    AC_DEFINE(HAVE_PTC)
Packit a69f91
else
Packit a69f91
    AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
# On SCO OpenServer, two types of ptys are available: SVR4 streams and c-list.
Packit a69f91
# The library routines to open the SVR4 ptys are broken on certain systems and
Packit a69f91
# the SCO command to increase the number of ptys only configure c-list ones
Packit a69f91
# anyway.  So we chose these, which have a special numbering scheme.
Packit a69f91
#
Packit a69f91
AC_MSG_CHECKING([for SCO style pty allocation])
Packit a69f91
sco_ptys=""
Packit a69f91
case "${host}" in
Packit a69f91
  *-sco3.2v[[45]]*)	sco_clist_ptys=1 svr4_ptys_broken=1;;
Packit a69f91
esac
Packit a69f91
Packit a69f91
if test x"${sco_clist_ptys}" != x"" ; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  AC_DEFINE(HAVE_SCO_CLIST_PTYS)
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([for SVR4 style pty allocation])
Packit a69f91
if test -r /dev/ptmx -a "x$svr4_ptys_broken" = x ; then
Packit a69f91
  AC_MSG_RESULT(yes)
Packit a69f91
  AC_DEFINE(HAVE_PTMX)
Packit a69f91
  # aargg. Some systems need libpt.a to use /dev/ptmx
Packit a69f91
  AC_CHECK_LIB(pt, libpts="-lpt", libpts="")
Packit a69f91
  AC_CHECK_FUNC(ptsname, , LIBS="${LIBS} $libpts")
Packit a69f91
else
Packit a69f91
  AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
# In OSF/1 case, SVR4 are somewhat different.
Packit a69f91
# Gregory Depp <depp@osf.org> 17Aug93
Packit a69f91
AC_MSG_CHECKING([for OSF/1 style pty allocation])
Packit a69f91
if test -r /dev/ptmx_bsd ; then
Packit a69f91
    AC_DEFINE(HAVE_PTMX_BSD)
Packit a69f91
    AC_MSG_RESULT(yes)
Packit a69f91
else
Packit a69f91
    AC_MSG_RESULT(no)
Packit a69f91
fi
Packit a69f91
Packit a69f91
tcgetattr=0
Packit a69f91
tcsetattr=0
Packit a69f91
AC_CHECK_FUNC(tcgetattr, tcgetattr=1)
Packit a69f91
AC_CHECK_FUNC(tcsetattr, tcsetattr=1)
Packit a69f91
if test $tcgetattr -eq 1 -a $tcsetattr -eq 1 ; then
Packit a69f91
    AC_DEFINE(HAVE_TCSETATTR)
Packit a69f91
    AC_DEFINE(POSIX)
Packit a69f91
fi
Packit a69f91
Packit a69f91
# first check for the pure bsd
Packit a69f91
AC_MSG_CHECKING([for struct sgttyb])
Packit a69f91
AC_TRY_RUN([
Packit a69f91
#include <sgtty.h>
Packit a69f91
main()
Packit a69f91
{
Packit a69f91
  struct sgttyb tmp;
Packit a69f91
  exit(0);
Packit a69f91
}],
Packit a69f91
        AC_MSG_RESULT(yes)
Packit a69f91
        AC_DEFINE(HAVE_SGTTYB)
Packit a69f91
        PTY_TYPE=sgttyb
Packit a69f91
,
Packit a69f91
        AC_MSG_RESULT(no)
Packit a69f91
,
Packit a69f91
	AC_MSG_ERROR([Expect can't be cross compiled])
Packit a69f91
)
Packit a69f91
Packit a69f91
# mach systems have include files for unimplemented features
Packit a69f91
# so avoid doing following test on those systems
Packit a69f91
if test $mach -eq 0 ; then
Packit a69f91
Packit a69f91
  # next check for the older style ttys
Packit a69f91
  # note that if we detect termio.h (only), we still set PTY_TYPE=termios
Packit a69f91
  # since that just controls which of pty_XXXX.c file is use and
Packit a69f91
  # pty_termios.c is set up to handle pty_termio.
Packit a69f91
  AC_MSG_CHECKING([for struct termio])
Packit a69f91
  AC_TRY_RUN([#include <termio.h>
Packit a69f91
  main()
Packit a69f91
  {
Packit a69f91
    struct termio tmp;
Packit a69f91
    exit(0);
Packit a69f91
  }],
Packit a69f91
        AC_DEFINE(HAVE_TERMIO)
Packit a69f91
        PTY_TYPE=termios
Packit a69f91
        AC_MSG_RESULT(yes)
Packit a69f91
,
Packit a69f91
        AC_MSG_RESULT(no)
Packit a69f91
,
Packit a69f91
	AC_MSG_ERROR([Expect can't be cross compiled])
Packit a69f91
)
Packit a69f91
Packit a69f91
  # now check for the new style ttys (not yet posix)
Packit a69f91
  AC_MSG_CHECKING([for struct termios])
Packit a69f91
  AC_TRY_RUN([
Packit a69f91
  /* including termios.h on Solaris 5.6 fails unless inttypes.h included */
Packit a69f91
#  ifdef HAVE_INTTYPES_H
Packit a69f91
#  include <inttypes.h>
Packit a69f91
#  endif
Packit a69f91
#  include <termios.h>
Packit a69f91
  main()
Packit a69f91
  {
Packit a69f91
    struct termios tmp;
Packit a69f91
    exit(0);
Packit a69f91
  }],
Packit a69f91
        AC_DEFINE(HAVE_TERMIOS)
Packit a69f91
        PTY_TYPE=termios
Packit a69f91
        AC_MSG_RESULT(yes)
Packit a69f91
  ,
Packit a69f91
        AC_MSG_RESULT(no)
Packit a69f91
  ,
Packit a69f91
	AC_MSG_ERROR([Expect can't be cross compiled])
Packit a69f91
  )
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if TCGETS or TCGETA in termios.h])
Packit a69f91
AC_TRY_RUN([
Packit a69f91
/* including termios.h on Solaris 5.6 fails unless inttypes.h included */
Packit a69f91
#ifdef HAVE_INTTYPES_H
Packit a69f91
#include <inttypes.h>
Packit a69f91
#endif
Packit a69f91
#include <termios.h>
Packit a69f91
main() {
Packit a69f91
#if defined(TCGETS) || defined(TCGETA)
Packit a69f91
	return 0;
Packit a69f91
#else
Packit a69f91
	return 1;
Packit a69f91
#endif
Packit a69f91
}],
Packit a69f91
	AC_DEFINE(HAVE_TCGETS_OR_TCGETA_IN_TERMIOS_H)
Packit a69f91
	AC_MSG_RESULT(yes)
Packit a69f91
,
Packit a69f91
	AC_MSG_RESULT(no)
Packit a69f91
,
Packit a69f91
	AC_MSG_ERROR([Expect can't be cross compiled])
Packit a69f91
)
Packit a69f91
Packit a69f91
AC_MSG_CHECKING([if TIOCGWINSZ in termios.h])
Packit a69f91
AC_TRY_RUN([
Packit a69f91
/* including termios.h on Solaris 5.6 fails unless inttypes.h included */
Packit a69f91
#ifdef HAVE_INTTYPES_H
Packit a69f91
#include <inttypes.h>
Packit a69f91
#endif
Packit a69f91
#include <termios.h>
Packit a69f91
main() {
Packit a69f91
#ifdef TIOCGWINSZ
Packit a69f91
	return 0;
Packit a69f91
#else
Packit a69f91
	return 1;
Packit a69f91
#endif
Packit a69f91
}],
Packit a69f91
	AC_DEFINE(HAVE_TIOCGWINSZ_IN_TERMIOS_H)
Packit a69f91
	AC_MSG_RESULT(yes)
Packit a69f91
,
Packit a69f91
	AC_MSG_RESULT(no)
Packit a69f91
,
Packit a69f91
	AC_MSG_ERROR([Expect can't be cross compiled])
Packit a69f91
)
Packit a69f91
Packit a69f91
# finally check for Cray style ttys
Packit a69f91
AC_MSG_CHECKING([for Cray-style ptys])
Packit a69f91
SETUID=":"
Packit a69f91
AC_TRY_RUN([
Packit a69f91
main(){
Packit a69f91
#ifdef CRAY
Packit a69f91
	return 0;
Packit a69f91
#else
Packit a69f91
	return 1;
Packit a69f91
#endif
Packit a69f91
}
Packit a69f91
],
Packit a69f91
	PTY_TYPE=unicos
Packit a69f91
	SETUID="chmod u+s"
Packit a69f91
	AC_MSG_RESULT(yes)
Packit a69f91
,
Packit a69f91
	AC_MSG_RESULT(no)
Packit a69f91
,
Packit a69f91
	AC_MSG_ERROR([Expect can't be cross compiled])
Packit a69f91
)
Packit a69f91
Packit a69f91
#
Packit a69f91
# Check for select and/or poll. If both exist, we prefer select.
Packit a69f91
# if neither exists, define SIMPLE_EVENT.
Packit a69f91
#
Packit a69f91
select=0
Packit a69f91
poll=0
Packit a69f91
unset ac_cv_func_select
Packit a69f91
AC_CHECK_FUNC(select, select=1)
Packit a69f91
AC_CHECK_FUNC(poll,   poll=1)
Packit a69f91
AC_MSG_CHECKING([event handling])
Packit a69f91
if test $select -eq 1 ; then
Packit a69f91
  EVENT_TYPE=select
Packit a69f91
  EVENT_ABLE=event
Packit a69f91
  AC_MSG_RESULT(via select)
Packit a69f91
elif test $poll -eq 1 ; then
Packit a69f91
  EVENT_TYPE=poll
Packit a69f91
  EVENT_ABLE=event
Packit a69f91
  AC_MSG_RESULT(via poll)
Packit a69f91
else
Packit a69f91
  EVENT_TYPE=simple
Packit a69f91
  EVENT_ABLE=noevent
Packit a69f91
  AC_MSG_RESULT(none)
Packit a69f91
  AC_DEFINE(SIMPLE_EVENT)
Packit a69f91
fi
Packit a69f91
Packit a69f91
AC_HAVE_FUNCS(_getpty)
Packit a69f91
AC_HAVE_FUNCS(getpty)
Packit a69f91
Packit a69f91
# following test sets SETPGRP_VOID if setpgrp takes 0 args, else takes 2
Packit a69f91
AC_FUNC_SETPGRP
Packit a69f91
Packit a69f91
#
Packit a69f91
# check for timezones
Packit a69f91
#
Packit a69f91
AC_MSG_CHECKING([for SV-style timezone])
Packit a69f91
AC_TRY_RUN([
Packit a69f91
extern char *tzname[2];
Packit a69f91
extern int daylight;
Packit a69f91
main()
Packit a69f91
{
Packit a69f91
  int *x = &daylight;
Packit a69f91
  char **y = tzname;
Packit a69f91
Packit a69f91
  exit(0);
Packit a69f91
}],
Packit a69f91
	AC_DEFINE(HAVE_SV_TIMEZONE)
Packit a69f91
	AC_MSG_RESULT(yes),
Packit a69f91
	AC_MSG_RESULT(no)
Packit a69f91
,
Packit a69f91
	AC_MSG_ERROR([Expect can't be cross compiled])
Packit a69f91
)
Packit a69f91
Packit a69f91
Packit a69f91
# Following comment stolen from Tcl's configure.in:
Packit a69f91
#   Note:  in the following variable, it's important to use the absolute
Packit a69f91
#   path name of the Tcl directory rather than "..":  this is because
Packit a69f91
#   AIX remembers this path and will attempt to use it at run-time to look
Packit a69f91
#   up the Tcl library.
Packit a69f91
Packit a69f91
PACKAGE_VERSION_NODOTS="`echo $PACKAGE_VERSION | sed -e 's/\.//g'`"
Packit a69f91
Packit a69f91
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
Packit a69f91
    EXP_LIB_VERSION=$PACKAGE_VERSION
Packit a69f91
else
Packit a69f91
    EXP_LIB_VERSION=$PACKAGE_VERSION_NODOTS
Packit a69f91
fi
Packit a69f91
if test $iunix -eq 1 ; then
Packit a69f91
    EXP_LIB_VERSION=$PACKAGE_VERSION_NODOTS
Packit a69f91
fi
Packit a69f91
Packit a69f91
# also remove dots on systems that don't support filenames > 14
Packit a69f91
# (are there systems which support shared libs and restrict filename lengths!?)
Packit a69f91
AC_SYS_LONG_FILE_NAMES
Packit a69f91
if test $ac_cv_sys_long_file_names = no; then
Packit a69f91
    EXP_LIB_VERSION=$PACKAGE_VERSION_NODOTS
Packit a69f91
fi
Packit a69f91
Packit a69f91
if test "$FRAMEWORK_BUILD" = "1" ; then
Packit a69f91
    EXP_BUILD_LIB_SPEC="-F`pwd` -framework Expect"
Packit a69f91
    EXP_LIB_SPEC="-framework Expect"
Packit a69f91
    EXP_LIB_FILE="Expect"
Packit a69f91
    AC_DEFINE(EXP_FRAMEWORK)
Packit a69f91
else
Packit a69f91
    if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
Packit a69f91
        EXP_LIB_FLAG="-lexpect${EXP_LIB_VERSION}"
Packit a69f91
    else
Packit a69f91
        EXP_LIB_FLAG="-lexpect`echo ${EXP_LIB_VERSION} | tr -d .`"
Packit a69f91
    fi
Packit a69f91
    EXP_BUILD_LIB_SPEC="-L`pwd` ${EXP_LIB_FLAG}"
Packit a69f91
    EXP_LIB_SPEC="-L${libdir} ${EXP_LIB_FLAG}"
Packit a69f91
fi
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# This section is based on analogous thing in Tk installation. - DEL
Packit a69f91
#	Various manipulations on the search path used at runtime to
Packit a69f91
#	find shared libraries:
Packit a69f91
#	2. On systems such as AIX and Ultrix that use "-L" as the
Packit a69f91
#	   search path option, colons cannot be used to separate
Packit a69f91
#	   directories from each other. Change colons to " -L".
Packit a69f91
#	3. Create two sets of search flags, one for use in cc lines
Packit a69f91
#	   and the other for when the linker is invoked directly.  In
Packit a69f91
#	   the second case, '-Wl,' must be stripped off and commas must
Packit a69f91
#	   be replaced by spaces.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}/${PACKAGE_NAME}${PACKAGE_VERSION}'
Packit a69f91
Packit a69f91
# If Tcl and Expect are installed in different places, adjust the library
Packit a69f91
# search path to reflect this.
Packit a69f91
Packit a69f91
if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
Packit a69f91
    LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib"
Packit a69f91
fi
Packit a69f91
Packit a69f91
if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then
Packit a69f91
    LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'`
Packit a69f91
fi
Packit a69f91
Packit a69f91
# The eval below is tricky!  It *evaluates* the string in
Packit a69f91
# ..._CC_SEARCH_FLAGS, which causes a substitution of the
Packit a69f91
# variable LIB_RUNTIME_DIR.
Packit a69f91
Packit a69f91
eval "EXP_CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\""
Packit a69f91
Packit a69f91
# now broken out into EXP_AND_TCL_LIBS.  Had to do this
Packit a69f91
# in order to avoid repeating lib specs to which some systems object.
Packit a69f91
Packit a69f91
LIBS="$LIBS $LD_SEARCH_FLAGS"
Packit a69f91
Packit a69f91
#
Packit a69f91
# Set up makefile substitutions
Packit a69f91
#
Packit a69f91
AC_SUBST(EXP_BUILD_LIB_SPEC)
Packit a69f91
AC_SUBST(EXP_CC_SEARCH_FLAGS)
Packit a69f91
AC_SUBST(SETUID)
Packit a69f91
AC_SUBST(SETPGRP_VOID)
Packit a69f91
AC_SUBST(DEFAULT_STTY_ARGS)
Packit a69f91
# Expect uses these from tclConfig.sh to make the main executable
Packit a69f91
AC_SUBST(TCL_DL_LIBS)
Packit a69f91
AC_SUBST(TCL_CC_SEARCH_FLAGS)
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# More TEA code based on data we got from the original expect
Packit a69f91
# configure code.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
#-----------------------------------------------------------------------
Packit a69f91
# Specify the C source files to compile in TEA_ADD_SOURCES,
Packit a69f91
# public headers that need to be installed in TEA_ADD_HEADERS,
Packit a69f91
# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
Packit a69f91
# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
Packit a69f91
# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
Packit a69f91
# and PKG_TCL_SOURCES.
Packit a69f91
#-----------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_ADD_SOURCES([
Packit a69f91
	exp_command.c expect.c exp_inter.c exp_regexp.c exp_tty.c
Packit a69f91
	exp_log.c exp_main_sub.c exp_pty.c exp_trap.c exp_strf.c
Packit a69f91
	exp_console.c exp_glob.c exp_win.c exp_clib.c exp_closetcl.c
Packit a69f91
	exp_memmove.c exp_tty_comm.c exp_chan.c Dbg.c
Packit a69f91
])
Packit a69f91
Packit a69f91
# Variant sources. Comments in the Makefile indicate that the
Packit a69f91
# event_type/able stuff can be overidden in the Makefile, and should
Packit a69f91
# be for particular systems. IMHO this requires a configure option.
Packit a69f91
#
Packit a69f91
# See at the end, where we select the sources based on the collect
Packit a69f91
# information.
Packit a69f91
Packit a69f91
TEA_ADD_SOURCES([
Packit a69f91
	pty_${PTY_TYPE}.c
Packit a69f91
	exp_${EVENT_TYPE}.c
Packit a69f91
	exp_${EVENT_ABLE}.c
Packit a69f91
])
Packit a69f91
Packit a69f91
TEA_ADD_HEADERS([expect.h expect_tcl.h expect_comm.h tcldbg.h])
Packit a69f91
Packit a69f91
TEA_ADD_INCLUDES([-I.])
Packit a69f91
TEA_ADD_INCLUDES([-I\"`\${CYGPATH} \${srcdir}`\"])
Packit a69f91
Packit a69f91
TEA_ADD_LIBS([])
Packit a69f91
TEA_ADD_CFLAGS([-DTCL_DEBUGGER -DUSE_NON_CONST])
Packit a69f91
TEA_ADD_CFLAGS([-DSCRIPTDIR=\\\"\${DESTDIR}\${prefix}/lib/\${PKG_DIR}\\\"])
Packit a69f91
TEA_ADD_CFLAGS([-DEXECSCRIPTDIR=\\\"\${DESTDIR}\${pkglibdir}\\\"])
Packit a69f91
TEA_ADD_CFLAGS([-DSTTY_BIN=\\\"${STTY_BIN}\\\"])
Packit a69f91
TEA_ADD_CFLAGS([-DDFLT_STTY=\"\\\"$DEFAULT_STTY_ARGS\\\"\"])
Packit a69f91
Packit a69f91
TEA_ADD_STUB_SOURCES([])
Packit a69f91
TEA_ADD_TCL_SOURCES([])
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# This macro generates a line to use when building a library.  It
Packit a69f91
# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
Packit a69f91
# and TEA_LOAD_TCLCONFIG macros above.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_MAKE_LIB
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
Packit a69f91
# file during the install process.  Don't run the TCLSH_PROG through
Packit a69f91
# ${CYGPATH} because it's being used directly by make.
Packit a69f91
# Require that we use a tclsh shell version 8.2 or later since earlier
Packit a69f91
# versions have bugs in the pkg_mkIndex routine.
Packit a69f91
# Add WISH as well if this is a Tk extension.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
TEA_PROG_TCLSH
Packit a69f91
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
# Finally, substitute all of the various values into the Makefile.
Packit a69f91
# You may alternatively have a special pkgIndex.tcl.in or other files
Packit a69f91
# which require substituting th AC variables in.  Include these here.
Packit a69f91
#--------------------------------------------------------------------
Packit a69f91
Packit a69f91
touch expect_cf.h
Packit a69f91
AC_OUTPUT([Makefile], chmod +x ${srcdir}/install-sh)