diff --git a/Makefile.in b/Makefile.in index 2d36791..8f36662 100644 --- a/Makefile.in +++ b/Makefile.in @@ -121,8 +121,8 @@ includedir = @includedir@ DESTDIR = PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) -pkgdatadir = $(datadir)/$(PKG_DIR) -pkglibdir = $(libdir)/$(PKG_DIR) +pkgdatadir = $(datadir)/tcl@TCL_VERSION@/$(PKG_DIR) +pkglibdir = $(libdir)/tcl@TCL_VERSION@/$(PKG_DIR) pkgincludedir = $(includedir)/$(PKG_DIR) top_builddir = . @@ -263,7 +263,7 @@ install-doc: doc else true; fi ; \ done -test: binaries libraries +test: binaries libraries pkgIndex.tcl-test $(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS) shell: binaries libraries @@ -331,6 +331,11 @@ pkgIndex.tcl: pkgIndex.tcl-hand: (echo 'if {![package vsatisfies [package provide Tcl] @TCL_VERSION@]} {return}' ; \ echo 'package ifneeded Expect $(PACKAGE_VERSION) \ + [list load [file join $$dir .. .. $(PKG_LIB_FILE)]]'\ + ) > pkgIndex.tcl + +pkgIndex.tcl-test: + (echo 'package ifneeded Expect $(PACKAGE_VERSION) \ [list load [file join $$dir $(PKG_LIB_FILE)]]'\ ) > pkgIndex.tcl diff --git a/Makefile.in.pkgpath b/Makefile.in.pkgpath new file mode 100644 index 0000000..2d36791 --- /dev/null +++ b/Makefile.in.pkgpath @@ -0,0 +1,636 @@ +# Makefile.in -- +# +# This file is a Makefile for Expect TEA Extension. If it has the name +# "Makefile.in" then it is a template for a Makefile; to generate the +# actual Makefile, run "./configure", which is a configuration script +# generated by the "autoconf" program (constructs like "@foo@" will get +# replaced in the actual Makefile. +# +# Copyright (c) 1999 Scriptics Corporation. +# Copyright (c) 2002-2005 ActiveState Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: Makefile.in,v 5.50 2010/09/17 16:49:22 hobbs Exp $ + +#======================================================================== +#======================================================================== + +# expect must be setuid on crays in order to open ptys (and accordingly, +# you must run this Makefile as root). +# See the FAQ for more info on why this is necessary on Crays. +SETUID = @SETUID@ +# SETUID = chmod u+s + +LIB_RUNTIME_DIR = $(DESTDIR)@libdir@ + +# The following Expect scripts are not necessary to have installed as +# commands, but are very useful. Edit out what you don't want +# installed. The INSTALL file describes these and others in more +# detail. Some Make's screw up if you delete all of them because +# SCRIPTS is a target. If this is a problem, just comment out the +# SCRIPTS target itself. + +SCRIPTS = timed-run timed-read ftp-rfc autopasswd lpunlock weather \ + passmass rftp kibitz rlogin-cwd xpstat tkpasswd dislocate xkibitz \ + tknewsbiff unbuffer mkpasswd cryptdir decryptdir autoexpect \ + multixterm + +# A couple of the scripts have man pages of their own. +# You can delete these too if you don't want'em. + +SCRIPTS_MANPAGES = kibitz dislocate xkibitz tknewsbiff unbuffer mkpasswd \ + passmass cryptdir decryptdir autoexpect multixterm + + +# allow us to handle null list gracefully, "end_of_list" should not exist + +SCRIPT_LIST = $(SCRIPTS) end_of_list +SCRIPT_MANPAGE_LIST = $(SCRIPTS_MANPAGES) end_of_list + +# Short directory path where binaries can be found to support #! hack. +# This directory path can be the same as the directory in which the +# binary actually sits except when the path is so long that the #! +# mechanism breaks (usually at 32 characters). The solution is to +# create a directory with a very short name, which consists only of +# symbolic links back to the true binaries. Subtracting two for "#!" +# and a couple more for arguments (typically " -f" or " --") gives you +# 27 characters. Pathnames over this length won't be able to use the +# #! magic. For more info on this, see the execve(2) man page. + +SHORT_BINDIR = $(exec_prefix)/bin + +#======================================================================== +# Nothing of the variables below this line should need to be changed. +# Please check the TARGETS section below to make sure the make targets +# are correct. +#======================================================================== + +#======================================================================== +# The names of the source files is defined in the configure script. +# The object files are used for linking into the final library. +# This will be used when a dist target is added to the Makefile. +# It is not important to specify the directory, as long as it is the +# $(srcdir) or in the generic, win or unix subdirectory. +#======================================================================== + +PKG_SOURCES = @PKG_SOURCES@ +PKG_OBJECTS = @PKG_OBJECTS@ + +PKG_STUB_SOURCES = @PKG_STUB_SOURCES@ +PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@ + +#======================================================================== +# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with +# this package that need to be installed, if any. +#======================================================================== + +PKG_TCL_SOURCES = @PKG_TCL_SOURCES@ + +#======================================================================== +# This is a list of public header files to be installed, if any. +#======================================================================== + +PKG_HEADERS = @PKG_HEADERS@ + +#======================================================================== +# "PKG_LIB_FILE" refers to the library (dynamic or static as per +# configuration options) composed of the named objects. +#======================================================================== + +PKG_LIB_FILE = @PKG_LIB_FILE@ +PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ + +lib_BINARIES = $(PKG_LIB_FILE) +bin_BINARIES = expect +BINARIES = $(lib_BINARIES) $(bin_BINARIES) + +SHELL = @SHELL@ + +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +libdir = @libdir@ +datadir = @datadir@ +mandir = @mandir@ +includedir = @includedir@ + +DESTDIR = + +PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION) +pkgdatadir = $(datadir)/$(PKG_DIR) +pkglibdir = $(libdir)/$(PKG_DIR) +pkgincludedir = $(includedir)/$(PKG_DIR) + +top_builddir = . + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ + +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +CC = @CC@ +CFLAGS_DEFAULT = @CFLAGS_DEFAULT@ +CFLAGS_WARNING = @CFLAGS_WARNING@ +CLEANFILES = @CLEANFILES@ +EXEEXT = @EXEEXT@ +LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@ +MAKE_LIB = @MAKE_LIB@ +MAKE_SHARED_LIB = @MAKE_SHARED_LIB@ +MAKE_STATIC_LIB = @MAKE_STATIC_LIB@ +MAKE_STUB_LIB = @MAKE_STUB_LIB@ +OBJEXT = @OBJEXT@ +RANLIB = @RANLIB@ +RANLIB_STUB = @RANLIB_STUB@ +SHLIB_CFLAGS = @SHLIB_CFLAGS@ +SHLIB_LD = @SHLIB_LD@ +SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ +STLIB_LD = @STLIB_LD@ +TCL_DEFS = @TCL_DEFS@ +TCL_BIN_DIR = @TCL_BIN_DIR@ +TCL_SRC_DIR = @TCL_SRC_DIR@ +# Not used, but retained for reference of what libs Tcl required +TCL_LIBS = @TCL_LIBS@ + +#======================================================================== +# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our +# package without installing. The other environment variables allow us +# to test against an uninstalled Tcl. Add special env vars that you +# require for testing here (like TCLX_LIBRARY). +#======================================================================== + +EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR) +TCLSH_ENV = TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \ + @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \ + PATH="$(EXTRA_PATH):$(PATH)" \ + TCLLIBPATH="$(top_builddir)" +TCLSH_PROG = @TCLSH_PROG@ +TCLSH = $(TCLSH_ENV) $(TCLSH_PROG) +SHARED_BUILD = @SHARED_BUILD@ + +INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@ + +PKG_CFLAGS = @PKG_CFLAGS@ + +# TCL_DEFS is not strictly need here, but if you remove it, then you +# must make sure that configure.in checks for the necessary components +# that your library may use. TCL_DEFS can actually be a problem if +# you do not compile with a similar machine setup as the Tcl core was +# compiled with. +#DEFS = $(TCL_DEFS) @DEFS@ $(PKG_CFLAGS) +DEFS = @DEFS@ $(PKG_CFLAGS) + +CONFIG_CLEAN_FILES = Makefile + +CPPFLAGS = @CPPFLAGS@ +LIBS = @PKG_LIBS@ @LIBS@ +AR = @AR@ +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + +#======================================================================== +# Start of user-definable TARGETS section +#======================================================================== + +#======================================================================== +# TEA TARGETS. Please note that the "libraries:" target refers to platform +# independent files, and the "binaries:" target inclues executable programs and +# platform-dependent libraries. Modify these targets so that they install +# the various pieces of your package. The make and install rules +# for the BINARIES that you specified above have already been done. +#======================================================================== + +all: binaries libraries doc + +#======================================================================== +# The binaries target builds executable programs, Windows .dll's, unix +# shared/static libraries, and any other platform-dependent files. +# The list of targets to build for "binaries:" is specified at the top +# of the Makefile, in the "BINARIES" variable. +#======================================================================== + +binaries: $(BINARIES) pkgIndex.tcl-hand + +libraries: + +doc: + +install: all install-binaries install-libraries install-doc + +install-binaries: binaries install-lib-binaries install-bin-binaries + +#======================================================================== +# This rule installs platform-independent files, such as header files. +#======================================================================== + +install-libraries: libraries $(SCRIPTS) + @mkdir -p $(DESTDIR)$(includedir) + @echo "Installing header files in $(DESTDIR)$(includedir)" + @list='$(PKG_HEADERS)'; for i in $$list; do \ + echo "Installing $(srcdir)/$$i" ; \ + $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \ + done; +# install standalone scripts and their man pages, if requested + @mkdir -p $(DESTDIR)$(prefix)/bin + -for i in $(SCRIPT_LIST) ; do \ + if [ -f $$i ] ; then \ + $(INSTALL_PROGRAM) $$i $(DESTDIR)$(prefix)/bin/$$i ; \ + rm -f $$i ; \ + else true; fi ; \ + done + +#======================================================================== +# Install documentation. Unix manpages should go in the $(mandir) +# directory. +#======================================================================== + +install-doc: doc + @mkdir -p $(DESTDIR)$(mandir)/man1 + @mkdir -p $(DESTDIR)$(mandir)/man3 + @echo "Installing documentation in $(DESTDIR)$(mandir)" +# install Expect man page + $(INSTALL_DATA) $(srcdir)/expect.man $(DESTDIR)$(mandir)/man1/expect.1 +# install man page for Expect library + $(INSTALL_DATA) $(srcdir)/libexpect.man $(DESTDIR)$(mandir)/man3/libexpect.3 + -for i in $(SCRIPT_MANPAGE_LIST) ; do \ + if [ -f $(srcdir)/example/$$i.man ] ; then \ + $(INSTALL_DATA) $(srcdir)/example/$$i.man $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + else true; fi ; \ + done + +test: binaries libraries + $(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS) + +shell: binaries libraries + @$(TCLSH) $(SCRIPT) + +expectshell: binaries libraries + @$(TCLSH_ENV) expect $(SCRIPT) + +gdb: + $(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT) + +depend: + +#======================================================================== +# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable +# mentioned above. That will ensure that this target is built when you +# run "make binaries". +# +# The $(PKG_OBJECTS) objects are created and linked into the final +# library. In most cases these object files will correspond to the +# source files above. +#======================================================================== + +$(PKG_LIB_FILE): $(PKG_OBJECTS) + -rm -f $(PKG_LIB_FILE) + ${MAKE_LIB} + $(RANLIB) $(PKG_LIB_FILE) + +$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS) + -rm -f $(PKG_STUB_LIB_FILE) + ${MAKE_STUB_LIB} + $(RANLIB_STUB) $(PKG_STUB_LIB_FILE) + +#======================================================================== +# We need to enumerate the list of .c to .o lines here. +# +# In the following lines, $(srcdir) refers to the toplevel directory +# containing your extension. If your sources are in a subdirectory, +# you will have to modify the paths to reflect this: +# +# Expect.$(OBJEXT): $(srcdir)/generic/Expect.c +# $(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/Expect.c` -o $@ +# +# Setting the VPATH variable to a list of paths will cause the makefile +# to look into these paths when resolving .c to .obj dependencies. +# As necessary, add $(srcdir):$(srcdir)/compat:.... +#======================================================================== + +VPATH = $(srcdir) + +.c.@OBJEXT@: + $(COMPILE) -c `@CYGPATH@ $<` -o $@ + +#======================================================================== +# Create the pkgIndex.tcl file. +# It is usually easiest to let Tcl do this for you with pkg_mkIndex, but +# you may find that you need to customize the package. If so, either +# modify the -hand version, or create a pkgIndex.tcl.in file and have +# the configure script output the pkgIndex.tcl by editing configure.in. +#======================================================================== + +pkgIndex.tcl: + ( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH) + +pkgIndex.tcl-hand: + (echo 'if {![package vsatisfies [package provide Tcl] @TCL_VERSION@]} {return}' ; \ + echo 'package ifneeded Expect $(PACKAGE_VERSION) \ + [list load [file join $$dir $(PKG_LIB_FILE)]]'\ + ) > pkgIndex.tcl + +#======================================================================== +# Distribution creation +# You may need to tweak this target to make it work correctly. +#======================================================================== + +TAR = tar +#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar +COMPRESS = $(TAR) zcvf $(PKG_DIR).tar.gz $(PKG_DIR) +DIST_ROOT = /tmp/dist +DIST_DIR = $(DIST_ROOT)/$(PKG_DIR) + +dist-clean: + rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.* + +dist: dist-clean doc + mkdir -p $(DIST_DIR) + cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \ + $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \ + $(srcdir)/fixline1 \ + $(DIST_DIR)/ + chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4 + chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in + + mkdir $(DIST_DIR)/tclconfig + cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \ + $(srcdir)/tclconfig/config.guess $(srcdir)/tclconfig/config.sub \ + $(DIST_DIR)/tclconfig/ + chmod 664 $(DIST_DIR)/tclconfig/tcl.m4 + chmod +x $(DIST_DIR)/tclconfig/install-sh + + cp -p $(srcdir)/*.{c,h,man} $(srcdir)/vgrindefs $(srcdir)/NEWS \ + $(srcdir)/INSTALL $(srcdir)/FAQ $(srcdir)/HISTORY \ + $(DIST_DIR)/ + chmod 664 $(DIST_DIR)/*.{c,h,man} + + -list='demos example generic library tests unix win tests testsuite'; \ + for p in $$list; do \ + if test -d $(srcdir)/$$p ; then \ + mkdir -p $(DIST_DIR)/$$p; \ + cp -p $(srcdir)/$$p/* $(DIST_DIR)/$$p/; \ + fi; \ + done + (cd $(DIST_ROOT); $(COMPRESS);) + cp $(DIST_ROOT)/$(PKG_DIR).tar.gz $(top_builddir) + +$(SCRIPTS): + $(TCLSH) $(srcdir)/fixline1 $(SHORT_BINDIR) < $(srcdir)/example/$@ > $@ + +## We cannot use TCL_LIBS below (after TCL_LIB_SPEC) because its +## expansion references the contents of LIBS, which contains linker +## options we cannot use here (and which is what we are replacing in +## the first place). + +expect: exp_main_exp.o $(PKG_LIB_FILE) + $(CC) \ + @CFLAGS@ \ + @LDFLAGS_DEFAULT@ \ + -o expect exp_main_exp.o \ + @EXP_BUILD_LIB_SPEC@ \ + @TCL_LIB_SPEC@ \ + @TCL_DL_LIBS@ @PKG_LIBS@ @MATH_LIBS@ \ + @TCL_CC_SEARCH_FLAGS@ \ + @EXP_CC_SEARCH_FLAGS@ + $(SETUID) expect + +expectk: + @echo "expectk remove from distribution" + @echo "use tclsh with package require Tk and Expect" + +#======================================================================== +# Produce FAQ and homepage +#======================================================================== + +WEBDIR = /proj/itl/www/div826/subject/expect +VERSION = $(PACKAGE_VERSION) + +# create the FAQ in html form +FAQ.html: FAQ.src FAQ.tcl + FAQ.src html > FAQ.html + +# create the FAQ in text form +FAQ: FAQ.src FAQ.tcl + FAQ.src text > FAQ + +# generate Expect home page +homepage.html: homepage.src homepage.tcl expect.tar.gz.md5 + homepage.src > homepage.html + +expect.tar.gz.md5: expect-$(VERSION).tar.gz + md5 expect-$(VERSION).tar.gz > expect.tar.gz.md5 + +# install various html docs on our web server +install-html: FAQ.html homepage.html + cp homepage.html $(WEBDIR)/index.html + cp FAQ.html $(WEBDIR) + +# HTMLize man pages for examples and push them out to the web server +example-man-pages: + -for i in $(SCRIPT_MANPAGE_LIST) ; do \ + if [ -f $(srcdir)/example/$$i.man ] ; then \ + rman -f HTML $(srcdir)/example/$$i.man > $(srcdir)/example/$$i.man.html ; \ + cp $(srcdir)/example/$$i.man.html $(FTPDIR)/example ; \ + else true; fi ; \ + done + +#======================================================================== +# Push out releases +#======================================================================== + +FTPDIR = /proj/itl/www/div826/subject/expect + +# make a private tar file for myself +tar: expect-$(VERSION).tar + mv expect-$(VERSION).tar expect.tar + +# make a release and install it on ftp server +# update web page to reflect new version +ftp: expect-$(VERSION).tar.Z expect-$(VERSION).tar.gz install-html homepage.html + cp expect-$(VERSION).tar.Z $(FTPDIR)/expect.tar.Z + cp expect-$(VERSION).tar.gz $(FTPDIR)/expect.tar.gz + cp expect-$(VERSION).tar.gz $(FTPDIR)/old/expect-$(VERSION).tar.gz + md5 $(FTPDIR)/expect.tar.gz > expect.tar.gz.md5 + cp HISTORY $(FTPDIR) + cp README $(FTPDIR)/README.distribution + cp example/README $(FTPDIR)/example + cp `pubfile example` $(FTPDIR)/example + ls -l $(FTPDIR)/expect.tar* +# delete .Z temp file, still need .gz though for md5 later + rm expect-$(VERSION).tar* + +# make an alpha release and install it on ftp server +alpha: expect-$(VERSION).tar.Z expect-$(VERSION).tar.gz + cp expect-$(VERSION).tar.Z $(FTPDIR)/alpha.tar.Z + cp expect-$(VERSION).tar.gz $(FTPDIR)/alpha.tar.gz + cp HISTORY $(FTPDIR) + rm expect-$(VERSION).tar* + ls -l $(FTPDIR)/alpha.tar* + +# make a beta release and install it on ftp server +beta: expect-$(VERSION).tar.Z expect-$(VERSION).tar.gz + rm -rf $(FTPDIR)/alpha.tar* + cp expect-$(VERSION).tar.Z $(FTPDIR)/beta.tar.Z + cp expect-$(VERSION).tar.gz $(FTPDIR)/beta.tar.gz + cp HISTORY $(FTPDIR) + rm expect-$(VERSION).tar* + ls -l $(FTPDIR)/beta.tar* + +expect-$(VERSION).tar: configure + rm -f ../expect-$(VERSION) + ln -s `pwd` ../expect-$(VERSION) + cd ..;tar cvfh $@ `pubfile expect-$(VERSION)` + mv ../$@ . + +expect-$(VERSION).tar.Z: expect-$(VERSION).tar + compress -fc expect-$(VERSION).tar > $@ + +expect-$(VERSION).tar.gz: expect-$(VERSION).tar + gzip -fc expect-$(VERSION).tar > $@ + +#======================================================================== +# End of user-definable section +#======================================================================== + +#======================================================================== +# Don't modify the file to clean here. Instead, set the "CLEANFILES" +# variable in configure.in +#======================================================================== + +clean: + -test -z "$(BINARIES)" || rm -f $(BINARIES) + -rm -f *.$(OBJEXT) core *.core + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean: clean + -rm -f *.tab.c + -rm -f $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log config.status + +#======================================================================== +# Install binary object libraries. On Windows this includes both .dll and +# .lib files. Because the .lib files are not explicitly listed anywhere, +# we need to deduce their existence from the .dll file of the same name. +# Library files go into the lib directory. +# In addition, this will generate the pkgIndex.tcl +# file in the install location (assuming it can find a usable tclsh shell) +# +# You should not have to modify this target. +#======================================================================== + +install-lib-binaries: + @mkdir -p $(DESTDIR)$(pkglibdir) + @list='$(lib_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \ + stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \ + if test "x$$stub" = "xstub"; then \ + echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \ + else \ + echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \ + $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \ + fi; \ + ext=`echo $$p|sed -e "s/.*\.//"`; \ + if test "x$$ext" = "xdll"; then \ + lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \ + if test -f $$lib; then \ + echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \ + $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \ + fi; \ + fi; \ + fi; \ + done + @list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + if test -f $(srcdir)/$$p; then \ + destp=`basename $$p`; \ + echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \ + $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \ + fi; \ + done + @if test "x$(SHARED_BUILD)" = "x1"; then \ + echo " Install pkgIndex.tcl $(DESTDIR)$(pkglibdir)"; \ + $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \ + fi + +#======================================================================== +# Install binary executables (e.g. .exe files and dependent .dll files) +# This is for files that must go in the bin directory (located next to +# wish and tclsh), like dependent .dll files on Windows. +# +# You should not have to modify this target, except to define bin_BINARIES +# above if necessary. +#======================================================================== + +install-bin-binaries: + @mkdir -p $(DESTDIR)$(bindir) + @list='$(bin_BINARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ + fi; \ + done + +.SUFFIXES: .c .$(OBJEXT) .man .n .html + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +uninstall-binaries: + list='$(lib_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(PKG_TCL_SOURCES)'; for p in $$list; do \ + p=`basename $$p`; \ + rm -f $(DESTDIR)$(pkglibdir)/$$p; \ + done + list='$(bin_BINARIES)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/$$p; \ + done + +#======================================================================== +# +# Target to regenerate header files and stub files from the *.decls tables. +# +#======================================================================== + +genstubs: + $(TCLSH_PROG) \ + $(srcdir)/tools/genStubs.tcl $(srcdir)/generic \ + $(srcdir)/Expect.decls + +#======================================================================== +# +# Target to check that all exported functions have an entry in the stubs +# tables. +# +#======================================================================== + +Expect_DECLS = \ + $(srcdir)/expect.decls + +checkstubs: + -@for i in `nm -p $(Expect_LIB_FILE) | awk '$$2 ~ /T/ { print $$3 }' \ + | sort -n`; do \ + match=0; \ + for j in $(Expect_DECLS); do \ + if [ `grep -c $$i $$j` -gt 0 ]; then \ + match=1; \ + fi; \ + done; \ + if [ $$match -eq 0 ]; then echo $$i; fi \ + done + + +.PHONY: all binaries clean depend distclean doc install libraries test chantest + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/configure.in b/configure.in index aa6fd6e..51558fa 100755 --- a/configure.in +++ b/configure.in @@ -977,6 +977,7 @@ AC_SUBST(EXP_CC_SEARCH_FLAGS) AC_SUBST(SETUID) AC_SUBST(SETPGRP_VOID) AC_SUBST(DEFAULT_STTY_ARGS) +AC_SUBST(TCL_VERSION) # Expect uses these from tclConfig.sh to make the main executable AC_SUBST(TCL_DL_LIBS) AC_SUBST(TCL_CC_SEARCH_FLAGS) diff --git a/configure.in.pkgpath b/configure.in.pkgpath new file mode 100755 index 0000000..aa6fd6e --- /dev/null +++ b/configure.in.pkgpath @@ -0,0 +1,1059 @@ +dnl +dnl Process this file with autoconf to produce a configure script. +dnl +AC_REVISION($Id: configure.in,v 5.82 2013/11/04 19:03:00 andreas_kupries Exp $) + +AC_INIT([expect],[5.45.4]) + +TEA_INIT([3.9]) + +AC_CONFIG_AUX_DIR(tclconfig) + +#-------------------------------------------------------------------- +# Configure script for package 'Expect'. +# TEA compliant. +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + +TEA_PATH_TCLCONFIG +TEA_LOAD_TCLCONFIG + +# expectk has been removed from the distribution as Tcl has supported +# dynamic extensions everywhere for a while. We still allow 'expect' +# to be built for the die-hard users, but expectk is just wish with +# package require Expect +if test "${with_tk+set}" = set ; then + AC_MSG_WARN([With Tk request ignored - use package require Tk & Expect]) +fi + +#----------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + +TEA_PREFIX + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + +TEA_SETUP_COMPILER + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG +#-------------------------------------------------------------------- + +#TEA_PUBLIC_TCL_HEADERS +TEA_PRIVATE_TCL_HEADERS + +#-------------------------------------------------------------------- +# You can add more files to clean if your extension creates any extra +# files by extending CLEANFILES. +# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure +# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var. +# +# A few miscellaneous platform-specific items: +# TEA_ADD_* any platform specific compiler/build info here. +#-------------------------------------------------------------------- + +TEA_ADD_CLEANFILES([pkgIndex.tcl]) + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +# So far only Tcl responds to this one. +# +# Hook for when threading is supported in Expect. The --enable-threads +# flag currently has no effect. +#------------------------------------------------------------------------ + +TEA_ENABLE_THREADS + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + +TEA_ENABLE_SHARED + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + +TEA_CONFIG_CFLAGS + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols option. +#-------------------------------------------------------------------- + +TEA_ENABLE_SYMBOLS + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. +#-------------------------------------------------------------------- + +AC_DEFINE(USE_TCL_STUBS) +AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs]) + +#------------------------------------------------------------------------- +# Check for system header files. +#------------------------------------------------------------------------- + +AC_CHECK_HEADER(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H)) +AC_CHECK_HEADER(sys/sysmacros.h, AC_DEFINE(HAVE_SYSMACROS_H)) + +# Oddly, some systems have stdarg but don't support prototypes +# Tcl avoids the whole issue by not using stdarg on UNIX at all! + +dnl AC_CHECK_HEADER(stdarg.h, AC_DEFINE(HAVE_STDARG_H)) + +AC_CHECK_HEADER(varargs.h, AC_DEFINE(HAVE_VARARGS_H)) + +# If no stropts.h, then the svr4 implementation is broken. +# At least it is on my Debian "potato" system. - Rob Savoye + +AC_CHECK_HEADER(sys/stropts.h, AC_DEFINE(HAVE_STROPTS_H), svr4_ptys_broken=1) +AC_CHECK_HEADER(sys/sysconfig.h, AC_DEFINE(HAVE_SYSCONF_H)) +AC_CHECK_HEADER(sys/fcntl.h, AC_DEFINE(HAVE_SYS_FCNTL_H)) +AC_CHECK_HEADER(sys/ptem.h, AC_DEFINE(HAVE_SYS_PTEM_H)) +AC_CHECK_HEADER(sys/strredir.h, AC_DEFINE(HAVE_STRREDIR_H)) +AC_CHECK_HEADER(sys/strpty.h, AC_DEFINE(HAVE_STRPTY_H)) + +AC_MSG_CHECKING([for sys/bsdtypes.h]) +if test "ISC_${ISC}" = "ISC_1" ; then + AC_MSG_RESULT(yes) + # if on ISC 1, we need to get FD_SET macros + AC_HAVE_HEADERS(sys/bsdtypes.h) +else + AC_MSG_RESULT(no) +fi + +#------------------------------------------------------------------------- +# What type do signals return? +#------------------------------------------------------------------------- + +AC_TYPE_SIGNAL + +#------------------------------------------------------------------------- +# Find out all about time handling differences. +#------------------------------------------------------------------------- + +TEA_TIME_HANDLER + +#-------------------------------------------------------------------- +# The check below checks whether defines the type +# "union wait" correctly. It's needed because of weirdness in +# HP-UX where "union wait" is defined in both the BSD and SYS-V +# environments. Checking the usability of WIFEXITED seems to do +# the trick. +#-------------------------------------------------------------------- + +AC_MSG_CHECKING([union wait]) +AC_CACHE_VAL(tcl_cv_union_wait, + AC_TRY_LINK([#include +#include ], [ +union wait x; +WIFEXITED(x); /* Generates compiler error if WIFEXITED uses an int. */ + ], tcl_cv_union_wait=yes, tcl_cv_union_wait=no)) +AC_MSG_RESULT($tcl_cv_union_wait) +if test $tcl_cv_union_wait = no; then + AC_DEFINE(NO_UNION_WAIT) +fi + +###################################################################### +# required by Sequent ptx2 + +AC_CHECK_FUNC(gethostname, gethostname=1 , gethostname=0) +if test $gethostname -eq 0 ; then + AC_CHECK_LIB(inet, gethostname, LIBS="$LIBS -linet") +fi + +###################################################################### +# required by Fischman's ISC 4.0 + +AC_CHECK_FUNC(socket, socket=1 , socket=0) +if test $socket -eq 0 ; then + AC_CHECK_LIB(inet, socket, LIBS="$LIBS -linet") +fi + +###################################################################### + +AC_CHECK_FUNC(select, select=1 , select=0) +if test $select -eq 0 ; then + AC_CHECK_LIB(inet, select, LIBS="$LIBS -linet") +fi + +###################################################################### + +AC_CHECK_FUNC(getpseudotty, getpseudotty=1 , getpseudotty=0) +if test $getpseudotty -eq 0 ; then + AC_CHECK_LIB(seq, getpseudotty) +fi + +###################################################################### +# Check for FreeBSD/NetBSD openpty() +unset ac_cv_func_openpty + +AC_CHECK_FUNC(openpty, AC_DEFINE(HAVE_OPENPTY) openpty=1 , openpty=0) +if test $openpty -eq 0 ; then + AC_CHECK_LIB(util, openpty, [ + # we only need to define OPENPTY once, but since we are overriding + # the default behavior, we must also handle augment LIBS too. + # This needn't be done in the 2nd and 3rd tests. + AC_DEFINE(HAVE_OPENPTY) + LIBS="$LIBS -lutil" + ]) +fi + +###################################################################### +# End of library/func checking +###################################################################### + +# Hand patches to library/func checking. +dnl From: Michael Kuhl +dnl To get expect to compile on a Sequent NUMA-Q running DYNIX/ptx v4.4.2. + +AC_MSG_CHECKING([if running Sequent running SVR4]) +if test "$host_alias" = "i386-sequent-sysv4" ; then + LIBS="-lnsl -lsocket -lm" + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +#-------------------------------------------------------------------- +#-------------------------------------------------------------------- +#-------------------------------------------------------------------- +#-------------------------------------------------------------------- +# From here on comes original expect configure code. +# At the end we will have another section of TEA 3.2 code. +# +# Note specialities +# +# - Runs a sub configure (Dbgconfigure) for the expect tcl debugger +# +#-------------------------------------------------------------------- +#-------------------------------------------------------------------- + +dnl AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) +AC_CANONICAL_SYSTEM + +# If `configure' is invoked (in)directly via `make', ensure that it +# encounters no `make' conflicts. +# + +dnl unset MFLAGS MAKEFLAGS +MFLAGS= +MAKEFLAGS= + +# An explanation is in order for the strange things going on with the +# various LIBS. There are three separate definitions for LIBS. The +# reason is that some systems require shared libraries include +# references to their dependent libraries, i.e., any additional +# libraries that must be linked to. And some systems get upset if the +# references are repeated on the link line. So therefore, we create +# one for Expect, one for Expect and Tcl, and one for building Expect's own +# shared library. Tcl's tclConfig.sh insists that any shared libs +# that it "helps" build must pass the libraries as LIBS (see comment +# near end of this configure file). I would do but since we're close +# to hitting config's max symbols, we take one short cut and pack the +# LIBS into EXP_SHLIB_LD_LIBS (which is basically what Tcl wants to do +# for us). The point, however, is that there's no separate LIBS or +# EXP_LIBS symbol passed out of configure. One additional point for +# confusion is that LIBS is what configure uses to do all library +# tests, so we have to swap definitions of LIBS periodically. When we +# are swapping out the one for Expect's shared library, we save it in +# EXP_LIBS. Sigh. + +eval "LIBS=\"$TCL_LIBS\"" + +if test "${with_tcl+set}" = set ; then + case "${with_tcl}" in + ..*) + AC_MSG_WARN([Specify absolute path to --with-tcl for subdir configuration]) + ;; + esac +fi + +# these are the other subdirectories we need to configure +AC_CONFIG_SUBDIRS(testsuite) + +AC_TYPE_PID_T + +AC_MSG_CHECKING([if running Mach]) +mach=0 +case "${host}" in + # Both Next and pure Mach behave identically with respect + # to a few things, so just lump them together as "mach" + *-*-mach*) mach=1 ;; + *-*-next*) mach=1 ; next=1 ;; +esac + +if test $mach -eq 1 ; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING([if running MachTen]) +# yet another Mach clone +if test -r /MachTen ; then + AC_MSG_RESULT(yes) + mach=1 +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING([if on Pyramid]) +if test -r /bin/pyr ; then + AC_MSG_RESULT(yes) + pyr=1 +else + AC_MSG_RESULT(no) + pyr=0 +fi + +AC_MSG_CHECKING([if on Apollo]) +if test -r /usr/apollo/bin ; then + AC_MSG_RESULT(yes) + apollo=1 +else + AC_MSG_RESULT(no) + apollo=0 +fi + +AC_MSG_CHECKING([if on Interactive]) +if test "x`(uname -s) 2>/dev/null`" = xIUNIX; then + AC_MSG_RESULT(yes) + iunix=1 +else + AC_MSG_RESULT(no) + iunix=0 +fi + +AC_MSG_CHECKING([stty to use]) +if test -r /usr/local/bin/stty ; then + STTY_BIN=/usr/local/bin/stty +else + STTY_BIN=/bin/stty +fi +AC_MSG_RESULT($STTY_BIN) + +AC_MSG_CHECKING([if stty reads stdout]) + +# On some systems stty can't be run in the background (svr4) or get it +# wrong because they fail to complain (next, mach), so don't attempt +# the test on some systems. + +stty_reads_stdout="" +case "${host}" in + *-*-solaris*) stty_reads_stdout=0 ;; + *-*-irix*) stty_reads_stdout=0 ;; + *-*-sco3.2v[[45]]*) stty_reads_stdout=1 ;; + i[[3456]]86-*-sysv4.2MP) stty_reads_stdout=0 ;; + *-*-linux*) stty_reads_stdout=0 ;; + # Not sure about old convex but 5.2 definitely reads from stdout + c[[12]]-*-*) stty_reads_stdout=1 ;; + *-*-aix[[34]]*) stty_reads_stdout=0 ;; + *-*-hpux9*) stty_reads_stdout=0 ;; + *-*-hpux10*) stty_reads_stdout=0 ;; + *-*-osf[[234]]*) stty_reads_stdout=0 ;; + *-*-ultrix4.4) stty_reads_stdout=0 ;; + *-*-dgux*) stty_reads_stdout=0 ;; +esac + +if test $mach -eq 1 ; then + stty_reads_stdout=1 +fi +if test $apollo -eq 1 ; then + stty_reads_stdout=1 +fi +if test $pyr -eq 1 ; then + stty_reads_stdout=1 +fi + +# if we still don't know, test +if test x"${stty_reads_stdout}" = x"" ; then + $STTY_BIN > /dev/null 2> /dev/null ; a=$? + $STTY_BIN < /dev/tty > /dev/null 2> /dev/null ; b=$? + if test $a -ne 0 -a $b -ne 0; then + stty_reads_stdout=1 + else + stty_reads_stdout=0 + fi +fi + +if test ${stty_reads_stdout} -eq 1 ; then + AC_MSG_RESULT(yes) + AC_DEFINE(STTY_READS_STDOUT) +else + AC_MSG_RESULT(no) +fi + +# Solaris 2.4 and later requires __EXTENSIONS__ in order to see all sorts +# of traditional but nonstandard stuff in header files. +AC_MSG_CHECKING([if running Solaris]) +solaris=0 +case "${host}" in + *-*-solaris*) solaris=1;; +esac + +if test $solaris -eq 1 ; then + AC_MSG_RESULT(yes) + AC_DEFINE(SOLARIS) +else + AC_MSG_RESULT(no) +fi + +# On Interactive UNIX, -Xp must be added to LIBS in order to find strftime. +# This test should really be done by Tcl. So just check Tcl's definition. +# If defective, add to all three LIBS. (It's not actually necessary for +# EXP_LIBS since -Xp will just be ignored the way that EXP_LIBS is used in +# the Makefile, but we include it for consistency.) + +if test $iunix -eq 1 ; then + AC_CHECK_FUNC(strftime, , [ + LIBS="${LIBS} -Xp" + ]) +fi + +###################################################################### +# +# Look for various header files +# + +# +# Look for functions that may be missing +# +dnl AC_CHECK_FUNC(memcpy, AC_DEFINE(HAVE_MEMCPY)) +AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE)) +AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF)) +AC_CHECK_FUNC(strftime, AC_DEFINE(HAVE_STRFTIME)) +AC_CHECK_FUNC(strchr, AC_DEFINE(HAVE_STRCHR)) +AC_CHECK_FUNC(timezone, AC_DEFINE(HAVE_TIMEZONE)) +AC_CHECK_FUNC(siglongjmp, AC_DEFINE(HAVE_SIGLONGJMP)) + +# dnl check for memcpy by hand +# because Unixware 2.0 handles it specially and refuses to compile +# autoconf's automatic test that is a call with no arguments +AC_MSG_CHECKING([for memcpy]) +AC_TRY_LINK(,[ +char *s1, *s2; +memcpy(s1,s2,0); +], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MEMCPY) + , + AC_MSG_RESULT(no) +) + +# Some systems only define WNOHANG if _POSIX_SOURCE is defined +# The following merely tests that sys/wait.h can be included +# and if so that WNOHANG is not defined. The only place I've +# seen this is ISC. +AC_MSG_CHECKING([if WNOHANG requires _POSIX_SOURCE]) +AC_TRY_RUN([ +#include +main() { +#ifndef WNOHANG + return 0; +#else + return 1; +#endif +}], + AC_MSG_RESULT(yes) + AC_DEFINE(WNOHANG_REQUIRES_POSIX_SOURCE) +, + AC_MSG_RESULT(no) +, + AC_MSG_ERROR([Expect can't be cross compiled]) +) + +AC_MSG_CHECKING([if any value exists for WNOHANG]) +rm -rf wnohang +AC_TRY_RUN([ +#include +#include +main() { +#ifdef WNOHANG + FILE *fp = fopen("wnohang","w"); + fprintf(fp,"%d",WNOHANG); + fclose(fp); + return 0; +#else + return 1; +#endif +}], + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, `cat wnohang`) + rm -f wnohang +, + AC_MSG_RESULT(no) + AC_DEFINE(WNOHANG_BACKUP_VALUE, 1) +, + AC_MSG_ERROR([Expect can't be cross compiled]) +) + +# +# check how signals work +# + +# Check for the data type of the mask used in select(). +# This picks up HP braindamage which defines fd_set and then +# proceeds to ignore it and use int. +# Pattern matching on int could be loosened. +# Can't use ac_header_egrep since that doesn't see prototypes with K&R cpp. +AC_MSG_CHECKING([mask type of select]) +if egrep "select\(size_t, int" /usr/include/sys/time.h >/dev/null 2>&1; then + AC_MSG_RESULT(int) + AC_DEFINE(SELECT_MASK_TYPE, int) +else + AC_MSG_RESULT(none) + AC_DEFINE(SELECT_MASK_TYPE, fd_set) +fi + +dnl # Check for the data type of the function used in signal(). This +dnl # must be before the test for rearming. +dnl # echo checking return type of signal handlers +dnl AC_HEADER_EGREP([(void|sighandler_t).*signal], signal.h, retsigtype=void,AC_DEFINE(RETSIGTYPE, int) retsigtype=int) + +# FIXME: check if alarm exists +AC_MSG_CHECKING([if signals need to be re-armed]) +AC_TRY_RUN([ +#include +#define RETSIGTYPE $retsigtype + +int signal_rearms = 0; + +RETSIGTYPE +child_sigint_handler(n) +int n; +{ +} + +RETSIGTYPE +parent_sigint_handler(n) +int n; +{ +signal_rearms++; +} + +main() +{ + signal(SIGINT,parent_sigint_handler); + + if (0 == fork()) { + signal(SIGINT,child_sigint_handler); + kill(getpid(),SIGINT); + kill(getpid(),SIGINT); + kill(getppid(),SIGINT); + } else { + int status; + + wait(&status); + unlink("core"); + exit(signal_rearms); + } +}], + AC_MSG_RESULT(yes) + AC_DEFINE(REARM_SIG) +, + AC_MSG_RESULT(no) +, AC_MSG_WARN([Expect can't be cross compiled]) +) + +# HPUX7 has trouble with the big cat so split it +# Owen Rees 29Mar93 +SEDDEFS="${SEDDEFS}CONFEOF +cat >> conftest.sed </dev/null`" = xHP-UX; then + AC_MSG_RESULT(yes) + hp=1 +else + AC_MSG_RESULT(no) + hp=0 +fi + +AC_MSG_CHECKING([sane default stty arguments]) +DEFAULT_STTY_ARGS="sane" + +if test $mach -eq 1 ; then + DEFAULT_STTY_ARGS="cooked" +fi + +if test $hp -eq 1 ; then + DEFAULT_STTY_ARGS="sane kill " +fi + +AC_MSG_RESULT($DEFAULT_STTY_ARG) + +# Look for various features to determine what kind of pty +# we have. For some weird reason, ac_compile_check would not +# work, but ac_test_program does. +# +AC_MSG_CHECKING([for HP style pty allocation]) +# following test fails on DECstations and other things that don't grok -c +# but that's ok, since they don't have PTYMs anyway +if test -r /dev/ptym/ptyp0 2>/dev/null ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTYM) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING([for HP style pty trapping]) +AC_HEADER_EGREP([struct.*request_info], sys/ptyio.h, + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTYTRAP) +, + AC_MSG_RESULT(no) +) + +AC_MSG_CHECKING([for AIX new-style pty allocation]) +if test -r /dev/ptc -a -r /dev/pts ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTC_PTS) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING([for SGI old-style pty allocation]) +if test -r /dev/ptc -a ! -r /dev/pts ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTC) +else + AC_MSG_RESULT(no) +fi + +# On SCO OpenServer, two types of ptys are available: SVR4 streams and c-list. +# The library routines to open the SVR4 ptys are broken on certain systems and +# the SCO command to increase the number of ptys only configure c-list ones +# anyway. So we chose these, which have a special numbering scheme. +# +AC_MSG_CHECKING([for SCO style pty allocation]) +sco_ptys="" +case "${host}" in + *-sco3.2v[[45]]*) sco_clist_ptys=1 svr4_ptys_broken=1;; +esac + +if test x"${sco_clist_ptys}" != x"" ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SCO_CLIST_PTYS) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING([for SVR4 style pty allocation]) +if test -r /dev/ptmx -a "x$svr4_ptys_broken" = x ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PTMX) + # aargg. Some systems need libpt.a to use /dev/ptmx + AC_CHECK_LIB(pt, libpts="-lpt", libpts="") + AC_CHECK_FUNC(ptsname, , LIBS="${LIBS} $libpts") +else + AC_MSG_RESULT(no) +fi + +# In OSF/1 case, SVR4 are somewhat different. +# Gregory Depp 17Aug93 +AC_MSG_CHECKING([for OSF/1 style pty allocation]) +if test -r /dev/ptmx_bsd ; then + AC_DEFINE(HAVE_PTMX_BSD) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +tcgetattr=0 +tcsetattr=0 +AC_CHECK_FUNC(tcgetattr, tcgetattr=1) +AC_CHECK_FUNC(tcsetattr, tcsetattr=1) +if test $tcgetattr -eq 1 -a $tcsetattr -eq 1 ; then + AC_DEFINE(HAVE_TCSETATTR) + AC_DEFINE(POSIX) +fi + +# first check for the pure bsd +AC_MSG_CHECKING([for struct sgttyb]) +AC_TRY_RUN([ +#include +main() +{ + struct sgttyb tmp; + exit(0); +}], + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SGTTYB) + PTY_TYPE=sgttyb +, + AC_MSG_RESULT(no) +, + AC_MSG_ERROR([Expect can't be cross compiled]) +) + +# mach systems have include files for unimplemented features +# so avoid doing following test on those systems +if test $mach -eq 0 ; then + + # next check for the older style ttys + # note that if we detect termio.h (only), we still set PTY_TYPE=termios + # since that just controls which of pty_XXXX.c file is use and + # pty_termios.c is set up to handle pty_termio. + AC_MSG_CHECKING([for struct termio]) + AC_TRY_RUN([#include + main() + { + struct termio tmp; + exit(0); + }], + AC_DEFINE(HAVE_TERMIO) + PTY_TYPE=termios + AC_MSG_RESULT(yes) +, + AC_MSG_RESULT(no) +, + AC_MSG_ERROR([Expect can't be cross compiled]) +) + + # now check for the new style ttys (not yet posix) + AC_MSG_CHECKING([for struct termios]) + AC_TRY_RUN([ + /* including termios.h on Solaris 5.6 fails unless inttypes.h included */ +# ifdef HAVE_INTTYPES_H +# include +# endif +# include + main() + { + struct termios tmp; + exit(0); + }], + AC_DEFINE(HAVE_TERMIOS) + PTY_TYPE=termios + AC_MSG_RESULT(yes) + , + AC_MSG_RESULT(no) + , + AC_MSG_ERROR([Expect can't be cross compiled]) + ) +fi + +AC_MSG_CHECKING([if TCGETS or TCGETA in termios.h]) +AC_TRY_RUN([ +/* including termios.h on Solaris 5.6 fails unless inttypes.h included */ +#ifdef HAVE_INTTYPES_H +#include +#endif +#include +main() { +#if defined(TCGETS) || defined(TCGETA) + return 0; +#else + return 1; +#endif +}], + AC_DEFINE(HAVE_TCGETS_OR_TCGETA_IN_TERMIOS_H) + AC_MSG_RESULT(yes) +, + AC_MSG_RESULT(no) +, + AC_MSG_ERROR([Expect can't be cross compiled]) +) + +AC_MSG_CHECKING([if TIOCGWINSZ in termios.h]) +AC_TRY_RUN([ +/* including termios.h on Solaris 5.6 fails unless inttypes.h included */ +#ifdef HAVE_INTTYPES_H +#include +#endif +#include +main() { +#ifdef TIOCGWINSZ + return 0; +#else + return 1; +#endif +}], + AC_DEFINE(HAVE_TIOCGWINSZ_IN_TERMIOS_H) + AC_MSG_RESULT(yes) +, + AC_MSG_RESULT(no) +, + AC_MSG_ERROR([Expect can't be cross compiled]) +) + +# finally check for Cray style ttys +AC_MSG_CHECKING([for Cray-style ptys]) +SETUID=":" +AC_TRY_RUN([ +main(){ +#ifdef CRAY + return 0; +#else + return 1; +#endif +} +], + PTY_TYPE=unicos + SETUID="chmod u+s" + AC_MSG_RESULT(yes) +, + AC_MSG_RESULT(no) +, + AC_MSG_ERROR([Expect can't be cross compiled]) +) + +# +# Check for select and/or poll. If both exist, we prefer select. +# if neither exists, define SIMPLE_EVENT. +# +select=0 +poll=0 +unset ac_cv_func_select +AC_CHECK_FUNC(select, select=1) +AC_CHECK_FUNC(poll, poll=1) +AC_MSG_CHECKING([event handling]) +if test $select -eq 1 ; then + EVENT_TYPE=select + EVENT_ABLE=event + AC_MSG_RESULT(via select) +elif test $poll -eq 1 ; then + EVENT_TYPE=poll + EVENT_ABLE=event + AC_MSG_RESULT(via poll) +else + EVENT_TYPE=simple + EVENT_ABLE=noevent + AC_MSG_RESULT(none) + AC_DEFINE(SIMPLE_EVENT) +fi + +AC_HAVE_FUNCS(_getpty) +AC_HAVE_FUNCS(getpty) + +# following test sets SETPGRP_VOID if setpgrp takes 0 args, else takes 2 +AC_FUNC_SETPGRP + +# +# check for timezones +# +AC_MSG_CHECKING([for SV-style timezone]) +AC_TRY_RUN([ +extern char *tzname[2]; +extern int daylight; +main() +{ + int *x = &daylight; + char **y = tzname; + + exit(0); +}], + AC_DEFINE(HAVE_SV_TIMEZONE) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) +, + AC_MSG_ERROR([Expect can't be cross compiled]) +) + + +# Following comment stolen from Tcl's configure.in: +# 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. + +PACKAGE_VERSION_NODOTS="`echo $PACKAGE_VERSION | sed -e 's/\.//g'`" + +if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then + EXP_LIB_VERSION=$PACKAGE_VERSION +else + EXP_LIB_VERSION=$PACKAGE_VERSION_NODOTS +fi +if test $iunix -eq 1 ; then + EXP_LIB_VERSION=$PACKAGE_VERSION_NODOTS +fi + +# also remove dots on systems that don't support filenames > 14 +# (are there systems which support shared libs and restrict filename lengths!?) +AC_SYS_LONG_FILE_NAMES +if test $ac_cv_sys_long_file_names = no; then + EXP_LIB_VERSION=$PACKAGE_VERSION_NODOTS +fi + +if test "$FRAMEWORK_BUILD" = "1" ; then + EXP_BUILD_LIB_SPEC="-F`pwd` -framework Expect" + EXP_LIB_SPEC="-framework Expect" + EXP_LIB_FILE="Expect" + AC_DEFINE(EXP_FRAMEWORK) +else + if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then + EXP_LIB_FLAG="-lexpect${EXP_LIB_VERSION}" + else + EXP_LIB_FLAG="-lexpect`echo ${EXP_LIB_VERSION} | tr -d .`" + fi + EXP_BUILD_LIB_SPEC="-L`pwd` ${EXP_LIB_FLAG}" + EXP_LIB_SPEC="-L${libdir} ${EXP_LIB_FLAG}" +fi + +#-------------------------------------------------------------------- +# This section is based on analogous thing in Tk installation. - DEL +# Various manipulations on the search path used at runtime to +# find shared libraries: +# 2. On systems such as AIX and Ultrix that use "-L" as the +# search path option, colons cannot be used to separate +# directories from each other. Change colons to " -L". +# 3. Create two sets of search flags, one for use in cc lines +# and the other for when the linker is invoked directly. In +# the second case, '-Wl,' must be stripped off and commas must +# be replaced by spaces. +#-------------------------------------------------------------------- + +LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}/${PACKAGE_NAME}${PACKAGE_VERSION}' + +# If Tcl and Expect are installed in different places, adjust the library +# search path to reflect this. + +if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then + LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib" +fi + +if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then + LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` +fi + +# The eval below is tricky! It *evaluates* the string in +# ..._CC_SEARCH_FLAGS, which causes a substitution of the +# variable LIB_RUNTIME_DIR. + +eval "EXP_CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\"" + +# now broken out into EXP_AND_TCL_LIBS. Had to do this +# in order to avoid repeating lib specs to which some systems object. + +LIBS="$LIBS $LD_SEARCH_FLAGS" + +# +# Set up makefile substitutions +# +AC_SUBST(EXP_BUILD_LIB_SPEC) +AC_SUBST(EXP_CC_SEARCH_FLAGS) +AC_SUBST(SETUID) +AC_SUBST(SETPGRP_VOID) +AC_SUBST(DEFAULT_STTY_ARGS) +# Expect uses these from tclConfig.sh to make the main executable +AC_SUBST(TCL_DL_LIBS) +AC_SUBST(TCL_CC_SEARCH_FLAGS) + +#-------------------------------------------------------------------- +# More TEA code based on data we got from the original expect +# configure code. +#-------------------------------------------------------------------- + +#----------------------------------------------------------------------- +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- + +TEA_ADD_SOURCES([ + exp_command.c expect.c exp_inter.c exp_regexp.c exp_tty.c + exp_log.c exp_main_sub.c exp_pty.c exp_trap.c exp_strf.c + exp_console.c exp_glob.c exp_win.c exp_clib.c exp_closetcl.c + exp_memmove.c exp_tty_comm.c exp_chan.c Dbg.c +]) + +# Variant sources. Comments in the Makefile indicate that the +# event_type/able stuff can be overidden in the Makefile, and should +# be for particular systems. IMHO this requires a configure option. +# +# See at the end, where we select the sources based on the collect +# information. + +TEA_ADD_SOURCES([ + pty_${PTY_TYPE}.c + exp_${EVENT_TYPE}.c + exp_${EVENT_ABLE}.c +]) + +TEA_ADD_HEADERS([expect.h expect_tcl.h expect_comm.h tcldbg.h]) + +TEA_ADD_INCLUDES([-I.]) +TEA_ADD_INCLUDES([-I\"`\${CYGPATH} \${srcdir}`\"]) + +TEA_ADD_LIBS([]) +TEA_ADD_CFLAGS([-DTCL_DEBUGGER -DUSE_NON_CONST]) +TEA_ADD_CFLAGS([-DSCRIPTDIR=\\\"\${DESTDIR}\${prefix}/lib/\${PKG_DIR}\\\"]) +TEA_ADD_CFLAGS([-DEXECSCRIPTDIR=\\\"\${DESTDIR}\${pkglibdir}\\\"]) +TEA_ADD_CFLAGS([-DSTTY_BIN=\\\"${STTY_BIN}\\\"]) +TEA_ADD_CFLAGS([-DDFLT_STTY=\"\\\"$DEFAULT_STTY_ARGS\\\"\"]) + +TEA_ADD_STUB_SOURCES([]) +TEA_ADD_TCL_SOURCES([]) + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + +TEA_MAKE_LIB + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +# Add WISH as well if this is a Tk extension. +#-------------------------------------------------------------------- + +TEA_PROG_TCLSH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +# You may alternatively have a special pkgIndex.tcl.in or other files +# which require substituting th AC variables in. Include these here. +#-------------------------------------------------------------------- + +touch expect_cf.h +AC_OUTPUT([Makefile], chmod +x ${srcdir}/install-sh)