1dnl 2dnl Process this file with autoconf to produce a configure script. 3dnl 4AC_REVISION($Id: configure.in,v 5.80 2010/08/27 21:51:53 hobbs Exp $) 5 6AC_INIT([expect],[5.45]) 7 8TEA_INIT([3.9]) 9 10AC_CONFIG_AUX_DIR(tclconfig) 11 12#-------------------------------------------------------------------- 13# Configure script for package 'Expect'. 14# TEA compliant. 15#-------------------------------------------------------------------- 16 17#-------------------------------------------------------------------- 18# Load the tclConfig.sh file 19#-------------------------------------------------------------------- 20 21TEA_PATH_TCLCONFIG 22TEA_LOAD_TCLCONFIG 23 24# expectk has been removed from the distribution as Tcl has supported 25# dynamic extensions everywhere for a while. We still allow 'expect' 26# to be built for the die-hard users, but expectk is just wish with 27# package require Expect 28if test "${with_tk+set}" = set ; then 29 AC_MSG_WARN([With Tk request ignored - use package require Tk & Expect]) 30fi 31 32#----------------------------------------------------------------------- 33# Handle the --prefix=... option by defaulting to what Tcl gave. 34# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. 35#----------------------------------------------------------------------- 36 37TEA_PREFIX 38 39#----------------------------------------------------------------------- 40# Standard compiler checks. 41# This sets up CC by using the CC env var, or looks for gcc otherwise. 42# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create 43# the basic setup necessary to compile executables. 44#----------------------------------------------------------------------- 45 46TEA_SETUP_COMPILER 47 48#-------------------------------------------------------------------- 49# __CHANGE__ 50# Choose which headers you need. Extension authors should try very 51# hard to only rely on the Tcl public header files. Internal headers 52# contain private data structures and are subject to change without 53# notice. 54# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG 55#-------------------------------------------------------------------- 56 57#TEA_PUBLIC_TCL_HEADERS 58TEA_PRIVATE_TCL_HEADERS 59 60#-------------------------------------------------------------------- 61# You can add more files to clean if your extension creates any extra 62# files by extending CLEANFILES. 63# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure 64# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var. 65# 66# A few miscellaneous platform-specific items: 67# TEA_ADD_* any platform specific compiler/build info here. 68#-------------------------------------------------------------------- 69 70TEA_ADD_CLEANFILES([pkgIndex.tcl]) 71 72#-------------------------------------------------------------------- 73# Check whether --enable-threads or --disable-threads was given. 74# So far only Tcl responds to this one. 75# 76# Hook for when threading is supported in Expect. The --enable-threads 77# flag currently has no effect. 78#------------------------------------------------------------------------ 79 80TEA_ENABLE_THREADS 81 82#-------------------------------------------------------------------- 83# The statement below defines a collection of symbols related to 84# building as a shared library instead of a static library. 85#-------------------------------------------------------------------- 86 87TEA_ENABLE_SHARED 88 89#-------------------------------------------------------------------- 90# This macro figures out what flags to use with the compiler/linker 91# when building shared/static debug/optimized objects. This information 92# can be taken from the tclConfig.sh file, but this figures it all out. 93#-------------------------------------------------------------------- 94 95TEA_CONFIG_CFLAGS 96 97#-------------------------------------------------------------------- 98# Set the default compiler switches based on the --enable-symbols option. 99#-------------------------------------------------------------------- 100 101TEA_ENABLE_SYMBOLS 102 103#-------------------------------------------------------------------- 104# Everyone should be linking against the Tcl stub library. If you 105# can't for some reason, remove this definition. If you aren't using 106# stubs, you also need to modify the SHLIB_LD_LIBS setting below to 107# link against the non-stubbed Tcl library. 108#-------------------------------------------------------------------- 109 110AC_DEFINE(USE_TCL_STUBS) 111AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs]) 112 113#------------------------------------------------------------------------- 114# Check for system header files. 115#------------------------------------------------------------------------- 116 117AC_CHECK_HEADER(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H)) 118AC_CHECK_HEADER(sys/sysmacros.h, AC_DEFINE(HAVE_SYSMACROS_H)) 119 120# Oddly, some systems have stdarg but don't support prototypes 121# Tcl avoids the whole issue by not using stdarg on UNIX at all! 122 123dnl AC_CHECK_HEADER(stdarg.h, AC_DEFINE(HAVE_STDARG_H)) 124 125AC_CHECK_HEADER(varargs.h, AC_DEFINE(HAVE_VARARGS_H)) 126 127# If no stropts.h, then the svr4 implementation is broken. 128# At least it is on my Debian "potato" system. - Rob Savoye 129 130AC_CHECK_HEADER(sys/stropts.h, AC_DEFINE(HAVE_STROPTS_H), svr4_ptys_broken=1) 131AC_CHECK_HEADER(sys/sysconfig.h, AC_DEFINE(HAVE_SYSCONF_H)) 132AC_CHECK_HEADER(sys/fcntl.h, AC_DEFINE(HAVE_SYS_FCNTL_H)) 133AC_CHECK_HEADER(sys/ptem.h, AC_DEFINE(HAVE_SYS_PTEM_H)) 134AC_CHECK_HEADER(sys/strredir.h, AC_DEFINE(HAVE_STRREDIR_H)) 135AC_CHECK_HEADER(sys/strpty.h, AC_DEFINE(HAVE_STRPTY_H)) 136 137AC_MSG_CHECKING([for sys/bsdtypes.h]) 138if test "ISC_${ISC}" = "ISC_1" ; then 139 AC_MSG_RESULT(yes) 140 # if on ISC 1, we need <sys/bsdtypes.h> to get FD_SET macros 141 AC_HAVE_HEADERS(sys/bsdtypes.h) 142else 143 AC_MSG_RESULT(no) 144fi 145 146#------------------------------------------------------------------------- 147# What type do signals return? 148#------------------------------------------------------------------------- 149 150AC_TYPE_SIGNAL 151 152#------------------------------------------------------------------------- 153# Find out all about time handling differences. 154#------------------------------------------------------------------------- 155 156TEA_TIME_HANDLER 157 158#-------------------------------------------------------------------- 159# The check below checks whether <sys/wait.h> defines the type 160# "union wait" correctly. It's needed because of weirdness in 161# HP-UX where "union wait" is defined in both the BSD and SYS-V 162# environments. Checking the usability of WIFEXITED seems to do 163# the trick. 164#-------------------------------------------------------------------- 165 166AC_MSG_CHECKING([union wait]) 167AC_CACHE_VAL(tcl_cv_union_wait, 168 AC_TRY_LINK([#include <sys/types.h> 169#include <sys/wait.h>], [ 170union wait x; 171WIFEXITED(x); /* Generates compiler error if WIFEXITED uses an int. */ 172 ], tcl_cv_union_wait=yes, tcl_cv_union_wait=no)) 173AC_MSG_RESULT($tcl_cv_union_wait) 174if test $tcl_cv_union_wait = no; then 175 AC_DEFINE(NO_UNION_WAIT) 176fi 177 178###################################################################### 179# required by Sequent ptx2 180 181AC_CHECK_FUNC(gethostname, gethostname=1 , gethostname=0) 182if test $gethostname -eq 0 ; then 183 AC_CHECK_LIB(inet, gethostname, LIBS="$LIBS -linet") 184fi 185 186###################################################################### 187# required by Fischman's ISC 4.0 188 189AC_CHECK_FUNC(socket, socket=1 , socket=0) 190if test $socket -eq 0 ; then 191 AC_CHECK_LIB(inet, socket, LIBS="$LIBS -linet") 192fi 193 194###################################################################### 195 196AC_CHECK_FUNC(select, select=1 , select=0) 197if test $select -eq 0 ; then 198 AC_CHECK_LIB(inet, select, LIBS="$LIBS -linet") 199fi 200 201###################################################################### 202 203AC_CHECK_FUNC(getpseudotty, getpseudotty=1 , getpseudotty=0) 204if test $getpseudotty -eq 0 ; then 205 AC_CHECK_LIB(seq, getpseudotty) 206fi 207 208###################################################################### 209# Check for FreeBSD/NetBSD openpty() 210unset ac_cv_func_openpty 211 212AC_CHECK_FUNC(openpty, AC_DEFINE(HAVE_OPENPTY) openpty=1 , openpty=0) 213if test $openpty -eq 0 ; then 214 AC_CHECK_LIB(util, openpty, [ 215 # we only need to define OPENPTY once, but since we are overriding 216 # the default behavior, we must also handle augment LIBS too. 217 # This needn't be done in the 2nd and 3rd tests. 218 AC_DEFINE(HAVE_OPENPTY) 219 LIBS="$LIBS -lutil" 220 ]) 221fi 222 223###################################################################### 224# End of library/func checking 225###################################################################### 226 227# Hand patches to library/func checking. 228dnl From: Michael Kuhl <mkuhl@legato.com> 229dnl To get expect to compile on a Sequent NUMA-Q running DYNIX/ptx v4.4.2. 230 231AC_MSG_CHECKING([if running Sequent running SVR4]) 232if test "$host_alias" = "i386-sequent-sysv4" ; then 233 LIBS="-lnsl -lsocket -lm" 234 AC_MSG_RESULT(yes) 235else 236 AC_MSG_RESULT(no) 237fi 238 239#-------------------------------------------------------------------- 240#-------------------------------------------------------------------- 241#-------------------------------------------------------------------- 242#-------------------------------------------------------------------- 243# From here on comes original expect configure code. 244# At the end we will have another section of TEA 3.2 code. 245# 246# Note specialities 247# 248# - Runs a sub configure (Dbgconfigure) for the expect tcl debugger 249# 250#-------------------------------------------------------------------- 251#-------------------------------------------------------------------- 252 253dnl AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) 254AC_CANONICAL_SYSTEM 255 256# If `configure' is invoked (in)directly via `make', ensure that it 257# encounters no `make' conflicts. 258# 259 260dnl unset MFLAGS MAKEFLAGS 261MFLAGS= 262MAKEFLAGS= 263 264# An explanation is in order for the strange things going on with the 265# various LIBS. There are three separate definitions for LIBS. The 266# reason is that some systems require shared libraries include 267# references to their dependent libraries, i.e., any additional 268# libraries that must be linked to. And some systems get upset if the 269# references are repeated on the link line. So therefore, we create 270# one for Expect, one for Expect and Tcl, and one for building Expect's own 271# shared library. Tcl's tclConfig.sh insists that any shared libs 272# that it "helps" build must pass the libraries as LIBS (see comment 273# near end of this configure file). I would do but since we're close 274# to hitting config's max symbols, we take one short cut and pack the 275# LIBS into EXP_SHLIB_LD_LIBS (which is basically what Tcl wants to do 276# for us). The point, however, is that there's no separate LIBS or 277# EXP_LIBS symbol passed out of configure. One additional point for 278# confusion is that LIBS is what configure uses to do all library 279# tests, so we have to swap definitions of LIBS periodically. When we 280# are swapping out the one for Expect's shared library, we save it in 281# EXP_LIBS. Sigh. 282 283eval "LIBS=\"$TCL_LIBS\"" 284 285if test "${with_tcl+set}" = set ; then 286 case "${with_tcl}" in 287 ..*) 288 AC_MSG_WARN([Specify absolute path to --with-tcl for subdir configuration]) 289 ;; 290 esac 291fi 292 293# these are the other subdirectories we need to configure 294AC_CONFIG_SUBDIRS(testsuite) 295 296AC_TYPE_PID_T 297 298AC_MSG_CHECKING([if running Mach]) 299mach=0 300case "${host}" in 301 # Both Next and pure Mach behave identically with respect 302 # to a few things, so just lump them together as "mach" 303 *-*-mach*) mach=1 ;; 304 *-*-next*) mach=1 ; next=1 ;; 305esac 306 307if test $mach -eq 1 ; then 308 AC_MSG_RESULT(yes) 309else 310 AC_MSG_RESULT(no) 311fi 312 313AC_MSG_CHECKING([if running MachTen]) 314# yet another Mach clone 315if test -r /MachTen ; then 316 AC_MSG_RESULT(yes) 317 mach=1 318else 319 AC_MSG_RESULT(no) 320fi 321 322AC_MSG_CHECKING([if on Pyramid]) 323if test -r /bin/pyr ; then 324 AC_MSG_RESULT(yes) 325 pyr=1 326else 327 AC_MSG_RESULT(no) 328 pyr=0 329fi 330 331AC_MSG_CHECKING([if on Apollo]) 332if test -r /usr/apollo/bin ; then 333 AC_MSG_RESULT(yes) 334 apollo=1 335else 336 AC_MSG_RESULT(no) 337 apollo=0 338fi 339 340AC_MSG_CHECKING([if on Interactive]) 341if test "x`(uname -s) 2>/dev/null`" = xIUNIX; then 342 AC_MSG_RESULT(yes) 343 iunix=1 344else 345 AC_MSG_RESULT(no) 346 iunix=0 347fi 348 349AC_MSG_CHECKING([stty to use]) 350if test -r /usr/local/bin/stty ; then 351 STTY_BIN=/usr/local/bin/stty 352else 353 STTY_BIN=/bin/stty 354fi 355AC_MSG_RESULT($STTY_BIN) 356 357AC_MSG_CHECKING([if stty reads stdout]) 358 359# On some systems stty can't be run in the background (svr4) or get it 360# wrong because they fail to complain (next, mach), so don't attempt 361# the test on some systems. 362 363stty_reads_stdout="" 364case "${host}" in 365 *-*-solaris*) stty_reads_stdout=0 ;; 366 *-*-irix*) stty_reads_stdout=0 ;; 367 *-*-sco3.2v[[45]]*) stty_reads_stdout=1 ;; 368 i[[3456]]86-*-sysv4.2MP) stty_reads_stdout=0 ;; 369 *-*-linux*) stty_reads_stdout=0 ;; 370 # Not sure about old convex but 5.2 definitely reads from stdout 371 c[[12]]-*-*) stty_reads_stdout=1 ;; 372 *-*-aix[[34]]*) stty_reads_stdout=0 ;; 373 *-*-hpux9*) stty_reads_stdout=0 ;; 374 *-*-hpux10*) stty_reads_stdout=0 ;; 375 *-*-osf[[234]]*) stty_reads_stdout=0 ;; 376 *-*-ultrix4.4) stty_reads_stdout=0 ;; 377 *-*-dgux*) stty_reads_stdout=0 ;; 378esac 379 380if test $mach -eq 1 ; then 381 stty_reads_stdout=1 382fi 383if test $apollo -eq 1 ; then 384 stty_reads_stdout=1 385fi 386if test $pyr -eq 1 ; then 387 stty_reads_stdout=1 388fi 389 390# if we still don't know, test 391if test x"${stty_reads_stdout}" = x"" ; then 392 $STTY_BIN > /dev/null 2> /dev/null ; a=$? 393 $STTY_BIN < /dev/tty > /dev/null 2> /dev/null ; b=$? 394 if test $a -ne 0 -a $b -ne 0; then 395 stty_reads_stdout=1 396 else 397 stty_reads_stdout=0 398 fi 399fi 400 401if test ${stty_reads_stdout} -eq 1 ; then 402 AC_MSG_RESULT(yes) 403 AC_DEFINE(STTY_READS_STDOUT) 404else 405 AC_MSG_RESULT(no) 406fi 407 408# Solaris 2.4 and later requires __EXTENSIONS__ in order to see all sorts 409# of traditional but nonstandard stuff in header files. 410AC_MSG_CHECKING([if running Solaris]) 411solaris=0 412case "${host}" in 413 *-*-solaris*) solaris=1;; 414esac 415 416if test $solaris -eq 1 ; then 417 AC_MSG_RESULT(yes) 418 AC_DEFINE(SOLARIS) 419else 420 AC_MSG_RESULT(no) 421fi 422 423# On Interactive UNIX, -Xp must be added to LIBS in order to find strftime. 424# This test should really be done by Tcl. So just check Tcl's definition. 425# If defective, add to all three LIBS. (It's not actually necessary for 426# EXP_LIBS since -Xp will just be ignored the way that EXP_LIBS is used in 427# the Makefile, but we include it for consistency.) 428 429if test $iunix -eq 1 ; then 430 AC_CHECK_FUNC(strftime, , [ 431 LIBS="${LIBS} -Xp" 432 ]) 433fi 434 435###################################################################### 436# 437# Look for various header files 438# 439 440# 441# Look for functions that may be missing 442# 443dnl AC_CHECK_FUNC(memcpy, AC_DEFINE(HAVE_MEMCPY)) 444AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE)) 445AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF)) 446AC_CHECK_FUNC(strftime, AC_DEFINE(HAVE_STRFTIME)) 447AC_CHECK_FUNC(strchr, AC_DEFINE(HAVE_STRCHR)) 448AC_CHECK_FUNC(timezone, AC_DEFINE(HAVE_TIMEZONE)) 449AC_CHECK_FUNC(siglongjmp, AC_DEFINE(HAVE_SIGLONGJMP)) 450 451# dnl check for memcpy by hand 452# because Unixware 2.0 handles it specially and refuses to compile 453# autoconf's automatic test that is a call with no arguments 454AC_MSG_CHECKING([for memcpy]) 455AC_TRY_LINK(,[ 456char *s1, *s2; 457memcpy(s1,s2,0); 458], 459 AC_MSG_RESULT(yes) 460 AC_DEFINE(HAVE_MEMCPY) 461 , 462 AC_MSG_RESULT(no) 463) 464 465# Some systems only define WNOHANG if _POSIX_SOURCE is defined 466# The following merely tests that sys/wait.h can be included 467# and if so that WNOHANG is not defined. The only place I've 468# seen this is ISC. 469AC_MSG_CHECKING([if WNOHANG requires _POSIX_SOURCE]) 470AC_TRY_RUN([ 471#include <sys/wait.h> 472main() { 473#ifndef WNOHANG 474 return 0; 475#else 476 return 1; 477#endif 478}], 479 AC_MSG_RESULT(yes) 480 AC_DEFINE(WNOHANG_REQUIRES_POSIX_SOURCE) 481, 482 AC_MSG_RESULT(no) 483, 484 AC_MSG_ERROR([Expect can't be cross compiled]) 485) 486 487AC_MSG_CHECKING([if any value exists for WNOHANG]) 488rm -rf wnohang 489AC_TRY_RUN([ 490#include <stdio.h> 491#include <sys/wait.h> 492main() { 493#ifdef WNOHANG 494 FILE *fp = fopen("wnohang","w"); 495 fprintf(fp,"%d",WNOHANG); 496 fclose(fp); 497 return 0; 498#else 499 return 1; 500#endif 501}], 502 AC_MSG_RESULT(yes) 503 AC_DEFINE_UNQUOTED(WNOHANG_BACKUP_VALUE, `cat wnohang`) 504 rm -f wnohang 505, 506 AC_MSG_RESULT(no) 507 AC_DEFINE(WNOHANG_BACKUP_VALUE, 1) 508, 509 AC_MSG_ERROR([Expect can't be cross compiled]) 510) 511 512# 513# check how signals work 514# 515 516# Check for the data type of the mask used in select(). 517# This picks up HP braindamage which defines fd_set and then 518# proceeds to ignore it and use int. 519# Pattern matching on int could be loosened. 520# Can't use ac_header_egrep since that doesn't see prototypes with K&R cpp. 521AC_MSG_CHECKING([mask type of select]) 522if egrep "select\(size_t, int" /usr/include/sys/time.h >/dev/null 2>&1; then 523 AC_MSG_RESULT(int) 524 AC_DEFINE(SELECT_MASK_TYPE, int) 525else 526 AC_MSG_RESULT(none) 527 AC_DEFINE(SELECT_MASK_TYPE, fd_set) 528fi 529 530dnl # Check for the data type of the function used in signal(). This 531dnl # must be before the test for rearming. 532dnl # echo checking return type of signal handlers 533dnl AC_HEADER_EGREP([(void|sighandler_t).*signal], signal.h, retsigtype=void,AC_DEFINE(RETSIGTYPE, int) retsigtype=int) 534 535# FIXME: check if alarm exists 536AC_MSG_CHECKING([if signals need to be re-armed]) 537AC_TRY_RUN([ 538#include <signal.h> 539#define RETSIGTYPE $retsigtype 540 541int signal_rearms = 0; 542 543RETSIGTYPE 544child_sigint_handler(n) 545int n; 546{ 547} 548 549RETSIGTYPE 550parent_sigint_handler(n) 551int n; 552{ 553signal_rearms++; 554} 555 556main() 557{ 558 signal(SIGINT,parent_sigint_handler); 559 560 if (0 == fork()) { 561 signal(SIGINT,child_sigint_handler); 562 kill(getpid(),SIGINT); 563 kill(getpid(),SIGINT); 564 kill(getppid(),SIGINT); 565 } else { 566 int status; 567 568 wait(&status); 569 unlink("core"); 570 exit(signal_rearms); 571 } 572}], 573 AC_MSG_RESULT(yes) 574 AC_DEFINE(REARM_SIG) 575, 576 AC_MSG_RESULT(no) 577, AC_MSG_WARN([Expect can't be cross compiled]) 578) 579 580# HPUX7 has trouble with the big cat so split it 581# Owen Rees <rtor@ansa.co.uk> 29Mar93 582SEDDEFS="${SEDDEFS}CONFEOF 583cat >> conftest.sed <<CONFEOF 584" 585# 586 587# There are multiple versions of getpty, alas. 588# I don't remember who has the first one, but Convex just added one 589# so check for it. Unfortunately, there is no header so the only 590# reasonable way to make sure is to look it we are on a Convex. 591AC_MSG_CHECKING([if on Convex]) 592convex=0 593case "${host}" in 594 c[[12]]-*-*) convex=1;; 595esac 596 597if test $convex -eq 1 ; then 598 AC_MSG_RESULT(yes) 599 AC_DEFINE(CONVEX) 600else 601 AC_MSG_RESULT(no) 602fi 603 604 605AC_MSG_CHECKING([if on HP]) 606if test "x`(uname) 2>/dev/null`" = xHP-UX; then 607 AC_MSG_RESULT(yes) 608 hp=1 609else 610 AC_MSG_RESULT(no) 611 hp=0 612fi 613 614AC_MSG_CHECKING([sane default stty arguments]) 615DEFAULT_STTY_ARGS="sane" 616 617if test $mach -eq 1 ; then 618 DEFAULT_STTY_ARGS="cooked" 619fi 620 621if test $hp -eq 1 ; then 622 DEFAULT_STTY_ARGS="sane kill " 623fi 624 625AC_MSG_RESULT($DEFAULT_STTY_ARG) 626 627# Look for various features to determine what kind of pty 628# we have. For some weird reason, ac_compile_check would not 629# work, but ac_test_program does. 630# 631AC_MSG_CHECKING([for HP style pty allocation]) 632# following test fails on DECstations and other things that don't grok -c 633# but that's ok, since they don't have PTYMs anyway 634if test -r /dev/ptym/ptyp0 2>/dev/null ; then 635 AC_MSG_RESULT(yes) 636 AC_DEFINE(HAVE_PTYM) 637else 638 AC_MSG_RESULT(no) 639fi 640 641AC_MSG_CHECKING([for HP style pty trapping]) 642AC_HEADER_EGREP([struct.*request_info], sys/ptyio.h, 643 AC_MSG_RESULT(yes) 644 AC_DEFINE(HAVE_PTYTRAP) 645, 646 AC_MSG_RESULT(no) 647) 648 649AC_MSG_CHECKING([for AIX new-style pty allocation]) 650if test -r /dev/ptc -a -r /dev/pts ; then 651 AC_MSG_RESULT(yes) 652 AC_DEFINE(HAVE_PTC_PTS) 653else 654 AC_MSG_RESULT(no) 655fi 656 657AC_MSG_CHECKING([for SGI old-style pty allocation]) 658if test -r /dev/ptc -a ! -r /dev/pts ; then 659 AC_MSG_RESULT(yes) 660 AC_DEFINE(HAVE_PTC) 661else 662 AC_MSG_RESULT(no) 663fi 664 665# On SCO OpenServer, two types of ptys are available: SVR4 streams and c-list. 666# The library routines to open the SVR4 ptys are broken on certain systems and 667# the SCO command to increase the number of ptys only configure c-list ones 668# anyway. So we chose these, which have a special numbering scheme. 669# 670AC_MSG_CHECKING([for SCO style pty allocation]) 671sco_ptys="" 672case "${host}" in 673 *-sco3.2v[[45]]*) sco_clist_ptys=1 svr4_ptys_broken=1;; 674esac 675 676if test x"${sco_clist_ptys}" != x"" ; then 677 AC_MSG_RESULT(yes) 678 AC_DEFINE(HAVE_SCO_CLIST_PTYS) 679else 680 AC_MSG_RESULT(no) 681fi 682 683AC_MSG_CHECKING([for SVR4 style pty allocation]) 684if test -r /dev/ptmx -a "x$svr4_ptys_broken" = x ; then 685 AC_MSG_RESULT(yes) 686 AC_DEFINE(HAVE_PTMX) 687 # aargg. Some systems need libpt.a to use /dev/ptmx 688 AC_CHECK_LIB(pt, libpts="-lpt", libpts="") 689 AC_CHECK_FUNC(ptsname, , LIBS="${LIBS} $libpts") 690else 691 AC_MSG_RESULT(no) 692fi 693 694# In OSF/1 case, SVR4 are somewhat different. 695# Gregory Depp <depp@osf.org> 17Aug93 696AC_MSG_CHECKING([for OSF/1 style pty allocation]) 697if test -r /dev/ptmx_bsd ; then 698 AC_DEFINE(HAVE_PTMX_BSD) 699 AC_MSG_RESULT(yes) 700else 701 AC_MSG_RESULT(no) 702fi 703 704tcgetattr=0 705tcsetattr=0 706AC_CHECK_FUNC(tcgetattr, tcgetattr=1) 707AC_CHECK_FUNC(tcsetattr, tcsetattr=1) 708if test $tcgetattr -eq 1 -a $tcsetattr -eq 1 ; then 709 AC_DEFINE(HAVE_TCSETATTR) 710 AC_DEFINE(POSIX) 711fi 712 713# first check for the pure bsd 714AC_MSG_CHECKING([for struct sgttyb]) 715AC_TRY_RUN([ 716#include <sgtty.h> 717main() 718{ 719 struct sgttyb tmp; 720 exit(0); 721}], 722 AC_MSG_RESULT(yes) 723 AC_DEFINE(HAVE_SGTTYB) 724 PTY_TYPE=sgttyb 725, 726 AC_MSG_RESULT(no) 727, 728 AC_MSG_ERROR([Expect can't be cross compiled]) 729) 730 731# mach systems have include files for unimplemented features 732# so avoid doing following test on those systems 733if test $mach -eq 0 ; then 734 735 # next check for the older style ttys 736 # note that if we detect termio.h (only), we still set PTY_TYPE=termios 737 # since that just controls which of pty_XXXX.c file is use and 738 # pty_termios.c is set up to handle pty_termio. 739 AC_MSG_CHECKING([for struct termio]) 740 AC_TRY_RUN([#include <termio.h> 741 main() 742 { 743 struct termio tmp; 744 exit(0); 745 }], 746 AC_DEFINE(HAVE_TERMIO) 747 PTY_TYPE=termios 748 AC_MSG_RESULT(yes) 749, 750 AC_MSG_RESULT(no) 751, 752 AC_MSG_ERROR([Expect can't be cross compiled]) 753) 754 755 # now check for the new style ttys (not yet posix) 756 AC_MSG_CHECKING([for struct termios]) 757 AC_TRY_RUN([ 758 /* including termios.h on Solaris 5.6 fails unless inttypes.h included */ 759# ifdef HAVE_INTTYPES_H 760# include <inttypes.h> 761# endif 762# include <termios.h> 763 main() 764 { 765 struct termios tmp; 766 exit(0); 767 }], 768 AC_DEFINE(HAVE_TERMIOS) 769 PTY_TYPE=termios 770 AC_MSG_RESULT(yes) 771 , 772 AC_MSG_RESULT(no) 773 , 774 AC_MSG_ERROR([Expect can't be cross compiled]) 775 ) 776fi 777 778AC_MSG_CHECKING([if TCGETS or TCGETA in termios.h]) 779AC_TRY_RUN([ 780/* including termios.h on Solaris 5.6 fails unless inttypes.h included */ 781#ifdef HAVE_INTTYPES_H 782#include <inttypes.h> 783#endif 784#include <termios.h> 785main() { 786#if defined(TCGETS) || defined(TCGETA) 787 return 0; 788#else 789 return 1; 790#endif 791}], 792 AC_DEFINE(HAVE_TCGETS_OR_TCGETA_IN_TERMIOS_H) 793 AC_MSG_RESULT(yes) 794, 795 AC_MSG_RESULT(no) 796, 797 AC_MSG_ERROR([Expect can't be cross compiled]) 798) 799 800AC_MSG_CHECKING([if TIOCGWINSZ in termios.h]) 801AC_TRY_RUN([ 802/* including termios.h on Solaris 5.6 fails unless inttypes.h included */ 803#ifdef HAVE_INTTYPES_H 804#include <inttypes.h> 805#endif 806#include <termios.h> 807main() { 808#ifdef TIOCGWINSZ 809 return 0; 810#else 811 return 1; 812#endif 813}], 814 AC_DEFINE(HAVE_TIOCGWINSZ_IN_TERMIOS_H) 815 AC_MSG_RESULT(yes) 816, 817 AC_MSG_RESULT(no) 818, 819 AC_MSG_ERROR([Expect can't be cross compiled]) 820) 821 822# finally check for Cray style ttys 823AC_MSG_CHECKING([for Cray-style ptys]) 824SETUID=":" 825AC_TRY_RUN([ 826main(){ 827#ifdef CRAY 828 return 0; 829#else 830 return 1; 831#endif 832} 833], 834 PTY_TYPE=unicos 835 SETUID="chmod u+s" 836 AC_MSG_RESULT(yes) 837, 838 AC_MSG_RESULT(no) 839, 840 AC_MSG_ERROR([Expect can't be cross compiled]) 841) 842 843# 844# Check for select and/or poll. If both exist, we prefer select. 845# if neither exists, define SIMPLE_EVENT. 846# 847select=0 848poll=0 849unset ac_cv_func_select 850AC_CHECK_FUNC(select, select=1) 851AC_CHECK_FUNC(poll, poll=1) 852AC_MSG_CHECKING([event handling]) 853if test $select -eq 1 ; then 854 EVENT_TYPE=select 855 EVENT_ABLE=event 856 AC_MSG_RESULT(via select) 857elif test $poll -eq 1 ; then 858 EVENT_TYPE=poll 859 EVENT_ABLE=event 860 AC_MSG_RESULT(via poll) 861else 862 EVENT_TYPE=simple 863 EVENT_ABLE=noevent 864 AC_MSG_RESULT(none) 865 AC_DEFINE(SIMPLE_EVENT) 866fi 867 868AC_HAVE_FUNCS(_getpty) 869AC_HAVE_FUNCS(getpty) 870 871# following test sets SETPGRP_VOID if setpgrp takes 0 args, else takes 2 872AC_FUNC_SETPGRP 873 874# 875# check for timezones 876# 877AC_MSG_CHECKING([for SV-style timezone]) 878AC_TRY_RUN([ 879extern char *tzname[2]; 880extern int daylight; 881main() 882{ 883 int *x = &daylight; 884 char **y = tzname; 885 886 exit(0); 887}], 888 AC_DEFINE(HAVE_SV_TIMEZONE) 889 AC_MSG_RESULT(yes), 890 AC_MSG_RESULT(no) 891, 892 AC_MSG_ERROR([Expect can't be cross compiled]) 893) 894 895 896# Following comment stolen from Tcl's configure.in: 897# Note: in the following variable, it's important to use the absolute 898# path name of the Tcl directory rather than "..": this is because 899# AIX remembers this path and will attempt to use it at run-time to look 900# up the Tcl library. 901 902PACKAGE_VERSION_NODOTS="`echo $PACKAGE_VERSION | sed -e 's/\.//g'`" 903 904if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then 905 EXP_LIB_VERSION=$PACKAGE_VERSION 906else 907 EXP_LIB_VERSION=$PACKAGE_VERSION_NODOTS 908fi 909if test $iunix -eq 1 ; then 910 EXP_LIB_VERSION=$PACKAGE_VERSION_NODOTS 911fi 912 913# also remove dots on systems that don't support filenames > 14 914# (are there systems which support shared libs and restrict filename lengths!?) 915AC_SYS_LONG_FILE_NAMES 916if test $ac_cv_sys_long_file_names = no; then 917 EXP_LIB_VERSION=$PACKAGE_VERSION_NODOTS 918fi 919 920if test "$FRAMEWORK_BUILD" = "1" ; then 921 EXP_BUILD_LIB_SPEC="-F`pwd` -framework Expect" 922 EXP_LIB_SPEC="-framework Expect" 923 EXP_LIB_FILE="Expect" 924 AC_DEFINE(EXP_FRAMEWORK) 925else 926 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then 927 EXP_LIB_FLAG="-lexpect${EXP_LIB_VERSION}" 928 else 929 EXP_LIB_FLAG="-lexpect`echo ${EXP_LIB_VERSION} | tr -d .`" 930 fi 931 EXP_BUILD_LIB_SPEC="-L`pwd` ${EXP_LIB_FLAG}" 932 EXP_LIB_SPEC="-L${libdir} ${EXP_LIB_FLAG}" 933fi 934 935#-------------------------------------------------------------------- 936# This section is based on analogous thing in Tk installation. - DEL 937# Various manipulations on the search path used at runtime to 938# find shared libraries: 939# 2. On systems such as AIX and Ultrix that use "-L" as the 940# search path option, colons cannot be used to separate 941# directories from each other. Change colons to " -L". 942# 3. Create two sets of search flags, one for use in cc lines 943# and the other for when the linker is invoked directly. In 944# the second case, '-Wl,' must be stripped off and commas must 945# be replaced by spaces. 946#-------------------------------------------------------------------- 947 948LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}/${PACKAGE_NAME}${PACKAGE_VERSION}' 949 950# If Tcl and Expect are installed in different places, adjust the library 951# search path to reflect this. 952 953if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then 954 LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib" 955fi 956 957if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then 958 LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` 959fi 960 961# The eval below is tricky! It *evaluates* the string in 962# ..._CC_SEARCH_FLAGS, which causes a substitution of the 963# variable LIB_RUNTIME_DIR. 964 965eval "EXP_CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\"" 966 967# now broken out into EXP_AND_TCL_LIBS. Had to do this 968# in order to avoid repeating lib specs to which some systems object. 969 970LIBS="$LIBS $LD_SEARCH_FLAGS" 971 972# 973# Set up makefile substitutions 974# 975AC_SUBST(EXP_BUILD_LIB_SPEC) 976AC_SUBST(EXP_CC_SEARCH_FLAGS) 977AC_SUBST(SETUID) 978AC_SUBST(SETPGRP_VOID) 979AC_SUBST(DEFAULT_STTY_ARGS) 980# Expect uses these from tclConfig.sh to make the main executable 981AC_SUBST(TCL_DL_LIBS) 982AC_SUBST(TCL_CC_SEARCH_FLAGS) 983 984#-------------------------------------------------------------------- 985# More TEA code based on data we got from the original expect 986# configure code. 987#-------------------------------------------------------------------- 988 989#----------------------------------------------------------------------- 990# Specify the C source files to compile in TEA_ADD_SOURCES, 991# public headers that need to be installed in TEA_ADD_HEADERS, 992# stub library C source files to compile in TEA_ADD_STUB_SOURCES, 993# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. 994# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS 995# and PKG_TCL_SOURCES. 996#----------------------------------------------------------------------- 997 998TEA_ADD_SOURCES([ 999 exp_command.c expect.c exp_inter.c exp_regexp.c exp_tty.c 1000 exp_log.c exp_main_sub.c exp_pty.c exp_trap.c exp_strf.c 1001 exp_console.c exp_glob.c exp_win.c exp_clib.c exp_closetcl.c 1002 exp_memmove.c exp_tty_comm.c exp_chan.c Dbg.c 1003]) 1004 1005# Variant sources. Comments in the Makefile indicate that the 1006# event_type/able stuff can be overidden in the Makefile, and should 1007# be for particular systems. IMHO this requires a configure option. 1008# 1009# See at the end, where we select the sources based on the collect 1010# information. 1011 1012TEA_ADD_SOURCES([ 1013 pty_${PTY_TYPE}.c 1014 exp_${EVENT_TYPE}.c 1015 exp_${EVENT_ABLE}.c 1016]) 1017 1018TEA_ADD_HEADERS([expect.h expect_tcl.h expect_comm.h tcldbg.h]) 1019 1020TEA_ADD_INCLUDES([-I.]) 1021TEA_ADD_INCLUDES([-I\"`\${CYGPATH} \${srcdir}`\"]) 1022 1023TEA_ADD_LIBS([]) 1024TEA_ADD_CFLAGS([-DTCL_DEBUGGER -DUSE_NON_CONST]) 1025TEA_ADD_CFLAGS([-DSCRIPTDIR=\\\"\${DESTDIR}\${prefix}/lib/\${PKG_DIR}\\\"]) 1026TEA_ADD_CFLAGS([-DEXECSCRIPTDIR=\\\"\${DESTDIR}\${pkglibdir}\\\"]) 1027TEA_ADD_CFLAGS([-DSTTY_BIN=\\\"${STTY_BIN}\\\"]) 1028TEA_ADD_CFLAGS([-DDFLT_STTY=\"\\\"$DEFAULT_STTY_ARGS\\\"\"]) 1029 1030TEA_ADD_STUB_SOURCES([]) 1031TEA_ADD_TCL_SOURCES([]) 1032 1033#-------------------------------------------------------------------- 1034# This macro generates a line to use when building a library. It 1035# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, 1036# and TEA_LOAD_TCLCONFIG macros above. 1037#-------------------------------------------------------------------- 1038 1039TEA_MAKE_LIB 1040 1041#-------------------------------------------------------------------- 1042# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl 1043# file during the install process. Don't run the TCLSH_PROG through 1044# ${CYGPATH} because it's being used directly by make. 1045# Require that we use a tclsh shell version 8.2 or later since earlier 1046# versions have bugs in the pkg_mkIndex routine. 1047# Add WISH as well if this is a Tk extension. 1048#-------------------------------------------------------------------- 1049 1050TEA_PROG_TCLSH 1051 1052#-------------------------------------------------------------------- 1053# Finally, substitute all of the various values into the Makefile. 1054# You may alternatively have a special pkgIndex.tcl.in or other files 1055# which require substituting th AC variables in. Include these here. 1056#-------------------------------------------------------------------- 1057 1058touch expect_cf.h 1059AC_OUTPUT([Makefile], chmod +x ${srcdir}/install-sh) 1060