expect5.45.4/0000755000175000017500000000000013235563420013331 5ustar pysslingpysslingexpect5.45.4/exp_trap.c0000664000175000017500000003226513235134350015325 0ustar pysslingpyssling/* exp_trap.c - Expect's trap command Written by: Don Libes, NIST, 9/1/93 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #include "expect_cf.h" #include #include #include #ifdef HAVE_SYS_WAIT_H #include #endif #ifdef HAVE_STRING_H #include #endif #if defined(SIGCLD) && !defined(SIGCHLD) #define SIGCHLD SIGCLD #endif #include "tcl.h" #include "exp_rename.h" #include "exp_prog.h" #include "exp_command.h" #include "exp_log.h" #ifdef TCL_DEBUGGER #include "tcldbg.h" #endif #define NO_SIG 0 static struct trap { char *action; /* Tcl command to execute upon sig */ /* Each is handled by the eval_trap_action */ int mark; /* TRUE if signal has occurred */ Tcl_Interp *interp; /* interp to use or 0 if we should use the */ /* interpreter active at the time the sig */ /* is processed */ int code; /* return our new code instead of code */ /* available when signal is processed */ CONST char *name; /* name of signal */ int reserved; /* if unavailable for trapping */ } traps[NSIG]; int sigchld_count = 0; /* # of sigchlds caught but not yet processed */ static int eval_trap_action(); static int got_sig; /* this records the last signal received */ /* it is only a hint and can be wiped out */ /* by multiple signals, but it will always */ /* be left with a valid signal that is */ /* pending */ static Tcl_AsyncHandler async_handler; static CONST char * signal_to_string(sig) int sig; { if (sig <= 0 || sig > NSIG) return("SIGNAL OUT OF RANGE"); return(traps[sig].name); } /* current sig being processed by user sig handler */ static int current_sig = NO_SIG; int exp_nostack_dump = FALSE; /* TRUE if user has requested unrolling of */ /* stack with no trace */ /*ARGSUSED*/ static int tophalf(clientData,interp,code) ClientData clientData; Tcl_Interp *interp; int code; { struct trap *trap; /* last trap processed */ int rc; int i; Tcl_Interp *sig_interp; expDiagLog("sighandler: handling signal(%d)\r\n",got_sig); if (got_sig <= 0 || got_sig >= NSIG) { expErrorLog("caught impossible signal %d\r\n",got_sig); abort(); } /* start to work on this sig. got_sig can now be overwritten */ /* and it won't cause a problem */ current_sig = got_sig; trap = &traps[current_sig]; trap->mark = FALSE; /* decrement below looks dangerous */ /* Don't we need to temporarily block bottomhalf? */ if (current_sig == SIGCHLD) { sigchld_count--; expDiagLog("sigchld_count-- == %d\n",sigchld_count); } if (!trap->action) { /* In this one case, we let ourselves be called when no */ /* signaler predefined, since we are calling explicitly */ /* from another part of the program, and it is just simpler */ if (current_sig == 0) return code; expErrorLog("caught unexpected signal: %s (%d)\r\n", signal_to_string(current_sig),current_sig); abort(); } if (trap->interp) { /* if trap requested original interp, use it */ sig_interp = trap->interp; } else if (interp) { /* else if another interp is available, use it */ sig_interp = interp; } else { /* fall back to exp_interp */ sig_interp = exp_interp; } rc = eval_trap_action(sig_interp,current_sig,trap,code); current_sig = NO_SIG; /* * scan for more signals to process */ /* first check for additional SIGCHLDs */ if (sigchld_count) { got_sig = SIGCHLD; traps[SIGCHLD].mark = TRUE; Tcl_AsyncMark(async_handler); } else { got_sig = -1; for (i=1;i 0 && sig < NSIG) return sig; } else { /* try interpreting as a string */ for (sig=1;sig 0) goto usage_error; if (show_max) { Tcl_SetObjResult(interp,Tcl_NewIntObj(NSIG-1)); } if (current_sig == NO_SIG) { Tcl_SetResult(interp,"no signal in progress",TCL_STATIC); return TCL_ERROR; } if (show_name) { /* skip over "SIG" */ /* TIP 27: Casting away the CONST should be ok because of TCL_STATIC */ Tcl_SetResult(interp,(char*)signal_to_string(current_sig) + 3,TCL_STATIC); } else { Tcl_SetObjResult(interp,Tcl_NewIntObj(current_sig)); } return TCL_OK; } if (objc == 0 || objc > 2) goto usage_error; if (objc == 1) { int sig = exp_string_to_signal(interp,arg); if (sig == -1) return TCL_ERROR; if (traps[sig].action) { Tcl_SetResult(interp,traps[sig].action,TCL_STATIC); } else { Tcl_SetResult(interp,"SIG_DFL",TCL_STATIC); } return TCL_OK; } action = arg; /* objv[1] is the list of signals - crack it open */ if (TCL_OK != Tcl_ListObjGetElements(interp,objv[1],&n,&list)) { return TCL_ERROR; } for (i=0;iaction); expDiagLogU(")\r\n"); /* save to prevent user from redefining trap->code while trap */ /* is executing */ code_flag = trap->code; if (!code_flag) { /* * save return values */ eip = Tcl_GetVar2Ex(interp,"errorInfo","",TCL_GLOBAL_ONLY); if (eip) eip = Tcl_DuplicateObj(eip); ecp = Tcl_GetVar2Ex(interp,"errorCode","",TCL_GLOBAL_ONLY); if (ecp) ecp = Tcl_DuplicateObj(ecp); irp = Tcl_GetObjResult(interp); if (irp) irp = Tcl_DuplicateObj(irp); } newcode = Tcl_GlobalEval(interp,trap->action); /* * if new code is to be ignored (usual case - see "else" below) * allow only OK/RETURN from trap, otherwise complain */ if (code_flag) { expDiagLog("return value = %d for trap %s, action ",newcode,signal_to_string(sig)); expDiagLogU(trap->action); expDiagLogU("\r\n"); if (0 != strcmp(Tcl_GetStringResult(interp),"")) { /* * Check errorinfo and see if it contains -nostack. * This shouldn't be necessary, but John changed the * top level interp so that it distorts arbitrary * return values into TCL_ERROR, so by the time we * get back, we'll have lost the value of errorInfo */ eip = Tcl_GetVar2Ex(interp,"errorInfo","",TCL_GLOBAL_ONLY); if (eip) { exp_nostack_dump = (0 == strncmp("-nostack",Tcl_GetString(eip),8)); } } } else if (newcode != TCL_OK && newcode != TCL_RETURN) { if (newcode != TCL_ERROR) { exp_error(interp,"return value = %d for trap %s, action %s\r\n",newcode,signal_to_string(sig),trap->action); } Tcl_BackgroundError(interp); } if (!code_flag) { /* * restore values */ Tcl_ResetResult(interp); /* turns off Tcl's internal */ /* flags: ERR_IN_PROGRESS, ERROR_CODE_SET */ /* This also wipes clean errorInfo/Code/result which is why */ /* all the calls to Tcl_Dup earlier */ if (eip) { /* odd that Tcl doesn't have a call that does all this at once */ int len; char *s = Tcl_GetStringFromObj(eip,&len); Tcl_AddObjErrorInfo(interp,s,len); Tcl_DecrRefCount(eip); /* we never incr'd it, but the code allows this */ } else { Tcl_UnsetVar(interp,"errorInfo",0); } /* restore errorCode. Note that Tcl_AddErrorInfo (above) */ /* resets it to NONE. If the previous value is NONE, it's */ /* important to avoid calling Tcl_SetErrorCode since this */ /* with cause Tcl to set its internal ERROR_CODE_SET flag. */ if (ecp) { if (!streq("NONE",Tcl_GetString(ecp))) Tcl_SetErrorCode(interp,ecp); /* we're just passing on the errorcode obj */ /* presumably, Tcl will incr ref count */ } else { Tcl_UnsetVar(interp,"errorCode",0); } newcode = oldcode; /* note that since newcode gets overwritten here by old code */ /* it is possible to return in the middle of a trap by using */ /* "return" (or "continue" for that matter)! */ } return newcode; } static struct exp_cmd_data cmd_data[] = { {"trap", Exp_TrapObjCmd, 0, (ClientData)EXP_SPAWN_ID_BAD, 0}, {0}}; void exp_init_trap_cmds(interp) Tcl_Interp *interp; { exp_create_commands(interp,cmd_data); } expect5.45.4/exp_tty_comm.c0000664000175000017500000000150313235134350016201 0ustar pysslingpyssling/* exp_tty_comm.c - tty support routines common to both Expect program and library */ #include "expect_cf.h" #include #include "tcl.h" #include "exp_tty_in.h" #include "exp_rename.h" #include "expect_comm.h" #include "exp_command.h" #include "exp_log.h" #ifndef TRUE #define FALSE 0 #define TRUE 1 #endif int exp_disconnected = FALSE; /* not disc. from controlling tty */ /*static*/ exp_tty exp_tty_current, exp_tty_cooked; #define tty_current exp_tty_current #define tty_cooked exp_tty_cooked void exp_init_tty() { extern exp_tty exp_tty_original; /* save original user tty-setting in 'cooked', just in case user */ /* asks for it without earlier telling us what cooked means to them */ tty_cooked = exp_tty_original; /* save our current idea of the terminal settings */ tty_current = exp_tty_original; } expect5.45.4/pty_sgttyb.c0000664000175000017500000001364613235134350015715 0ustar pysslingpyssling/* pty_bsd.c - routines to allocate ptys - BSD version Written by: Don Libes, NIST, 2/6/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #include /* tmp for debugging */ #include #if defined(SIGCLD) && !defined(SIGCHLD) #define SIGCHLD SIGCLD #endif #include #include /*** #include ***/ #include #include #include #include "expect_cf.h" #include "exp_rename.h" #include "exp_tty_in.h" #include "exp_pty.h" void expDiagLog(); void expDiagLogU(); #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif static char master_name[] = "/dev/ptyXX"; /* master */ static char slave_name[] = "/dev/ttyXX"; /* slave */ static char *tty_type; /* ptr to char [pt] denoting whether it is a pty or tty */ static char *tty_bank; /* ptr to char [p-z] denoting which bank it is */ static char *tty_num; /* ptr to char [0-f] denoting which number it is */ char *exp_pty_slave_name; char *exp_pty_error; static void pty_stty(s,name) char *s; /* args to stty */ char *name; /* name of pty */ { #define MAX_ARGLIST 10240 char buf[MAX_ARGLIST]; /* overkill is easier */ RETSIGTYPE (*old)(); /* save old sigalarm handler */ #ifdef STTY_READS_STDOUT sprintf(buf,"%s %s > %s",STTY_BIN,s,name); #else sprintf(buf,"%s %s < %s",STTY_BIN,s,name); #endif old = signal(SIGCHLD, SIG_DFL); system(buf); signal(SIGCHLD, old); /* restore signal handler */ } int exp_dev_tty; /* file descriptor to /dev/tty or -1 if none */ static int knew_dev_tty;/* true if we had our hands on /dev/tty at any time */ #ifdef TIOCGWINSZ static struct winsize winsize = {0, 0}; #endif #if defined(TIOCGSIZE) && !defined(TIOCGWINSZ) static struct ttysize winsize = {0, 0}; #endif exp_tty exp_tty_original; #define GET_TTYTYPE 0 #define SET_TTYTYPE 1 static void ttytype(request,fd,ttycopy,ttyinit,s) int request; int fd; /* following are used only if request == SET_TTYTYPE */ int ttycopy; /* if true, copy from /dev/tty */ int ttyinit; /* if true, initialize to sane state */ char *s; /* stty args */ { static struct tchars tc; /* special characters */ static struct ltchars lc; /* local special characters */ static struct winsize win; /* window size */ static int lb; /* local modes */ static int l; /* line discipline */ if (request == GET_TTYTYPE) { if (-1 == ioctl(fd, TIOCGETP, (char *)&exp_tty_original) || -1 == ioctl(fd, TIOCGETC, (char *)&tc) || -1 == ioctl(fd, TIOCGETD, (char *)&l) || -1 == ioctl(fd, TIOCGLTC, (char *)&lc) || -1 == ioctl(fd, TIOCLGET, (char *)&lb) || -1 == ioctl(fd, TIOCGWINSZ, (char *)&win)) { knew_dev_tty = FALSE; exp_dev_tty = -1; } #ifdef TIOCGWINSZ ioctl(fd,TIOCGWINSZ,&winsize); #endif #if defined(TIOCGSIZE) && !defined(TIOCGWINSZ) ioctl(fd,TIOCGSIZE,&winsize); #endif } else { /* type == SET_TTYTYPE */ if (ttycopy && knew_dev_tty) { (void) ioctl(fd, TIOCSETP, (char *)&exp_tty_current); (void) ioctl(fd, TIOCSETC, (char *)&tc); (void) ioctl(fd, TIOCSLTC, (char *)&lc); (void) ioctl(fd, TIOCLSET, (char *)&lb); (void) ioctl(fd, TIOCSETD, (char *)&l); (void) ioctl(fd, TIOCSWINSZ, (char *)&win); #ifdef TIOCSWINSZ ioctl(fd,TIOCSWINSZ,&winsize); #endif #if defined(TIOCSSIZE) && !defined(TIOCSWINSZ) ioctl(fd,TIOCGSIZE,&winsize); #endif } #ifdef __CENTERLINE__ #undef DFLT_STTY #define DFLT_STTY "sane" #endif /* Apollo Domain doesn't need this */ #ifdef DFLT_STTY if (ttyinit) { /* overlay parms originally supplied by Makefile */ pty_stty(DFLT_STTY,slave_name); } #endif /* lastly, give user chance to override any terminal parms */ if (s) { pty_stty(s,slave_name); } } } void exp_init_pty() { tty_type = & slave_name[strlen("/dev/")]; tty_bank = &master_name[strlen("/dev/pty")]; tty_num = &master_name[strlen("/dev/ptyp")]; exp_dev_tty = open("/dev/tty",O_RDWR); #if experimental /* code to allocate force expect to get a controlling tty */ /* even if it doesn't start with one (i.e., under cron). */ /* This code is not necessary, but helpful for testing odd things. */ if (exp_dev_tty == -1) { /* give ourselves a controlling tty */ int master = exp_getptymaster(); fcntl(master,F_SETFD,1); /* close-on-exec */ setpgrp(0,0); close(0); close(1); exp_getptyslave(exp_get_var(exp_interp,"stty_init")); close(2); fcntl(0,F_DUPFD,2); /* dup 0 onto 2 */ } #endif knew_dev_tty = (exp_dev_tty != -1); if (knew_dev_tty) ttytype(GET_TTYTYPE,exp_dev_tty,0,0,(char *)0); } /* returns fd of master end of pseudotty */ int exp_getptymaster() { int master = -1; char *hex, *bank; struct stat statbuf; exp_pty_error = 0; if (exp_pty_test_start() == -1) return -1; for (bank = "pqrstuvwxyzPQRSTUVWXYZ";*bank;bank++) { *tty_bank = *bank; *tty_num = '0'; if (stat(master_name, &statbuf) < 0) break; for (hex = "0123456789abcdef";*hex;hex++) { *tty_num = *hex; /* generate slave name from master */ strcpy(slave_name,master_name); *tty_type = 't'; master = exp_pty_test(master_name,slave_name, *tty_bank,tty_num); if (master >= 0) goto done; } } done: exp_pty_test_end(); exp_pty_slave_name = slave_name; return(master); } /* see comment in pty_termios.c */ /*ARGSUSED*/ void exp_slave_control(master,control) int master; int control; { } int exp_getptyslave(ttycopy,ttyinit,stty_args) int ttycopy; int ttyinit; char *stty_args; { int slave; if (0 > (slave = open(slave_name, O_RDWR))) return(-1); if (0 == slave) { /* if opened in a new process, slave will be 0 (and */ /* ultimately, 1 and 2 as well) */ /* duplicate 0 onto 1 and 2 to prepare for stty */ fcntl(0,F_DUPFD,1); fcntl(0,F_DUPFD,2); } ttytype(SET_TTYTYPE,slave,ttycopy,ttyinit,stty_args); (void) exp_pty_unlock(); return(slave); } void exp_pty_exit() { /* a stub so we can do weird things on the cray */ } expect5.45.4/expect.c0000664000175000017500000024472613235554476015021 0ustar pysslingpyssling/* expect.c - expect commands Written by: Don Libes, NIST, 2/6/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #include #include #include #include #include /* for isspace */ #include /* for time(3) */ #include "expect_cf.h" #ifdef HAVE_SYS_WAIT_H #include #endif #ifdef HAVE_UNISTD_H # include #endif #include "tclInt.h" #include "string.h" #include "exp_rename.h" #include "exp_prog.h" #include "exp_command.h" #include "exp_log.h" #include "exp_event.h" #include "exp_tty_in.h" #include "exp_tstamp.h" /* this should disappear when interact */ /* loses ref's to it */ #ifdef TCL_DEBUGGER #include "tcldbg.h" #endif #include "retoglob.c" /* RE 2 GLOB translator C variant */ /* initial length of strings that we can guarantee patterns can match */ int exp_default_match_max = 2000; #define INIT_EXPECT_TIMEOUT_LIT "10" /* seconds */ #define INIT_EXPECT_TIMEOUT 10 /* seconds */ int exp_default_parity = TRUE; int exp_default_rm_nulls = TRUE; int exp_default_close_on_eof = TRUE; /* user variable names */ #define EXPECT_TIMEOUT "timeout" #define EXPECT_OUT "expect_out" extern int Exp_StringCaseMatch _ANSI_ARGS_((Tcl_UniChar *string, int strlen, Tcl_UniChar *pattern,int plen, int nocase,int *offset)); typedef struct ThreadSpecificData { int timeout; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * addr of these placeholders appear as clientData in ExpectCmd * when called * as expect_user and expect_tty. It would be nicer * to invoked * expDevttyGet() but C doesn't allow this in an array initialization, sigh. */ static ExpState StdinoutPlaceholder; static ExpState DevttyPlaceholder; /* 1 ecase struct is reserved for each case in the expect command. Note that * eof/timeout don't use any of theirs, but the algorithm is simpler this way. */ struct ecase { /* case for expect command */ struct exp_i *i_list; Tcl_Obj *pat; /* original pattern spec */ Tcl_Obj *body; /* ptr to body to be executed upon match */ Tcl_Obj *gate; /* For PAT_RE, a gate-keeper glob pattern * which is quicker to match and reduces * the number of calls into expensive RE * matching. Optional. */ #define PAT_EOF 1 #define PAT_TIMEOUT 2 #define PAT_DEFAULT 3 #define PAT_FULLBUFFER 4 #define PAT_GLOB 5 /* glob-style pattern list */ #define PAT_RE 6 /* regular expression */ #define PAT_EXACT 7 /* exact string */ #define PAT_NULL 8 /* ASCII 0 */ #define PAT_TYPES 9 /* used to size array of pattern type descriptions */ int use; /* PAT_XXX */ int simple_start; /* offset (chars) from start of buffer denoting where a * glob or exact match begins */ int transfer; /* if false, leave matched chars in input stream */ int indices; /* if true, write indices */ int iread; /* if true, reread indirects */ int timestamp; /* if true, write timestamps */ #define CASE_UNKNOWN 0 #define CASE_NORM 1 #define CASE_LOWER 2 int Case; /* convert case before doing match? */ }; /* descriptions of the pattern types, used for debugging */ char *pattern_style[PAT_TYPES]; struct exp_cases_descriptor { int count; struct ecase **cases; }; /* This describes an Expect command */ static struct exp_cmd_descriptor { int cmdtype; /* bg, before, after */ int duration; /* permanent or temporary */ int timeout_specified_by_flag; /* if -timeout flag used */ int timeout; /* timeout period if flag used */ struct exp_cases_descriptor ecd; struct exp_i *i_list; } exp_cmds[4]; /* note that exp_cmds[FG] is just a fake, the real contents is stored in some * dynamically-allocated variable. We use exp_cmds[FG] mostly as a well-known * address and also as a convenience and so we allocate just a few of its * fields that we need. */ static void exp_cmd_init( struct exp_cmd_descriptor *cmd, int cmdtype, int duration) { cmd->duration = duration; cmd->cmdtype = cmdtype; cmd->ecd.cases = 0; cmd->ecd.count = 0; cmd->i_list = 0; } static int i_read_errno;/* place to save errno, if i_read() == -1, so it doesn't get overwritten before we get to read it */ #ifdef SIMPLE_EVENT static int alarm_fired; /* if alarm occurs */ #endif void exp_background_channelhandlers_run_all(); /* exp_indirect_updateX is called by Tcl when an indirect variable is set */ static char *exp_indirect_update1( /* 1-part Tcl variable names */ Tcl_Interp *interp, struct exp_cmd_descriptor *ecmd, struct exp_i *exp_i); static char *exp_indirect_update2( /* 2-part Tcl variable names */ ClientData clientData, Tcl_Interp *interp, /* Interpreter containing variable. */ char *name1, /* Name of variable. */ char *name2, /* Second part of variable name. */ int flags); /* Information about what happened. */ #ifdef SIMPLE_EVENT /*ARGSUSED*/ static RETSIGTYPE sigalarm_handler(int n) /* unused, for compatibility with STDC */ { alarm_fired = TRUE; } #endif /*SIMPLE_EVENT*/ /* free up everything in ecase */ static void free_ecase( Tcl_Interp *interp, struct ecase *ec, int free_ilist) /* if we should free ilist */ { if (ec->i_list->duration == EXP_PERMANENT) { if (ec->pat) { Tcl_DecrRefCount(ec->pat); } if (ec->gate) { Tcl_DecrRefCount(ec->gate); } if (ec->body) { Tcl_DecrRefCount(ec->body); } } if (free_ilist) { ec->i_list->ecount--; if (ec->i_list->ecount == 0) { exp_free_i(interp,ec->i_list,exp_indirect_update2); } } ckfree((char *)ec); /* NEW */ } /* free up any argv structures in the ecases */ static void free_ecases( Tcl_Interp *interp, struct exp_cmd_descriptor *eg, int free_ilist) /* if true, free ilists */ { int i; if (!eg->ecd.cases) return; for (i=0;iecd.count;i++) { free_ecase(interp,eg->ecd.cases[i],free_ilist); } ckfree((char *)eg->ecd.cases); eg->ecd.cases = 0; eg->ecd.count = 0; } #if 0 /* no standard defn for this, and some systems don't even have it, so avoid */ /* the whole quagmire by calling it something else */ static char *exp_strdup(char *s) { char *news = ckalloc(strlen(s) + 1); strcpy(news,s); return(news); } #endif /* return TRUE if string appears to be a set of arguments The intent of this test is to support the ability of commands to have all their args braced as one. This conflicts with the possibility of actually intending to have a single argument. The bad case is in expect which can have a single argument with embedded \n's although it's rare. Examples that this code should handle: \n FALSE (pattern) \n\n FALSE \n \n \n FALSE foo FALSE foo\n FALSE \nfoo\n TRUE (set of args) \nfoo\nbar TRUE Current test is very cheap and almost always right :-) */ int exp_one_arg_braced(Tcl_Obj *objPtr) /* INTL */ { int seen_nl = FALSE; char *p = Tcl_GetString(objPtr); for (;*p;p++) { if (*p == '\n') { seen_nl = TRUE; continue; } if (!isspace(*p)) { /* INTL: ISO space */ return(seen_nl); } } return FALSE; } /* called to execute a command of only one argument - a hack to commands */ /* to be called with all args surrounded by an outer set of braces */ /* Returns a list object containing the new set of arguments */ /* Caller then has to either reinvoke itself, or better, simply replace * its current argumnts */ /*ARGSUSED*/ Tcl_Obj* exp_eval_with_one_arg( ClientData clientData, Tcl_Interp *interp, Tcl_Obj *CONST objv[]) /* Argument objects. */ { Tcl_Obj* res = Tcl_NewListObj (1,objv); #define NUM_STATIC_OBJS 20 Tcl_Token *tokenPtr; CONST char *p; CONST char *next; int rc; int bytesLeft, numWords; Tcl_Parse parse; /* * Prepend the command name and the -nobrace switch so we can * reinvoke without recursing. */ Tcl_ListObjAppendElement (interp, res, Tcl_NewStringObj("-nobrace", -1)); p = Tcl_GetStringFromObj(objv[1], &bytesLeft); /* * Treat the pattern/action block like a series of Tcl commands. * For each command, parse the command words, perform substititions * on each word, and add the words to an array of values. We don't * actually evaluate the individual commands, just the substitutions. */ do { if (Tcl_ParseCommand(interp, p, bytesLeft, 0, &parse) != TCL_OK) { rc = TCL_ERROR; goto done; } numWords = parse.numWords; if (numWords > 0) { /* * Generate an array of objects for the words of the command. */ /* * For each word, perform substitutions then store the * result in the objs array. */ for (tokenPtr = parse.tokenPtr; numWords > 0; numWords--, tokenPtr += (tokenPtr->numComponents + 1)) { /* FUTURE: Save token information, do substitution later */ Tcl_Obj* w = Tcl_EvalTokens(interp, tokenPtr+1, tokenPtr->numComponents); /* w has refCount 1 here, if not NULL */ if (w == NULL) { Tcl_DecrRefCount (res); res = NULL; goto done; } Tcl_ListObjAppendElement (interp, res, w); Tcl_DecrRefCount (w); /* Local reference goes away */ } } /* * Advance to the next command in the script. */ next = parse.commandStart + parse.commandSize; bytesLeft -= next - p; p = next; Tcl_FreeParse(&parse); } while (bytesLeft > 0); done: return res; } static void ecase_clear(struct ecase *ec) { ec->i_list = 0; ec->pat = 0; ec->body = 0; ec->transfer = TRUE; ec->simple_start = 0; ec->indices = FALSE; ec->iread = FALSE; ec->timestamp = FALSE; ec->Case = CASE_NORM; ec->use = PAT_GLOB; ec->gate = NULL; } static struct ecase * ecase_new(void) { struct ecase *ec = (struct ecase *)ckalloc(sizeof(struct ecase)); ecase_clear(ec); return ec; } /* parse_expect_args parses the arguments to expect or its variants. It normally returns TCL_OK, and returns TCL_ERROR for failure. (It can't return i_list directly because there is no way to differentiate between clearing, say, expect_before and signalling an error.) eg (expect_global) is initialized to reflect the arguments parsed eg->ecd.cases is an array of ecases eg->ecd.count is the # of ecases eg->i_list is a linked list of exp_i's which represent the -i info Each exp_i is chained to the next so that they can be easily free'd if necessary. Each exp_i has a reference count. If the -i is not used (e.g., has no following patterns), the ref count will be 0. Each ecase points to an exp_i. Several ecases may point to the same exp_i. Variables named by indirect exp_i's are read for the direct values. If called from a foreground expect and no patterns or -i are given, a default exp_i is forced so that the command "expect" works right. The exp_i chain can be broken by the caller if desired. */ static int parse_expect_args( Tcl_Interp *interp, struct exp_cmd_descriptor *eg, ExpState *default_esPtr, /* suggested ExpState if called as expect_user or _tty */ int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { int i; char *string; struct ecase ec; /* temporary to collect args */ eg->timeout_specified_by_flag = FALSE; ecase_clear(&ec); /* Allocate an array to store the ecases. Force array even if 0 */ /* cases. This will often be too large (i.e., if there are flags) */ /* but won't affect anything. */ eg->ecd.cases = (struct ecase **)ckalloc(sizeof(struct ecase *) * (1+(objc/2))); eg->ecd.count = 0; for (i = 1;i= objc) { Tcl_WrongNumArgs(interp, 1, objv,"-glob pattern"); return TCL_ERROR; } goto pattern; case EXP_ARG_REGEXP: i++; if (i >= objc) { Tcl_WrongNumArgs(interp, 1, objv,"-regexp regexp"); return TCL_ERROR; } ec.use = PAT_RE; /* * Try compiling the expression so we can report * any errors now rather then when we first try to * use it. */ if (!(Tcl_GetRegExpFromObj(interp, objv[i], TCL_REG_ADVANCED))) { goto error; } /* Derive a gate keeper glob pattern which reduces the amount * of RE matching. */ { Tcl_Obj* g; Tcl_UniChar* str; int strlen; str = Tcl_GetUnicodeFromObj (objv[i], &strlen); g = exp_retoglob (str, strlen); if (g) { ec.gate = g; expDiagLog("Gate keeper glob pattern for '%s'",Tcl_GetString(objv[i])); expDiagLog(" is '%s'. Activating booster.\n",Tcl_GetString(g)); } else { /* Ignore errors, fall back to regular RE matching */ expDiagLog("Gate keeper glob pattern for '%s'",Tcl_GetString(objv[i])); expDiagLog(" is '%s'. Not usable, disabling the",Tcl_GetString(Tcl_GetObjResult (interp))); expDiagLog(" performance booster.\n"); } } goto pattern; case EXP_ARG_EXACT: i++; if (i >= objc) { Tcl_WrongNumArgs(interp, 1, objv, "-exact string"); return TCL_ERROR; } ec.use = PAT_EXACT; goto pattern; case EXP_ARG_NOTRANSFER: ec.transfer = 0; break; case EXP_ARG_NOCASE: ec.Case = CASE_LOWER; break; case EXP_ARG_SPAWN_ID: i++; if (i>=objc) { Tcl_WrongNumArgs(interp, 1, objv, "-i spawn_id"); goto error; } ec.i_list = exp_new_i_complex(interp, Tcl_GetString(objv[i]), eg->duration, exp_indirect_update2); if (!ec.i_list) goto error; ec.i_list->cmdtype = eg->cmdtype; /* link new i_list to head of list */ ec.i_list->next = eg->i_list; eg->i_list = ec.i_list; break; case EXP_ARG_INDICES: ec.indices = TRUE; break; case EXP_ARG_IREAD: ec.iread = TRUE; break; case EXP_ARG_TIMESTAMP: ec.timestamp = TRUE; break; case EXP_ARG_DASH_TIMEOUT: i++; if (i>=objc) { Tcl_WrongNumArgs(interp, 1, objv, "-timeout seconds"); goto error; } if (Tcl_GetIntFromObj(interp, objv[i], &eg->timeout) != TCL_OK) { goto error; } eg->timeout_specified_by_flag = TRUE; break; case EXP_ARG_NOBRACE: /* nobrace does nothing but take up space */ /* on the command line which prevents */ /* us from re-expanding any command lines */ /* of one argument that looks like it should */ /* be expanded to multiple arguments. */ break; } /* * Keep processing arguments, we aren't ready for the * pattern yet. */ continue; } else { /* * We have a pattern or keyword. */ static char *keywords[] = { "timeout", "eof", "full_buffer", "default", "null", (char *)NULL }; enum keywords { EXP_ARG_TIMEOUT, EXP_ARG_EOF, EXP_ARG_FULL_BUFFER, EXP_ARG_DEFAULT, EXP_ARG_NULL }; /* * Match keywords exactly, otherwise they are patterns. */ if (Tcl_GetIndexFromObj(interp, objv[i], keywords, "keyword", 1 /* exact */, &index) != TCL_OK) { Tcl_ResetResult(interp); goto pattern; } switch ((enum keywords) index) { case EXP_ARG_TIMEOUT: ec.use = PAT_TIMEOUT; break; case EXP_ARG_EOF: ec.use = PAT_EOF; break; case EXP_ARG_FULL_BUFFER: ec.use = PAT_FULLBUFFER; break; case EXP_ARG_DEFAULT: ec.use = PAT_DEFAULT; break; case EXP_ARG_NULL: ec.use = PAT_NULL; break; } pattern: /* if no -i, use previous one */ if (!ec.i_list) { /* if no -i flag has occurred yet, use default */ if (!eg->i_list) { if (default_esPtr != EXP_SPAWN_ID_BAD) { eg->i_list = exp_new_i_simple(default_esPtr,eg->duration); } else { default_esPtr = expStateCurrent(interp,0,0,1); if (!default_esPtr) goto error; eg->i_list = exp_new_i_simple(default_esPtr,eg->duration); } } ec.i_list = eg->i_list; } ec.i_list->ecount++; /* save original pattern spec */ /* keywords such as "-timeout" are saved as patterns here */ /* useful for debugging but not otherwise used */ ec.pat = objv[i]; if (eg->duration == EXP_PERMANENT) { Tcl_IncrRefCount(ec.pat); if (ec.gate) { Tcl_IncrRefCount(ec.gate); } } i++; if (i < objc) { ec.body = objv[i]; if (eg->duration == EXP_PERMANENT) Tcl_IncrRefCount(ec.body); } else { ec.body = NULL; } *(eg->ecd.cases[eg->ecd.count] = ecase_new()) = ec; /* clear out for next set */ ecase_clear(&ec); eg->ecd.count++; } } /* if no patterns at all have appeared force the current */ /* spawn id to be added to list anyway */ if (eg->i_list == 0) { if (default_esPtr != EXP_SPAWN_ID_BAD) { eg->i_list = exp_new_i_simple(default_esPtr,eg->duration); } else { default_esPtr = expStateCurrent(interp,0,0,1); if (!default_esPtr) goto error; eg->i_list = exp_new_i_simple(default_esPtr,eg->duration); } } return(TCL_OK); error: /* very hard to free case_master_list here if it hasn't already */ /* been attached to a case, ugh */ /* note that i_list must be avail to free ecases! */ free_ecases(interp,eg,0); if (eg->i_list) exp_free_i(interp,eg->i_list,exp_indirect_update2); return(TCL_ERROR); } #define EXP_IS_DEFAULT(x) ((x) == EXP_TIMEOUT || (x) == EXP_EOF) static char yes[] = "yes\r\n"; static char no[] = "no\r\n"; /* this describes status of a successful match */ struct eval_out { struct ecase *e; /* ecase that matched */ ExpState *esPtr; /* ExpState that matched */ Tcl_UniChar* matchbuf; /* Buffer that matched, */ int matchlen; /* and #chars that matched, or * #chars in buffer at EOF */ /* This points into the esPtr->input.buffer ! */ }; /* *---------------------------------------------------------------------- * * string_case_first -- * * Find the first instance of a pattern in a string. * * Results: * Returns the pointer to the first instance of the pattern * in the given string, or NULL if no match was found. * * Side effects: * None. * *---------------------------------------------------------------------- */ Tcl_UniChar * string_case_first( /* INTL */ register Tcl_UniChar *string, /* String (unicode). */ int length, /* length of above string */ register char *pattern) /* Pattern, which may contain * special characters (utf8). */ { Tcl_UniChar *s; char *p; int offset; register int consumed = 0; Tcl_UniChar ch1, ch2; Tcl_UniChar *bufend = string + length; while ((*string != 0) && (string < bufend)) { s = string; p = pattern; while ((*s) && (s < bufend)) { ch1 = *s++; consumed++; offset = TclUtfToUniChar(p, &ch2); if (Tcl_UniCharToLower(ch1) != Tcl_UniCharToLower(ch2)) { break; } p += offset; } if (*p == '\0') { return string; } string++; consumed++; } return NULL; } Tcl_UniChar * string_first( /* INTL */ register Tcl_UniChar *string, /* String (unicode). */ int length, /* length of above string */ register char *pattern) /* Pattern, which may contain * special characters (utf8). */ { Tcl_UniChar *s; char *p; int offset; register int consumed = 0; Tcl_UniChar ch1, ch2; Tcl_UniChar *bufend = string + length; while ((*string != 0) && (string < bufend)) { s = string; p = pattern; while ((*s) && (s < bufend)) { ch1 = *s++; consumed++; offset = TclUtfToUniChar(p, &ch2); if (ch1 != ch2) { break; } p += offset; } if (*p == '\0') { return string; } string++; consumed++; } return NULL; } Tcl_UniChar * string_first_char( /* INTL */ register Tcl_UniChar *string, /* String. */ register Tcl_UniChar pattern) { /* unicode based Tcl_UtfFindFirst */ Tcl_UniChar find; while (1) { find = *string; if (find == pattern) { return string; } if (*string == '\0') { return NULL; } string ++; } return NULL; } /* like eval_cases, but handles only a single cases that needs a real */ /* string match */ /* returns EXP_X where X is MATCH, NOMATCH, FULLBUFFER, TCLERRROR */ static int eval_case_string( Tcl_Interp *interp, struct ecase *e, ExpState *esPtr, struct eval_out *o, /* 'output' - i.e., final case of interest */ /* next two args are for debugging, when they change, reprint buffer */ ExpState **last_esPtr, int *last_case, char *suffix) { Tcl_RegExp re; Tcl_RegExpInfo info; Tcl_Obj* buf; Tcl_UniChar *str; int numchars, flags, dummy, globmatch; int result; str = esPtr->input.buffer; numchars = esPtr->input.use; /* if ExpState or case changed, redisplay debug-buffer */ if ((esPtr != *last_esPtr) || e->Case != *last_case) { expDiagLog("\r\nexpect%s: does \"",suffix); expDiagLogU(expPrintifyUni(str,numchars)); expDiagLog("\" (spawn_id %s) match %s ",esPtr->name,pattern_style[e->use]); *last_esPtr = esPtr; *last_case = e->Case; } if (e->use == PAT_RE) { expDiagLog("\""); expDiagLogU(expPrintify(Tcl_GetString(e->pat))); expDiagLog("\"? "); if (e->gate) { int plen; Tcl_UniChar* pat = Tcl_GetUnicodeFromObj(e->gate,&plen); expDiagLog("Gate \""); expDiagLogU(expPrintify(Tcl_GetString(e->gate))); expDiagLog("\"? gate="); globmatch = Exp_StringCaseMatch(str, numchars, pat, plen, (e->Case == CASE_NORM) ? 0 : 1, &dummy); } else { expDiagLog("(No Gate, RE only) gate="); /* No gate => RE matching always */ globmatch = 1; } if (globmatch < 0) { expDiagLogU(no); /* i.e. no match */ } else { expDiagLog("yes re="); if (e->Case == CASE_NORM) { flags = TCL_REG_ADVANCED; } else { flags = TCL_REG_ADVANCED | TCL_REG_NOCASE; } re = Tcl_GetRegExpFromObj(interp, e->pat, flags); /* ZZZ: Future optimization: Avoid copying */ buf = Tcl_NewUnicodeObj (str, numchars); Tcl_IncrRefCount (buf); result = Tcl_RegExpExecObj(interp, re, buf, 0 /* offset */, -1 /* nmatches */, 0 /* eflags */); Tcl_DecrRefCount (buf); if (result > 0) { o->e = e; /* * Retrieve the byte offset of the end of the * matched string. */ Tcl_RegExpGetInfo(re, &info); o->matchlen = info.matches[0].end; o->matchbuf = str; o->esPtr = esPtr; expDiagLogU(yes); return(EXP_MATCH); } else if (result == 0) { expDiagLogU(no); } else { /* result < 0 */ return(EXP_TCLERROR); } } } else if (e->use == PAT_GLOB) { int match; /* # of chars that matched */ expDiagLog("\""); expDiagLogU(expPrintify(Tcl_GetString(e->pat))); expDiagLog("\"? "); if (str) { int plen; Tcl_UniChar* pat = Tcl_GetUnicodeFromObj(e->pat,&plen); match = Exp_StringCaseMatch(str,numchars, pat, plen, (e->Case == CASE_NORM) ? 0 : 1, &e->simple_start); if (match != -1) { o->e = e; o->matchlen = match; o->matchbuf = str; o->esPtr = esPtr; expDiagLogU(yes); return(EXP_MATCH); } } expDiagLogU(no); } else if (e->use == PAT_EXACT) { int patLength; char *pat = Tcl_GetStringFromObj(e->pat, &patLength); Tcl_UniChar *p; if (e->Case == CASE_NORM) { p = string_first(str, numchars, pat); /* NEW function in this file, see above */ } else { p = string_case_first(str, numchars, pat); } expDiagLog("\""); expDiagLogU(expPrintify(Tcl_GetString(e->pat))); expDiagLog("\"? "); if (p) { /* Bug 3095935. Go from #bytes to #chars */ patLength = Tcl_NumUtfChars (pat, patLength); e->simple_start = p - str; o->e = e; o->matchlen = patLength; o->matchbuf = str; o->esPtr = esPtr; expDiagLogU(yes); return(EXP_MATCH); } else expDiagLogU(no); } else if (e->use == PAT_NULL) { CONST Tcl_UniChar *p; expDiagLogU("null? "); p = string_first_char (str, 0); /* NEW function in this file, see above */ if (p) { o->e = e; o->matchlen = p-str; /* #chars */ o->matchbuf = str; o->esPtr = esPtr; expDiagLogU(yes); return EXP_MATCH; } expDiagLogU(no); } else if (e->use == PAT_FULLBUFFER) { expDiagLogU(Tcl_GetString(e->pat)); expDiagLogU("? "); /* this must be the same test as in expIRead */ /* We drop one third when are at least 2/3 full */ /* condition is (size >= max*2/3) <=> (size*3 >= max*2) */ if (((expSizeGet(esPtr)*3) >= (esPtr->input.max*2)) && (numchars > 0)) { o->e = e; o->matchlen = numchars/3; o->matchbuf = str; o->esPtr = esPtr; expDiagLogU(yes); return(EXP_FULLBUFFER); } else { expDiagLogU(no); } } return(EXP_NOMATCH); } /* sets o.e if successfully finds a matching pattern, eof, timeout or deflt */ /* returns original status arg or EXP_TCLERROR */ static int eval_cases( Tcl_Interp *interp, struct exp_cmd_descriptor *eg, ExpState *esPtr, struct eval_out *o, /* 'output' - i.e., final case of interest */ /* next two args are for debugging, when they change, reprint buffer */ ExpState **last_esPtr, int *last_case, int status, ExpState *(esPtrs[]), int mcount, char *suffix) { int i; ExpState *em; /* ExpState of ecase */ struct ecase *e; if (o->e || status == EXP_TCLERROR || eg->ecd.count == 0) return(status); if (status == EXP_TIMEOUT) { for (i=0;iecd.count;i++) { e = eg->ecd.cases[i]; if (e->use == PAT_TIMEOUT || e->use == PAT_DEFAULT) { o->e = e; break; } } return(status); } else if (status == EXP_EOF) { for (i=0;iecd.count;i++) { e = eg->ecd.cases[i]; if (e->use == PAT_EOF || e->use == PAT_DEFAULT) { struct exp_state_list *slPtr; for (slPtr=e->i_list->state_list; slPtr ;slPtr=slPtr->next) { em = slPtr->esPtr; if (expStateAnyIs(em) || em == esPtr) { o->e = e; return(status); } } } } return(status); } /* the top loops are split from the bottom loop only because I can't */ /* split'em further. */ /* The bufferful condition does not prevent a pattern match from */ /* occurring and vice versa, so it is scanned with patterns */ for (i=0;iecd.count;i++) { struct exp_state_list *slPtr; int j; e = eg->ecd.cases[i]; if (e->use == PAT_TIMEOUT || e->use == PAT_DEFAULT || e->use == PAT_EOF) continue; for (slPtr = e->i_list->state_list; slPtr; slPtr = slPtr->next) { em = slPtr->esPtr; /* if em == EXP_SPAWN_ID_ANY, then user is explicitly asking */ /* every case to be checked against every ExpState */ if (expStateAnyIs(em)) { /* test against each spawn_id */ for (j=0;jecd.count;) { struct ecase *e = ecmd->ecd.cases[i]; if (e->i_list == exp_i) { free_ecase(interp,e,0); /* shift remaining elements down */ /* but only if there are any left */ /* Use memmove to handle the overlap */ /* memcpy breaks */ if (i+1 != ecmd->ecd.count) { memmove(&ecmd->ecd.cases[i], &ecmd->ecd.cases[i+1], ((ecmd->ecd.count - i) - 1) * sizeof(struct exp_cmd_descriptor *)); } ecmd->ecd.count--; if (0 == ecmd->ecd.count) { ckfree((char *)ecmd->ecd.cases); ecmd->ecd.cases = 0; } } else { i++; } } } /* remove exp_i from list */ static void exp_i_remove( Tcl_Interp *interp, struct exp_i **ei, /* list to remove from */ struct exp_i *exp_i) /* element to remove */ { /* since it's in middle of list, free exp_i by hand */ for (;*ei; ei = &(*ei)->next) { if (*ei == exp_i) { *ei = exp_i->next; exp_i->next = 0; exp_free_i(interp,exp_i,exp_indirect_update2); break; } } } /* remove exp_i from list and remove any dependent ecases */ static void exp_i_remove_with_ecases( Tcl_Interp *interp, struct exp_cmd_descriptor *ecmd, struct exp_i *exp_i) { ecases_remove_by_expi(interp,ecmd,exp_i); exp_i_remove(interp,&ecmd->i_list,exp_i); } /* remove ecases tied to a single direct spawn id */ static void ecmd_remove_state( Tcl_Interp *interp, struct exp_cmd_descriptor *ecmd, ExpState *esPtr, int direct) { struct exp_i *exp_i, *next; struct exp_state_list **slPtr; for (exp_i=ecmd->i_list;exp_i;exp_i=next) { next = exp_i->next; if (!(direct & exp_i->direct)) continue; for (slPtr = &exp_i->state_list;*slPtr;) { if (esPtr == ((*slPtr)->esPtr)) { struct exp_state_list *tmp = *slPtr; *slPtr = (*slPtr)->next; exp_free_state_single(tmp); /* if last bg ecase, disarm spawn id */ if ((ecmd->cmdtype == EXP_CMD_BG) && (!expStateAnyIs(esPtr))) { esPtr->bg_ecount--; if (esPtr->bg_ecount == 0) { exp_disarm_background_channelhandler(esPtr); esPtr->bg_interp = 0; } } continue; } slPtr = &(*slPtr)->next; } /* if left with no ExpStates (and is direct), get rid of it */ /* and any dependent ecases */ if (exp_i->direct == EXP_DIRECT && !exp_i->state_list) { exp_i_remove_with_ecases(interp,ecmd,exp_i); } } } /* this is called from exp_close to clean up the ExpState */ void exp_ecmd_remove_state_direct_and_indirect( Tcl_Interp *interp, ExpState *esPtr) { ecmd_remove_state(interp,&exp_cmds[EXP_CMD_BEFORE],esPtr,EXP_DIRECT|EXP_INDIRECT); ecmd_remove_state(interp,&exp_cmds[EXP_CMD_AFTER],esPtr,EXP_DIRECT|EXP_INDIRECT); ecmd_remove_state(interp,&exp_cmds[EXP_CMD_BG],esPtr,EXP_DIRECT|EXP_INDIRECT); /* force it - explanation in exp_tk.c where this func is defined */ exp_disarm_background_channelhandler_force(esPtr); } /* arm a list of background ExpState's */ static void state_list_arm( Tcl_Interp *interp, struct exp_state_list *slPtr) { /* for each spawn id in list, arm if necessary */ for (;slPtr;slPtr=slPtr->next) { ExpState *esPtr = slPtr->esPtr; if (expStateAnyIs(esPtr)) continue; if (esPtr->bg_ecount == 0) { exp_arm_background_channelhandler(esPtr); esPtr->bg_interp = interp; } esPtr->bg_ecount++; } } /* return TRUE if this ecase is used by this fd */ static int exp_i_uses_state( struct exp_i *exp_i, ExpState *esPtr) { struct exp_state_list *fdp; for (fdp = exp_i->state_list;fdp;fdp=fdp->next) { if (fdp->esPtr == esPtr) return 1; } return 0; } static void ecase_append( Tcl_Interp *interp, struct ecase *ec) { if (!ec->transfer) Tcl_AppendElement(interp,"-notransfer"); if (ec->indices) Tcl_AppendElement(interp,"-indices"); if (!ec->Case) Tcl_AppendElement(interp,"-nocase"); if (ec->use == PAT_RE) Tcl_AppendElement(interp,"-re"); else if (ec->use == PAT_GLOB) Tcl_AppendElement(interp,"-gl"); else if (ec->use == PAT_EXACT) Tcl_AppendElement(interp,"-ex"); Tcl_AppendElement(interp,Tcl_GetString(ec->pat)); Tcl_AppendElement(interp,ec->body?Tcl_GetString(ec->body):""); } /* append all ecases that match this exp_i */ static void ecase_by_exp_i_append( Tcl_Interp *interp, struct exp_cmd_descriptor *ecmd, struct exp_i *exp_i) { int i; for (i=0;iecd.count;i++) { if (ecmd->ecd.cases[i]->i_list == exp_i) { ecase_append(interp,ecmd->ecd.cases[i]); } } } static void exp_i_append( Tcl_Interp *interp, struct exp_i *exp_i) { Tcl_AppendElement(interp,"-i"); if (exp_i->direct == EXP_INDIRECT) { Tcl_AppendElement(interp,exp_i->variable); } else { struct exp_state_list *fdp; /* if more than one element, add braces */ if (exp_i->state_list->next) { Tcl_AppendResult(interp," {",(char *)0); } for (fdp = exp_i->state_list;fdp;fdp=fdp->next) { char buf[25]; /* big enough for a small int */ sprintf(buf,"%ld", (long)fdp->esPtr); Tcl_AppendElement(interp,buf); } if (exp_i->state_list->next) { Tcl_AppendResult(interp,"} ",(char *)0); } } } /* return current setting of the permanent expect_before/after/bg */ int expect_info( Tcl_Interp *interp, struct exp_cmd_descriptor *ecmd, int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { struct exp_i *exp_i; int i; int direct = EXP_DIRECT|EXP_INDIRECT; char *iflag = 0; int all = FALSE; /* report on all fds */ ExpState *esPtr = 0; static char *flags[] = {"-i", "-all", "-noindirect", (char *)0}; enum flags {EXP_ARG_I, EXP_ARG_ALL, EXP_ARG_NOINDIRECT}; /* start with 2 to skip over "cmdname -info" */ for (i = 2;i= objc) { Tcl_WrongNumArgs(interp, 1, objv,"-i spawn_id"); return TCL_ERROR; } break; case EXP_ARG_ALL: all = TRUE; break; case EXP_ARG_NOINDIRECT: direct &= ~EXP_INDIRECT; break; } } if (all) { /* avoid printing out -i when redundant */ struct exp_i *previous = 0; for (i=0;iecd.count;i++) { if (previous != ecmd->ecd.cases[i]->i_list) { exp_i_append(interp,ecmd->ecd.cases[i]->i_list); previous = ecmd->ecd.cases[i]->i_list; } ecase_append(interp,ecmd->ecd.cases[i]); } return TCL_OK; } if (!iflag) { if (!(esPtr = expStateCurrent(interp,0,0,0))) { return TCL_ERROR; } } else if (!(esPtr = expStateFromChannelName(interp,iflag,0,0,0,"dummy"))) { /* not a valid ExpState so assume it is an indirect variable */ Tcl_ResetResult(interp); for (i=0;iecd.count;i++) { if (ecmd->ecd.cases[i]->i_list->direct == EXP_INDIRECT && streq(ecmd->ecd.cases[i]->i_list->variable,iflag)) { ecase_append(interp,ecmd->ecd.cases[i]); } } return TCL_OK; } /* print ecases of this direct_fd */ for (exp_i=ecmd->i_list;exp_i;exp_i=exp_i->next) { if (!(direct & exp_i->direct)) continue; if (!exp_i_uses_state(exp_i,esPtr)) continue; ecase_by_exp_i_append(interp,ecmd,exp_i); } return TCL_OK; } /* Exp_ExpectGlobalObjCmd is invoked to process expect_before/after/background */ /*ARGSUSED*/ int Exp_ExpectGlobalObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { int result = TCL_OK; struct exp_i *exp_i, **eip; struct exp_state_list *slPtr; /* temp for interating over state_list */ struct exp_cmd_descriptor eg; int count; Tcl_Obj* new_cmd = NULL; struct exp_cmd_descriptor *ecmd = (struct exp_cmd_descriptor *) clientData; if ((objc == 2) && exp_one_arg_braced(objv[1])) { /* expect {...} */ new_cmd = exp_eval_with_one_arg(clientData,interp,objv); if (!new_cmd) return TCL_ERROR; } else if ((objc == 3) && streq(Tcl_GetString(objv[1]),"-brace")) { /* expect -brace {...} ... fake command line for reparsing */ Tcl_Obj *new_objv[2]; new_objv[0] = objv[0]; new_objv[1] = objv[2]; new_cmd = exp_eval_with_one_arg(clientData,interp,new_objv); if (!new_cmd) return TCL_ERROR; } if (new_cmd) { /* Replace old arguments with result of the reparse */ Tcl_ListObjGetElements (interp, new_cmd, &objc, (Tcl_Obj***) &objv); } if (objc > 1 && (Tcl_GetString(objv[1])[0] == '-')) { if (exp_flageq("info",Tcl_GetString(objv[1])+1,4)) { int res = expect_info(interp,ecmd,objc,objv); if (new_cmd) { Tcl_DecrRefCount (new_cmd); } return res; } } exp_cmd_init(&eg,ecmd->cmdtype,EXP_PERMANENT); if (TCL_ERROR == parse_expect_args(interp,&eg,EXP_SPAWN_ID_BAD, objc,objv)) { if (new_cmd) { Tcl_DecrRefCount (new_cmd); } return TCL_ERROR; } /* * visit each NEW direct exp_i looking for spawn ids. * When found, remove them from any OLD exp_i's. */ /* visit each exp_i */ for (exp_i=eg.i_list;exp_i;exp_i=exp_i->next) { if (exp_i->direct == EXP_INDIRECT) continue; /* for each spawn id, remove it from ecases */ for (slPtr=exp_i->state_list;slPtr;slPtr=slPtr->next) { ExpState *esPtr = slPtr->esPtr; /* validate all input descriptors */ if (!expStateAnyIs(esPtr)) { if (!expStateCheck(interp,esPtr,1,1,"expect")) { result = TCL_ERROR; goto cleanup; } } /* remove spawn id from exp_i */ ecmd_remove_state(interp,ecmd,esPtr,EXP_DIRECT); } } /* * For each indirect variable, release its old ecases and * clean up the matching spawn ids. * Same logic as in "expect_X delete" command. */ for (exp_i=eg.i_list;exp_i;exp_i=exp_i->next) { struct exp_i **old_i; if (exp_i->direct == EXP_DIRECT) continue; for (old_i = &ecmd->i_list;*old_i;) { struct exp_i *tmp; if (((*old_i)->direct == EXP_DIRECT) || (!streq((*old_i)->variable,exp_i->variable))) { old_i = &(*old_i)->next; continue; } ecases_remove_by_expi(interp,ecmd,*old_i); /* unlink from middle of list */ tmp = *old_i; *old_i = tmp->next; tmp->next = 0; exp_free_i(interp,tmp,exp_indirect_update2); } /* if new one has ecases, update it */ if (exp_i->ecount) { /* Note: The exp_indirect_ functions are Tcl_VarTraceProc's, and * are used as such in other places of Expect. We cannot use a * Tcl_Obj* as return value :( */ char *msg = exp_indirect_update1(interp,ecmd,exp_i); if (msg) { /* unusual way of handling error return */ /* because of Tcl's variable tracing */ Tcl_SetResult (interp, msg, TCL_VOLATILE); result = TCL_ERROR; goto indirect_update_abort; } } } /* empty i_lists have to be removed from global eg.i_list */ /* before returning, even if during error */ indirect_update_abort: /* * New exp_i's that have 0 ecases indicate fd/vars to be deleted. * Now that the deletions have been done, discard the new exp_i's. */ for (exp_i=eg.i_list;exp_i;) { struct exp_i *next = exp_i->next; if (exp_i->ecount == 0) { exp_i_remove(interp,&eg.i_list,exp_i); } exp_i = next; } if (result == TCL_ERROR) goto cleanup; /* * arm all new bg direct fds */ if (ecmd->cmdtype == EXP_CMD_BG) { for (exp_i=eg.i_list;exp_i;exp_i=exp_i->next) { if (exp_i->direct == EXP_DIRECT) { state_list_arm(interp,exp_i->state_list); } } } /* * now that old ecases are gone, add new ecases and exp_i's (both * direct and indirect). */ /* append ecases */ count = ecmd->ecd.count + eg.ecd.count; if (eg.ecd.count) { int start_index; /* where to add new ecases in old list */ if (ecmd->ecd.count) { /* append to end */ ecmd->ecd.cases = (struct ecase **)ckrealloc((char *)ecmd->ecd.cases, count * sizeof(struct ecase *)); start_index = ecmd->ecd.count; } else { /* append to beginning */ ecmd->ecd.cases = (struct ecase **)ckalloc(eg.ecd.count * sizeof(struct ecase *)); start_index = 0; } memcpy(&ecmd->ecd.cases[start_index],eg.ecd.cases, eg.ecd.count*sizeof(struct ecase *)); ecmd->ecd.count = count; } /* append exp_i's */ for (eip = &ecmd->i_list;*eip;eip = &(*eip)->next) { /* empty loop to get to end of list */ } /* *exp_i now points to end of list */ *eip = eg.i_list; /* connect new list to end of current list */ cleanup: if (result == TCL_ERROR) { /* in event of error, free any unreferenced ecases */ /* but first, split up i_list so that exp_i's aren't */ /* freed twice */ for (exp_i=eg.i_list;exp_i;) { struct exp_i *next = exp_i->next; exp_i->next = 0; exp_i = next; } free_ecases(interp,&eg,1); } else { if (eg.ecd.cases) ckfree((char *)eg.ecd.cases); } if (ecmd->cmdtype == EXP_CMD_BG) { exp_background_channelhandlers_run_all(); } if (new_cmd) { Tcl_DecrRefCount (new_cmd); } return(result); } /* adjusts file according to user's size request */ void expAdjust(ExpState *esPtr) { int new_msize, excess; Tcl_UniChar *string; /* * Resize buffer to user's request * 3 + 1. * * x3: in case the match straddles two bufferfuls, and to allow * reading a bufferful even when we reach near fullness of two. * (At shuffle time this means we look for 2/3 full buffer and * drop a 1/3, i.e. half of that). * * NOTE: The unmodified expect got the same effect by comparing * apples and oranges in shuffle mgmt, i.e bytes vs. chars, * and automatically extending the buffer (Tcl_Obj string) * to hold that much. * * +1: for trailing null. */ new_msize = esPtr->umsize * 3 + 1; if (new_msize != esPtr->input.max) { if (esPtr->input.use > new_msize) { /* * too much data, forget about data at beginning of buffer */ string = esPtr->input.buffer; excess = esPtr->input.use - new_msize; /* #chars */ memcpy (string, string + excess, new_msize * sizeof (Tcl_UniChar)); esPtr->input.use = new_msize; } else { /* * too little data - length < new_mbytes * Make larger if the max is also too small. */ if (esPtr->input.max < new_msize) { esPtr->input.buffer = (Tcl_UniChar*) \ Tcl_Realloc ((char*)esPtr->input.buffer, new_msize * sizeof (Tcl_UniChar)); } } esPtr->key = expect_key++; esPtr->input.max = new_msize; } } #if OBSOLETE /* Strip parity */ static void expParityStrip( Tcl_Obj *obj, int offsetBytes) { char *p, ch; int changed = FALSE; for (p = Tcl_GetString(obj) + offsetBytes;*p;p++) { ch = *p & 0x7f; if (ch != *p) changed = TRUE; else *p &= 0x7f; } if (changed) { /* invalidate the unicode rep */ if (obj->typePtr->freeIntRepProc) { obj->typePtr->freeIntRepProc(obj); } } } /* This function is only used when debugging. It checks when a string's internal UTF is sane and whether an offset into the string appears to be at a UTF boundary. */ static void expValid( Tcl_Obj *obj, int offset) { char *s, *end; int len; s = Tcl_GetStringFromObj(obj,&len); if (offset > len) { printf("offset (%d) > length (%d)\n",offset,len); fflush(stdout); abort(); } /* first test for null terminator */ end = s + len; if (*end != '\0') { printf("obj lacks null terminator\n"); fflush(stdout); abort(); } /* check for valid UTF sequence */ while (*s) { Tcl_UniChar uc; s += TclUtfToUniChar(s,&uc); if (s > end) { printf("UTF out of sync with terminator\n"); fflush(stdout); abort(); } } s += offset; while (*s) { Tcl_UniChar uc; s += TclUtfToUniChar(s,&uc); if (s > end) { printf("UTF from offset out of sync with terminator\n"); fflush(stdout); abort(); } } } #endif /*OBSOLETE*/ /* Strip nulls from object, beginning at offset */ static int expNullStrip( ExpUniBuf* buf, int offsetChars) { Tcl_UniChar *src, *src2, *dest, *end; int newsize; /* size of obj after all nulls removed */ src2 = src = dest = buf->buffer + offsetChars; end = buf->buffer + buf->use; while (src < end) { if (*src) { *dest = *src; dest ++; } src ++; } newsize = offsetChars + (dest - src2); buf->use = newsize; return newsize; } /* returns # of bytes read or (non-positive) error of form EXP_XXX */ /* returns 0 for end of file */ /* If timeout is non-zero, set an alarm before doing the read, else assume */ /* the read will complete immediately. */ /*ARGSUSED*/ static int expIRead( /* INTL */ Tcl_Interp *interp, ExpState *esPtr, int timeout, int save_flags) { int cc = EXP_TIMEOUT; int size; /* We drop one third when are at least 2/3 full */ /* condition is (size >= max*2/3) <=> (size*3 >= max*2) */ if (expSizeGet(esPtr)*3 >= esPtr->input.max*2) exp_buffer_shuffle(interp,esPtr,save_flags,EXPECT_OUT,"expect"); size = expSizeGet(esPtr); #ifdef SIMPLE_EVENT restart: alarm_fired = FALSE; if (timeout > -1) { signal(SIGALRM,sigalarm_handler); alarm((timeout > 0)?timeout:1); } #endif cc = Tcl_ReadChars(esPtr->channel, esPtr->input.newchars, esPtr->input.max - esPtr->input.use, 0 /* no append */); i_read_errno = errno; if (cc > 0) { memcpy (esPtr->input.buffer + esPtr->input.use, Tcl_GetUnicodeFromObj (esPtr->input.newchars, NULL), cc * sizeof (Tcl_UniChar)); esPtr->input.use += cc; } #ifdef SIMPLE_EVENT alarm(0); if (cc == -1) { /* check if alarm went off */ if (i_read_errno == EINTR) { if (alarm_fired) { return EXP_TIMEOUT; } else { if (Tcl_AsyncReady()) { int rc = Tcl_AsyncInvoke(interp,TCL_OK); if (rc != TCL_OK) return(exp_tcl2_returnvalue(rc)); } goto restart; } } } #endif return cc; } /* * expRead() does the logical equivalent of a read() for the expect command. * This includes figuring out which descriptor should be read from. * * The result of the read() is left in a spawn_id's buffer rather than * explicitly passing it back. Note that if someone else has modified a buffer * either before or while this expect is running (i.e., if we or some event has * called Tcl_Eval which did another expect/interact), expRead will also call * this a successful read (for the purposes if needing to pattern match against * it). */ /* if it returns a negative number, it corresponds to a EXP_XXX result */ /* if it returns a non-negative number, it means there is data */ /* (0 means nothing new was actually read, but it should be looked at again) */ int expRead( Tcl_Interp *interp, ExpState *(esPtrs[]), /* If 0, then esPtrOut already known and set */ int esPtrsMax, /* number of esPtrs */ ExpState **esPtrOut, /* Out variable to leave new ExpState. */ int timeout, int key) { ExpState *esPtr; int size; int cc; int write_count; int tcl_set_flags; /* if we have to discard chars, this tells */ /* whether to show user locally or globally */ if (esPtrs == 0) { /* we already know the ExpState, just find out what happened */ cc = exp_get_next_event_info(interp,*esPtrOut); tcl_set_flags = TCL_GLOBAL_ONLY; } else { cc = exp_get_next_event(interp,esPtrs,esPtrsMax,esPtrOut,timeout,key); tcl_set_flags = 0; } esPtr = *esPtrOut; if (cc == EXP_DATA_NEW) { /* try to read it */ cc = expIRead(interp,esPtr,timeout,tcl_set_flags); if (cc == 0 && Tcl_Eof(esPtr->channel)) { cc = EXP_EOF; } } else if (cc == EXP_DATA_OLD) { cc = 0; } else if (cc == EXP_RECONFIGURE) { return EXP_RECONFIGURE; } if (cc == EXP_ABEOF) { /* abnormal EOF */ /* On many systems, ptys produce EIO upon EOF - sigh */ if (i_read_errno == EIO) { /* Sun, Cray, BSD, and others */ cc = EXP_EOF; } else if (i_read_errno == EINVAL) { /* Solaris 2.4 occasionally returns this */ cc = EXP_EOF; } else { if (i_read_errno == EBADF) { exp_error(interp,"bad spawn_id (process died earlier?)"); } else { exp_error(interp,"i_read(spawn_id fd=%d): %s",esPtr->fdin, Tcl_PosixError(interp)); if (esPtr->close_on_eof) { exp_close(interp,esPtr); } } return(EXP_TCLERROR); /* was goto error; */ } } /* EOF, TIMEOUT, and ERROR return here */ /* In such cases, there is no need to update screen since, if there */ /* was prior data read, it would have been sent to the screen when */ /* it was read. */ if (cc < 0) return (cc); /* * update display */ size = expSizeGet(esPtr); if (size) write_count = size - esPtr->printed; else write_count = 0; if (write_count) { /* * Show chars to user if they've requested it, UNLESS they're seeing it * already because they're typing it and tty driver is echoing it. * Also send to Diag and Log if appropriate. */ expLogInteractionU(esPtr,esPtr->input.buffer + esPtr->printed, write_count); /* * strip nulls from input, since there is no way for Tcl to deal with * such strings. Doing it here lets them be sent to the screen, just * in case they are involved in formatting operations */ if (esPtr->rm_nulls) size = expNullStrip(&esPtr->input,esPtr->printed); esPtr->printed = size; /* count'm even if not logging */ } return(cc); } /* when buffer fills, copy second half over first and */ /* continue, so we can do matches over multiple buffers */ void exp_buffer_shuffle( /* INTL */ Tcl_Interp *interp, ExpState *esPtr, int save_flags, char *array_name, char *caller_name) { Tcl_UniChar *str; Tcl_UniChar *p; int numchars, newlen, skiplen; Tcl_UniChar lostChar; /* * allow user to see data we are discarding */ expDiagLog("%s: set %s(spawn_id) \"%s\"\r\n", caller_name,array_name,esPtr->name); Tcl_SetVar2(interp,array_name,"spawn_id",esPtr->name,save_flags); /* * The internal storage buffer object should only be referred * to by the channel that uses it. We always copy the contents * out of the object before passing the data to anyone outside * of these routines. This ensures that the object always has * a refcount of 1 so we can safely modify the contents in place. */ str = esPtr->input.buffer; numchars = esPtr->input.use; /* We discard 1/3 of the data in the buffer. */ skiplen = numchars/3; p = str + skiplen; /* * before doing move, show user data we are discarding */ lostChar = *p; /* Temporarily stick null in middle of string to terminate */ *p = 0; expDiagLog("%s: set %s(buffer) \"",caller_name,array_name); expDiagLogU(expPrintifyUni(str,numchars)); expDiagLogU("\"\r\n"); Tcl_SetVar2Ex(interp,array_name,"buffer", Tcl_NewUnicodeObj (str, skiplen), save_flags); /* * Restore damage done fir display above. */ *p = lostChar; /* * move the higher 2/3 of the string down over the lower 2/3. * This destroys the 1st 1/3. */ newlen = numchars - skiplen; memmove(str, p, newlen * sizeof(Tcl_UniChar)); esPtr->input.use = newlen; esPtr->printed -= skiplen; if (esPtr->printed < 0) esPtr->printed = 0; } /* map EXP_ style return value to TCL_ style return value */ /* not defined to work on TCL_OK */ int exp_tcl2_returnvalue(int x) { switch (x) { case TCL_ERROR: return EXP_TCLERROR; case TCL_RETURN: return EXP_TCLRET; case TCL_BREAK: return EXP_TCLBRK; case TCL_CONTINUE: return EXP_TCLCNT; case EXP_CONTINUE: return EXP_TCLCNTEXP; case EXP_CONTINUE_TIMER: return EXP_TCLCNTTIMER; case EXP_TCL_RETURN: return EXP_TCLRETTCL; } /* Must not reach this location. Can happen only if x is an * illegal value. Added return to suppress compiler warning. */ return -1000; } /* map from EXP_ style return value to TCL_ style return values */ int exp_2tcl_returnvalue(int x) { switch (x) { case EXP_TCLERROR: return TCL_ERROR; case EXP_TCLRET: return TCL_RETURN; case EXP_TCLBRK: return TCL_BREAK; case EXP_TCLCNT: return TCL_CONTINUE; case EXP_TCLCNTEXP: return EXP_CONTINUE; case EXP_TCLCNTTIMER: return EXP_CONTINUE_TIMER; case EXP_TCLRETTCL: return EXP_TCL_RETURN; } /* Must not reach this location. Can happen only if x is an * illegal value. Added return to suppress compiler warning. */ return -1000; } /* variables predefined by expect are retrieved using this routine which looks in the global space if they are not in the local space. This allows the user to localize them if desired, and also to avoid having to put "global" in procedure definitions. */ char * exp_get_var( Tcl_Interp *interp, char *var) { char *val; if (NULL != (val = Tcl_GetVar(interp,var,0 /* local */))) return(val); return(Tcl_GetVar(interp,var,TCL_GLOBAL_ONLY)); } static int get_timeout(Tcl_Interp *interp) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); CONST char *t; if (NULL != (t = exp_get_var(interp,EXPECT_TIMEOUT))) { tsdPtr->timeout = atoi(t); } return(tsdPtr->timeout); } /* make a copy of a linked list (1st arg) and attach to end of another (2nd arg) */ static int update_expect_states( struct exp_i *i_list, struct exp_state_list **i_union) { struct exp_i *p; /* for each i_list in an expect statement ... */ for (p=i_list;p;p=p->next) { struct exp_state_list *slPtr; /* for each esPtr in the i_list */ for (slPtr=p->state_list;slPtr;slPtr=slPtr->next) { struct exp_state_list *tmpslPtr; struct exp_state_list *u; if (expStateAnyIs(slPtr->esPtr)) continue; /* check this one against all so far */ for (u = *i_union;u;u=u->next) { if (slPtr->esPtr == u->esPtr) goto found; } /* if not found, link in as head of list */ tmpslPtr = exp_new_state(slPtr->esPtr); tmpslPtr->next = *i_union; *i_union = tmpslPtr; found:; } } return TCL_OK; } char * exp_cmdtype_printable(int cmdtype) { switch (cmdtype) { case EXP_CMD_FG: return("expect"); case EXP_CMD_BG: return("expect_background"); case EXP_CMD_BEFORE: return("expect_before"); case EXP_CMD_AFTER: return("expect_after"); } /*#ifdef LINT*/ return("unknown expect command"); /*#endif*/ } /* exp_indirect_update2 is called back via Tcl's trace handler whenever */ /* an indirect spawn id list is changed */ /*ARGSUSED*/ static char * exp_indirect_update2( ClientData clientData, Tcl_Interp *interp, /* Interpreter containing variable. */ char *name1, /* Name of variable. */ char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { char *msg; struct exp_i *exp_i = (struct exp_i *)clientData; exp_configure_count++; msg = exp_indirect_update1(interp,&exp_cmds[exp_i->cmdtype],exp_i); exp_background_channelhandlers_run_all(); return msg; } static char * exp_indirect_update1( Tcl_Interp *interp, struct exp_cmd_descriptor *ecmd, struct exp_i *exp_i) { struct exp_state_list *slPtr; /* temp for interating over state_list */ /* * disarm any ExpState's that lose all their active spawn ids */ if (ecmd->cmdtype == EXP_CMD_BG) { /* clean up each spawn id used by this exp_i */ for (slPtr=exp_i->state_list;slPtr;slPtr=slPtr->next) { ExpState *esPtr = slPtr->esPtr; if (expStateAnyIs(esPtr)) continue; /* silently skip closed or preposterous fds */ /* since we're just disabling them anyway */ /* preposterous fds will have been reported */ /* by code in next section already */ if (!expStateCheck(interp,slPtr->esPtr,1,0,"")) continue; /* check before decrementing, ecount may not be */ /* positive if update is called before ecount is */ /* properly synchronized */ if (esPtr->bg_ecount > 0) { esPtr->bg_ecount--; } if (esPtr->bg_ecount == 0) { exp_disarm_background_channelhandler(esPtr); esPtr->bg_interp = 0; } } } /* * reread indirect variable */ exp_i_update(interp,exp_i); /* * check validity of all fd's in variable */ for (slPtr=exp_i->state_list;slPtr;slPtr=slPtr->next) { /* validate all input descriptors */ if (expStateAnyIs(slPtr->esPtr)) continue; if (!expStateCheck(interp,slPtr->esPtr,1,1, exp_cmdtype_printable(ecmd->cmdtype))) { /* Note: Cannot construct a Tcl_Obj* here, the function is a * Tcl_VarTraceProc and the API wants a char*. * * DANGER: The buffer may overflow if either the existing result, * the variable name, or both become to large. */ static char msg[200]; sprintf(msg,"%s from indirect variable (%s)", Tcl_GetStringResult (interp),exp_i->variable); return msg; } } /* for each spawn id in list, arm if necessary */ if (ecmd->cmdtype == EXP_CMD_BG) { state_list_arm(interp,exp_i->state_list); } return (char *)0; } int expMatchProcess( Tcl_Interp *interp, struct eval_out *eo, /* final case of interest */ int cc, /* EOF, TIMEOUT, etc... */ int bg, /* 1 if called from background handler, */ /* else 0 */ char *detail) { ExpState *esPtr = 0; Tcl_Obj *body = 0; Tcl_UniChar *buffer; struct ecase *e = 0; /* points to current ecase */ int match = -1; /* characters matched */ /* uprooted by a NULL */ int result = TCL_OK; #define out(indexName, value) \ expDiagLog("%s: set %s(%s) \"",detail,EXPECT_OUT,indexName); \ expDiagLogU(expPrintify(value)); \ expDiagLogU("\"\r\n"); \ Tcl_SetVar2(interp, EXPECT_OUT,indexName,value,(bg ? TCL_GLOBAL_ONLY : 0)); /* The numchars argument allows us to avoid sticking a \0 into the buffer */ #define outuni(indexName, value,numchars) \ expDiagLog("%s: set %s(%s) \"",detail,EXPECT_OUT,indexName); \ expDiagLogU(expPrintifyUni(value,numchars)); \ expDiagLogU("\"\r\n"); \ Tcl_SetVar2Ex(interp, EXPECT_OUT,indexName,Tcl_NewUnicodeObj(value,numchars),(bg ? TCL_GLOBAL_ONLY : 0)); if (eo->e) { e = eo->e; body = e->body; if (cc != EXP_TIMEOUT) { esPtr = eo->esPtr; match = eo->matchlen; buffer = eo->matchbuf; } } else if (cc == EXP_EOF) { /* read an eof but no user-supplied case */ esPtr = eo->esPtr; match = eo->matchlen; buffer = eo->matchbuf; } if (match >= 0) { char name[20], value[20]; int i; if (e && e->use == PAT_RE) { Tcl_RegExp re; int flags; Tcl_RegExpInfo info; Tcl_Obj *buf; /* No gate keeper required here, we know that the RE * matches, we just do it again to get all the captured * pieces */ if (e->Case == CASE_NORM) { flags = TCL_REG_ADVANCED; } else { flags = TCL_REG_ADVANCED | TCL_REG_NOCASE; } re = Tcl_GetRegExpFromObj(interp, e->pat, flags); Tcl_RegExpGetInfo(re, &info); buf = Tcl_NewUnicodeObj (buffer,esPtr->input.use); for (i=0;i<=info.nsubs;i++) { int start, end; Tcl_Obj *val; start = info.matches[i].start; end = info.matches[i].end-1; if (start == -1) continue; if (e->indices) { /* start index */ sprintf(name,"%d,start",i); sprintf(value,"%d",start); out(name,value); /* end index */ sprintf(name,"%d,end",i); sprintf(value,"%d",end); out(name,value); } /* string itself */ sprintf(name,"%d,string",i); val = Tcl_GetRange(buf, start, end); expDiagLog("%s: set %s(%s) \"",detail,EXPECT_OUT,name); expDiagLogU(expPrintifyObj(val)); expDiagLogU("\"\r\n"); Tcl_SetVar2Ex(interp,EXPECT_OUT,name,val,(bg ? TCL_GLOBAL_ONLY : 0)); } Tcl_DecrRefCount (buf); } else if (e && (e->use == PAT_GLOB || e->use == PAT_EXACT)) { Tcl_UniChar *str; if (e->indices) { /* start index */ sprintf(value,"%d",e->simple_start); out("0,start",value); /* end index */ sprintf(value,"%d",e->simple_start + match - 1); out("0,end",value); } /* string itself */ str = esPtr->input.buffer + e->simple_start; outuni("0,string",str,match); /* redefine length of string that */ /* matched for later extraction */ match += e->simple_start; } else if (e && e->use == PAT_NULL && e->indices) { /* start index */ sprintf(value,"%d",match-1); out("0,start",value); /* end index */ sprintf(value,"%d",match-1); out("0,end",value); } else if (e && e->use == PAT_FULLBUFFER) { expDiagLogU("expect_background: full buffer\r\n"); } } /* this is broken out of (match > 0) (above) since it can be */ /* that an EOF occurred with match == 0 */ if (eo->esPtr) { Tcl_UniChar *str; int numchars; out("spawn_id",esPtr->name); str = esPtr->input.buffer; numchars = esPtr->input.use; /* Save buf[0..match] */ outuni("buffer",str,match); /* "!e" means no case matched - transfer by default */ if (!e || e->transfer) { int remainder = numchars-match; /* delete matched chars from input buffer */ esPtr->printed -= match; if (numchars != 0) { memmove(str,str+match,remainder*sizeof(Tcl_UniChar)); } esPtr->input.use = remainder; } if (cc == EXP_EOF) { /* exp_close() deletes all background bodies */ /* so save eof body temporarily */ if (body) { Tcl_IncrRefCount(body); } if (esPtr->close_on_eof) { exp_close(interp,esPtr); } } } if (body) { if (!bg) { result = Tcl_EvalObjEx(interp,body,0); } else { result = Tcl_EvalObjEx(interp,body,TCL_EVAL_GLOBAL); if (result != TCL_OK) Tcl_BackgroundError(interp); } if (cc == EXP_EOF) { Tcl_DecrRefCount(body); } } return result; } /* this function is called from the background when input arrives */ /*ARGSUSED*/ void exp_background_channelhandler( /* INTL */ ClientData clientData, int mask) { char backup[EXP_CHANNELNAMELEN+1]; /* backup copy of esPtr channel name! */ ExpState *esPtr; Tcl_Interp *interp; int cc; /* number of bytes returned in a single read */ /* or negative EXP_whatever */ struct eval_out eo; /* final case of interest */ ExpState *last_esPtr; /* for differentiating when multiple esPtrs */ /* to print out better debugging messages */ int last_case; /* as above but for case */ /* restore our environment */ esPtr = (ExpState *)clientData; /* backup just in case someone zaps esPtr in the middle of our work! */ strcpy(backup,esPtr->name); interp = esPtr->bg_interp; /* temporarily prevent this handler from being invoked again */ exp_block_background_channelhandler(esPtr); /* * if mask == 0, then we've been called because the patterns changed not * because the waiting data has changed, so don't actually do any I/O */ if (mask == 0) { cc = 0; } else { esPtr->notifiedMask = mask; esPtr->notified = FALSE; cc = expRead(interp,(ExpState **)0,0,&esPtr,EXP_TIME_INFINITY,0); } do_more_data: eo.e = 0; /* no final case yet */ eo.esPtr = 0; /* no final file selected yet */ eo.matchlen = 0; /* nothing matched yet */ /* force redisplay of buffer when debugging */ last_esPtr = 0; if (cc == EXP_EOF) { /* do nothing */ } else if (cc < 0) { /* EXP_TCLERROR or any other weird value*/ goto finish; /* * if we were going to do this right, we should differentiate between * things like HP ioctl-open-traps that fall out here and should * rightfully be ignored and real errors that should be reported. Come * to think of it, the only errors will come from HP ioctl handshake * botches anyway. */ } else { /* normal case, got data */ /* new data if cc > 0, same old data if cc == 0 */ /* below here, cc as general status */ cc = EXP_NOMATCH; } cc = eval_cases(interp,&exp_cmds[EXP_CMD_BEFORE], esPtr,&eo,&last_esPtr,&last_case,cc,&esPtr,1,"_background"); cc = eval_cases(interp,&exp_cmds[EXP_CMD_BG], esPtr,&eo,&last_esPtr,&last_case,cc,&esPtr,1,"_background"); cc = eval_cases(interp,&exp_cmds[EXP_CMD_AFTER], esPtr,&eo,&last_esPtr,&last_case,cc,&esPtr,1,"_background"); if (cc == EXP_TCLERROR) { /* only likely problem here is some internal regexp botch */ Tcl_BackgroundError(interp); goto finish; } /* special eof code that cannot be done in eval_cases */ /* or above, because it would then be executed several times */ if (cc == EXP_EOF) { eo.esPtr = esPtr; eo.matchlen = expSizeGet(eo.esPtr); eo.matchbuf = eo.esPtr->input.buffer; expDiagLogU("expect_background: read eof\r\n"); goto matched; } if (!eo.e) { /* if we get here, there must not have been a match */ goto finish; } matched: expMatchProcess(interp, &eo, cc, 1 /* bg */,"expect_background"); /* * Event handler will not call us back if there is more input * pending but it has already arrived. bg_status will be * "blocked" only if armed. */ /* * Connection could have been closed on us. In this case, * exitWhenBgStatusUnblocked will be 1 and we should disable the channel * handler and release the esPtr. */ /* First check that the esPtr is even still valid! */ /* * It isn't sufficient to just check that 'Tcl_GetChannel' still knows about * backup since it is possible that esPtr was lost in the background AND * another process spawned and reassigned the same name. */ if (!expChannelStillAlive(esPtr, backup)) { expDiagLog("expect channel %s lost in background handler\n",backup); return; } if ((!esPtr->freeWhenBgHandlerUnblocked) && (esPtr->bg_status == blocked)) { if (0 != (cc = expSizeGet(esPtr))) { goto do_more_data; } } finish: exp_unblock_background_channelhandler(esPtr); if (esPtr->freeWhenBgHandlerUnblocked) expStateFree(esPtr); } /*ARGSUSED*/ int Exp_ExpectObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { int cc; /* number of chars returned in a single read */ /* or negative EXP_whatever */ ExpState *esPtr = 0; int i; /* misc temporary */ struct exp_cmd_descriptor eg; struct exp_state_list *state_list; /* list of ExpStates to watch */ struct exp_state_list *slPtr; /* temp for interating over state_list */ ExpState **esPtrs; int mcount; /* number of esPtrs to watch */ struct eval_out eo; /* final case of interest */ int result; /* Tcl result */ time_t start_time_total; /* time at beginning of this procedure */ time_t start_time = 0; /* time when restart label hit */ time_t current_time = 0; /* current time (when we last looked)*/ time_t end_time; /* future time at which to give up */ ExpState *last_esPtr; /* for differentiating when multiple f's */ /* to print out better debugging messages */ int last_case; /* as above but for case */ int first_time = 1; /* if not "restarted" */ int key; /* identify this expect command instance */ int configure_count; /* monitor exp_configure_count */ int timeout; /* seconds */ int remtime; /* remaining time in timeout */ int reset_timer; /* should timer be reset after continue? */ Tcl_Time temp_time; Tcl_Obj* new_cmd = NULL; if ((objc == 2) && exp_one_arg_braced(objv[1])) { /* expect {...} */ new_cmd = exp_eval_with_one_arg(clientData,interp,objv); if (!new_cmd) return TCL_ERROR; } else if ((objc == 3) && streq(Tcl_GetString(objv[1]),"-brace")) { /* expect -brace {...} ... fake command line for reparsing */ Tcl_Obj *new_objv[2]; new_objv[0] = objv[0]; new_objv[1] = objv[2]; new_cmd = exp_eval_with_one_arg(clientData,interp,new_objv); if (!new_cmd) return TCL_ERROR; } if (new_cmd) { /* Replace old arguments with result of the reparse */ Tcl_ListObjGetElements (interp, new_cmd, &objc, (Tcl_Obj***) &objv); } Tcl_GetTime (&temp_time); start_time_total = temp_time.sec; start_time = start_time_total; reset_timer = TRUE; if (&StdinoutPlaceholder == (ExpState *)clientData) { clientData = (ClientData) expStdinoutGet(); } else if (&DevttyPlaceholder == (ExpState *)clientData) { clientData = (ClientData) expDevttyGet(); } /* make arg list for processing cases */ /* do it dynamically, since expect can be called recursively */ exp_cmd_init(&eg,EXP_CMD_FG,EXP_TEMPORARY); state_list = 0; esPtrs = 0; if (TCL_ERROR == parse_expect_args(interp,&eg, (ExpState *)clientData, objc,objv)) { if (new_cmd) { Tcl_DecrRefCount (new_cmd); } return TCL_ERROR; } restart_with_update: /* validate all descriptors and flatten ExpStates into array */ if ((TCL_ERROR == update_expect_states(exp_cmds[EXP_CMD_BEFORE].i_list,&state_list)) || (TCL_ERROR == update_expect_states(exp_cmds[EXP_CMD_AFTER].i_list, &state_list)) || (TCL_ERROR == update_expect_states(eg.i_list,&state_list))) { result = TCL_ERROR; goto cleanup; } /* declare ourselves "in sync" with external view of close/indirect */ configure_count = exp_configure_count; /* count and validate state_list */ mcount = 0; for (slPtr=state_list;slPtr;slPtr=slPtr->next) { mcount++; /* validate all input descriptors */ if (!expStateCheck(interp,slPtr->esPtr,1,1,"expect")) { result = TCL_ERROR; goto cleanup; } } /* make into an array */ esPtrs = (ExpState **)ckalloc(mcount * sizeof(ExpState *)); for (slPtr=state_list,i=0;slPtr;slPtr=slPtr->next,i++) { esPtrs[i] = slPtr->esPtr; } restart: if (first_time) first_time = 0; else { Tcl_GetTime (&temp_time); start_time = temp_time.sec; } if (eg.timeout_specified_by_flag) { timeout = eg.timeout; } else { /* get the latest timeout */ timeout = get_timeout(interp); } key = expect_key++; result = TCL_OK; last_esPtr = 0; /* * end of restart code */ eo.e = 0; /* no final case yet */ eo.esPtr = 0; /* no final ExpState selected yet */ eo.matchlen = 0; /* nothing matched yet */ /* timeout code is a little tricky, be very careful changing it */ if (timeout != EXP_TIME_INFINITY) { /* if exp_continue -continue_timer, do not update end_time */ if (reset_timer) { Tcl_GetTime (&temp_time); current_time = temp_time.sec; end_time = current_time + timeout; } else { reset_timer = TRUE; } } /* remtime and current_time updated at bottom of loop */ remtime = timeout; for (;;) { if ((timeout != EXP_TIME_INFINITY) && (remtime < 0)) { cc = EXP_TIMEOUT; } else { cc = expRead(interp,esPtrs,mcount,&esPtr,remtime,key); } /*SUPPRESS 530*/ if (cc == EXP_EOF) { /* do nothing */ } else if (cc == EXP_TIMEOUT) { expDiagLogU("expect: timed out\r\n"); } else if (cc == EXP_RECONFIGURE) { reset_timer = FALSE; goto restart_with_update; } else if (cc < 0) { /* EXP_TCLERROR or any other weird value*/ goto error; } else { /* new data if cc > 0, same old data if cc == 0 */ /* below here, cc as general status */ cc = EXP_NOMATCH; /* force redisplay of buffer when debugging */ last_esPtr = 0; } cc = eval_cases(interp,&exp_cmds[EXP_CMD_BEFORE], esPtr,&eo,&last_esPtr,&last_case,cc,esPtrs,mcount,""); cc = eval_cases(interp,&eg, esPtr,&eo,&last_esPtr,&last_case,cc,esPtrs,mcount,""); cc = eval_cases(interp,&exp_cmds[EXP_CMD_AFTER], esPtr,&eo,&last_esPtr,&last_case,cc,esPtrs,mcount,""); if (cc == EXP_TCLERROR) goto error; /* special eof code that cannot be done in eval_cases */ /* or above, because it would then be executed several times */ if (cc == EXP_EOF) { eo.esPtr = esPtr; eo.matchlen = expSizeGet(eo.esPtr); eo.matchbuf = eo.esPtr->input.buffer; expDiagLogU("expect: read eof\r\n"); break; } else if (cc == EXP_TIMEOUT) break; /* break if timeout or eof and failed to find a case for it */ if (eo.e) break; /* no match was made with current data, force a read */ esPtr->force_read = TRUE; if (timeout != EXP_TIME_INFINITY) { Tcl_GetTime (&temp_time); current_time = temp_time.sec; remtime = end_time - current_time; } } goto done; error: result = exp_2tcl_returnvalue(cc); done: if (result != TCL_ERROR) { result = expMatchProcess(interp, &eo, cc, 0 /* not bg */,"expect"); } cleanup: if (result == EXP_CONTINUE_TIMER) { reset_timer = FALSE; result = EXP_CONTINUE; } if ((result == EXP_CONTINUE) && (configure_count == exp_configure_count)) { expDiagLogU("expect: continuing expect\r\n"); goto restart; } if (state_list) { exp_free_state(state_list); state_list = 0; } if (esPtrs) { ckfree((char *)esPtrs); esPtrs = 0; } if (result == EXP_CONTINUE) { expDiagLogU("expect: continuing expect after update\r\n"); goto restart_with_update; } free_ecases(interp,&eg,0); /* requires i_lists to be avail */ exp_free_i(interp,eg.i_list,exp_indirect_update2); if (new_cmd) { Tcl_DecrRefCount (new_cmd); } return(result); } /*ARGSUSED*/ static int Exp_TimestampObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { char *format = 0; time_t seconds = -1; int gmt = FALSE; /* local time by default */ struct tm *tm; Tcl_DString dstring; int i; static char* options[] = { "-format", "-gmt", "-seconds", NULL }; enum options { TS_FORMAT, TS_GMT, TS_SECONDS }; for (i=1; i= objc) goto usage_error; format = Tcl_GetString (objv[i]); break; case TS_GMT: gmt = TRUE; break; case TS_SECONDS: { int sec; i++; if (i >= objc) goto usage_error; if (TCL_OK != Tcl_GetIntFromObj (interp, objv[i], &sec)) { goto usage_error; } seconds = sec; } break; } } if (i < objc) goto usage_error; if (seconds == -1) { time(&seconds); } if (format) { if (gmt) { tm = gmtime(&seconds); } else { tm = localtime(&seconds); } Tcl_DStringInit(&dstring); exp_strftime(format,tm,&dstring); Tcl_DStringResult(interp,&dstring); } else { Tcl_SetObjResult (interp, Tcl_NewIntObj (seconds)); } return TCL_OK; usage_error: exp_error(interp,"args: [-seconds #] [-format format] [-gmt]"); return TCL_ERROR; } /* Helper function hnadling the common processing of -d and -i options of * various commands. */ static int process_di _ANSI_ARGS_ ((Tcl_Interp* interp, int objc, Tcl_Obj *CONST objv[], /* Argument objects. */ int* at, int* Default, ExpState **esOut, CONST char* cmd)); static int process_di ( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], /* Argument objects. */ int* at, int* Default, ExpState **esOut, CONST char* cmd) { static char* options[] = { "-d", "-i", NULL }; enum options { DI_DEFAULT, DI_ID }; int def = FALSE; char* chan = NULL; int i; ExpState *esPtr; for (i=1; i= objc) { exp_error(interp,"-i needs argument"); return(TCL_ERROR); } chan = Tcl_GetString (objv[i]); break; } } if (def && chan) { exp_error(interp,"cannot do -d and -i at the same time"); return(TCL_ERROR); } /* Not all arguments processed, more than two remaining, only at most one * remaining is expected/allowed. */ if (i < (objc-1)) { exp_error(interp,"too many arguments"); return(TCL_OK); } if (!def) { if (!chan) { esPtr = expStateCurrent(interp,0,0,0); } else { esPtr = expStateFromChannelName(interp,chan,0,0,0,(char*)cmd); } if (!esPtr) return(TCL_ERROR); } *at = i; *Default = def; *esOut = esPtr; return TCL_OK; } /*ARGSUSED*/ int Exp_MatchMaxObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { int size = -1; ExpState *esPtr = 0; int Default = FALSE; int i; if (TCL_OK != process_di (interp, objc, objv, &i, &Default, &esPtr, "match_max")) return TCL_ERROR; /* No size argument */ if (i == objc) { if (Default) { size = exp_default_match_max; } else { size = esPtr->umsize; } Tcl_SetObjResult (interp, Tcl_NewIntObj (size)); return(TCL_OK); } /* * All that's left is to set the size */ if (TCL_OK != Tcl_GetIntFromObj (interp, objv[i], &size)) { return TCL_ERROR; } if (size <= 0) { exp_error(interp,"must be positive"); return(TCL_ERROR); } if (Default) exp_default_match_max = size; else esPtr->umsize = size; return(TCL_OK); } /*ARGSUSED*/ int Exp_RemoveNullsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { int value = -1; ExpState *esPtr = 0; int Default = FALSE; int i; if (TCL_OK != process_di (interp, objc, objv, &i, &Default, &esPtr, "remove_nulls")) return TCL_ERROR; /* No flag argument */ if (i == objc) { if (Default) { value = exp_default_rm_nulls; } else { value = esPtr->rm_nulls; } Tcl_SetObjResult (interp, Tcl_NewIntObj (value)); return(TCL_OK); } /* all that's left is to set the value */ if (TCL_OK != Tcl_GetBooleanFromObj (interp, objv[i], &value)) { return TCL_ERROR; } if ((value != 0) && (value != 1)) { exp_error(interp,"must be 0 or 1"); return(TCL_ERROR); } if (Default) exp_default_rm_nulls = value; else esPtr->rm_nulls = value; return(TCL_OK); } /*ARGSUSED*/ int Exp_ParityObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { int parity; ExpState *esPtr = 0; int Default = FALSE; int i; if (TCL_OK != process_di (interp, objc, objv, &i, &Default, &esPtr, "parity")) return TCL_ERROR; /* No parity argument */ if (i == objc) { if (Default) { parity = exp_default_parity; } else { parity = esPtr->parity; } Tcl_SetObjResult (interp, Tcl_NewIntObj (parity)); return(TCL_OK); } /* all that's left is to set the parity */ if (TCL_OK != Tcl_GetIntFromObj (interp, objv[i], &parity)) { return TCL_ERROR; } if (Default) exp_default_parity = parity; else esPtr->parity = parity; return(TCL_OK); } /*ARGSUSED*/ int Exp_CloseOnEofObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { int close_on_eof; ExpState *esPtr = 0; int Default = FALSE; int i; if (TCL_OK != process_di (interp, objc, objv, &i, &Default, &esPtr, "close_on_eof")) return TCL_ERROR; /* No flag argument */ if (i == objc) { if (Default) { close_on_eof = exp_default_close_on_eof; } else { close_on_eof = esPtr->close_on_eof; } Tcl_SetObjResult (interp, Tcl_NewIntObj (close_on_eof)); return(TCL_OK); } /* all that's left is to set the close_on_eof */ if (TCL_OK != Tcl_GetIntFromObj (interp, objv[i], &close_on_eof)) { return TCL_ERROR; } if (Default) exp_default_close_on_eof = close_on_eof; else esPtr->close_on_eof = close_on_eof; return(TCL_OK); } #if DEBUG_PERM_ECASES /* This big chunk of code is just for debugging the permanent */ /* expect cases */ void exp_fd_print(struct exp_state_list *slPtr) { if (!slPtr) return; printf("%d ",slPtr->esPtr); exp_fd_print(slPtr->next); } void exp_i_print(struct exp_i *exp_i) { if (!exp_i) return; printf("exp_i %x",exp_i); printf((exp_i->direct == EXP_DIRECT)?" direct":" indirect"); printf((exp_i->duration == EXP_PERMANENT)?" perm":" tmp"); printf(" ecount = %d\n",exp_i->ecount); printf("variable %s, value %s\n", ((exp_i->variable)?exp_i->variable:"--"), ((exp_i->value)?exp_i->value:"--")); printf("ExpStates: "); exp_fd_print(exp_i->state_list); printf("\n"); exp_i_print(exp_i->next); } void exp_ecase_print(struct ecase *ecase) { printf("pat <%s>\n",ecase->pat); printf("exp_i = %x\n",ecase->i_list); } void exp_ecases_print(struct exp_cases_descriptor *ecd) { int i; printf("%d cases\n",ecd->count); for (i=0;icount;i++) exp_ecase_print(ecd->cases[i]); } void exp_cmd_print(struct exp_cmd_descriptor *ecmd) { printf("expect cmd type: %17s",exp_cmdtype_printable(ecmd->cmdtype)); printf((ecmd->duration==EXP_PERMANENT)?" perm ": "tmp "); /* printdict */ exp_ecases_print(&ecmd->ecd); exp_i_print(ecmd->i_list); } void exp_cmds_print(void) { exp_cmd_print(&exp_cmds[EXP_CMD_BEFORE]); exp_cmd_print(&exp_cmds[EXP_CMD_AFTER]); exp_cmd_print(&exp_cmds[EXP_CMD_BG]); } /*ARGSUSED*/ int cmdX( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) /* Argument objects. */ { exp_cmds_print(); return TCL_OK; } #endif /*DEBUG_PERM_ECASES*/ void expExpectVarsInit(void) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); tsdPtr->timeout = INIT_EXPECT_TIMEOUT; } static struct exp_cmd_data cmd_data[] = { {"expect", Exp_ExpectObjCmd, 0, (ClientData)0, 0}, {"expect_after",Exp_ExpectGlobalObjCmd, 0, (ClientData)&exp_cmds[EXP_CMD_AFTER],0}, {"expect_before",Exp_ExpectGlobalObjCmd,0, (ClientData)&exp_cmds[EXP_CMD_BEFORE],0}, {"expect_user", Exp_ExpectObjCmd, 0, (ClientData)&StdinoutPlaceholder,0}, {"expect_tty", Exp_ExpectObjCmd, 0, (ClientData)&DevttyPlaceholder,0}, {"expect_background",Exp_ExpectGlobalObjCmd,0, (ClientData)&exp_cmds[EXP_CMD_BG],0}, {"match_max", Exp_MatchMaxObjCmd, 0, (ClientData)0, 0}, {"remove_nulls", Exp_RemoveNullsObjCmd, 0, (ClientData)0, 0}, {"parity", Exp_ParityObjCmd, 0, (ClientData)0, 0}, {"close_on_eof", Exp_CloseOnEofObjCmd, 0, (ClientData)0, 0}, {"timestamp", Exp_TimestampObjCmd, 0, (ClientData)0, 0}, {0}}; void exp_init_expect_cmds(Tcl_Interp *interp) { exp_create_commands(interp,cmd_data); Tcl_SetVar(interp,EXPECT_TIMEOUT,INIT_EXPECT_TIMEOUT_LIT,0); exp_cmd_init(&exp_cmds[EXP_CMD_BEFORE],EXP_CMD_BEFORE,EXP_PERMANENT); exp_cmd_init(&exp_cmds[EXP_CMD_AFTER ],EXP_CMD_AFTER, EXP_PERMANENT); exp_cmd_init(&exp_cmds[EXP_CMD_BG ],EXP_CMD_BG, EXP_PERMANENT); exp_cmd_init(&exp_cmds[EXP_CMD_FG ],EXP_CMD_FG, EXP_TEMPORARY); /* preallocate to one element, so future realloc's work */ exp_cmds[EXP_CMD_BEFORE].ecd.cases = 0; exp_cmds[EXP_CMD_AFTER ].ecd.cases = 0; exp_cmds[EXP_CMD_BG ].ecd.cases = 0; pattern_style[PAT_EOF] = "eof"; pattern_style[PAT_TIMEOUT] = "timeout"; pattern_style[PAT_DEFAULT] = "default"; pattern_style[PAT_FULLBUFFER] = "full buffer"; pattern_style[PAT_GLOB] = "glob pattern"; pattern_style[PAT_RE] = "regular expression"; pattern_style[PAT_EXACT] = "exact string"; pattern_style[PAT_NULL] = "null"; #if 0 Tcl_CreateObjCommand(interp,"x",cmdX,(ClientData)0,exp_deleteProc); #endif } void exp_init_sig(void) { #if 0 signal(SIGALRM,sigalarm_handler); signal(SIGINT,sigint_handler); #endif } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ expect5.45.4/exp_chan.c0000664000175000017500000005221713235134350015267 0ustar pysslingpyssling/* * exp_chan.c * * Channel driver for Expect channels. * Based on UNIX File channel from TclUnixChan.c * */ #include #include #include #include #include /* for isspace */ #include /* for time(3) */ #include "expect_cf.h" #ifdef HAVE_SYS_WAIT_H #include #endif #ifdef HAVE_UNISTD_H # include #endif #include #include "tclInt.h" /* Internal definitions for Tcl. */ #include "tcl.h" #include "string.h" #include "exp_rename.h" #include "exp_prog.h" #include "exp_command.h" #include "exp_log.h" #include "tcldbg.h" /* Dbg_StdinMode */ extern int expSetBlockModeProc _ANSI_ARGS_((int fd, int mode)); static int ExpBlockModeProc _ANSI_ARGS_((ClientData instanceData, int mode)); static int ExpCloseProc _ANSI_ARGS_((ClientData instanceData, Tcl_Interp *interp)); static int ExpInputProc _ANSI_ARGS_((ClientData instanceData, char *buf, int toRead, int *errorCode)); static int ExpOutputProc _ANSI_ARGS_(( ClientData instanceData, char *buf, int toWrite, int *errorCode)); static void ExpWatchProc _ANSI_ARGS_((ClientData instanceData, int mask)); static int ExpGetHandleProc _ANSI_ARGS_((ClientData instanceData, int direction, ClientData *handlePtr)); /* * This structure describes the channel type structure for Expect-based IO: */ Tcl_ChannelType expChannelType = { "exp", /* Type name. */ ExpBlockModeProc, /* Set blocking/nonblocking mode.*/ ExpCloseProc, /* Close proc. */ ExpInputProc, /* Input proc. */ ExpOutputProc, /* Output proc. */ NULL, /* Seek proc. */ NULL, /* Set option proc. */ NULL, /* Get option proc. */ ExpWatchProc, /* Initialize notifier. */ ExpGetHandleProc, /* Get OS handles out of channel. */ NULL, /* Close2 proc */ }; typedef struct ThreadSpecificData { /* * List of all exp channels currently open. This is per thread and is * used to match up fd's to channels, which rarely occurs. */ ExpState *firstExpPtr; int channelCount; /* this is process-wide as it is used to give user some hint as to why a spawn has failed by looking at process-wide resource usage */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* *---------------------------------------------------------------------- * * ExpBlockModeProc -- * * Helper procedure to set blocking and nonblocking modes on a * file based channel. Invoked by generic IO level code. * * Results: * 0 if successful, errno when failed. * * Side effects: * Sets the device into blocking or non-blocking mode. * *---------------------------------------------------------------------- */ /* ARGSUSED */ static int ExpBlockModeProc(instanceData, mode) ClientData instanceData; /* Exp state. */ int mode; /* The mode to set. Can be one of * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ { ExpState *esPtr = (ExpState *) instanceData; if (esPtr->fdin == 0) { /* Forward status to debugger. Required for FIONBIO systems, * which are unable to query the fd for its current state. */ Dbg_StdinMode (mode); } /* [Expect SF Bug 1108551] (July 7 2005) * Exclude manipulation of the blocking status for stdin/stderr. * * This is handled by the Tcl core itself and we must absolutely * not pull the rug out from under it. The standard setting to * non-blocking will mess with the core which had them set to * blocking, and makes all its decisions based on that assumption. * Setting to non-blocking can cause hangs and crashes. * * Stdin is ok however, apparently. * (Sep 9 2005) No, it is not. */ if ((esPtr->fdin == 0) || (esPtr->fdin == 1) || (esPtr->fdin == 2)) { return 0; } return expSetBlockModeProc (esPtr->fdin, mode); } int expSetBlockModeProc(fd, mode) int fd; int mode; /* The mode to set. Can be one of * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ { int curStatus; /*printf("ExpBlockModeProc(%d)\n",mode); printf("fdin = %d\n",fd);*/ #ifndef USE_FIONBIO curStatus = fcntl(fd, F_GETFL); /*printf("curStatus = %d\n",curStatus);*/ if (mode == TCL_MODE_BLOCKING) { curStatus &= (~(O_NONBLOCK)); } else { curStatus |= O_NONBLOCK; } /*printf("new curStatus %d\n",curStatus);*/ if (fcntl(fd, F_SETFL, curStatus) < 0) { return errno; } curStatus = fcntl(fd, F_GETFL); #else /* USE_FIONBIO */ if (mode == TCL_MODE_BLOCKING) { curStatus = 0; } else { curStatus = 1; } if (ioctl(fd, (int) FIONBIO, &curStatus) < 0) { return errno; } #endif /* !USE_FIONBIO */ return 0; } /* *---------------------------------------------------------------------- * * ExpInputProc -- * * This procedure is invoked from the generic IO level to read * input from an exp-based channel. * * Results: * The number of bytes read is returned or -1 on error. An output * argument contains a POSIX error code if an error occurs, or zero. * * Side effects: * Reads input from the input device of the channel. * *---------------------------------------------------------------------- */ static int ExpInputProc(instanceData, buf, toRead, errorCodePtr) ClientData instanceData; /* Exp state. */ char *buf; /* Where to store data read. */ int toRead; /* How much space is available * in the buffer? */ int *errorCodePtr; /* Where to store error code. */ { ExpState *esPtr = (ExpState *) instanceData; int bytesRead; /* How many bytes were actually * read from the input device? */ *errorCodePtr = 0; /* * Assume there is always enough input available. This will block * appropriately, and read will unblock as soon as a short read is * possible, if the channel is in blocking mode. If the channel is * nonblocking, the read will never block. */ bytesRead = read(esPtr->fdin, buf, (size_t) toRead); /*printf("ExpInputProc: read(%d,,) = %d\r\n",esPtr->fdin,bytesRead);*/ /* Emulate EOF on tty for tcl */ if ((bytesRead == -1) && (errno == EIO) && isatty(esPtr->fdin)) { bytesRead = 0; } if (bytesRead > -1) { /* strip parity if requested */ if (esPtr->parity == 0) { char *end = buf+bytesRead; for (;buf < end;buf++) { *buf &= 0x7f; } } return bytesRead; } *errorCodePtr = errno; return -1; } /* *---------------------------------------------------------------------- * * ExpOutputProc-- * * This procedure is invoked from the generic IO level to write * output to an exp channel. * * Results: * The number of bytes written is returned or -1 on error. An * output argument contains a POSIX error code if an error occurred, * or zero. * * Side effects: * Writes output on the output device of the channel. * *---------------------------------------------------------------------- */ static int ExpOutputProc(instanceData, buf, toWrite, errorCodePtr) ClientData instanceData; /* Exp state. */ char *buf; /* The data buffer. */ int toWrite; /* How many bytes to write? */ int *errorCodePtr; /* Where to store error code. */ { ExpState *esPtr = (ExpState *) instanceData; int written = 0; *errorCodePtr = 0; if (toWrite < 0) Tcl_Panic("ExpOutputProc: called with negative char count"); if (toWrite ==0) { return 0; } written = write(esPtr->fdout, buf, (size_t) toWrite); if (written == 0) { /* This shouldn't happen but I'm told that it does * nonetheless (at least on SunOS 4.1.3). Since this is * not a documented return value, the most reasonable * thing is to complain here and retry in the hopes that * it is some transient condition. */ sleep(1); expDiagLogU("write() failed to write anything - will sleep(1) and retry...\n"); *errorCodePtr = EAGAIN; return -1; } else if (written < 0) { *errorCodePtr = errno; return -1; } return written; } /* *---------------------------------------------------------------------- * * ExpCloseProc -- * * This procedure is called from the generic IO level to perform * channel-type-specific cleanup when an exp-based channel is closed. * * Results: * 0 if successful, errno if failed. * * Side effects: * Closes the device of the channel. * *---------------------------------------------------------------------- */ /*ARGSUSED*/ static int ExpCloseProc(instanceData, interp) ClientData instanceData; /* Exp state. */ Tcl_Interp *interp; /* For error reporting - unused. */ { ExpState *esPtr = (ExpState *) instanceData; ExpState **nextPtrPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); esPtr->registered = FALSE; #if 0 /* Really should check that we created one first. Since we're sharing fds with Tcl, perhaps a filehandler was created with a plain tcl file - we wouldn't want to delete that. Although if user really close Expect's user_spawn_id, it probably doesn't matter anyway. */ Tcl_DeleteFileHandler(esPtr->fdin); #endif /*0*/ Tcl_Free((char*)esPtr->input.buffer); Tcl_DecrRefCount (esPtr->input.newchars); /* Actually file descriptor should have been closed earlier. */ /* So do nothing here */ /* * Conceivably, the process may not yet have been waited for. If this * becomes a requirement, we'll have to revisit this code. But for now, if * it's just Tcl exiting, the processes will exit on their own soon * anyway. */ for (nextPtrPtr = &(tsdPtr->firstExpPtr); (*nextPtrPtr) != NULL; nextPtrPtr = &((*nextPtrPtr)->nextPtr)) { if ((*nextPtrPtr) == esPtr) { (*nextPtrPtr) = esPtr->nextPtr; break; } } tsdPtr->channelCount--; if (esPtr->bg_status == blocked || esPtr->bg_status == disarm_req_while_blocked) { esPtr->freeWhenBgHandlerUnblocked = 1; /* * If we're in the middle of a bg event handler, then the event * handler will have to take care of freeing esPtr. */ } else { expStateFree(esPtr); } return 0; } /* *---------------------------------------------------------------------- * * ExpWatchProc -- * * Initialize the notifier to watch the fd from this channel. * * Results: * None. * * Side effects: * Sets up the notifier so that a future event on the channel will * be seen by Tcl. * *---------------------------------------------------------------------- */ static void ExpWatchProc(instanceData, mask) ClientData instanceData; /* The exp state. */ int mask; /* Events of interest; an OR-ed * combination of TCL_READABLE, * TCL_WRITABLE and TCL_EXCEPTION. */ { ExpState *esPtr = (ExpState *) instanceData; /* * Make sure we only register for events that are valid on this exp. * Note that we are passing Tcl_NotifyChannel directly to * Tcl_CreateExpHandler with the channel pointer as the client data. */ mask &= esPtr->validMask; if (mask) { /*printf(" CreateFileHandler: %d (mask = %d)\r\n",esPtr->fdin,mask);*/ Tcl_CreateFileHandler(esPtr->fdin, mask, (Tcl_FileProc *) Tcl_NotifyChannel, (ClientData) esPtr->channel); } else { /*printf(" DeleteFileHandler: %d (mask = %d)\r\n",esPtr->fdin,mask);*/ Tcl_DeleteFileHandler(esPtr->fdin); } } /* *---------------------------------------------------------------------- * * ExpGetHandleProc -- * * Called from Tcl_GetChannelHandle to retrieve OS handles from * an exp-based channel. * * Results: * Returns TCL_OK with the fd in handlePtr, or TCL_ERROR if * there is no handle for the specified direction. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int ExpGetHandleProc(instanceData, direction, handlePtr) ClientData instanceData; /* The exp state. */ int direction; /* TCL_READABLE or TCL_WRITABLE */ ClientData *handlePtr; /* Where to store the handle. */ { ExpState *esPtr = (ExpState *) instanceData; if (direction & TCL_WRITABLE) { *handlePtr = (ClientData) esPtr->fdin; } if (direction & TCL_READABLE) { *handlePtr = (ClientData) esPtr->fdin; } else { return TCL_ERROR; } return TCL_OK; } int expChannelCountGet() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); return tsdPtr->channelCount; } int expChannelStillAlive(esBackupPtr, backupName) ExpState *esBackupPtr; char *backupName; { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); ExpState *esPtr; /* * This utility function is called from 'exp_background_channelhandler' * and checks to make sure that backupName can still be found in the * channels linked list at the same address as before. * * If it can't be (or if the memory address has changed) then it * means that it was lost in the background (and possibly another * channel was opened and reassigned the same name). */ for (esPtr = tsdPtr->firstExpPtr; esPtr; esPtr = esPtr->nextPtr) { if (0 == strcmp(esPtr->name, backupName)) return (esPtr == esBackupPtr); } /* not found; must have been lost in the background */ return 0; } #if 0 /* Converted to macros */ int expSizeGet(esPtr) ExpState *esPtr; { return esPtr->input.use; } int expSizeZero(esPtr) ExpState *esPtr; { return (esPtr->input.use == 0); } #endif /* return 0 for success or negative for failure */ int expWriteChars(esPtr,buffer,lenBytes) ExpState *esPtr; char *buffer; int lenBytes; { int rc; retry: rc = Tcl_WriteChars(esPtr->channel,buffer,lenBytes); if ((rc == -1) && (errno == EAGAIN)) goto retry; if (!exp_strict_write) { /* * 5.41 compatbility behaviour. Ignore any and all write errors * the OS may have thrown. */ return 0; } /* just return 0 rather than positive byte counts */ return ((rc > 0) ? 0 : rc); } int expWriteCharsUni(esPtr,buffer,lenChars) ExpState *esPtr; Tcl_UniChar *buffer; int lenChars; { int rc; Tcl_DString ds; Tcl_DStringInit (&ds); Tcl_UniCharToUtfDString (buffer,lenChars,&ds); rc = expWriteChars(esPtr,Tcl_DStringValue (&ds), Tcl_DStringLength (&ds)); Tcl_DStringFree (&ds); return rc; } void expStateFree(esPtr) ExpState *esPtr; { if (esPtr->fdBusy) { close(esPtr->fdin); } esPtr->valid = FALSE; if (!esPtr->keepForever) { ckfree((char *)esPtr); } } /* close all connections * * The kernel would actually do this by default, however Tcl is going to come * along later and try to reap its exec'd processes. If we have inherited any * via spawn -open, Tcl can hang if we don't close the connections first. */ void exp_close_all(interp) Tcl_Interp *interp; { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); ExpState *esPtr; ExpState *esNextPtr; /* Save the nextPtr in a local variable before calling 'exp_close' as 'expStateFree' can be called from it under some circumstances, possibly causing the memory allocator to smash the value in 'esPtr'. - Andreas Kupries */ /* no need to keep things in sync (i.e., tsdPtr, count) since we could only be doing this if we're exiting. Just close everything down. */ for (esPtr = tsdPtr->firstExpPtr;esPtr;esPtr = esNextPtr) { esNextPtr = esPtr->nextPtr; exp_close(interp,esPtr); } } /* wait for any of our own spawned processes we call waitpid rather * than wait to avoid running into someone else's processes. Yes, * according to Ousterhout this is the best way to do it. * returns the ExpState or 0 if nothing to wait on */ ExpState * expWaitOnAny() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); int result; ExpState *esPtr; for (esPtr = tsdPtr->firstExpPtr;esPtr;esPtr = esPtr->nextPtr) { if (esPtr->pid == exp_getpid) continue; /* skip ourself */ if (esPtr->user_waited) continue; /* one wait only! */ if (esPtr->sys_waited) break; restart: result = waitpid(esPtr->pid,&esPtr->wait,WNOHANG); if (result == esPtr->pid) break; if (result == 0) continue; /* busy, try next */ if (result == -1) { if (errno == EINTR) goto restart; else break; } } return esPtr; } ExpState * expWaitOnOne() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); ExpState *esPtr; int pid; /* should really be recoded using the common wait code in command.c */ WAIT_STATUS_TYPE status; pid = wait(&status); for (esPtr = tsdPtr->firstExpPtr;esPtr;esPtr = esPtr->nextPtr) { if (esPtr->pid == pid) { esPtr->sys_waited = TRUE; esPtr->wait = status; return esPtr; } } /* Should not reach this location. If it happens return a value * causing an easy crash */ return NULL; } void exp_background_channelhandlers_run_all() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); ExpState *esPtr; ExpState *esNextPtr; ExpState *esPriorPtr = 0; /* kick off any that already have input waiting */ for (esPtr = tsdPtr->firstExpPtr;esPtr; esPriorPtr = esPtr, esPtr = esPtr->nextPtr) { /* is bg_interp the best way to check if armed? */ if (esPtr->bg_interp && !expSizeZero(esPtr)) { /* * We save the nextPtr in a local variable before calling * 'exp_background_channelhandler' since in some cases * 'expStateFree' could end up getting called before it * returns, leading to a likely segfault on the next * interaction through the for loop. */ esNextPtr = esPtr->nextPtr; exp_background_channelhandler((ClientData)esPtr,0); if (esNextPtr != esPtr->nextPtr) { /* * 'expStateFree' must have been called from * underneath us so we know that esPtr->nextPtr is * invalid. However, it is possible that either the * original nextPtr and/or the priorPtr have been * freed too. If the esPriorPtr->nextPtr is now * esNextPtr it seems safe to proceed. Otherwise we * break and end early for safety. */ if (esPriorPtr && esPriorPtr->nextPtr == esNextPtr) { esPtr = esPriorPtr; } else { break; /* maybe set esPtr = tsdPtr->firstExpPtr again? */ } } } } } ExpState * expCreateChannel(interp,fdin,fdout,pid) Tcl_Interp *interp; int fdin; int fdout; int pid; { ExpState *esPtr; int mask; Tcl_ChannelType *channelTypePtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); channelTypePtr = &expChannelType; esPtr = (ExpState *) ckalloc((unsigned) sizeof(ExpState)); esPtr->nextPtr = tsdPtr->firstExpPtr; tsdPtr->firstExpPtr = esPtr; sprintf(esPtr->name,"exp%d",fdin); /* * For now, stupidly assume this. We we will likely have to revisit this * later to prevent people from doing stupid things. */ mask = TCL_READABLE | TCL_WRITABLE; /* not sure about this - what about adopted channels */ esPtr->validMask = mask | TCL_EXCEPTION; esPtr->fdin = fdin; esPtr->fdout = fdout; /* set close-on-exec for everything but std channels */ /* (system and stty commands need access to std channels) */ if (fdin != 0 && fdin != 2) { expCloseOnExec(fdin); if (fdin != fdout) expCloseOnExec(fdout); } esPtr->fdBusy = FALSE; esPtr->channel = Tcl_CreateChannel(channelTypePtr, esPtr->name, (ClientData) esPtr, mask); Tcl_RegisterChannel(interp,esPtr->channel); esPtr->registered = TRUE; Tcl_SetChannelOption(interp,esPtr->channel,"-buffering","none"); Tcl_SetChannelOption(interp,esPtr->channel,"-blocking","0"); Tcl_SetChannelOption(interp,esPtr->channel,"-translation","lf"); esPtr->pid = pid; esPtr->input.max = 1; esPtr->input.use = 0; esPtr->input.buffer = (Tcl_UniChar*) Tcl_Alloc (sizeof (Tcl_UniChar)); esPtr->input.newchars = Tcl_NewObj(); Tcl_IncrRefCount (esPtr->input.newchars); esPtr->umsize = exp_default_match_max; /* this will reallocate object with an appropriate sized buffer */ expAdjust(esPtr); esPtr->printed = 0; esPtr->echoed = 0; esPtr->rm_nulls = exp_default_rm_nulls; esPtr->parity = exp_default_parity; esPtr->close_on_eof = exp_default_close_on_eof; esPtr->key = expect_key++; esPtr->force_read = FALSE; esPtr->fg_armed = FALSE; esPtr->chan_orig = 0; esPtr->fd_slave = EXP_NOFD; #ifdef HAVE_PTYTRAP esPtr->slave_name = 0; #endif /* HAVE_PTYTRAP */ esPtr->open = TRUE; esPtr->notified = FALSE; esPtr->user_waited = FALSE; esPtr->sys_waited = FALSE; esPtr->bg_interp = 0; esPtr->bg_status = unarmed; esPtr->bg_ecount = 0; esPtr->freeWhenBgHandlerUnblocked = FALSE; esPtr->keepForever = FALSE; esPtr->valid = TRUE; tsdPtr->channelCount++; return esPtr; } void expChannelInit() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); tsdPtr->channelCount = 0; } expect5.45.4/exp_strf.c0000664000175000017500000003411413235134350015330 0ustar pysslingpyssling/* exp_strp.c - functions for exp_timestamp */ /* * strftime.c * * Public-domain implementation of ANSI C library routine. * * It's written in old-style C for maximal portability. * However, since I'm used to prototypes, I've included them too. * * If you want stuff in the System V ascftime routine, add the SYSV_EXT define. * For extensions from SunOS, add SUNOS_EXT. * For stuff needed to implement the P1003.2 date command, add POSIX2_DATE. * For VMS dates, add VMS_EXT. * For complete POSIX semantics, add POSIX_SEMANTICS. * * The code for %c, %x, and %X now follows the 1003.2 specification for * the POSIX locale. * This version ignores LOCALE information. * It also doesn't worry about multi-byte characters. * So there. * * This file is also shipped with GAWK (GNU Awk), gawk specific bits of * code are included if GAWK is defined. * * Arnold Robbins * January, February, March, 1991 * Updated March, April 1992 * Updated April, 1993 * Updated February, 1994 * Updated May, 1994 * Updated January 1995 * Updated September 1995 * * Fixes from ado@elsie.nci.nih.gov * February 1991, May 1992 * Fixes from Tor Lillqvist tml@tik.vtt.fi * May, 1993 * Further fixes from ado@elsie.nci.nih.gov * February 1994 * %z code from chip@chinacat.unicom.com * Applied September 1995 * * * Modified by Don Libes for Expect, 10/93 and 12/95. * Forced POSIX semantics. * Replaced inline/min/max stuff with a single range function. * Removed tzset stuff. * Commented out tzname stuff. * * According to Arnold, the current version of this code can ftp'd from * ftp.mathcs.emory.edu:/pub/arnold/strftime.shar.gz * */ #include "expect_cf.h" #include "tcl.h" #include #include #include "string.h" /* according to Karl Vogel, time.h is insufficient on Pyramid */ /* following is recommended by autoconf */ #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #include #define SYSV_EXT 1 /* stuff in System V ascftime routine */ #define POSIX2_DATE 1 /* stuff in Posix 1003.2 date command */ #if defined(POSIX2_DATE) && ! defined(SYSV_EXT) #define SYSV_EXT 1 #endif #if defined(POSIX2_DATE) #define adddecl(stuff) stuff #else #define adddecl(stuff) #endif #ifndef __STDC__ #define const extern char *getenv(); static int weeknumber(); adddecl(static int iso8601wknum();) #else #ifndef strchr extern char *strchr(const char *str, int ch); #endif extern char *getenv(const char *v); static int weeknumber(const struct tm *timeptr, int firstweekday); adddecl(static int iso8601wknum(const struct tm *timeptr);) #endif /* attempt to use strftime to compute timezone, else fallback to */ /* less portable ways */ #if !defined(HAVE_STRFTIME) # if defined(HAVE_SV_TIMEZONE) extern char *tzname[2]; extern int daylight; # else # if defined(HAVE_TIMEZONE) char * zone_name (tp) struct tm *tp; { char *timezone (); struct timeval tv; struct timezone tz; gettimeofday (&tv, &tz); return timezone (tz.tz_minuteswest, tp->tm_isdst); } # endif /* HAVE_TIMEZONE */ # endif /* HAVE_SV_TIMEZONE */ #endif /* HAVE_STRFTIME */ static int range(low,item,hi) int low, item, hi; { if (item < low) return low; if (item > hi) return hi; return item; } /* strftime --- produce formatted time */ void /*size_t*/ #ifndef __STDC__ exp_strftime(/*s,*/ format, timeptr, dstring) /*char *s;*/ char *format; const struct tm *timeptr; Tcl_DString *dstring; #else /*exp_strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr)*/ exp_strftime(char *format, const struct tm *timeptr,Tcl_DString *dstring) #endif { int copied; /* used to suppress copying when called recursively */ #if 0 char *endp = s + maxsize; char *start = s; #endif char *percentptr; char tbuf[100]; int i; /* various tables, useful in North America */ static char *days_a[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", }; static char *days_l[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", }; static char *months_a[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }; static char *months_l[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", }; static char *ampm[] = { "AM", "PM", }; /* for (; *format && s < endp - 1; format++) {*/ for (; *format ; format++) { tbuf[0] = '\0'; copied = 0; /* has not been copied yet */ percentptr = strchr(format,'%'); if (percentptr == 0) { Tcl_DStringAppend(dstring,format,-1); goto out; } else if (percentptr != format) { Tcl_DStringAppend(dstring,format,percentptr - format); format = percentptr; } #if 0 if (*format != '%') { *s++ = *format; continue; } #endif again: switch (*++format) { case '\0': Tcl_DStringAppend(dstring,"%",1); #if 0 *s++ = '%'; #endif goto out; case '%': Tcl_DStringAppend(dstring,"%",1); copied = 1; break; #if 0 *s++ = '%'; continue; #endif case 'a': /* abbreviated weekday name */ if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6) strcpy(tbuf, "?"); else strcpy(tbuf, days_a[timeptr->tm_wday]); break; case 'A': /* full weekday name */ if (timeptr->tm_wday < 0 || timeptr->tm_wday > 6) strcpy(tbuf, "?"); else strcpy(tbuf, days_l[timeptr->tm_wday]); break; #ifdef SYSV_EXT case 'h': /* abbreviated month name */ #endif case 'b': /* abbreviated month name */ if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11) strcpy(tbuf, "?"); else strcpy(tbuf, months_a[timeptr->tm_mon]); break; case 'B': /* full month name */ if (timeptr->tm_mon < 0 || timeptr->tm_mon > 11) strcpy(tbuf, "?"); else strcpy(tbuf, months_l[timeptr->tm_mon]); break; case 'c': /* appropriate date and time representation */ sprintf(tbuf, "%s %s %2d %02d:%02d:%02d %d", days_a[range(0, timeptr->tm_wday, 6)], months_a[range(0, timeptr->tm_mon, 11)], range(1, timeptr->tm_mday, 31), range(0, timeptr->tm_hour, 23), range(0, timeptr->tm_min, 59), range(0, timeptr->tm_sec, 61), timeptr->tm_year + 1900); break; case 'd': /* day of the month, 01 - 31 */ i = range(1, timeptr->tm_mday, 31); sprintf(tbuf, "%02d", i); break; case 'H': /* hour, 24-hour clock, 00 - 23 */ i = range(0, timeptr->tm_hour, 23); sprintf(tbuf, "%02d", i); break; case 'I': /* hour, 12-hour clock, 01 - 12 */ i = range(0, timeptr->tm_hour, 23); if (i == 0) i = 12; else if (i > 12) i -= 12; sprintf(tbuf, "%02d", i); break; case 'j': /* day of the year, 001 - 366 */ sprintf(tbuf, "%03d", timeptr->tm_yday + 1); break; case 'm': /* month, 01 - 12 */ i = range(0, timeptr->tm_mon, 11); sprintf(tbuf, "%02d", i + 1); break; case 'M': /* minute, 00 - 59 */ i = range(0, timeptr->tm_min, 59); sprintf(tbuf, "%02d", i); break; case 'p': /* am or pm based on 12-hour clock */ i = range(0, timeptr->tm_hour, 23); if (i < 12) strcpy(tbuf, ampm[0]); else strcpy(tbuf, ampm[1]); break; case 'S': /* second, 00 - 61 */ i = range(0, timeptr->tm_sec, 61); sprintf(tbuf, "%02d", i); break; case 'U': /* week of year, Sunday is first day of week */ sprintf(tbuf, "%02d", weeknumber(timeptr, 0)); break; case 'w': /* weekday, Sunday == 0, 0 - 6 */ i = range(0, timeptr->tm_wday, 6); sprintf(tbuf, "%d", i); break; case 'W': /* week of year, Monday is first day of week */ sprintf(tbuf, "%02d", weeknumber(timeptr, 1)); break; case 'x': /* appropriate date representation */ sprintf(tbuf, "%s %s %2d %d", days_a[range(0, timeptr->tm_wday, 6)], months_a[range(0, timeptr->tm_mon, 11)], range(1, timeptr->tm_mday, 31), timeptr->tm_year + 1900); break; case 'X': /* appropriate time representation */ sprintf(tbuf, "%02d:%02d:%02d", range(0, timeptr->tm_hour, 23), range(0, timeptr->tm_min, 59), range(0, timeptr->tm_sec, 61)); break; case 'y': /* year without a century, 00 - 99 */ i = timeptr->tm_year % 100; sprintf(tbuf, "%02d", i); break; case 'Y': /* year with century */ sprintf(tbuf, "%d", 1900 + timeptr->tm_year); break; case 'Z': /* time zone name or abbrevation */ #if defined(HAVE_STRFTIME) strftime(tbuf,sizeof tbuf,"%Z",timeptr); #else # if defined(HAVE_SV_TIMEZONE) i = 0; if (daylight && timeptr->tm_isdst) i = 1; strcpy(tbuf, tzname[i]); # else strcpy(tbuf, zone_name (timeptr)); # if defined(HAVE_TIMEZONE) # endif /* HAVE_TIMEZONE */ /* no timezone available */ /* feel free to add others here */ # endif /* HAVE_SV_TIMEZONE */ #endif /* HAVE STRFTIME */ break; #ifdef SYSV_EXT case 'n': /* same as \n */ tbuf[0] = '\n'; tbuf[1] = '\0'; break; case 't': /* same as \t */ tbuf[0] = '\t'; tbuf[1] = '\0'; break; case 'D': /* date as %m/%d/%y */ exp_strftime("%m/%d/%y", timeptr, dstring); copied = 1; /* exp_strftime(tbuf, sizeof tbuf, "%m/%d/%y", timeptr);*/ break; case 'e': /* day of month, blank padded */ sprintf(tbuf, "%2d", range(1, timeptr->tm_mday, 31)); break; case 'r': /* time as %I:%M:%S %p */ exp_strftime("%I:%M:%S %p", timeptr, dstring); copied = 1; /* exp_strftime(tbuf, sizeof tbuf, "%I:%M:%S %p", timeptr);*/ break; case 'R': /* time as %H:%M */ exp_strftime("%H:%M", timeptr, dstring); copied = 1; /* exp_strftime(tbuf, sizeof tbuf, "%H:%M", timeptr);*/ break; case 'T': /* time as %H:%M:%S */ exp_strftime("%H:%M:%S", timeptr, dstring); copied = 1; /* exp_strftime(tbuf, sizeof tbuf, "%H:%M:%S", timeptr);*/ break; #endif #ifdef POSIX2_DATE case 'C': sprintf(tbuf, "%02d", (timeptr->tm_year + 1900) / 100); break; case 'E': case 'O': /* POSIX locale extensions, ignored for now */ goto again; case 'V': /* week of year according ISO 8601 */ sprintf(tbuf, "%02d", iso8601wknum(timeptr)); break; case 'u': /* ISO 8601: Weekday as a decimal number [1 (Monday) - 7] */ sprintf(tbuf, "%d", timeptr->tm_wday == 0 ? 7 : timeptr->tm_wday); break; #endif /* POSIX2_DATE */ default: tbuf[0] = '%'; tbuf[1] = *format; tbuf[2] = '\0'; break; } if (!copied) Tcl_DStringAppend(dstring,tbuf,-1); #if 0 i = strlen(tbuf); if (i) { if (s + i < endp - 1) { strcpy(s, tbuf); s += i; } else return 0; #endif } out:; #if 0 if (s < endp && *format == '\0') { *s = '\0'; return (s - start); } else return 0; #endif } /* isleap --- is a year a leap year? */ #ifndef __STDC__ static int isleap(year) int year; #else static int isleap(int year) #endif { return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0); } #ifdef POSIX2_DATE /* iso8601wknum --- compute week number according to ISO 8601 */ #ifndef __STDC__ static int iso8601wknum(timeptr) const struct tm *timeptr; #else static int iso8601wknum(const struct tm *timeptr) #endif { /* * From 1003.2: * If the week (Monday to Sunday) containing January 1 * has four or more days in the new year, then it is week 1; * otherwise it is the highest numbered week of the previous * (52 or 53) year, and the next week is week 1. * * ADR: This means if Jan 1 was Monday through Thursday, * it was week 1, otherwise week 53. * * XPG4 erroneously included POSIX.2 rationale text in the * main body of the standard. Thus it requires week 53. */ int weeknum, jan1day; /* get week number, Monday as first day of the week */ weeknum = weeknumber(timeptr, 1); /* * With thanks and tip of the hatlo to tml@tik.vtt.fi * * What day of the week does January 1 fall on? * We know that * (timeptr->tm_yday - jan1.tm_yday) MOD 7 == * (timeptr->tm_wday - jan1.tm_wday) MOD 7 * and that * jan1.tm_yday == 0 * and that * timeptr->tm_wday MOD 7 == timeptr->tm_wday * from which it follows that. . . */ jan1day = timeptr->tm_wday - (timeptr->tm_yday % 7); if (jan1day < 0) jan1day += 7; /* * If Jan 1 was a Monday through Thursday, it was in * week 1. Otherwise it was last year's highest week, which is * this year's week 0. * * What does that mean? * If Jan 1 was Monday, the week number is exactly right, it can * never be 0. * If it was Tuesday through Thursday, the weeknumber is one * less than it should be, so we add one. * Otherwise, Friday, Saturday or Sunday, the week number is * OK, but if it is 0, it needs to be 52 or 53. */ switch (jan1day) { case 1: /* Monday */ break; case 2: /* Tuesday */ case 3: /* Wednesday */ case 4: /* Thursday */ weeknum++; break; case 5: /* Friday */ case 6: /* Saturday */ case 0: /* Sunday */ if (weeknum == 0) { #ifdef USE_BROKEN_XPG4 /* XPG4 (as of March 1994) says 53 unconditionally */ weeknum = 53; #else /* get week number of last week of last year */ struct tm dec31ly; /* 12/31 last year */ dec31ly = *timeptr; dec31ly.tm_year--; dec31ly.tm_mon = 11; dec31ly.tm_mday = 31; dec31ly.tm_wday = (jan1day == 0) ? 6 : jan1day - 1; dec31ly.tm_yday = 364 + isleap(dec31ly.tm_year + 1900); weeknum = iso8601wknum(& dec31ly); #endif } break; } if (timeptr->tm_mon == 11) { /* * The last week of the year * can be in week 1 of next year. * Sigh. * * This can only happen if * M T W * 29 30 31 * 30 31 * 31 */ int wday, mday; wday = timeptr->tm_wday; mday = timeptr->tm_mday; if ( (wday == 1 && (mday >= 29 && mday <= 31)) || (wday == 2 && (mday == 30 || mday == 31)) || (wday == 3 && mday == 31)) weeknum = 1; } return weeknum; } #endif /* weeknumber --- figure how many weeks into the year */ /* With thanks and tip of the hatlo to ado@elsie.nci.nih.gov */ #ifndef __STDC__ static int weeknumber(timeptr, firstweekday) const struct tm *timeptr; int firstweekday; #else static int weeknumber(const struct tm *timeptr, int firstweekday) #endif { int wday = timeptr->tm_wday; int ret; if (firstweekday == 1) { if (wday == 0) /* sunday */ wday = 6; else wday--; } ret = ((timeptr->tm_yday + 7 - wday) / 7); if (ret < 0) ret = 0; return ret; } expect5.45.4/exp_main_sub.c0000664000175000017500000006163313235561756016173 0ustar pysslingpyssling/* exp_main_sub.c - miscellaneous subroutines for Expect or Tk main() */ #include "expect_cf.h" #include #include #ifdef HAVE_INTTYPES_H # include #endif #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_SYS_WAIT_H #include #endif #include "tcl.h" #include "tclInt.h" #include "exp_rename.h" #include "exp_prog.h" #include "exp_command.h" #include "exp_tty_in.h" #include "exp_log.h" #include "exp_event.h" #ifdef TCL_DEBUGGER #include "tcldbg.h" #endif #ifndef EXP_VERSION #define EXP_VERSION PACKAGE_VERSION #endif #ifdef __CENTERLINE__ #undef EXP_VERSION #define EXP_VERSION "5.45.4" /* I give up! */ /* It is not necessary that number */ /* be accurate. It is just here to */ /* pacify Centerline which doesn't */ /* seem to be able to get it from */ /* the Makefile. */ #undef SCRIPTDIR #define SCRIPTDIR "example/" #undef EXECSCRIPTDIR #define EXECSCRIPTDIR "example/" #endif char exp_version[] = PACKAGE_VERSION; #define NEED_TCL_MAJOR 7 #define NEED_TCL_MINOR 5 char *exp_argv0 = "this program"; /* default program name */ void (*exp_app_exit)() = 0; void (*exp_event_exit)() = 0; FILE *exp_cmdfile = 0; char *exp_cmdfilename = 0; int exp_cmdlinecmds = FALSE; int exp_interactive = FALSE; int exp_buffer_command_input = FALSE;/* read in entire cmdfile at once */ int exp_fgets(); Tcl_Interp *exp_interp; /* for use by signal handlers who can't figure out */ /* the interpreter directly */ int exp_tcl_debugger_available = FALSE; int exp_getpid; int exp_strict_write = 0; static void usage(interp) Tcl_Interp *interp; { char buffer [] = "exit 1"; expErrorLog("usage: expect [-div] [-c cmds] [[-f] cmdfile] [args]\r\n"); /* SF #439042 -- Allow overide of "exit" by user / script */ Tcl_Eval(interp, buffer); } /* this clumsiness because pty routines don't know Tcl definitions */ /*ARGSUSED*/ static void exp_pty_exit_for_tcl(clientData) ClientData clientData; { exp_pty_exit(); } static void exp_init_pty_exit() { Tcl_CreateExitHandler(exp_pty_exit_for_tcl,(ClientData)0); } /* This can be called twice or even recursively - it's safe. */ void exp_exit_handlers(clientData) ClientData clientData; { extern int exp_forked; Tcl_Interp *interp = (Tcl_Interp *)clientData; /* use following checks to prevent recursion in exit handlers */ /* if this code ever supports multiple interps, these should */ /* become interp-specific */ static int did_app_exit = FALSE; static int did_expect_exit = FALSE; if (!did_expect_exit) { did_expect_exit = TRUE; /* called user-defined exit routine if one exists */ if (exp_onexit_action) { int result = Tcl_GlobalEval(interp,exp_onexit_action); if (result != TCL_OK) Tcl_BackgroundError(interp); } } else { expDiagLogU("onexit handler called recursively - forcing exit\r\n"); } if (exp_app_exit) { if (!did_app_exit) { did_app_exit = TRUE; (*exp_app_exit)(interp); } else { expDiagLogU("application exit handler called recursively - forcing exit\r\n"); } } if (!exp_disconnected && !exp_forked && (exp_dev_tty != -1) && isatty(exp_dev_tty)) { if (exp_ioctled_devtty) { exp_tty_set(interp,&exp_tty_original,exp_dev_tty,0); } } /* all other files either don't need to be flushed or will be implicitly closed at exit. Spawned processes are free to continue running, however most will shutdown after seeing EOF on stdin. Some systems also deliver SIGHUP and other sigs to idle processes which will blow them away if not prepared. */ exp_close_all(interp); } static int history_nextid(interp) Tcl_Interp *interp; { /* unncessarily tricky coding - if nextid isn't defined, maintain our own static version */ static int nextid = 0; CONST char *nextidstr = Tcl_GetVar2(interp,"tcl::history","nextid",0); if (nextidstr) { /* intentionally ignore failure */ (void) sscanf(nextidstr,"%d",&nextid); } return ++nextid; } /* this stupidity because Tcl needs commands in writable space */ static char prompt1[] = "prompt1"; static char prompt2[] = "prompt2"; static char *prompt2_default = "+> "; static char prompt1_default[] = "expect%d.%d> "; /*ARGSUSED*/ int Exp_Prompt1ObjCmd(clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; /* Argument objects. */ { static char buffer[200]; Interp *iPtr = (Interp *)interp; sprintf(buffer,prompt1_default,iPtr->numLevels,history_nextid(interp)); Tcl_SetResult(interp,buffer,TCL_STATIC); return(TCL_OK); } /*ARGSUSED*/ int Exp_Prompt2ObjCmd(clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; { Tcl_SetResult(interp,prompt2_default,TCL_STATIC); return(TCL_OK); } /*ARGSUSED*/ static int ignore_procs(interp,s) Tcl_Interp *interp; char *s; /* function name */ { return ((s[0] == 'p') && (s[1] == 'r') && (s[2] == 'o') && (s[3] == 'm') && (s[4] == 'p') && (s[5] == 't') && ((s[6] == '1') || (s[6] == '2')) && (s[7] == '\0') ); } /* handle an error from Tcl_Eval or Tcl_EvalFile */ static void handle_eval_error(interp,check_for_nostack) Tcl_Interp *interp; int check_for_nostack; { char *msg; /* if errorInfo has something, print it */ /* else use what's in the interp result */ msg = Tcl_GetVar(interp,"errorInfo",TCL_GLOBAL_ONLY); if (!msg) msg = Tcl_GetStringResult (interp); else if (check_for_nostack) { /* suppress errorInfo if generated via */ /* error ... -nostack */ if (0 == strncmp("-nostack",msg,8)) return; /* * This shouldn't be necessary, but previous test fails * because of recent change John made - see eval_trap_action() * in exp_trap.c for more info */ if (exp_nostack_dump) { exp_nostack_dump = FALSE; return; } } /* no \n at end, since ccmd will already have one. */ /* Actually, this is not true if command is last in */ /* file and has no newline after it, oh well */ expErrorLogU(exp_cook(msg,(int *)0)); expErrorLogU("\r\n"); } /* user has pressed escape char from interact or somehow requested expect. If a user-supplied command returns: TCL_ERROR, assume user is experimenting and reprompt TCL_OK, ditto TCL_RETURN, return TCL_OK (assume user just wants to escape() to return) EXP_TCL_RETURN, return TCL_RETURN anything else return it */ int exp_interpreter(interp,eofObj) Tcl_Interp *interp; Tcl_Obj *eofObj; { Tcl_Obj *commandPtr = NULL; int code; int gotPartial; Interp *iPtr = (Interp *)interp; int tty_changed = FALSE; exp_tty tty_old; int was_raw, was_echo; Tcl_Channel inChannel, outChannel; ExpState *esPtr = expStdinoutGet(); /* int fd = fileno(stdin);*/ expect_key++; commandPtr = Tcl_NewObj(); Tcl_IncrRefCount(commandPtr); gotPartial = 0; while (TRUE) { if (Tcl_IsShared(commandPtr)) { Tcl_DecrRefCount(commandPtr); commandPtr = Tcl_DuplicateObj(commandPtr); Tcl_IncrRefCount(commandPtr); } outChannel = expStdinoutGet()->channel; if (outChannel) { Tcl_Flush(outChannel); } if (!esPtr->open) { code = EXP_EOF; goto eof; } /* force terminal state */ tty_changed = exp_tty_cooked_echo(interp,&tty_old,&was_raw,&was_echo); if (!gotPartial) { code = Tcl_Eval(interp,prompt1); if (code == TCL_OK) { expStdoutLogU(Tcl_GetStringResult(interp),1); } else expStdoutLog(1,prompt1_default,iPtr->numLevels,history_nextid(interp)); } else { code = Tcl_Eval(interp,prompt2); if (code == TCL_OK) { expStdoutLogU(Tcl_GetStringResult(interp),1); } else expStdoutLogU(prompt2_default,1); } esPtr->force_read = 1; code = exp_get_next_event(interp,&esPtr,1,&esPtr,EXP_TIME_INFINITY, esPtr->key); /* check for code == EXP_TCLERROR? */ if (code != EXP_EOF) { inChannel = expStdinoutGet()->channel; code = Tcl_GetsObj(inChannel, commandPtr); #ifdef SIMPLE_EVENT if (code == -1 && errno == EINTR) { if (Tcl_AsyncReady()) { (void) Tcl_AsyncInvoke(interp,TCL_OK); } continue; } #endif if (code < 0) code = EXP_EOF; if ((code == 0) && Tcl_Eof(inChannel) && !gotPartial) code = EXP_EOF; } eof: if (code == EXP_EOF) { if (eofObj) { code = Tcl_EvalObjEx(interp,eofObj,0); } else { code = TCL_OK; } goto done; } expDiagWriteObj(commandPtr); /* intentionally always write to logfile */ if (expLogChannelGet()) { Tcl_WriteObj(expLogChannelGet(),commandPtr); } /* no need to write to stdout, since they will see */ /* it just from it having been echoed as they are */ /* typing it */ /* * Add the newline removed by Tcl_GetsObj back to the string. */ if (Tcl_IsShared(commandPtr)) { Tcl_DecrRefCount(commandPtr); commandPtr = Tcl_DuplicateObj(commandPtr); Tcl_IncrRefCount(commandPtr); } Tcl_AppendToObj(commandPtr, "\n", 1); if (!TclObjCommandComplete(commandPtr)) { gotPartial = 1; continue; } Tcl_AppendToObj(commandPtr, "\n", 1); if (!TclObjCommandComplete(commandPtr)) { gotPartial = 1; continue; } gotPartial = 0; if (tty_changed) exp_tty_set(interp,&tty_old,was_raw,was_echo); code = Tcl_RecordAndEvalObj(interp, commandPtr, 0); Tcl_DecrRefCount(commandPtr); commandPtr = Tcl_NewObj(); Tcl_IncrRefCount(commandPtr); switch (code) { char *str; case TCL_OK: str = Tcl_GetStringResult(interp); if (*str != 0) { expStdoutLogU(exp_cook(str,(int *)0),1); expStdoutLogU("\r\n",1); } continue; case TCL_ERROR: handle_eval_error(interp,1); /* since user is typing by hand, we expect lots */ /* of errors, and want to give another chance */ continue; #define finish(x) {code = x; goto done;} case TCL_BREAK: case TCL_CONTINUE: finish(code); case EXP_TCL_RETURN: finish(TCL_RETURN); case TCL_RETURN: finish(TCL_OK); default: /* note that ccmd has trailing newline */ expErrorLog("error %d: ",code); expErrorLogU(Tcl_GetString(Tcl_GetObjResult(interp))); expErrorLogU("\r\n"); continue; } } /* cannot fall thru here, must jump to label */ done: if (tty_changed) exp_tty_set(interp,&tty_old,was_raw,was_echo); Tcl_DecrRefCount(commandPtr); return(code); } /*ARGSUSED*/ int Exp_ExpVersionObjCmd(clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; /* Argument objects. */ { int emajor, umajor; char *user_version; /* user-supplied version string */ if (objc == 1) { Tcl_SetResult(interp,exp_version,TCL_STATIC); return(TCL_OK); } if (objc > 3) { exp_error(interp,"usage: expect_version [[-exit] version]"); return(TCL_ERROR); } user_version = Tcl_GetString (objv[objc==2?1:2]); emajor = atoi(exp_version); umajor = atoi(user_version); /* first check major numbers */ if (emajor == umajor) { int u, e; /* now check minor numbers */ char *dot = strchr(user_version,'.'); if (!dot) { exp_error(interp,"version number must include a minor version number"); return TCL_ERROR; } u = atoi(dot+1); dot = strchr(exp_version,'.'); e = atoi(dot+1); if (e >= u) return(TCL_OK); } if (objc == 2) { exp_error(interp,"%s requires Expect version %s (but using %s)", exp_argv0,user_version,exp_version); return(TCL_ERROR); } expErrorLog("%s requires Expect version %s (but is using %s)\r\n", exp_argv0,user_version,exp_version); /* SF #439042 -- Allow overide of "exit" by user / script */ { char buffer [] = "exit 1"; Tcl_Eval(interp, buffer); } /*NOTREACHED, but keep compiler from complaining*/ return TCL_ERROR; } static char init_auto_path[] = "\ if {$exp_library != \"\"} {\n\ lappend auto_path $exp_library\n\ }\n\ if {$exp_exec_library != \"\"} {\n\ lappend auto_path $exp_exec_library\n\ }"; static void DeleteCmdInfo (clientData, interp) ClientData clientData; Tcl_Interp *interp; { ckfree (clientData); } int Expect_Init(interp) Tcl_Interp *interp; { static int first_time = TRUE; Tcl_CmdInfo* close_info = NULL; Tcl_CmdInfo* return_info = NULL; if (first_time) { #ifndef USE_TCL_STUBS int tcl_major = atoi(TCL_VERSION); char *dot = strchr(TCL_VERSION,'.'); int tcl_minor = atoi(dot+1); if (tcl_major < NEED_TCL_MAJOR || (tcl_major == NEED_TCL_MAJOR && tcl_minor < NEED_TCL_MINOR)) { char bufa [20]; char bufb [20]; Tcl_Obj* s = Tcl_NewStringObj (exp_argv0,-1); sprintf(bufa,"%d.%d",tcl_major,tcl_minor); sprintf(bufb,"%d.%d",NEED_TCL_MAJOR,NEED_TCL_MINOR); Tcl_AppendStringsToObj (s, " compiled with Tcl ", bufa, " but needs at least Tcl ", bufb, "\n", NULL); Tcl_SetObjResult (interp, s); return TCL_ERROR; } #endif } #ifndef USE_TCL_STUBS if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) { return TCL_ERROR; } #else if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { return TCL_ERROR; } #endif /* * Save initial close and return for later use */ close_info = (Tcl_CmdInfo*) ckalloc (sizeof (Tcl_CmdInfo)); if (Tcl_GetCommandInfo(interp, "close", close_info) == 0) { ckfree ((char*) close_info); return TCL_ERROR; } return_info = (Tcl_CmdInfo*) ckalloc (sizeof (Tcl_CmdInfo)); if (Tcl_GetCommandInfo(interp, "return", return_info) == 0){ ckfree ((char*) close_info); ckfree ((char*) return_info); return TCL_ERROR; } Tcl_SetAssocData (interp, EXP_CMDINFO_CLOSE, DeleteCmdInfo, (ClientData) close_info); Tcl_SetAssocData (interp, EXP_CMDINFO_RETURN, DeleteCmdInfo, (ClientData) return_info); /* * Expect redefines close so we need to save the original (pre-expect) * definition so it can be restored before exiting. * * Needed when expect is dynamically loaded after close has * been redefined e.g. the virtual file system in tclkit */ if (TclRenameCommand(interp, "close", "_close.pre_expect") != TCL_OK) { return TCL_ERROR; } if (Tcl_PkgProvide(interp, "Expect", PACKAGE_VERSION) != TCL_OK) { return TCL_ERROR; } Tcl_Preserve(interp); Tcl_CreateExitHandler(Tcl_Release,(ClientData)interp); if (first_time) { exp_getpid = getpid(); exp_init_pty(); exp_init_pty_exit(); exp_init_tty(); /* do this only now that we have looked at */ /* original tty state */ exp_init_stdio(); exp_init_sig(); exp_init_event(); exp_init_trap(); exp_init_unit_random(); exp_init_spawn_ids(interp); expChannelInit(); expDiagInit(); expLogInit(); expDiagLogPtrSet(expDiagLogU); expErrnoMsgSet(Tcl_ErrnoMsg); Tcl_CreateExitHandler(exp_exit_handlers,(ClientData)interp); first_time = FALSE; } /* save last known interp for emergencies */ exp_interp = interp; /* initialize commands */ exp_init_most_cmds(interp); /* add misc cmds to interpreter */ exp_init_expect_cmds(interp); /* add expect cmds to interpreter */ exp_init_main_cmds(interp); /* add main cmds to interpreter */ exp_init_trap_cmds(interp); /* add trap cmds to interpreter */ exp_init_tty_cmds(interp); /* add tty cmds to interpreter */ exp_init_interact_cmds(interp); /* add interact cmds to interpreter */ /* initialize variables */ exp_init_spawn_id_vars(interp); expExpectVarsInit(); /* * For each of the the Tcl variables, "expect_library", *"exp_library", and "exp_exec_library", set the variable * if it does not already exist. This mechanism allows the * application calling "Expect_Init()" to set these varaibles * to alternate locations from where Expect was built. */ if (Tcl_GetVar(interp, "expect_library", TCL_GLOBAL_ONLY) == NULL) { Tcl_SetVar(interp,"expect_library",SCRIPTDIR,0);/* deprecated */ } if (Tcl_GetVar(interp, "exp_library", TCL_GLOBAL_ONLY) == NULL) { Tcl_SetVar(interp,"exp_library",SCRIPTDIR,0); } if (Tcl_GetVar(interp, "exp_exec_library", TCL_GLOBAL_ONLY) == NULL) { Tcl_SetVar(interp,"exp_exec_library",EXECSCRIPTDIR,0); } Tcl_Eval(interp,init_auto_path); Tcl_ResetResult(interp); #ifdef TCL_DEBUGGER Dbg_IgnoreFuncs(interp,ignore_procs); #endif return TCL_OK; } static char sigint_init_default[80]; static char sigterm_init_default[80]; static char debug_init_default[] = "trap {exp_debug 1} SIGINT"; void exp_parse_argv(interp,argc,argv) Tcl_Interp *interp; int argc; char **argv; { char argc_rep[10]; /* enough space for storing literal rep of argc */ int sys_rc = TRUE; /* read system rc file */ int my_rc = TRUE; /* read personal rc file */ int c; int rc; extern int optind; extern char *optarg; char *args; /* ptr to string-rep of all args */ char *debug_init; exp_argv0 = argv[0]; #ifdef TCL_DEBUGGER Dbg_ArgcArgv(argc,argv,1); #endif /* initially, we must assume we are not interactive */ /* this prevents interactive weirdness courtesy of unknown via -c */ /* after handling args, we can change our mind */ Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY); /* there's surely a system macro to do this but I don't know what it is */ #define EXP_SIG_EXIT(signalnumber) (0x80|signalnumber) sprintf(sigint_init_default, "trap {exit %d} SIGINT", EXP_SIG_EXIT(SIGINT)); Tcl_Eval(interp,sigint_init_default); sprintf(sigterm_init_default,"trap {exit %d} SIGTERM",EXP_SIG_EXIT(SIGTERM)); Tcl_Eval(interp,sigterm_init_default); /* * [#418892]. The '+' character in front of every other option * declaration causes 'GNU getopt' to deactivate its * non-standard behaviour and switch to POSIX. Other * implementations of 'getopt' might recognize the option '-+' * because of this, but the following switch will catch this * and generate a usage message. */ while ((c = getopt(argc, argv, "+b:c:dD:f:inN-v")) != EOF) { switch(c) { case '-': /* getopt already handles -- internally, however */ /* this allows us to abort getopt when dash is at */ /* the end of another option which is required */ /* in order to allow things like -n- on #! line */ goto abort_getopt; case 'c': /* command */ exp_cmdlinecmds = TRUE; rc = Tcl_Eval(interp,optarg); if (rc != TCL_OK) { expErrorLogU(exp_cook(Tcl_GetVar(interp,"errorInfo",TCL_GLOBAL_ONLY),(int *)0)); expErrorLogU("\r\n"); } break; case 'd': expDiagToStderrSet(TRUE); expDiagLog("expect version %s\r\n",exp_version); break; #ifdef TCL_DEBUGGER case 'D': exp_tcl_debugger_available = TRUE; if (Tcl_GetInt(interp,optarg,&rc) != TCL_OK) { expErrorLog("%s: -D argument must be 0 or 1\r\n",exp_argv0); /* SF #439042 -- Allow overide of "exit" by user / script */ { char buffer [] = "exit 1"; Tcl_Eval(interp, buffer); } } /* set up trap handler before Dbg_On so user does */ /* not have to see it at first debugger prompt */ if (0 == (debug_init = getenv("EXPECT_DEBUG_INIT"))) { debug_init = debug_init_default; } Tcl_Eval(interp,debug_init); if (rc == 1) Dbg_On(interp,0); break; #endif case 'f': /* name of cmd file */ exp_cmdfilename = optarg; break; case 'b': /* read cmdfile one part at a time */ exp_cmdfilename = optarg; exp_buffer_command_input = TRUE; break; case 'i': /* interactive */ exp_interactive = TRUE; break; case 'n': /* don't read personal rc file */ my_rc = FALSE; break; case 'N': /* don't read system-wide rc file */ sys_rc = FALSE; break; case 'v': printf("expect version %s\n", exp_version); /* SF #439042 -- Allow overide of "exit" by user / script */ { char buffer [] = "exit 0"; Tcl_Eval(interp, buffer); } break; default: usage(interp); } } abort_getopt: for (c = 0;c * exp_main_sub.c: Updated EXP_VERSION to 5.45.3 * configure, configure.in: Updated expect to version 5.45.3 * expect.man [http://sourceforge.net/p/expect/bugs/86/]. Report and fix by Vitezlav Crhonek. * expect.c [http://sourceforge.net/p/expect/bugs/76/]. Report and fix by Mutsuhito Iikura. On finding a full buffer during matching the sliding window mechanism slides too far, truncating the whole buffer and preventing matches across the boundary. Fix is shortening the slide distance (slide only one 1/3). * expect.c: [http://sourceforge.net/p/expect/patches/18/]. Report and fix both by Nils Carlson . Replaced a cc==0 check with proper Tcl_Eof() check. 2013-11-04 Andreas Kupries * tclconfig/tcl.m4: [http://sourceforge.net/p/expect/patches/17/] * configure: Extended Tcl header detection for OS X Mountain Lion. * exp_main_sub.c: Updated EXP_VERSION to 5.45.2 * configure, configure.in: Updated expect to version 5.45.2 * expect.c: [http://sourceforge.net/p/expect/patches/16/]. Report and fix both by Per Cederqvist. Replaced a memcpy with memmove as the latter properly handles overlapping memory, whereas the original code does not. 2012-08-15 Andreas Kupries * exp_main_sub.c: Updated EXP_VERSION to 5.45.1 * configure, configure.in: Updated expect to version 5.45.1 * exp_chan.c: Applied patch sent in by Ogawa Hirofumi . The patch fixes a problem when talking a tty where the writer has died. Some operating systems report the condition as EIO with nothing read, while this actually an EOF. Without the patch the returned data is incomplete due to the error reported immediately and dropping data in buffers. 2012-05-16 Andreas Kupries * exp_chan.c: [Bug 3526461]: Applied patch by Michael Cleverly fixing a problem with the iteration over the expect channel list where the loop code may modify the list, breaking the iterator. * exp_chan.c: [Bug 3526707]: Applied patch by Michael Cleverly * exp_command.h: fixing problem * expect.c: with an insufficient test for a lost channel in exp_background_channelhandler. 2010-10-26 Andreas Kupries * expect.c: [Bug 3095935]: Convert #bytes information to #chars to prevent later code to fail when copying strings around and miscalculating how much to copy, for strings containing non-ASCII utf chars. 2010-09-30 Andreas Kupries * example/autopasswd: Updated to use tclsh in PATH, and 'package * example/chess.exp: require Expect'. Obsoletes fixline1. * example/cryptdir: * example/decryptdir: * example/dislocate: * example/dvorak: * example/ftp-inband: * example/ftp-rfc: * example/gethostbyaddr: * example/kibitz: * example/lpunlock: * example/mkpasswd: * example/multixterm: * example/passmass: * example/read1char: * example/rftp: * example/rlogin-cwd: * example/robohunt: * example/rogue.exp: * example/telnet-cwd: * example/timed-read: * example/timed-run: * example/unbuffer: * example/virterm: * example/weather: * example/xkibitz: * example/xpstat: * Makefile.in: Continued work on the 'make dist' target (config.{sub,guess}) * install.sh: Removed unused file. * mkinstalldirs: Removed unused file. * tclconfig/README.txt: Removed unused file. * testsuite/config/: Removed contents of unused directory. * test/.Sanitize: Removed unused file. 2010-09-17 Jeff Hobbs * Makefile.in: improved make dist target to include the necessary files, and remove old dist_orig. Enable Makefile regen target 2010-09-16 Jeff Hobbs * configure: regen with ac-2.59 * tclconfig/tcl.m4: update for correct LDFLAGS on HP-UX * Makefile.in (expect): use TEA LDFLAGS instead of tclConfig.sh to build expect executable 2010-09-01 Andreas Kupries * Makefile.in: [Bug 865278] Semi-applied Don Porter's patch adding code which prevents the package from registering with Tcl interpreters which cannot load it, i.e. below the version it was compiled against. Semi because the pkgIndex.in in his patch is not used, the pkgIndex.tcl is generated by the Makefile(.in). * pkgIndex.in: Removed. File not used. 2010-08-31 Andreas Kupries * Various cleanups, local patches of ActiveState. * exp_clib.c: Remove local copy of Tcl_ErrnoMsg(). * exp_inter.c: Hack access to TCL_REG_BOSONLY when not present, became private with Tcl 8.5 and higher. * expect.h: Remove the local fiddling with the memory allocation and panic macros. * Dbg.c: [Bug 2972727]: Applied the parts of Larry Virden's patch which were still current. Most of it applied to the partially ansified sources we had in trunk for a time and where errors in that set of changes, thus out of date now. * example/unbuffer: [Bug 2949748]: Applied patch by Vitezslav Crhonek to prevent unbuffer from eating the exit code of the command it ran (regular mode only, not -p). Slightly modified, I removed the superfluous 'eval' used to invoke 'wait', invoking it directly. 2010-08-27 Jeff Hobbs * retoglob.c: Fail if the generated glob contains more than two asterisks. Fixes [Expect SF Bug 3010684] (cederqvist) * exp_main_sub.c: add return to silence compiler warning. Updated EXP_VERSION to 5.45.0 * config.guess, config.sub, expect.m4 (removed): * configure, configure.in, tclconfig/tcl.m4: Update to TEA 3.9 * Makefile.in, aclocal.m4: Partial cleanup of the build system. * testsuite/Makefile.in: Remove unused EXP_ from configure.in * testsuite/aclocal.m4: and no longer use Tk. * testsuite/configure: Update testsuite bits to use TEA info. * testsuite/configure.in: Update expect to version 5.45 * Dbg.c: account for removal of tcldbgcf.h * DbgMkfl.in, Dbgconfig.in, Dbgconfigure, DbgpkgInd.in (removed): * tcldbgcf.h.in (removed): removed Dbg debugger subcomponent as it no longer built and debugger functionality is included in expect library and binary * pty_termios.c: add HAVE_STRING_H include string.h * exp_trap.c: add HAVE_STRING_H include string.h * expectk.man, exp_main_tk.c (removed): expectk no longer built. Use tclsh with package require Tk and Expect instead. * tests/all.tcl: add package require Expect * example/archie, example/autoexpect: minor code cleanup * example/tkpasswd, example/tknewsbiff, example/tkterm: use package require statements in lieu of expectk 2009-11-03 Andreas Kupries * exp_command.c (Exp_SpawnObjCmd): [Expect SF Bug 2891422]. Fixed error message when the command to spawn could not be executed. Tried to use a Tcl_Obj* as argument for a %s. Replaced with the correct char* variable. Thanks to Elchonon Edelson for the report. [Expect SF Bug 2891563] Ditto for the same type of bug when emitting error 'usage: -ignore unknown signal name'. The remainder of the exp_error calls are ok however. * configure.in: Bumped version to 5.44.1.15. * configure: Regen'd, autoconf 2.59. 2009-07-14 Andreas Kupries * exp_clib.c (TclRegComp): Fixed memory leak reported by in [Expect SF Bug 2814263]. 2009-06-22 Andreas Kupries * pty_unicos.c (pty_stty): Fixed missing double-quotes for sprint formatting strings. Thanks to for the report, i.e. [Expect SF Bug 2809496]. 2009-06-18 Andreas Kupries * exp_command.c (Exp_LogFileObjCmd): Fix argument parsing logic error in the log_file command breaking the use of options -open and -leaveopen. Applied patch supplied by Andy Belsey . With thanks for both the analysis of the problem and the patch. * configure.in: Bumped version to 5.44.1.14. * configure: Regen'd, autoconf 2.59. 2009-05-27 Andreas Kupries * exp_tty.c (Exp_SttyCmd, Exp_SystemCmd): Applied patch by Reinhard Max (max@suse.de) fixing buffer-overflows in the 'stty' command due to an off-by-one error in the buffer size. See the bugs https://bugzilla.novell.com/show_bug.cgi?id=506873 and https://bugzilla.novell.com/show_bug.cgi?id=501291 * configure.in: Bumped version to 5.44.1.13. * configure: Regen'd, autoconf 2.59. 2009-05-06 Andreas Kupries * retoglob.c: Accepted the patch by Mike Cumings fixing [Expect SF Bug 13179]. The updated code checks a (?...) sequence that it contains only ARE options before processing it as such. This prevents the misinterpretation of non-capturing paren groups as ARe options with subsequent segmentation fault. * configure.in: Bumped version to 5.44.1.12. * configure: Regen'd, autoconf 2.59. 2008-09-30 Andreas Kupries * configure.in: Bumped version to 5.44.1.11. * configure: Regen'd, autoconf 2.59. * exp_command.c (Exp_OverlayObjCmd): Fixed [Expect SF Bug 2127456] reported by , with thanks. Changed retrieval of command from objv[0] (== 'overlay' itself), to objv[i] containing the actual user command. * expect.c (string_case_first, string_first, eval_case_string): Applied patch supplied by Andy Belsey fixing the seg.fault in 'expect -exact'. With thanks for both the analysis of the problem and the patch. See also [Expect SF Bug 2114547]. 2008-08-28 Andreas Kupries * exp_trap.c (tophalf): Fixed inverted condition setting the interpreter used for trap handling to NULL, causing a crash when trying to handle ^C. This fixes [SF Bug 1757471] reported by Matthias Kraft . * configure.in: Bumped version to 5.44.1.10. * configure: Regen'd, autoconf 2.59. 2008-08-18 Jeff Hobbs * exp_main_sub.c (exp_interpreter): cleaner handling of commandPtr to prevent crash. (das) 2008-06-03 Andreas Kupries * exp_glob.c (Exp_StringCaseMatch2): Fixed bug in the handling of glob classes, see [SF Bug 1873404]. The code tried to match the closing bracket of a class in the input because it was not properly skipped after the class was matched successfully. Additional trace output added. * configure.in: Bumped version to 5.44.1.9. * configure: Regen'd, autoconf 2.59. 2008-05-05 Andreas Kupries * exp_pty.c: Minimal ansification of function definitions to match them to their prototypes where promoted types are otherwise causing a mismatch for some compilers, like AIX in 64bit mode. * configure.in: Bumped version to 5.44.1.8. * configure: Regen'd, autoconf 2.59. 2008-04-03 Andreas Kupries * configure.in: Bumped version to 5.44.1.7. * configure: Regen'd, autoconf 2.59. * The following set of changes was sent our way by Reinhard Max . * exp_command.c: Fixed more compiler warnings, and started * exp_command.h: to ansify the code base, beginning with * exp_inter.c: the introduction of proper function prototypes. * exp_main_exp.c: * exp_pty.h: * exp_tty.c: * exp_tty.h: * exp_win.c: * expect.c: * pty_termios.c: * retoglob.c: 2008-04-03 Andreas Kupries * configure.in: Bumped version to 5.44.1.6. * configure: Regen'd, autoconf 2.59. * The following set of changes was sent our way by Reinhard Max . * configure.in: Fixed checking of stty on linux, do not restrict to specific cpu's. Further try with stdin, and stdin redirected to /dev/tty when determining if stdout is read. * testsuite/configure.in: Brought up to TEA 3.5. * testsuite/aclocal.m4: New file, to import the TEA definitions. * Dbg.c: Added missed CONST in declaration and definition of 'debugger_trap'. * exp_command.c: Fixed pointer aliasing trouble with 'Tcl_DetachPids', and added the missing initialization of the command string in the 'overlay' command. * expect.c: Fixed missing initialization of 'simple_start' element of 'ecase'. * exp_inter.c: Fixed bogus use of 'slen' in 'intMatch'. The relevant string is Tcl_Unichar, not Utf. * Makefile.in: Replaced bogus INSTALL_ROOT with DESTDIR, and added missing DESTDIR references to the target for the installation of the manpages. 2008-02-27 Andreas Kupries * expect.c: Fixed refcounting error when parsing a single expect * configure.in: argument into a list of patterns and * configure: actions. Updated the version number to 5.44.1.5. * Dbg.c: Added missing 'return TCL_OK' to debugger_trap. 2007-12-13 Jeff Hobbs * exp_log.c (expStdoutLogU): correct which buf is output. * exp_command.c (Exp_SendLogObjCmd): fix '--' handling (Exp_SendObjCmd): fix '--' handling to expect last argument 2007-09-24 Andreas Kupries * exp_inter.c: Changed inclusion of tcl.h to tclInt.h to get the * expect.c: definition of TCL_REG_BOSONLY, which was moved to that header in Tcl 8.5. Ditto for expect.c, for the macro TclUtfToUniChar (was a function in 8.4). Expect now compiles again for both Tcl 8.4 and 8.5. * configure.in: Bumped version to 5.44.1.4. * configure: Regenerated. 2007-09-19 Andreas Kupries * retoglob.c (EMITC): Keep the characters '^' and '$' quoted as well, we do not wish to invoke their special interpretation by the Expect glob matcher. * configure.in: Bumped version to 5.44.1.3. * configure: Regenerated. 2007-08-09 Andreas Kupries * retoglob.c: We had ExpChopNested and ExpBackslash locally ansified (prototypes) to avoid a compiler error on AIX (type promotion trouble). This now integrated into the mainline sources, conditional to AIX. * expect.c (Exp_TimestampObjCmd): Fixed argument processing broken by objc,objv conversion. Tried to use command name as the argument for -seconds. Also did not detect when one argument to many was specified. * configure.in: Bumped version to 5.44.1.2. * configure: Regenerated. 2007-07-17 Andreas Kupries * expect.c: Circumvented problems with the C compiler by use of a temporary variable to hold the unicode pointer of a glob pattern. The computed pattern length given to Exp_StringCaseMatch was bogus. * exp_glob.c: Added tracing of the glob matcher internals (Can be enabled by define EXP_INTERNAL_TRACE_GLOB). Fixed bug in a guard condition in the optimized handling of '*'. The bad condition caused the code to miss possible matches at the beginning of the input (first char). * tests/expect.test: Added tests which check the glob matcher and RE gate keeping. * configure.in: Bumped to 5.44.1.1 to separate this from the regular 5.44.1 sources. * configure: Regenerated. 2007-07-12 Andreas Kupries * expect.c: Found bugs mismanaging input and pattern in the * exp_glob.c: updated glob matcher. We cannot check for '\0' anymore to find the end of the string, these are counted arrays now. Rewritten to use sentinel pointers. 2007-07-11 Andreas Kupries * exp_chan.c: Converted the buffering system from UTF-8 in Tcl_Obj * exp_command.h: to UTF-16 C-array, to avoid the repeated conversion * expect.c: of the input from utf-8 to utf-16. Updated the glob * exp_glob.c: matching code to use the same tricks for speed which * exp_inter.c: are used by the Tcl core. Extended the regexp * exp_log.c: matching path with a glob matcher which uses a gate * exp_log.h: keeper glob pattern to weed out most non-candidates * retoglob.c (New file): in a speedy manner. Regexp matching now has to be done only for the small number of candidates identified by the gate keeper. Overall speed improvement as glob matching is faster than regexp matching. Added code translating regular expressions into their gate keeper glob pattern. * Dbg.c: Converted the lot of argc,argv based command * exp_command.c: implementations over to objc,objv. * expect.c: * exp_main_sub.c: * Dbg.c: Cleaned up the direct access to interp->result, * exp_command.c: replaced with the proper functions and * expect.c: Tcl_Obj's. * exp_main_exp.c: * exp_main_sub.c: * exp_main_tk.c: * exp_prog.h: * exp_trap.c: * exp_tty.c: * exp_win.c: * exp_win.h: * tests/cat.test: Added proper 'package require Expect' * tests/expect.test: to the test setup code (JeffH). * tests/logfile.test: * tests/pid.test: * tests/send.test: * tests/spawn.test: * tests/stty.test: * exp_command.c: Reformatted overlong lines, whitespace, * expect.c: comments. Added braces to some if-constructs. * exp_inter.c: Reworked if-constructs interleaved with * exp_tty.c: #if for better formatting in emacs. * Dbg.c: Added note about unhandled cases in a switch. * exp_chan.c: Added code to suppress unhandled warning for unreachable code. * exp_command.c: Removed unused variable. * expect.c: Removed unused static function, added code to suppress unhandled warning for unreachable code. * exp_command.c: Fixed typo in comment. 2007-06-28 Andreas Kupries * Merged changes from the official version 5.44.1 of expect into the SF sources. See the details below. -------------------- Marius Schamsula reported tclconfig missing, evidentally for new TEA. Lots of massaging to fix TEAification of Makefile and configure including that version numbers will now be full three part. Daniel Wong noted the home page should note that Wikipedia has a very readable entry for Expect. Andre Alves noted passmass needed some fixes to handle Solaris 9 passwd prompt changes. Andreas fixed several things: changes to better support TEA, fix debugger interaction with nonblocking mode, and probably other things I'm overlooking. Martin Dietze noted that autoconf 2.59 is confused by C comment after undefs in expect_cf.h.in. Added additional code to unbuffer -p so that if a process earlier in the pipeline exits, unbuffer attempts to recover any remaining output from the spawned proc before unbuffer itself exits. Jeffrey Hobbs noted that once stty was called, a bg'd script would be suspended at exit. Turned out to be overaggressive code in stty that recorded what 'damage' the user might have caused when calling stty in the first place. Jens Petersen provided patch to make setpgrp configure better on some Linux systems. Added example/getpassck script to test for getpass bug. multixterm had debugging stuff leftover ("hello"). -------------------- 2006-02-27 Andreas Kupries * exp_main_sub.c: Added command 'exp_configure' for magic configuration. * exp_command.c: Accepts option -strictwrite. Default is 0, ignoring * exp_chan.c: write errors (compatible to 5.41). Setting to 1 re- * expect_tcl.h: activates 5.42 behaviour. 2006-01-25 Jeff Hobbs * tclconfig/tcl.m4, configure: Fix LD_SEARCH_FLAGS setting in tcl.m4 * example/unbuffer: whitespace police * example/beer.exp: brace exprs * expect.man: use clock instead of exec date, minor nroff fixes. 2006-01-24 Andreas Kupries * tclconfig/tcl.m4: Updated to TEA 3.5 * configure.in: Ditto. * configure: Regenerated. 2006-01-10 Jeff Hobbs * tests/expect.test: ensure iso8859-1 for /tmp/null (steffen). 2005-09-19 Andreas Kupries * exp_chan.c (ExpOutputProc): Added guard to intercept and ignore empty write operations, i.e. operations trying to write zero bytes. 2005-09-09 Andreas Kupries * exp_chan.c (ExpBlockModeProc): No, stdin is not ok (See last entry). Fixed. 2005-07-07 Andreas Kupries * exp_chan.c (ExpBlockModeProc): [Expect SF Bug 1108551]. Excluded manipulation of the blocking status for stdin/stderr. This is handled by the Tcl core itself and we must absolutely not pull the rug out from under it. The standard setting to non-blocking will mess with the core which had them set to blocking, and makes all its decisions based on that assumption. Setting to non-blocking can cause hangs and crashes. Stdin is ok however, apparently. This problem was introduced at '2004-06-14'. 2005-06-22 Andreas Kupries * exp_chan.c: Fixed bug causing crash of expect on exit when a * exp_command.c: Tcl channel is used with -(leave)open more than * exp_command.h: once. It tried to close such channels multiple times, going through already freed memory. Added data structures to track and refcount all such channels, to close them only when the last user goes away. 2005-06-09 Andreas Kupries * Makefile.in: Upgraded build system to TEA 3.2. * configure.in: * config.guess: * config.sub * exp_main_sub.c: * aclocal.m4: 2005-03-29 Andreas Kupries * exp_chan.c: Fixed problem with debugger introduced at '2004-06-14'. * tcldbg.h: For a nonblocking stdin the debugger blowed up on the * Dbg.c: empty reads it could get, exiting the application. I guess that this was an implicit 'panic'. Fix: - Split ExpBlockmodeProc into high- and lowlevel code, the latter for use by the debugger. The high-level code tells the debugger which state stdin is in (doing this explicitly because if FIONBIO is used it is not possible to query the fd directly, and I saw no reason to #ifdef for fcntl which can). - Debugger now exports a function for use by the blockmode proc, and in each interaction it checks for nonblocking input, forces blocking if necessary. At the end of each interaction the true mode is restored. Both operations use the low-level blockmode code. 2005-03-07 Jeff Hobbs * exp_tty.c (Exp_SttyCmd): fix from Libes that controlling terminal check example (book p372) by restricting set of exp_ioctled_devtty variable. 2005-02-15 Andreas Kupries * Merged changes from the official versions 5.42.1 and 5.43.0 of expect into the SF sources. See the details below. -------------------- Martin Forssen fixed bug in ExpOutputProc that caused misbehavior during partial writes. Someone noted that gets stdin behaves differently (returns -1 immediately) from tclsh because with 5.42, stdin is unblocked by defaults. Robroy Gregg noted that expect_background ignores timeouts. Added to documentation. Jens Peterson provided patch for "mkpasswd -vo". Gary Bliesener noted that multixterm failed on his system which had an old Tk that didn't support the Tk package. Removed beta designation. Daniel A. Steffen provided patch for MacOS to avoid panic-redefinition. -------------------- 2005-01-21 Andreas Kupries * exp_inter.c: Changed all uses of 'time(3)' to Tcl_GetTime. IOW * expect.c: go through the abstract core API instead of directly acessing OS time. This makes the code dependent on Tcl 8.4, as Tcl_GetTime was not public before. See TIP #73 for its introduction into the public API. As for the reason behind _this_ change see TIP #233. Our change here now causes Expect to be automatically in sync with any virtualization set up in the core. 2004-08-19 Andreas Kupries * exp_chan.c (ExpOutputProc): Added code posted by Don on c.l.t. to handle interrupted system calls (EAGAIN). 2004-07-15 Andreas Kupries * Merged changes from the official version 5.42b0 of expect into the SF sources. See details below. -------------------- Alexander Doktorovich wanted to use Expect as a filter. This is possible but 'too hard'. To make it easier, added close_on_eof command to control whether expect/interact automatically close the channel on eof. This should simplify/enable other scripts. Kurt Heberlein noted that Expect would hang. Andreas tracked it down to a change in Tcl such that when Tcl had data left in its buffers, it would check for more data rather than returning what it had to Expect first. If no data was forthcoming then Tcl would hang because the pty driver runs in blocked mode. Recoded to use nonblocking mode. Yi Luo noted that multixterm xterms were reporting the parent's X window ids (via the WINDOWID env variable) instead of the new ones. Dick Van Deun noted that kibitz expects to find write in /bin but it is in /usr/bin on Slackware. Seems safe to drop the prefix. Steve Lee noted that building Expect failed on Linux when built from scratch because stty ends up in /usr/local/bin rather than the assumed /bin. Added code to support this. -------------------- 2004-06-14 Andreas Kupries * exp_chan.c: Integrated the block mode proc I got by mail from Don Libes into the channel driver. This fixes an error with expect hanging on some input if the situation is just right^Hwrong. Basically if the buffers in driver, Tcl IO core and Expect itself are aligned just so it can cause Expect to block in all call to the OS for more data even if all the data it needs is in ts buffers. Because the driver is blocking and the Tcl core was told that it can run in non-blocking mode. with the block mode proc in place the driver knows that it should be non-blocking and is able to tell this to the OS as well. The call to the OS still happens, but is not blocking anymore, and so the problem is gone. A number of incompat changes in the Tcl IO core to work around this problem in Expect will be removed now. 2004-06-03 Andreas Kupries * aclocal.m4 (TCLHDIRDASHI): Extended with path to unix headers as well. * expect_tcl.h: Added inclusion of . Both changes required for Expect to compile against Tcl 8.5 after the header reform. * configure: Regenerated. 2004-05-19 Andreas Kupries * Merged changes from the official version 5.41 of expect into the SF sources. See details below. -------------------- Simon Taylor provided fix for interact -o which was completely broken by 5.40.1. Added scroll support to official tkterm. Copied all fixes from/to term_expect to/from tkterm. Kiran Madabhushi encountered interact diagnostics incorrectly pointing to expect_background. Also, found multiple -o flags behaving unexpectedly. Added diag. Kristoffer Eriksson noted typo in SIMPLE code in exp_inter.c. However, this is extremely unlikely to affect any machines. Reinhard Max noted that "make test" failed when run in the background. The log testcase was testing the send_tty command. Added code in both Expect and in the test to handle this. -------------------- 2004-02-25 Andreas Kupries * Merged changes from the official version 5.40 of expect into the SF sources. See details below. Partially already done (Rich Kennedy's patch). -------------------- Eric Raymond provided troff-related fixes for the expect, lib, and dislocate man pages. Rich Kennedy noted a bug having to do with our caching of whether we have registered a filehandler. This broke when Tcl was setting a handler on the same file. Ken Pizzini provided patch for leak in spawn error handling. Pete Lancashire noted autopasswd example broke on Solaris which capitalized prompts. -------------------- 2003-10-20 Andreas Kupries * exp_event.c (exp_get_next_event): Applied a patch made by Don Libes in response to a bug report posted to news:comp.lang.tcl by Rich Kennedy . Patch was posted to c.l.t too. > Subject: Re: 2nd interact does not grab stdin > Date: 17 Oct 2003 15:33:38 -0400 > From: Don Libes > Organization: National Institute of Standards and Technology > Newsgroups: comp.lang.tcl > References: <3F86D6F8.E535CBDE@cisco.com> > It's a bug - some overaggressive caching regarding stdin. A fix > appears below. (You should also be able to avoid the problem by > replacing the gets with expect_user.) > Don > Rich Kennedy writes: > > Hi, > > > > The following little expect script gets in trouble with second > > 'interact' statement. The 'less' program does not get stdin > > so it doesn't respond to typed characters... > > > > Is there something that must be done after the 1st interact to > > allow the second to work correctly? (Note, you have to run > > as a script because it works correctly if you type the commands > > interactively to expect) > > > > #!/usr/local/bin/expect > > > > gets stdin a > > spawn less file1 > > interact > > wait > > gets stdin junk > > spawn less file2 > > interact > > wait > > > > Thanks > > > > Rich Kennedy 2003-09-05 Andreas Kupries * Merged changes from the official version 5.39 of expect into the SF sources. See details below. Partially already done. -------------------- Poorva Gupta noted that grantpt/unlockpt order was backward. Strange that this was never a prob before! Eric Raymond provided a troff-related fix for the multixterm man page. Nicolas Roeser noted confusion with md5 so I made the Expect page more explicit about which file that hash was based on. Josh Purinton noted that earlier fix wasn't quite right. Exit on INT/TERM should cause Expect to exit with signal embedded in status. He also requested I obfuscate email addresses in this file. Guido Ostkamp and Igor Sobrado noted that fixline1 rewrote scripts to be expect scripts even if they were expectk scripts. Dirk Petera noted that any_spawn_id used to work but did no longer. Looks like a bug left over from the the I18L conversion. Fixed. Steve Szabo noted exp_log_file -open channel failed. Fixed. Fixed bug from 5.31 that prevent stty from returning messages from underlying program. Thomas Dickey noted that ncurses ignores 2-char term names because of, well, poor assumptions and coding. Changed tkterm to use longer names. Heath Moore noted that exp_clib could lock up if remtime happened to be precisely 0. Recoded to avoid. At request of Per Otterholm , wrote script to read from stdin and echo passwords (exercise 9 in Tk chapter of Expect book). Added to example directory as passwdprompt. Josh Purinton pointed out that by default, SIGINT/TERM should cause expect's return status to be 1, not 0. Paul Reithmuller noted that unbuffer shouldn't postprocess its output. Added stty_init. Mordechai T. Abzug noted that log_file wasn't recording -append status. James Kelly noted weather example needed new source. Dimitar Haralanov noted that interact dumped core with interact { timeout 1 } -------------------- 2003-06-16 Andreas Kupries * exp_command.c: Applied patch provided on c.l.t., by Don Libes in response to a bug report by Dirk Petera in same place. See thread reference below: http://groups.google.ca/groups?threadm=4791f5a6.0305250619.1a660299%40posting.google.com 2003-05-08 Andreas Kupries * exp_clib.c (expectv): Applied patch provided on c.l.t., by Don Libes in response to a bug report by "Heath Moore" in same place: > Regarding expect 5.38... > > I'm using libexpect on RedHat 8.0 to communicate via telnet, > and am having problems with it locking up instead of timing > out. Causing traffic during the lockup breaks the lockup. I > looked at the sources, and think I may have found the reason. > > It appears as though i_read can be called with remtime== 0, > which means do > one read() and return without using alarm(), > even when exp_timeout is non-zero. This would happen if > i_read were to return after receiving non-matching data when > end_time == current_time. The subsequent i_read would then > wait until it received data. 2003-02-17 Andreas Kupries * Makefile.in: * configure.in: Removed the check of configure against configure.in and Makefile.in. It is a hassle to deal with when trying to build straight from CVS, making unsupervised automatic builds difficult 2003-02-14 Andreas Kupries * configure.in: Made expect aware of tcl stubs. Derived from the * exp_command.h: patches to expect done by Steve Landers * exp_command.c: . Modifications: * exp_main_sub.c No global cmdinfo structures for 'close' and * exp_main_exp.c: 'return'. Made this per-interpreter information * exp_main_tk.c: as it should be. Using interp assoc data for this. NOTE: stubs is not default, but has to be activated via '--enable-stubs'. * configure: Regenerated. 2003-02-14 Andreas Kupries * exp_chan.c (exp_close_all): Save the nextPtr in a local variable before calling 'exp_close' as 'expStateFree' can be called from it under some circumstances, possibly causing the memory allocator to smash the value in 'esPtr'. 2003-02-03 Andreas Kupries * exp_log.c (expLogChannelOpen): Fixed the bug reported on comp.lang.tcl by Mordechai T. Abzug . The bugfix itself was provided by Don Libes. 2002-10-09 Andreas Kupries * exp_command.c (Exp_SpawnCmd): Tcl_GetChannelHandle expected a ClientData*, but got an int*. sizeof(int) != sizeof(ClientData) on 64bit platforms. Crashed the command on a PA-RISC 2.0 machine with --enable-64bit set. Fix: Use temp. variables of type ClientData to retrieve the fd's, and copy this into the actual variables, with a cast to int. 2002-09-25 Jeff Hobbs * configure: regen'ed * configure.in: use tcl_libdir in EXP_LIB_SPEC instead of ${INSTALL_ROOT}${exec_prefix}/lib (steffen) * exp_main_tk.c (Tk_Init2): don't call XSynchronize on OS X. 2002-08-08 Andreas Kupries * Merged changes from the official version 5.38 of expect into the SF sources. See details below. * Makefile.in: Added generation of MD5 checksum for distributed archive. * rftp: Bugfix by Curt Schroeder, see HISTORY * HISTORY: Updated with new info. * configure: Updated version info. * configure.in: Updated version info. 2002-06-26 David Gravereaux * example/weather: Updated script to use rainmaker.wunderground.com instead of cirrus.sprl.umich.edu. The old service is closed. Added Larry Virden's notes about how rainmaker needs reverse DNS from the peer making the connection or no data can retrieved. This appears to be a blind error condition. 2002-06-17 Andreas Kupries * exp_main_tk.c: #ifdef'd definition of "matherr". This hack is not required for 8.4 anymore. But still for 8.3. 2002-03-25 Andreas Kupries * exp_main_sub.c: Fixed typo in merge of #459646. Thanks to Hemang Lavana. * exp_log.c (expStdoutLogU): Merged fix for SF Bug #513382 into the HEAD (The source of the patch is "expect-sf418892-sf439042-branch"). Use Tcl_WriteChars/Tcl_Flush instead of 'fwrite' for tcl 8.1 and beyond to enforce correct conversion of the internal UTF/8 into the external representation. * Merged fix for SF Bug #459646 into the HEAD (The source of the patch is "expect-sf418892-sf439042-branch"). * Merged fix for SF Bug #439042 into the HEAD (The source of the patch is "expect-sf418892-sf439042-branch"). * Merged fix for SF Bug #418892 into the HEAD (The source of the patch is "expect-sf418892-sf439042-branch"). 2002-03-23 Don Libes * Andreas Kupries mods to provide CONST support per TIP 27 (Fixed SF Patch #525074). 2002-02-25 Andreas Kupries * expect.c: Applied patch by Don Libes fixing improper internationalization. 2002-02-21 Andreas Kupries * expect.man: Changed the paragraph about [exp_continue] to contain information about the flag "-continue_timer". This fixes the bug SF #520630. 2002-02-08 Andreas Kupries * expect.man: Changed abbreviation of "-notransfer" from "-n" to "-not". "-n" is no longer unique due to the addition of "-nocase". This fixes the bug SF #514994. 2002-02-07 Andreas Kupries * Applied patch for SF #514590 to correct behaviour of expect when expecting and send from and to bogus spawn id's. 2002-01-16 Andreas Kupries * Resynchronization of SourceForge with Don's sources to Expect version 5.34. The changes are Don Porter provided package-related fixes for test suite. Brian Theado noted that interact's -re support broke when offsets kicked in. Turned out that the regexp engine supports them during execution but the results are delivered RELATIVE to the offset. (I suspect this was done due to expediency.) 2001-12-05 Andreas Kupries * exp_inter.c: Applied patch posted by Don libes to c.l.t. on his behalf to keep the SF repository in sync with his changes. Don's notes: I obviously missed the fact that although "Tcl_RegExpExecObj" supports offsets, they aren't delivered to "Tcl_RegExpGetInfo". 2001-09-12 David Gravereaux * 'telco-tec-win32-branch' branch created. 2001-08-01 Jeff Hobbs * Dbg.c (Dbg_On): fixed handling of stepping. [Bug: #446412] 2000-04-26 Rob Savoye * pty_termios.h: Only include stropts.h if it exists, rather than deciding it exists based on HAVE_PTMX. * configure.in: Make sure libpt exists, rather than blindly using it for all our configure tests, which then all fail. Also assume our svr4 style ptys are broken, if /dev/ptmx exists, but stropts.h doesn't exist. 1999-08-31 Jennifer Hom * Makefile.in: Changed test target to source tests/all.tcl instead of tests/all * tests/README: Modified documentation to reflect the change from usage of a defs file to the use of package tcltest to run the tests * tests/all: * tests/defs: * tests/all.tcl: * tests/cat.test: * tests/expect.test: * tests/logfile.test: * tests/pid.test: * tests/send.test: * tests/spawn.test * tests/stty.test: Modified test files to use package tcltest, removed tests/all and tests/defs, and added tests/all.tcl 1999-06-22 * expect.c: Fixed bug in token parsing where index was not being incremented properly. * configure.in: Changed version number to 5.31. * aclocal.m4: Fixed CY_AC_LOAD_TKCONFIG so it tests for Tk_Init instead of Tk_Main (which is only a macro in 8.1 and later). Also added TCL_BUILD_LIB_SPEC to the set of flags used in this test to avoid linker errors. * Dbgconfig.in: move CY_*_TCLCONFIG tests below AC_PROG_CC so it will work with gcc Thu Mar 20 14:27:45 1997 Geoffrey Noer * configure.in: don't check if stty reads stdout for i[[3456]]86-*-sysv4.2MP during config; hard code instead Tue Nov 19 09:22:08 1996 Tom Tromey * Makefile.in (install_shared_lib): Put else clause onto each if. Fri Nov 15 11:23:43 1996 Tom Tromey * Makefile.in (XCFLAGS): Use EXP_SHLIB_CFLAGS, not TCL_SHLIB_CFLAGS. (TCL_SHLIB_CFLAGS): Define. * configure.in: Allow arguments to --enable-blah to work. Compute and AC_SUBST EXP_SHLIB_CFLAGS. Added missing AC_MSG_CHECKING. Wed Oct 2 10:13:37 1996 Tom Tromey * configure: Regenerated. * configure.in (stty_reads_stdout): /bin/stty on DG/UX fails. Fri Sep 27 10:15:48 1996 Tom Tromey * expect.c (exp_i_read): Pass interp as first arg to exp_error. * configure.in (stty_reads_stdout): /bin/stty on OSF2.0, OSF3.2, HPUX 9.X, HPUX 10.X guesses wrong, so set value explicitly. Mon Sep 9 10:29:32 1996 Tom Tromey * configure: Regenerated. * configure.in: Added code to actually handle --with-x. * configure: Regenerated. * configure.in: Don't bother looking for Tk if --with-x=no specified. Thu Sep 5 11:01:09 1996 Tom Tromey * configure: Regenerated. * configure.in (stty_reads_stdout): AIX fails "stty" test in background, so set explicitly. Ditto HPUX 9 and 10. Thu Aug 29 17:04:55 1996 Michael Meissner * configure.in (i[345]86-*-*): Recognize i686 for pentium pro. * configure: Regenerate. Mon Aug 5 12:55:06 1996 Tom Tromey * Makefile.in (XCFLAGS): New macro. (CFLAGS): Define to just @CFLAGS@. (CFLAGS_INT): Use $(XCFLAGS). (expect, expect_installed, expect.tc, expectk, expectk_installed, expectk.tc): Use $(XCFLAGS). Mon Feb 12 23:11:38 1996 Rob Savoye * aclocal.m4: Fix typo of ac_cv_tkh to be ac_cv_tclh so it works on all systems. * configure, DBGconfigure, testsuite/configure: Regenerated with autoconf 2.7. Tue Feb 6 11:48:05 1996 Tom Tromey * exp_clib.c, exp_printify.c, expect_comm.h: For Tcl 7.5 and greater, use ../compat/stdlib.h, not compat/stdlib.h. Tue Jan 30 12:21:37 1996 Fred Fish * exp_regexp.c (regmatch, regrepeat): Only declare strchr if it is not a macro. Mon Jan 22 11:17:06 1996 Tom Tromey * configure.in: Check for -lieee, -ldl, and -ldld. * Makefile.in (OFILES): Include @LIBOBJS@. (strerror.o): New target. * strerror.c: New file. * configure.in: Test for strerror. Fri Jan 19 11:08:11 1996 Tom Tromey * Makefile.in (install, ${SCRIPT_LIST}, test): Find new Tcl libraries. Thu Jan 18 13:43:13 1996 Tom Tromey * Most files: Update to expect 5.19. Fri Jan 12 16:22:12 1996 Tom Tromey * exp_closetcl.c (exp_close_tcl_files): Skip stdin, stdout, stderr. * expect_comm.h: Declare exp_close_files_interp. * exp_command.c (exp_init_most_cmds): Set exp_close_files_interp. Thu Jan 11 09:43:14 1996 Tom Tromey * exp_closetcl.c (exp_close_files_interp): New variable for Tcl 7.5. (exp_close_tcl_files): Updated for Tcl 7.5. Prototype and varargs changes: * expect.c: Don't include . * Dbg.c: Copied in many defines from expect_comm.h. (print): Use new varargs defines. * exp_clib.c (exp_fexpectl): Use EXP_VARARGS_START. * expect_comm.h: Include "tclInt.h". * exp_console.c (exp_console_manipulation_failed): First arg to errorlog is char*, not FILE*. * exp_log.c (debuglog): Pass name of last argument to EXP_VARARGS_START. * expect_cf.h.in (tcl_AsyncReady): Removed define. * expect.c (Exp_ExpectGlobalCmd): Added cast. * exp_command.c (exp_i_update): First arg to exp_debuglog is * exp_poll.c (exp_get_next_event): Likewise. char*, not Tcl_Interp*. * exp_log.h: Use prototypes everywhere. Include "expect_comm.h". * expect_tcl.h: Use EXP_VARARGS, not VARARGS. (tcl_AsyncReady): New define for Tcl 7.5. * aclocal.m4 (CY_AC_PATH_TCLH): Handle Tcl 7.5 and greater. (CY_AC_PATH_TCLLIB): Handle Tcl 7.5 and greater. (CY_AC_PATH_TKH): Handle Tk 4.1 and greater. (CY_AC_PATH_TKLIB): Handle Tk 4.1 and greater. Properly quote argument to AC_REQUIRE. * configure: Regenerated. Tue Jan 9 16:26:47 1996 Rob Savoye * Makefile.in: Change SHORT_BINDIR to $prefix, rather than exec_prefix. This is only used to store the platform independant expect scripts. Dec 18 17:22:05 1995 Brendan Kehoe * configure.in, configure: For a solaris2 machine doing a static build, add `-ldl -lw' to avoid unresolved refs using the OpenWindows libraries. Wed Nov 22 08:49:01 1995 Rob Savoye * Most files: Update to expect 5.18.1. Fri Nov 17 17:31:55 1995 Rob Savoye * configure.in: Add support for SCO OpenServer. It doesn't like the trap either. Thu Nov 16 09:28:53 1995 Rob Savoye * configure.in: Use $host to get the OS type rather than trying to get the host name ourselves. Use the $host to set the STTY_READS_STDOUT for hosts were the test is known to fail. It also now configures in the background. * configure.in, Dbgconfig.in, testsuite/configure.in: Use AC_PROG_CC again since Cygnus configure now does the sames thing. Mon Oct 30 18:16:48 1995 Jason Molenda (crash@phydeaux.cygnus.com) * configure.in (no_tk): zero out X_PROGS if we can't find tk libraries. Tue Oct 24 18:25:09 1995 Jason Molenda (crash@phydeaux.cygnus.com) * Makefile.in (X11HDIR): Changed to X11_CFLAGS. (X11_LIB_FLAGS): Changed to X11_LDFLAGS. (X11_LIB): Changed to X11_LIBS. (CPPFLAGS_SIMPLE): Use X11_CFLAGS. (expectk, expectk.tc, tk): use X11_LDFLAGS & X11_LIBS. * configure.in (X11HDIR, X11_LIB_FLAGS, X11_LIB): Use X11_CFLAGS, X11_LDFLAGS, X11_LIBS. Link X11 statically on Solaris, SunOS and HPUX. Thu Oct 19 20:55:54 1995 Fred Fish * Makefile.in: Remove extraneous tabs and blanks in otherwise empty lines. That confuses older non-GNU versions of "make". Mon Oct 9 20:58:50 1995 Jason Molenda (crash@phydeaux.cygnus.com) * testsuite/aclocal.m4: New file. Include ../aclocal.m4. Thu Aug 31 00:16:26 1995 Rob Savoye * HISTORY, Makefile.in, aclocal.m4, exp_command.h, exp_inter.c, exp_main_tk.c, exp_pty.c, expect.c, tests/all, testsuite/Makefile.in. Update to the 5.18.0 release. Minor changes. Thu Aug 17 18:47:21 1995 Rob Savoye * Most files: Update to the 5.17.7 release. Thu Aug 3 22:47:36 1995 Jeff Law (law@snake.cs.utah.edu) * pty_termios.c (HAVE_PTMX): Undefine if both HAVE_PTYM and HAVE_PTMX are defined (as happens for hpux10). Thu Jul 27 16:31:23 1995 J.T. Conklin * Makefile.in (configure): Removed rule that automatically rebuilds configure script. Users might not have autoconf. Tue Jul 18 23:15:03 1995 Fred Fish * expect.c (Exp_ExpectGlobalCmd): Cast ckrealloc first arg to char*. Sun Jun 18 13:02:41 1995 Fred Fish * configure, configure.in (XLIBS): When adding -lX11, also preserve the previous libraries that we went to the trouble of finding. Sun Jun 18 12:15:44 1995 Fred Fish * Makefile.in (exp_clib.o): Add dependencies. Mon May 1 16:50:22 1995 Rob Savoye * configure.in: Also set XINCLUDES in the Makefile. Fri Apr 28 18:56:02 1995 Rob Savoye * aclocal.m4: Create a clone of AC_C_CROSS called CY_C_CROSS that has better error handling in case the native compiler is hosed. * aclocal.m4: Look for tcl and tk directories as just tcl (and tk) or tcl[0-9] (and tk[0-9)] so it doesn't match the tclX release. Print an error and exit if any of the --with-{tcl,tk}* options are used and point to bogus paths. Based Tcl header search on tclInt./h rather than tcl.h. * Makefile.in: Add dependancies for back in for configure and Dbgconfigure targets. Mon Apr 24 16:46:01 1995 Rob Savoye * exp_command.c, exp_event.h, exp_inter.c, exp_main_tk.c, exp_poll.c, exp_select.c, exp_simple.c, exp_tk.c, exp_trap.c, exp_tty.c, FAQ, README, HISTORY: Update to expect 5.16.3. Fri Apr 14 12:00:39 1995 Rob Savoye * configure.in: Copy Dbg_cf.h to objdir, not srcdir. Tue Apr 11 18:52:24 1995 Rob Savoye * aclocal.m4: Split the macros so header and library searches are seperate macros. AC_PATH_{TCL,TK} nows only calls the macros. Lots of optimization to the AC_PATH_T* macros. Supports the use of --with-tclinclude, --with-tcllib, --with-tkinclude, --with-tklib to specify alternative search dirs for tcl and tk stuff. * Makefile.in, testsuite/Makefile.in: Re-write targets for configure, Dbgconfigure so they work in an unconfigured srcdir. * configure.in: Put AC_PATH_X before AC_PATH_TK and make the TK test conditional. Fix how Dbgconfigure gets passed the Tcl header dir to use --with-PACKAGE which is much simpler. Removed the test for user override of X search paths since AC_PATH_X uses. --x-includes and --x-libraries instead. * Dbgconfig.in: Use AC_PATH_TCLH to find just the headers, and test for LynxOS. * debugger/: Remove directory. Recursive configuring is so much easier... * DbgMkfl.in, Dbg_cf.h.in, Dbg.c, Dbg.h, Dbgconfigure, Dbgconfig.in: Sigh, moved back to the top-level expect directory. Wed Apr 5 17:25:45 1995 Rob Savoye * configure.in: Add a trap so the configure runs in the background. Thu Mar 16 16:56:08 1995 Rob Savoye * debugger: New directory for the Tcl debugger. * debugger/Dbg.c, debugger/Dbg.h, debugger/Dbg_cf.h.in: Moved from the top level expect directory so it builds standalone. * DbgMkfl.in, debugger/Makefile.in: Moved to debugger dir and renamed. * install-sh, mkinstalldirs: New files borrowed from the autoconf distribution. * aclocal.m4: New autoconf macros. * Makefile.in: Tweaked so it's recursive. * configure.in: Use new macros in aclocal.m4 rather than hunting for the Tcl and Tk stuff ourseleves. * debugger/Makefile.in: Build debugger standalone. * testsuite/Makefile.in, testsuite/configure.in: New files for autoconf support. * exp_test.c, testsuite/exp_test.c: Move test file. Fri Jan 13 15:30:30 1995 Ian Lance Taylor * Makefile.in (check): Pass EXPECT correctly to runtest. Thu Oct 20 18:04:06 1994 Rob Savoye * Makefile.in: Add X11_INCLUDE_FLAGS so top level flags get used too. Tue Jun 14 12:32:07 1994 David J. Mackenzie (djm@rtl.cygnus.com) * aclocal.m4: Copy from TCL directory. * configure.in: Improve checks for installed Tcl and Tk. * configure: Rebuilt. Tue Jun 7 13:52:34 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * Makefile.in (mostlyclean, realclean): New targets. Wed May 18 12:21:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * Makefile.in (install): Add another ``else true''. Fri Apr 29 16:49:36 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) * Makefile.in (install): Always use else in if conditional to avoid Ultrix sh bug. Mon Apr 11 15:22:12 1994 Rob Savoye (rob@cirdan.cygnus.com) * Upgrade to the new "official" beta release of expect 5.7. Wed Mar 30 17:15:28 1994 Rob Savoye (rob@cirdan.cygnus.com) * testsuite/expect.tests/expect-test.exp: Just run the new expect tests and format the outout under DejaGnu. Mon Mar 28 14:33:55 1994 Rob Savoye (rob@cirdan.cygnus.com) * Upgrade to expect 5.6.3. Thu Dec 2 16:26:54 1993 Rob Savoye (rob@darkstar.cygnus.com) * configure.in: Add tests to find Tcl and Tk headers and libraries. Thu Aug 19 18:26:49 1993 Rob Savoye (rob@darkstar.cygnus.com) * upgraded to version 4.7.6, add OSF/1 patches in again. Wed Aug 18 20:10:16 1993 Rob Savoye (rob@rtl.cygnus.com) * upgraded to version 4.7.4, add OSF/1 patches in again. Tue Aug 17 20:17:40 1993 Rob Savoye (rob@darkstar.cygnus.com) * pty_termios.c, exp_command.c, configure.in: Add support for using ptmx_bsd's if they exist. Only found on OSF/1. (patch applied from Gregory Depp Thu Jun 10 11:36:09 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) * exp_main.h: fix prototype for exp_cook Fri Jun 4 08:55:22 1993 Ian Lance Taylor (ian@cygnus.com) * Makefile.in (TCLLIB): If ../tcl/libtcl.a does not exist, use -ltcl. Tue May 25 14:45:12 1993 Rob Savoye (rob@darkstar.cygnus.com) * Makefile.in, configure.in: Add some support for autoconfiguring for X. Sun May 23 22:32:09 1993 Rob Savoye (rob at darkstar.cygnus.com) * exp_command.c: Fix so send_log still works when master is out of bounds. (ok since it doesn't get used). Mon May 17 19:51:52 1993 Rob Savoye (rob@cygnus.com) * configure.in: Change test for ranlib so it kicks out "true" rather than "@:" if it can't be found. Thu Apr 15 14:11:50 1993 Rob Savoye (rob@cygnus.com) * configure.in, Makefile.in: If using ptmx's (SVR4 style pty's) then check for libpt.a too. Thu Apr 8 17:13:39 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) * Makefile.in: all doesn't depend on $(SCRIPTS). When building $(SCRIPTS) using fixline & sources in $(srcdir), not the current directory. When installing manpages, install from $(srcdir). Don't install like "install foo $(bindir)" but rather "install foo $(bindir)/foo". Mon Mar 22 23:56:29 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) * Makefile.in: add check & installcheck targets Tue Mar 2 20:28:30 1993 david d `zoo' zuhn (zoo at cirdan.cygnus.com) * configure.in, configure: declare SETUID to be @: instead of echo * pty_termios.c: declare ptynum * Makefile.in: a number of changes, including use of the AR and ARFLAGS variables, the appropriate variables for X11 (as passed down from the top level Makefile), clean up some doc lines Mon Mar 1 15:05:40 1993 Rob Savoye (rob at darkstar.cygnus.com) * configure.in, defs.h.in: Fixed problem for systems that think getpty() should be _getpty(). Thu Feb 25 15:34:34 1993 Rob Savoye (rob at darkstar.cygnus.com) * exp_tty.h: Defines portable tty macros. * pty_termios.c: New file, slightly based on pty_usg.c. Uses portable macros and also supports termio. * pty_sgttyb.c: Was pty_bsd.c. * configure.in, Makefile.in, configure: autoconf support for expect. Sun Feb 21 17:42:28 1993 Rob Savoye (rob at darkstar.cygnus.com) * exp_tty.h: Removed and renamed the macros to use configure's. Wed Feb 17 18:56:36 1993 Rob Savoye (rob at darkstar.cygnus.com) * expect.c, Makefile.in: Changed SIG_FN_RETURN to RETSIGTYPE since that's what autoconf kicks out. Thu Dec 24 15:07:32 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) * Makefile.in: added dummy dvi target Wed Dec 16 11:26:16 1992 Ian Lance Taylor (ian@cygnus.com) * inter_select.c (init_interact): if SCO is defined, use sysconf to get maxfds, rather than getdtablesize. * configure.in (*-*-sco*): Use mh-sco. * mh-sco: New file; like mh-sysv, but pass -DSCO in HDEFS. Tue Nov 17 14:28:20 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) * config/mh-{hpux,aix,irix4,sysv*}: updated with appropriate values for the host machine (HDEFS, RANLIB, etc) * configure.in: use that * Makefile.in: use $(HDEFS) in compiling C files Sun Nov 15 21:46:16 1992 Fred Fish (fnf@cygnus.com) * Update to base 3.24.0 release, merging back in changes made by cygnus to 3.22.12 release. Sat Nov 14 20:16:26 1992 Fred Fish (fnf@cygnus.com) * Makefile.in (CFLAGS): Rework use of CFLAGS to fit in better with cygnus configuration standard. * config/mh-svr4: Removed. * config/mh-sysv4: New file, renamed from mh-svr4. * configure.in (*-sysv4): New configuration. * configure.in (*-sun-solaris2, *-sysv4): Use mh-sysv4. * expect.c (sigwinch_handler): Fix #if without any condition. * command.c, expect.c, global.h, lib_exp.c, main.c, term.h: Test for SYSV4 as well as SYSV3. * inter_select.c (sys/sysconfig.h): Include when SYSV4 defined. * inter_select.c (init_interact): Add sysconf call for SYSV4. * pty_svr4.c (ptsname): Declare for SYSV4. Thu Oct 22 17:35:07 1992 Rob Savoye (rob@cygnus.com) * command.c: Added a "send_log" command. It only writes to a log file if one was opened by the "log_file" command. * main.c: Added setbuf commands for stdin, stdout, stderr to turn off buffering. expect5.45.4/exp_event.c0000664000175000017500000002027313235134350015474 0ustar pysslingpyssling/* exp_event.c - event interface for Expect Written by: Don Libes, NIST, 2/6/90 I hereby place this software in the public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #include "expect_cf.h" #include #include #include #ifdef HAVE_SYS_WAIT_H #include #endif #ifdef HAVE_PTYTRAP # include #endif #include "tcl.h" #include "exp_prog.h" #include "exp_command.h" /* for ExpState defs */ #include "exp_event.h" typedef struct ThreadSpecificData { int rr; /* round robin ptr */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; void exp_event_disarm_bg(esPtr) ExpState *esPtr; { Tcl_DeleteChannelHandler(esPtr->channel,exp_background_channelhandler,(ClientData)esPtr); } static void exp_arm_background_channelhandler_force(esPtr) ExpState *esPtr; { Tcl_CreateChannelHandler(esPtr->channel, TCL_READABLE|TCL_EXCEPTION, exp_background_channelhandler, (ClientData)esPtr); esPtr->bg_status = armed; } void exp_arm_background_channelhandler(esPtr) ExpState *esPtr; { switch (esPtr->bg_status) { case unarmed: exp_arm_background_channelhandler_force(esPtr); break; case disarm_req_while_blocked: esPtr->bg_status = blocked; /* forget request */ break; case armed: case blocked: /* do nothing */ break; } } void exp_disarm_background_channelhandler(esPtr) ExpState *esPtr; { switch (esPtr->bg_status) { case blocked: esPtr->bg_status = disarm_req_while_blocked; break; case armed: esPtr->bg_status = unarmed; exp_event_disarm_bg(esPtr); break; case disarm_req_while_blocked: case unarmed: /* do nothing */ break; } } /* ignore block status and forcibly disarm handler - called from exp_close. */ /* After exp_close returns, we will not have an opportunity to disarm */ /* because the fd will be invalid, so we force it here. */ void exp_disarm_background_channelhandler_force(esPtr) ExpState *esPtr; { switch (esPtr->bg_status) { case blocked: case disarm_req_while_blocked: case armed: esPtr->bg_status = unarmed; exp_event_disarm_bg(esPtr); break; case unarmed: /* do nothing */ break; } } /* this can only be called at the end of the bg handler in which */ /* case we know the status is some kind of "blocked" */ void exp_unblock_background_channelhandler(esPtr) ExpState *esPtr; { switch (esPtr->bg_status) { case blocked: exp_arm_background_channelhandler_force(esPtr); break; case disarm_req_while_blocked: exp_disarm_background_channelhandler_force(esPtr); break; } } /* this can only be called at the beginning of the bg handler in which */ /* case we know the status must be "armed" */ void exp_block_background_channelhandler(esPtr) ExpState *esPtr; { esPtr->bg_status = blocked; exp_event_disarm_bg(esPtr); } /*ARGSUSED*/ static void exp_timehandler(clientData) ClientData clientData; { *(int *)clientData = TRUE; } static void exp_channelhandler(clientData,mask) ClientData clientData; int mask; { ExpState *esPtr = (ExpState *)clientData; esPtr->notified = TRUE; esPtr->notifiedMask = mask; exp_event_disarm_fg(esPtr); } void exp_event_disarm_fg(esPtr) ExpState *esPtr; { /*printf("DeleteChannelHandler: %s\r\n",esPtr->name);*/ Tcl_DeleteChannelHandler(esPtr->channel,exp_channelhandler,(ClientData)esPtr); /* remember that ChannelHandler has been disabled so that */ /* it can be turned on for fg expect's as well as bg */ esPtr->fg_armed = FALSE; } /* returns status, one of EOF, TIMEOUT, ERROR or DATA */ /* can now return RECONFIGURE, too */ /*ARGSUSED*/ int exp_get_next_event(interp,esPtrs,n,esPtrOut,timeout,key) Tcl_Interp *interp; ExpState *(esPtrs[]); int n; /* # of esPtrs */ ExpState **esPtrOut; /* 1st ready esPtr, not set if none */ int timeout; /* seconds */ int key; { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); ExpState *esPtr; int i; /* index into in-array */ #ifdef HAVE_PTYTRAP struct request_info ioctl_info; #endif int old_configure_count = exp_configure_count; int timerFired = FALSE; Tcl_TimerToken timerToken = 0;/* handle to Tcl timehandler descriptor */ /* We must delete any timer before returning. Doing so throughout * the code makes it unreadable; isolate the unreadable nonsense here. */ #define RETURN(x) { \ if (timerToken) Tcl_DeleteTimerHandler(timerToken); \ return(x); \ } for (;;) { /* if anything has been touched by someone else, report that */ /* an event has been received */ for (i=0;irr++; if (tsdPtr->rr >= n) tsdPtr->rr = 0; esPtr = esPtrs[tsdPtr->rr]; if (esPtr->key != key) { esPtr->key = key; esPtr->force_read = FALSE; *esPtrOut = esPtr; RETURN(EXP_DATA_OLD); } else if ((!esPtr->force_read) && (!expSizeZero(esPtr))) { *esPtrOut = esPtr; RETURN(EXP_DATA_OLD); } else if (esPtr->notified) { /* this test of the mask should be redundant but SunOS */ /* raises both READABLE and EXCEPTION (for no */ /* apparent reason) when selecting on a plain file */ if (esPtr->notifiedMask & TCL_READABLE) { *esPtrOut = esPtr; esPtr->notified = FALSE; RETURN(EXP_DATA_NEW); } /* * at this point we know that the event must be TCL_EXCEPTION * indicating either EOF or HP ptytrap. */ #ifndef HAVE_PTYTRAP RETURN(EXP_EOF); #else if (ioctl(esPtr->fdin,TIOCREQCHECK,&ioctl_info) < 0) { expDiagLog("ioctl error on TIOCREQCHECK: %s", Tcl_PosixError(interp)); RETURN(EXP_TCLERROR); } if (ioctl_info.request == TIOCCLOSE) { RETURN(EXP_EOF); } if (ioctl(esPtr->fdin, TIOCREQSET, &ioctl_info) < 0) { expDiagLog("ioctl error on TIOCREQSET after ioctl or open on slave: %s", Tcl_ErrnoMsg(errno)); } /* presumably, we trapped an open here */ /* so simply continue by falling thru */ #endif /* !HAVE_PTYTRAP */ } } if (!timerToken) { if (timeout >= 0) { timerToken = Tcl_CreateTimerHandler(1000*timeout, exp_timehandler, (ClientData)&timerFired); } } /* make sure that all fds that should be armed are */ for (i=0;iname);*/ Tcl_CreateChannelHandler( esPtr->channel, TCL_READABLE | TCL_EXCEPTION, exp_channelhandler, (ClientData)esPtr); esPtr->fg_armed = TRUE; } Tcl_DoOneEvent(0); /* do any event */ if (timerFired) return(EXP_TIMEOUT); if (old_configure_count != exp_configure_count) { RETURN(EXP_RECONFIGURE); } } } /* Having been told there was an event for a specific ExpState, get it */ /* This returns status, one of EOF, TIMEOUT, ERROR or DATA */ /*ARGSUSED*/ int exp_get_next_event_info(interp,esPtr) Tcl_Interp *interp; ExpState *esPtr; { #ifdef HAVE_PTYTRAP struct request_info ioctl_info; #endif if (esPtr->notifiedMask & TCL_READABLE) return EXP_DATA_NEW; /* ready_mask must contain TCL_EXCEPTION */ #ifndef HAVE_PTYTRAP return(EXP_EOF); #else if (ioctl(esPtr->fdin,TIOCREQCHECK,&ioctl_info) < 0) { expDiagLog("ioctl error on TIOCREQCHECK: %s", Tcl_PosixError(interp)); return(EXP_TCLERROR); } if (ioctl_info.request == TIOCCLOSE) { return(EXP_EOF); } if (ioctl(esPtr->fdin, TIOCREQSET, &ioctl_info) < 0) { expDiagLog("ioctl error on TIOCREQSET after ioctl or open on slave: %s", Tcl_ErrnoMsg(errno)); } /* presumably, we trapped an open here */ /* call it an error for lack of anything more descriptive */ /* it will be thrown away by caller anyway */ return EXP_TCLERROR; #endif } /*ARGSUSED*/ int /* returns TCL_XXX */ exp_dsleep(interp,sec) Tcl_Interp *interp; double sec; { int timerFired = FALSE; Tcl_CreateTimerHandler((int)(sec*1000),exp_timehandler,(ClientData)&timerFired); while (!timerFired) { Tcl_DoOneEvent(0); } return TCL_OK; } static char destroy_cmd[] = "destroy ."; static void exp_event_exit_real(interp) Tcl_Interp *interp; { Tcl_Eval(interp,destroy_cmd); } /* set things up for later calls to event handler */ void exp_init_event() { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); tsdPtr->rr = 0; exp_event_exit = exp_event_exit_real; } expect5.45.4/Dbg.c0000664000175000017500000010257313235134350014177 0ustar pysslingpyssling/* Dbg.c - Tcl Debugger - See cmdHelp() for commands Written by: Don Libes, NIST, 3/23/93 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #include #ifndef HAVE_STRCHR #define strchr(s,c) index(s,c) #endif /* HAVE_STRCHR */ #if 0 /* tclInt.h drags in stdlib. By claiming no-stdlib, force it to drag in */ /* Tcl's compat version. This avoids having to test for its presence */ /* which is too tricky - configure can't generate two cf files, so when */ /* Expect (or any app) uses the debugger, there's no way to get the info */ /* about whether stdlib exists or not, except pointing the debugger at */ /* an app-dependent .h file and I don't want to do that. */ #define NO_STDLIB_H #endif #include "tclInt.h" /*#include tclInt.h drags in varargs.h. Since Pyramid */ /* objects to including varargs.h twice, just */ /* omit this one. */ /*#include "string.h" tclInt.h drags this in, too! */ #include "tcldbg.h" #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif static int simple_interactor (Tcl_Interp *interp, ClientData data); static int zero (Tcl_Interp *interp, char *string); /* most of the static variables in this file may be */ /* moved into Tcl_Interp */ static Dbg_InterProc *interactor = &simple_interactor; static ClientData interdata = 0; static Dbg_IgnoreFuncsProc *ignoreproc = &zero; static Dbg_OutputProc *printproc = 0; static ClientData printdata = 0; static int stdinmode; static void print _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); static int debugger_active = FALSE; /* this is not externally documented anywhere as of yet */ char *Dbg_VarName = "dbg"; #define DEFAULT_COMPRESS 0 static int compress = DEFAULT_COMPRESS; #define DEFAULT_WIDTH 75 /* leave a little space for printing */ /* stack level */ static int buf_width = DEFAULT_WIDTH; static int main_argc = 1; static char *default_argv = "application"; static char **main_argv = &default_argv; static Tcl_Trace debug_handle; static int step_count = 1; /* count next/step */ #define FRAMENAMELEN 10 /* enough to hold strings like "#4" */ static char viewFrameName[FRAMENAMELEN];/* destination frame name for up/down */ static CallFrame *goalFramePtr; /* destination for next/return */ static int goalNumLevel; /* destination for Next */ static enum debug_cmd { none, step, next, ret, cont, up, down, where, Next } debug_cmd = step; /* info about last action to use as a default */ static enum debug_cmd last_action_cmd = next; static int last_step_count = 1; /* this acts as a strobe (while testing breakpoints). It is set to true */ /* every time a new debugger command is issued that is an action */ static int debug_new_action; #define NO_LINE -1 /* if break point is not set by line number */ struct breakpoint { int id; Tcl_Obj *file; /* file where breakpoint is */ int line; /* line where breakpoint is */ int re; /* 1 if this is regexp pattern */ Tcl_Obj *pat; /* pattern defining where breakpoint can be */ Tcl_Obj *expr; /* expr to trigger breakpoint */ Tcl_Obj *cmd; /* cmd to eval at breakpoint */ struct breakpoint *next, *previous; }; static struct breakpoint *break_base = 0; static int breakpoint_max_id = 0; static struct breakpoint * breakpoint_new() { struct breakpoint *b = (struct breakpoint *)ckalloc(sizeof(struct breakpoint)); if (break_base) break_base->previous = b; b->next = break_base; b->previous = 0; b->id = breakpoint_max_id++; b->file = 0; b->line = NO_LINE; b->pat = 0; b->re = 0; b->expr = 0; b->cmd = 0; break_base = b; return(b); } static void breakpoint_print(interp,b) Tcl_Interp *interp; struct breakpoint *b; { print(interp,"breakpoint %d: ",b->id); if (b->re) { print(interp,"-re \"%s\" ",Tcl_GetString(b->pat)); } else if (b->pat) { print(interp,"-glob \"%s\" ",Tcl_GetString(b->pat)); } else if (b->line != NO_LINE) { if (b->file) { print(interp,"%s:",Tcl_GetString(b->file)); } print(interp,"%d ",b->line); } if (b->expr) print(interp,"if {%s} ",Tcl_GetString(b->expr)); if (b->cmd) print(interp,"then {%s}",Tcl_GetString(b->cmd)); print(interp,"\n"); } static void save_re_matches(interp, re, objPtr) Tcl_Interp *interp; Tcl_RegExp re; Tcl_Obj *objPtr; { Tcl_RegExpInfo info; int i, start; char name[20]; Tcl_RegExpGetInfo(re, &info); for (i=0;i<=info.nsubs;i++) { start = info.matches[i].start; /* end = info.matches[i].end-1;*/ if (start == -1) continue; sprintf(name,"%d",i); Tcl_SetVar2Ex(interp, Dbg_VarName, name, Tcl_GetRange(objPtr, info.matches[i].start, info.matches[i].end-1), 0); } } /* return 1 to break, 0 to continue */ static int breakpoint_test(interp,cmd,bp) Tcl_Interp *interp; char *cmd; /* command about to be executed */ struct breakpoint *bp; /* breakpoint to test */ { if (bp->re) { int found = 0; Tcl_Obj *cmdObj; Tcl_RegExp re = Tcl_GetRegExpFromObj(NULL, bp->pat, TCL_REG_ADVANCED); cmdObj = Tcl_NewStringObj(cmd,-1); Tcl_IncrRefCount(cmdObj); if (Tcl_RegExpExecObj(NULL, re, cmdObj, 0 /* offset */, -1 /* nmatches */, 0 /* eflags */) > 0) { save_re_matches(interp, re, cmdObj); found = 1; } Tcl_DecrRefCount(cmdObj); if (!found) return 0; } else if (bp->pat) { if (0 == Tcl_StringMatch(cmd, Tcl_GetString(bp->pat))) return 0; } else if (bp->line != NO_LINE) { /* not yet implemented - awaiting support from Tcl */ return 0; } if (bp->expr) { int value; /* ignore errors, since they are likely due to */ /* simply being out of scope a lot */ if (TCL_OK != Tcl_ExprBooleanObj(interp,bp->expr,&value) || (value == 0)) return 0; } if (bp->cmd) { Tcl_EvalObjEx(interp, bp->cmd, 0); } else { breakpoint_print(interp,bp); } return 1; } static char *already_at_top_level = "already at top level"; /* similar to TclGetFrame but takes two frame ptrs and a direction. If direction is up, search up stack from curFrame If direction is down, simulate searching down stack by seaching up stack from origFrame */ static int TclGetFrame2(interp, origFramePtr, string, framePtrPtr, dir) Tcl_Interp *interp; CallFrame *origFramePtr; /* frame that is true top-of-stack */ char *string; /* String describing frame. */ CallFrame **framePtrPtr; /* Store pointer to frame here (or NULL * if global frame indicated). */ enum debug_cmd dir; /* look up or down the stack */ { Interp *iPtr = (Interp *) interp; int level, result; CallFrame *framePtr; /* frame currently being searched */ CallFrame *curFramePtr = iPtr->varFramePtr; /* * Parse string to figure out which level number to go to. */ result = 1; if (*string == '#') { if (Tcl_GetInt(interp, string+1, &level) != TCL_OK) { return TCL_ERROR; } if (level < 0) { levelError: Tcl_AppendResult(interp, "bad level \"", string, "\"", (char *) NULL); return TCL_ERROR; } framePtr = origFramePtr; /* start search here */ } else if (isdigit(*string)) { if (Tcl_GetInt(interp, string, &level) != TCL_OK) { return TCL_ERROR; } if (dir == up) { if (curFramePtr == 0) { Tcl_SetResult(interp,already_at_top_level,TCL_STATIC); return TCL_ERROR; } level = curFramePtr->level - level; framePtr = curFramePtr; /* start search here */ } else { if (curFramePtr != 0) { level = curFramePtr->level + level; } framePtr = origFramePtr; /* start search here */ } } else { level = curFramePtr->level - 1; result = 0; } /* * Figure out which frame to use. */ if (level == 0) { framePtr = NULL; } else { for (;framePtr != NULL; framePtr = framePtr->callerVarPtr) { if (framePtr->level == level) { break; } } if (framePtr == NULL) { goto levelError; } } *framePtrPtr = framePtr; return result; } static char *printify(s) char *s; { static int destlen = 0; char *d; /* ptr into dest */ unsigned int need; static char buf_basic[DEFAULT_WIDTH+1]; static char *dest = buf_basic; Tcl_UniChar ch; if (s == 0) return(""); /* worst case is every character takes 4 to printify */ need = strlen(s)*6; if (need > destlen) { if (dest && (dest != buf_basic)) ckfree(dest); dest = (char *)ckalloc(need+1); destlen = need; } for (d = dest;*s;) { s += Tcl_UtfToUniChar(s, &ch); if (ch == '\b') { strcpy(d,"\\b"); d += 2; } else if (ch == '\f') { strcpy(d,"\\f"); d += 2; } else if (ch == '\v') { strcpy(d,"\\v"); d += 2; } else if (ch == '\r') { strcpy(d,"\\r"); d += 2; } else if (ch == '\n') { strcpy(d,"\\n"); d += 2; } else if (ch == '\t') { strcpy(d,"\\t"); d += 2; } else if ((unsigned)ch < 0x20) { /* unsigned strips parity */ sprintf(d,"\\%03o",ch); d += 4; } else if (ch == 0177) { strcpy(d,"\\177"); d += 4; } else if ((ch < 0x80) && isprint(UCHAR(ch))) { *d = (char)ch; d += 1; } else { sprintf(d,"\\u%04x",ch); d += 6; } } *d = '\0'; return(dest); } static char * print_argv(interp,argc,argv) Tcl_Interp *interp; int argc; char *argv[]; { static int buf_width_max = DEFAULT_WIDTH; static char buf_basic[DEFAULT_WIDTH+1]; /* basic buffer */ static char *buf = buf_basic; int space; /* space remaining in buf */ int len; char *bufp; int proc; /* if current command is "proc" */ int arg_index; if (buf_width > buf_width_max) { if (buf && (buf != buf_basic)) ckfree(buf); buf = (char *)ckalloc(buf_width + 1); buf_width_max = buf_width; } proc = (0 == strcmp("proc",argv[0])); sprintf(buf,"%.*s",buf_width,argv[0]); len = strlen(buf); space = buf_width - len; bufp = buf + len; argc--; argv++; arg_index = 1; while (argc && (space > 0)) { CONST char *elementPtr; CONST char *nextPtr; int wrap; /* braces/quotes have been stripped off arguments */ /* so put them back. We wrap everything except lists */ /* with one argument. One exception is to always wrap */ /* proc's 2nd arg (the arg list), since people are */ /* used to always seeing it this way. */ if (proc && (arg_index > 1)) wrap = TRUE; else { (void) TclFindElement(interp,*argv, #if TCL_MAJOR_VERSION >= 8 -1, #endif &elementPtr,&nextPtr,(int *)0,(int *)0); if (*elementPtr == '\0') wrap = TRUE; else if (*nextPtr == '\0') wrap = FALSE; else wrap = TRUE; } /* wrap lists (or null) in braces */ if (wrap) { sprintf(bufp," {%.*s}",space-3,*argv); } else { sprintf(bufp," %.*s",space-1,*argv); } len = strlen(buf); space = buf_width - len; bufp = buf + len; argc--; argv++; arg_index++; } if (compress) { /* this copies from our static buf to printify's static buf */ /* and back to our static buf */ strncpy(buf,printify(buf),buf_width); } /* usually but not always right, but assume truncation if buffer is */ /* full. this avoids tiny but odd-looking problem of appending "}" */ /* to truncated lists during {}-wrapping earlier */ if (strlen(buf) == buf_width) { buf[buf_width-1] = buf[buf_width-2] = buf[buf_width-3] = '.'; } return(buf); } #if TCL_MAJOR_VERSION >= 8 static char * print_objv(interp,objc,objv) Tcl_Interp *interp; int objc; Tcl_Obj *objv[]; { char **argv; int argc; int len; argv = (char **)ckalloc(objc+1 * sizeof(char *)); for (argc=0 ; argccallerVarPtr,viewf); print(interp,"%c%d: %s\n",ptr,curf->level, #if TCL_MAJOR_VERSION >= 8 print_objv(interp,curf->objc,curf->objv) #else print_argv(interp,curf->argc,curf->argv) #endif ); } } static void PrintStack(interp,curf,viewf,objc,objv,level) Tcl_Interp *interp; CallFrame *curf; /* current FramePtr */ CallFrame *viewf; /* view FramePtr */ int objc; Tcl_Obj *CONST objv[]; /* Argument objects. */ char *level; { PrintStackBelow(interp,curf,viewf); print(interp," %s: %s\n",level,print_objv(interp,objc,objv)); } /* return 0 if goal matches current frame or goal can't be found */ /* anywere in frame stack */ /* else return 1 */ /* This catches things like a proc called from a Tcl_Eval which in */ /* turn was not called from a proc but some builtin such as source */ /* or Tcl_Eval. These builtin calls to Tcl_Eval lose any knowledge */ /* the FramePtr from the proc, so we have to search the entire */ /* stack frame to see if it's still there. */ static int GoalFrame(goal,iptr) CallFrame *goal; Interp *iptr; { CallFrame *cf = iptr->varFramePtr; /* if at current level, return success immediately */ if (goal == cf) return 0; while (cf) { cf = cf->callerVarPtr; if (goal == cf) { /* found, but since it's above us, fail */ return 1; } } return 0; } #if 0 static char *cmd_print(cmdtype) enum debug_cmd cmdtype; { switch (cmdtype) { case none: return "cmd: none"; case step: return "cmd: step"; case next: return "cmd: next"; case ret: return "cmd: ret"; case cont: return "cmd: cont"; case up: return "cmd: up"; case down: return "cmd: down"; case where: return "cmd: where"; case Next: return "cmd: Next"; } return "cmd: Unknown"; } #endif /* debugger's trace handler */ static int debugger_trap _ANSI_ARGS_ (( ClientData clientData, Tcl_Interp *interp, int level, CONST char *command, Tcl_Command commandInfo, int objc, struct Tcl_Obj * CONST * objv)); /*ARGSUSED*/ static int debugger_trap(clientData,interp,level,command,commandInfo,objc,objv) ClientData clientData; /* not used */ Tcl_Interp *interp; int level; /* positive number if called by Tcl, -1 if */ /* called by Dbg_On in which case we don't */ /* know the level */ CONST char *command; Tcl_Command commandInfo; /* Unused */ int objc; struct Tcl_Obj * CONST * objv; { char level_text[6]; /* textual representation of level */ int break_status; Interp *iPtr = (Interp *)interp; CallFrame *trueFramePtr; /* where the pc is */ CallFrame *viewFramePtr; /* where up/down are */ int print_command_first_time = TRUE; static int debug_suspended = FALSE; struct breakpoint *b; char* thecmd; /* skip commands that are invoked interactively */ if (debug_suspended) return TCL_OK; thecmd = Tcl_GetString (objv[0]); /* skip debugger commands */ if (thecmd[1] == '\0') { switch (thecmd[0]) { case 'n': case 's': case 'c': case 'r': case 'w': case 'b': case 'u': case 'd': return TCL_OK; } } if ((*ignoreproc)(interp,thecmd)) return TCL_OK; /* if level is unknown, use "?" */ sprintf(level_text,(level == -1)?"?":"%d",level); /* save so we can restore later */ trueFramePtr = iPtr->varFramePtr; /* do not allow breaking while testing breakpoints */ debug_suspended = TRUE; /* test all breakpoints to see if we should break */ /* if any successful breakpoints, start interactor */ debug_new_action = FALSE; /* reset strobe */ break_status = FALSE; /* no successful breakpoints yet */ for (b = break_base;b;b=b->next) { break_status |= breakpoint_test(interp,command,b); } if (break_status) { if (!debug_new_action) { goto start_interact; } /* if s or n triggered by breakpoint, make "s 1" */ /* (and so on) refer to next command, not this one */ /* step_count++;*/ goto end_interact; } switch (debug_cmd) { case cont: goto finish; case step: step_count--; if (step_count > 0) goto finish; goto start_interact; case next: /* check if we are back at the same level where the next */ /* command was issued. Also test */ /* against all FramePtrs and if no match, assume that */ /* we've missed a return, and so we should break */ /* if (goalFramePtr != iPtr->varFramePtr) goto finish;*/ if (GoalFrame(goalFramePtr,iPtr)) goto finish; step_count--; if (step_count > 0) goto finish; goto start_interact; case Next: /* check if we are back at the same level where the next */ /* command was issued. */ if (goalNumLevel < iPtr->numLevels) goto finish; step_count--; if (step_count > 0) goto finish; goto start_interact; case ret: /* same comment as in "case next" */ if (goalFramePtr != iPtr->varFramePtr) goto finish; goto start_interact; /* DANGER: unhandled cases! none, up, down, where */ } start_interact: if (print_command_first_time) { print(interp,"%s: %s\n", level_text,print_argv(interp,1,&command)); print_command_first_time = FALSE; } /* since user is typing a command, don't interrupt it immediately */ debug_cmd = cont; debug_suspended = TRUE; /* interactor won't return until user gives a debugger cmd */ (*interactor)(interp,interdata); end_interact: /* save this so it can be restored after "w" command */ viewFramePtr = iPtr->varFramePtr; if (debug_cmd == up || debug_cmd == down) { /* calculate new frame */ if (-1 == TclGetFrame2(interp,trueFramePtr,viewFrameName, &iPtr->varFramePtr,debug_cmd)) { print(interp,"%s\n",Tcl_GetStringResult (interp)); Tcl_ResetResult(interp); } goto start_interact; } /* reset view back to normal */ iPtr->varFramePtr = trueFramePtr; #if 0 /* allow trapping */ debug_suspended = FALSE; #endif switch (debug_cmd) { case cont: case step: goto finish; case next: goalFramePtr = iPtr->varFramePtr; goto finish; case Next: goalNumLevel = iPtr->numLevels; goto finish; case ret: goalFramePtr = iPtr->varFramePtr; if (goalFramePtr == 0) { print(interp,"nowhere to return to\n"); break; } goalFramePtr = goalFramePtr->callerVarPtr; goto finish; case where: PrintStack(interp,iPtr->varFramePtr,viewFramePtr,objc,objv,level_text); break; } /* restore view and restart interactor */ iPtr->varFramePtr = viewFramePtr; goto start_interact; finish: debug_suspended = FALSE; return TCL_OK; } /*ARGSUSED*/ static int cmdNext(clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; /* Argument objects. */ { debug_new_action = TRUE; debug_cmd = *(enum debug_cmd *)clientData; last_action_cmd = debug_cmd; if (objc == 1) { step_count = 1; } else if (TCL_OK != Tcl_GetIntFromObj (interp, objv[1], &step_count)) { return TCL_ERROR; } last_step_count = step_count; return(TCL_RETURN); } /*ARGSUSED*/ static int cmdDir(clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; /* Argument objects. */ { char* frame; debug_cmd = *(enum debug_cmd *)clientData; if (objc == 1) { frame = "1"; } else { frame = Tcl_GetString (objv[1]); } strncpy(viewFrameName,frame,FRAMENAMELEN); return TCL_RETURN; } /*ARGSUSED*/ static int cmdSimple(clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; /* Argument objects. */ { debug_new_action = TRUE; debug_cmd = *(enum debug_cmd *)clientData; last_action_cmd = debug_cmd; return TCL_RETURN; } static void breakpoint_destroy(b) struct breakpoint *b; { if (b->file) Tcl_DecrRefCount(b->file); if (b->pat) Tcl_DecrRefCount(b->pat); if (b->cmd) Tcl_DecrRefCount(b->cmd); if (b->expr) Tcl_DecrRefCount(b->expr); /* unlink from chain */ if ((b->previous == 0) && (b->next == 0)) { break_base = 0; } else if (b->previous == 0) { break_base = b->next; b->next->previous = 0; } else if (b->next == 0) { b->previous->next = 0; } else { b->previous->next = b->next; b->next->previous = b->previous; } ckfree((char *)b); } static void savestr(objPtr,str) Tcl_Obj **objPtr; char *str; { *objPtr = Tcl_NewStringObj(str, -1); Tcl_IncrRefCount(*objPtr); } /*ARGSUSED*/ static int cmdWhere(clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; /* Argument objects. */ { static char* options [] = { "-compress", "-width", NULL }; enum options { WHERE_COMPRESS, WHERE_WIDTH }; int i; if (objc == 1) { debug_cmd = where; return TCL_RETURN; } /* Check and process switches */ for (i=1; i= objc) { print(interp,"%d\n",compress); break; } if (TCL_OK != Tcl_GetBooleanFromObj (interp, objv[i], &buf_width)) goto usage; break; case WHERE_WIDTH: i++; if (i >= objc) { print(interp,"%d\n",buf_width); break; } if (TCL_OK != Tcl_GetIntFromObj (interp, objv[i], &buf_width)) goto usage; break; } } if (i < objc) goto usage; return TCL_OK; usage: print(interp,"usage: w [-width #] [-compress 0|1]\n"); return TCL_ERROR; } #define breakpoint_fail(msg) {error_msg = msg; goto break_fail;} /*ARGSUSED*/ static int cmdBreak(clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; /* Argument objects. */ { struct breakpoint *b; char *error_msg; static char* options [] = { "-glob", "-regexp", "if", "then", NULL }; enum options { BREAK_GLOB, BREAK_RE, BREAK_IF, BREAK_THEN }; int i; int index; /* No arguments, list breakpoints */ if (objc == 1) { for (b = break_base;b;b=b->next) breakpoint_print(interp,b); return(TCL_OK); } /* Process breakpoint deletion (-, -x) */ /* Copied from exp_prog.h */ #define streq(x,y) (0 == strcmp((x),(y))) if (objc == 2) { int id; if (streq (Tcl_GetString (objv[1]),"-")) { while (break_base) { breakpoint_destroy(break_base); } breakpoint_max_id = 0; return(TCL_OK); } if ((Tcl_GetString (objv[1])[0] == '-') && (TCL_OK == Tcl_GetIntFromObj (interp, objv[1], &id))) { id = -id; for (b = break_base;b;b=b->next) { if (b->id == id) { breakpoint_destroy(b); if (!break_base) breakpoint_max_id = 0; return(TCL_OK); } } Tcl_SetResult(interp,"no such breakpoint",TCL_STATIC); return(TCL_ERROR); } } b = breakpoint_new(); /* Process switches */ i = 1; if (Tcl_GetIndexFromObj(interp, objv[i], options, "flag", 0, &index) == TCL_OK) { switch ((enum options) index) { case BREAK_GLOB: i++; if (i == objc) breakpoint_fail("no pattern?"); savestr(&b->pat,Tcl_GetString (objv[i])); i++; break; case BREAK_RE: i++; if (i == objc) breakpoint_fail("bad regular expression"); b->re = 1; savestr(&b->pat,Tcl_GetString (objv[i])); if (Tcl_GetRegExpFromObj(interp, b->pat, TCL_REG_ADVANCED) == NULL) { breakpoint_destroy(b); return TCL_ERROR; } i++; break; case BREAK_IF: break; case BREAK_THEN: break; } } else { /* look for [file:]line */ char *colon; char *linep; /* pointer to beginning of line number */ char* ref = Tcl_GetString (objv[i]); colon = strchr(ref,':'); if (colon) { *colon = '\0'; savestr(&b->file,ref); *colon = ':'; linep = colon + 1; } else { linep = ref; /* get file from current scope */ /* savestr(&b->file, ?); */ } if (TCL_OK == Tcl_GetInt(interp,linep,&b->line)) { i++; print(interp,"setting breakpoints by line number is currently unimplemented - use patterns or expressions\n"); } else { /* not an int? - unwind & assume it is an expression */ if (b->file) Tcl_DecrRefCount(b->file); } } if (i < objc) { int do_if = FALSE; if (Tcl_GetIndexFromObj(interp, objv[i], options, "flag", 0, &index) == TCL_OK) { switch ((enum options) index) { case BREAK_IF: i++; do_if = TRUE; /* Consider next word as expression */ break; case BREAK_THEN: /* No 'if expression' guard here, do nothing */ break; case BREAK_GLOB: case BREAK_RE: do_if = TRUE; /* Consider current word as expression, without a preceding 'if' */ break; } } else { /* Consider current word as expression, without a preceding 'if' */ do_if = TRUE; } if (do_if) { if (i == objc) breakpoint_fail("if what"); savestr(&b->expr,Tcl_GetString (objv[i])); i++; } } if (i < objc) { /* Remainder is a command */ if (Tcl_GetIndexFromObj(interp, objv[i], options, "flag", 0, &index) == TCL_OK) { switch ((enum options) index) { case BREAK_THEN: i++; break; case BREAK_IF: case BREAK_GLOB: case BREAK_RE: break; } } if (i == objc) breakpoint_fail("then what?"); savestr(&b->cmd,Tcl_GetString (objv[i])); } Tcl_SetObjResult (interp, Tcl_NewIntObj (b->id)); return(TCL_OK); break_fail: breakpoint_destroy(b); Tcl_SetResult(interp,error_msg,TCL_STATIC); return(TCL_ERROR); } static char *help[] = { "s [#] step into procedure", "n [#] step over procedure", "N [#] step over procedures, commands, and arguments", "c continue", "r continue until return to caller", "u [#] move scope up level", "d [#] move scope down level", " go to absolute frame if # is prefaced by \"#\"", "w show stack (\"where\")", "w -w [#] show/set width", "w -c [0|1] show/set compress", "b show breakpoints", "b [-r regexp-pattern] [if expr] [then command]", "b [-g glob-pattern] [if expr] [then command]", "b [[file:]#] [if expr] [then command]", " if pattern given, break if command resembles pattern", " if # given, break on line #", " if expr given, break if expr true", " if command given, execute command at breakpoint", "b -# delete breakpoint", "b - delete all breakpoints", 0}; /*ARGSUSED*/ static int cmdHelp(clientData, interp, objc, objv) ClientData clientData; Tcl_Interp *interp; int objc; Tcl_Obj *CONST objv[]; /* Argument objects. */ { char **hp; for (hp=help;*hp;hp++) { print(interp,"%s\n",*hp); } return(TCL_OK); } /* occasionally, we print things larger buf_max but not by much */ /* see print statements in PrintStack routines for examples */ #define PAD 80 /*VARARGS*/ static void print TCL_VARARGS_DEF(Tcl_Interp *,arg1) { Tcl_Interp *interp; char *fmt; va_list args; interp = TCL_VARARGS_START(Tcl_Interp *,arg1,args); fmt = va_arg(args,char *); if (!printproc) vprintf(fmt,args); else { static int buf_width_max = DEFAULT_WIDTH+PAD; static char buf_basic[DEFAULT_WIDTH+PAD+1]; static char *buf = buf_basic; if (buf_width+PAD > buf_width_max) { if (buf && (buf != buf_basic)) ckfree(buf); buf = (char *)ckalloc(buf_width+PAD+1); buf_width_max = buf_width+PAD; } vsprintf(buf,fmt,args); (*printproc)(interp,buf,printdata); } va_end(args); } /*ARGSUSED*/ Dbg_InterStruct Dbg_Interactor(interp,inter_proc,data) Tcl_Interp *interp; Dbg_InterProc *inter_proc; ClientData data; { Dbg_InterStruct tmp; tmp.func = interactor; tmp.data = interdata; interactor = (inter_proc?inter_proc:simple_interactor); interdata = data; return tmp; } /*ARGSUSED*/ Dbg_IgnoreFuncsProc * Dbg_IgnoreFuncs(interp,proc) Tcl_Interp *interp; Dbg_IgnoreFuncsProc *proc; { Dbg_IgnoreFuncsProc *tmp = ignoreproc; ignoreproc = (proc?proc:zero); return tmp; } /*ARGSUSED*/ Dbg_OutputStruct Dbg_Output(interp,proc,data) Tcl_Interp *interp; Dbg_OutputProc *proc; ClientData data; { Dbg_OutputStruct tmp; tmp.func = printproc; tmp.data = printdata; printproc = proc; printdata = data; return tmp; } /*ARGSUSED*/ int Dbg_Active(interp) Tcl_Interp *interp; { return debugger_active; } char ** Dbg_ArgcArgv(argc,argv,copy) int argc; char *argv[]; int copy; { char **alloc; main_argc = argc; if (!copy) { main_argv = argv; alloc = 0; } else { main_argv = alloc = (char **)ckalloc((argc+1)*sizeof(char *)); while (argc-- >= 0) { *main_argv++ = *argv++; } main_argv = alloc; } return alloc; } static struct cmd_list { char *cmdname; Tcl_ObjCmdProc *cmdproc; enum debug_cmd cmdtype; } cmd_list[] = { {"n", cmdNext, next}, {"s", cmdNext, step}, {"N", cmdNext, Next}, {"c", cmdSimple, cont}, {"r", cmdSimple, ret}, {"w", cmdWhere, none}, {"b", cmdBreak, none}, {"u", cmdDir, up}, {"d", cmdDir, down}, {"h", cmdHelp, none}, {0} }; /* this may seem excessive, but this avoids the explicit test for non-zero */ /* in the caller, and chances are that that test will always be pointless */ /*ARGSUSED*/ static int zero (Tcl_Interp *interp, char *string) { return 0; } extern int expSetBlockModeProc _ANSI_ARGS_((int fd, int mode)); static int simple_interactor(Tcl_Interp *interp, ClientData data) { int rc; char *ccmd; /* pointer to complete command */ char line[BUFSIZ+1]; /* space for partial command */ int newcmd = TRUE; Interp *iPtr = (Interp *)interp; Tcl_DString dstring; Tcl_DStringInit(&dstring); /* Force blocking if necessary */ if (stdinmode == TCL_MODE_NONBLOCKING) { expSetBlockModeProc(0, TCL_MODE_BLOCKING); } newcmd = TRUE; while (TRUE) { struct cmd_list *c; if (newcmd) { #if TCL_MAJOR_VERSION < 8 print(interp,"dbg%d.%d> ",iPtr->numLevels,iPtr->curEventNum+1); #else /* unncessarily tricky coding - if nextid isn't defined, maintain our own static version */ static int nextid = 0; CONST char *nextidstr = Tcl_GetVar2(interp,"tcl::history","nextid",0); if (nextidstr) { sscanf(nextidstr,"%d",&nextid); } print(interp,"dbg%d.%d> ",iPtr->numLevels,nextid++); #endif } else { print(interp,"dbg+> "); } fflush(stdout); rc = read(0,line,BUFSIZ); if (0 >= rc) { if (!newcmd) line[0] = 0; else exit(0); } else line[rc] = '\0'; ccmd = Tcl_DStringAppend(&dstring,line,rc); if (!Tcl_CommandComplete(ccmd)) { newcmd = FALSE; continue; /* continue collecting command */ } newcmd = TRUE; /* if user pressed return with no cmd, use previous one */ if ((ccmd[0] == '\n' || ccmd[0] == '\r') && ccmd[1] == '\0') { /* this loop is guaranteed to exit through break */ for (c = cmd_list;c->cmdname;c++) { if (c->cmdtype == last_action_cmd) break; } /* recreate textual version of command */ Tcl_DStringAppend(&dstring,c->cmdname,-1); if (c->cmdtype == step || c->cmdtype == next || c->cmdtype == Next) { char num[10]; sprintf(num," %d",last_step_count); Tcl_DStringAppend(&dstring,num,-1); } } #if TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION < 4 rc = Tcl_RecordAndEval(interp,ccmd,0); #else rc = Tcl_RecordAndEval(interp,ccmd,TCL_NO_EVAL); rc = Tcl_Eval(interp,ccmd); #endif Tcl_DStringFree(&dstring); switch (rc) { case TCL_OK: { char* res = Tcl_GetStringResult (interp); if (*res != 0) print(interp,"%s\n",res); } continue; case TCL_ERROR: print(interp,"%s\n",Tcl_GetVar(interp,"errorInfo",TCL_GLOBAL_ONLY)); /* since user is typing by hand, we expect lots of errors, and want to give another chance */ continue; case TCL_BREAK: case TCL_CONTINUE: #define finish(x) {rc = x; goto done;} finish(rc); case TCL_RETURN: finish(TCL_OK); default: /* note that ccmd has trailing newline */ print(interp,"error %d: %s\n",rc,ccmd); continue; } } /* cannot fall thru here, must jump to label */ done: Tcl_DStringFree(&dstring); /* Restore old blocking mode */ if (stdinmode == TCL_MODE_NONBLOCKING) { expSetBlockModeProc(0, TCL_MODE_NONBLOCKING); } return(rc); } static char init_auto_path[] = "lappend auto_path $dbg_library"; static void init_debugger(interp) Tcl_Interp *interp; { struct cmd_list *c; for (c = cmd_list;c->cmdname;c++) { Tcl_CreateObjCommand(interp,c->cmdname,c->cmdproc, (ClientData)&c->cmdtype,(Tcl_CmdDeleteProc *)0); } debug_handle = Tcl_CreateObjTrace(interp,10000,0, debugger_trap,(ClientData)0, NULL); debugger_active = TRUE; Tcl_SetVar2(interp,Dbg_VarName,"active","1",0); #ifdef DBG_SCRIPTDIR Tcl_SetVar(interp,"dbg_library",DBG_SCRIPTDIR,0); #endif Tcl_Eval(interp,init_auto_path); } /* allows any other part of the application to jump to the debugger */ /*ARGSUSED*/ void Dbg_On(interp,immediate) Tcl_Interp *interp; int immediate; /* if true, stop immediately */ /* should only be used in safe places */ /* i.e., when Tcl_Eval can be called */ { if (!debugger_active) init_debugger(interp); /* Initialize debugger in single-step mode. Note: if the command reader is already active, it's too late which is why we also statically initialize debug_cmd to step. */ debug_cmd = step; step_count = 1; #define LITERAL(s) Tcl_NewStringObj ((s), sizeof(s)-1) if (immediate) { Tcl_Obj* fake_cmd = LITERAL ( "--interrupted-- (command_unknown)"); Tcl_IncrRefCount (fake_cmd); debugger_trap((ClientData)0,interp,-1,Tcl_GetString (fake_cmd),0,1,&fake_cmd); /* (*interactor)(interp);*/ Tcl_DecrRefCount (fake_cmd); } } void Dbg_Off(interp) Tcl_Interp *interp; { struct cmd_list *c; if (!debugger_active) return; for (c = cmd_list;c->cmdname;c++) { Tcl_DeleteCommand(interp,c->cmdname); } Tcl_DeleteTrace(interp,debug_handle); debugger_active = FALSE; Tcl_UnsetVar(interp,Dbg_VarName,TCL_GLOBAL_ONLY); /* initialize for next use */ debug_cmd = step; step_count = 1; } /* allows any other part of the application to tell the debugger where the Tcl channel for stdin is. */ /*ARGSUSED*/ void Dbg_StdinMode(mode) int mode; { stdinmode = mode; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ expect5.45.4/exp_log.h0000664000175000017500000000426413235134350015143 0ustar pysslingpyssling/* exp_log.h */ extern void expErrorLog _ANSI_ARGS_(TCL_VARARGS(char *,fmt)); extern void expErrorLogU _ANSI_ARGS_((char *)); extern void expStdoutLog _ANSI_ARGS_(TCL_VARARGS(int,force_stdout)); extern void expStdoutLogU _ANSI_ARGS_((char *buf, int force_stdout)); EXTERN void expDiagInit _ANSI_ARGS_((void)); EXTERN int expDiagChannelOpen _ANSI_ARGS_((Tcl_Interp *,char *)); EXTERN Tcl_Channel expDiagChannelGet _ANSI_ARGS_((void)); EXTERN void expDiagChannelClose _ANSI_ARGS_((Tcl_Interp *)); EXTERN char * expDiagFilename _ANSI_ARGS_((void)); EXTERN int expDiagToStderrGet _ANSI_ARGS_((void)); EXTERN void expDiagToStderrSet _ANSI_ARGS_((int)); EXTERN void expDiagWriteBytes _ANSI_ARGS_((char *,int)); EXTERN void expDiagWriteChars _ANSI_ARGS_((char *,int)); EXTERN void expDiagWriteObj _ANSI_ARGS_((Tcl_Obj *)); EXTERN void expDiagLog _ANSI_ARGS_(TCL_VARARGS(char *,fmt)); EXTERN void expDiagLogU _ANSI_ARGS_((char *)); EXTERN char * expPrintify _ANSI_ARGS_((char *)); EXTERN char * expPrintifyUni _ANSI_ARGS_((Tcl_UniChar *,int)); EXTERN char * expPrintifyObj _ANSI_ARGS_((Tcl_Obj *)); EXTERN void expPrintf _ANSI_ARGS_(TCL_VARARGS(char *,fmt)); EXTERN void expLogInit _ANSI_ARGS_((void)); EXTERN int expLogChannelOpen _ANSI_ARGS_((Tcl_Interp *,char *,int)); EXTERN Tcl_Channel expLogChannelGet _ANSI_ARGS_((void)); EXTERN int expLogChannelSet _ANSI_ARGS_((Tcl_Interp *,char *)); EXTERN void expLogChannelClose _ANSI_ARGS_((Tcl_Interp *)); EXTERN char * expLogFilenameGet _ANSI_ARGS_((void)); EXTERN void expLogAppendSet _ANSI_ARGS_((int)); EXTERN int expLogAppendGet _ANSI_ARGS_((void)); EXTERN void expLogLeaveOpenSet _ANSI_ARGS_((int)); EXTERN int expLogLeaveOpenGet _ANSI_ARGS_((void)); EXTERN void expLogAllSet _ANSI_ARGS_((int)); EXTERN int expLogAllGet _ANSI_ARGS_((void)); EXTERN void expLogToStdoutSet _ANSI_ARGS_((int)); EXTERN int expLogToStdoutGet _ANSI_ARGS_((void)); EXTERN void expLogDiagU _ANSI_ARGS_((char *)); EXTERN int expWriteBytesAndLogIfTtyU _ANSI_ARGS_((ExpState *,Tcl_UniChar *,int)); EXTERN int expLogUserGet _ANSI_ARGS_((void)); EXTERN void expLogUserSet _ANSI_ARGS_((int)); EXTERN void expLogInteractionU _ANSI_ARGS_((ExpState *,Tcl_UniChar *,int)); expect5.45.4/expect_tcl.h0000664000175000017500000000345313235134350015637 0ustar pysslingpyssling/* expect_tcl.h - include file for using the expect library, libexpect.a with Tcl (and optionally Tk) Written by: Don Libes, libes@cme.nist.gov, NIST, 12/3/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #ifndef _EXPECT_TCL_H #define _EXPECT_TCL_H #include #include "expect_comm.h" /* * This is a convenience macro used to initialize a thread local storage ptr. * Stolen from tclInt.h */ #ifndef TCL_TSD_INIT #define TCL_TSD_INIT(keyPtr) (ThreadSpecificData *)Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData)) #endif EXTERN int exp_cmdlinecmds; EXTERN int exp_interactive; EXTERN FILE *exp_cmdfile; EXTERN char *exp_cmdfilename; EXTERN int exp_getpid; /* pid of Expect itself */ EXTERN int exp_buffer_command_input; EXTERN int exp_strict_write; EXTERN int exp_tcl_debugger_available; EXTERN Tcl_Interp *exp_interp; #define Exp_Init Expect_Init EXTERN int Expect_Init _ANSI_ARGS_((Tcl_Interp *)); /* for Tcl_AppInit apps */ EXTERN void exp_parse_argv _ANSI_ARGS_((Tcl_Interp *,int argc,char **argv)); EXTERN int exp_interpreter _ANSI_ARGS_((Tcl_Interp *,Tcl_Obj *)); EXTERN int exp_interpret_cmdfile _ANSI_ARGS_((Tcl_Interp *,FILE *)); EXTERN int exp_interpret_cmdfilename _ANSI_ARGS_((Tcl_Interp *,char *)); EXTERN void exp_interpret_rcfiles _ANSI_ARGS_((Tcl_Interp *,int my_rc,int sys_rc)); EXTERN char * exp_cook _ANSI_ARGS_((char *s,int *len)); EXTERN void expCloseOnExec _ANSI_ARGS_((int)); /* app-specific exit handler */ EXTERN void (*exp_app_exit)_ANSI_ARGS_((Tcl_Interp *)); EXTERN void exp_exit_handlers _ANSI_ARGS_((ClientData)); EXTERN void exp_error _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); #endif /* _EXPECT_TCL_H */ expect5.45.4/exp_int.h0000664000175000017500000000213713235134350015151 0ustar pysslingpyssling/* exp_int.h - private symbols common to both expect program and library Written by: Don Libes, libes@cme.nist.gov, NIST, 12/3/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #ifndef _EXPECT_INT_H #define _EXPECT_INT_H #ifndef TRUE #define FALSE 0 #define TRUE 1 #endif #ifndef HAVE_MEMCPY #define memcpy(x,y,len) bcopy(y,x,len) #endif #include void exp_console_set _ANSI_ARGS_((void)); void expDiagLogPtrSet _ANSI_ARGS_((void (*)_ANSI_ARGS_((char *)))); void expDiagLogPtr _ANSI_ARGS_((char *)); void expDiagLogPtrX _ANSI_ARGS_((char *,int)); void expDiagLogPtrStr _ANSI_ARGS_((char *,char *)); void expDiagLogPtrStrStr _ANSI_ARGS_((char *,char *,char *)); void expErrnoMsgSet _ANSI_ARGS_((char * (*) _ANSI_ARGS_((int)))); char * expErrnoMsg _ANSI_ARGS_((int)); #ifdef NO_STDLIB_H # include "../compat/stdlib.h" #else # include /* for malloc */ #endif /*NO_STDLIB_H*/ #endif /* _EXPECT_INT_H */ expect5.45.4/pty_termios.c0000664000175000017500000004753413235134350016066 0ustar pysslingpyssling/* pty_termios.c - routines to allocate ptys - termios version Written by: Don Libes, NIST, 2/6/90 This file is in the public domain. However, the author and NIST would appreciate credit if you use this file or parts of it. */ #include #include #if defined(SIGCLD) && !defined(SIGCHLD) #define SIGCHLD SIGCLD #endif #include "expect_cf.h" /* The following functions are linked from the Tcl library. They don't cause anything else in the library to be dragged in, so it shouldn't cause any problems (e.g., bloat). The functions are relatively small but painful enough that I don't care to recode them. You may, if you absolutely want to get rid of any vestiges of Tcl. */ extern char *TclGetRegError(); #if defined(HAVE_PTMX_BSD) && defined(HAVE_PTMX) /* * Some systems have both PTMX and PTMX_BSD. * In fact, alphaev56-dec-osf4.0e has /dev/pts, /dev/pty, /dev/ptym, * /dev/ptm, /dev/ptmx, and /dev/ptmx_bsd * Suggestion from Martin Buchholz is that BSD * is usually deprecated and so should be here. */ #undef HAVE_PTMX_BSD #endif /* Linux and Digital systems can be configured to have both. According to Ashley Pittman , Digital works better with openpty which supports 4000 while ptmx supports 60. */ #if defined(HAVE_OPENPTY) && defined(HAVE_PTMX) #undef HAVE_PTMX #endif #if defined(HAVE_PTYM) && defined(HAVE_PTMX) /* * HP-UX 10.0 with streams (optional) have both PTMX and PTYM. I don't * know which is preferred but seeing as how the HP trap stuff is so * unusual, it is probably safer to stick with the native HP pty support, * too. */ #undef HAVE_PTMX #endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #include #include #ifdef NO_STDLIB_H #include "../compat/stdlib.h" #else #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYSMACROS_H #include #endif #ifdef HAVE_PTYTRAP #include #endif #include #ifdef HAVE_SYS_FCNTL_H # include #else # include #endif #if defined(_SEQUENT_) # include #endif #if defined(HAVE_PTMX) && defined(HAVE_STROPTS_H) # include #endif #include "exp_win.h" #include "exp_tty_in.h" #include "exp_rename.h" #include "exp_pty.h" void expDiagLog(); void expDiagLogPtr(); #include /*extern char *sys_errlist[];*/ #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif /* Convex getpty is different than older-style getpty */ /* Convex getpty is really just a cover function that does the traversal */ /* across the domain of pty names. It makes no attempt to verify that */ /* they can actually be used. Indded, the logic in the man page is */ /* wrong because it will allow you to allocate ptys that your own account */ /* already has in use. */ #if defined(HAVE_GETPTY) && defined(CONVEX) #undef HAVE_GETPTY #define HAVE_CONVEX_GETPTY extern char *getpty(); static char *master_name; static char slave_name[] = "/dev/ptyXX"; static char *tty_bank; /* ptr to char [p-z] denoting which bank it is */ static char *tty_num; /* ptr to char [0-f] denoting which number it is */ #endif #if defined(_SEQUENT_) && !defined(HAVE_PTMX) /* old-style SEQUENT, new-style uses ptmx */ static char *master_name, *slave_name; #endif /* _SEQUENT */ /* very old SGIs prefer _getpty over ptc */ #if defined(HAVE__GETPTY) && defined(HAVE_PTC) && !defined(HAVE_GETPTY) #undef HAVE_PTC #endif #if defined(HAVE_PTC) static char slave_name[] = "/dev/ttyqXXX"; /* some machines (e.g., SVR4.0 StarServer) have all of these and */ /* HAVE_PTC works best */ #undef HAVE_GETPTY #undef HAVE__GETPTY #endif #if defined(HAVE__GETPTY) || defined(HAVE_PTC_PTS) || defined(HAVE_PTMX) static char *slave_name; #endif #if defined(HAVE_GETPTY) #include static char master_name[MAXPTYNAMELEN]; static char slave_name[MAXPTYNAMELEN]; #endif #if !defined(HAVE_GETPTY) && !defined(HAVE__GETPTY) && !defined(HAVE_PTC) && !defined(HAVE_PTC_PTS) && !defined(HAVE_PTMX) && !defined(HAVE_CONVEX_GETPTY) && !defined(_SEQUENT_) && !defined(HAVE_SCO_CLIST_PTYS) && !defined(HAVE_OPENPTY) #ifdef HAVE_PTYM /* strange order and missing d is intentional */ static char banks[] = "pqrstuvwxyzabcefghijklo"; static char master_name[] = "/dev/ptym/ptyXXXX"; static char slave_name[] = "/dev/pty/ttyXXXX"; static char *slave_bank; static char *slave_num; #else static char banks[] = "pqrstuvwxyzPQRSTUVWXYZ"; static char master_name[] = "/dev/ptyXX"; static char slave_name [] = "/dev/ttyXX"; #endif /* HAVE_PTYM */ static char *tty_type; /* ptr to char [pt] denoting whether it is a pty or tty */ static char *tty_bank; /* ptr to char [p-z] denoting which bank it is */ static char *tty_num; /* ptr to char [0-f] denoting which number it is */ #endif #if defined(HAVE_SCO_CLIST_PTYS) # define MAXPTYNAMELEN 64 static char master_name[MAXPTYNAMELEN]; static char slave_name[MAXPTYNAMELEN]; #endif /* HAVE_SCO_CLIST_PTYS */ #ifdef HAVE_OPENPTY static char master_name[64]; static char slave_name[64]; #endif char *exp_pty_slave_name; char *exp_pty_error; #if 0 static void pty_stty(s,name) char *s; /* args to stty */ char *name; /* name of pty */ { #define MAX_ARGLIST 10240 char buf[MAX_ARGLIST]; /* overkill is easier */ RETSIGTYPE (*old)(); /* save old sigalarm handler */ int pid; old = signal(SIGCHLD, SIG_DFL); switch (pid = fork()) { case 0: /* child */ exec_stty(STTY_BIN,STTY_BIN,s); break; case -1: /* fail */ default: /* parent */ waitpid(pid); break; } signal(SIGCHLD, old); /* restore signal handler */ } exec_stty(s) char *s; { char *args[50]; char *cp; int argi = 0; int quoting = FALSE; int in_token = FALSE; /* TRUE if we are reading a token */ args[0] = cp = s; while (*s) { if (quoting) { if (*s == '\\' && *(s+1) == '"') { /* quoted quote */ s++; /* get past " */ *cp++ = *s++; } else if (*s == '\"') { /* close quote */ end_token quoting = FALSE; } else *cp++ = *s++; /* suck up anything */ } else if (*s == '\"') { /* open quote */ in_token = TRUE; quoting = TRUE; s++; } else if (isspace(*s)) { end_token } else { *cp++ = *s++; in_token = TRUE; } } end_token args[argi] = (char *) 0; /* terminate argv */ execvp(args[0],args); } #endif /*0*/ static void pty_stty(s,name) char *s; /* args to stty */ char *name; /* name of pty */ { #define MAX_ARGLIST 10240 char buf[MAX_ARGLIST]; /* overkill is easier */ RETSIGTYPE (*old)(); /* save old sigalarm handler */ #ifdef STTY_READS_STDOUT sprintf(buf,"%s %s > %s",STTY_BIN,s,name); #else sprintf(buf,"%s %s < %s",STTY_BIN,s,name); #endif old = signal(SIGCHLD, SIG_DFL); system(buf); signal(SIGCHLD, old); /* restore signal handler */ } int exp_dev_tty; /* file descriptor to /dev/tty or -1 if none */ static int knew_dev_tty;/* true if we had our hands on /dev/tty at any time */ exp_tty exp_tty_original; #define GET_TTYTYPE 0 #define SET_TTYTYPE 1 static void ttytype(request,fd,ttycopy,ttyinit,s) int request; int fd; /* following are used only if request == SET_TTYTYPE */ int ttycopy; /* true/false, copy from /dev/tty */ int ttyinit; /* if true, initialize to sane state */ char *s; /* stty args */ { if (request == GET_TTYTYPE) { #ifdef HAVE_TCSETATTR if (-1 == tcgetattr(fd, &exp_tty_original)) { #else if (-1 == ioctl(fd, TCGETS, (char *)&exp_tty_original)) { #endif knew_dev_tty = FALSE; exp_dev_tty = -1; } exp_window_size_get(fd); } else { /* type == SET_TTYTYPE */ if (ttycopy && knew_dev_tty) { #ifdef HAVE_TCSETATTR (void) tcsetattr(fd, TCSADRAIN, &exp_tty_current); #else (void) ioctl(fd, TCSETS, (char *)&exp_tty_current); #endif exp_window_size_set(fd); } #ifdef __CENTERLINE__ #undef DFLT_STTY #define DFLT_STTY "sane" #endif /* Apollo Domain doesn't need this */ #ifdef DFLT_STTY if (ttyinit) { /* overlay parms originally supplied by Makefile */ /* As long as BSD stty insists on stdout == stderr, we can no longer write */ /* diagnostics to parent stderr, since stderr has is now child's */ /* Maybe someday they will fix stty? */ /* expDiagLogPtrStr("exp_getptyslave: (default) stty %s\n",DFLT_STTY);*/ pty_stty(DFLT_STTY,slave_name); } #endif /* lastly, give user chance to override any terminal parms */ if (s) { /* give user a chance to override any terminal parms */ /* expDiagLogPtrStr("exp_getptyslave: (user-requested) stty %s\n",s);*/ pty_stty(s,slave_name); } } } void exp_init_pty() { #if !defined(HAVE_GETPTY) && !defined(HAVE__GETPTY) && !defined(HAVE_PTC) && !defined(HAVE_PTC_PTS) && !defined(HAVE_PTMX) && !defined(HAVE_CONVEX_GETPTY) && !defined(_SEQUENT_) && !defined(HAVE_SCO_CLIST_PTYS) && !defined(HAVE_OPENPTY) #ifdef HAVE_PTYM static char dummy; tty_bank = &master_name[strlen("/dev/ptym/pty")]; tty_num = &master_name[strlen("/dev/ptym/ptyX")]; slave_bank = &slave_name[strlen("/dev/pty/tty")]; slave_num = &slave_name[strlen("/dev/pty/ttyX")]; #else tty_bank = &master_name[strlen("/dev/pty")]; tty_num = &master_name[strlen("/dev/ptyp")]; tty_type = &slave_name[strlen("/dev/")]; #endif #endif /* HAVE_PTYM */ exp_dev_tty = open("/dev/tty",O_RDWR); knew_dev_tty = (exp_dev_tty != -1); if (knew_dev_tty) ttytype(GET_TTYTYPE,exp_dev_tty,0,0,(char *)0); } #ifndef R_OK /* 3b2 doesn't define these according to jthomas@nmsu.edu. */ #define R_OK 04 #define W_OK 02 #endif int exp_getptymaster() { char *hex, *bank; struct stat stat_buf; int master = -1; int slave = -1; int num; exp_pty_error = 0; #define TEST_PTY 1 #if defined(HAVE_PTMX) || defined(HAVE_PTMX_BSD) #undef TEST_PTY #if defined(HAVE_PTMX_BSD) if ((master = open("/dev/ptmx_bsd", O_RDWR)) == -1) return(-1); #else if ((master = open("/dev/ptmx", O_RDWR)) == -1) return(-1); #endif if ((slave_name = (char *)ptsname(master)) == NULL) { close(master); return(-1); } if (grantpt(master)) { static char buf[500]; exp_pty_error = buf; sprintf(exp_pty_error,"grantpt(%s) failed - likely reason is that your system administrator (in a rage of blind passion to rid the system of security holes) removed setuid from the utility used internally by grantpt to change pty permissions. Tell your system admin to reestablish setuid on the utility. Get the utility name by running Expect under truss or trace.", expErrnoMsg(errno)); close(master); return(-1); } if (-1 == (int)unlockpt(master)) { static char buf[500]; exp_pty_error = buf; sprintf(exp_pty_error,"unlockpt(%s) failed.", expErrnoMsg(errno)); close(master); return(-1); } #ifdef TIOCFLUSH (void) ioctl(master,TIOCFLUSH,(char *)0); #endif /* TIOCFLUSH */ exp_pty_slave_name = slave_name; return(master); #endif #if defined(HAVE__GETPTY) /* SGI needs it this way */ #undef TEST_PTY slave_name = _getpty(&master, O_RDWR, 0600, 0); if (slave_name == NULL) return (-1); exp_pty_slave_name = slave_name; return(master); #endif #if defined(HAVE_PTC) && !defined(HAVE__GETPTY) /* old SGI, version 3 */ #undef TEST_PTY master = open("/dev/ptc", O_RDWR); if (master >= 0) { int ptynum; if (fstat(master, &stat_buf) < 0) { close(master); return(-1); } ptynum = minor(stat_buf.st_rdev); sprintf(slave_name,"/dev/ttyq%d",ptynum); } exp_pty_slave_name = slave_name; return(master); #endif #if defined(HAVE_GETPTY) && !defined(HAVE__GETPTY) #undef TEST_PTY master = getpty(master_name, slave_name, O_RDWR); /* is it really necessary to verify slave side is usable? */ exp_pty_slave_name = slave_name; return master; #endif #if defined(HAVE_PTC_PTS) #undef TEST_PTY master = open("/dev/ptc",O_RDWR); if (master >= 0) { /* never fails */ slave_name = ttyname(master); } exp_pty_slave_name = slave_name; return(master); #endif #if defined(_SEQUENT_) && !defined(HAVE_PTMX) #undef TEST_PTY /* old-style SEQUENT, new-style uses ptmx */ master = getpseudotty(&slave_name, &master_name); exp_pty_slave_name = slave_name; return(master); #endif /* _SEQUENT_ */ #if defined(HAVE_OPENPTY) #undef TEST_PTY if (openpty(&master, &slave, master_name, 0, 0) != 0) { close(master); close(slave); return -1; } strcpy(slave_name, ttyname(slave)); exp_pty_slave_name = slave_name; close(slave); return master; #endif /* HAVE_OPENPTY */ #if defined(TEST_PTY) /* * all pty allocation mechanisms after this require testing */ if (exp_pty_test_start() == -1) return -1; #if !defined(HAVE_CONVEX_GETPTY) && !defined(HAVE_PTYM) && !defined(HAVE_SCO_CLIST_PTYS) for (bank = banks;*bank;bank++) { *tty_bank = *bank; *tty_num = '0'; if (stat(master_name, &stat_buf) < 0) break; for (hex = "0123456789abcdef";*hex;hex++) { *tty_num = *hex; strcpy(slave_name,master_name); *tty_type = 't'; master = exp_pty_test(master_name,slave_name,*tty_bank,tty_num); if (master >= 0) goto done; } } #endif #ifdef HAVE_SCO_CLIST_PTYS for (num = 0; ; num++) { char num_str [16]; sprintf (num_str, "%d", num); sprintf (master_name, "%s%s", "/dev/ptyp", num_str); if (stat (master_name, &stat_buf) < 0) break; sprintf (slave_name, "%s%s", "/dev/ttyp", num_str); master = exp_pty_test(master_name,slave_name,'0',num_str); if (master >= 0) goto done; } #endif #ifdef HAVE_PTYM /* systems with PTYM follow this idea: /dev/ptym/pty[a-ce-z][0-9a-f] master pseudo terminals /dev/pty/tty[a-ce-z][0-9a-f] slave pseudo terminals /dev/ptym/pty[a-ce-z][0-9][0-9] master pseudo terminals /dev/pty/tty[a-ce-z][0-9][0-9] slave pseudo terminals SPPUX (Convex's HPUX compatible) follows the PTYM convention but extends it: /dev/ptym/pty[a-ce-z][0-9][0-9][0-9] master pseudo terminals /dev/pty/tty[a-ce-z][0-9][0-9][0-9] slave pseudo terminals The code does not distinguish between HPUX and SPPUX because there is no reason to. HPUX will merely fail the extended SPPUX tests. In fact, most SPPUX systems will fail simply because few systems will actually have the extended ptys. However, the tests are fast so it is no big deal. */ /* * pty[a-ce-z][0-9a-f] */ for (bank = banks;*bank;bank++) { *tty_bank = *bank; sprintf(tty_num,"0"); if (stat(master_name, &stat_buf) < 0) break; *(slave_num+1) = '\0'; for (hex = "0123456789abcdef";*hex;hex++) { *tty_num = *hex; *slave_bank = *tty_bank; *slave_num = *tty_num; master = exp_pty_test(master_name,slave_name,*tty_bank,tty_num); if (master >= 0) goto done; } } /* * tty[p-za-ce-o][0-9][0-9] */ for (bank = banks;*bank;bank++) { *tty_bank = *bank; sprintf(tty_num,"00"); if (stat(master_name, &stat_buf) < 0) break; for (num = 0; num<100; num++) { *slave_bank = *tty_bank; sprintf(tty_num,"%02d",num); strcpy(slave_num,tty_num); master = exp_pty_test(master_name,slave_name,*tty_bank,tty_num); if (master >= 0) goto done; } } /* * tty[p-za-ce-o][0-9][0-9][0-9] */ for (bank = banks;*bank;bank++) { *tty_bank = *bank; sprintf(tty_num,"000"); if (stat(master_name, &stat_buf) < 0) break; for (num = 0; num<1000; num++) { *slave_bank = *tty_bank; sprintf(tty_num,"%03d",num); strcpy(slave_num,tty_num); master = exp_pty_test(master_name,slave_name,*tty_bank,tty_num); if (master >= 0) goto done; } } #endif /* HAVE_PTYM */ #if defined(HAVE_CONVEX_GETPTY) for (;;) { if ((master_name = getpty()) == NULL) return -1; strcpy(slave_name,master_name); slave_name[5] = 't';/* /dev/ptyXY ==> /dev/ttyXY */ tty_bank = &slave_name[8]; tty_num = &slave_name[9]; master = exp_pty_test(master_name,slave_name,*tty_bank,tty_num); if (master >= 0) goto done; } #endif done: exp_pty_test_end(); exp_pty_slave_name = slave_name; return(master); #endif /* defined(TEST_PTY) */ } /* if slave is opened in a child, slave_control(1) must be executed after */ /* master is opened (when child is opened is irrelevent) */ /* if slave is opened in same proc as master, slave_control(1) must executed */ /* after slave is opened */ /*ARGSUSED*/ void exp_slave_control(master,control) int master; int control; /* if 1, enable pty trapping of close/open/ioctl */ { #ifdef HAVE_PTYTRAP ioctl(master, TIOCTRAP, &control); #endif /* HAVE_PTYTRAP */ } int exp_getptyslave( int ttycopy, int ttyinit, CONST char *stty_args) { int slave, slave2; char buf[10240]; if (0 > (slave = open(slave_name, O_RDWR))) { static char buf[500]; exp_pty_error = buf; sprintf(exp_pty_error,"open(%s,rw) = %d (%s)",slave_name,slave,expErrnoMsg(errno)); return(-1); } #if defined(HAVE_PTMX_BSD) if (ioctl (slave, I_LOOK, buf) != 0) if (ioctl (slave, I_PUSH, "ldterm")) { expDiagLogPtrStrStr("ioctl(%d,I_PUSH,\"ldterm\") = %s\n",slave,expErrnoMsg(errno)); } #else #if defined(HAVE_PTMX) if (ioctl(slave, I_PUSH, "ptem")) { expDiagLogPtrStrStr("ioctl(%d,I_PUSH,\"ptem\") = %s\n",slave,expErrnoMsg(errno)); } if (ioctl(slave, I_PUSH, "ldterm")) { expDiagLogPtrStrStr("ioctl(%d,I_PUSH,\"ldterm\") = %s\n",slave,expErrnoMsg(errno)); } if (ioctl(slave, I_PUSH, "ttcompat")) { expDiagLogPtrStrStr("ioctl(%d,I_PUSH,\"ttcompat\") = %s\n",slave,expErrnoMsg(errno)); } #endif #endif if (0 == slave) { /* if opened in a new process, slave will be 0 (and */ /* ultimately, 1 and 2 as well) */ /* duplicate 0 onto 1 and 2 to prepare for stty */ fcntl(0,F_DUPFD,1); fcntl(0,F_DUPFD,2); } ttytype(SET_TTYTYPE,slave,ttycopy,ttyinit,stty_args); #if 0 #ifdef HAVE_PTYTRAP /* do another open, to tell master that slave is done fiddling */ /* with pty and master does not have to wait to do further acks */ if (0 > (slave2 = open(slave_name, O_RDWR))) return(-1); close(slave2); #endif /* HAVE_PTYTRAP */ #endif (void) exp_pty_unlock(); return(slave); } #ifdef HAVE_PTYTRAP #include #include /* This function attempts to deal with HP's pty interface. This function simply returns an indication of what was trapped (or -1 for failure), the parent deals with the details. Originally, I tried to just trap open's but that is not enough. When the pty is initialized, ioctl's are generated and if not trapped will hang the child if no further trapping is done. (This could occur if parent spawns a process and then immediatley does a close.) So instead, the parent must trap the ioctl's. It probably suffices to trap the write ioctl's (and tiocsctty which some hp's need) - conceivably, stty could be smart enough not to do write's if the tty settings are already correct. In that case, we'll have to rethink this. Suggestions from HP engineers encouraged. I cannot imagine how this interface was intended to be used! */ int exp_wait_for_slave_open(fd) int fd; { fd_set excep; struct timeval t; struct request_info ioctl_info; int rc; int found = 0; int maxfds = sysconf(_SC_OPEN_MAX); t.tv_sec = 30; /* 30 seconds */ t.tv_usec = 0; FD_ZERO(&excep); FD_SET(fd,&excep); rc = select(maxfds, (SELECT_MASK_TYPE *)0, (SELECT_MASK_TYPE *)0, (SELECT_MASK_TYPE *)&excep, &t); if (rc != 1) { expDiagLogPtrStr("spawned process never started: %s\r\n",expErrnoMsg(errno)); return(-1); } if (ioctl(fd,TIOCREQCHECK,&ioctl_info) < 0) { expDiagLogPtrStr("ioctl(TIOCREQCHECK) failed: %s\r\n",expErrnoMsg(errno)); return(-1); } found = ioctl_info.request; expDiagLogPtrX("trapped pty op = %x",found); if (found == TIOCOPEN) { expDiagLogPtr(" TIOCOPEN"); } else if (found == TIOCCLOSE) { expDiagLogPtr(" TIOCCLOSE"); } #ifdef TIOCSCTTY if (found == TIOCSCTTY) { expDiagLogPtr(" TIOCSCTTY"); } #endif if (found & IOC_IN) { expDiagLogPtr(" IOC_IN (set)"); } else if (found & IOC_OUT) { expDiagLogPtr(" IOC_OUT (get)"); } expDiagLogPtr("\n"); if (ioctl(fd, TIOCREQSET, &ioctl_info) < 0) { expDiagLogPtrStr("ioctl(TIOCREQSET) failed: %s\r\n",expErrnoMsg(errno)); return(-1); } return(found); } #endif void exp_pty_exit() { /* a stub so we can do weird things on the cray */ } expect5.45.4/configure0000775000175000017500000116730013235561756015264 0ustar pysslingpyssling#! /bin/sh # From configure.in Id: configure.in. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for expect 5.45.4. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='expect' PACKAGE_TARNAME='expect' PACKAGE_VERSION='5.45.4' PACKAGE_STRING='expect 5.45.4' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" enable_option_checking=no ac_subst_vars='LTLIBOBJS LIBOBJS TCLSH_PROG VC_MANIFEST_EMBED_EXE VC_MANIFEST_EMBED_DLL RANLIB_STUB MAKE_STUB_LIB MAKE_STATIC_LIB MAKE_SHARED_LIB MAKE_LIB PKG_OBJECTS PKG_SOURCES TCL_CC_SEARCH_FLAGS TCL_DL_LIBS DEFAULT_STTY_ARGS SETPGRP_VOID SETUID EXP_CC_SEARCH_FLAGS EXP_BUILD_LIB_SPEC subdirs target_os target_vendor target_cpu target host_os host_vendor host_cpu host build_os build_vendor build_cpu build TCL_DBGX LDFLAGS_DEFAULT CFLAGS_DEFAULT LD_LIBRARY_PATH_VAR SHLIB_CFLAGS SHLIB_LD_LIBS SHLIB_LD STLIB_LD CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG CELIB_DIR AR SHARED_BUILD TCL_THREADS TCL_TOP_DIR_NATIVE TCL_INCLUDES MATH_LIBS EGREP GREP RANLIB SET_MAKE INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CPP OBJEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC TCL_SHLIB_LD_LIBS TCL_LD_FLAGS TCL_EXTRA_CFLAGS TCL_DEFS TCL_LIBS CLEANFILES TCL_STUB_LIB_SPEC TCL_STUB_LIB_FLAG TCL_STUB_LIB_FILE TCL_LIB_SPEC TCL_LIB_FLAG TCL_LIB_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_PATCH_LEVEL TCL_VERSION PKG_CFLAGS PKG_LIBS PKG_INCLUDES PKG_HEADERS PKG_TCL_SOURCES PKG_STUB_OBJECTS PKG_STUB_SOURCES PKG_STUB_LIB_FILE PKG_LIB_FILE EXEEXT CYGPATH target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_tcl with_tclinclude enable_threads enable_shared enable_64bit enable_64bit_vis enable_rpath enable_wince with_celib enable_symbols ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' ac_subdirs_all='testsuite' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures expect 5.45.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/expect] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of expect 5.45.4:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-threads build with threads --enable-shared build and link with shared libraries (default: on) --enable-64bit enable 64bit support (default: off) --enable-64bit-vis enable 64bit Sparc VIS support (default: off) --disable-rpath disable rpath support (default: on) --enable-wince enable Win/CE support (where applicable) --enable-symbols build with debugging symbols (default: off) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) --with-tclinclude directory containing the public Tcl header files --with-celib=DIR use Windows/CE support library from DIR Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF expect configure 5.45.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by expect $as_me 5.45.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # TEA extensions pass this us the version of TEA they think they # are compatible with. TEA_VERSION="3.9" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5 $as_echo_n "checking for correct TEA configuration... " >&6; } if test x"${PACKAGE_NAME}" = x ; then as_fn_error $? " The PACKAGE_NAME variable must be defined by your TEA configure.in" "$LINENO" 5 fi if test x"3.9" = x ; then as_fn_error $? " TEA version not specified." "$LINENO" 5 elif test "3.9" != "${TEA_VERSION}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&5 $as_echo "warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5 $as_echo "ok (TEA ${TEA_VERSION})" >&6; } fi case "`uname -s`" in *win32*|*WIN32*|*MINGW32_*) # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CYGPATH+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CYGPATH"; then ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CYGPATH="cygpath -w" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" fi fi CYGPATH=$ac_cv_prog_CYGPATH if test -n "$CYGPATH"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5 $as_echo "$CYGPATH" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi EXEEXT=".exe" TEA_PLATFORM="windows" ;; *CYGWIN_*) CYGPATH=echo EXEEXT=".exe" # TEA_PLATFORM is determined later in LOAD_TCLCONFIG ;; *) CYGPATH=echo EXEEXT="" TEA_PLATFORM="unix" ;; esac # Check if exec_prefix is set. If not use fall back to prefix. # Note when adjusted, so that TEA_PREFIX can correct for this. # This is needed for recursive configures, since autoconf propagates # $prefix, but not $exec_prefix (doh!). if test x$exec_prefix = xNONE ; then exec_prefix_default=yes exec_prefix=$prefix fi { $as_echo "$as_me:${as_lineno-$LINENO}: configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}" >&5 $as_echo "$as_me: configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}" >&6;} # This package name must be replaced statically for AC_SUBST to work # Substitute STUB_LIB_FILE in case package creates a stub library too. # We AC_SUBST these here to ensure they are subst'ed, # in case the user doesn't call TEA_ADD_... ac_aux_dir= for ac_dir in tclconfig "$srcdir"/tclconfig; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in tclconfig \"$srcdir\"/tclconfig" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. #-------------------------------------------------------------------- # Configure script for package 'Expect'. # TEA compliant. #-------------------------------------------------------------------- #-------------------------------------------------------------------- # Load the tclConfig.sh file #-------------------------------------------------------------------- # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl was given. if test "${with_tcl+set}" = set; then : withval=$with_tcl; with_tclconfig="${withval}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5 $as_echo_n "checking for Tcl configuration... " >&6; } if ${ac_cv_c_tclconfig+:} false; then : $as_echo_n "(cached) " >&6 else # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case "${with_tclconfig}" in */tclConfig.sh ) if test -f "${with_tclconfig}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5 $as_echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;} with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`" fi ;; esac if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`" else as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5 fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ ../../tcl \ `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ ../../../tcl \ `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do if test "${TEA_PLATFORM}" = "windows" \ -a -f "$i/win/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/win; pwd)`" break fi if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/unix; pwd)`" break fi done fi # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`" break fi done fi # TEA specific: on Windows, check in common installation locations if test "${TEA_PLATFORM}" = "windows" \ -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d C:/Tcl/lib 2>/dev/null` \ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi # check in a few other private locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test "${TEA_PLATFORM}" = "windows" \ -a -f "$i/win/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/win; pwd)`" break fi if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/unix; pwd)`" break fi done fi fi if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" as_fn_error $? "Can't find Tcl configuration definitions" "$LINENO" 5 else no_tcl= TCL_BIN_DIR="${ac_cv_c_tclconfig}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5 $as_echo "found ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5 $as_echo_n "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... " >&6; } if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5 $as_echo "loading" >&6; } . "${TCL_BIN_DIR}/tclConfig.sh" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 $as_echo "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. if test -f "${TCL_BIN_DIR}/Makefile" ; then TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}" TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}" TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}" elif test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works # against Tcl.framework installed in an arbitrary location. case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then for i in "`cd "${TCL_BIN_DIR}"; pwd`" \ "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}" break fi done fi if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}" TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}" fi ;; esac fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" case "`uname -s`" in *CYGWIN_*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cygwin variant" >&5 $as_echo_n "checking for cygwin variant... " >&6; } case ${TCL_EXTRA_CFLAGS} in *-mwin32*|*-mno-cygwin*) TEA_PLATFORM="windows" CFLAGS="$CFLAGS -mwin32" { $as_echo "$as_me:${as_lineno-$LINENO}: result: win32" >&5 $as_echo "win32" >&6; } ;; *) TEA_PLATFORM="unix" { $as_echo "$as_me:${as_lineno-$LINENO}: result: unix" >&5 $as_echo "unix" >&6; } ;; esac EXEEXT=".exe" ;; *) ;; esac # The BUILD_$pkg is to define the correct extern storage class # handling when making this package cat >>confdefs.h <<_ACEOF #define BUILD_${PACKAGE_NAME} /**/ _ACEOF # Do this here as we have fully defined TEA_PLATFORM now if test "${TEA_PLATFORM}" = "windows" ; then CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp" fi # TEA specific: # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: With Tk request ignored - use package require Tk & Expect" >&5 $as_echo "$as_me: WARNING: With Tk request ignored - use package require Tk & Expect" >&2;} fi #----------------------------------------------------------------------- # Handle the --prefix=... option by defaulting to what Tcl gave. # Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. #----------------------------------------------------------------------- if test "${prefix}" = "NONE"; then prefix_default=yes if test x"${TCL_PREFIX}" != x; then { $as_echo "$as_me:${as_lineno-$LINENO}: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&5 $as_echo "$as_me: --prefix defaulting to TCL_PREFIX ${TCL_PREFIX}" >&6;} prefix=${TCL_PREFIX} else { $as_echo "$as_me:${as_lineno-$LINENO}: --prefix defaulting to /usr/local" >&5 $as_echo "$as_me: --prefix defaulting to /usr/local" >&6;} prefix=/usr/local fi fi if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \ -o x"${exec_prefix_default}" = x"yes" ; then if test x"${TCL_EXEC_PREFIX}" != x; then { $as_echo "$as_me:${as_lineno-$LINENO}: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&5 $as_echo "$as_me: --exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}" >&6;} exec_prefix=${TCL_EXEC_PREFIX} else { $as_echo "$as_me:${as_lineno-$LINENO}: --exec-prefix defaulting to ${prefix}" >&5 $as_echo "$as_me: --exec-prefix defaulting to ${prefix}" >&6;} exec_prefix=$prefix fi fi #----------------------------------------------------------------------- # 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. #----------------------------------------------------------------------- # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) # in this macro, they need to go into TEA_SETUP_COMPILER instead. # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu #-------------------------------------------------------------------- # Checks to see if the make program sets the $MAKE variable. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi #-------------------------------------------------------------------- # Find ranlib #-------------------------------------------------------------------- if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. #------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" -a -n "$GCC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -pipe" >&5 $as_echo_n "checking if the compiler understands -pipe... " >&6; } if ${tcl_cv_cc_pipe+:} false; then : $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_cc_pipe=yes else tcl_cv_cc_pipe=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$hold_cflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_pipe" >&5 $as_echo "$tcl_cv_cc_pipe" >&6; } if test $tcl_cv_cc_pipe = yes; then CFLAGS="$CFLAGS -pipe" fi fi #-------------------------------------------------------------------- # Common compiler flag setup #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac if test "${TEA_PLATFORM}" = "unix" ; then #-------------------------------------------------------------------- # On a few very rare systems, all of the libm.a stuff is # already in libc.a. Set compiler flags accordingly. # Also, Linux requires the "ieee" library for math to work # right (and it must appear before "-lm"). #-------------------------------------------------------------------- ac_fn_c_check_func "$LINENO" "sin" "ac_cv_func_sin" if test "x$ac_cv_func_sin" = xyes; then : MATH_LIBS="" else MATH_LIBS="-lm" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lieee" >&5 $as_echo_n "checking for main in -lieee... " >&6; } if ${ac_cv_lib_ieee_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lieee $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ieee_main=yes else ac_cv_lib_ieee_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee_main" >&5 $as_echo "$ac_cv_lib_ieee_main" >&6; } if test "x$ac_cv_lib_ieee_main" = xyes; then : MATH_LIBS="-lieee $MATH_LIBS" fi #-------------------------------------------------------------------- # Interactive UNIX requires -linet instead of -lsocket, plus it # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -linet" >&5 $as_echo_n "checking for main in -linet... " >&6; } if ${ac_cv_lib_inet_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet_main=yes else ac_cv_lib_inet_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_main" >&5 $as_echo "$ac_cv_lib_inet_main" >&6; } if test "x$ac_cv_lib_inet_main" = xyes; then : LIBS="$LIBS -linet" fi ac_fn_c_check_header_mongrel "$LINENO" "net/errno.h" "ac_cv_header_net_errno_h" "$ac_includes_default" if test "x$ac_cv_header_net_errno_h" = xyes; then : $as_echo "#define HAVE_NET_ERRNO_H 1" >>confdefs.h fi #-------------------------------------------------------------------- # Check for the existence of the -lsocket and -lnsl libraries. # The order here is important, so that they end up in the right # order in the command line generated by make. Here are some # special considerations: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- tcl_checkBoth=0 ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" if test "x$ac_cv_func_connect" = xyes; then : tcl_checkSocket=0 else tcl_checkSocket=1 fi if test "$tcl_checkSocket" = 1; then ac_fn_c_check_func "$LINENO" "setsockopt" "ac_cv_func_setsockopt" if test "x$ac_cv_func_setsockopt" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setsockopt in -lsocket" >&5 $as_echo_n "checking for setsockopt in -lsocket... " >&6; } if ${ac_cv_lib_socket_setsockopt+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char setsockopt (); int main () { return setsockopt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_setsockopt=yes else ac_cv_lib_socket_setsockopt=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_setsockopt" >&5 $as_echo "$ac_cv_lib_socket_setsockopt" >&6; } if test "x$ac_cv_lib_socket_setsockopt" = xyes; then : LIBS="$LIBS -lsocket" else tcl_checkBoth=1 fi fi fi if test "$tcl_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept" if test "x$ac_cv_func_accept" = xyes; then : tcl_checkNsl=0 else LIBS=$tk_oldLibs fi fi ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : LIBS="$LIBS -lnsl" fi fi # TEA specific: Don't perform the eval of the libraries here because # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking dirent.h" >&5 $as_echo_n "checking dirent.h... " >&6; } if ${tcl_cv_dirent_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #ifndef _POSIX_SOURCE # ifdef __Lynx__ /* * Generate compilation error to make the test fail: Lynx headers * are only valid if really in the POSIX environment. */ missing_procedure(); # endif #endif DIR *d; struct dirent *entryPtr; char *p; d = opendir("foobar"); entryPtr = readdir(d); p = entryPtr->d_name; closedir(d); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_dirent_h=yes else tcl_cv_dirent_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_dirent_h" >&5 $as_echo "$tcl_cv_dirent_h" >&6; } if test $tcl_cv_dirent_h = no; then $as_echo "#define NO_DIRENT_H 1" >>confdefs.h fi # TEA specific: ac_fn_c_check_header_mongrel "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default" if test "x$ac_cv_header_errno_h" = xyes; then : else $as_echo "#define NO_ERRNO_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" if test "x$ac_cv_header_float_h" = xyes; then : else $as_echo "#define NO_FLOAT_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default" if test "x$ac_cv_header_values_h" = xyes; then : else $as_echo "#define NO_VALUES_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" if test "x$ac_cv_header_limits_h" = xyes; then : $as_echo "#define HAVE_LIMITS_H 1" >>confdefs.h else $as_echo "#define NO_LIMITS_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : tcl_ok=1 else tcl_ok=0 fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtol" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtoul" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtod" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* if test $tcl_ok = 0; then $as_echo "#define NO_STDLIB_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes; then : tcl_ok=1 else tcl_ok=0 fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strstr" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strerror" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* # See also memmove check below for a place where NO_STRING_H can be # set and why. if test $tcl_ok = 0; then $as_echo "#define NO_STRING_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default" if test "x$ac_cv_header_sys_wait_h" = xyes; then : else $as_echo "#define NO_SYS_WAIT_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" if test "x$ac_cv_header_dlfcn_h" = xyes; then : else $as_echo "#define NO_DLFCN_H 1" >>confdefs.h fi # OS/390 lacks sys/param.h (and doesn't need it, by chance). for ac_header in sys/param.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" if test "x$ac_cv_header_sys_param_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_PARAM_H 1 _ACEOF fi done # Let the user call this, because if it triggers, they will # need a compat/strtod.c that is correct. Users can also # use Tcl_GetDouble(FromObj) instead. #TEA_BUGGY_STRTOD fi #-------------------------------------------------------------------- # __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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl public headers" >&5 $as_echo_n "checking for Tcl public headers... " >&6; } # Check whether --with-tclinclude was given. if test "${with_tclinclude+set}" = set; then : withval=$with_tclinclude; with_tclinclude=${withval} fi if ${ac_cv_c_tclh+:} false; then : $as_echo_n "(cached) " >&6 else # Use the value from --with-tclinclude, if it was given if test x"${with_tclinclude}" != x ; then if test -f "${with_tclinclude}/tcl.h" ; then ac_cv_c_tclh=${with_tclinclude} else as_fn_error $? "${with_tclinclude} directory does not contain tcl.h" "$LINENO" 5 fi else list="" if test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use # the framework's Headers directory case ${TCL_DEFS} in *TCL_FRAMEWORK*) list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`" ;; esac fi # Look in the source dir only if Tcl is not installed, # and in that situation, look there before installed locations. if test -f "${TCL_BIN_DIR}/Makefile" ; then list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`" fi # Check order: pkg --prefix location, Tcl's --prefix location, # relative to directory of tclConfig.sh. eval "temp_includedir=${includedir}" list="$list \ `ls -d ${temp_includedir} 2>/dev/null` \ `ls -d ${TCL_PREFIX}/include 2>/dev/null` \ `ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`" if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then list="$list /usr/local/include /usr/include" if test x"${TCL_INCLUDE_SPEC}" != x ; then d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'` list="$list `ls -d ${d} 2>/dev/null`" fi fi for i in $list ; do if test -f "$i/tcl.h" ; then ac_cv_c_tclh=$i break fi done fi fi # Print a message based on how we determined the include path if test x"${ac_cv_c_tclh}" = x ; then as_fn_error $? "tcl.h not found. Please specify its location with --with-tclinclude" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclh}" >&5 $as_echo "${ac_cv_c_tclh}" >&6; } fi # Convert to a native path and substitute into the output files. INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}` TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\" # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl private include files" >&5 $as_echo_n "checking for Tcl private include files... " >&6; } TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}` TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\" # Check to see if tclPort.h isn't already with the public headers # Don't look for tclInt.h because that resides with tcl.h in the core # sources, but the Port headers are in a different directory if test "${TEA_PLATFORM}" = "windows" -a \ -f "${ac_cv_c_tclh}/tclWinPort.h"; then result="private headers found with public headers" elif test "${TEA_PLATFORM}" = "unix" -a \ -f "${ac_cv_c_tclh}/tclUnixPort.h"; then result="private headers found with public headers" else TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\" if test "${TEA_PLATFORM}" = "windows"; then TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\" else TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\" fi # Overwrite the previous TCL_INCLUDES as this should capture both # public and private headers in the same set. # We want to ensure these are substituted so as not to require # any *_NATIVE vars be defined in the Makefile TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}" if test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use # the framework's Headers and PrivateHeaders directories case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -d "${TCL_BIN_DIR}/Headers"; then if test -d "${TCL_BIN_DIR}/PrivateHeaders"; then TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}" elif test -d "${TCL_BIN_DIR}/Headers/tcl-private"; then TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/Headers/tcl-private\" ${TCL_INCLUDES}" fi else TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`" fi ;; esac result="Using ${TCL_INCLUDES}" else if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then as_fn_error $? "Cannot find private header tclInt.h in ${TCL_SRC_DIR}" "$LINENO" 5 fi result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${result}" >&5 $as_echo "${result}" >&6; } #-------------------------------------------------------------------- # 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. #-------------------------------------------------------------------- CLEANFILES="$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. #------------------------------------------------------------------------ # Check whether --enable-threads was given. if test "${enable_threads+set}" = set; then : enableval=$enable_threads; tcl_ok=$enableval else tcl_ok=yes fi if test "${enable_threads+set}" = set; then enableval="$enable_threads" tcl_ok=$enableval else tcl_ok=yes fi if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then TCL_THREADS=1 if test "${TEA_PLATFORM}" != "windows" ; then # We are always OK on Windows, so check what this platform wants: # USE_THREAD_ALLOC tells us to try the special thread-based # allocator that significantly reduces lock contention $as_echo "#define USE_THREAD_ALLOC 1" >>confdefs.h $as_echo "#define _REENTRANT 1" >>confdefs.h if test "`uname -s`" = "SunOS" ; then $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h fi $as_echo "#define _THREAD_SAFE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthread" >&5 $as_echo_n "checking for pthread_mutex_init in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_mutex_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_mutex_init (); int main () { return pthread_mutex_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_mutex_init=yes else ac_cv_lib_pthread_pthread_mutex_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 $as_echo "$ac_cv_lib_pthread_pthread_mutex_init" >&6; } if test "x$ac_cv_lib_pthread_pthread_mutex_init" = xyes; then : tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = "no"; then # Check a little harder for __pthread_mutex_init in the same # library, as some systems hide it there until pthread.h is # defined. We could alternatively do an AC_TRY_COMPILE with # pthread.h, but that will work with libpthread really doesn't # exist, like AIX 4.2. [Bug: 4359] { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_mutex_init in -lpthread" >&5 $as_echo_n "checking for __pthread_mutex_init in -lpthread... " >&6; } if ${ac_cv_lib_pthread___pthread_mutex_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char __pthread_mutex_init (); int main () { return __pthread_mutex_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread___pthread_mutex_init=yes else ac_cv_lib_pthread___pthread_mutex_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 $as_echo "$ac_cv_lib_pthread___pthread_mutex_init" >&6; } if test "x$ac_cv_lib_pthread___pthread_mutex_init" = xyes; then : tcl_ok=yes else tcl_ok=no fi fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthread" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthreads" >&5 $as_echo_n "checking for pthread_mutex_init in -lpthreads... " >&6; } if ${ac_cv_lib_pthreads_pthread_mutex_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthreads $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_mutex_init (); int main () { return pthread_mutex_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthreads_pthread_mutex_init=yes else ac_cv_lib_pthreads_pthread_mutex_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 $as_echo "$ac_cv_lib_pthreads_pthread_mutex_init" >&6; } if test "x$ac_cv_lib_pthreads_pthread_mutex_init" = xyes; then : tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthreads" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc" >&5 $as_echo_n "checking for pthread_mutex_init in -lc... " >&6; } if ${ac_cv_lib_c_pthread_mutex_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_mutex_init (); int main () { return pthread_mutex_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_pthread_mutex_init=yes else ac_cv_lib_c_pthread_mutex_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_pthread_mutex_init" >&5 $as_echo "$ac_cv_lib_c_pthread_mutex_init" >&6; } if test "x$ac_cv_lib_c_pthread_mutex_init" = xyes; then : tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc_r" >&5 $as_echo_n "checking for pthread_mutex_init in -lc_r... " >&6; } if ${ac_cv_lib_c_r_pthread_mutex_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_mutex_init (); int main () { return pthread_mutex_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_r_pthread_mutex_init=yes else ac_cv_lib_c_r_pthread_mutex_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 $as_echo "$ac_cv_lib_c_r_pthread_mutex_init" >&6; } if test "x$ac_cv_lib_c_r_pthread_mutex_init" = xyes; then : tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -pthread" else TCL_THREADS=0 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&5 $as_echo "$as_me: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&2;} fi fi fi fi fi else TCL_THREADS=0 fi # Do checking message here to not mess up interleaved configure output { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with threads" >&5 $as_echo_n "checking for building with threads... " >&6; } if test "${TCL_THREADS}" = 1; then $as_echo "#define TCL_THREADS 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 $as_echo "yes (default)" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # TCL_THREADS sanity checking. See if our request for building with # threads is the same as the way Tcl was built. If not, warn the user. case ${TCL_DEFS} in *THREADS=1*) if test "${TCL_THREADS}" = "0"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads." >&5 $as_echo "$as_me: WARNING: Building ${PACKAGE_NAME} without threads enabled, but building against Tcl that IS thread-enabled. It is recommended to use --enable-threads." >&2;} fi ;; *) if test "${TCL_THREADS}" = "1"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --enable-threads requested, but building against a Tcl that is NOT thread-enabled. This is an OK configuration that will also run in a thread-enabled core." >&5 $as_echo "$as_me: WARNING: --enable-threads requested, but building against a Tcl that is NOT thread-enabled. This is an OK configuration that will also run in a thread-enabled core." >&2;} fi ;; esac #-------------------------------------------------------------------- # The statement below defines a collection of symbols related to # building as a shared library instead of a static library. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5 $as_echo_n "checking how to build libraries... " >&6; } # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; tcl_ok=$enableval else tcl_ok=yes fi if test "${enable_shared+set}" = set; then enableval="$enable_shared" tcl_ok=$enableval else tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5 $as_echo "shared" >&6; } SHARED_BUILD=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 $as_echo "static" >&6; } SHARED_BUILD=0 $as_echo "#define STATIC_BUILD 1" >>confdefs.h fi #-------------------------------------------------------------------- # 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. #-------------------------------------------------------------------- # Step 0.a: Enable 64 bit support? { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5 $as_echo_n "checking if 64bit support is requested... " >&6; } # Check whether --enable-64bit was given. if test "${enable_64bit+set}" = set; then : enableval=$enable_64bit; do64bit=$enableval else do64bit=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5 $as_echo "$do64bit" >&6; } # Step 0.b: Enable Solaris 64 bit VIS support? { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 64bit Sparc VIS support is requested" >&5 $as_echo_n "checking if 64bit Sparc VIS support is requested... " >&6; } # Check whether --enable-64bit-vis was given. if test "${enable_64bit_vis+set}" = set; then : enableval=$enable_64bit_vis; do64bitVIS=$enableval else do64bitVIS=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $do64bitVIS" >&5 $as_echo "$do64bitVIS" >&6; } # Force 64bit on with VIS if test "$do64bitVIS" = "yes"; then : do64bit=yes fi # Step 0.c: Check if visibility support is available. Do this here so # that platform specific alternatives can be used below if this fails. { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports visibility \"hidden\"" >&5 $as_echo_n "checking if compiler supports visibility \"hidden\"... " >&6; } if ${tcl_cv_cc_visibility_hidden+:} false; then : $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) void f(void); void f(void) {} int main () { f(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cc_visibility_hidden=yes else tcl_cv_cc_visibility_hidden=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5 $as_echo "$tcl_cv_cc_visibility_hidden" >&6; } if test $tcl_cv_cc_visibility_hidden = yes; then : $as_echo "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h fi # Step 0.d: Disable -rpath support? { $as_echo "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5 $as_echo_n "checking if rpath support is requested... " >&6; } # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; doRpath=$enableval else doRpath=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doRpath" >&5 $as_echo "$doRpath" >&6; } # TEA specific: Cross-compiling options for Windows/CE builds? if test "${TEA_PLATFORM}" = windows; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Windows/CE build is requested" >&5 $as_echo_n "checking if Windows/CE build is requested... " >&6; } # Check whether --enable-wince was given. if test "${enable_wince+set}" = set; then : enableval=$enable_wince; doWince=$enableval else doWince=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doWince" >&5 $as_echo "$doWince" >&6; } fi # Set the variable "system" to hold the name and version number # for the system. { $as_echo "$as_me:${as_lineno-$LINENO}: checking system version" >&5 $as_echo_n "checking system version... " >&6; } if ${tcl_cv_sys_version+:} false; then : $as_echo_n "(cached) " >&6 else # TEA specific: if test "${TEA_PLATFORM}" = "windows" ; then tcl_cv_sys_version=windows else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: can't find uname command" >&5 $as_echo "$as_me: WARNING: can't find uname command" >&2;} tcl_cv_sys_version=unknown else if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_sys_version" >&5 $as_echo "$tcl_cv_sys_version" >&6; } system=$tcl_cv_sys_version # Require ranlib early so we can override it in special cases below. # Set configuration options based on system name and version. # This is similar to Tcl's unix/tcl.m4 except that we've added a # "windows" case and removed some core-only vars. do64bit_ok=no # default to '{$LIBS}' and set to "" on per-platform necessary basis SHLIB_LD_LIBS='${LIBS}' # When ld needs options to work in 64-bit mode, put them in # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load] # is disabled by the user. [Bug 1016796] LDFLAGS_ARCH="" UNSHARED_LIB_SUFFIX="" # TEA specific: use PACKAGE_VERSION instead of VERSION TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' ECHO_VERSION='`echo ${PACKAGE_VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O if test "$GCC" = yes; then : # TEA specific: CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall" else CFLAGS_WARNING="" fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi STLIB_LD='${AR} cr' LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" if test "x$SHLIB_VERSION" = x; then : SHLIB_VERSION="1.0" fi case $system in # TEA specific: windows) # This is a 2-stage check to make sure we have the 64-bit SDK # We have to know where the SDK is installed. # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs # MACHINE is IX86 for LINK, but this is used by the manifest, # which requires x86|amd64|ia64. MACHINE="X86" if test "$do64bit" != "no" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft Platform SDK" fi MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` PATH64="" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # default to AMD64 64-bit build PATH64="${MSSDK}/Bin/Win64/x86/AMD64" ;; ia64) MACHINE="IA64" PATH64="${MSSDK}/Bin/Win64" ;; esac if test ! -d "${PATH64}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5 $as_echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ensure latest Platform SDK is installed" >&5 $as_echo "$as_me: WARNING: Ensure latest Platform SDK is installed" >&2;} do64bit="no" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 $as_echo " Using 64-bit $MACHINE mode" >&6; } do64bit_ok="yes" fi fi if test "$doWince" != "no" ; then if test "$do64bit" != "no" ; then as_fn_error $? "Windows/CE and 64-bit builds incompatible" "$LINENO" 5 fi if test "$GCC" = "yes" ; then as_fn_error $? "Windows/CE and GCC builds incompatible" "$LINENO" 5 fi # First, look for one uninstalled. # the alternative search directory is invoked by --with-celib if test x"${no_celib}" = x ; then # we reset no_celib in case something fails here no_celib=true # Check whether --with-celib was given. if test "${with_celib+set}" = set; then : withval=$with_celib; with_celibconfig=${withval} fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Windows/CE celib directory" >&5 $as_echo_n "checking for Windows/CE celib directory... " >&6; } if ${ac_cv_c_celibconfig+:} false; then : $as_echo_n "(cached) " >&6 else # First check to see if --with-celibconfig was specified. if test x"${with_celibconfig}" != x ; then if test -d "${with_celibconfig}/inc" ; then ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)` else as_fn_error $? "${with_celibconfig} directory doesn't contain inc directory" "$LINENO" 5 fi fi # then check for a celib library if test x"${ac_cv_c_celibconfig}" = x ; then for i in \ ../celib-palm-3.0 \ ../celib \ ../../celib-palm-3.0 \ ../../celib \ `ls -dr ../celib-*3.[0-9]* 2>/dev/null` \ ${srcdir}/../celib-palm-3.0 \ ${srcdir}/../celib \ `ls -dr ${srcdir}/../celib-*3.[0-9]* 2>/dev/null` \ ; do if test -d "$i/inc" ; then ac_cv_c_celibconfig=`(cd $i; pwd)` break fi done fi fi if test x"${ac_cv_c_celibconfig}" = x ; then as_fn_error $? "Cannot find celib support library directory" "$LINENO" 5 else no_celib= CELIB_DIR=${ac_cv_c_celibconfig} CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $CELIB_DIR" >&5 $as_echo "found $CELIB_DIR" >&6; } fi fi # Set defaults for common evc4/PPC2003 setup # Currently Tcl requires 300+, possibly 420+ for sockets CEVERSION=420; # could be 211 300 301 400 420 ... TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... ARCH=ARM; # could be ARM MIPS X86EM ... PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" if test "$doWince" != "yes"; then # If !yes then the user specified something # Reset ARCH to allow user to skip specifying it ARCH= eval `echo $doWince | awk -F, '{ \ if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \ if ($1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \ if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \ if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \ }'` if test "x${ARCH}" = "x" ; then ARCH=$TARGETCPU; fi fi OSVERSION=WCE$CEVERSION; if test "x${WCEROOT}" = "x" ; then WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" if test ! -d "${WCEROOT}" ; then WCEROOT="C:/Program Files/Microsoft eMbedded Tools" fi fi if test "x${SDKROOT}" = "x" ; then SDKROOT="C:/Program Files/Windows CE Tools" if test ! -d "${SDKROOT}" ; then SDKROOT="C:/Windows CE Tools" fi fi WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'` SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'` if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then as_fn_error $? "could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" "$LINENO" 5 doWince="no" else # We could PATH_NOSPACE these, but that's not important, # as long as we quote them when used. CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" if test -d "${CEINCLUDE}/${TARGETCPU}" ; then CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" fi CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" fi fi if test "$GCC" != "yes" ; then if test "${SHARED_BUILD}" = "0" ; then runtime=-MT else runtime=-MD fi if test "$do64bit" != "no" ; then # All this magic is necessary for the Win64 SDK RC1 - hobbs CC="\"${PATH64}/cl.exe\"" CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\"" RC="\"${MSSDK}/bin/rc.exe\"" lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" LINKBIN="\"${PATH64}/link.exe\"" CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" # Avoid 'unresolved external symbol __security_cookie' # errors, c.f. http://support.microsoft.com/?id=894573 vars="bufferoverflowU.lib" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done elif test "$doWince" != "no" ; then CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" if test "${TARGETCPU}" = "X86"; then CC="\"${CEBINROOT}/cl.exe\"" else CC="\"${CEBINROOT}/cl${ARCH}.exe\"" fi CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\"" arch=`echo ${ARCH} | awk '{print tolower($0)}'` defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS" if test "${SHARED_BUILD}" = "1" ; then # Static CE builds require static celib as well defs="${defs} _DLL" fi for i in $defs ; do cat >>confdefs.h <<_ACEOF #define $i 1 _ACEOF done cat >>confdefs.h <<_ACEOF #define _WIN32_WCE $CEVERSION _ACEOF cat >>confdefs.h <<_ACEOF #define UNDER_CE $CEVERSION _ACEOF CFLAGS_DEBUG="-nologo -Zi -Od" CFLAGS_OPTIMIZE="-nologo -Ox" lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" LINKBIN="\"${CEBINROOT}/link.exe\"" else RC="rc" lflags="-nologo" LINKBIN="link" CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" fi fi if test "$GCC" = "yes"; then # mingw gcc mode RC="windres" CFLAGS_DEBUG="-g" CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" SHLIB_LD="$CC -shared" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" else SHLIB_LD="${LINKBIN} -dll ${lflags}" # link -lib only works when -lib is the first arg STLIB_LD="${LINKBIN} -lib ${lflags}" UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib' PATHTYPE=-w # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp # and also # http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx # This essentially turns it all on. LDFLAGS_DEBUG="-debug -debugtype:cv" LDFLAGS_OPTIMIZE="-release" if test "$doWince" != "no" ; then LDFLAGS_CONSOLE="-link ${lflags}" LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} else LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi fi SHLIB_SUFFIX=".dll" SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll' TCL_LIB_VERSIONS_OK=nodots ;; AIX-*) if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then : # AIX requires the _r compiler when gcc isn't being used case "${CC}" in *_r|*_r\ *) # ok ... ;; *) # Make sure only first arg gets _r CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'` ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using $CC for compiling with threads" >&5 $as_echo "Using $CC for compiling with threads" >&6; } fi LIBS="$LIBS -lc" SHLIB_CFLAGS="" SHLIB_SUFFIX=".so" LD_LIBRARY_PATH_VAR="LIBPATH" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes; then : if test "$GCC" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 $as_echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -q64" LDFLAGS_ARCH="-q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" fi fi if test "`uname -m`" = ia64; then : # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC SHLIB_LD="/usr/ccs/bin/ld -G -z text" if test "$GCC" = yes; then : CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' else CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' else if test "$GCC" = yes; then : SHLIB_LD='${CC} -shared -Wl,-bexpall' else SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry" LDFLAGS="$LDFLAGS -brtl" fi SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi ;; BeOS*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -nostart' SHLIB_SUFFIX=".so" #----------------------------------------------------------- # Check for inet_ntoa in -lbind, for BeOS (which also needs # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lbind" >&5 $as_echo_n "checking for inet_ntoa in -lbind... " >&6; } if ${ac_cv_lib_bind_inet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_ntoa (); int main () { return inet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bind_inet_ntoa=yes else ac_cv_lib_bind_inet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind_inet_ntoa" >&5 $as_echo "$ac_cv_lib_bind_inet_ntoa" >&6; } if test "x$ac_cv_lib_bind_inet_ntoa" = xyes; then : LIBS="$LIBS -lbind -lsocket" fi ;; BSD/OS-4.*) SHLIB_CFLAGS="-export-dynamic -fPIC" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".so" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; CYGWIN_*) SHLIB_CFLAGS="" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" EXE_SUFFIX=".exe" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; Haiku*) LDFLAGS="$LDFLAGS -Wl,--export-dynamic" SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lnetwork" >&5 $as_echo_n "checking for inet_ntoa in -lnetwork... " >&6; } if ${ac_cv_lib_network_inet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnetwork $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inet_ntoa (); int main () { return inet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_network_inet_ntoa=yes else ac_cv_lib_network_inet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_inet_ntoa" >&5 $as_echo "$ac_cv_lib_network_inet_ntoa" >&6; } if test "x$ac_cv_lib_network_inet_ntoa" = xyes; then : LIBS="$LIBS -lnetwork" fi ;; HP-UX-*.11.*) # Use updated header definitions where possible $as_echo "#define _XOPEN_SOURCE_EXTENDED 1" >>confdefs.h # TEA specific: Needed by Tcl, but not most extensions #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?]) #LIBS="$LIBS -lxnet" # Use the XOPEN network library if test "`uname -m`" = ia64; then : SHLIB_SUFFIX=".so" # Use newer C++ library for C++ extensions #if test "$GCC" != "yes" ; then # CPPFLAGS="-AA" #fi else SHLIB_SUFFIX=".sl" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = yes; then : LDFLAGS="$LDFLAGS -Wl,-E" CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi if test "$GCC" = yes; then : SHLIB_LD='${CC} -shared' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else CFLAGS="$CFLAGS -z" # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc #CFLAGS="$CFLAGS +DAportable" SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" fi # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes"; then : if test "$GCC" = yes; then : case `${CC} -dumpmachine` in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD='${CC} -shared' if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 $as_echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} ;; esac else do64bit_ok=yes CFLAGS="$CFLAGS +DD64" LDFLAGS_ARCH="+DD64" fi fi ;; IRIX-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_SUFFIX=".so" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes; then : CFLAGS="$CFLAGS -mabi=n32" LDFLAGS="$LDFLAGS -mabi=n32" else case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) CFLAGS="$CFLAGS -n32" ;; esac LDFLAGS="$LDFLAGS -n32" fi ;; IRIX64-6.*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_SUFFIX=".so" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes; then : if test "$GCC" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported by gcc" >&5 $as_echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} else do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" CFLAGS="$CFLAGS -64" LDFLAGS_ARCH="-64" fi fi ;; Linux*) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" # TEA specific: CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}' LDFLAGS="$LDFLAGS -Wl,--export-dynamic" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "`uname -m`" = "alpha"; then : CFLAGS="$CFLAGS -mieee" fi if test $do64bit = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -m64 flag" >&5 $as_echo_n "checking if compiler accepts -m64 flag... " >&6; } if ${tcl_cv_cc_m64+:} false; then : $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cc_m64=yes else tcl_cv_cc_m64=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_m64" >&5 $as_echo "$tcl_cv_cc_m64" >&6; } if test $tcl_cv_cc_m64 = yes; then : CFLAGS="$CFLAGS -m64" do64bit_ok=yes fi fi # The combo of gcc + glibc has a bug related to inlining of # functions like strtod(). The -fno-builtin flag should address # this problem but it does not work. The -fno-inline flag is kind # of overkill but it works. Disable inlining only when one of the # files in compat/*.c is being linked in. if test x"${USE_COMPAT}" != x; then : CFLAGS="$CFLAGS -fno-inline" fi ;; GNU*) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" SHLIB_LD='${CC} -shared' LDFLAGS="$LDFLAGS -Wl,--export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" if test "`uname -m`" = "alpha"; then : CFLAGS="$CFLAGS -mieee" fi ;; Lynx*) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE=-02 SHLIB_LD='${CC} -shared' LD_FLAGS="-Wl,--export-dynamic" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi ;; OpenBSD-*) SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ELF" >&5 $as_echo_n "checking for ELF... " >&6; } if ${tcl_cv_ld_elf+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ELF__ yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : tcl_cv_ld_elf=yes else tcl_cv_ld_elf=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_elf" >&5 $as_echo "$tcl_cv_ld_elf" >&6; } if test $tcl_cv_ld_elf = yes; then : LDFLAGS=-Wl,-export-dynamic else LDFLAGS="" fi if test "${TCL_THREADS}" = "1"; then : # OpenBSD builds and links with -pthread, never -lpthread. LIBS=`echo $LIBS | sed s/-lpthread//` CFLAGS="$CFLAGS -pthread" SHLIB_CFLAGS="$SHLIB_CFLAGS -pthread" fi # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; NetBSD-*|FreeBSD-[3-4].*) # FreeBSD 3.* and greater have ELF. # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" LDFLAGS="$LDFLAGS -export-dynamic" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "${TCL_THREADS}" = "1"; then : # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi case $system in FreeBSD-3.*) # FreeBSD-3 doesn't handle version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' TCL_LIB_VERSIONS_OK=nodots ;; esac ;; FreeBSD-*) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" TCL_SHLIB_LD_EXTRAS="-soname \$@" SHLIB_SUFFIX=".so" LDFLAGS="" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "${TCL_THREADS}" = "1"; then : # The -pthread needs to go in the LDFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_LIBS" fi # Version numbers are dot-stripped by system policy. TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1' TCL_LIB_VERSIONS_OK=nodots ;; Darwin-*) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and # -mmacosx-version-min flags from CFLAGS to CPPFLAGS: CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if ($i~/^(isysroot|mmacosx-version-min)/) print "-"$i}'`" CFLAGS="`echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`" if test $do64bit = yes; then : case `arch` in ppc) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch ppc64 flag" >&5 $as_echo_n "checking if compiler accepts -arch ppc64 flag... " >&6; } if ${tcl_cv_cc_arch_ppc64+:} false; then : $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cc_arch_ppc64=yes else tcl_cv_cc_arch_ppc64=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_ppc64" >&5 $as_echo "$tcl_cv_cc_arch_ppc64" >&6; } if test $tcl_cv_cc_arch_ppc64 = yes; then : CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes fi;; i386) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch x86_64 flag" >&5 $as_echo_n "checking if compiler accepts -arch x86_64 flag... " >&6; } if ${tcl_cv_cc_arch_x86_64+:} false; then : $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cc_arch_x86_64=yes else tcl_cv_cc_arch_x86_64=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_x86_64" >&5 $as_echo "$tcl_cv_cc_arch_x86_64" >&6; } if test $tcl_cv_cc_arch_x86_64 = yes; then : CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes fi;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 $as_echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; esac else # Check for combined 32-bit and 64-bit fat build if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then : fat_32_64=yes fi fi # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ld accepts -single_module flag" >&5 $as_echo_n "checking if ld accepts -single_module flag... " >&6; } if ${tcl_cv_ld_single_module+:} false; then : $as_echo_n "(cached) " >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_ld_single_module=yes else tcl_cv_ld_single_module=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_single_module" >&5 $as_echo "$tcl_cv_ld_single_module" >&6; } if test $tcl_cv_ld_single_module = yes; then : SHLIB_LD="${SHLIB_LD} -Wl,-single_module" fi # TEA specific: link shlib with current and compatiblity version flags vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([0-9]\{1,5\}\)\(\(\.[0-9]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d` SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}" SHLIB_SUFFIX=".dylib" # Don't use -prebind when building for Mac OS X 10.4 or later only: if test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \ "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then : LDFLAGS="$LDFLAGS -prebind" fi LDFLAGS="$LDFLAGS -headerpad_max_install_names" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ld accepts -search_paths_first flag" >&5 $as_echo_n "checking if ld accepts -search_paths_first flag... " >&6; } if ${tcl_cv_ld_search_paths_first+:} false; then : $as_echo_n "(cached) " >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { int i; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_ld_search_paths_first=yes else tcl_cv_ld_search_paths_first=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_search_paths_first" >&5 $as_echo "$tcl_cv_ld_search_paths_first" >&6; } if test $tcl_cv_ld_search_paths_first = yes; then : LDFLAGS="$LDFLAGS -Wl,-search_paths_first" fi if test "$tcl_cv_cc_visibility_hidden" != yes; then : $as_echo "#define MODULE_SCOPE __private_extern__" >>confdefs.h tcl_cv_cc_visibility_hidden=yes fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" # TEA specific: for combined 32 & 64 bit fat builds of Tk # extensions, verify that 64-bit build is possible. if test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"; then : if test "${TEA_WINDOWINGSYSTEM}" = x11; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit X11" >&5 $as_echo_n "checking for 64-bit X11... " >&6; } if ${tcl_cv_lib_x11_64+:} false; then : $as_echo_n "(cached) " >&6 else for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { XrmInitialize(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_lib_x11_64=yes else tcl_cv_lib_x11_64=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_x11_64" >&5 $as_echo "$tcl_cv_lib_x11_64" >&6; } fi if test "${TEA_WINDOWINGSYSTEM}" = aqua; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit Tk" >&5 $as_echo_n "checking for 64-bit Tk... " >&6; } if ${tcl_cv_lib_tk_64+:} false; then : $as_echo_n "(cached) " >&6 else for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done CPPFLAGS="$CPPFLAGS -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}" LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { Tk_InitStubs(NULL, "", 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_lib_tk_64=yes else tcl_cv_lib_tk_64=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_tk_64" >&5 $as_echo "$tcl_cv_lib_tk_64" >&6; } fi # remove 64-bit arch flags from CFLAGS et al. if configuration # does not support 64-bit. if test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no; then : { $as_echo "$as_me:${as_lineno-$LINENO}: Removing 64-bit architectures from compiler & linker flags" >&5 $as_echo "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;} for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done fi fi ;; OS/390-*) CFLAGS_OPTIMIZE="" # Optimizer is buggy $as_echo "#define _OE_SOCKETS 1" >>confdefs.h ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" if test "$SHARED_BUILD" = 1; then : SHLIB_LD='ld -shared -expect_unresolved "*"' else SHLIB_LD='ld -non_shared -expect_unresolved "*"' fi SHLIB_SUFFIX=".so" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi if test "$GCC" = yes; then : CFLAGS="$CFLAGS -mieee" else CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" fi # see pthread_intro(3) for pthread support on osf1, k.furukawa if test "${TCL_THREADS}" = 1; then : CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` if test "$GCC" = yes; then : LIBS="$LIBS -lpthread -lmach -lexc" else CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi fi ;; QNX-6*) # QNX RTP # This may work for all QNX, but it was only reported for v6. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SCO_SV-3.2*) if test "$GCC" = yes; then : SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else SHLIB_CFLAGS="-Kpic -belf" LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-5.[0-6]) # Careful to not let 5.10+ fall into this case # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. $as_echo "#define _REENTRANT 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h SHLIB_CFLAGS="-KPIC" SHLIB_SUFFIX=".so" if test "$GCC" = yes; then : SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else SHLIB_LD="/usr/ccs/bin/ld -G -z text" CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi ;; SunOS-5*) # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. $as_echo "#define _REENTRANT 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h SHLIB_CFLAGS="-KPIC" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = yes; then : arch=`isainfo` if test "$arch" = "sparcv9 sparc"; then : if test "$GCC" = yes; then : if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5 $as_echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} else do64bit_ok=yes CFLAGS="$CFLAGS -m64 -mcpu=v9" LDFLAGS="$LDFLAGS -m64 -mcpu=v9" SHLIB_CFLAGS="-fPIC" fi else do64bit_ok=yes if test "$do64bitVIS" = yes; then : CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" else CFLAGS="$CFLAGS -xarch=v9" LDFLAGS_ARCH="-xarch=v9" fi # Solaris 64 uses this as well #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" fi else if test "$arch" = "amd64 i386"; then : if test "$GCC" = yes; then : case $system in SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*) do64bit_ok=yes CFLAGS="$CFLAGS -m64" LDFLAGS="$LDFLAGS -m64";; *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 $as_echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;};; esac else do64bit_ok=yes case $system in SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*) CFLAGS="$CFLAGS -m64" LDFLAGS="$LDFLAGS -m64";; *) CFLAGS="$CFLAGS -xarch=amd64" LDFLAGS="$LDFLAGS -xarch=amd64";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported for $arch" >&5 $as_echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;} fi fi fi SHLIB_SUFFIX=".so" if test "$GCC" = yes; then : SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "$do64bit_ok" = yes; then : if test "$arch" = "sparcv9 sparc"; then : # We need to specify -static-libgcc or we need to # add the path to the sparv9 libgcc. # JH: static-libgcc is necessary for core Tcl, but may # not be necessary for extensions. SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc" # for finding sparcv9 libgcc, get the regular libgcc # path, remove so name and append 'sparcv9' #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..." #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir" else if test "$arch" = "amd64 i386"; then : # JH: static-libgcc is necessary for core Tcl, but may # not be necessary for extensions. SHLIB_LD="$SHLIB_LD -m64 -static-libgcc" fi fi fi else case $system in SunOS-5.[1-9][0-9]*) # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';; *) SHLIB_LD='/usr/ccs/bin/ld -G -z text';; esac CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' fi ;; esac if test "$do64bit" = yes -a "$do64bit_ok" = no; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5 $as_echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;} fi # Add in the arch flags late to ensure it wasn't removed. # Not necessary in TEA, but this is aligned with core LDFLAGS="$LDFLAGS $LDFLAGS_ARCH" # If we're running gcc, then change the C flags for compiling shared # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. if test "$GCC" = yes; then : case $system in AIX-*) ;; BSD/OS*) ;; CYGWIN_*) ;; IRIX*) ;; NetBSD-*|FreeBSD-*|OpenBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; windows) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac fi if test "$tcl_cv_cc_visibility_hidden" != yes; then : $as_echo "#define MODULE_SCOPE extern" >>confdefs.h $as_echo "#define NO_VIZ /**/" >>confdefs.h fi if test "$SHARED_LIB_SUFFIX" = ""; then : # TEA specific: use PACKAGE_VERSION instead of VERSION SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}' fi if test "$UNSHARED_LIB_SUFFIX" = ""; then : # TEA specific: use PACKAGE_VERSION instead of VERSION UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' fi # These must be called after we do the basic CFLAGS checks and # verify any possible 64-bit or similar switches are necessary { $as_echo "$as_me:${as_lineno-$LINENO}: checking for required early compiler flags" >&5 $as_echo_n "checking for required early compiler flags... " >&6; } tcl_flags="" if ${tcl_cv_flag__isoc99_source+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__isoc99_source=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _ISOC99_SOURCE 1 #include int main () { char *p = (char *)strtoll; char *q = (char *)strtoull; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__isoc99_source=yes else tcl_cv_flag__isoc99_source=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then $as_echo "#define _ISOC99_SOURCE 1" >>confdefs.h tcl_flags="$tcl_flags _ISOC99_SOURCE" fi if ${tcl_cv_flag__largefile64_source+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__largefile64_source=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE64_SOURCE 1 #include int main () { struct stat64 buf; int i = stat64("/", &buf); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__largefile64_source=yes else tcl_cv_flag__largefile64_source=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then $as_echo "#define _LARGEFILE64_SOURCE 1" >>confdefs.h tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" fi if ${tcl_cv_flag__largefile_source64+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *)open64; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__largefile_source64=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE_SOURCE64 1 #include int main () { char *p = (char *)open64; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__largefile_source64=yes else tcl_cv_flag__largefile_source64=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then $as_echo "#define _LARGEFILE_SOURCE64 1" >>confdefs.h tcl_flags="$tcl_flags _LARGEFILE_SOURCE64" fi if test "x${tcl_flags}" = "x" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${tcl_flags}" >&5 $as_echo "${tcl_flags}" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit integer type" >&5 $as_echo_n "checking for 64-bit integer type... " >&6; } if ${tcl_cv_type_64bit+:} false; then : $as_echo_n "(cached) " >&6 else tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { __int64 value = (__int64) 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_type_64bit=__int64 else tcl_type_64bit="long long" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # See if we should use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { switch (0) { case 1: case (sizeof(${tcl_type_64bit})==sizeof(long)): ; } ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_type_64bit=${tcl_type_64bit} fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "${tcl_cv_type_64bit}" = none ; then $as_echo "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: using long" >&5 $as_echo "using long" >&6; } elif test "${tcl_cv_type_64bit}" = "__int64" \ -a "${TEA_PLATFORM}" = "windows" ; then # TEA specific: We actually want to use the default tcl.h checks in # this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* { $as_echo "$as_me:${as_lineno-$LINENO}: result: using Tcl header defaults" >&5 $as_echo "using Tcl header defaults" >&6; } else cat >>confdefs.h <<_ACEOF #define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${tcl_cv_type_64bit}" >&5 $as_echo "${tcl_cv_type_64bit}" >&6; } # Now check for auxiliary declarations { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct dirent64" >&5 $as_echo_n "checking for struct dirent64... " >&6; } if ${tcl_cv_struct_dirent64+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct dirent64 p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_struct_dirent64=yes else tcl_cv_struct_dirent64=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_dirent64" >&5 $as_echo "$tcl_cv_struct_dirent64" >&6; } if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then $as_echo "#define HAVE_STRUCT_DIRENT64 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat64" >&5 $as_echo_n "checking for struct stat64... " >&6; } if ${tcl_cv_struct_stat64+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct stat64 p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_struct_stat64=yes else tcl_cv_struct_stat64=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_stat64" >&5 $as_echo "$tcl_cv_struct_stat64" >&6; } if test "x${tcl_cv_struct_stat64}" = "xyes" ; then $as_echo "#define HAVE_STRUCT_STAT64 1" >>confdefs.h fi for ac_func in open64 lseek64 do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5 $as_echo_n "checking for off64_t... " >&6; } if ${tcl_cv_type_off64_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { off64_t offset; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_type_off64_t=yes else tcl_cv_type_off64_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then $as_echo "#define HAVE_TYPE_OFF64_T 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi #-------------------------------------------------------------------- # Set the default compiler switches based on the --enable-symbols option. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5 $as_echo_n "checking for build with symbols... " >&6; } # Check whether --enable-symbols was given. if test "${enable_symbols+set}" = set; then : enableval=$enable_symbols; tcl_ok=$enableval else tcl_ok=no fi DBGX="" if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else CFLAGS_DEFAULT="${CFLAGS_DEBUG}" LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" if test "$tcl_ok" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5 $as_echo "yes (standard debugging)" >&6; } fi fi # TEA specific: if test "${TEA_PLATFORM}" != "windows" ; then LDFLAGS_DEFAULT="${LDFLAGS}" fi if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then $as_echo "#define TCL_MEM_DEBUG 1" >>confdefs.h fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem debugging" >&5 $as_echo "enabled symbols mem debugging" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5 $as_echo "enabled $tcl_ok debugging" >&6; } fi fi #-------------------------------------------------------------------- # 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. #-------------------------------------------------------------------- $as_echo "#define USE_TCL_STUBS 1" >>confdefs.h $as_echo "#define USE_TCL_STUBS 1" >>confdefs.h #------------------------------------------------------------------------- # Check for system header files. #------------------------------------------------------------------------- ac_fn_c_check_header_mongrel "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default" if test "x$ac_cv_header_sys_select_h" = xyes; then : $as_echo "#define HAVE_SYS_SELECT_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : $as_echo "#define HAVE_SYSMACROS_H 1" >>confdefs.h fi # Oddly, some systems have stdarg but don't support prototypes # Tcl avoids the whole issue by not using stdarg on UNIX at all! ac_fn_c_check_header_mongrel "$LINENO" "varargs.h" "ac_cv_header_varargs_h" "$ac_includes_default" if test "x$ac_cv_header_varargs_h" = xyes; then : $as_echo "#define HAVE_VARARGS_H 1" >>confdefs.h fi # If no stropts.h, then the svr4 implementation is broken. # At least it is on my Debian "potato" system. - Rob Savoye ac_fn_c_check_header_mongrel "$LINENO" "sys/stropts.h" "ac_cv_header_sys_stropts_h" "$ac_includes_default" if test "x$ac_cv_header_sys_stropts_h" = xyes; then : $as_echo "#define HAVE_STROPTS_H 1" >>confdefs.h else svr4_ptys_broken=1 fi ac_fn_c_check_header_mongrel "$LINENO" "sys/sysconfig.h" "ac_cv_header_sys_sysconfig_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sysconfig_h" = xyes; then : $as_echo "#define HAVE_SYSCONF_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/fcntl.h" "ac_cv_header_sys_fcntl_h" "$ac_includes_default" if test "x$ac_cv_header_sys_fcntl_h" = xyes; then : $as_echo "#define HAVE_SYS_FCNTL_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/ptem.h" "ac_cv_header_sys_ptem_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ptem_h" = xyes; then : $as_echo "#define HAVE_SYS_PTEM_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/strredir.h" "ac_cv_header_sys_strredir_h" "$ac_includes_default" if test "x$ac_cv_header_sys_strredir_h" = xyes; then : $as_echo "#define HAVE_STRREDIR_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/strpty.h" "ac_cv_header_sys_strpty_h" "$ac_includes_default" if test "x$ac_cv_header_sys_strpty_h" = xyes; then : $as_echo "#define HAVE_STRPTY_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/bsdtypes.h" >&5 $as_echo_n "checking for sys/bsdtypes.h... " >&6; } if test "ISC_${ISC}" = "ISC_1" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # if on ISC 1, we need to get FD_SET macros for ac_header in sys/bsdtypes.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/bsdtypes.h" "ac_cv_header_sys_bsdtypes_h" "$ac_includes_default" if test "x$ac_cv_header_sys_bsdtypes_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_BSDTYPES_H 1 _ACEOF fi done else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi #------------------------------------------------------------------------- # What type do signals return? #------------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF #------------------------------------------------------------------------- # Find out all about time handling differences. #------------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi for ac_header in sys/time.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" if test "x$ac_cv_header_sys_time_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_TIME_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include #include <$ac_cv_struct_tm> " if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 _ACEOF fi if test "$ac_cv_member_struct_tm_tm_zone" = yes; then $as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " if test "x$ac_cv_have_decl_tzname" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_TZNAME $ac_have_decl _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } if ${ac_cv_var_tzname+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #if !HAVE_DECL_TZNAME extern char *tzname[]; #endif int main () { return tzname[0][0]; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_var_tzname=yes else ac_cv_var_tzname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_var_tzname" >&5 $as_echo "$ac_cv_var_tzname" >&6; } if test $ac_cv_var_tzname = yes; then $as_echo "#define HAVE_TZNAME 1" >>confdefs.h fi fi for ac_func in gmtime_r localtime_r do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking tm_tzadj in struct tm" >&5 $as_echo_n "checking tm_tzadj in struct tm... " >&6; } if ${tcl_cv_member_tm_tzadj+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct tm tm; tm.tm_tzadj; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_member_tm_tzadj=yes else tcl_cv_member_tm_tzadj=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_member_tm_tzadj" >&5 $as_echo "$tcl_cv_member_tm_tzadj" >&6; } if test $tcl_cv_member_tm_tzadj = yes ; then $as_echo "#define HAVE_TM_TZADJ 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking tm_gmtoff in struct tm" >&5 $as_echo_n "checking tm_gmtoff in struct tm... " >&6; } if ${tcl_cv_member_tm_gmtoff+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { struct tm tm; tm.tm_gmtoff; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_member_tm_gmtoff=yes else tcl_cv_member_tm_gmtoff=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_member_tm_gmtoff" >&5 $as_echo "$tcl_cv_member_tm_gmtoff" >&6; } if test $tcl_cv_member_tm_gmtoff = yes ; then $as_echo "#define HAVE_TM_GMTOFF 1" >>confdefs.h fi # # Its important to include time.h in this check, as some systems # (like convex) have timezone functions, etc. # { $as_echo "$as_me:${as_lineno-$LINENO}: checking long timezone variable" >&5 $as_echo_n "checking long timezone variable... " >&6; } if ${tcl_cv_timezone_long+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { extern long timezone; timezone += 1; exit (0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_timezone_long=yes else tcl_cv_timezone_long=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_timezone_long" >&5 $as_echo "$tcl_cv_timezone_long" >&6; } if test $tcl_cv_timezone_long = yes ; then $as_echo "#define HAVE_TIMEZONE_VAR 1" >>confdefs.h else # # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. # { $as_echo "$as_me:${as_lineno-$LINENO}: checking time_t timezone variable" >&5 $as_echo_n "checking time_t timezone variable... " >&6; } if ${tcl_cv_timezone_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { extern time_t timezone; timezone += 1; exit (0); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_timezone_time=yes else tcl_cv_timezone_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_timezone_time" >&5 $as_echo "$tcl_cv_timezone_time" >&6; } if test $tcl_cv_timezone_time = yes ; then $as_echo "#define HAVE_TIMEZONE_VAR 1" >>confdefs.h fi fi #-------------------------------------------------------------------- # 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. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking union wait" >&5 $as_echo_n "checking union wait... " >&6; } if ${tcl_cv_union_wait+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { union wait x; WIFEXITED(x); /* Generates compiler error if WIFEXITED uses an int. */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_union_wait=yes else tcl_cv_union_wait=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_union_wait" >&5 $as_echo "$tcl_cv_union_wait" >&6; } if test $tcl_cv_union_wait = no; then $as_echo "#define NO_UNION_WAIT 1" >>confdefs.h fi ###################################################################### # required by Sequent ptx2 ac_fn_c_check_func "$LINENO" "gethostname" "ac_cv_func_gethostname" if test "x$ac_cv_func_gethostname" = xyes; then : gethostname=1 else gethostname=0 fi if test $gethostname -eq 0 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostname in -linet" >&5 $as_echo_n "checking for gethostname in -linet... " >&6; } if ${ac_cv_lib_inet_gethostname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostname (); int main () { return gethostname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet_gethostname=yes else ac_cv_lib_inet_gethostname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_gethostname" >&5 $as_echo "$ac_cv_lib_inet_gethostname" >&6; } if test "x$ac_cv_lib_inet_gethostname" = xyes; then : LIBS="$LIBS -linet" fi fi ###################################################################### # required by Fischman's ISC 4.0 ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" if test "x$ac_cv_func_socket" = xyes; then : socket=1 else socket=0 fi if test $socket -eq 0 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -linet" >&5 $as_echo_n "checking for socket in -linet... " >&6; } if ${ac_cv_lib_inet_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet_socket=yes else ac_cv_lib_inet_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_socket" >&5 $as_echo "$ac_cv_lib_inet_socket" >&6; } if test "x$ac_cv_lib_inet_socket" = xyes; then : LIBS="$LIBS -linet" fi fi ###################################################################### ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" if test "x$ac_cv_func_select" = xyes; then : select=1 else select=0 fi if test $select -eq 0 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for select in -linet" >&5 $as_echo_n "checking for select in -linet... " >&6; } if ${ac_cv_lib_inet_select+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char select (); int main () { return select (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet_select=yes else ac_cv_lib_inet_select=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_select" >&5 $as_echo "$ac_cv_lib_inet_select" >&6; } if test "x$ac_cv_lib_inet_select" = xyes; then : LIBS="$LIBS -linet" fi fi ###################################################################### ac_fn_c_check_func "$LINENO" "getpseudotty" "ac_cv_func_getpseudotty" if test "x$ac_cv_func_getpseudotty" = xyes; then : getpseudotty=1 else getpseudotty=0 fi if test $getpseudotty -eq 0 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpseudotty in -lseq" >&5 $as_echo_n "checking for getpseudotty in -lseq... " >&6; } if ${ac_cv_lib_seq_getpseudotty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lseq $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getpseudotty (); int main () { return getpseudotty (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_seq_getpseudotty=yes else ac_cv_lib_seq_getpseudotty=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_seq_getpseudotty" >&5 $as_echo "$ac_cv_lib_seq_getpseudotty" >&6; } if test "x$ac_cv_lib_seq_getpseudotty" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSEQ 1 _ACEOF LIBS="-lseq $LIBS" fi fi ###################################################################### # Check for FreeBSD/NetBSD openpty() unset ac_cv_func_openpty ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" if test "x$ac_cv_func_openpty" = xyes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h openpty=1 else openpty=0 fi if test $openpty -eq 0 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } if ${ac_cv_lib_util_openpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char openpty (); int main () { return openpty (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_util_openpty=yes else ac_cv_lib_util_openpty=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } if test "x$ac_cv_lib_util_openpty" = xyes; then : # 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. $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lutil" fi fi ###################################################################### # End of library/func checking ###################################################################### # Hand patches to library/func checking. { $as_echo "$as_me:${as_lineno-$LINENO}: checking if running Sequent running SVR4" >&5 $as_echo_n "checking if running Sequent running SVR4... " >&6; } if test "$host_alias" = "i386-sequent-sysv4" ; then LIBS="-lnsl -lsocket -lm" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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 # #-------------------------------------------------------------------- #-------------------------------------------------------------------- # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- # If `configure' is invoked (in)directly via `make', ensure that it # encounters no `make' conflicts. # 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 ..*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Specify absolute path to --with-tcl for subdir configuration" >&5 $as_echo "$as_me: WARNING: Specify absolute path to --with-tcl for subdir configuration" >&2;} ;; esac fi # these are the other subdirectories we need to configure subdirs="$subdirs testsuite" ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if running Mach" >&5 $as_echo_n "checking if running Mach... " >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if running MachTen" >&5 $as_echo_n "checking if running MachTen... " >&6; } # yet another Mach clone if test -r /MachTen ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } mach=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if on Pyramid" >&5 $as_echo_n "checking if on Pyramid... " >&6; } if test -r /bin/pyr ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } pyr=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } pyr=0 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if on Apollo" >&5 $as_echo_n "checking if on Apollo... " >&6; } if test -r /usr/apollo/bin ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } apollo=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } apollo=0 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if on Interactive" >&5 $as_echo_n "checking if on Interactive... " >&6; } if test "x`(uname -s) 2>/dev/null`" = xIUNIX; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } iunix=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } iunix=0 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stty to use" >&5 $as_echo_n "checking stty to use... " >&6; } if test -r /usr/local/bin/stty ; then STTY_BIN=/usr/local/bin/stty else STTY_BIN=/bin/stty fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STTY_BIN" >&5 $as_echo "$STTY_BIN" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if stty reads stdout" >&5 $as_echo_n "checking if stty reads stdout... " >&6; } # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define STTY_READS_STDOUT 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Solaris 2.4 and later requires __EXTENSIONS__ in order to see all sorts # of traditional but nonstandard stuff in header files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking if running Solaris" >&5 $as_echo_n "checking if running Solaris... " >&6; } solaris=0 case "${host}" in *-*-solaris*) solaris=1;; esac if test $solaris -eq 1 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define SOLARIS 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = xyes; then : else LIBS="${LIBS} -Xp" fi fi ###################################################################### # # Look for various header files # # # Look for functions that may be missing # ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" if test "x$ac_cv_func_memmove" = xyes; then : $as_echo "#define HAVE_MEMMOVE 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" if test "x$ac_cv_func_sysconf" = xyes; then : $as_echo "#define HAVE_SYSCONF 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = xyes; then : $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" if test "x$ac_cv_func_strchr" = xyes; then : $as_echo "#define HAVE_STRCHR 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "timezone" "ac_cv_func_timezone" if test "x$ac_cv_func_timezone" = xyes; then : $as_echo "#define HAVE_TIMEZONE 1" >>confdefs.h fi ac_fn_c_check_func "$LINENO" "siglongjmp" "ac_cv_func_siglongjmp" if test "x$ac_cv_func_siglongjmp" = xyes; then : $as_echo "#define HAVE_SIGLONGJMP 1" >>confdefs.h fi # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for memcpy" >&5 $as_echo_n "checking for memcpy... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { char *s1, *s2; memcpy(s1,s2,0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_MEMCPY 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext # 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking if WNOHANG requires _POSIX_SOURCE" >&5 $as_echo_n "checking if WNOHANG requires _POSIX_SOURCE... " >&6; } if test "$cross_compiling" = yes; then : as_fn_error $? "Expect can't be cross compiled" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include main() { #ifndef WNOHANG return 0; #else return 1; #endif } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define WNOHANG_REQUIRES_POSIX_SOURCE 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if any value exists for WNOHANG" >&5 $as_echo_n "checking if any value exists for WNOHANG... " >&6; } rm -rf wnohang if test "$cross_compiling" = yes; then : as_fn_error $? "Expect can't be cross compiled" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include main() { #ifdef WNOHANG FILE *fp = fopen("wnohang","w"); fprintf(fp,"%d",WNOHANG); fclose(fp); return 0; #else return 1; #endif } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } cat >>confdefs.h <<_ACEOF #define WNOHANG_BACKUP_VALUE `cat wnohang` _ACEOF rm -f wnohang else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define WNOHANG_BACKUP_VALUE 1" >>confdefs.h fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi # # 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking mask type of select" >&5 $as_echo_n "checking mask type of select... " >&6; } if egrep "select\(size_t, int" /usr/include/sys/time.h >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: int" >&5 $as_echo "int" >&6; } $as_echo "#define SELECT_MASK_TYPE int" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } $as_echo "#define SELECT_MASK_TYPE fd_set" >>confdefs.h fi # FIXME: check if alarm exists { $as_echo "$as_me:${as_lineno-$LINENO}: checking if signals need to be re-armed" >&5 $as_echo_n "checking if signals need to be re-armed... " >&6; } if test "$cross_compiling" = yes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Expect can't be cross compiled" >&5 $as_echo "$as_me: WARNING: Expect can't be cross compiled" >&2;} else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #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); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define REARM_SIG 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi # HPUX7 has trouble with the big cat so split it # Owen Rees 29Mar93 SEDDEFS="${SEDDEFS}CONFEOF cat >> conftest.sed <&5 $as_echo_n "checking if on Convex... " >&6; } convex=0 case "${host}" in c[12]-*-*) convex=1;; esac if test $convex -eq 1 ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define CONVEX 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if on HP" >&5 $as_echo_n "checking if on HP... " >&6; } if test "x`(uname) 2>/dev/null`" = xHP-UX; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } hp=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } hp=0 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking sane default stty arguments" >&5 $as_echo_n "checking sane default stty arguments... " >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEFAULT_STTY_ARG" >&5 $as_echo "$DEFAULT_STTY_ARG" >&6; } # 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. # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HP style pty allocation" >&5 $as_echo_n "checking for HP style pty allocation... " >&6; } # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_PTYM 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HP style pty trapping" >&5 $as_echo_n "checking for HP style pty trapping... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "struct.*request_info" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_PTYTRAP 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AIX new-style pty allocation" >&5 $as_echo_n "checking for AIX new-style pty allocation... " >&6; } if test -r /dev/ptc -a -r /dev/pts ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_PTC_PTS 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SGI old-style pty allocation" >&5 $as_echo_n "checking for SGI old-style pty allocation... " >&6; } if test -r /dev/ptc -a ! -r /dev/pts ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_PTC 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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. # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SCO style pty allocation" >&5 $as_echo_n "checking for SCO style pty allocation... " >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_SCO_CLIST_PTYS 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SVR4 style pty allocation" >&5 $as_echo_n "checking for SVR4 style pty allocation... " >&6; } if test -r /dev/ptmx -a "x$svr4_ptys_broken" = x ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_PTMX 1" >>confdefs.h # aargg. Some systems need libpt.a to use /dev/ptmx as_ac_Lib=`$as_echo "ac_cv_lib_pt_libpts="-lpt"" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpts=\"-lpt\" in -lpt" >&5 $as_echo_n "checking for libpts=\"-lpt\" in -lpt... " >&6; } if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char libpts="-lpt" (); int main () { return libpts="-lpt" (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$as_ac_Lib=yes" else eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : libpts="" fi ac_fn_c_check_func "$LINENO" "ptsname" "ac_cv_func_ptsname" if test "x$ac_cv_func_ptsname" = xyes; then : else LIBS="${LIBS} $libpts" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # In OSF/1 case, SVR4 are somewhat different. # Gregory Depp 17Aug93 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSF/1 style pty allocation" >&5 $as_echo_n "checking for OSF/1 style pty allocation... " >&6; } if test -r /dev/ptmx_bsd ; then $as_echo "#define HAVE_PTMX_BSD 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi tcgetattr=0 tcsetattr=0 ac_fn_c_check_func "$LINENO" "tcgetattr" "ac_cv_func_tcgetattr" if test "x$ac_cv_func_tcgetattr" = xyes; then : tcgetattr=1 fi ac_fn_c_check_func "$LINENO" "tcsetattr" "ac_cv_func_tcsetattr" if test "x$ac_cv_func_tcsetattr" = xyes; then : tcsetattr=1 fi if test $tcgetattr -eq 1 -a $tcsetattr -eq 1 ; then $as_echo "#define HAVE_TCSETATTR 1" >>confdefs.h $as_echo "#define POSIX 1" >>confdefs.h fi # first check for the pure bsd { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct sgttyb" >&5 $as_echo_n "checking for struct sgttyb... " >&6; } if test "$cross_compiling" = yes; then : as_fn_error $? "Expect can't be cross compiled" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include main() { struct sgttyb tmp; exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_SGTTYB 1" >>confdefs.h PTY_TYPE=sgttyb else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi # 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct termio" >&5 $as_echo_n "checking for struct termio... " >&6; } if test "$cross_compiling" = yes; then : as_fn_error $? "Expect can't be cross compiled" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include main() { struct termio tmp; exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : $as_echo "#define HAVE_TERMIO 1" >>confdefs.h PTY_TYPE=termios { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi # now check for the new style ttys (not yet posix) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct termios" >&5 $as_echo_n "checking for struct termios... " >&6; } if test "$cross_compiling" = yes; then : as_fn_error $? "Expect can't be cross compiled" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : $as_echo "#define HAVE_TERMIOS 1" >>confdefs.h PTY_TYPE=termios { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if TCGETS or TCGETA in termios.h" >&5 $as_echo_n "checking if TCGETS or TCGETA in termios.h... " >&6; } if test "$cross_compiling" = yes; then : as_fn_error $? "Expect can't be cross compiled" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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 } _ACEOF if ac_fn_c_try_run "$LINENO"; then : $as_echo "#define HAVE_TCGETS_OR_TCGETA_IN_TERMIOS_H 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if TIOCGWINSZ in termios.h" >&5 $as_echo_n "checking if TIOCGWINSZ in termios.h... " >&6; } if test "$cross_compiling" = yes; then : as_fn_error $? "Expect can't be cross compiled" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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 } _ACEOF if ac_fn_c_try_run "$LINENO"; then : $as_echo "#define HAVE_TIOCGWINSZ_IN_TERMIOS_H 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi # finally check for Cray style ttys { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cray-style ptys" >&5 $as_echo_n "checking for Cray-style ptys... " >&6; } SETUID=":" if test "$cross_compiling" = yes; then : as_fn_error $? "Expect can't be cross compiled" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ main(){ #ifdef CRAY return 0; #else return 1; #endif } _ACEOF if ac_fn_c_try_run "$LINENO"; then : PTY_TYPE=unicos SETUID="chmod u+s" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi # # 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_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" if test "x$ac_cv_func_select" = xyes; then : select=1 fi ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" if test "x$ac_cv_func_poll" = xyes; then : poll=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking event handling" >&5 $as_echo_n "checking event handling... " >&6; } if test $select -eq 1 ; then EVENT_TYPE=select EVENT_ABLE=event { $as_echo "$as_me:${as_lineno-$LINENO}: result: via select" >&5 $as_echo "via select" >&6; } elif test $poll -eq 1 ; then EVENT_TYPE=poll EVENT_ABLE=event { $as_echo "$as_me:${as_lineno-$LINENO}: result: via poll" >&5 $as_echo "via poll" >&6; } else EVENT_TYPE=simple EVENT_ABLE=noevent { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } $as_echo "#define SIMPLE_EVENT 1" >>confdefs.h fi for ac_func in _getpty do : ac_fn_c_check_func "$LINENO" "_getpty" "ac_cv_func__getpty" if test "x$ac_cv_func__getpty" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__GETPTY 1 _ACEOF fi done for ac_func in getpty do : ac_fn_c_check_func "$LINENO" "getpty" "ac_cv_func_getpty" if test "x$ac_cv_func_getpty" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPTY 1 _ACEOF fi done # following test sets SETPGRP_VOID if setpgrp takes 0 args, else takes 2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setpgrp takes no argument" >&5 $as_echo_n "checking whether setpgrp takes no argument... " >&6; } if ${ac_cv_func_setpgrp_void+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : as_fn_error $? "cannot check setpgrp when cross compiling" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* If this system has a BSD-style setpgrp which takes arguments, setpgrp(1, 1) will fail with ESRCH and return -1, in that case exit successfully. */ return setpgrp (1,1) != -1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_setpgrp_void=no else ac_cv_func_setpgrp_void=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_setpgrp_void" >&5 $as_echo "$ac_cv_func_setpgrp_void" >&6; } if test $ac_cv_func_setpgrp_void = yes; then $as_echo "#define SETPGRP_VOID 1" >>confdefs.h fi # # check for timezones # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SV-style timezone" >&5 $as_echo_n "checking for SV-style timezone... " >&6; } if test "$cross_compiling" = yes; then : as_fn_error $? "Expect can't be cross compiled" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern char *tzname[2]; extern int daylight; main() { int *x = &daylight; char **y = tzname; exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : $as_echo "#define HAVE_SV_TIMEZONE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi # 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!?) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long file names" >&5 $as_echo_n "checking for long file names... " >&6; } if ${ac_cv_sys_long_file_names+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_long_file_names=yes # Test for long file names in all the places we know might matter: # . the current directory, where building will happen # $prefix/lib where we will be installing things # $exec_prefix/lib likewise # $TMPDIR if set, where it might want to write temporary files # /tmp where it might want to write temporary files # /var/tmp likewise # /usr/tmp likewise for ac_dir in . "$TMPDIR" /tmp /var/tmp /usr/tmp "$prefix/lib" "$exec_prefix/lib"; do # Skip $TMPDIR if it is empty or bogus, and skip $exec_prefix/lib # in the usual case where exec_prefix is '${prefix}'. case $ac_dir in #( . | /* | ?:[\\/]*) ;; #( *) continue;; esac test -w "$ac_dir/." || continue # It is less confusing to not echo anything here. ac_xdir=$ac_dir/cf$$ (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue ac_tf1=$ac_xdir/conftest9012345 ac_tf2=$ac_xdir/conftest9012346 touch "$ac_tf1" 2>/dev/null && test -f "$ac_tf1" && test ! -f "$ac_tf2" || ac_cv_sys_long_file_names=no rm -f -r "$ac_xdir" 2>/dev/null test $ac_cv_sys_long_file_names = no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_long_file_names" >&5 $as_echo "$ac_cv_sys_long_file_names" >&6; } if test $ac_cv_sys_long_file_names = yes; then $as_echo "#define HAVE_LONG_FILE_NAMES 1" >>confdefs.h fi 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" $as_echo "#define EXP_FRAMEWORK 1" >>confdefs.h 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 # # Expect uses these from tclConfig.sh to make the main executable #-------------------------------------------------------------------- # 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. #----------------------------------------------------------------------- vars=" 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 " for i in $vars; do case $i in \$*) # allow $-var names PKG_SOURCES="$PKG_SOURCES $i" PKG_OBJECTS="$PKG_OBJECTS $i" ;; *) # check for existence - allows for generic/win/unix VPATH # To add more dirs here (like 'src'), you have to update VPATH # in Makefile.in as well if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ -a ! -f "${srcdir}/macosx/$i" \ ; then as_fn_error $? "could not find source file '$i'" "$LINENO" 5 fi PKG_SOURCES="$PKG_SOURCES $i" # this assumes it is in a VPATH dir i=`basename $i` # handle user calling this before or after TEA_SETUP_COMPILER if test x"${OBJEXT}" != x ; then j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" else j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" fi PKG_OBJECTS="$PKG_OBJECTS $j" ;; esac done # 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. vars=" pty_${PTY_TYPE}.c exp_${EVENT_TYPE}.c exp_${EVENT_ABLE}.c " for i in $vars; do case $i in \$*) # allow $-var names PKG_SOURCES="$PKG_SOURCES $i" PKG_OBJECTS="$PKG_OBJECTS $i" ;; *) # check for existence - allows for generic/win/unix VPATH # To add more dirs here (like 'src'), you have to update VPATH # in Makefile.in as well if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ -a ! -f "${srcdir}/macosx/$i" \ ; then as_fn_error $? "could not find source file '$i'" "$LINENO" 5 fi PKG_SOURCES="$PKG_SOURCES $i" # this assumes it is in a VPATH dir i=`basename $i` # handle user calling this before or after TEA_SETUP_COMPILER if test x"${OBJEXT}" != x ; then j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" else j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" fi PKG_OBJECTS="$PKG_OBJECTS $j" ;; esac done vars="expect.h expect_tcl.h expect_comm.h tcldbg.h" for i in $vars; do # check for existence, be strict because it is installed if test ! -f "${srcdir}/$i" ; then as_fn_error $? "could not find header file '${srcdir}/$i'" "$LINENO" 5 fi PKG_HEADERS="$PKG_HEADERS $i" done vars="-I." for i in $vars; do PKG_INCLUDES="$PKG_INCLUDES $i" done vars="-I\"`\${CYGPATH} \${srcdir}`\"" for i in $vars; do PKG_INCLUDES="$PKG_INCLUDES $i" done vars="" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi PKG_LIBS="$PKG_LIBS $i" done PKG_CFLAGS="$PKG_CFLAGS -DTCL_DEBUGGER -DUSE_NON_CONST" PKG_CFLAGS="$PKG_CFLAGS -DSCRIPTDIR=\\\"\${DESTDIR}\${prefix}/lib/\${PKG_DIR}\\\"" PKG_CFLAGS="$PKG_CFLAGS -DEXECSCRIPTDIR=\\\"\${DESTDIR}\${pkglibdir}\\\"" PKG_CFLAGS="$PKG_CFLAGS -DSTTY_BIN=\\\"${STTY_BIN}\\\"" PKG_CFLAGS="$PKG_CFLAGS -DDFLT_STTY=\"\\\"$DEFAULT_STTY_ARGS\\\"\"" vars="" for i in $vars; do # check for existence - allows for generic/win/unix VPATH if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \ -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \ -a ! -f "${srcdir}/macosx/$i" \ ; then as_fn_error $? "could not find stub source file '$i'" "$LINENO" 5 fi PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i" # this assumes it is in a VPATH dir i=`basename $i` # handle user calling this before or after TEA_SETUP_COMPILER if test x"${OBJEXT}" != x ; then j="`echo $i | sed -e 's/\.[^.]*$//'`.${OBJEXT}" else j="`echo $i | sed -e 's/\.[^.]*$//'`.\${OBJEXT}" fi PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j" done vars="" for i in $vars; do # check for existence, be strict because it is installed if test ! -f "${srcdir}/$i" ; then as_fn_error $? "could not find tcl source file '${srcdir}/$i'" "$LINENO" 5 fi PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i" done #-------------------------------------------------------------------- # 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. #-------------------------------------------------------------------- if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then MAKE_STATIC_LIB="\${STLIB_LD} -out:\$@ \$(PKG_OBJECTS)" MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\$@ \$(PKG_OBJECTS)" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined(_MSC_VER) && _MSC_VER >= 1400 print("manifest needed") #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "manifest needed" >/dev/null 2>&1; then : # Could do a CHECK_PROG for mt, but should always be with MSVC8+ VC_MANIFEST_EMBED_DLL="if test -f \$@.manifest ; then mt.exe -nologo -manifest \$@.manifest -outputresource:\$@\;2 ; fi" VC_MANIFEST_EMBED_EXE="if test -f \$@.manifest ; then mt.exe -nologo -manifest \$@.manifest -outputresource:\$@\;1 ; fi" MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}" CLEANFILES="$CLEANFILES *.manifest" fi rm -f conftest* MAKE_STUB_LIB="\${STLIB_LD} -out:\$@ \$(PKG_STUB_OBJECTS)" else MAKE_STATIC_LIB="\${STLIB_LD} \$@ \$(PKG_OBJECTS)" MAKE_SHARED_LIB="\${SHLIB_LD} -o \$@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}" MAKE_STUB_LIB="\${STLIB_LD} \$@ \$(PKG_STUB_OBJECTS)" fi if test "${SHARED_BUILD}" = "1" ; then MAKE_LIB="${MAKE_SHARED_LIB} " else MAKE_LIB="${MAKE_STATIC_LIB} " fi #-------------------------------------------------------------------- # Shared libraries and static libraries have different names. # Use the double eval to make sure any variables in the suffix is # substituted. (@@@ Might not be necessary anymore) #-------------------------------------------------------------------- if test "${TEA_PLATFORM}" = "windows" ; then if test "${SHARED_BUILD}" = "1" ; then # We force the unresolved linking of symbols that are really in # the private libraries of Tcl and Tk. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\"" if test x"${TK_BIN_DIR}" != x ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" fi eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" else eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" fi # Some packages build their own stubs libraries eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" if test "$GCC" = "yes"; then PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE} fi # These aren't needed on Windows (either MSVC or gcc) RANLIB=: RANLIB_STUB=: else RANLIB_STUB="${RANLIB}" if test "${SHARED_BUILD}" = "1" ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" if test x"${TK_BIN_DIR}" != x ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}" fi eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" RANLIB=: else eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" fi # Some packages build their own stubs libraries eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" fi # These are escaped so that only CFLAGS is picked up at configure time. # The other values will be substituted at make time. CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}" if test "${SHARED_BUILD}" = "1" ; then CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}" fi #-------------------------------------------------------------------- # 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. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 $as_echo_n "checking for tclsh... " >&6; } if test -f "${TCL_BIN_DIR}/Makefile" ; then # tclConfig.sh is in Tcl build directory if test "${TEA_PLATFORM}" = "windows"; then TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" else TCLSH_PROG="${TCL_BIN_DIR}/tclsh" fi else # tclConfig.sh is in install location if test "${TEA_PLATFORM}" = "windows"; then TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}" else TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}" fi list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \ `ls -d ${TCL_BIN_DIR}/.. 2>/dev/null` \ `ls -d ${TCL_PREFIX}/bin 2>/dev/null`" for i in $list ; do if test -f "$i/${TCLSH_PROG}" ; then REAL_TCL_BIN_DIR="`cd "$i"; pwd`/" break fi done TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${TCLSH_PROG}" >&5 $as_echo "${TCLSH_PROG}" >&6; } #-------------------------------------------------------------------- # 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_config_files="$ac_config_files Makefile" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS="" : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by expect $as_me 5.45.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ expect config.status 5.45.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "default":C) chmod +x ${srcdir}/install-sh ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file, --srcdir, and --disable-option-checking arguments # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; --disable-option-checking) ;; *) case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_sub_configure_args " '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi # Always prepend --disable-option-checking to silence warnings, since # different subdirs can have different --enable and --with options. ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 $as_echo "$ac_msg" >&6 as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 fi cd "$ac_popdir" done fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi expect5.45.4/exp_win.c0000664000175000017500000001004513235134350015144 0ustar pysslingpyssling/* exp_win.c - window support Written by: Don Libes, NIST, 10/25/93 This file is in the public domain. However, the author and NIST would appreciate credit if you use this file or parts of it. */ #include "expect_cf.h" #include "tcl.h" #ifdef NO_STDLIB_H #include "../compat/stdlib.h" #else #include #endif /* _IBCS2 required on some Intel platforms to allow the include files */ /* to produce a definition for winsize. */ #define _IBCS2 1 /* * get everyone's window size definitions * note that this is tricky because (of course) everyone puts them in different places. Worse, on some systems, some .h files conflict and cannot both be included even though both exist. This is the case, for example, on SunOS 4.1.3 using gcc where termios.h conflicts with sys/ioctl.h */ #ifdef HAVE_TERMIOS # include #else # include #endif /* Sigh. On AIX 2.3, termios.h exists but does not define TIOCGWINSZ */ /* Instead, it has to come from ioctl.h. However, As I said above, this */ /* can't be cavalierly included on all machines, even when it exists. */ #if defined(HAVE_TERMIOS) && !defined(HAVE_TIOCGWINSZ_IN_TERMIOS_H) # include #endif /* SCO defines window size structure in PTEM and TIOCGWINSZ in termio.h */ /* Sigh... */ #if defined(HAVE_SYS_PTEM_H) # include /* for stream.h's caddr_t */ # include /* for ptem.h's mblk_t */ # include #endif /* HAVE_SYS_PTEM_H */ #include "exp_tty_in.h" #include "exp_win.h" #ifdef TIOCGWINSZ typedef struct winsize exp_winsize; #define columns ws_col #define rows ws_row #define EXP_WIN #endif #if !defined(EXP_WIN) && defined(TIOCGSIZE) typedef struct ttysize exp_winsize; #define columns ts_cols #define rows ts_lines #define EXP_WIN #endif #if !defined(EXP_WIN) typedef struct { int columns; int rows; } exp_winsize; #endif static exp_winsize winsize = {0, 0}; static exp_winsize win2size = {0, 0}; int exp_window_size_set(fd) int fd; { #ifdef TIOCSWINSZ ioctl(fd,TIOCSWINSZ,&winsize); #endif #if defined(TIOCSSIZE) && !defined(TIOCSWINSZ) ioctl(fd,TIOCSSIZE,&winsize); #endif } int exp_window_size_get(fd) int fd; { #ifdef TIOCGWINSZ ioctl(fd,TIOCGWINSZ,&winsize); #endif #if defined(TIOCGSIZE) && !defined(TIOCGWINSZ) ioctl(fd,TIOCGSIZE,&winsize); #endif #if !defined(EXP_WIN) winsize.rows = 0; winsize.columns = 0; #endif } void exp_win_rows_set(rows) char *rows; { winsize.rows = atoi(rows); exp_window_size_set(exp_dev_tty); } char* exp_win_rows_get() { static char rows [20]; exp_window_size_get(exp_dev_tty); sprintf(rows,"%d",winsize.rows); return rows; } void exp_win_columns_set(columns) char *columns; { winsize.columns = atoi(columns); exp_window_size_set(exp_dev_tty); } char* exp_win_columns_get() { static char columns [20]; exp_window_size_get(exp_dev_tty); sprintf(columns,"%d",winsize.columns); return columns; } /* * separate copy of everything above - used for handling user stty requests */ int exp_win2_size_set(fd) int fd; { #ifdef TIOCSWINSZ ioctl(fd,TIOCSWINSZ,&win2size); #endif #if defined(TIOCSSIZE) && !defined(TIOCSWINSZ) ioctl(fd,TIOCSSIZE,&win2size); #endif } int exp_win2_size_get(fd) int fd; { #ifdef TIOCGWINSZ ioctl(fd,TIOCGWINSZ,&win2size); #endif #if defined(TIOCGSIZE) && !defined(TIOCGWINSZ) ioctl(fd,TIOCGSIZE,&win2size); #endif } void exp_win2_rows_set(fd,rows) int fd; char *rows; { exp_win2_size_get(fd); win2size.rows = atoi(rows); exp_win2_size_set(fd); } char* exp_win2_rows_get(fd) int fd; { static char rows [20]; exp_win2_size_get(fd); sprintf(rows,"%d",win2size.rows); #if !defined(EXP_WIN) win2size.rows = 0; win2size.columns = 0; #endif return rows; } void exp_win2_columns_set(fd,columns) int fd; char *columns; { exp_win2_size_get(fd); win2size.columns = atoi(columns); exp_win2_size_set(fd); } char* exp_win2_columns_get(fd) int fd; { static char columns [20]; exp_win2_size_get(fd); sprintf(columns,"%d",win2size.columns); return columns; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ expect5.45.4/exp_glob.c0000664000175000017500000002467413235134350015307 0ustar pysslingpyssling/* exp_glob.c - expect functions for doing glob Based on Tcl's glob functions but modified to support anchors and to return information about the possibility of future matches Modifications by: Don Libes, NIST, 2/6/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #include "expect_cf.h" #include "tcl.h" #include "exp_int.h" /* Proper forward declaration of internal function */ static int Exp_StringCaseMatch2 _ANSI_ARGS_((CONST Tcl_UniChar *string, /* String. */ CONST Tcl_UniChar *stop, /* First char _after_ string */ CONST Tcl_UniChar *pattern, /* Pattern, which may contain * special characters. */ CONST Tcl_UniChar *pstop, /* First char _after_ pattern */ int nocase)); /* The following functions implement expect's glob-style string matching */ /* Exp_StringMatch allow's implements the unanchored front (or conversely */ /* the '^') feature. Exp_StringMatch2 does the rest of the work. */ int /* returns # of CHARS that matched */ Exp_StringCaseMatch(string, strlen, pattern, plen, nocase, offset) /* INTL */ Tcl_UniChar *string; Tcl_UniChar *pattern; int strlen; int plen; int nocase; int *offset; /* offset in chars from beginning of string where pattern matches */ { CONST Tcl_UniChar *s; CONST Tcl_UniChar *stop = string + strlen; CONST Tcl_UniChar *pstop = pattern + plen; int ssm, sm; /* count of bytes matched or -1 */ int caret = FALSE; int star = FALSE; #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog("\nESCM pattern(%d)=\"",plen); expDiagLogU(expPrintifyUni(pattern,plen)); expDiagLog("\"\n"); expDiagLog(" string(%d)=\"",strlen); expDiagLogU(expPrintifyUni(string,strlen)); expDiagLog("\"\n"); expDiagLog(" nocase=%d\n",nocase); #endif *offset = 0; if (pattern[0] == '^') { caret = TRUE; pattern++; } else if (pattern[0] == '*') { star = TRUE; } /* * test if pattern matches in initial position. * This handles front-anchor and 1st iteration of non-front-anchor. * Note that 1st iteration must be tried even if string is empty. */ sm = Exp_StringCaseMatch2(string,stop,pattern,pstop,nocase); #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog("@0 => %d\n",sm); #endif if (sm >= 0) return(sm); if (caret) return -1; if (star) return -1; if (*string == '\0') return -1; s = string + 1; sm = 0; #if 0 if ((*pattern != '[') && (*pattern != '?') && (*pattern != '\\') && (*pattern != '$') && (*pattern != '*')) { while (*s && (s < stop) && *pattern != *s) { s++; sm++; } } if (sm) { printf("skipped %d chars of %d\n", sm, strlen); fflush(stdout); } #endif for (;s < stop; s++) { ssm = Exp_StringCaseMatch2(s,stop,pattern,pstop,nocase); #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog("@%d => %d\n",s-string,ssm); #endif if (ssm != -1) { *offset = s-string; return(ssm+sm); } } return -1; } /* Exp_StringCaseMatch2 -- * * Like Tcl_StringCaseMatch except that * 1: returns number of characters matched, -1 if failed. * (Can return 0 on patterns like "" or "$") * 2: does not require pattern to match to end of string * 3: Much of code is stolen from Tcl_StringMatch * 4: front-anchor is assumed (Tcl_StringMatch retries for non-front-anchor) */ static int Exp_StringCaseMatch2(string,stop,pattern,pstop,nocase) /* INTL */ register CONST Tcl_UniChar *string; /* String. */ register CONST Tcl_UniChar *stop; /* First char _after_ string */ register CONST Tcl_UniChar *pattern; /* Pattern, which may contain * special characters. */ register CONST Tcl_UniChar *pstop; /* First char _after_ pattern */ int nocase; { Tcl_UniChar ch1, ch2, p; int match = 0; /* # of bytes matched */ CONST Tcl_UniChar *oldString; #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" ESCM2 pattern=\""); expDiagLogU(expPrintifyUni(pattern,pstop-pattern)); expDiagLog("\"\n"); expDiagLog(" string=\""); expDiagLogU(expPrintifyUni(string,stop-string)); expDiagLog("\"\n"); expDiagLog(" nocase=%d\n",nocase); #endif while (1) { #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" * ==========\n"); expDiagLog(" * pattern=\""); expDiagLogU(expPrintifyUni(pattern,pstop-pattern)); expDiagLog("\"\n"); expDiagLog(" * string=\""); expDiagLogU(expPrintifyUni(string,stop-string)); expDiagLog("\"\n"); #endif /* If at end of pattern, success! */ if (pattern >= pstop) { return match; } /* If last pattern character is '$', verify that entire * string has been matched. */ if ((*pattern == '$') && ((pattern + 1) >= pstop)) { if (string == stop) return(match); else return(-1); } /* Check for a "*" as the next pattern character. It matches * any substring. We handle this by calling ourselves * recursively for each postfix of string, until either we match * or we reach the end of the string. * * ZZZ: Check against Tcl core, port optimizations found there over here. */ if (*pattern == '*') { CONST Tcl_UniChar *tail; /* * Skip all successive *'s in the pattern */ while ((pattern < pstop) && (*pattern == '*')) { ++pattern; } if (pattern >= pstop) { return((stop-string)+match); /* DEL */ } p = *pattern; if (nocase) { p = Tcl_UniCharToLower(p); } /* find LONGEST match */ /* * NOTES * * The original code used 'strlen' to find the end of the * string. With the recursion coming this was done over and * over again, making this an O(n**2) operation overall. Now * the pointer to the end is passed in from the caller, and * even the topmost context now computes it from start and * length instead of seaching. * * The conversion to unicode also allow us to step back via * decrement, in linear time overall. The previously used * Tcl_UtfPrev crawled to the previous character from the * beginning of the string, another O(n**2) operation. */ tail = stop - 1; while (1) { int rc; #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" skip back '%c'\n",p); #endif /* * Optimization for matching - cruise through the string * quickly if the next char in the pattern isn't a special * character. * * NOTE: We cruise backwards to keep the semantics of * finding the LONGEST match. * * XXX JH: should this add '&& (p != '$')' ??? */ if ((p != '[') && (p != '?') && (p != '\\')) { if (nocase) { while ((tail >= string) && (p != *tail) && (p != Tcl_UniCharToLower(*tail))) { tail--;; } } else { /* * XXX JH: Should this be (tail > string)? * ZZZ AK: No. tail == string is perfectly acceptable, * if p == *tail. Backing before string is ok too, * that is the condition to break the outer loop. */ while ((tail >= string) && (p != *tail)) { tail --; } } } /* if we've backed up to before the beginning of string, give up */ if (tail < string) break; rc = Exp_StringCaseMatch2(tail, stop, pattern, pstop, nocase); #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" (*) rc=%d\n",rc); #endif if (rc != -1 ) { return match + (tail - string) + rc; /* match = # of bytes we've skipped before this */ /* (...) = # of bytes we've skipped due to "*" */ /* rc = # of bytes we've matched after "*" */ } /* if we've backed up to beginning of string, give up */ if (tail == string) break; tail --; if (tail < string) tail = string; } return -1; /* DEL */ } /* * after this point, all patterns must match at least one * character, so check this */ if (string >= stop) return -1; /* Check for a "?" as the next pattern character. It matches * any single character. */ if (*pattern == '?') { pattern++; oldString = string; string ++; match ++; /* incr by # of matched chars */ continue; } /* Check for a "[" as the next pattern character. It is * followed by a list of characters that are acceptable, or by a * range (two characters separated by "-"). */ if (*pattern == '[') { Tcl_UniChar ch, startChar, endChar; #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" class\n"); #endif pattern++; oldString = string; ch = *string++; while (1) { if ((pattern >= pstop) || (*pattern == ']')) { #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" end-of-pattern or class/1\n"); #endif return -1; /* was 0; DEL */ } startChar = *pattern ++; if (nocase) { startChar = Tcl_UniCharToLower(startChar); } if (*pattern == '-') { pattern++; if (pattern >= pstop) { #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" end-of-pattern/2\n"); #endif return -1; /* DEL */ } endChar = *pattern ++; if (nocase) { endChar = Tcl_UniCharToLower(endChar); } if (((startChar <= ch) && (ch <= endChar)) || ((endChar <= ch) && (ch <= startChar))) { /* * Matches ranges of form [a-z] or [z-a]. */ #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" matched-range\n"); #endif break; } } else if (startChar == ch) { #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" matched-char\n"); #endif break; } } while ((pattern < pstop) && (*pattern != ']')) { pattern++; } if (pattern < pstop) { /* * Skip closing bracket if there was any. * Fixes SF Bug 1873404. */ pattern++; } #ifdef EXP_INTERNAL_TRACE_GLOB expDiagLog(" skipped remainder of pattern\n"); #endif match += (string - oldString); /* incr by # matched chars */ continue; } /* If the next pattern character is backslash, strip it off so * we do exact matching on the character that follows. */ if (*pattern == '\\') { pattern ++; if (pattern >= pstop) { return -1; } } /* There's no special character. Just make sure that the next * characters of each string match. */ oldString = string; ch1 = *string ++; ch2 = *pattern ++; if (nocase) { if (Tcl_UniCharToLower(ch1) != Tcl_UniCharToLower(ch2)) { return -1; } } else if (ch1 != ch2) { return -1; } match += (string - oldString); /* incr by # matched chars */ } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ expect5.45.4/exp_prog.h0000664000175000017500000000116613235134350015327 0ustar pysslingpyssling/* exp_prog.h - private symbols common to both expect program and library Written by: Don Libes, libes@cme.nist.gov, NIST, 12/3/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #ifndef _EXPECT_PROG_H #define _EXPECT_PROG_H #include "expect_tcl.h" #include "exp_int.h" /* yes, I have a weak mind */ #define streq(x,y) (0 == strcmp((x),(y))) /* Constant strings for NewStringObj */ #define LITERAL(s) Tcl_NewStringObj ((s), sizeof(s)-1) #endif /* _EXPECT_PROG_H */ expect5.45.4/exp_event.h0000664000175000017500000000165313235134350015502 0ustar pysslingpyssling/* exp_event.h - event definitions */ int exp_get_next_event _ANSI_ARGS_((Tcl_Interp *,ExpState **, int, ExpState **, int, int)); int exp_get_next_event_info _ANSI_ARGS_((Tcl_Interp *, ExpState *)); int exp_dsleep _ANSI_ARGS_((Tcl_Interp *, double)); void exp_init_event _ANSI_ARGS_((void)); extern void (*exp_event_exit) _ANSI_ARGS_((Tcl_Interp *)); void exp_event_disarm _ANSI_ARGS_((ExpState *,Tcl_FileProc *)); void exp_event_disarm_bg _ANSI_ARGS_((ExpState *)); void exp_event_disarm_fg _ANSI_ARGS_((ExpState *)); void exp_arm_background_channelhandler _ANSI_ARGS_((ExpState *)); void exp_disarm_background_channelhandler _ANSI_ARGS_((ExpState *)); void exp_disarm_background_channelhandler_force _ANSI_ARGS_((ExpState *)); void exp_unblock_background_channelhandler _ANSI_ARGS_((ExpState *)); void exp_block_background_channelhandler _ANSI_ARGS_((ExpState *)); void exp_background_channelhandler _ANSI_ARGS_((ClientData,int)); expect5.45.4/FAQ0000644000175000017500000022237713235134350013674 0ustar pysslingpysslingExpect FAQ (Frequently Asked Questions) An HTML version of this FAQ can be found in http://expect.nist.gov/FAQ.html This FAQ lists common questions, usually about subjects that didn't fit well in the book for one reason or another (or weren't indexed sufficiently well so that people can't find the answers easily enough). In some cases, I've left the original questions. I suppose I could've stripped off the headers, but it seems more realistic to see actual people who've asked the questions. Thanks to everyone who asked. The man page and the papers listed in the README file should also be consulted for highly technical or philosophical discussion of the implementation, design, and practical application of Expect. Don ====================================================================== Here is the list of questions. You can search for the corresponding answer by searching for the question number. For example searching for "#3." will get you that answer. **** General **** #1. I keep hearing about Expect. So what is it? #2. How do you pronounce "Ousterhout" anyway? (Or "Libes" for that matter?) #3. Why should I learn yet another language (Tcl) instead of writing my interaction in ? #4. What about Perl? #5. Do we need to pay or ask for permission to distribute Expect? #6. Since Expect is free, can we give you a gift? #7. Are there any hidden dangers in using Expect? **** Book, newsgroup, FAQ, README, ... **** #8. Why is this FAQ so short? #9. How was this FAQ created? #10. The background makes the FAQ hard to read. #11. Why isn't there an Expect mailing list? #12. Why isn't overlay covered in Exploring Expect? #13. Is the front cover of your book a self portrait (ha ha)? #14. Why don't the examples in your USENIX papers work? #15. Can you put the examples in your book into an anonymous ftp site? #16. Do you have ideas for more articles on Expect? **** Can Expect do this? **** #17. Can Expect automatically generate a script from watching a session? #18. Can Expect understand screen-oriented (Curses) programs? #19. Can Expect be run as a CGI script? #20. Can Expect act like a browser and retrieve pages or talk to a CGI script? #21. Can Expect be run from cron? #22. Why does my Expect script not work under inetd? **** Compilation or porting questions **** #23. Why can't I compile Expect with Tcl 8.0? #24. Does Expect 5.26 work with Tcl/Tk 8.0.3? #25. Why can't I compile Expect with Tcl/Tk 8.1aX? #26. Why can't I compile Expect with Tcl/Tk 8.0b1? #27. Why does Expect need to be setuid root on Cray? #28. Does Expect run on VMS? #29. Is it possible to use Expect and TclX together? #30. Is it possible to use Expect and together? #31. Why does configure complain about "cross-compiling"? #32. Why are make/configure looping endlessly? #33. Why does compile fail with: Don't know how to make pty_.c? #34. Does Expect run on MSDOS, Win95, WinNT, MacOS, etc...? #35. Why does Expect dump core? Why can I run Expect as root but not as myself? **** Other... **** #36. Is it possible to prevent Expect from printing out its interactions? #37. Why does it send back the same string twice? #38. Why can't I send the line "user@hostname\r"? #39. How do I hide the output of the send command? #40. Why don't I see pauses between characters sent with send -s? #41. Why does "talk" fail with "Who are you? You have no entry utmp" or "You don't exist. Go away"? #42. Why does . match a newline? #43. Why doesn't Expect kill telnet (or other programs) sometimes? #44. How come I get "ioctl(set): Inappropriate ..., bye recursed"? #45. How come there's no interact function in the Expect library? #46. Can't you make tkterm understand any terminal type? #47. Trapping SIGCHLD causes looping sometimes #48. Why do I get "invalid spawn id"? #49. Could you put a version number in the filename of the Expect archive? #50. Why does Expect work as root, but say "out of ptys" when run as myself? #51. Why does spawn fail with "sync byte ...."? #52. Why does Expect fail on RedHat 5.0? #53. Why does Expect fail on RedHat 5.1? #54. Is Expect Y2K compliant? * * Questions and Answers * **** General **** #1. I keep hearing about Expect. So what is it? From: libes (Don Libes) To: Charles Hymes Subject: I keep hearing about Expect. So what is it? Charles Hymes writes: > >So, what is Expect? Expect is a tool primarily for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc. Expect really makes this stuff trivial. Expect is also useful for testing these same applications. Expect is described in many books, articles, papers, and FAQs. There is an entire book on it available from O'Reilly. Expect is free and in the public domain. Download instructions can be found in the Expect homepage. Don ====================================================================== #2. How do you pronounce "Ousterhout" anyway? (Or "Libes" for that matter?) From: ouster@sprite.Berkeley.EDU (John Ousterhout) To: libes@cme.nist.gov Subject: Re: pronunciation? Date: Tue, 29 May 90 21:26:10 PDT Those of us in the family pronounce it "OH-stir-howt", where the first syllable rhymes with "low", the second with "purr", and the third with "doubt". Unfortunately this isn't the correct Dutch pronounciation for a name spelled this way (someplace along the line it got misspelled: it was originally "Oosterhout"), nor is it what you'd guess if you use common sense. So, we've gotten used to responding to almost anything. -John- I suppose I should say something in kind. "Libes" is pronounced "Lee-bis" with stress on the first syllable. Like John though, I've gotten used to responding to anything close. By the way, notice the date on this message. I had only written the first cut of Expect four months earlier. I asked John how to pronounce his name because I had already got a paper accepted into USENIX and needed to be able to say his name correctly while giving the talk! Don ====================================================================== #3. Why should I learn yet another language (Tcl) instead of writing my interaction in ? From: libes (Don Libes) Subject: Re: Expect, Tcl, programmed dialogue etc. Date: Mon, 2 Sep 91 15:47:14 EDT >>>A friend told me about "Expect". But then, I have to know the >>>idiocies of "tcl". I would like to know if there is an alternative >>>to Expect that is also useful in other places, so that I do not >>>have to spend time getting used to tcl for just this one tool. > >>Your reasoning is shortsighted. Tcl is a language that can be used in >>other applications. It won't be a waste of your time to learn it. > >I have nothing against tcl as such. >The reluctance to learn it comes mainly from the feeling that half my >life seems to be spent learning new languages that differ very little >from existing ones, and differ in annoying little details at that. >To add to the misery, every implementation has its own >idiosyncracies...:-( Ironically, Tcl was written specifically to halt this very problem. The author recognized that every utility seems to have its own idiosyncratic .rc file or programming language. Tcl was designed as a general-purpose language that could be included with any utility, to avoid having everyone hack up their own new language. In this context, your statements do Tcl a great disservice. Don ====================================================================== #4. What about Perl? From: libes (Don Libes) To: Joe McGuckin Subject: Re: Need Perl examples Date: Sun, 22 Jan 95 20:17:39 EST Joe McGuckin writes: > >Yeah, I've scanned through your book a couple of times in the last >week, trying to make up my mind if I should buy it. I spent three years writing it - so I'm glad to hear you're spending a little time considering its merit! >Pro: > Looks like implementing some sort of telnet daemon would be trivial. Once you see it as an Expect script, you'll realize how trivial these things can really be. >Con: > Yet another language to learn. I know perl reasonably well & would > like to stick with it. Good point. While I'm not a Perl guru, I've used it quite a bit and it's nice for many things. But I wouldn't have bothered writing Expect in the first place if I thought Perl was ideal. And many Perl experts agree - I know a lot of them who call out to Expect scripts rather than do this stuff in Perl - it's that much easier with Expect. Expect is also much more mature. It's portable, stable, robust, and it's fully documented - with lots of examples and a complete tutorial, too. In response to someone complaining about how difficult it was to do something in Perl, Larry Wall once remarked: "The key to using Perl is to focus on its strengths and avoid its weaknesses." That definitely applies here. Even if you do proceed with Perl, you will find the book helpful. Automating interactive applications has unique pitfalls to it and many of the descriptions and solutions in the book transcend the choice of language that you use to implement them. Don ====================================================================== #5. Do we need to pay or ask for permission to distribute Expect? From: libes (Don Libes) To: Mohammad Reza Jahanbin Subject: Copyright Question. Date: Tue, 26 Jan 93 23:46:24 EST Mohammad Reza Jahanbin writes: >Before anything let me thank you on behalf of ComputeVision R&D for >putting so much effort into Expect. Part of CV has been using Expect >for the past two years or so to build variety of tools including an >automated testbed for a product. > >CV is currently considering shipping the automated testbed to some of its >retailers, to enable them to perform their own tests before distributing >the product. > >The Question is, are we allowed to ship Expect? Do we need to ask >anyone for permission? Do we need to say or write anything in the >documentation? Do we need to pay for it? > >I have not been able to find any copyright (or indeed copyleft) notices >in the usual Expect distribution. Would you be able to clarify our position. It is my understanding that you are allowed to do just about anything with Expect. You can even sell it. You need not ask our permission. You need not pay for it. (Your tax dollars, in effect, already have paid for it.) You should not claim that you wrote it (since this would be a lie), nor should you attempt to copyright it (this would be fruitless as it is a work of the US government and therefore not subject to copyright). NIST would appreciate any credit you can give for this work. One line may suffice (as far as I'm concerned) although there should be something to the effect that this software was produced for research purposes. No warantee, guarantee, or liability is implied. My management is always interested in feedback on our work. If you would like to send letters of praise describing how Expect has helped your business, we would be delighted. Letters (on letterhead please) are strong evidence used by policy makers when deciding where every dollar goes. If you want to send these letters to NIST directly, you may send them to the following individuals: Robert Hebner, Director NIST Admin Bldg, Rm A-1134 Gaithersburg, MD 20899 Ric Jackson, Manufacturing Engineering Laboratory NIST Bldg 220, Rm B-322 Gaithersburg, MD 20899 Steve Ray, Manufacturing Systems Integration Division NIST Bldg 220, Rm A-127 Gaithersburg, MD 20899 Amy Knutilla, Manufacturing Collaboration Technologies Group NIST Bldg 220, Rm A-127 Gaithersburg, MD 20899 In case you're wondering about the uninformative titles, Robert Hebner is the director of all of NIST (about 3000 people) and Amy Knutilla (way down there at the bottom) is my immediate supervisor. I hope this has answered your questions. Let me know if you have further questions. Don ====================================================================== #6. Since Expect is free, can we give you a gift? This is not an actual letter but represents the gist of several that I've received. >>>Expect has saved us many thousands of dollars. We'd like to send >>>you a free copy of our product. >> >>Thanks, but please don't. As a federal employee, I'm not >>allowed to accept gifts of any significant value. > >But, what if it is for personal use (like at home)? I assume >that would be okay. It doesn't matter (much). What the rules address is whether a gift might cause me to make an official decision differently. This is especially a concern because I may very well have to decide whether or not to buy products from your company in the future. There is a clause that says "you may accept gifts from friends, regardless of value ... but you should be careful to avoid accepting gifts which may create an appearance of impropriety, even if permitted as an exception to the gift rules." I'm still permitted to accept small token gifts, such as a t-shirt or reasonably-priced dinner (under $20 per gift to a maximum of $50 per year from any person or company) - so things are not totally ridiculous. Although the precise values in the gift rules seem rather arbitrary, I actually like the gift rules. They stop a lot of the nonsense that used to go on involving gifts. Don ====================================================================== #7. Are there any hidden dangers in using Expect? From: Charlton Henry Harrison To: libes@NIST.GOV Date: Fri, 27 Jan 1995 23:30:56 -0600 >>>Dear Don: >>> >>> I've been a fan of Expect ever since I first learned of UNIX back >>>in late '93. I'm young and don't have my CS degree just yet, but I worked >>>a while back at Texas Instruments in their Telecom Customer Support dept. >>>I started in late '93 (and hence, that's where I first started exploring >>>the UNIX environment) and immediately forsaw the need of automating a lot >>>of my redundant and mindless duties, but I didn't know how since we were >>>working over a heterogeneous LAN with multiple OSs. >>> Then I found out about Expect. I automated everything! My boss didn't >>>like hearing that I was working on something else in order to get out of >>>work, and I got tired of explaining it to him. >>> Although I accomplished all the aspects of my duties, I was infamous >>>for being the laziest person at work, and it showed (I made my job SO easy). >>>I got a new boss after a while, and he hated me from the start and fired >>>me soon after. Oh well, I guess my mentality didn't click with theirs. >>> There are a lot of people like that: they believe life is putting >>>in a hard day's work to get by. I hate that. >>> So the point is, thank you for the wonderful 'Expect'. I bought >>>your book and now I have the most recent version of it on my Linux system >>>at home. Needless to say I'm looking for another job, though. >>> >>> Charlton >>> >> Thanks very much for your nice letter. Sorry to hear about your >> automating yourself out of a job. Actually, I think most computer >> scientists have to face this dilemma. In some ways, it's a >> self-defeating occupation. >> >> Don > >Yeah, I'd be interested in hearing if you have a personal philosophy on >how to handle this kind of thing. I plan on pursuing a career in Artificial >Intelligence for similar reason of making life easier for everyone (me >in particular!) What the future holds in this category is a great >mystery. I'm glad you asked. My personal philosophy on this kind of thing is: Find someone really rich and marry them. Don ====================================================================== **** Book, newsgroup, FAQ, README, ... **** #8. Why is this FAQ so short? From: libes (Don Libes) To: Wade Holst Subject: Expect question Wade Holst writes: > > 1) Is there a more up-to-date version of the FAQ than what > comes with expect-5.5? (For such a useful application, I > would expect more than 12 questions). I know that a lot of other packages have *huge* FAQs but I have always believed that this is an indication that their regular documentation sucks. As questions arise that are not addressed well by the original docs, the docs themselves should be fixed rather than new ones created. In contrast, I believe that an FAQ should literally be a list of frequently asked questions and little else. An FAQ should not be a replacement for good documentation. In that sense, I have tried to use this FAQ as a second place to look rather than a first place. The place you should always look first is Exploring Expect. At over 600 pages, the book is very comprehensive, well-organized, and includes three indices and two tables-of-contents to make it very easy to find what you want to know. The book was not a rush job. During the three years I spent writing it, virtually every question I was asked became incorporated as subject material for the book. I wanted to make sure that the book wouldn't need much of an FAQ! It would not make sense to try and distill the entire book into an FAQ (that is actually comprehensive rather that truly frequently asked questions). There's simply too much material there. So this FAQ is short. It really tries to stick just to *truly* frequently asked questions. Don ====================================================================== #9. How was this FAQ created? The Expect FAQ is regularly recreated by a Tcl script which produces either text or HTML depending on how it is called. Using Tcl has two nice results: + I didn't have to choose one format and worry about converting it to the other. (Remember that the FAQ appears in HTML on the web and it appears in text in the Expect distribution.) The more common approach - doing conversions in either direction - is really painful - plus, it's now easy to generate other formats, too. + It's much, much easier to keep track of questions and answers. For example, when I add a new question, I don't have to add it twice (once at the top and again later with the answer), nor do I have to worry about making the links between them. All this and a lot of other stuff is handled automatically - and the source is much more readable than the actual HTML. (see "FAQbuilder") You can read about these ideas in a paper that appeared at Tcl '96 called Writing CGI Scripts in Tcl. (CGI scripts are the primary focus of the paper, but it also spends time on HTML generation for other purposes - including the example of highly stylized documents like FAQs.) I encourage you to examine the source to this FAQ - it comes in two parts: + Expect-specific FAQ source + Generic FAQ Builder source The generic FAQ builder has also been used to build several other FAQs (unrelated to Expect). Don ====================================================================== #10. The background makes the FAQ hard to read. To: bonneau@mudd.csap.af.mil (Allen Bonneau) Subject: FAQ background colors Date: Wed, 10 Apr 96 10:24:52 EDT Allen Bonneau writes: >... the white and gray background makes the FAQ difficult to read. It's not white and gray. It's several very close shades of gray. It's supposed to be very subtle. Sounds like you have your browser in a mode where it is mishandling colors. Turn on dithering and restart your browser. Don ====================================================================== #11. Why isn't there an Expect mailing list? From: libes (Don Libes) To: dclark@nas.nasa.gov (David R. Clark) Subject: Mailing list for Expect Date: Mon, 23 Sep 91 18:21:28 EDT >Would be nice if their were an Expect mailing list. I would use it more >often, and be made aware of other users. Perhaps I'm too myopic, but I don't see the need for it. Most of the questions about Expect posted to Usenet every day can be found in the various FAQs or in the book, so it's pretty easy getting answers to them. For one reason or another (occasionally a bug fix, but often, just adding a neat example), I update Expect every couple of weeks. Personally, I'd hate being on the other end of something like this. Who needs patches every two weeks for problems that are likely not even relevant to you? (Most patches these days are either extremely esoteric or are related to porting Expect to some unusual machine.) >It would be helpful, too, if this served as an area for swapping programs. >Many of the things that I want to do are done by others already. NIST doesn't distribute software written by other people but if you've got relatively small scripts that show off unique ideas and techniques that would be educational for the Expect community, I can include your script with Expect or put it in a publicly accessible directory so other people can get it. I'm also willing to list links in Expect's home page to other web pages about projects that use Expect. There is a Tcl newsgroup, comp.lang.tcl, which many Expect users read. It's pretty good for asking questions about Tcl, and many of the readers use Expect so Expect questions are encouraged. The newsgroup is gatewayed to a mailing list (tcl@sprite.berkeley.edu) which is further described in the Tcl documentation. Don ====================================================================== #12. Why isn't overlay covered in Exploring Expect? To: spaf@cs.purdue.edu Gene Spafford writes: >I'm curious as to why the "overlay" command is not mentioned anywhere >in the book. Is that a recent addition? A deprecated feature? I >ended up using it in one of my scripts.... The overlay command has been in Expect for a long time. In all that time no one has ever asked me about it and I have never used it. Well, I used it once but I really didn't like the result, and so I rewrote the script to not use it. I left the overlay command in Expect because it seemed like an interesting idea, but I never really finished it - in the sense that I believe it needs some more options and controls. In comparison, the interact command is very flexible and makes the need for overlay pretty moot. Don ====================================================================== #13. Is the front cover of your book a self portrait (ha ha)? From: libes (Don Libes) To: pkinz@cougar.tandem.com (kinzelman_paul) Subject: the cover? kinzelman paul writes: >The book finally came in. I tried to buy 4 copies but they had only 2 >left and they came in last Saturday. Move over Stephen King! :-) 4 copies!? Wow. That's more than my mother bought! >I was discussing your book with somebody who stopped in and we began >to speculate about the monkey on the cover. I don't suppose it's a >self portrait? :-) There is some real humor here. There seems to be considerable debate over what the creature is! The colophon at the end of the book says that it is a chimpanzee. I like that idea much more than a monkey which is what it looks like to me. My wife, who has a degree in zoology, explained to me that chimps are actually the second smartest of primates (humans are the smartest). Chimps are very intelligent and can do many things (but not everything) that humans do. Perfect for describing Expect. Anyway, she says I should be honored to have it grace the cover - even in theory. I remarked to Edie (the cover designer at O'Reilly) that even though the cover was nice looking, everyone was going to stare at it and say, "Gee, but it looks like a monkey." She replied "The purpose of the cover is just to get people to pick the book up. This cover will do that. Don't worry. If you get any rude comments from anyone, at least you know they are paying attention." [After being inundated by people pointing out that the animal really is a monkey, O'Reilly subsequently decided to acquiesce and has changed the colophon to admit that yes it is a rhesus monkey. Evidentally, the book from which O'Reilly has been taking those pictures from was wrong on this one.] Don ====================================================================== #14. Why don't the examples in your USENIX papers work? From: libes (Don Libes) To: Will Smith (AC) Subject: Expect Will Smith (AC) writes: >I just entered some scripts from a USENIX paper that my boss had. I get >errors about my quotes in the script. Also, it doesn't seem to know >about expect_match. Thanks in advance for any insight you could offer. The USENIX papers are old and out-of-date as far as quoting goes. A couple years ago, I cleaned up and simplified this aspect of Expect. Similarly, expect_out is now where the results of expect's pattern matching are saved. The man page is always the best reference on what Expect currently supports. Alternatively, you can read the CHANGES files. These files document the changes from one major version to another. Don ====================================================================== #15. Can you put the examples in your book into an anonymous ftp site? From: libes (Don Libes) To: pren@cs.umass.edu Subject: Examples in your book "Exploring Expect" Peifong Ren writes: > >Hi, > >I bought your book "Exploring Expect" from O'Reilly. >I wonder can you put the eamples in your book into an anonymous ftp >site? All of the substantive examples come with recent versions of Expect. Just look in the example directory. The remaining 50 or so examples are short enough that typing them in only takes a minute or two. If I put them online, you'd spend more time looking for them (reading my online catalog, figuring out what the online descriptions meant, mapping them back to the file, etc.) then it would take to type them in. And since you're likely to want to change the examples anyway, there's nothing to be gained for short ones. Don ====================================================================== #16. Do you have ideas for more articles on Expect? From: libes (Don Libes) To: faught@zeppelin.convex.com (Danny R. Faught) Cc: libes Subject: Re: SQA Quarterly articles Date: Thu, 21 Dec 95 13:31:01 EST Danny R. Faught writes: >I just arranged to write an article on automating interactive >processes for an issue early next year. You have so many good pieces >on expect out there, it's going to be hard to add anything original. One thing I've never written is a good mini-tutorial. Magazine editors love these types of pieces and there's certainly a need for it. So I'd encourage that type of article. Another possibility is an article on how you or your colleagues personally applied Expect to solve your particular problem. Application- oriented papers are the kind that necessarily have to be written by people in the field who are applying the technology. People love this kind of practical paper. For example, a good paper might be "Writing a pager". This is a nice topic because you can start with a simple 5-line script that solves the problem and then show progressive refinements that handle different twists on the same problem. (And "how to write a pager" is a very frequently asked question on Usenet.) Don ====================================================================== **** Can Expect do this? **** #17. Can Expect automatically generate a script from watching a session? From: libes (Don Libes) To: pete@willow24.cray.com Subject: Expect Date: Fri, 12 Oct 90 17:16:47 EDT >I like "Expect" and am thinking of using it to help automate the >testing of interactive programs. It would be useful if Expect had a >"watch me" mode, where it "looks over the shoulder" of the user and >records his keystrokes for later use in an Expect script. > >(Red Ryder and other Macintosh telecommunications packages offer this >sort of thing. You log onto Compuserve once in "watch me" mode, and >RR keeps track of the keystrokes/prompts. When you're done you have a >script that can be used to log onto Compuserve automatically.) > >Before I look into adding a "watch me" feature, I thought I should >ask: has this been done already? > >I'll say again that I like the tool a lot--nice work! There are other >people here using it for things like the testing of ksh, which >responds differently to signals when not used interactively. > >-- Pete The autoexpect script in Expect's example directory does what you want. Don ====================================================================== #18. Can Expect understand screen-oriented (Curses) programs? Yes, it can - with a little clever scripting. Look at the term_expect script for an example. It uses a Tk text widget to support screen-oriented Expect commands. This technique is described very thoroughly in Chapter 19 of Exploring Expect. Adrian Mariano (adrian@cam.cornell.edu) converted the term_expect code (see above) so that it runs without Tk (exercise 4 in Chapter 19!) Both term_expect and virterm can be found in the example directory that comes with Expect. An alternative approach to screen-handling was demonstrated by Mark Weissman (weissman@gte.com) and Christopher Matheus who modified a version of Expect to include a built-in Curses emulator. It can be ftp'd from the Tcl archive as expecTerm1.0beta.tar.Z. (Note that Expecterm does not run with the current version of Expect.) I like the idea of keeping the curses emulator outside of Expect itself. It leaves the interface entirely defineable by the user. And you can do things such as define your own terminal types if you want. For these reasons and several others, I'm not likely to return to Expecterm. Don ====================================================================== #19. Can Expect be run as a CGI script? Expect scripts work fine as CGI scripts. A couple pointers might help to get you going: Many Expect scripts can be run directly with one change - the following line should be inserted before any other output: puts "Content-type: text/html\n" Be sure not to forget that extra newline at the end of the puts. Next, make sure you invoke external programs using full paths. For example, instead of "spawn telnet", use "spawn /usr/ucb/telnet" (or whatever). Remember that the PATH and other environment variables are going to be different than what you are used to. This is very similar to dealing with cron and you can get other good tips and advice from reading the Background chapter in the book. Another tip: If a script runs fine by hand but not from CGI, just log in as "nobody" to the host on which your CGI script runs. Then try running it by hand. This generally makes it very obvious what's going on. (If you can't log in to the server or can't log in as "nobody", use the kibitz trick described in the Background chapter.) You may find it helpful to use cgi.tcl, a nice collection of CGI support utilities for Tcl scripts. It includes an Expect example among many others. The package includes just about everything: tables, frames, cookies, file upload, etc...., with some nice debugging support. It's pure Tcl, no C code - so it's very easy to try out and use. Don ====================================================================== #20. Can Expect act like a browser and retrieve pages or talk to a CGI script? From: jasont@netscape.com (Jason Tu) Date: Sat, 02 Nov 1996 09:51:03 -0800 I read your book "Exploring Expect" and find Expect is just the tool to test Netscape's enterprise server product, since it is very easy to use and quick to develop. I figured I would use telnet to send HTTP protocol dialog to a HTTP server and simulate how it behaves. But I couldn't get it to work at all. I am wondering that there might be a quick example that you can share with me. Yes, this is a useful way of testing HTTP servers and running CGI scripts (and winning Web contests :-). You can add error checking and other stuff, but here's the minimum your script should have to read a web page: match_max 100000 set timeout -1 spawn telnet $host 80 expect "Escape character is *\n" send "GET $page\r\n" expect puts "$expect_out(buffer)" If you want to communicate information to a CGI script, you'll want more. One way to see what needs to be sent is to load a real browser with the form and then send it to a fake daemon such as this one: #!/bin/sh /bin/cat -u > /tmp/catlog Enable this by adding this service to inetd. Then save the form in a temporary file, modify the form's host and port to correspond to your own host and whatever port you've chosen to associate with your fake daemon. Now fill out the form and you'll find the form data in /tmp/catlog. Using this, you can determine exactly how to amend your Expect script to behave like your browser. Don ====================================================================== #21. Can Expect be run from cron? Expect itself works fine from cron - however, you can cause problems if you do things that don't make sense in cron - such as assume that there is a terminal type predefined. There are a number of other pitfalls to watch out for. The list and explanations aren't short - which is why there's a whole chapter ("Background") on the subject in the book. Here's one that someone tried to stump me with recently: They told me that their program started up and then Expect immediately exited. We spent a lot of time tracking this down (Was the spawned program really starting up but then hanging - which would indicate a bug in the program; or was the program NOT starting up - which would indicate a bug in the environment; etc.) Turned out that Expect wasn't even running their program. They had assumed cron honored the #! line (which it doesn't) and so the first line in their script (exec date) was being interpreted by the shell and of course, the script did nothing after that - because that's what the shell's exec is supposed to do!) Don ====================================================================== #22. Why does my Expect script not work under inetd? From: dpm@bga.com (David P. Maynard) Subject: Re: Tcl/Expect, inetd service, and no echo password Date: 24 Oct 1996 13:34:57 -0500 In article <54ocsh$9i1@urchin.bga.com> dpm@bga.com (David P. Maynard) writes: I am fairly new to expect, so hopefully this isn't too obvious. I also confess to not having looked in "Exploring Expect" becuase I haven't found it in stock at a local bookstore yet. I want to write an expect script that runs as a service from inetd. (Actually, I plan to use the tcpd 'twist' command to launch the binary, but that doesn't seem to affect the problem.) The script will prompt the user for a password. The supplied password is used as a key to decrypt some passwords stored online. The script then fires off a telnet session to a remote box and does some fairly simple things that require the decrypted passwords. I have all of this working when I run the script from a UNIX prompt. However, when I run it out of inetd, the 'stty -echo' commands that turn off character echo when the user types the password fail with the following error: stty: impossible in this context are you disconnected or in a batch, at or cron script? stty: ioctl(user): Bad file descriptor I can understand the cause of the message (no associated tty), but I can't think of an easy solution. If I use 'gets' or 'expect_user,' the user's input is always echoed. I tried a few variations on the stty command, but didn't have any luck. Any suggestions? Yes, read Exploring Expect, Chapter 17 (Background Processing). In the section "Expect as a Daemon", there's a very thorough discussion of this problem and how to solve it. In short, there's no tty when you run a process from inetd. Echoing is controlled by the telnet protocol, so you must send and expect telnet protocol packets to solve the problem. Even knowing this, the actual implementation is very non-obvious which is why the book goes into it in such detail. Don ====================================================================== **** Compilation or porting questions **** #23. Why can't I compile Expect with Tcl 8.0? Sounds like you have an old version of Expect. Get a a new version of Expect. Don ====================================================================== #24. Does Expect 5.26 work with Tcl/Tk 8.0.3? To: aspi@cisco.com Subject: Re: Expect 5.26 and TCL 8.0 Aspi Siganporia writes: > >Hi Don, > >We are looking at upgrading Expect. Our last version was Expect5.22 > >I see that Expect5.26 supports TCL 8.0. > >The question is, > >Will it work with TCL8.0.3? > >Thanks >Aspi It might. 8.0.3 broke a couple of the more esoteric configurations. If you find that you can't compile using 5.26, get 5.27. Don ====================================================================== #25. Why can't I compile Expect with Tcl/Tk 8.1aX? Historically, I've rarely found the time to port Expect to alphas and betas. I recommend you stick with 8.0 unless you're willing to do a little work. Don ====================================================================== #26. Why can't I compile Expect with Tcl/Tk 8.0b1? I don't see the point in supporting an old beta. Upgrade to the production release of Tcl/Tk 8.0. Don ====================================================================== #27. Why does Expect need to be setuid root on Cray? From: libes (Don Libes) To: u70217@f.nersc.gov (Lori Wong) Subject: setuid in Expect Date: Thu, 24 Oct 91 16:15:20 EDT > I have been running Expect now under UNICOS 6.1 and CSOS 1.0 (Cray >Computer Corporation's OS). The two machines that I am running Expect >on have stringent security features, one of which is to limit setuid >privileges to specific individuals. I was wondering if you would be >kind enough to explain the purpose of the setuid that is needed by Expect >and whether it could be compiled to run without having to have setuid >privilege? I know it has to do with spawning and communicating with >the various spawned tasks, but don't know enough of the details to be >able to explain why Expect specifically needs setuid and whether or not >it could cause a security problem (could someone use it to enter into >the system and wreak havoc, for example?). Right now, I've limited >the access of Expect to my group, but need to know what the security >implications are if I open it to all users. I'd appreciate any light >you can shed on this subject... Root-access is needed to open a pty under Unicos. Thus, all programs accessing ptys must be setuid root. If you do an "ls -l" of programs like "script", "xterm", etc, you'll see this. I have no idea why this is. The requirement was probably for security reasons to begin with, but it has the ironic effect of making more programs require setuid and therefore greater possibility of errant setuid programs. In fact, there is one known Unicos bug relating to the way uids are switched at exec time which requires further special coding. If you search for "Cray" in the Expect source you will see significant chunks of code to get around the problem. I don't know if this reassures you any. All I can tell you is that a number of Cray experts have looked into the situation and are happy with the current implementation of Expect. Don ====================================================================== #28. Does Expect run on VMS? From: libes (Don Libes) To: Cameron Laird Subject: VMS question. Cameron Laird writes: >Do you know of anyone working with Expect and VMS? >I'd like not to re-invent wheels, but, if I'm to be >the first one, I want others to benefit. No, I'm not aware of anyone doing it. Since VMS claims POSIX conformance, it shouldn't be that hard - Expect uses the POSIX calls if it can. Probably the hardest part will just be modifying the Makefile and the configure script! However, that there might be a simpler solution. The neat thing about Expect is that you can control other computers easily. Run Expect on your UNIX box and have it log in to the VMS box and do its thing. (You can bypass the login garbage by using an inet daemon.) We've done exactly this to a number of weird pieces of hardware we have around the lab (robots, Lisp machines, embedded controllers, and, of course, a VAX running VMS). It saves time porting! Don ====================================================================== #29. Is it possible to use Expect and TclX together? Is it possible to use Expect and TclX together? From: bfriesen@iphase.com (Bob Friesenhahn) Date: 20 Jul 1994 04:09:43 GMT Organization: Interphase Corporation, Dallas TX - USA Jeffery A. Echtenkamp (echtenka@michigan.nb.rockwell.com) wrote: : Do Expect and tclX work together? If so, must anything special be done to : get them to work together? This answer courtesy of Bob Friesenhahn, Interphase (bfriesen@iphase.com): They work fine together. However, you should prepend "exp_" to your Expect command names. This will ensure that there are no conflicts between Expect commands and tclX commands of the same name (like wait). Just pick up the "make-a-wish" package, follow the instructions, and you will be all set. I have built a wish based on tcl, tk, Expect, tclX, and dp using this technique with no observed problems. Bob [If you need additional information, please read Chapter 22 ("Expect as Just Another Tcl Extension") of Exploring Expect. Its sole focus is how to make Expect work with other extensions. - Don] ====================================================================== #30. Is it possible to use Expect and together? From: libes (Don Libes) To: Frank Winkler Subject: Q Expect + TkSteal Frank Winkler writes: >Hi don, > >a short question considering installation of Expectk. > >Is it possible to build an Expectk-binary, which uses >the features of BLT, TkSteal and Expect ? I've never done it, but I know it must be possible because the tgdb package in the Tcl archive uses all of those extensions with Expect. Expect is a "well-behaved extension" in the sense that it requires no changes to the Tcl core. So Expect should work with any other Tcl extensions. You just need to add the usual Exp_Init call to main() or the other _Init calls to Expect's main. >If yes, which of them should be build first, second ... ? Order doesn't matter. I've done this kind of thing by hand. It's pretty simple. But people tell me the make-a-wish package in the Tcl archive automates the creation of multi-extension Tcl applications. [Also see the answer to the previous FAQ answer.] Don ====================================================================== #31. Why does configure complain about "cross-compiling"? From: libes (Don Libes) To: morton@hendrix.jci.tju.edu (Dan Morton) Subject: Re: Sorry to bother you, but... Dan Morton writes: >Don, > >I've posted an inquiry to comp.lang.tcl about my configure problems with >expect, but I've not yet gotten a reply. Perhaps you can nudge me in the >right direction? > >I'm running HP-UX 9.0 on a 735, and I've snagged the latest versions of Tcl >and expect from NIST (7.4 and 5.18 respectively). My gcc is v2.6. Tcl >configured and built out of the box, but I can't get expect to configure >properly. No matter what I do, it thinks it wants to cross-compile. I >think it's failing that little snippet of eval code. It gets further if I >specify --host=HP, but still complains about cross compiling. Here's the >result without options: > >{hendrix:~/expect-5.18:8} ./configure >checking for gcc... gcc >checking whether we are using GNU C... yes >checking whether gcc accepts -g... no >checking how to run the C preprocessor... gcc -E >checking whether cross-compiling... yes >checking whether cross-compiling... (cached) configure: error: You need to >specify --target to cross compile, > or the native compiler is broken I guess the error message has to be clearer. The message: "or the native compiler is broken" means that configure tried to compile a simple program and it failed. Here's the program it tries to compile: main() { return(0); } The configure output that you showed me says that it found gcc. Perhaps it was misinstalled or is just a placeholder and doesn't actually do anything? Try compiling a tiny C program yourself from the command line. Don ====================================================================== #32. Why are make/configure looping endlessly? To: Xiaorong Qu Subject: Make message for Expect --text follows this line-- Xiaorong Qu writes: >Don, > >The following is the output of make, you can find >that the process repeated three times. I bet what's going on is that your system clock is set to some ridiculous time such as last year. "Make" is sensitive to your clock. Please fix your clock. Then check that all the files are "older" than the current time. (If not, "touch" them all.) Don ====================================================================== #33. Why does compile fail with: Don't know how to make pty_.c? From: libes (Don Libes) To: wren@io.nosc.mil Subject: Compile fails with: Don't know how to make pty_.c > I'm trying to compile Expect on hpux 9.01, > downloaded from ftp.cme.nist.gov expect.tar > after running config > the make fails with "Don't know how to make pty_.c. (compile fails) > I see three versions pty_sgttyb.c, pty_termios.c and pty_unicos.c in > the load, but the configure picked none of them. > I tried forcing to pty_termios.c but that failed with other compile errors. I've seen this happen because gcc was partially installed. configure finds the gcc stub and uses gcc for all the tests. But because the compiler doesn't work, every test fails so configure doesn't select any of the choices. So either finish installing gcc or delete the stub. (And if it's not that, then something similar is wrong with whatever compiler you've got. Look closely at the output from configure, it will tell you what compiler it is trying to use.) By the way, Expect compiles fine on my HP (A.09.05 E 9000/735). Don ====================================================================== #34. Does Expect run on MSDOS, Win95, WinNT, MacOS, etc...? Gordon Chaffee has ported Expect to NT. I would like to unify the UNIX and NT code but I probably won't have the time to do this personally. Volunteers are welcome. I have no plans to do other ports. Feel free to volunteer. Don ====================================================================== #35. Why does Expect dump core? Why can I run Expect as root but not as myself? From: Wayne Tcheng Subject: Expect on Solaris Date: Wed, 2 Apr 97 21:34:50 EST I've compiled Expect 5.21 with Tcl 7.6 and Tk 4.2. Whenever I run Expect as a non-root user, it core dumps. When I am root, I can run it successfully. However, if I "su - wmt" to my own id, I can also run it without a problem. I've tried making the expect binary suid root, but that does not help either. I'm on Solaris 2.5. Any ideas? Sounds like something on your system is misconfigured. Everytime I've had reports like this (works as root, not as user), it's turned out to be /tmp was unwriteable or something equally improbable. The easiest way to find out is to use the debugger and tell me where Expect is dumping core. (If you don't understand this statement, ask a local C or C++ programmer.) As an aside, you should be using the most recent version of Expect (currently 5.22.1). But I don't know of any problems in 5.21 that caused core dumps, so it's certainly worth trying the debugger approach before retrieving the latest version. But if you do find a bug in Expect, before reporting it, please verify that it still exists in the current version. Don ====================================================================== **** Other... **** #36. Is it possible to prevent Expect from printing out its interactions? From: libes (Don Libes) To: Sunanda Iyengar Subject: Disabling display from Expect Sunanda Iyengar writes: >Is it possible to have Expect interact with a process and not print-out >the results of interaction? In my application, I need it to go into a >silent mode, communicate with a process without reporting to the user, and >then come back to normal mode and put the process into interactive mode. Use the following command: log_user 0 To restore output: log_user 1 See the Expect man page for more details or page 175 of Exploring Expect for details and examples. Don ====================================================================== #37. Why does it send back the same string twice? From: Don Libes To: yusufg@himalaya.cc.gatech.edu (Yusuf Goolamabbas) Subject: Duplicate pattern matches in Expectk --text follows this line-- Hi, I am trying to do a very simple thing in expectk spawn cat expect_background -re ".+" { send $expect_out(0,string) } exp_send "Hello World\n" Now the display in the text widget looks like this Hello World\r Hello World\r whereas I was expecting only one line Hello World\r Thanks in advance, Yusuf -- Yusuf Goolamabbas yusufg@cc.gatech.edu Graphics, Visualization, & Usability Center (O) 404.894.8791 College of Computing Georgia Tech http://www.cc.gatech.edu/grads/g/Yusuf.Goolamabbas/home.html This is correct behavior. The first "Hello World" is echoed by the terminal driver. The second is echoed by cat. This behavior has nothing to do with Expectk (or Expect for that matter). You can see this same thing if you type to cat interactively. % cat Hello World Hello World In the example above, I typed "cat" at the shell prompt and pressed return. Then I entered "Hello World" and pressed return. Looking at the output I *see* "Hello World" twice even though I only entered it once. You can account for this behavior in your patterns. Alternatively, just turn off the echo. In your particular case though, it's doing the right thing, showing you the result of an interactive cat just as if you had typed it yourself. In practice, this kind of problem doesn't arise - because programs like cat aren't spawned (except in very special situations). I assume that cat was just something you chose to experiment with. Don ====================================================================== #38. Why can't I send the line "user@hostname\r"? From: libes (Don Libes) To: bt@nadine.hpl.hp.com Subject: Re: [Q] Expect, ftp and '@' > I am attempting to use Expect to perform anonymous ftp gets without >my having to type all the stuff --- I mean, waaaiiiting for the >prompt, entering a-n-o-n-y-m-o-u-s with my fat fingers, and the rest. > > But I have a probleme: as I set the password to be my e-mail address: > set password "bt@hplb.hpl.hp.com" > the ftp servers seem not to receive neither my login name nor the >at-sign. Some of them do not care, some others say "ok, but don't do >that again", and the last ones throw me off. The short answer is to upgrade to Expect 5.20 or later. If you don't feel like doing this, here's the explanation for older versions of Expect: spawn initializes the terminal by using your current parameters and then forces them to be "sane". Unfortunately, on your system, "sane" says to interpret the "@" as the line-kill character. The most sensible thing to do is change "sane" in your Makefile to something that makes sense. (Since you work at HP, you might also suggest that they modernize stty!) Here's an example of a replacement line for the Makefile: STTY = -DDFLT_STTY=\""sane kill ^U"\" Other alternatives are: quote the @, or use the -nottyinit flag, or set the stty_init variable. Don ====================================================================== #39. How do I hide the output of the send command? From: tim@mks.com (Timothy D. Prime) Subject: Re: hide the text of expect's send command? Date: 29 Mar 1996 15:41:02 GMT In article , Kirby Hughes wrote: > I don't want to see (on the screen) the text sent by a "send" command. Is > there a way to hide it? "log_user 0" works for text coming back to me, but > doesn't (seem to) work for sending... > > #!/usr/local/bin/expect -- > log_user 0 > spawn telnet proxy > expect Command > send "c [lrange $argv 0 1]\n" > log_user 1 > interact This answer courtesy of Timothy Prime, Mortice Kern Systems (tim@mks.com): The output you are seeing wasn't printed by the send command. (I.e., the log_user command is working just fine.) The output you see is from the interact command. The interact command found program output and thus wrote it to the terminal so that you could see it. That's what the interact command is supposed to do! Although the expanation might take a little thought, the solution is easy. Simply put an expect command in before the command "log_user 1". Match against the last characters that you wish to suppress. ====================================================================== #40. Why don't I see pauses between characters sent with send -s? From: jcarney@mtl.mit.edu (John C. Carney) Newsgroups: comp.lang.tcl Date: 12 Aug 1996 17:32:54 GMT Organization: Massachvsetts Institvte of Technology I am trying to use expect to spawn the kermit program. It then is supposed to dial the modem and procede. When I run kermit from the shell, it has no problem dialing the modem. However, when kermit is spawned by expect, it will not dial. I thought perhaps the input stream was too fast for kermit and tried send -s. I do see a long delay before the dial message is sent, but it still won't dial. Also, I would expect (no pun) that I would see the characters sent as follows: atdt ... But instead I see: atdt ... What am I doing wrong? Thanks for you help. John Carney jcarney@garcon.mit.edu The send command doesn't wait for responses. The echoing you see is from an expect command running after send has run. At that point, all the characters have been echoed already - thus, you see the long pause (while send is running) and the rush of characters (while expect is running). Before you ask, no, it doesn't make sense to have send pause briefly and wait for echoing. Sometimes there is no echoing. And sometimes things aren't echoed in an intuitive way. So how could send possibly know what to wait for and how long? The solution is to use the expect background command: expect_background -re .+ Just put this after your spawn command and before you start sending things. Don ====================================================================== #41. Why does "talk" fail with "Who are you? You have no entry utmp" or "You don't exist. Go away"? From: libes (Don Libes) To: Will Smith (AC) Subject: Expect Will Smith (AC) writes: >Hi there. I was wondering if you had any ideas to why i am getting >this problem running an Expect script which tries to spawn a talk >process to myself on another machine. Would it have anything to do >with the fact that the executables are NOT installed in /usr/local/bin >or because it wasnt installed by ROOT or what. This is what my Expect >script looks like. > >#! /home/ritchie/ops/william/test/expect -f > >spawn talk william@curiac.acomp >set timeout 200 >expect {*established*} >set send_human {.1 .3 1 .05 2} >send -h "This is only a test.. I swear \ Please don't bust me with expect \n >expect "{*\r*}" >expect "{*\r*}" >exec sleep 5 >send -h "Ok, well see ya tomorrow you idiot \n" >exec sleep 3 > >The error i get is that it returns this when i run the script. > > Who are you? You have no entry in /etc/utmp! Aborting... On most systems, Expect does not automatically make a utmp entry. (A utmp entry normally indicates login information which seems kind of pointless for Expect scripts.) This allows Expect to run non-setuid. Normally, this lack of utmp entries doesn't mean much. However, a few programs actually refuse to run without a utmp entry. Fortunately, there are workarounds: Program-dependent solutions: "talk" is the only program I'm aware of that falls into this category. One solution is to get ytalk. ytalk doesn't have this problem plus it fixes many other bugs in talk, such as being able to communicate with both old and new talk. Program-independent solutions: Use a program specifically intended to create utmp entries. Such programs are easy to write or get if you don't have them already. For instance, sessreg is one which comes with the xdm distribution. And Solaris uses utmp_update. I like this approach because it isolates the setuid code in a small single system utility rather than in every program on the system that needs this ability. Tod Olson sent in the following example of how to use sessreg. He says: sessreg works nicely. Here is a fragment showing how we invoke sessreg on our Linux machines. Note: sessreg must be able to write utmp. We decided to make utmp work writable, since it's a kinda bogus creature anyhow, rather than make sessreg suid root (or whatever). ... spawn $shell expect $prompt send "sessreg -w /var/run/utmp -a $user\r" expect $prompt ====================================================================== #42. Why does . match a newline? From: libes (Don Libes) To: xipr@alv.teli.se (Ivan Prochazka) Subject: Why does . match a newline? Ivan Prochazka writes: > >Hello Don. > >In my opinion(and emacs) the regexp-symbol "." stands for all >characters except newline(\n). >This is not the case in Expect 5.2. Yes, there are some packages that follow this convention, but I don't think it is appropriate for Expect. Unlike emacs, most Expect patterns don't look for full lines - more often they look for prompts which *don't* end with newlines. I find that I actually write the [^\n] pattern very rarely. And if I write it frequently in a script, then the expect itself probably ought to be in a subroutine. In fact, the more common line-terminating sequence in Expect is \r\n, so that might make a more likely argument. In any case, Expect defines . the way POSIX does. So I feel pretty good about the definition of . being what it is. Don ====================================================================== #43. Why doesn't Expect kill telnet (or other programs) sometimes? From: libes (Don Libes) To: Karl.Sierka@Labyrinth.COM Subject: Re: need help running telnet Expect script from cron on sunos 4.1.3 karl.sierka@labyrinth.com writes: > The only problem I am still having with the script I wrote is that > the telnet does not seem to die on it's own, unless I turn on debugging. Actually, Expect doesn't explicitly kill processes at all. Generally, processes kill themselves after reading EOF on input. So it just seems like Expect kills all of its children. > I was forced to save the pid of the spawned telnet, and kill it with an > 'exec kill $pid' in a proc that is hopefully called before the script > exits. This seems to work fine, but it makes me nervous since omnet > charges for connect time, and leaving a hung telnet lying around could > get expensive. I warned the rest of the staff so that they will also be > on the lookout for any possible hung telnets to omnet. The problem is that telnet is not recognizing EOF. (This is quite understandable since real users can't actually generate one from the telnet user interface.) The solution is to either 1) explicitly drive telnet to kill itself (i.e., a graceful logout) followed by "expect eof" or 2) "exec kill" as you are doing. This is described further in Exploring Expect beginning on page 103. Don ====================================================================== #44. How come I get "ioctl(set): Inappropriate ..., bye recursed"? From: libes (Don Libes) To: james@Solbourne.COM (James B. Davis) Subject: How come I get "ioctl(set): Inappropriate ..., bye recursed" ... Date: Tue, 10 Dec 91 10:47:21 MST >Every time I ^C out of a Expect script run I get: > >ioctl(set): Inappropriate ioctl for device >bye recursed > >james@solbourne.com This answer courtesy of Michael Grant (mgrant@xdr.ncsl.nist.gov): You (or whoever installed gcc) forgot to run the fixincludes shell script while installing gcc. Recompiled gcc with itself, then run the fixincludes script - and the messages will go away. Michael Grant ====================================================================== #45. How come there's no interact function in the Expect library? From: libes (Don Libes) To: Djamal SIMOHAND Subject: Re: exp_expectl Date: Wed, 3 Jan 96 12:17:01 EST Djamal SIMOHAND writes: >I have already used the Expect program to write a script to connect by >telnet on my machine. Now I made a graphic interface in C and I need >the expect in C in order to have a coherent executable. > >I've already written most of the C already, but the connection is >closed just after my program is finished. Then I have no opportunity >to work on my machine. It seems I need of the equivalent of >"interact" in C. Is there such a function in the C library? > >Thanks for your help, > Djamal No, there is no interact-like function in the C library. The reason is three-fold: 1) It is simple enough to write your own. It's just a loop after all: while 1 { select/poll() read() write() } 2) There's no way I could possibly provide all the options you might need. In Expect, it's not a problem because the environment is very controlled, but in C, it's impossible to control what you might want to do. For example, you mention that you're embedding your code in a graphics application. Graphics packages typically have their own event manager, so you wouldn't want a monolithic interact function. 3) The library is intended for embedding in other applications, where it rarely makes sense to give the user direct control of a spawned process. That kind of thing makes so much more sense to handle with an Expect script than a C program. The C library was not intended as a replacement for Expect. Expect is really the tool of choice for interaction problems, not C. In summary, there's very little payoff for the library to supply an interact function. A simple one would only satisfy people who should be using Expect anyway - and it's impossible to create one that would do everything that everyone wants. It's easier just to let people create their own. Don ====================================================================== #46. Can't you make tkterm understand any terminal type? From: swig@teleport.com (Scott Swigart) Newsgroups: comp.lang.tcl Date: Tue, 13 Aug 1996 18:50:22 GMT I looked at tkterm, and it is promising, but it's missing some critical features. For one, I need something that understands various terminal types, and can get it's escape sequences from something like termcap or terminfo, instead of having them hard coded. Also, I question the ability of an Expect script to keep up if it had 50 or so types of escape sequences to parse. Actual C code would probably have to be created to do the parsing, and if you're going to go that far, why not just create a terminal widget so you could do something like: terminal .myterm -type vt220 which is more along the lines of what I was originally looking for. Yes, that would be divine. But terminal emulators are horribly complex and very little of that complexity can be discerned from the termcap file. For example, compare xterm's human-readable docs (63k man page + 18k appendix) to its termcap entry (654 bytes). Now consider the other hundreds of terminals in termcap each with their own weird extensions. I can't imagine what kind of ".myterm configure" interface you'd present to the user. What would you allow the user to change? The nice thing about tkterm is that everything is accessible to the user, but I can't imagine doing that through a widget interface. Unfortunately, like everyone else, I don't have the time... Me neither. Call me lazy. As an aside, I wonder why you want the ability for a terminal emulator to read termcap/info. Turns out that it's useless (unless what you are doing is testing termcap itself). Because if your app is using termcap in the first place, then it doesn't care what terminal type you choose - so why not choose the one that tkterm does? (And if your app isn't using termcap, then you have the converse problem.) Actually, I and several other people did a fair amount of experimentation (i.e., wrote a lot of C code) to do a universal terminal emulator - turns out that it's not possible in a general sense. To support any terminal type, you are going to be forced to go beyond what termcap/info offers. I.e., you'll have to handedit the definition or add new ones and/or accept certain limitations. After many revisions, Software - Practice & Experience is publishing a paper on tkterm. The paper includes more insights on the difficulties I've mentioned here. You can get a draft of the paper at: http://www.cme.nist.gov/msid/pubs/libes96d.ps Don ====================================================================== #47. Trapping SIGCHLD causes looping sometimes From: Bryan Kramer Sender: kramer@hydro.on.ca Cc: libes@NIST.GOV Subject: Problem with trap in expect on Solaris Date: Tue, 17 Sep 1996 11:09:50 -0400 I'm getting an infinite loop running the attached script foo.tcl on my solaris machine (Ultra Sparc, SunOS 5.5). This does not happen when I run the version of the same expect that I compiled on a Sparc 20 with SunOS 4.1.3UI (even though I am running it on the Solaris 5.5. ultra). trap { if {[catch { puts stderr "CALL TRAP [trap -number] [trap -name]" wait -i 1 } output]} { puts stderr "TRAP $output" return } puts "TRAP DONE" } SIGCHLD if {[catch {exec trivial} msg]} { puts stderr "Error $msg" } Please let me know if there is an immediate work around. Thanks -- |Bryan M. Kramer, Ph.D. 416-592-8865, fax 416-592-8802| |Ontario Hydro, 700 University Avenue, H12-C1 | |Toronto, Ontario, Canada M5G 1X6 | B. Kramer Home Page I haven't analyzed your script in depth, but this sounds like a problem I've seen before - it's due to an implementation deficiency in Tcl. The problem is that when an exec'd process finishes, it raises SIGCHLD. Expect's "wait" sees that it is Tcl's process. Unfortunately, there is no way to wait for one of Tcl's processes and tell Tcl that you've done so, nor is there any way to have Tcl wait itself. So Expect's wait just returns. On some systems alas, this just causes SIGCHLD to be reraised. The solution is multipart: 1 Tell John he needs to fix this problem. (I've told him this but he didn't agree with me that it's a problem.) Tcl needs to provide a new interface - either to clean up its process or to allow extensions to do the wait and pass the status back to Tcl so that it can have it later when needed. 2 Don't call exec while you are trapping SIGCHLD. Since this is a severe limitation, I recommend you avoid the problem by using "expect_before eof" to effectively trap the same event. If you're not already using expect, well, call it every so often anyway. Don ====================================================================== #48. Why do I get "invalid spawn id"? Subject: Why do I get "invalid spawn id" In article <53ggqe$hag@hole.sdsu.edu> khumbert@mail.sdsu.edu writes: I am trying to write a general looping procedure that will handle many cases that have similar prompt sequences. The function and one call are below. The problem is that when the "looping" function is called I get an "invalid spawn id(5) while executing "expect $exp1 {send -s "$send1} timeout {continue}". I only have one spawn in the entire program (a telnet session). I've tried setting a spawn_id variable for the telnet spawn and then setting spawn_id to that variable in "looping", but no dice, same error. Any ideas? Thanks in advance for any suggestions!!! Kelly Humbert proc looping {exp1 exp2 send1 send2} { global max_tries ### 5 ### set tries 0 set connected 0 set timeout 60 while {$tries <= $max_tries && $connected == 0} { incr tries expect { $exp1 {send -s $send1} timeout {continue} } expect { ">? " {send -s "\n"} timeout {continue} } expect { $exp2 {incr connected;send -s $send2} timeout {continue} } } return $tries }; What's going on is that the spawned process has closed the connection. When Expect detects this, it matches the "eof" pattern, and the spawn id is marked "invalid". However, you aren't testing for "eof", so the next command in your script finds the invalid spawn id, hence the complaint. If you want to find out where the eof is occurring, enable Expect's diagnostic mode - Expect will get very chatty about what it is doing internally. You can handle eof in all your expect statements by add a single expect_before/after command to your script. Don ====================================================================== #49. Could you put a version number in the filename of the Expect archive? From: "Nelson H. F. Beebe" Date: Mon, 23 Dec 1996 08:46:57 -0700 (MST) It would be helpful for the expect distribution to contain its version number, e.g. expect-5.21.6.tar.gz; I had an earlier version called 5.21, and it took some diffing to verify that the expect.tar.gz I fetched from ftp://ftp.cme.nist.gov/pub/subject/expect/expect.tar.gz really was newer. I don't name the file with a version number because I make new distributions so frequently. I realize that many other distributions include version numbers in them, but constantly changing filenames really annoys the heck out of people. I've been packaging Expect this way for five years and I've only gotten this question twice before. In contrast, I'm responsible for a number of other files on our ftp server that do occasionally change names, and I get no end of questions from people about where such and such a file has gone or why their ftp request fails. So that people don't have to download the distribution only to find it hasn't changed, there is a HISTORY file in the distribution directory. It's relatively short and has the latest version number at the top (with any changes listed immediately after). Don ====================================================================== #50. Why does Expect work as root, but say "out of ptys" when run as myself? Expect works fine as root, but when I run it as myself it says "out of ptys" (which I know isn't true). Any ideas? Sounds like a misconfiguration problem on your system. For example, once I saw this on a Digital system where the system administrator had decided to remove setuid from all programs ("I heard that setuid is a security risk, right?"). On that particular system, Expect uses a system library function that internally calls an external program chgpt which exists solely for the purpose of managing ptys. Needless to say, it must be setuid. Unfortunately, the library function doesn't do enough error checking, and there's no way for Expect to know that, so there's nothing I can do to give a better diagnostic explaining how your system is misconfigured. Don ====================================================================== #51. Why does spawn fail with "sync byte ...."? When I spawned a process using Expect, I got the following message: parent: sync byte read: bad file number child: sync byte write: bad file number This is one of these "should not happen" errors. For example, the following question in this FAQ mentions that it could be the fault of the C library. Another possibility is that you've run out of some system resource (file descriptors). The most likely reason is that you're calling spawn in a loop and have neglected to call close and wait. Don ====================================================================== #52. Why does Expect fail on RedHat 5.0? Lots of people have reported the following error from Expect on RedHat 5.0: failed to get controlling terminal using TIOCSCTTY parent sync byte write: broken pipe Martin Bly reports that: The fault is/was in the GNU libc (aka glibc) provided by Red Hat Software. Our sysadmin updated the version of the C libraries we have installed and both problems have vanished - in the case of the expect test, without a rebuild. ====================================================================== #53. Why does Expect fail on RedHat 5.1? People have reported the following error from Expect on RedHat 5.1: failed to get controlling terminal using TIOCSCTTY parent sync byte write: broken pipe If there are any people who have some debugging experience and can reproduce that error on RedHat 5.1, read on: First look in the man page (or perhaps diff the 5.1 and pre-5.1 man pages) governing TIOCSTTY and let me know what you find. Alternatively look at the source to xterm (or some other program that must allocate a pty) and see how it is allocating a pty. If anyone else is wondering if the problem has been fixed by the time you read this, just check the FAQ again. I'll update it as soon as the problem has been successfully diagnosed. Don ====================================================================== #54. Is Expect Y2K compliant? The short answer is: Yes, if you're using a modern version of Tcl (7.6p2 or later). Longer answer: Tcl 7.5 and 7.6p0/1 had bugs that caused them to be noncompliant with regard to how POSIX defines 2-character years. If your scripts use 2-character years, you should upgrade to a modern version of Tcl. If your scripts use 4-character years, than you have nothing to worry about. Don ====================================================================== Names of companies and products, and links to commercial pages are provided in order to adequately specify procedures and equipment used. In no case does such identification imply recommendation or endorsement by the National Institute of Standards and Technology, nor does it imply that the products are necessarily the best available for the purpose. Last edited: Tue Sep 22 17:52:23 EDT 1998 by Don Libes expect5.45.4/testsuite/0000755000175000017500000000000013235563420015362 5ustar pysslingpysslingexpect5.45.4/testsuite/ChangeLog0000644000175000017500000000140513235134350017130 0ustar pysslingpysslingMon Feb 22 07:54:03 1993 Mike Werner (mtw@poseidon.cygnus.com) * expect/testsuite: made modifications to testcases, etc., to allow them to work properly given the reorganization of deja-gnu and the relocation of the testcases from deja-gnu to a "tool" subdirectory. Sun Feb 21 10:55:55 1993 Mike Werner (mtw@poseidon.cygnus.com) * expect/testsuite: Initial creation of expect/testsuite. Migrated dejagnu testcases and support files for testing nm to expect/testsuite from deja-gnu. These files were moved "as is" with no modifications. This migration is part of a major overhaul of dejagnu. The modifications to these testcases, etc., which will allow them to work with the new version of dejagnu will be made in a future update. expect5.45.4/testsuite/configure0000755000175000017500000051237113235561756017314 0ustar pysslingpyssling#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for exp_test 0.43. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='exp_test' PACKAGE_TARNAME='exp_test' PACKAGE_VERSION='0.43' PACKAGE_STRING='exp_test 0.43' PACKAGE_BUGREPORT='' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS host MATH_LIBS EGREP GREP RANLIB SET_MAKE INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CPP OBJEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC TCL_SHLIB_LD_LIBS TCL_LD_FLAGS TCL_EXTRA_CFLAGS TCL_DEFS TCL_LIBS CLEANFILES TCL_STUB_LIB_SPEC TCL_STUB_LIB_FLAG TCL_STUB_LIB_FILE TCL_LIB_SPEC TCL_LIB_FLAG TCL_LIB_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_PATCH_LEVEL TCL_VERSION PKG_CFLAGS PKG_LIBS PKG_INCLUDES PKG_HEADERS PKG_TCL_SOURCES PKG_STUB_OBJECTS PKG_STUB_SOURCES PKG_STUB_LIB_FILE PKG_LIB_FILE EXEEXT CYGPATH target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_tcl ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures exp_test 0.43 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/exp_test] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of exp_test 0.43:";; esac cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF exp_test configure 0.43 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by exp_test $as_me 0.43, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # TEA extensions pass this us the version of TEA they think they # are compatible with. TEA_VERSION="3.9" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct TEA configuration" >&5 $as_echo_n "checking for correct TEA configuration... " >&6; } if test x"${PACKAGE_NAME}" = x ; then as_fn_error $? " The PACKAGE_NAME variable must be defined by your TEA configure.in" "$LINENO" 5 fi if test x"3.9" = x ; then as_fn_error $? " TEA version not specified." "$LINENO" 5 elif test "3.9" != "${TEA_VERSION}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&5 $as_echo "warning: requested TEA version \"3.9\", have \"${TEA_VERSION}\"" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (TEA ${TEA_VERSION})" >&5 $as_echo "ok (TEA ${TEA_VERSION})" >&6; } fi case "`uname -s`" in *win32*|*WIN32*|*MINGW32_*) # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CYGPATH+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CYGPATH"; then ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CYGPATH="cygpath -w" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" fi fi CYGPATH=$ac_cv_prog_CYGPATH if test -n "$CYGPATH"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5 $as_echo "$CYGPATH" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi EXEEXT=".exe" TEA_PLATFORM="windows" ;; *CYGWIN_*) CYGPATH=echo EXEEXT=".exe" # TEA_PLATFORM is determined later in LOAD_TCLCONFIG ;; *) CYGPATH=echo EXEEXT="" TEA_PLATFORM="unix" ;; esac # Check if exec_prefix is set. If not use fall back to prefix. # Note when adjusted, so that TEA_PREFIX can correct for this. # This is needed for recursive configures, since autoconf propagates # $prefix, but not $exec_prefix (doh!). if test x$exec_prefix = xNONE ; then exec_prefix_default=yes exec_prefix=$prefix fi { $as_echo "$as_me:${as_lineno-$LINENO}: configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}" >&5 $as_echo "$as_me: configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}" >&6;} # This package name must be replaced statically for AC_SUBST to work # Substitute STUB_LIB_FILE in case package creates a stub library too. # We AC_SUBST these here to ensure they are subst'ed, # in case the user doesn't call TEA_ADD_... ac_aux_dir= for ac_dir in ../tclconfig "$srcdir"/../tclconfig; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in ../tclconfig \"$srcdir\"/../tclconfig" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl was given. if test "${with_tcl+set}" = set; then : withval=$with_tcl; with_tclconfig="${withval}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5 $as_echo_n "checking for Tcl configuration... " >&6; } if ${ac_cv_c_tclconfig+:} false; then : $as_echo_n "(cached) " >&6 else # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case "${with_tclconfig}" in */tclConfig.sh ) if test -f "${with_tclconfig}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5 $as_echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;} with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`" fi ;; esac if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`" else as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5 fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ `ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ ../../tcl \ `ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ ../../../tcl \ `ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do if test "${TEA_PLATFORM}" = "windows" \ -a -f "$i/win/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/win; pwd)`" break fi if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/unix; pwd)`" break fi done fi # on Darwin, check in Framework installation locations if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ~/Library/Frameworks 2>/dev/null` \ `ls -d /Library/Frameworks 2>/dev/null` \ `ls -d /Network/Library/Frameworks 2>/dev/null` \ `ls -d /System/Library/Frameworks 2>/dev/null` \ ; do if test -f "$i/Tcl.framework/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`" break fi done fi # TEA specific: on Windows, check in common installation locations if test "${TEA_PLATFORM}" = "windows" \ -a x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d C:/Tcl/lib 2>/dev/null` \ `ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi # check in a few other private locations if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ `ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do if test "${TEA_PLATFORM}" = "windows" \ -a -f "$i/win/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/win; pwd)`" break fi if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i/unix; pwd)`" break fi done fi fi if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" as_fn_error $? "Can't find Tcl configuration definitions" "$LINENO" 5 else no_tcl= TCL_BIN_DIR="${ac_cv_c_tclconfig}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5 $as_echo "found ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5 $as_echo_n "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... " >&6; } if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5 $as_echo "loading" >&6; } . "${TCL_BIN_DIR}/tclConfig.sh" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 $as_echo "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC # instead of TCL_BUILD_LIB_SPEC since it will work with both an # installed and uninstalled version of Tcl. if test -f "${TCL_BIN_DIR}/Makefile" ; then TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}" TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}" TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}" elif test "`uname -s`" = "Darwin"; then # If Tcl was built as a framework, attempt to use the libraries # from the framework at the given location so that linking works # against Tcl.framework installed in an arbitrary location. case ${TCL_DEFS} in *TCL_FRAMEWORK*) if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then for i in "`cd "${TCL_BIN_DIR}"; pwd`" \ "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}" break fi done fi if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}" TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}" fi ;; esac fi # eval is required to do the TCL_DBGX substitution eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" case "`uname -s`" in *CYGWIN_*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cygwin variant" >&5 $as_echo_n "checking for cygwin variant... " >&6; } case ${TCL_EXTRA_CFLAGS} in *-mwin32*|*-mno-cygwin*) TEA_PLATFORM="windows" CFLAGS="$CFLAGS -mwin32" { $as_echo "$as_me:${as_lineno-$LINENO}: result: win32" >&5 $as_echo "win32" >&6; } ;; *) TEA_PLATFORM="unix" { $as_echo "$as_me:${as_lineno-$LINENO}: result: unix" >&5 $as_echo "unix" >&6; } ;; esac EXEEXT=".exe" ;; *) ;; esac # The BUILD_$pkg is to define the correct extern storage class # handling when making this package cat >>confdefs.h <<_ACEOF #define BUILD_${PACKAGE_NAME} /**/ _ACEOF # Do this here as we have fully defined TEA_PLATFORM now if test "${TEA_PLATFORM}" = "windows" ; then CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp" fi # TEA specific: # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE) # in this macro, they need to go into TEA_SETUP_COMPILER instead. # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu #-------------------------------------------------------------------- # Checks to see if the make program sets the $MAKE variable. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi #-------------------------------------------------------------------- # Find ranlib #-------------------------------------------------------------------- if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here. #------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" -a -n "$GCC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -pipe" >&5 $as_echo_n "checking if the compiler understands -pipe... " >&6; } if ${tcl_cv_cc_pipe+:} false; then : $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_cc_pipe=yes else tcl_cv_cc_pipe=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$hold_cflags fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_pipe" >&5 $as_echo "$tcl_cv_cc_pipe" >&6; } if test $tcl_cv_cc_pipe = yes; then CFLAGS="$CFLAGS -pipe" fi fi #-------------------------------------------------------------------- # Common compiler flag setup #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac if test "${TEA_PLATFORM}" = "unix" ; then #-------------------------------------------------------------------- # On a few very rare systems, all of the libm.a stuff is # already in libc.a. Set compiler flags accordingly. # Also, Linux requires the "ieee" library for math to work # right (and it must appear before "-lm"). #-------------------------------------------------------------------- ac_fn_c_check_func "$LINENO" "sin" "ac_cv_func_sin" if test "x$ac_cv_func_sin" = xyes; then : MATH_LIBS="" else MATH_LIBS="-lm" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lieee" >&5 $as_echo_n "checking for main in -lieee... " >&6; } if ${ac_cv_lib_ieee_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lieee $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ieee_main=yes else ac_cv_lib_ieee_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee_main" >&5 $as_echo "$ac_cv_lib_ieee_main" >&6; } if test "x$ac_cv_lib_ieee_main" = xyes; then : MATH_LIBS="-lieee $MATH_LIBS" fi #-------------------------------------------------------------------- # Interactive UNIX requires -linet instead of -lsocket, plus it # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -linet" >&5 $as_echo_n "checking for main in -linet... " >&6; } if ${ac_cv_lib_inet_main+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return main (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet_main=yes else ac_cv_lib_inet_main=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_main" >&5 $as_echo "$ac_cv_lib_inet_main" >&6; } if test "x$ac_cv_lib_inet_main" = xyes; then : LIBS="$LIBS -linet" fi ac_fn_c_check_header_mongrel "$LINENO" "net/errno.h" "ac_cv_header_net_errno_h" "$ac_includes_default" if test "x$ac_cv_header_net_errno_h" = xyes; then : $as_echo "#define HAVE_NET_ERRNO_H 1" >>confdefs.h fi #-------------------------------------------------------------------- # Check for the existence of the -lsocket and -lnsl libraries. # The order here is important, so that they end up in the right # order in the command line generated by make. Here are some # special considerations: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- tcl_checkBoth=0 ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" if test "x$ac_cv_func_connect" = xyes; then : tcl_checkSocket=0 else tcl_checkSocket=1 fi if test "$tcl_checkSocket" = 1; then ac_fn_c_check_func "$LINENO" "setsockopt" "ac_cv_func_setsockopt" if test "x$ac_cv_func_setsockopt" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setsockopt in -lsocket" >&5 $as_echo_n "checking for setsockopt in -lsocket... " >&6; } if ${ac_cv_lib_socket_setsockopt+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char setsockopt (); int main () { return setsockopt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_setsockopt=yes else ac_cv_lib_socket_setsockopt=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_setsockopt" >&5 $as_echo "$ac_cv_lib_socket_setsockopt" >&6; } if test "x$ac_cv_lib_socket_setsockopt" = xyes; then : LIBS="$LIBS -lsocket" else tcl_checkBoth=1 fi fi fi if test "$tcl_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept" if test "x$ac_cv_func_accept" = xyes; then : tcl_checkNsl=0 else LIBS=$tk_oldLibs fi fi ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : LIBS="$LIBS -lnsl" fi fi # TEA specific: Don't perform the eval of the libraries here because # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking dirent.h" >&5 $as_echo_n "checking dirent.h... " >&6; } if ${tcl_cv_dirent_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #ifndef _POSIX_SOURCE # ifdef __Lynx__ /* * Generate compilation error to make the test fail: Lynx headers * are only valid if really in the POSIX environment. */ missing_procedure(); # endif #endif DIR *d; struct dirent *entryPtr; char *p; d = opendir("foobar"); entryPtr = readdir(d); p = entryPtr->d_name; closedir(d); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_dirent_h=yes else tcl_cv_dirent_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_dirent_h" >&5 $as_echo "$tcl_cv_dirent_h" >&6; } if test $tcl_cv_dirent_h = no; then $as_echo "#define NO_DIRENT_H 1" >>confdefs.h fi # TEA specific: ac_fn_c_check_header_mongrel "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default" if test "x$ac_cv_header_errno_h" = xyes; then : else $as_echo "#define NO_ERRNO_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" if test "x$ac_cv_header_float_h" = xyes; then : else $as_echo "#define NO_FLOAT_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default" if test "x$ac_cv_header_values_h" = xyes; then : else $as_echo "#define NO_VALUES_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" if test "x$ac_cv_header_limits_h" = xyes; then : $as_echo "#define HAVE_LIMITS_H 1" >>confdefs.h else $as_echo "#define NO_LIMITS_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : tcl_ok=1 else tcl_ok=0 fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtol" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtoul" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strtod" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* if test $tcl_ok = 0; then $as_echo "#define NO_STDLIB_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" if test "x$ac_cv_header_string_h" = xyes; then : tcl_ok=1 else tcl_ok=0 fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strstr" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "strerror" >/dev/null 2>&1; then : else tcl_ok=0 fi rm -f conftest* # See also memmove check below for a place where NO_STRING_H can be # set and why. if test $tcl_ok = 0; then $as_echo "#define NO_STRING_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default" if test "x$ac_cv_header_sys_wait_h" = xyes; then : else $as_echo "#define NO_SYS_WAIT_H 1" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" if test "x$ac_cv_header_dlfcn_h" = xyes; then : else $as_echo "#define NO_DLFCN_H 1" >>confdefs.h fi # OS/390 lacks sys/param.h (and doesn't need it, by chance). for ac_header in sys/param.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" if test "x$ac_cv_header_sys_param_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_PARAM_H 1 _ACEOF fi done # Let the user call this, because if it triggers, they will # need a compat/strtod.c that is correct. Users can also # use Tcl_GetDouble(FromObj) instead. #TEA_BUGGY_STRTOD fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by exp_test $as_me 0.43, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ exp_test config.status 0.43 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi expect5.45.4/testsuite/Makefile.in0000644000175000017500000000533413235134350017430 0ustar pysslingpysslingVPATH = @srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ host = @host@ bindir = @bindir@ libdir = @libdir@ tooldir = $(libdir)/$(target_alias) includedir = @includedir@ gxx_includedir = $(tooldir)/g++-include targetdir = $(datadir)/$(target_alias) SHELL = /bin/sh CC = @CC@ TCL_SRC_DIR = @TCL_SRC_DIR@ CC_FOR_TARGET = ` \ if [ -f $${rootme}../gcc/Makefile ] ; then \ echo $${rootme}../gcc/xgcc -B$${rootme}../gcc/; \ else \ if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ echo $(CC); \ else \ t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \ fi; \ fi` EXPECT = `if [ -f $${rootme}/expect ] ; \ then echo $${rootme}/expect ; \ else echo expect; fi` RUNTEST = ` \ if [ -f ${srcdir}/../../dejagnu/runtest ] ; then \ echo ${srcdir}/../../dejagnu/runtest ; \ else echo runtest ; fi` RUNTESTFLAGS = all: binaries: libraries: .PHONY: info install-info check installcheck info: install-info: check: installcheck: .NOEXPORT: check: exp_test site.exp rootme=`cd .. && pwd`; export rootme; \ EXPECT=${EXPECT}; export EXPECT; \ if [ -f ../expect ] ; then \ TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` ; \ export TCL_LIBRARY ; \ else true ; fi ; \ $(RUNTEST) $(RUNTESTFLAGS) --tool expect EXPECT=$$EXPECT --srcdir $(srcdir) install: uninstall: force exp_test.o: ${srcdir}/exp_test.c site.exp: ./config.status @echo "Making a new config file..." -@rm -f ./tmp? @touch site.exp -@mv site.exp site.bak @echo "## these variables are automatically generated by make ##" > ./tmp0 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0 @echo "# add them to the last section" >> ./tmp0 @echo "set tool expect" >> ./tmp0 @echo "set srcdir ${srcdir}" >> ./tmp0 @echo "set objdir `pwd`" >> ./tmp0 @echo "set host_triplet ${host}" >> ./tmp0 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 @cat ./tmp0 > site.exp @cat site.bak | sed \ -e '1,/^## All variables above are.*##/ d' >> site.exp @rm -f ./tmp1 ./tmp0 clean mostlyclean: -rm -f *~ core *.o a.out *.x distclean realclean: clean -rm -f *~ core -rm -f Makefile config.status -rm -fr *.log summary detail Makefile : $(srcdir)/Makefile.in $(host_makefile_frag) $(SHELL) ./config.status # Original aclocal.m4 comes from DejaGnu # CYGNUS LOCAL: this hack lets "make -f Makefile.in" produce a configure file configure: force @echo "Rebuilding configure..." if [ x"${srcdir}" = x"@srcdir@" ] ; then \ srcdir=. ; export srcdir ; \ else true ; fi ; \ (cd $${srcdir}; autoconf --localdir=$${srcdir}/..) config.status: $(srcdir)/configure @echo "Rebuilding config.status..." $(SHELL) ./config.status --recheck force: expect5.45.4/testsuite/configure.in0000644000175000017500000000035713235134350017674 0ustar pysslingpysslingdnl Process this file with autoconf to produce a configure script. AC_INIT([exp_test],[0.43]) TEA_INIT([3.9]) AC_CONFIG_AUX_DIR(../tclconfig) TEA_PATH_TCLCONFIG TEA_LOAD_TCLCONFIG TEA_SETUP_COMPILER AC_SUBST(host) AC_OUTPUT(Makefile) expect5.45.4/testsuite/aclocal.m40000644000175000017500000000022613235134350017216 0ustar pysslingpyssling# # Include the TEA standard macro set # builtin(include,../tclconfig/tcl.m4) # # Add here whatever m4 macros you want to define for your package # expect5.45.4/testsuite/exp_test.c0000644000175000017500000000125513235134350017360 0ustar pysslingpyssling/* * exp-test -- this is a simple C program to test the interactive functions of expect. */ #include #include #define ARRAYSIZE 128 main (argc, argv) int argc; char *argv[]; { char line[ARRAYSIZE]; do { memset (line, 0, ARRAYSIZE); fgets (line, ARRAYSIZE, stdin); *(line + strlen(line)-1) = '\0'; /* get rid of the newline */ /* look for a few simple commands */ if (strncmp (line,"prompt ", 6) == 0) { printf ("%s (y or n) ?", line + 6); if (getchar() == 'y') puts ("YES"); else puts ("NO"); } if (strncmp (line, "print ", 6) == 0) { puts (line + 6); } } while (strncmp (line, "quit", 4)); } expect5.45.4/exp_tty.c0000664000175000017500000004422713235134350015200 0ustar pysslingpyssling/* exp_tty.c - tty support routines */ #include "expect_cf.h" #include #include #include "string.h" #ifdef HAVE_SYS_FCNTL_H # include #else # include #endif #include #ifdef HAVE_INTTYPES_H # include #endif #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_SYS_WAIT_H #include #endif #if defined(SIGCLD) && !defined(SIGCHLD) #define SIGCHLD SIGCLD #endif #include "tcl.h" #include "exp_prog.h" #include "exp_rename.h" #include "exp_tty_in.h" #include "exp_command.h" #include "exp_log.h" #include "exp_win.h" static int is_raw = FALSE; static int is_noecho = FALSE; int exp_ioctled_devtty = FALSE; int exp_stdin_is_tty; int exp_stdout_is_tty; /*static*/ extern exp_tty exp_tty_current, exp_tty_cooked; #define tty_current exp_tty_current #define tty_cooked exp_tty_cooked int exp_israw(void) { return is_raw; } int exp_isecho(void) { return !is_noecho; } /* if set == 1, set it to raw, else unset it */ void exp_tty_raw(int set) { if (set == 1) { is_raw = TRUE; #if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO) /* had POSIX too */ tty_current.c_iflag = 0; tty_current.c_oflag = 0; tty_current.c_lflag &= ECHO; /* disable everything but echo */ tty_current.c_cc[VMIN] = 1; tty_current.c_cc[VTIME] = 0; } else { tty_current.c_iflag = tty_cooked.c_iflag; tty_current.c_oflag = tty_cooked.c_oflag; /* tty_current.c_lflag = tty_cooked.c_lflag;*/ /* attempt 2 tty_current.c_lflag = tty_cooked.c_lflag & ~ECHO;*/ /* retain current echo setting */ tty_current.c_lflag = (tty_cooked.c_lflag & ~ECHO) | (tty_current.c_lflag & ECHO); tty_current.c_cc[VMIN] = tty_cooked.c_cc[VMIN]; tty_current.c_cc[VTIME] = tty_cooked.c_cc[VTIME]; #else # if defined(HAVE_SGTTYB) tty_current.sg_flags |= RAW; } else { tty_current.sg_flags = tty_cooked.sg_flags; # endif #endif is_raw = FALSE; } } void exp_tty_echo(int set) { if (set == 1) { is_noecho = FALSE; #if defined(HAVE_TERMIOS) || defined(HAVE_TERMIO) /* had POSIX too */ tty_current.c_lflag |= ECHO; } else { tty_current.c_lflag &= ~ECHO; #else tty_current.sg_flags |= ECHO; } else { tty_current.sg_flags &= ~ECHO; #endif is_noecho = TRUE; } } int exp_tty_set_simple(exp_tty *tty) { #ifdef HAVE_TCSETATTR return(tcsetattr(exp_dev_tty, TCSADRAIN,tty)); #else return(ioctl (exp_dev_tty, TCSETSW ,tty)); #endif } int exp_tty_get_simple(exp_tty *tty) { #ifdef HAVE_TCSETATTR return(tcgetattr(exp_dev_tty, tty)); #else return(ioctl (exp_dev_tty, TCGETS, tty)); #endif } /* returns 0 if nothing changed */ /* if something changed, the out parameters are changed as well */ int exp_tty_raw_noecho( Tcl_Interp *interp, exp_tty *tty_old, int *was_raw, int *was_echo) { if (exp_disconnected) return(0); if (is_raw && is_noecho) return(0); if (exp_dev_tty == -1) return(0); *tty_old = tty_current; /* save old parameters */ *was_raw = is_raw; *was_echo = !is_noecho; expDiagLog("tty_raw_noecho: was raw = %d echo = %d\r\n",is_raw,!is_noecho); exp_tty_raw(1); exp_tty_echo(-1); if (exp_tty_set_simple(&tty_current) == -1) { expErrorLog("ioctl(raw): %s\r\n",Tcl_PosixError(interp)); /* SF #439042 -- Allow overide of "exit" by user / script */ { char buffer [] = "exit 1"; Tcl_Eval(interp, buffer); } } exp_ioctled_devtty = TRUE; return(1); } /* returns 0 if nothing changed */ /* if something changed, the out parameters are changed as well */ int exp_tty_cooked_echo( Tcl_Interp *interp, exp_tty *tty_old, int *was_raw, int *was_echo) { if (exp_disconnected) return(0); if (!is_raw && !is_noecho) return(0); if (exp_dev_tty == -1) return(0); *tty_old = tty_current; /* save old parameters */ *was_raw = is_raw; *was_echo = !is_noecho; expDiagLog("tty_cooked_echo: was raw = %d echo = %d\r\n",is_raw,!is_noecho); exp_tty_raw(-1); exp_tty_echo(1); if (exp_tty_set_simple(&tty_current) == -1) { expErrorLog("ioctl(noraw): %s\r\n",Tcl_PosixError(interp)); /* SF #439042 -- Allow overide of "exit" by user / script */ { char buffer [] = "exit 1"; Tcl_Eval(interp, buffer); } } exp_ioctled_devtty = TRUE; return(1); } void exp_tty_set( Tcl_Interp *interp, exp_tty *tty, int raw, int echo) { if (exp_tty_set_simple(tty) == -1) { expErrorLog("ioctl(set): %s\r\n",Tcl_PosixError(interp)); /* SF #439042 -- Allow overide of "exit" by user / script */ { char buffer [] = "exit 1"; Tcl_Eval(interp, buffer); } } is_raw = raw; is_noecho = !echo; tty_current = *tty; expDiagLog("tty_set: raw = %d, echo = %d\r\n",is_raw,!is_noecho); exp_ioctled_devtty = TRUE; } #if 0 /* avoids scoping problems */ void exp_update_cooked_from_current() { tty_cooked = tty_current; } int exp_update_real_tty_from_current() { return(exp_tty_set_simple(&tty_current)); } int exp_update_current_from_real_tty() { return(exp_tty_get_simple(&tty_current)); } #endif void exp_init_stdio() { exp_stdin_is_tty = isatty(0); exp_stdout_is_tty = isatty(1); setbuf(stdout,(char *)0); /* unbuffer stdout */ } /*ARGSUSED*/ void exp_tty_break( Tcl_Interp *interp, int fd) { #ifdef POSIX tcsendbreak(fd,0); #else # ifdef TIOCSBRK ioctl(fd,TIOCSBRK,0); exp_dsleep(interp,0.25); /* sleep for at least a quarter of a second */ ioctl(fd,TIOCCBRK,0); # else /* dunno how to do this - ignore */ # endif #endif } /* take strings with newlines and insert carriage-returns. This allows user */ /* to write send_user strings without always putting in \r. */ /* If len == 0, use strlen to compute it */ /* NB: if terminal is not in raw mode, nothing is done. */ char * exp_cook( char *s, int *len) /* current and new length of s */ { static int destlen = 0; static char *dest = 0; char *d; /* ptr into dest */ unsigned int need; if (s == 0) return(""); if (!is_raw) return(s); /* worst case is every character takes 2 to represent */ need = 1 + 2*(len?*len:strlen(s)); if (need > destlen) { if (dest) ckfree(dest); dest = ckalloc(need); destlen = need; } for (d = dest;*s;s++) { if (*s == '\n') { *d++ = '\r'; *d++ = '\n'; } else { *d++ = *s; } } *d = '\0'; if (len) *len = d-dest; return(dest); } static int /* returns TCL_whatever */ exec_stty( Tcl_Interp *interp, int argc, char **argv, int devtty) /* if true, redirect to /dev/tty */ { int i; int rc; Tcl_Obj *cmdObj = Tcl_NewStringObj("",0); Tcl_IncrRefCount(cmdObj); Tcl_AppendStringsToObj(cmdObj,"exec ",(char *)0); Tcl_AppendStringsToObj(cmdObj,STTY_BIN,(char *)0); for (i=1;i/dev/tty", #else " " */ char original_redirect_char = (*redirect)[0]; (*redirect)[0] = '>'; /* stderr unredirected so we can get it directly! */ #endif rc = exec_stty(interp,argc,argv0,0); #ifdef STTY_READS_STDOUT /* restore redirect - don't know if necessary */ (*redirect)[0] = original_redirect_char; #endif } } done: exp_trap_on(master); return rc; } /*ARGSUSED*/ static int Exp_SystemCmd( ClientData clientData, Tcl_Interp *interp, int argc, char **argv) { int result = TCL_OK; RETSIGTYPE (*old)(); /* save old sigalarm handler */ #define MAX_ARGLIST 10240 int i; WAIT_STATUS_TYPE waitStatus; int systemStatus ; int abnormalExit = FALSE; char buf[MAX_ARGLIST]; char *bufp = buf; int total_len = 0, arg_len; int stty_args_recognized = TRUE; int cmd_is_stty = FALSE; int cooked = FALSE; int was_raw, was_echo; if (argc == 1) return TCL_OK; if (streq(argv[1],"stty")) { expDiagLogU("system stty is deprecated, use stty\r\n"); cmd_is_stty = TRUE; was_raw = exp_israw(); was_echo = exp_isecho(); } if (argc > 2 && cmd_is_stty) { exp_ioctled_devtty = TRUE; for (i=2;i MAX_ARGLIST) { exp_error(interp,"args too long (>=%d chars)", total_len); return(TCL_ERROR); } memcpy(bufp,argv[i],arg_len); bufp += arg_len; /* no need to check bounds, we accted for it earlier */ memcpy(bufp," ",1); bufp += 1; } *(bufp-1) = '\0'; old = signal(SIGCHLD, SIG_DFL); systemStatus = system(buf); signal(SIGCHLD, old); /* restore signal handler */ expDiagLogU("system("); expDiagLogU(buf); expDiagLog(") = %d\r\n",i); if (systemStatus == -1) { exp_error(interp,Tcl_PosixError(interp)); return TCL_ERROR; } *(int *)&waitStatus = systemStatus; if (!stty_args_recognized) { /* find out what weird options user asked for */ if ( #ifdef HAVE_TCSETATTR tcgetattr(exp_dev_tty, &tty_current) == -1 #else ioctl(exp_dev_tty, TCGETS, &tty_current) == -1 #endif ) { expErrorLog("ioctl(get): %s\r\n",Tcl_PosixError(interp)); /* SF #439042 -- Allow overide of "exit" by user / script */ { char buffer [] = "exit 1"; Tcl_Eval(interp, buffer); } } if (cooked) { /* find out user's new defn of 'cooked' */ tty_cooked = tty_current; } } if (cmd_is_stty) { char buf [11]; sprintf(buf,"%sraw %secho", (was_raw?"":"-"), (was_echo?"":"-")); Tcl_SetResult (interp, buf, TCL_VOLATILE); } /* following macros stolen from Tcl's tclUnix.h file */ /* we can't include the whole thing because it depends on other macros */ /* that come out of Tcl's Makefile, sigh */ #if 0 #undef WIFEXITED #ifndef WIFEXITED # define WIFEXITED(stat) (((*((int *) &(stat))) & 0xff) == 0) #endif #undef WEXITSTATUS #ifndef WEXITSTATUS # define WEXITSTATUS(stat) (((*((int *) &(stat))) >> 8) & 0xff) #endif #undef WIFSIGNALED #ifndef WIFSIGNALED # define WIFSIGNALED(stat) (((*((int *) &(stat)))) && ((*((int *) &(stat))) == ((*((int *) &(stat))) & 0x00ff))) #endif #undef WTERMSIG #ifndef WTERMSIG # define WTERMSIG(stat) ((*((int *) &(stat))) & 0x7f) #endif #undef WIFSTOPPED #ifndef WIFSTOPPED # define WIFSTOPPED(stat) (((*((int *) &(stat))) & 0xff) == 0177) #endif #undef WSTOPSIG #ifndef WSTOPSIG # define WSTOPSIG(stat) (((*((int *) &(stat))) >> 8) & 0xff) #endif #endif /* 0 */ /* stolen from Tcl. Again, this is embedded in another routine */ /* (CleanupChildren in tclUnixAZ.c) that we can't use directly. */ if (!WIFEXITED(waitStatus) || (WEXITSTATUS(waitStatus) != 0)) { char msg1[20], msg2[20]; int pid = 0; /* fake a pid, since system() won't tell us */ result = TCL_ERROR; sprintf(msg1, "%d", pid); if (WIFEXITED(waitStatus)) { sprintf(msg2, "%d", WEXITSTATUS(waitStatus)); Tcl_SetErrorCode(interp, "CHILDSTATUS", msg1, msg2, (char *) NULL); abnormalExit = TRUE; } else if (WIFSIGNALED(waitStatus)) { CONST char *p; p = Tcl_SignalMsg((int) (WTERMSIG(waitStatus))); Tcl_SetErrorCode(interp, "CHILDKILLED", msg1, Tcl_SignalId((int) (WTERMSIG(waitStatus))), p, (char *) NULL); Tcl_AppendResult(interp, "child killed: ", p, "\n", (char *) NULL); } else if (WIFSTOPPED(waitStatus)) { CONST char *p; p = Tcl_SignalMsg((int) (WSTOPSIG(waitStatus))); Tcl_SetErrorCode(interp, "CHILDSUSP", msg1, Tcl_SignalId((int) (WSTOPSIG(waitStatus))), p, (char *) NULL); Tcl_AppendResult(interp, "child suspended: ", p, "\n", (char *) NULL); } else { Tcl_AppendResult(interp, "child wait status didn't make sense\n", (char *) NULL); } } if (abnormalExit && (Tcl_GetStringResult (interp)[0] == 0)) { Tcl_AppendResult(interp, "child process exited abnormally", (char *) NULL); } return result; } static struct exp_cmd_data cmd_data[] = { {"stty", exp_proc(Exp_SttyCmd), 0, 0}, {"system", exp_proc(Exp_SystemCmd), 0, 0}, {0}}; void exp_init_tty_cmds(struct Tcl_Interp *interp) { exp_create_commands(interp,cmd_data); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ expect5.45.4/expTcl.c0000664000175000017500000000000013235134350014720 0ustar pysslingpysslingexpect5.45.4/INSTALL0000644000175000017500000002467513235134350014374 0ustar pysslingpysslingThis file is INSTALL. It contains installation instructions for Expect. If you do not have Tcl, get it (Expect's README explains how) and install it. The rest of these instructions assume that you have Tcl installed. If you are installing Expect on a single architecture, or are just trying it out to see whether it is worth installing, follow the "Simple Installation" below. If you are installing Expect on multiple architectures or the "Simple Installation" instructions are not sufficient, see "Sophisticated Installations" below. -------------------- Permissions -------------------- On a Cray, you must be root to compile Expect. See the FAQ for why this is. If you want shared libs on Linux, you must be root in order to run ldconfig. See the ldconfig man page for more info. -------------------- Simple Installation -------------------- By default, the Tcl source directory is assumed to be in the same directory as the Expect source directory. For example, in this listing, Expect and Tcl are both stored in /usr/local/src: /usr/local/src/tcl8.0 (actual version may be different) /usr/local/src/expect-5.24 (actual version may be different) If Tcl is stored elsewhere, the easiest way to deal with this is to create a symbolic link to its real directory. For example, from the Expect directory, type: ln -s /some/where/else/src/tcl8.0 .. The same applies for Tk, if you have it. (Tk is optional.) Run "./configure". This will generate a Makefile (from a prototype called "Makefile.in") appropriate to your system. (This step must be done in the foreground because configure performs various tests on your controlling tty. If you want to do this step in the background in the future, automate it using Expect!) Most people will not need to make any changes to the generated Makefile and can go on to the next step. If you want though, you can edit the Makefile and change any definitions as appropriate for your site. All the definitions you are likely to want to change are clearly identified and described at the beginning of the file. To build only the stand-alone Expect program, run "make expect". This is appropriate even if you still haven't decided whether to install Expect, are still curious about it, and want to do the minimum possible in order to experiment with it. To build everything, run "make". If "configure" found Tk and X on your system, this will build "expectk" (Expect with Tk). Once expect is built, you can cd to the example directory and try out some of the examples (see the README file in the example directory). Note that if Tcl has not yet been installed, this won't work. In this case, see the instructions "Trying Expect Without Installing Tcl" below. "make install" will install Expect. If you built Expectk, that will be installed as well. So will the documentation and some of the most useful examples. If you want shared libs on Linux, you must now su to root and run ldconfig on the shared library. See the ldconfig man page for more info. A handful of people running "pure" 4.2BSD systems have noted that expect fails to link due to lack of getopt and vprintf. You can get these from uunet or any good archive site. -------------------- Trying Expect Without Installing Tcl -------------------- Once expect is built, you can try it out. If Tcl has not been installed (but it has been compiled), you will need to define the environment variable TCL_LIBRARY. It should name the directory contain the Tcl libraries. For example, if you are using csh with Tcl 8.0.3: $ setenv TCL_LIBRARY ../tcl8.0.3/library Now you can run expect. The same advice applies to Tk. If it is available but has not been installed, you can try out expectk but only after defining TK_LIBRARY. For example, if you are using csh with Tk 8.0.3: $ setenv TK_LIBRARY ../tk8.0.3/library Now you can run expectk. -------------------- Sophisticated Installations -------------------- The following instructions provide some suggestions for handling complex installations. -------------------- Changing Defaults -------------------- The configure script allows you to customize the Expect configuration for your site; for details on how you can do this, type "./configure -help" or refer to the autoconf documentation (not included here). Expect's configure supports the following flags in addition to the standard ones: --verbose Cause configure to describe what it is checking and what it decides. --enable-shared Compile Expect as a shared library if it can figure out how to do that on this platform. (You must have already compiled Tcl with this flag.) --disable-load This switch is ignored so that you can configure Expect with the same configure command as Tcl. If you want to disable dynamic loading, configure Tcl with this flag and then reconfigure Expect. --enable-gcc This switch is ignored so that you can configure Expect with the same configure command as Tcl. If you want to enable gcc, configure Tcl with it and then reconfigure Expect. Expect will inherit the definition that way. It is not safe to modify the Makefile to use gcc by hand. If you do this, then information related to dynamic linking will be incorrect. --enable-threads This switch is ignored so that you can configure Expect with the same configure command as Tcl. --with-tcl=... Specifies the directory containing Tcl's configure file (tclConfig.sh). --with-tclinclude=... Specifies the directory containing Tcl's private include files (such as tclInt.h) --with-tk=... Specifies the directory containing Tk's configure file (tkConfig.sh). --with-tkinclude=... Specifies the directory containing Tk's private include files (such as tkInt.h) Some of the defaults in "configure" can be overridden by environment variables. This is a convenience intended for environments that are likely to affect any program that you configure and install. The following environment variables are supported. If you use these, consider adding them to your .login file so that other installation scripts can make use of them. CC C compiler CFLAGS Flags to C compiler CPPFLAGS Flags to C preprocessor LDFLAGS Flags to linker LIBS Libraries CONFIG_SHELL Shell for configure and Make Settings can also be given on the command line. For example, you could tell configure about flags from a Bourne-compatible shell as follows: CFLAGS=-O2 LIBS=-lposix ./configure Although configure will do some searching for Tcl (and all of this discussion holds true for Tk as well), configure likes to find the Tcl source directory in the parent directory of Expect and will use that Tcl if it exists. To make sure Tcl can be found this way (if it is located somewhere else), create a symbolic link in Expect's parent directory to where the Tcl directory is. By default, configure uses the latest Tcl it can find. You can override this by creating a symbolic link of "tcl" which points to the release you want. If you can't or don't want to create symbolic links, you can instead indicate where Tcl and Tk are by using the following environment variables: with_tcl Directory containing Tcl configure file (tclConfig.h) with_tclinclude Directory containing Tcl include files with_tkinclude Directory containing Tk include files with_tk Directory containing Tk binary library (tkConfig.h) -------------------- Multiple-Architecture Installation -------------------- You might want to compile a software package in a different directory from the one that contains the source code. Doing this allows you to compile the package for several architectures simultaneously from the same copy of the source code and keep multiple sets of object files on disk. To compile the package in a different directory from the one containing the source code, you must use a version of make that supports the VPATH variable. GNU make and most other recent make programs can do this. cd to the directory where you want the object files and executables to go and run configure. configure automatically checks for the source code in the directory that configure is in and in .. If configure reports that it cannot find the source code, run configure with the option --srcdir=dir, where dir is the directory that contains the source code. You can save some disk space by installing architecture-independent files (e.g., scripts, include files) in a different place than architecture-dependent files (e.g., binaries, libraries). To do this, edit the Makefile after configure builds it, or have configure create the Makefile with the right definitions in the first place. To have configure do it, use the following options to configure: --prefix=indep --exec-prefix=dep where dep is the root of the tree in which to store architecture-dependent files and indep is the root in which to store -dependent files. For example, you might invoke configure this way: configure --prefix=/usr/local/bin --exec-prefix=/usr/local/bin/arch -------------------- Test Suite -------------------- Patterned after the Tcl test suite, I have begun building a test suite in the subdirectory "test". It is still incomplete however you may use by typing "make test" in this directory. You should then see a printout of the test files processed. If any errors occur, you'll see a much more substantial printout for each error. See the README file in the "tests" directory for more information on the test suite. Note that the test suite assumes the existence of certain programs to use as interactive programs. If you are missing these or they behave differently, errors may be reported. Similarly, the test suite assumes certain other things about your system, such as the sane stty parameters. You may also try some of the programs distribute in the example directory (see the README file in the example directory). They are a strong indication of whether Expect works or not. If you have any problems with them, let me know. -------------------- Uninstalling -------------------- "make uninstall" removes all the files that "make install" creates (excluding those in the current directory). -------------------- Cleaning Up -------------------- Several "clean" targets are available to reduce space consumption of the Expect source. The two most useful are as follows: "make clean" deletes all files from the current directory that were created by "make" "make distclean" is like "make clean", but it also deletes files created by "configure" Other targets can be found in the Makefile. They follow the GNU Makefile conventions. expect5.45.4/exp_console.c0000664000175000017500000000335213235134350016014 0ustar pysslingpyssling/* exp_console.c - grab console. This stuff is in a separate file to avoid unpleasantness of AIX (3.2.4) .h files which provide no way to reference TIOCCONS and include both sys/ioctl.h and sys/sys/stropts.h without getting some sort of warning from the compiler. The problem is that both define _IO but only ioctl.h checks to see if it is defined first. This would suggest that it is sufficient to include ioctl.h after stropts.h. Unfortunately, ioctl.h, having seen that _IO is defined, then fails to define other important things (like _IOW). Written by: Don Libes, NIST, 2/6/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #include "expect_cf.h" #include #include #include /* Solaris needs this for console redir */ #ifdef HAVE_STRREDIR_H #include # ifdef SRIOCSREDIR # undef TIOCCONS # endif #endif #ifdef HAVE_SYS_FCNTL_H #include #endif #include "tcl.h" #include "exp_rename.h" #include "exp_prog.h" #include "exp_command.h" #include "exp_log.h" static void exp_console_manipulation_failed(s) char *s; { expErrorLog("expect: spawn: cannot %s console, check permissions of /dev/console\n",s); exit(-1); } void exp_console_set() { #ifdef SRIOCSREDIR int fd; if ((fd = open("/dev/console", O_RDONLY)) == -1) { exp_console_manipulation_failed("open"); } if (ioctl(fd, SRIOCSREDIR, 0) == -1) { exp_console_manipulation_failed("redirect"); } close(fd); #endif #ifdef TIOCCONS int on = 1; if (ioctl(0,TIOCCONS,(char *)&on) == -1) { exp_console_manipulation_failed("redirect"); } #endif /*TIOCCONS*/ } expect5.45.4/Makefile.in0000664000175000017500000005424013235134350015401 0ustar pysslingpyssling# 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: expect5.45.4/configure.in0000775000175000017500000007367613235561756015704 0ustar pysslingpysslingdnl 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) expect5.45.4/fixline10000755000175000017500000000130413235134350014770 0ustar pysslingpyssling#!expect -- # Synopsis: fixline1 newpath < input > output # Author: Don Libes # Description: change first line of script to reflect new binary # try to match any of the following first lines #!expect ... #!../expect ... #!expectk ... #!foo/bar/expectk ... #!/bin/sh ... (beginning of multiline #! style) # set line1 [gets stdin] if {"$line1" == "\#!/bin/sh"} { # if multi-line hack already in place, do nothing set header $line1 } else { # if single-line #!, switch to multi-line rewrite regexp "^#!(.*/)*(.*)" $line1 X X tail set header "#!/bin/sh\n" append header "# \\\n" append header "exec $tail "; append header {"$0" ${1+"$@"}} } puts -nonewline "$header\n[read stdin]" expect5.45.4/exp_tty.h0000664000175000017500000000151413235134350015175 0ustar pysslingpyssling/* exp_tty.h - tty support definitions Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #ifndef __EXP_TTY_H__ #define __EXP_TTY_H__ #include "expect_cf.h" extern int exp_dev_tty; extern int exp_ioctled_devtty; extern int exp_stdin_is_tty; extern int exp_stdout_is_tty; void exp_tty_raw(int set); void exp_tty_echo(int set); void exp_tty_break(Tcl_Interp *interp, int fd); int exp_tty_raw_noecho(Tcl_Interp *interp, exp_tty *tty_old, int *was_raw, int *was_echo); int exp_israw(void); int exp_isecho(void); void exp_tty_set(Tcl_Interp *interp, exp_tty *tty, int raw, int echo); int exp_tty_set_simple(exp_tty *tty); int exp_tty_get_simple(exp_tty *tty); #endif /* __EXP_TTY_H__ */ expect5.45.4/exp_clib.c0000664000175000017500000021562213235134350015270 0ustar pysslingpyssling/* exp_clib.c - top-level functions in the expect C library, libexpect.a Written by: Don Libes, libes@cme.nist.gov, NIST, 12/3/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #include "expect_cf.h" #include #include #ifdef HAVE_INTTYPES_H # include #endif #include #include #ifdef TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef CRAY # ifndef TCSETCTTY # if defined(HAVE_TERMIOS) # include # else # include # endif # endif #endif #ifdef HAVE_SYS_FCNTL_H # include #else # include #endif #ifdef HAVE_STRREDIR_H #include # ifdef SRIOCSREDIR # undef TIOCCONS # endif #endif #include /*#include - deprecated - ANSI C moves them into string.h */ #include "string.h" #include #ifdef NO_STDLIB_H /* * Tcl's compat/stdlib.h */ /* * stdlib.h -- * * Declares facilities exported by the "stdlib" portion of * the C library. This file isn't complete in the ANSI-C * sense; it only declares things that are needed by Tcl. * This file is needed even on many systems with their own * stdlib.h (e.g. SunOS) because not all stdlib.h files * declare all the procedures needed here (such as strtod). * * Copyright (c) 1991 The Regents of the University of California. * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: exp_clib.c,v 5.38 2010/07/01 00:53:49 eee Exp $ */ #ifndef _STDLIB #define _STDLIB extern void abort _ANSI_ARGS_((void)); extern double atof _ANSI_ARGS_((CONST char *string)); extern int atoi _ANSI_ARGS_((CONST char *string)); extern long atol _ANSI_ARGS_((CONST char *string)); extern char * calloc _ANSI_ARGS_((unsigned int numElements, unsigned int size)); extern void exit _ANSI_ARGS_((int status)); extern int free _ANSI_ARGS_((char *blockPtr)); extern char * getenv _ANSI_ARGS_((CONST char *name)); extern char * malloc _ANSI_ARGS_((unsigned int numBytes)); extern void qsort _ANSI_ARGS_((VOID *base, int n, int size, int (*compar)(CONST VOID *element1, CONST VOID *element2))); extern char * realloc _ANSI_ARGS_((char *ptr, unsigned int numBytes)); extern double strtod _ANSI_ARGS_((CONST char *string, char **endPtr)); extern long strtol _ANSI_ARGS_((CONST char *string, char **endPtr, int base)); extern unsigned long strtoul _ANSI_ARGS_((CONST char *string, char **endPtr, int base)); #endif /* _STDLIB */ /* * end of Tcl's compat/stdlib.h */ #else #include /* for malloc */ #endif #include #include "expect.h" #define TclRegError exp_TclRegError /* * regexp code - from tcl8.0.4/generic/regexp.c */ /* * TclRegComp and TclRegExec -- TclRegSub is elsewhere * * Copyright (c) 1986 by University of Toronto. * Written by Henry Spencer. Not derived from licensed software. * * Permission is granted to anyone to use this software for any * purpose on any computer system, and to redistribute it freely, * subject to the following restrictions: * * 1. The author is not responsible for the consequences of use of * this software, no matter how awful, even if they arise * from defects in it. * * 2. The origin of this software must not be misrepresented, either * by explicit claim or by omission. * * 3. Altered versions must be plainly marked as such, and must not * be misrepresented as being the original software. * * Beware that some of this code is subtly aware of the way operator * precedence is structured in regular expressions. Serious changes in * regular-expression syntax might require a total rethink. * * *** NOTE: this code has been altered slightly for use in Tcl: *** * *** 1. Use ckalloc and ckfree instead of malloc and free. *** * *** 2. Add extra argument to regexp to specify the real *** * *** start of the string separately from the start of the *** * *** current search. This is needed to search for multiple *** * *** matches within a string. *** * *** 3. Names have been changed, e.g. from regcomp to *** * *** TclRegComp, to avoid clashes with other *** * *** regexp implementations used by applications. *** * *** 4. Added errMsg declaration and TclRegError procedure *** * *** 5. Various lint-like things, such as casting arguments *** * *** in procedure calls. *** * * *** NOTE: This code has been altered for use in MT-Sturdy Tcl *** * *** 1. All use of static variables has been changed to access *** * *** fields of a structure. *** * *** 2. This in addition to changes to TclRegError makes the *** * *** code multi-thread safe. *** * * RCS: @(#) $Id: exp_clib.c,v 5.38 2010/07/01 00:53:49 eee Exp $ */ #if 0 #include "tclInt.h" #include "tclPort.h" #endif /* * The variable below is set to NULL before invoking regexp functions * and checked after those functions. If an error occurred then TclRegError * will set the variable to point to a (static) error message. This * mechanism unfortunately does not support multi-threading, but the * procedures TclRegError and TclGetRegError can be modified to use * thread-specific storage for the variable and thereby make the code * thread-safe. */ static char *errMsg = NULL; /* * The "internal use only" fields in regexp.h are present to pass info from * compile to execute that permits the execute phase to run lots faster on * simple cases. They are: * * regstart char that must begin a match; '\0' if none obvious * reganch is the match anchored (at beginning-of-line only)? * regmust string (pointer into program) that match must include, or NULL * regmlen length of regmust string * * Regstart and reganch permit very fast decisions on suitable starting points * for a match, cutting down the work a lot. Regmust permits fast rejection * of lines that cannot possibly match. The regmust tests are costly enough * that TclRegComp() supplies a regmust only if the r.e. contains something * potentially expensive (at present, the only such thing detected is * or + * at the start of the r.e., which can involve a lot of backup). Regmlen is * supplied because the test in TclRegExec() needs it and TclRegComp() is * computing it anyway. */ /* * Structure for regexp "program". This is essentially a linear encoding * of a nondeterministic finite-state machine (aka syntax charts or * "railroad normal form" in parsing technology). Each node is an opcode * plus a "next" pointer, possibly plus an operand. "Next" pointers of * all nodes except BRANCH implement concatenation; a "next" pointer with * a BRANCH on both ends of it is connecting two alternatives. (Here we * have one of the subtle syntax dependencies: an individual BRANCH (as * opposed to a collection of them) is never concatenated with anything * because of operator precedence.) The operand of some types of node is * a literal string; for others, it is a node leading into a sub-FSM. In * particular, the operand of a BRANCH node is the first node of the branch. * (NB this is *not* a tree structure: the tail of the branch connects * to the thing following the set of BRANCHes.) The opcodes are: */ /* definition number opnd? meaning */ #define END 0 /* no End of program. */ #define BOL 1 /* no Match "" at beginning of line. */ #define EOL 2 /* no Match "" at end of line. */ #define ANY 3 /* no Match any one character. */ #define ANYOF 4 /* str Match any character in this string. */ #define ANYBUT 5 /* str Match any character not in this string. */ #define BRANCH 6 /* node Match this alternative, or the next... */ #define BACK 7 /* no Match "", "next" ptr points backward. */ #define EXACTLY 8 /* str Match this string. */ #define NOTHING 9 /* no Match empty string. */ #define STAR 10 /* node Match this (simple) thing 0 or more times. */ #define PLUS 11 /* node Match this (simple) thing 1 or more times. */ #define OPEN 20 /* no Mark this point in input as start of #n. */ /* OPEN+1 is number 1, etc. */ #define CLOSE (OPEN+NSUBEXP) /* no Analogous to OPEN. */ /* * Opcode notes: * * BRANCH The set of branches constituting a single choice are hooked * together with their "next" pointers, since precedence prevents * anything being concatenated to any individual branch. The * "next" pointer of the last BRANCH in a choice points to the * thing following the whole choice. This is also where the * final "next" pointer of each individual branch points; each * branch starts with the operand node of a BRANCH node. * * BACK Normal "next" pointers all implicitly point forward; BACK * exists to make loop structures possible. * * STAR,PLUS '?', and complex '*' and '+', are implemented as circular * BRANCH structures using BACK. Simple cases (one character * per match) are implemented with STAR and PLUS for speed * and to minimize recursive plunges. * * OPEN,CLOSE ...are numbered at compile time. */ /* * A node is one char of opcode followed by two chars of "next" pointer. * "Next" pointers are stored as two 8-bit pieces, high order first. The * value is a positive offset from the opcode of the node containing it. * An operand, if any, simply follows the node. (Note that much of the * code generation knows about this implicit relationship.) * * Using two bytes for the "next" pointer is vast overkill for most things, * but allows patterns to get big without disasters. */ #define OP(p) (*(p)) #define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) #define OPERAND(p) ((p) + 3) /* * See regmagic.h for one further detail of program structure. */ /* * Utility definitions. */ #ifndef CHARBITS #define UCHARAT(p) ((int)*(unsigned char *)(p)) #else #define UCHARAT(p) ((int)*(p)&CHARBITS) #endif #define FAIL(m) { TclRegError(m); return(NULL); } #define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') #define META "^$.[()|?+*\\" /* * Flags to be passed up and down. */ #define HASWIDTH 01 /* Known never to match null string. */ #define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */ #define SPSTART 04 /* Starts with * or +. */ #define WORST 0 /* Worst case. */ /* * Global work variables for TclRegComp(). */ struct regcomp_state { char *regparse; /* Input-scan pointer. */ int regnpar; /* () count. */ char *regcode; /* Code-emit pointer; ®dummy = don't. */ long regsize; /* Code size. */ }; static char regdummy; /* * The first byte of the regexp internal "program" is actually this magic * number; the start node begins in the second byte. */ #define MAGIC 0234 /* * Forward declarations for TclRegComp()'s friends. */ static char * reg _ANSI_ARGS_((int paren, int *flagp, struct regcomp_state *rcstate)); static char * regatom _ANSI_ARGS_((int *flagp, struct regcomp_state *rcstate)); static char * regbranch _ANSI_ARGS_((int *flagp, struct regcomp_state *rcstate)); static void regc _ANSI_ARGS_((int b, struct regcomp_state *rcstate)); static void reginsert _ANSI_ARGS_((int op, char *opnd, struct regcomp_state *rcstate)); static char * regnext _ANSI_ARGS_((char *p)); static char * regnode _ANSI_ARGS_((int op, struct regcomp_state *rcstate)); static void regoptail _ANSI_ARGS_((char *p, char *val)); static char * regpiece _ANSI_ARGS_((int *flagp, struct regcomp_state *rcstate)); static void regtail _ANSI_ARGS_((char *p, char *val)); #ifdef STRCSPN static int strcspn _ANSI_ARGS_((char *s1, char *s2)); #endif /* - TclRegComp - compile a regular expression into internal code * * We can't allocate space until we know how big the compiled form will be, * but we can't compile it (and thus know how big it is) until we've got a * place to put the code. So we cheat: we compile it twice, once with code * generation turned off and size counting turned on, and once "for real". * This also means that we don't allocate space until we are sure that the * thing really will compile successfully, and we never have to move the * code and thus invalidate pointers into it. (Note that it has to be in * one piece because free() must be able to free it all.) * * Beware that the optimization-preparation code in here knows about some * of the structure of the compiled regexp. */ regexp * TclRegComp(exp) char *exp; { register regexp *r; register char *scan; register char *longest; register int len; int flags; struct regcomp_state state; struct regcomp_state *rcstate= &state; if (exp == NULL) FAIL("NULL argument"); /* First pass: determine size, legality. */ rcstate->regparse = exp; rcstate->regnpar = 1; rcstate->regsize = 0L; rcstate->regcode = ®dummy; regc(MAGIC, rcstate); if (reg(0, &flags, rcstate) == NULL) return(NULL); /* Small enough for pointer-storage convention? */ if (rcstate->regsize >= 32767L) /* Probably could be 65535L. */ FAIL("regexp too big"); /* Allocate space. */ r = (regexp *)ckalloc(sizeof(regexp) + (unsigned)rcstate->regsize); if (r == NULL) FAIL("out of space"); /* Second pass: emit code. */ rcstate->regparse = exp; rcstate->regnpar = 1; rcstate->regcode = r->program; regc(MAGIC, rcstate); if (reg(0, &flags, rcstate) == NULL) { ckfree ((char*) r); return(NULL); } /* Dig out information for optimizations. */ r->regstart = '\0'; /* Worst-case defaults. */ r->reganch = 0; r->regmust = NULL; r->regmlen = 0; scan = r->program+1; /* First BRANCH. */ if (OP(regnext(scan)) == END) { /* Only one top-level choice. */ scan = OPERAND(scan); /* Starting-point info. */ if (OP(scan) == EXACTLY) r->regstart = *OPERAND(scan); else if (OP(scan) == BOL) r->reganch++; /* * If there's something expensive in the r.e., find the * longest literal string that must appear and make it the * regmust. Resolve ties in favor of later strings, since * the regstart check works with the beginning of the r.e. * and avoiding duplication strengthens checking. Not a * strong reason, but sufficient in the absence of others. */ if (flags&SPSTART) { longest = NULL; len = 0; for (; scan != NULL; scan = regnext(scan)) if (OP(scan) == EXACTLY && ((int) strlen(OPERAND(scan))) >= len) { longest = OPERAND(scan); len = strlen(OPERAND(scan)); } r->regmust = longest; r->regmlen = len; } } return(r); } /* - reg - regular expression, i.e. main body or parenthesized thing * * Caller must absorb opening parenthesis. * * Combining parenthesis handling with the base level of regular expression * is a trifle forced, but the need to tie the tails of the branches to what * follows makes it hard to avoid. */ static char * reg(paren, flagp, rcstate) int paren; /* Parenthesized? */ int *flagp; struct regcomp_state *rcstate; { register char *ret; register char *br; register char *ender; register int parno = 0; int flags; *flagp = HASWIDTH; /* Tentatively. */ /* Make an OPEN node, if parenthesized. */ if (paren) { if (rcstate->regnpar >= NSUBEXP) FAIL("too many ()"); parno = rcstate->regnpar; rcstate->regnpar++; ret = regnode(OPEN+parno,rcstate); } else ret = NULL; /* Pick up the branches, linking them together. */ br = regbranch(&flags,rcstate); if (br == NULL) return(NULL); if (ret != NULL) regtail(ret, br); /* OPEN -> first. */ else ret = br; if (!(flags&HASWIDTH)) *flagp &= ~HASWIDTH; *flagp |= flags&SPSTART; while (*rcstate->regparse == '|') { rcstate->regparse++; br = regbranch(&flags,rcstate); if (br == NULL) return(NULL); regtail(ret, br); /* BRANCH -> BRANCH. */ if (!(flags&HASWIDTH)) *flagp &= ~HASWIDTH; *flagp |= flags&SPSTART; } /* Make a closing node, and hook it on the end. */ ender = regnode((paren) ? CLOSE+parno : END,rcstate); regtail(ret, ender); /* Hook the tails of the branches to the closing node. */ for (br = ret; br != NULL; br = regnext(br)) regoptail(br, ender); /* Check for proper termination. */ if (paren && *rcstate->regparse++ != ')') { FAIL("unmatched ()"); } else if (!paren && *rcstate->regparse != '\0') { if (*rcstate->regparse == ')') { FAIL("unmatched ()"); } else FAIL("junk on end"); /* "Can't happen". */ /* NOTREACHED */ } return(ret); } /* - regbranch - one alternative of an | operator * * Implements the concatenation operator. */ static char * regbranch(flagp, rcstate) int *flagp; struct regcomp_state *rcstate; { register char *ret; register char *chain; register char *latest; int flags; *flagp = WORST; /* Tentatively. */ ret = regnode(BRANCH,rcstate); chain = NULL; while (*rcstate->regparse != '\0' && *rcstate->regparse != '|' && *rcstate->regparse != ')') { latest = regpiece(&flags, rcstate); if (latest == NULL) return(NULL); *flagp |= flags&HASWIDTH; if (chain == NULL) /* First piece. */ *flagp |= flags&SPSTART; else regtail(chain, latest); chain = latest; } if (chain == NULL) /* Loop ran zero times. */ (void) regnode(NOTHING,rcstate); return(ret); } /* - regpiece - something followed by possible [*+?] * * Note that the branching code sequences used for ? and the general cases * of * and + are somewhat optimized: they use the same NOTHING node as * both the endmarker for their branch list and the body of the last branch. * It might seem that this node could be dispensed with entirely, but the * endmarker role is not redundant. */ static char * regpiece(flagp, rcstate) int *flagp; struct regcomp_state *rcstate; { register char *ret; register char op; register char *next; int flags; ret = regatom(&flags,rcstate); if (ret == NULL) return(NULL); op = *rcstate->regparse; if (!ISMULT(op)) { *flagp = flags; return(ret); } if (!(flags&HASWIDTH) && op != '?') FAIL("*+ operand could be empty"); *flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH); if (op == '*' && (flags&SIMPLE)) reginsert(STAR, ret, rcstate); else if (op == '*') { /* Emit x* as (x&|), where & means "self". */ reginsert(BRANCH, ret, rcstate); /* Either x */ regoptail(ret, regnode(BACK,rcstate)); /* and loop */ regoptail(ret, ret); /* back */ regtail(ret, regnode(BRANCH,rcstate)); /* or */ regtail(ret, regnode(NOTHING,rcstate)); /* null. */ } else if (op == '+' && (flags&SIMPLE)) reginsert(PLUS, ret, rcstate); else if (op == '+') { /* Emit x+ as x(&|), where & means "self". */ next = regnode(BRANCH,rcstate); /* Either */ regtail(ret, next); regtail(regnode(BACK,rcstate), ret); /* loop back */ regtail(next, regnode(BRANCH,rcstate)); /* or */ regtail(ret, regnode(NOTHING,rcstate)); /* null. */ } else if (op == '?') { /* Emit x? as (x|) */ reginsert(BRANCH, ret, rcstate); /* Either x */ regtail(ret, regnode(BRANCH,rcstate)); /* or */ next = regnode(NOTHING,rcstate); /* null. */ regtail(ret, next); regoptail(ret, next); } rcstate->regparse++; if (ISMULT(*rcstate->regparse)) FAIL("nested *?+"); return(ret); } /* - regatom - the lowest level * * Optimization: gobbles an entire sequence of ordinary characters so that * it can turn them into a single node, which is smaller to store and * faster to run. Backslashed characters are exceptions, each becoming a * separate node; the code is simpler that way and it's not worth fixing. */ static char * regatom(flagp, rcstate) int *flagp; struct regcomp_state *rcstate; { register char *ret; int flags; *flagp = WORST; /* Tentatively. */ switch (*rcstate->regparse++) { case '^': ret = regnode(BOL,rcstate); break; case '$': ret = regnode(EOL,rcstate); break; case '.': ret = regnode(ANY,rcstate); *flagp |= HASWIDTH|SIMPLE; break; case '[': { register int clss; register int classend; if (*rcstate->regparse == '^') { /* Complement of range. */ ret = regnode(ANYBUT,rcstate); rcstate->regparse++; } else ret = regnode(ANYOF,rcstate); if (*rcstate->regparse == ']' || *rcstate->regparse == '-') regc(*rcstate->regparse++,rcstate); while (*rcstate->regparse != '\0' && *rcstate->regparse != ']') { if (*rcstate->regparse == '-') { rcstate->regparse++; if (*rcstate->regparse == ']' || *rcstate->regparse == '\0') regc('-',rcstate); else { clss = UCHARAT(rcstate->regparse-2)+1; classend = UCHARAT(rcstate->regparse); if (clss > classend+1) FAIL("invalid [] range"); for (; clss <= classend; clss++) regc((char)clss,rcstate); rcstate->regparse++; } } else regc(*rcstate->regparse++,rcstate); } regc('\0',rcstate); if (*rcstate->regparse != ']') FAIL("unmatched []"); rcstate->regparse++; *flagp |= HASWIDTH|SIMPLE; } break; case '(': ret = reg(1, &flags, rcstate); if (ret == NULL) return(NULL); *flagp |= flags&(HASWIDTH|SPSTART); break; case '\0': case '|': case ')': FAIL("internal urp"); /* Supposed to be caught earlier. */ /* NOTREACHED */ case '?': case '+': case '*': FAIL("?+* follows nothing"); /* NOTREACHED */ case '\\': if (*rcstate->regparse == '\0') FAIL("trailing \\"); ret = regnode(EXACTLY,rcstate); regc(*rcstate->regparse++,rcstate); regc('\0',rcstate); *flagp |= HASWIDTH|SIMPLE; break; default: { register int len; register char ender; rcstate->regparse--; len = strcspn(rcstate->regparse, META); if (len <= 0) FAIL("internal disaster"); ender = *(rcstate->regparse+len); if (len > 1 && ISMULT(ender)) len--; /* Back off clear of ?+* operand. */ *flagp |= HASWIDTH; if (len == 1) *flagp |= SIMPLE; ret = regnode(EXACTLY,rcstate); while (len > 0) { regc(*rcstate->regparse++,rcstate); len--; } regc('\0',rcstate); } break; } return(ret); } /* - regnode - emit a node */ static char * /* Location. */ regnode(op, rcstate) int op; struct regcomp_state *rcstate; { register char *ret; register char *ptr; ret = rcstate->regcode; if (ret == ®dummy) { rcstate->regsize += 3; return(ret); } ptr = ret; *ptr++ = (char)op; *ptr++ = '\0'; /* Null "next" pointer. */ *ptr++ = '\0'; rcstate->regcode = ptr; return(ret); } /* - regc - emit (if appropriate) a byte of code */ static void regc(b, rcstate) int b; struct regcomp_state *rcstate; { if (rcstate->regcode != ®dummy) *rcstate->regcode++ = (char)b; else rcstate->regsize++; } /* - reginsert - insert an operator in front of already-emitted operand * * Means relocating the operand. */ static void reginsert(op, opnd, rcstate) int op; char *opnd; struct regcomp_state *rcstate; { register char *src; register char *dst; register char *place; if (rcstate->regcode == ®dummy) { rcstate->regsize += 3; return; } src = rcstate->regcode; rcstate->regcode += 3; dst = rcstate->regcode; while (src > opnd) *--dst = *--src; place = opnd; /* Op node, where operand used to be. */ *place++ = (char)op; *place++ = '\0'; *place = '\0'; } /* - regtail - set the next-pointer at the end of a node chain */ static void regtail(p, val) char *p; char *val; { register char *scan; register char *temp; register int offset; if (p == ®dummy) return; /* Find last node. */ scan = p; for (;;) { temp = regnext(scan); if (temp == NULL) break; scan = temp; } if (OP(scan) == BACK) offset = scan - val; else offset = val - scan; *(scan+1) = (char)((offset>>8)&0377); *(scan+2) = (char)(offset&0377); } /* - regoptail - regtail on operand of first argument; nop if operandless */ static void regoptail(p, val) char *p; char *val; { /* "Operandless" and "op != BRANCH" are synonymous in practice. */ if (p == NULL || p == ®dummy || OP(p) != BRANCH) return; regtail(OPERAND(p), val); } /* * TclRegExec and friends */ /* * Global work variables for TclRegExec(). */ struct regexec_state { char *reginput; /* String-input pointer. */ char *regbol; /* Beginning of input, for ^ check. */ char **regstartp; /* Pointer to startp array. */ char **regendp; /* Ditto for endp. */ }; /* * Forwards. */ static int regtry _ANSI_ARGS_((regexp *prog, char *string, struct regexec_state *restate)); static int regmatch _ANSI_ARGS_((char *prog, struct regexec_state *restate)); static int regrepeat _ANSI_ARGS_((char *p, struct regexec_state *restate)); #ifdef DEBUG int regnarrate = 0; void regdump _ANSI_ARGS_((regexp *r)); static char *regprop _ANSI_ARGS_((char *op)); #endif /* - TclRegExec - match a regexp against a string */ int TclRegExec(prog, string, start) register regexp *prog; register char *string; char *start; { register char *s; struct regexec_state state; struct regexec_state *restate= &state; /* Be paranoid... */ if (prog == NULL || string == NULL) { TclRegError("NULL parameter"); return(0); } /* Check validity of program. */ if (UCHARAT(prog->program) != MAGIC) { TclRegError("corrupted program"); return(0); } /* If there is a "must appear" string, look for it. */ if (prog->regmust != NULL) { s = string; while ((s = strchr(s, prog->regmust[0])) != NULL) { if (strncmp(s, prog->regmust, (size_t) prog->regmlen) == 0) break; /* Found it. */ s++; } if (s == NULL) /* Not present. */ return(0); } /* Mark beginning of line for ^ . */ restate->regbol = start; /* Simplest case: anchored match need be tried only once. */ if (prog->reganch) return(regtry(prog, string, restate)); /* Messy cases: unanchored match. */ s = string; if (prog->regstart != '\0') /* We know what char it must start with. */ while ((s = strchr(s, prog->regstart)) != NULL) { if (regtry(prog, s, restate)) return(1); s++; } else /* We don't -- general case. */ do { if (regtry(prog, s, restate)) return(1); } while (*s++ != '\0'); /* Failure. */ return(0); } /* - regtry - try match at specific point */ static int /* 0 failure, 1 success */ regtry(prog, string, restate) regexp *prog; char *string; struct regexec_state *restate; { register int i; register char **sp; register char **ep; restate->reginput = string; restate->regstartp = prog->startp; restate->regendp = prog->endp; sp = prog->startp; ep = prog->endp; for (i = NSUBEXP; i > 0; i--) { *sp++ = NULL; *ep++ = NULL; } if (regmatch(prog->program + 1,restate)) { prog->startp[0] = string; prog->endp[0] = restate->reginput; return(1); } else return(0); } /* - regmatch - main matching routine * * Conceptually the strategy is simple: check to see whether the current * node matches, call self recursively to see whether the rest matches, * and then act accordingly. In practice we make some effort to avoid * recursion, in particular by going through "ordinary" nodes (that don't * need to know whether the rest of the match failed) by a loop instead of * by recursion. */ static int /* 0 failure, 1 success */ regmatch(prog, restate) char *prog; struct regexec_state *restate; { register char *scan; /* Current node. */ char *next; /* Next node. */ scan = prog; #ifdef DEBUG if (scan != NULL && regnarrate) fprintf(stderr, "%s(\n", regprop(scan)); #endif while (scan != NULL) { #ifdef DEBUG if (regnarrate) fprintf(stderr, "%s...\n", regprop(scan)); #endif next = regnext(scan); switch (OP(scan)) { case BOL: if (restate->reginput != restate->regbol) { return 0; } break; case EOL: if (*restate->reginput != '\0') { return 0; } break; case ANY: if (*restate->reginput == '\0') { return 0; } restate->reginput++; break; case EXACTLY: { register int len; register char *opnd; opnd = OPERAND(scan); /* Inline the first character, for speed. */ if (*opnd != *restate->reginput) { return 0 ; } len = strlen(opnd); if (len > 1 && strncmp(opnd, restate->reginput, (size_t) len) != 0) { return 0; } restate->reginput += len; break; } case ANYOF: if (*restate->reginput == '\0' || strchr(OPERAND(scan), *restate->reginput) == NULL) { return 0; } restate->reginput++; break; case ANYBUT: if (*restate->reginput == '\0' || strchr(OPERAND(scan), *restate->reginput) != NULL) { return 0; } restate->reginput++; break; case NOTHING: break; case BACK: break; case OPEN+1: case OPEN+2: case OPEN+3: case OPEN+4: case OPEN+5: case OPEN+6: case OPEN+7: case OPEN+8: case OPEN+9: { register int no; register char *save; doOpen: no = OP(scan) - OPEN; save = restate->reginput; if (regmatch(next,restate)) { /* * Don't set startp if some later invocation of the * same parentheses already has. */ if (restate->regstartp[no] == NULL) { restate->regstartp[no] = save; } return 1; } else { return 0; } } case CLOSE+1: case CLOSE+2: case CLOSE+3: case CLOSE+4: case CLOSE+5: case CLOSE+6: case CLOSE+7: case CLOSE+8: case CLOSE+9: { register int no; register char *save; doClose: no = OP(scan) - CLOSE; save = restate->reginput; if (regmatch(next,restate)) { /* * Don't set endp if some later * invocation of the same parentheses * already has. */ if (restate->regendp[no] == NULL) restate->regendp[no] = save; return 1; } else { return 0; } } case BRANCH: { register char *save; if (OP(next) != BRANCH) { /* No choice. */ next = OPERAND(scan); /* Avoid recursion. */ } else { do { save = restate->reginput; if (regmatch(OPERAND(scan),restate)) return(1); restate->reginput = save; scan = regnext(scan); } while (scan != NULL && OP(scan) == BRANCH); return 0; } break; } case STAR: case PLUS: { register char nextch; register int no; register char *save; register int min; /* * Lookahead to avoid useless match attempts * when we know what character comes next. */ nextch = '\0'; if (OP(next) == EXACTLY) nextch = *OPERAND(next); min = (OP(scan) == STAR) ? 0 : 1; save = restate->reginput; no = regrepeat(OPERAND(scan),restate); while (no >= min) { /* If it could work, try it. */ if (nextch == '\0' || *restate->reginput == nextch) if (regmatch(next,restate)) return(1); /* Couldn't or didn't -- back up. */ no--; restate->reginput = save + no; } return(0); } case END: return(1); /* Success! */ default: if (OP(scan) > OPEN && OP(scan) < OPEN+NSUBEXP) { goto doOpen; } else if (OP(scan) > CLOSE && OP(scan) < CLOSE+NSUBEXP) { goto doClose; } TclRegError("memory corruption"); return 0; } scan = next; } /* * We get here only if there's trouble -- normally "case END" is * the terminating point. */ TclRegError("corrupted pointers"); return(0); } /* - regrepeat - repeatedly match something simple, report how many */ static int regrepeat(p, restate) char *p; struct regexec_state *restate; { register int count = 0; register char *scan; register char *opnd; scan = restate->reginput; opnd = OPERAND(p); switch (OP(p)) { case ANY: count = strlen(scan); scan += count; break; case EXACTLY: while (*opnd == *scan) { count++; scan++; } break; case ANYOF: while (*scan != '\0' && strchr(opnd, *scan) != NULL) { count++; scan++; } break; case ANYBUT: while (*scan != '\0' && strchr(opnd, *scan) == NULL) { count++; scan++; } break; default: /* Oh dear. Called inappropriately. */ TclRegError("internal foulup"); count = 0; /* Best compromise. */ break; } restate->reginput = scan; return(count); } /* - regnext - dig the "next" pointer out of a node */ static char * regnext(p) register char *p; { register int offset; if (p == ®dummy) return(NULL); offset = NEXT(p); if (offset == 0) return(NULL); if (OP(p) == BACK) return(p-offset); else return(p+offset); } #ifdef DEBUG static char *regprop(); /* - regdump - dump a regexp onto stdout in vaguely comprehensible form */ void regdump(r) regexp *r; { register char *s; register char op = EXACTLY; /* Arbitrary non-END op. */ register char *next; s = r->program + 1; while (op != END) { /* While that wasn't END last time... */ op = OP(s); printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */ next = regnext(s); if (next == NULL) /* Next ptr. */ printf("(0)"); else printf("(%d)", (s-r->program)+(next-s)); s += 3; if (op == ANYOF || op == ANYBUT || op == EXACTLY) { /* Literal string, where present. */ while (*s != '\0') { putchar(*s); s++; } s++; } putchar('\n'); } /* Header fields of interest. */ if (r->regstart != '\0') printf("start `%c' ", r->regstart); if (r->reganch) printf("anchored "); if (r->regmust != NULL) printf("must have \"%s\"", r->regmust); printf("\n"); } /* - regprop - printable representation of opcode */ static char * regprop(op) char *op; { register char *p; static char buf[50]; (void) strcpy(buf, ":"); switch (OP(op)) { case BOL: p = "BOL"; break; case EOL: p = "EOL"; break; case ANY: p = "ANY"; break; case ANYOF: p = "ANYOF"; break; case ANYBUT: p = "ANYBUT"; break; case BRANCH: p = "BRANCH"; break; case EXACTLY: p = "EXACTLY"; break; case NOTHING: p = "NOTHING"; break; case BACK: p = "BACK"; break; case END: p = "END"; break; case OPEN+1: case OPEN+2: case OPEN+3: case OPEN+4: case OPEN+5: case OPEN+6: case OPEN+7: case OPEN+8: case OPEN+9: sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN); p = NULL; break; case CLOSE+1: case CLOSE+2: case CLOSE+3: case CLOSE+4: case CLOSE+5: case CLOSE+6: case CLOSE+7: case CLOSE+8: case CLOSE+9: sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE); p = NULL; break; case STAR: p = "STAR"; break; case PLUS: p = "PLUS"; break; default: if (OP(op) > OPEN && OP(op) < OPEN+NSUBEXP) { sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN); p = NULL; break; } else if (OP(op) > CLOSE && OP(op) < CLOSE+NSUBEXP) { sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE); p = NULL; } else { TclRegError("corrupted opcode"); } break; } if (p != NULL) (void) strcat(buf, p); return(buf); } #endif /* * The following is provided for those people who do not have strcspn() in * their C libraries. They should get off their butts and do something * about it; at least one public-domain implementation of those (highly * useful) string routines has been published on Usenet. */ #ifdef STRCSPN /* * strcspn - find length of initial segment of s1 consisting entirely * of characters not from s2 */ static int strcspn(s1, s2) char *s1; char *s2; { register char *scan1; register char *scan2; register int count; count = 0; for (scan1 = s1; *scan1 != '\0'; scan1++) { for (scan2 = s2; *scan2 != '\0';) /* ++ moved down. */ if (*scan1 == *scan2++) return(count); count++; } return(count); } #endif /* *---------------------------------------------------------------------- * * TclRegError -- * * This procedure is invoked by the regexp code when an error * occurs. It saves the error message so it can be seen by the * code that called Spencer's code. * * Results: * None. * * Side effects: * The value of "string" is saved in "errMsg". * *---------------------------------------------------------------------- */ void exp_TclRegError(string) char *string; /* Error message. */ { errMsg = string; } char * TclGetRegError() { return errMsg; } /* * end of regexp definitions and code */ /* * stolen from exp_log.c - this function is called from the Expect library * but the one that the library supplies calls Tcl functions. So we supply * our own. */ static void expDiagLogU(str) char *str; { if (exp_is_debugging) { fprintf(stderr,str); if (exp_logfile) fprintf(exp_logfile,str); } } /* * expect-specific definitions and code */ #include "expect.h" #include "exp_int.h" /* exp_glob.c - expect functions for doing glob * * Based on Tcl's glob functions but modified to support anchors and to * return information about the possibility of future matches * * Modifications by: Don Libes, NIST, 2/6/90 */ /* The following functions implement expect's glob-style string * matching Exp_StringMatch allow's implements the unanchored front * (or conversely the '^') feature. Exp_StringMatch2 does the rest of * the work. */ /* Exp_StringMatch2 -- * * Like Tcl_StringMatch except that * 1) returns number of characters matched, -1 if failed. * (Can return 0 on patterns like "" or "$") * 2) does not require pattern to match to end of string * 3) much of code is stolen from Tcl_StringMatch * 4) front-anchor is assumed (Tcl_StringMatch retries for non-front-anchor) */ static int Exp_StringMatch2(string,pattern) register char *string; /* String. */ register char *pattern; /* Pattern, which may contain * special characters. */ { char c2; int match = 0; /* # of chars matched */ while (1) { /* If at end of pattern, success! */ if (*pattern == 0) { return match; } /* If last pattern character is '$', verify that entire * string has been matched. */ if ((*pattern == '$') && (pattern[1] == 0)) { if (*string == 0) return(match); else return(-1); } /* Check for a "*" as the next pattern character. It matches * any substring. We handle this by calling ourselves * recursively for each postfix of string, until either we * match or we reach the end of the string. */ if (*pattern == '*') { int head_len; char *tail; pattern += 1; if (*pattern == 0) { return(strlen(string)+match); /* DEL */ } /* find longest match - switched to this on 12/31/93 */ head_len = strlen(string); /* length before tail */ tail = string + head_len; while (head_len >= 0) { int rc; if (-1 != (rc = Exp_StringMatch2(tail, pattern))) { return rc + match + head_len; /* DEL */ } tail--; head_len--; } return -1; /* DEL */ } /* * after this point, all patterns must match at least one * character, so check this */ if (*string == 0) return -1; /* Check for a "?" as the next pattern character. It matches * any single character. */ if (*pattern == '?') { goto thisCharOK; } /* Check for a "[" as the next pattern character. It is followed * by a list of characters that are acceptable, or by a range * (two characters separated by "-"). */ if (*pattern == '[') { pattern += 1; while (1) { if ((*pattern == ']') || (*pattern == 0)) { return -1; /* was 0; DEL */ } if (*pattern == *string) { break; } if (pattern[1] == '-') { c2 = pattern[2]; if (c2 == 0) { return -1; /* DEL */ } if ((*pattern <= *string) && (c2 >= *string)) { break; } if ((*pattern >= *string) && (c2 <= *string)) { break; } pattern += 2; } pattern += 1; } while (*pattern != ']') { if (*pattern == 0) { pattern--; break; } pattern += 1; } goto thisCharOK; } /* If the next pattern character is backslash, strip it off * so we do exact matching on the character that follows. */ if (*pattern == '\\') { pattern += 1; if (*pattern == 0) { return -1; } } /* There's no special character. Just make sure that the next * characters of each string match. */ if (*pattern != *string) { return -1; } thisCharOK: pattern += 1; string += 1; match++; } } static int /* returns # of chars that matched */ Exp_StringMatch(string, pattern,offset) char *string; char *pattern; int *offset; /* offset from beginning of string where pattern matches */ { char *s; int sm; /* count of chars matched or -1 */ int caret = FALSE; int star = FALSE; *offset = 0; if (pattern[0] == '^') { caret = TRUE; pattern++; } else if (pattern[0] == '*') { star = TRUE; } /* * test if pattern matches in initial position. * This handles front-anchor and 1st iteration of non-front-anchor. * Note that 1st iteration must be tried even if string is empty. */ sm = Exp_StringMatch2(string,pattern); if (sm >= 0) return(sm); if (caret) return -1; if (star) return -1; if (*string == '\0') return -1; for (s = string+1;*s;s++) { sm = Exp_StringMatch2(s,pattern); if (sm != -1) { *offset = s-string; return(sm); } } return -1; } #define EXP_MATCH_MAX 2000 /* public */ char *exp_buffer = 0; char *exp_buffer_end = 0; char *exp_match = 0; char *exp_match_end = 0; int exp_match_max = EXP_MATCH_MAX; /* bytes */ int exp_full_buffer = FALSE; /* don't return on full buffer */ int exp_remove_nulls = TRUE; int exp_timeout = 10; /* seconds */ int exp_pty_timeout = 5; /* seconds - see CRAY below */ int exp_autoallocpty = TRUE; /* if TRUE, we do allocation */ int exp_pty[2]; /* master is [0], slave is [1] */ int exp_pid; char *exp_stty_init = 0; /* initial stty args */ int exp_ttycopy = TRUE; /* copy tty parms from /dev/tty */ int exp_ttyinit = TRUE; /* set tty parms to sane state */ int exp_console = FALSE; /* redirect console */ void (*exp_child_exec_prelude)() = 0; void (*exp_close_in_child)() = 0; #ifdef HAVE_SIGLONGJMP sigjmp_buf exp_readenv; /* for interruptable read() */ #else jmp_buf exp_readenv; /* for interruptable read() */ #endif /* HAVE_SIGLONGJMP */ int exp_reading = FALSE; /* whether we can longjmp or not */ int exp_is_debugging = FALSE; FILE *exp_debugfile = 0; FILE *exp_logfile = 0; int exp_logfile_all = FALSE; /* if TRUE, write log of all interactions */ int exp_loguser = TRUE; /* if TRUE, user sees interactions on stdout */ char *exp_printify(); int exp_getptymaster(); int exp_getptyslave(); #define sysreturn(x) return(errno = x, -1) void exp_init_pty(); /* The following functions are linked from the Tcl library. They don't cause anything else in the library to be dragged in, so it shouldn't cause any problems (e.g., bloat). The functions are relatively small but painful enough that I don't care to recode them. You may, if you absolutely want to get rid of any vestiges of Tcl. */ static unsigned int bufsiz = 2*EXP_MATCH_MAX; static struct f { int valid; char *buffer; /* buffer of matchable chars */ char *buffer_end; /* one beyond end of matchable chars */ char *match_end; /* one beyond end of matched string */ int msize; /* size of allocate space */ /* actual size is one larger for null */ } *fs = 0; static int fd_alloc_max = -1; /* max fd allocated */ /* translate fd or fp to fd */ static struct f * fdfp2f(fd,fp) int fd; FILE *fp; { if (fd == -1) return(fs + fileno(fp)); else return(fs + fd); } static struct f * fd_new(fd) int fd; { int i, low; struct f *fp; struct f *newfs; /* temporary, so we don't lose old fs */ if (fd > fd_alloc_max) { if (!fs) { /* no fd's yet allocated */ newfs = (struct f *)malloc(sizeof(struct f)*(fd+1)); low = 0; } else { /* enlarge fd table */ newfs = (struct f *)realloc((char *)fs,sizeof(struct f)*(fd+1)); low = fd_alloc_max+1; } fs = newfs; fd_alloc_max = fd; for (i = low; i <= fd_alloc_max; i++) { /* init new entries */ fs[i].valid = FALSE; } } fp = fs+fd; if (!fp->valid) { /* initialize */ fp->buffer = malloc((unsigned)(bufsiz+1)); if (!fp->buffer) return 0; fp->msize = bufsiz; fp->valid = TRUE; } fp->buffer_end = fp->buffer; fp->match_end = fp->buffer; return fp; } static void exp_setpgrp() { #ifdef MIPS_BSD /* required on BSD side of MIPS OS */ # include syscall(SYS_setpgrp); #endif #ifdef SETPGRP_VOID (void) setpgrp(); #else (void) setpgrp(0,0); #endif } /* returns fd of master side of pty */ int exp_spawnv(file,argv) char *file; char *argv[]; /* some compiler complains about **argv? */ { int cc; int errorfd; /* place to stash fileno(stderr) in child */ /* while we're setting up new stderr */ int ttyfd; int sync_fds[2]; int sync2_fds[2]; int status_pipe[2]; int child_errno; char sync_byte; #ifdef PTYTRAP_DIES int slave_write_ioctls = 1; /* by default, slave will be write-ioctled this many times */ #endif static int first_time = TRUE; if (first_time) { first_time = FALSE; exp_init_pty(); exp_init_tty(); expDiagLogPtrSet(expDiagLogU); /* * TIP 27; It is unclear why this code produces a * warning. The equivalent code in exp_main_sub.c * (line 512) does not generate a warning ! */ expErrnoMsgSet(Tcl_ErrnoMsg); } if (!file || !argv) sysreturn(EINVAL); if (!argv[0] || strcmp(file,argv[0])) { exp_debuglog("expect: warning: file (%s) != argv[0] (%s)\n", file, argv[0]?argv[0]:""); } #ifdef PTYTRAP_DIES /* any extraneous ioctl's that occur in slave must be accounted for when trapping, see below in child half of fork */ #if defined(TIOCSCTTY) && !defined(CIBAUD) && !defined(sun) && !defined(hp9000s300) slave_write_ioctls++; #endif #endif /*PTYTRAP_DIES*/ if (exp_autoallocpty) { if (0 > (exp_pty[0] = exp_getptymaster())) sysreturn(ENODEV); } fcntl(exp_pty[0],F_SETFD,1); /* close on exec */ #ifdef PTYTRAP_DIES exp_slave_control(exp_pty[0],1);*/ #endif if (!fd_new(exp_pty[0])) { errno = ENOMEM; return -1; } if (-1 == (pipe(sync_fds))) { return -1; } if (-1 == (pipe(sync2_fds))) { close(sync_fds[0]); close(sync_fds[1]); return -1; } if (-1 == pipe(status_pipe)) { close(sync_fds[0]); close(sync_fds[1]); close(sync2_fds[0]); close(sync2_fds[1]); return -1; } if ((exp_pid = fork()) == -1) return(-1); if (exp_pid) { /* parent */ close(sync_fds[1]); close(sync2_fds[0]); close(status_pipe[1]); if (!exp_autoallocpty) close(exp_pty[1]); #ifdef PTYTRAP_DIES #ifdef HAVE_PTYTRAP if (exp_autoallocpty) { /* trap initial ioctls in a feeble attempt to not */ /* block the initially. If the process itself */ /* ioctls /dev/tty, such blocks will be trapped */ /* later during normal event processing */ while (slave_write_ioctls) { int cc; cc = exp_wait_for_slave_open(exp_pty[0]); #if defined(TIOCSCTTY) && !defined(CIBAUD) && !defined(sun) && !defined(hp9000s300) if (cc == TIOCSCTTY) slave_write_ioctls = 0; #endif if (cc & IOC_IN) slave_write_ioctls--; else if (cc == -1) { printf("failed to trap slave pty"); return -1; } } } #endif #endif /*PTYTRAP_DIES*/ /* * wait for slave to initialize pty before allowing * user to send to it */ exp_debuglog("parent: waiting for sync byte\r\n"); cc = read(sync_fds[0],&sync_byte,1); if (cc == -1) { exp_errorlog("parent sync byte read: %s\r\n",Tcl_ErrnoMsg(errno)); return -1; } /* turn on detection of eof */ exp_slave_control(exp_pty[0],1); /* * tell slave to go on now now that we have initialized pty */ exp_debuglog("parent: telling child to go ahead\r\n"); cc = write(sync2_fds[1]," ",1); if (cc == -1) { exp_errorlog("parent sync byte write: %s\r\n",Tcl_ErrnoMsg(errno)); return -1; } exp_debuglog("parent: now unsynchronized from child\r\n"); close(sync_fds[0]); close(sync2_fds[1]); /* see if child's exec worked */ retry: switch (read(status_pipe[0],&child_errno,sizeof child_errno)) { case -1: if (errno == EINTR) goto retry; /* well it's not really the child's errno */ /* but it can be treated that way */ child_errno = errno; break; case 0: /* child's exec succeeded */ child_errno = 0; break; default: /* child's exec failed; err contains exec's errno */ waitpid(exp_pid, NULL, 0); errno = child_errno; exp_pty[0] = -1; } close(status_pipe[0]); return(exp_pty[0]); } /* * child process - do not return from here! all errors must exit() */ close(sync_fds[0]); close(sync2_fds[1]); close(status_pipe[0]); fcntl(status_pipe[1],F_SETFD,1); /* close on exec */ #ifdef CRAY (void) close(exp_pty[0]); #endif /* ultrix (at least 4.1-2) fails to obtain controlling tty if setsid */ /* is called. setpgrp works though. */ #if defined(POSIX) && !defined(ultrix) #define DO_SETSID #endif #ifdef __convex__ #define DO_SETSID #endif #ifdef DO_SETSID setsid(); #else #ifdef SYSV3 #ifndef CRAY exp_setpgrp(); #endif /* CRAY */ #else /* !SYSV3 */ exp_setpgrp(); #ifdef TIOCNOTTY ttyfd = open("/dev/tty", O_RDWR); if (ttyfd >= 0) { (void) ioctl(ttyfd, TIOCNOTTY, (char *)0); (void) close(ttyfd); } #endif /* TIOCNOTTY */ #endif /* SYSV3 */ #endif /* DO_SETSID */ /* save error fd while we're setting up new one */ errorfd = fcntl(2,F_DUPFD,3); /* and here is the macro to restore it */ #define restore_error_fd {close(2);fcntl(errorfd,F_DUPFD,2);} if (exp_autoallocpty) { close(0); close(1); close(2); /* since we closed fd 0, open of pty slave must return fd 0 */ if (0 > (exp_pty[1] = exp_getptyslave(exp_ttycopy,exp_ttyinit, exp_stty_init))) { restore_error_fd fprintf(stderr,"open(slave pty): %s\n",Tcl_ErrnoMsg(errno)); exit(-1); } /* sanity check */ if (exp_pty[1] != 0) { restore_error_fd fprintf(stderr,"exp_getptyslave: slave = %d but expected 0\n", exp_pty[1]); exit(-1); } } else { if (exp_pty[1] != 0) { close(0); fcntl(exp_pty[1],F_DUPFD,0); } close(1); fcntl(0,F_DUPFD,1); close(2); fcntl(0,F_DUPFD,1); close(exp_pty[1]); } /* The test for hpux may have to be more specific. In particular, the */ /* code should be skipped on the hp9000s300 and hp9000s720 (but there */ /* is no documented define for the 720!) */ #if defined(TIOCSCTTY) && !defined(sun) && !defined(hpux) /* 4.3+BSD way to acquire controlling terminal */ /* according to Stevens - Adv. Prog..., p 642 */ #ifdef __QNX__ /* posix in general */ if (tcsetct(0, getpid()) == -1) { restore_error_fd expErrorLog("failed to get controlling terminal using TIOCSCTTY"); exit(-1); } #else (void) ioctl(0,TIOCSCTTY,(char *)0); /* ignore return value - on some systems, it is defined but it * fails and it doesn't seem to cause any problems. Or maybe * it works but returns a bogus code. Noone seems to be able * to explain this to me. The systems are an assortment of * different linux systems (and FreeBSD 2.5), RedHat 5.2 and * Debian 2.0 */ #endif #endif #ifdef CRAY (void) setsid(); (void) ioctl(0,TCSETCTTY,0); (void) close(0); if (open("/dev/tty", O_RDWR) < 0) { restore_error_fd fprintf(stderr,"open(/dev/tty): %s\r\n",Tcl_ErrnoMsg(errno)); exit(-1); } (void) close(1); (void) close(2); (void) dup(0); (void) dup(0); setptyutmp(); /* create a utmp entry */ /* _CRAY2 code from Hal Peterson , Cray Research, Inc. */ #ifdef _CRAY2 /* * Interpose a process between expect and the spawned child to * keep the slave side of the pty open to allow time for expect * to read the last output. This is a workaround for an apparent * bug in the Unicos pty driver on Cray-2's under Unicos 6.0 (at * least). */ if ((pid = fork()) == -1) { restore_error_fd fprintf(stderr,"second fork: %s\r\n",Tcl_ErrnoMsg(errno)); exit(-1); } if (pid) { /* Intermediate process. */ int status; int timeout; char *t; /* How long should we wait? */ timeout = exp_pty_timeout; /* Let the spawned process run to completion. */ while (wait(&status) < 0 && errno == EINTR) /* empty body */; /* Wait for the pty to clear. */ sleep(timeout); /* Duplicate the spawned process's status. */ if (WIFSIGNALED(status)) kill(getpid(), WTERMSIG(status)); /* The kill may not have worked, but this will. */ exit(WEXITSTATUS(status)); } #endif /* _CRAY2 */ #endif /* CRAY */ if (exp_console) { #ifdef SRIOCSREDIR int fd; if ((fd = open("/dev/console", O_RDONLY)) == -1) { restore_error_fd fprintf(stderr, "spawn %s: cannot open console, check permissions of /dev/console\n",argv[0]); exit(-1); } if (ioctl(fd, SRIOCSREDIR, 0) == -1) { restore_error_fd fprintf(stderr, "spawn %s: cannot redirect console, check permissions of /dev/console\n",argv[0]); } close(fd); #endif #ifdef TIOCCONS int on = 1; if (ioctl(0,TIOCCONS,(char *)&on) == -1) { restore_error_fd fprintf(stderr, "spawn %s: cannot open console, check permissions of /dev/console\n",argv[0]); exit(-1); } #endif /* TIOCCONS */ } /* tell parent that we are done setting up pty */ /* The actual char sent back is irrelevant. */ /* exp_debuglog("child: telling parent that pty is initialized\r\n");*/ cc = write(sync_fds[1]," ",1); if (cc == -1) { restore_error_fd fprintf(stderr,"child: sync byte write: %s\r\n",Tcl_ErrnoMsg(errno)); exit(-1); } close(sync_fds[1]); /* wait for master to let us go on */ cc = read(sync2_fds[0],&sync_byte,1); if (cc == -1) { restore_error_fd exp_errorlog("child: sync byte read: %s\r\n",Tcl_ErrnoMsg(errno)); exit(-1); } close(sync2_fds[0]); /* exp_debuglog("child: now unsynchronized from parent\r\n"); */ /* (possibly multiple) masters are closed automatically due to */ /* earlier fcntl(,,CLOSE_ON_EXEC); */ /* just in case, allow user to explicitly close other files */ if (exp_close_in_child) (*exp_close_in_child)(); /* allow user to do anything else to child */ if (exp_child_exec_prelude) (*exp_child_exec_prelude)(); (void) execvp(file,argv); /* Unfortunately, by now we've closed fd's to stderr, logfile * and debugfile. The only reasonable thing to do is to send * *back the error as part of the program output. This will * be *picked up in an expect or interact command. */ write(status_pipe[1], &errno, sizeof errno); exit(-1); /*NOTREACHED*/ } /* returns fd of master side of pty */ /*VARARGS*/ int exp_spawnl TCL_VARARGS_DEF(char *,arg1) /*exp_spawnl(va_alist)*/ /*va_dcl*/ { va_list args; /* problematic line here */ int i; char *arg, **argv; arg = TCL_VARARGS_START(char *,arg1,args); /*va_start(args);*/ for (i=1;;i++) { arg = va_arg(args,char *); if (!arg) break; } va_end(args); if (i == 0) sysreturn(EINVAL); if (!(argv = (char **)malloc((i+1)*sizeof(char *)))) sysreturn(ENOMEM); argv[0] = TCL_VARARGS_START(char *,arg1,args); /*va_start(args);*/ for (i=1;;i++) { argv[i] = va_arg(args,char *); if (!argv[i]) break; } i = exp_spawnv(argv[0],argv+1); free((char *)argv); return(i); } /* allow user-provided fd to be passed to expect funcs */ int exp_spawnfd(fd) int fd; { if (!fd_new(fd)) { errno = ENOMEM; return -1; } return fd; } /* remove nulls from s. Initially, the number of chars in s is c, */ /* not strlen(s). This count does not include the trailing null. */ /* returns number of nulls removed. */ static int rm_nulls(s,c) char *s; int c; { char *s2 = s; /* points to place in original string to put */ /* next non-null character */ int count = 0; int i; for (i=0;i 0) alarm(timeout); /* restart read if setjmp returns 0 (first time) or 2 (EXP_RESTART). */ /* abort if setjmp returns 1 (EXP_ABORT). */ #ifdef HAVE_SIGLONGJMP if (EXP_ABORT != sigsetjmp(exp_readenv,1)) { #else if (EXP_ABORT != setjmp(exp_readenv)) { #endif /* HAVE_SIGLONGJMP */ exp_reading = TRUE; if (fd == -1) { int c; c = getc(fp); if (c == EOF) { /*fprintf(stderr,"<>",c);fflush(stderr);*/ if (feof(fp)) cc = 0; else cc = -1; } else { /*fprintf(stderr,"<<%c>>",c);fflush(stderr);*/ buffer[0] = c; cc = 1; } } else { #ifndef HAVE_PTYTRAP cc = read(fd,buffer,length); #else # include fd_set rdrs; fd_set excep; restart: FD_ZERO(&rdrs); FD_ZERO(&excep); FD_SET(fd,&rdrs); FD_SET(fd,&excep); if (-1 == (cc = select(fd+1, (SELECT_MASK_TYPE *)&rdrs, (SELECT_MASK_TYPE *)0, (SELECT_MASK_TYPE *)&excep, (struct timeval *)0))) { /* window refreshes trigger EINTR, ignore */ if (errno == EINTR) goto restart; } if (FD_ISSET(fd,&rdrs)) { cc = read(fd,buffer,length); } else if (FD_ISSET(fd,&excep)) { struct request_info ioctl_info; ioctl(fd,TIOCREQCHECK,&ioctl_info); if (ioctl_info.request == TIOCCLOSE) { cc = 0; /* indicate eof */ } else { ioctl(fd, TIOCREQSET, &ioctl_info); /* presumably, we trapped an open here */ goto restart; } } #endif /* HAVE_PTYTRAP */ } #if 0 /* can't get fread to return early! */ else { if (!(cc = fread(buffer,1,length,fp))) { if (ferror(fp)) cc = -1; } } #endif i_read_errno = errno; /* errno can be overwritten by the */ /* time we return */ } exp_reading = FALSE; if (timeout > 0) alarm(0); return(cc); } /* I tried really hard to make the following two functions share the code */ /* that makes the ecase array, but I kept running into a brick wall when */ /* passing var args into the funcs and then again into a make_cases func */ /* I would very much appreciate it if someone showed me how to do it right */ /* takes triplets of args, with a final "exp_last" arg */ /* triplets are type, pattern, and then int to return */ /* returns negative value if error (or EOF/timeout) occurs */ /* some negative values can also have an associated errno */ /* the key internal variables that this function depends on are: exp_buffer exp_buffer_end exp_match_end */ static int expectv(fd,fp,ecases) int fd; FILE *fp; struct exp_case *ecases; { int cc = 0; /* number of chars returned in a single read */ int buf_length; /* numbers of chars in exp_buffer */ int old_length; /* old buf_length */ int first_time = TRUE; /* force old buffer to be tested before */ /* additional reads */ int polled = 0; /* true if poll has caused read() to occur */ struct exp_case *ec; /* points to current ecase */ time_t current_time; /* current time (when we last looked)*/ time_t end_time; /* future time at which to give up */ int remtime; /* remaining time in timeout */ struct f *f; int return_val; int sys_error = 0; #define return_normally(x) {return_val = x; goto cleanup;} #define return_errno(x) {sys_error = x; goto cleanup;} f = fdfp2f(fd,fp); if (!f) return_errno(ENOMEM); exp_buffer = f->buffer; exp_buffer_end = f->buffer_end; exp_match_end = f->match_end; buf_length = exp_buffer_end - exp_match_end; if (buf_length) { /* * take end of previous match to end of buffer * and copy to beginning of buffer */ memmove(exp_buffer,exp_match_end,buf_length); } exp_buffer_end = exp_buffer + buf_length; *exp_buffer_end = '\0'; if (!ecases) return_errno(EINVAL); /* compile if necessary */ for (ec=ecases;ec->type != exp_end;ec++) { if ((ec->type == exp_regexp) && !ec->re) { TclRegError((char *)0); if (!(ec->re = TclRegComp(ec->pattern))) { fprintf(stderr,"regular expression %s is bad: %s",ec->pattern,TclGetRegError()); return_errno(EINVAL); } } } /* get the latest buffer size. Double the user input for two */ /* reasons. 1) Need twice the space in case the match */ /* straddles two bufferfuls, 2) easier to hack the division by */ /* two when shifting the buffers later on */ bufsiz = 2*exp_match_max; if (f->msize != bufsiz) { /* if truncated, forget about some data */ if (buf_length > bufsiz) { /* copy end of buffer down */ /* copy one less than what buffer can hold to avoid */ /* triggering buffer-full handling code below */ /* which will immediately dump the first half */ /* of the buffer */ memmove(exp_buffer,exp_buffer+(buf_length - bufsiz)+1, bufsiz-1); buf_length = bufsiz-1; } exp_buffer = realloc(exp_buffer,bufsiz+1); if (!exp_buffer) return_errno(ENOMEM); exp_buffer[buf_length] = '\0'; exp_buffer_end = exp_buffer + buf_length; f->msize = bufsiz; } /* some systems (i.e., Solaris) require fp be flushed when switching */ /* directions - do this again afterwards */ if (fd == -1) fflush(fp); if (exp_timeout != -1) signal(SIGALRM,sigalarm_handler); /* remtime and current_time updated at bottom of loop */ remtime = exp_timeout; time(¤t_time); end_time = current_time + remtime; for (;;) { /* when buffer fills, copy second half over first and */ /* continue, so we can do matches over multiple buffers */ if (buf_length == bufsiz) { int first_half, second_half; if (exp_full_buffer) { exp_debuglog("expect: full buffer\r\n"); exp_match = exp_buffer; exp_match_end = exp_buffer + buf_length; exp_buffer_end = exp_match_end; return_normally(EXP_FULLBUFFER); } first_half = bufsiz/2; second_half = bufsiz - first_half; memcpy(exp_buffer,exp_buffer+first_half,second_half); buf_length = second_half; exp_buffer_end = exp_buffer + second_half; } /* * always check first if pattern is already in buffer */ if (first_time) { first_time = FALSE; goto after_read; } /* * check for timeout * we should timeout if either * 1) exp_timeout > remtime <= 0 (normal) * 2) exp_timeout == 0 and we have polled at least once * */ if (((exp_timeout > remtime) && (remtime <= 0)) || ((exp_timeout == 0) && polled)) { exp_debuglog("expect: timeout\r\n"); exp_match_end = exp_buffer; return_normally(EXP_TIMEOUT); } /* remember that we have actually checked at least once */ polled = 1; cc = i_read(fd,fp, exp_buffer_end, bufsiz - buf_length, remtime); if (cc == 0) { exp_debuglog("expect: eof\r\n"); return_normally(EXP_EOF); /* normal EOF */ } else if (cc == -1) { /* abnormal EOF */ /* ptys produce EIO upon EOF - sigh */ if (i_read_errno == EIO) { /* convert to EOF indication */ exp_debuglog("expect: eof\r\n"); return_normally(EXP_EOF); } exp_debuglog("expect: error (errno = %d)\r\n",i_read_errno); return_errno(i_read_errno); } else if (cc == -2) { exp_debuglog("expect: timeout\r\n"); exp_match_end = exp_buffer; return_normally(EXP_TIMEOUT); } old_length = buf_length; buf_length += cc; exp_buffer_end += buf_length; if (exp_logfile_all || (exp_loguser && exp_logfile)) { fwrite(exp_buffer + old_length,1,cc,exp_logfile); } if (exp_loguser) fwrite(exp_buffer + old_length,1,cc,stdout); if (exp_debugfile) fwrite(exp_buffer + old_length,1,cc,exp_debugfile); /* if we wrote to any logs, flush them */ if (exp_debugfile) fflush(exp_debugfile); if (exp_loguser) { fflush(stdout); if (exp_logfile) fflush(exp_logfile); } /* remove nulls from input, so we can use C-style strings */ /* doing it here lets them be sent to the screen, just */ /* in case they are involved in formatting operations */ if (exp_remove_nulls) { buf_length -= rm_nulls(exp_buffer + old_length, cc); } /* cc should be decremented as well, but since it will not */ /* be used before being set again, there is no need */ exp_buffer_end = exp_buffer + buf_length; *exp_buffer_end = '\0'; exp_match_end = exp_buffer; after_read: exp_debuglog("expect: does {%s} match ",exp_printify(exp_buffer)); /* pattern supplied */ for (ec=ecases;ec->type != exp_end;ec++) { int matched = -1; exp_debuglog("{%s}? ",exp_printify(ec->pattern)); if (ec->type == exp_glob) { int offset; matched = Exp_StringMatch(exp_buffer,ec->pattern,&offset); if (matched >= 0) { exp_match = exp_buffer + offset; exp_match_end = exp_match + matched; } } else if (ec->type == exp_exact) { char *p = strstr(exp_buffer,ec->pattern); if (p) { matched = 1; exp_match = p; exp_match_end = p + strlen(ec->pattern); } } else if (ec->type == exp_null) { char *p; for (p=exp_buffer;pre,exp_buffer,exp_buffer)) { matched = 1; exp_match = ec->re->startp[0]; exp_match_end = ec->re->endp[0]; } else if (TclGetRegError()) { fprintf(stderr,"r.e. match (pattern %s) failed: %s",ec->pattern,TclGetRegError()); } } if (matched != -1) { exp_debuglog("yes\nexp_buffer is {%s}\n", exp_printify(exp_buffer)); return_normally(ec->value); } else exp_debuglog("no\n"); } /* * Update current time and remaining time. * Don't bother if we are waiting forever or polling. */ if (exp_timeout > 0) { time(¤t_time); remtime = end_time - current_time; } } cleanup: f->buffer = exp_buffer; f->buffer_end = exp_buffer_end; f->match_end = exp_match_end; /* some systems (i.e., Solaris) require fp be flushed when switching */ /* directions - do this before as well */ if (fd == -1) fflush(fp); if (sys_error) { errno = sys_error; return -1; } return return_val; } int exp_fexpectv(fp,ecases) FILE *fp; struct exp_case *ecases; { return(expectv(-1,fp,ecases)); } int exp_expectv(fd,ecases) int fd; struct exp_case *ecases; { return(expectv(fd,(FILE *)0,ecases)); } /*VARARGS*/ int exp_expectl TCL_VARARGS_DEF(int,arg1) /*exp_expectl(va_alist)*/ /*va_dcl*/ { va_list args; int fd; struct exp_case *ec, *ecases; int i; enum exp_type type; fd = TCL_VARARGS_START(int,arg1,args); /* va_start(args);*/ /* fd = va_arg(args,int);*/ /* first just count the arg sets */ for (i=0;;i++) { type = va_arg(args,enum exp_type); if (type == exp_end) break; /* Ultrix 4.2 compiler refuses enumerations comparison!? */ if ((int)type < 0 || (int)type >= (int)exp_bogus) { fprintf(stderr,"bad type (set %d) in exp_expectl\n",i); sysreturn(EINVAL); } va_arg(args,char *); /* COMPUTED BUT NOT USED */ if (type == exp_compiled) { va_arg(args,regexp *); /* COMPUTED BUT NOT USED */ } va_arg(args,int); /* COMPUTED BUT NOT USED*/ } va_end(args); if (!(ecases = (struct exp_case *) malloc((1+i)*sizeof(struct exp_case)))) sysreturn(ENOMEM); /* now set up the actual cases */ fd = TCL_VARARGS_START(int,arg1,args); /*va_start(args);*/ /*va_arg(args,int);*/ /*COMPUTED BUT NOT USED*/ for (ec=ecases;;ec++) { ec->type = va_arg(args,enum exp_type); if (ec->type == exp_end) break; ec->pattern = va_arg(args,char *); if (ec->type == exp_compiled) { ec->re = va_arg(args,regexp *); } else { ec->re = 0; } ec->value = va_arg(args,int); } va_end(args); i = expectv(fd,(FILE *)0,ecases); for (ec=ecases;ec->type != exp_end;ec++) { /* free only if regexp and we compiled it for user */ if (ec->type == exp_regexp) { free((char *)ec->re); } } free((char *)ecases); return(i); } int exp_fexpectl TCL_VARARGS_DEF(FILE *,arg1) /*exp_fexpectl(va_alist)*/ /*va_dcl*/ { va_list args; FILE *fp; struct exp_case *ec, *ecases; int i; enum exp_type type; fp = TCL_VARARGS_START(FILE *,arg1,args); /*va_start(args);*/ /*fp = va_arg(args,FILE *);*/ /* first just count the arg-pairs */ for (i=0;;i++) { type = va_arg(args,enum exp_type); if (type == exp_end) break; /* Ultrix 4.2 compiler refuses enumerations comparison!? */ if ((int)type < 0 || (int)type >= (int)exp_bogus) { fprintf(stderr,"bad type (set %d) in exp_expectl\n",i); sysreturn(EINVAL); } va_arg(args,char *); /* COMPUTED BUT NOT USED */ if (type == exp_compiled) { va_arg(args,regexp *); /* COMPUTED BUT NOT USED */ } va_arg(args,int); /* COMPUTED BUT NOT USED*/ } va_end(args); if (!(ecases = (struct exp_case *) malloc((1+i)*sizeof(struct exp_case)))) sysreturn(ENOMEM); #if 0 va_start(args); va_arg(args,FILE *); /*COMPUTED, BUT NOT USED*/ #endif (void) TCL_VARARGS_START(FILE *,arg1,args); for (ec=ecases;;ec++) { ec->type = va_arg(args,enum exp_type); if (ec->type == exp_end) break; ec->pattern = va_arg(args,char *); if (ec->type == exp_compiled) { ec->re = va_arg(args,regexp *); } else { ec->re = 0; } ec->value = va_arg(args,int); } va_end(args); i = expectv(-1,fp,ecases); for (ec=ecases;ec->type != exp_end;ec++) { /* free only if regexp and we compiled it for user */ if (ec->type == exp_regexp) { free((char *)ec->re); } } free((char *)ecases); return(i); } /* like popen(3) but works in both directions */ FILE * exp_popen(program) char *program; { FILE *fp; int ec; if (0 > (ec = exp_spawnl("sh","sh","-c",program,(char *)0))) return(0); if (!(fp = fdopen(ec,"r+"))) return(0); setbuf(fp,(char *)0); return(fp); } int exp_disconnect() { int ttyfd; #ifndef EALREADY #define EALREADY 37 #endif /* presumably, no stderr, so don't bother with error message */ if (exp_disconnected) sysreturn(EALREADY); exp_disconnected = TRUE; freopen("/dev/null","r",stdin); freopen("/dev/null","w",stdout); freopen("/dev/null","w",stderr); #ifdef POSIX setsid(); #else #ifdef SYSV3 /* put process in our own pgrp, and lose controlling terminal */ exp_setpgrp(); signal(SIGHUP,SIG_IGN); if (fork()) exit(0); /* first child exits (as per Stevens, */ /* UNIX Network Programming, p. 79-80) */ /* second child process continues as daemon */ #else /* !SYSV3 */ exp_setpgrp(); /* Pyramid lacks this defn */ #ifdef TIOCNOTTY ttyfd = open("/dev/tty", O_RDWR); if (ttyfd >= 0) { /* zap controlling terminal if we had one */ (void) ioctl(ttyfd, TIOCNOTTY, (char *)0); (void) close(ttyfd); } #endif /* TIOCNOTTY */ #endif /* SYSV3 */ #endif /* POSIX */ return(0); } /* send to log if open and debugging enabled */ /* send to stderr if debugging enabled */ /* use this function for recording unusual things in the log */ /*VARARGS*/ void exp_debuglog TCL_VARARGS_DEF(char *,arg1) { char *fmt; va_list args; fmt = TCL_VARARGS_START(char *,arg1,args); if (exp_debugfile) vfprintf(exp_debugfile,fmt,args); if (exp_is_debugging) { vfprintf(stderr,fmt,args); if (exp_logfile) vfprintf(exp_logfile,fmt,args); } va_end(args); } /* send to log if open */ /* send to stderr */ /* use this function for error conditions */ /*VARARGS*/ void exp_errorlog TCL_VARARGS_DEF(char *,arg1) { char *fmt; va_list args; fmt = TCL_VARARGS_START(char *,arg1,args); vfprintf(stderr,fmt,args); if (exp_debugfile) vfprintf(exp_debugfile,fmt,args); if (exp_logfile) vfprintf(exp_logfile,fmt,args); va_end(args); } #include char * exp_printify(s) char *s; { static int destlen = 0; static char *dest = 0; char *d; /* ptr into dest */ unsigned int need; if (s == 0) return(""); /* worst case is every character takes 4 to printify */ need = strlen(s)*4 + 1; if (need > destlen) { if (dest) ckfree(dest); dest = ckalloc(need); destlen = need; } for (d = dest;*s;s++) { if (*s == '\r') { strcpy(d,"\\r"); d += 2; } else if (*s == '\n') { strcpy(d,"\\n"); d += 2; } else if (*s == '\t') { strcpy(d,"\\t"); d += 2; } else if (isascii(*s) && isprint(*s)) { *d = *s; d += 1; } else { sprintf(d,"\\x%02x",*s & 0xff); d += 4; } } *d = '\0'; return(dest); } expect5.45.4/exp_memmove.c0000664000175000017500000000062413235134350016016 0ustar pysslingpyssling/* memmove - some systems lack this */ #include "expect_cf.h" #include "tcl.h" /* like memcpy but can handle overlap */ #ifndef HAVE_MEMMOVE char * memmove(dest,src,n) VOID *dest; CONST VOID *src; int n; { char *d; CONST char *s; d = dest; s = src; if (s #include #include #ifdef HAVE_UNISTD_H # include #endif /* Some systems require that the poll array be non-empty so provide a * 1-elt array for starters. It will be ignored as soon as it grows * larger. */ static struct pollfd initialFdArray; static struct pollfd *fdArray = &initialFdArray; static int fdsInUse = 0; /* space in use */ static int fdsMaxSpace = 1; /* space that has actually been allocated */ /* * tclUnixNotify.c -- * * This file contains the implementation of the select-based * Unix-specific notifier, which is the lowest-level part of the * Tcl event loop. This file works together with * ../generic/tclNotify.c. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * SCCS: @(#) tclUnixNotfy.c 1.42 97/07/02 20:55:44 */ /* * This structure is used to keep track of the notifier info for a * a registered file. */ typedef struct FileHandler { int fd; int mask; /* Mask of desired events: TCL_READABLE, * etc. */ int readyMask; /* Mask of events that have been seen since the * last time file handlers were invoked for * this file. */ Tcl_FileProc *proc; /* Procedure to call, in the style of * Tcl_CreateFileHandler. */ ClientData clientData; /* Argument to pass to proc. */ int pollArrayIndex; /* index into poll array */ struct FileHandler *nextPtr;/* Next in list of all files we care about. */ } FileHandler; /* * The following structure is what is added to the Tcl event queue when * file handlers are ready to fire. */ typedef struct FileHandlerEvent { Tcl_Event header; /* Information that is standard for * all events. */ int fd; /* File descriptor that is ready. Used * to find the FileHandler structure for * the file (can't point directly to the * FileHandler structure because it could * go away while the event is queued). */ } FileHandlerEvent; /* * The following static structure contains the state information for the * select based implementation of the Tcl notifier. */ static struct { FileHandler *firstFileHandlerPtr; /* Pointer to head of file handler list. */ fd_mask checkMasks[3*MASK_SIZE]; /* This array is used to build up the masks * to be used in the next call to select. * Bits are set in response to calls to * Tcl_CreateFileHandler. */ fd_mask readyMasks[3*MASK_SIZE]; /* This array reflects the readable/writable * conditions that were found to exist by the * last call to select. */ int numFdBits; /* Number of valid bits in checkMasks * (one more than highest fd for which * Tcl_WatchFile has been called). */ } notifier; /* * The following static indicates whether this module has been initialized. */ static int initialized = 0; /* * Static routines defined in this file. */ static void InitNotifier _ANSI_ARGS_((void)); static void NotifierExitHandler _ANSI_ARGS_(( ClientData clientData)); static int FileHandlerEventProc _ANSI_ARGS_((Tcl_Event *evPtr, int flags)); /* *---------------------------------------------------------------------- * * InitNotifier -- * * Initializes the notifier state. * * Results: * None. * * Side effects: * Creates a new exit handler. * *---------------------------------------------------------------------- */ static void InitNotifier() { initialized = 1; memset(¬ifier, 0, sizeof(notifier)); Tcl_CreateExitHandler(NotifierExitHandler, NULL); } /* *---------------------------------------------------------------------- * * NotifierExitHandler -- * * This function is called to cleanup the notifier state before * Tcl is unloaded. * * Results: * None. * * Side effects: * Destroys the notifier window. * *---------------------------------------------------------------------- */ static void NotifierExitHandler(clientData) ClientData clientData; /* Not used. */ { initialized = 0; } /* *---------------------------------------------------------------------- * * Tcl_SetTimer -- * * This procedure sets the current notifier timer value. This * interface is not implemented in this notifier because we are * always running inside of Tcl_DoOneEvent. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void Tcl_SetTimer(timePtr) Tcl_Time *timePtr; /* Timeout value, may be NULL. */ { /* * The interval timer doesn't do anything in this implementation, * because the only event loop is via Tcl_DoOneEvent, which passes * timeout values to Tcl_WaitForEvent. */ } /* *---------------------------------------------------------------------- * * Tcl_CreateFileHandler -- * * This procedure registers a file handler with the Xt notifier. * * Results: * None. * * Side effects: * Creates a new file handler structure and registers one or more * input procedures with Xt. * *---------------------------------------------------------------------- */ void Tcl_CreateFileHandler(fd, mask, proc, clientData) int fd; /* Handle of stream to watch. */ int mask; /* OR'ed combination of TCL_READABLE, * TCL_WRITABLE, and TCL_EXCEPTION: * indicates conditions under which * proc should be called. */ Tcl_FileProc *proc; /* Procedure to call for each * selected event. */ ClientData clientData; /* Arbitrary data to pass to proc. */ { FileHandler *filePtr; int index, bit; int cur_fd_index; if (!initialized) { InitNotifier(); } for (filePtr = notifier.firstFileHandlerPtr; filePtr != NULL; filePtr = filePtr->nextPtr) { if (filePtr->fd == fd) { break; } } if (filePtr == NULL) { filePtr = (FileHandler*) ckalloc(sizeof(FileHandler)); /* MLK */ filePtr->fd = fd; filePtr->readyMask = 0; filePtr->nextPtr = notifier.firstFileHandlerPtr; notifier.firstFileHandlerPtr = filePtr; } filePtr->proc = proc; filePtr->clientData = clientData; filePtr->pollArrayIndex = fdsInUse; cur_fd_index = fdsInUse; fdsInUse++; if (fdsInUse > fdsMaxSpace) { if (fdArray != &initialFdArray) ckfree((char *)fdArray); fdArray = (struct pollfd *)ckalloc(fdsInUse*sizeof(struct pollfd)); fdsMaxSpace = fdsInUse; } fdArray[cur_fd_index].fd = fd; /* I know that POLLIN/OUT is right. But I have no idea if POLLPRI * corresponds well to TCL_EXCEPTION. */ if (mask & TCL_READABLE) { fdArray[cur_fd_index].events = POLLIN; } if (mask & TCL_WRITABLE) { fdArray[cur_fd_index].events = POLLOUT; } if (mask & TCL_EXCEPTION) { fdArray[cur_fd_index].events = POLLPRI; } } /* *---------------------------------------------------------------------- * * Tcl_DeleteFileHandler -- * * Cancel a previously-arranged callback arrangement for * a file. * * Results: * None. * * Side effects: * If a callback was previously registered on file, remove it. * *---------------------------------------------------------------------- */ void Tcl_DeleteFileHandler(fd) int fd; /* Stream id for which to remove callback procedure. */ { FileHandler *filePtr, *prevPtr, *lastPtr; int index, bit, mask, i; int cur_fd_index; if (!initialized) { InitNotifier(); } /* * Find the entry for the given file (and return if there * isn't one). */ for (prevPtr = NULL, filePtr = notifier.firstFileHandlerPtr; ; prevPtr = filePtr, filePtr = filePtr->nextPtr) { if (filePtr == NULL) { return; } if (filePtr->fd == fd) { break; } } /* * Clean up information in the callback record. */ if (prevPtr == NULL) { notifier.firstFileHandlerPtr = filePtr->nextPtr; } else { prevPtr->nextPtr = filePtr->nextPtr; } /* back to poll-specific code - DEL */ cur_fd_index = filePtr->pollArrayIndex; fdsInUse--; /* if this one is last, do nothing special */ /* else swap with one at end of array */ if (cur_fd_index != fdsInUse) { int lastfd_in_array = fdArray[fdsInUse].fd; memcpy(&fdArray[cur_fd_index],&fdArray[fdsInUse],sizeof(struct pollfd)); /* update index to reflect new location in array */ /* first find link corresponding to last element in array */ for (lastPtr = notifier.firstFileHandlerPtr; filePtr; lastPtr = lastPtr->nextPtr) { if (lastPtr->fd == lastfd_in_array) { lastPtr->pollArrayIndex = cur_fd_index; break; } } } fdsInUse--; ckfree((char *) filePtr); } /* *---------------------------------------------------------------------- * * FileHandlerEventProc -- * * This procedure is called by Tcl_ServiceEvent when a file event * reaches the front of the event queue. This procedure is * responsible for actually handling the event by invoking the * callback for the file handler. * * Results: * Returns 1 if the event was handled, meaning it should be removed * from the queue. Returns 0 if the event was not handled, meaning * it should stay on the queue. The only time the event isn't * handled is if the TCL_FILE_EVENTS flag bit isn't set. * * Side effects: * Whatever the file handler's callback procedure does. * *---------------------------------------------------------------------- */ static int FileHandlerEventProc(evPtr, flags) Tcl_Event *evPtr; /* Event to service. */ int flags; /* Flags that indicate what events to * handle, such as TCL_FILE_EVENTS. */ { FileHandler *filePtr; FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) evPtr; int mask; if (!(flags & TCL_FILE_EVENTS)) { return 0; } /* * Search through the file handlers to find the one whose handle matches * the event. We do this rather than keeping a pointer to the file * handler directly in the event, so that the handler can be deleted * while the event is queued without leaving a dangling pointer. */ for (filePtr = notifier.firstFileHandlerPtr; filePtr != NULL; filePtr = filePtr->nextPtr) { if (filePtr->fd != fileEvPtr->fd) { continue; } /* * The code is tricky for two reasons: * 1. The file handler's desired events could have changed * since the time when the event was queued, so AND the * ready mask with the desired mask. * 2. The file could have been closed and re-opened since * the time when the event was queued. This is why the * ready mask is stored in the file handler rather than * the queued event: it will be zeroed when a new * file handler is created for the newly opened file. */ mask = filePtr->readyMask & filePtr->mask; filePtr->readyMask = 0; if (mask != 0) { (*filePtr->proc)(filePtr->clientData, mask); } break; } return 1; } /* *---------------------------------------------------------------------- * * Tcl_WaitForEvent -- * * This function is called by Tcl_DoOneEvent to wait for new * events on the message queue. If the block time is 0, then * Tcl_WaitForEvent just polls without blocking. * * Results: * Returns -1 if the select would block forever, otherwise * returns 0. * * Side effects: * Queues file events that are detected by the select. * *---------------------------------------------------------------------- */ int Tcl_WaitForEvent(timePtr) Tcl_Time *timePtr; /* Maximum block time, or NULL. */ { FileHandler *filePtr; FileHandlerEvent *fileEvPtr; int timeout; struct timeval *timeoutPtr; int bit, index, mask, numFound; if (!initialized) { InitNotifier(); } /* * Set up the timeout structure. Note that if there are no events to * check for, we return with a negative result rather than blocking * forever. */ if (timePtr) { timeout = timePtr->sec*1000 + timePtr->usec/1000; } else if (notifier.numFdBits == 0) { return -1; } else { timeoutPtr = NULL; } numFound = poll(fdArray,fdsInUse,timeout); /* * Queue all detected file events before returning. */ for (filePtr = notifier.firstFileHandlerPtr; (filePtr != NULL) && (numFound > 0); filePtr = filePtr->nextPtr) { index = filePtr->pollArrayIndex; mask = 0; if (fdArray[index].revents & POLLIN) { mask |= TCL_READABLE; } if (fdArray[index].revents & POLLOUT) { mask |= TCL_WRITABLE; } /* I have no idea if this is right ... */ if (fdArray[index].revents & (POLLPRI|POLLERR|POLLHUP|POLLNVAL)) { mask |= TCL_EXCEPTION; } if (!mask) { continue; } else { numFound--; } /* * Don't bother to queue an event if the mask was previously * non-zero since an event must still be on the queue. */ if (filePtr->readyMask == 0) { fileEvPtr = (FileHandlerEvent *) ckalloc( sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; fileEvPtr->fd = filePtr->fd; Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL); } filePtr->readyMask = mask; } return 0; } expect5.45.4/README0000644000175000017500000003455313235134350014217 0ustar pysslingpysslingNOTE: ALPHA AND BETA RELEASES OF TCL/TK ARE NOT SUPPORTED! -------------------- Introduction -------------------- This is the README file for Expect, a program that performs programmed dialogue with other interactive programs. It is briefly described by its man page, expect(1). This directory contains the source and man page for Expect. This README file covers Expect 5.38 and up. These versions of Expect work with Tcl 8.2 and up and Tk 8.2 and up. Significant changes and other news can be found in the NEWS file. The Expect home page is: http://expect.nist.gov The Expect FAQ is: http://expect.nist.gov/FAQ.html -------------------- Getting Started - The Preferable Way -------------------- A book on Expect is available from O'Reilly with the title "Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Applications", ISBN 1-56592-090-2. The book is filled with detailed examples and explanations, and is a comprehensive tutorial to Expect. The book also includes a tutorial on Tcl written specifically for Expect users (so you don't have to read the Expect papers or the man pages). Exploring Expect is 602 pages. -------------------- Getting Started - The Hacker Way -------------------- While the book is the best way to learn about Expect, it is not absolutely necessary. There are man pages after all and there are numerous articles and papers on Expect. All of my own papers are in the public domain and can be received free. If you are a hacker on a tight budget, this may appeal to you. Nonetheless, I think you will find the book pays for itself very quickly. It is much more readable than the man pages, it includes well-written and explained examples, and it describes everything in the papers as a coherent whole. The concepts in the papers actually only make up a small fraction of the book. The 1990 USENIX paper (see "Readings" below) is probably the best one for understanding Expect conceptually. The 1991 Computing Systems and the LISA IV papers provide a nice mix of examples. The only downside is, the examples in these papers don't actually work anymore - some aspects (e.g., syntax) of both Expect and Tcl have changed. The papers still make interesting reading - just don't study the examples too closely! Fortunately, most of the examples from the papers also accompany this distribution - and all of these are up to date. For all the details, read the man page. It is long but you can get started just by skimming the sections on the following commands: spawn (starts a process) send (sends to a process) expect (waits for output from a process) interact (lets you interact with a process) To print out the Expect man page, invoke your local troff using the -man macros, such as either of: ptroff -man expect.man ditroff -man expect.man If Expect is installed, you can read the man pages using the "usual" man commands, such as "man expect". If not installed, view the man page on your screen by saying something like: nroff -man expect.man | more Expect uses Tcl as the underlying language for expressing things such as procedures, loops, file I/O, and arithmetic expressions. For many simple scripts, it is not necessary to learn about Tcl. Just by studying the examples, you will learn enough Tcl to get by. But if you would like to learn more about Tcl or use it in your own applications, read the Tcl README file which provides pointers to the extensive Tcl documentation. Or read Exploring Expect. Chapter 2 of Exploring Expect is a Tcl tutorial specifically designed for Expect users. An interactive debugger is bundled with Expect. The debugger has its own documentation that comes separately. It is listed in the Readings below. Again, it is slightly out of date. An up-to-date description of the debugger appears in Chapter 18 of Exploring Expect. This chapter also contains additional advice and tips for debugging. You may get the feeling that the Expect documentation is somewhat scattered and disorganized. This was true prior to publication of Exploring Expect. The book contains everything you need to know, all up-to-date, and with examples of every concept. (The book contains no references to any of the Expect papers because none are necessary.) ---------------------- Examples ---------------------- This distribution contains many example scripts. (All of the substantive examples in the book are included.) They can be found in the example directory of this distribution. The README file in that directory briefly describes all of the example scripts. Many of the more sophisticated examples have man pages of their own. Other interesting scripts are available separately in the directory http://expect.nist.gov/scripts/ (ftpable as ftp://ftp.nist.gov/mel/div826/subject/expect/scripts). (See below for how to retrieve these.) You are welcome to send me scripts to add to this directory. A number of Expect scripts are also available in the Tcl archive, available at ftp://ftp.neosoft.com/pub/tcl. -------------------- Readings on Expect -------------------- The implementation, philosophy, and design are discussed in "expect: Curing Those Uncontrollable Fits of Interaction", Proceedings of the Summer 1990 USENIX Conference, Anaheim, CA, June 11-15, 1990. Examples and discussion, specifically aimed at system administrators, are in "Using expect to Automate System Administration Tasks", Proceedings of the 1990 USENIX Large Systems Administration Conference (LISA) IV, Colorado Springs, CO, October 17-19, 1990. A comprehensive paper of example scripts is "expect: Scripts for Controlling Interactive Programs", Computing Systems, Vol. 4, No. 2, University of California Press Journals, 1991. Regression and conformance testing is discussed in "Regression Testing and Conformance Testing Interactive Programs", Proceedings of the Summer 1992 USENIX Conference, San Antonio, TX, June 8-12, 1992. An explanation of some of the more interesting source code to an early version of Expect is in Chapter 36 ("Expect") of "Obfuscated C and Other Mysteries", John Wiley & Sons, ISBN 0-471-57805-3, January 1993. A paper on connecting multiple interactive programs together using Expect is "Kibitz - Connecting Multiple Interactive Programs Together", Software - Practice & Experience, Vol. 23, No. 5, May 1993. The debugger is discussed in "A Debugger for Tcl Applications", Proceedings of the 1993 Tcl/Tk Workshop, Berkeley, CA, June 10-11, 1993. Using Expect with Tk is described in the paper "X Wrappers for Non-Graphic Interactive Programs", Proceedings of Xhibition '94, San Jose, CA, June 20-24, 1994. Simple techniques to allow secure handling of passwords in background processes are covered in "Handling Passwords with Security and Reliability in Background Processes", Proceedings of the 1994 USENIX LISA VIII Conference, San Diego, CA, September 19-23, 1994. More publications can be found in the Expect home page (see elsewhere). -------------------- How to Get the Latest Version of Expect or the Readings -------------------- Expect may be ftp'd as mel/div826/subject/expect/expect.tar.gz from expect.nist.gov. (Yes, the URL is much shorter: http://expect.nist.gov/expect.tar.Z) Request email delivery by mailing to "library@cme.nist.gov". The contents of the message should be (no subject line) "send pub/expect/expect.tar.Z". Once you have retrieved the system, read the INSTALL file. The papers mentioned above can be retrieved separately (from the same directories listed above) as: doc/seminal.ps.Z (USENIX '90 - Intro and Implementation) doc/sysadm.ps.Z (LISA '90 - System Administration) doc/scripts.ps.Z (Comp. Systems '91 - Overview of Scripts) doc/regress.ps.Z (USENIX '92 - Testing) doc/kibitz.ps.Z (SP&E '93 - Automating Multiple Interactive Programs Simultaneously) doc/tcl-debug.ps.Z (Tcl/Tk '93 - Tcl/Tk Debugger) doc/expectk.ps.Z (Xhibition '94 - Using Expect with Tk) doc/bgpasswd.ps.Z (LISA '94 - Passwds in Background Procs) doc/chargraph.ps.Z (SP&E '96 - Testing and Automation of Character Graphic Applications) The book "Exploring Expect" is described in more detail earlier in this file. The book "Obfuscated C and Other Mysteries" is not on-line but is available in bookstores or directly from the publisher (Wiley). Overhead transparencies I've used at conferences are also available in the same way as the papers themselves. The transparencies are sketchy and not meant for personal education - however if you are familiar with Expect and just want to give a short talk on it to your colleagues, you may find the transparencies useful. They vary in length from 15 to 20 minutes in length. These are: doc/seminal-talk.ps.Z (USENIX '90 - Intro and Implementation) doc/sysadm-talk.ps.Z (LISA '90 - System Administration) doc/regress-talk.ps.Z (USENIX '92 - Testing) doc/tcl-debug-talk.ps.Z (Tcl/Tk '93 - Tcl/Tk Debugger) doc/expectk-talk.ps.Z (Xhibition '94 - Expect + Tk = Expectk) doc/bgpasswd-talk.ps.Z (LISA '94 - Passwords in the Background) All of the documents are compressed PostScript files and should be uncompressed and sent to a PostScript printer. The documents are intended for printing at 8.5"x11" and may fail on some ISO A4 printers. According to Hans Mayer , you can make them A4-able by searching for "FMVERSION" and changing the next line from: 1 1 0 0 612 792 0 1 13 FMDOCUMENT to: 1 1 0 0 594 841 0 1 13 FMDOCUMENT -------------------- Using Expect with and without Tcl and/or Tk. -------------------- The usual way of using Expect is as a standalone program with Tcl as the control language. Since you may already have Tcl, it is available separately. Tcl may be retrieved as tcl.tar.Z in the same way as described above for Expect. When new releases of Tcl appear, I will try to check them out for Expect as soon as possible. If you would like to get the newest Tcl release without waiting, ftp it from ftp.scriptics.com (directory pub/tcl). Expect may also be built using the Tk library, a Tcl interface to the X Window System. Tk is available in the same way as Tcl. It is possible to embed the Expect/Tcl core and optionally Tk in your own C programs. This is described in libexpect(3). Expect can also be used from a C or C++ program without Tcl. This is described in libexpect(3). While I consider this library to be easy to use, the standalone Expect program is much, much easier to use than working with the C compiler and its usual edit, compile, debug cycle. Unlike typical programming, most of the debugging isn't getting the C compiler to accept your programs - rather, it is getting the dialogue correct. Also, translating scripts from Expect to C is usually not necessary. For example, the speed of interactive dialogues is virtually never an issue. So please try 'expect' first. It is a more appropriate tool than the library for most people. -------------------- Systems Supported -------------------- I do not know of any UNIX systems on which Expect will not run. Systems which do not support select or poll can use Expect, but without the ability to run multiple processes simultaneously. I am willing to work with you to complete a port. Before sending me changes, please download or verify that you have the latest version of Expect (see above). Then send me a "diff -c" along with a suitable English explanation. If your diff involves something specific to a machine, give me diffs for configure.in as well or give me a hint about when the diffs should be done so I can write the configure support myself. Also please include the version of the OS and whether it is beta, current, recent, or totally out-of-date and unsupported. -------------------- Installing Expect -------------------- Expect comes with a configure script that provides for an automated installation. I believe you will find that Expect is very easy to install. (Tcl and Tk, too.) For more information, read the INSTALL file. -------------------- Support from Don Libes or NIST -------------------- Although I can't promise anything in the way of support, I'd be interested to hear about your experiences using it (good or bad). I'm also interested in hearing bug reports and suggestions for improvement even though I can't promise to implement them. If you send me a bug, fix, or question, include the version of Expect (as reported by expect -d), version of Tcl, and name and version of the OS that you are using. Before sending mail, it may be helpful to verify that your problem still exists in the latest version. You can check on the current release and whether it addresses your problems by retrieving the latest HISTORY file (see "History" above). Awards, love letters, and bug reports may be sent to: Don Libes National Institute of Standards and Technology Bldg 220, Rm A-127 Gaithersburg, MD 20899 (301) 975-3535 libes@nist.gov I hereby place this software in the public domain. NIST and I would appreciate credit if this program or parts of it are used. Design and implementation of this program was funded primarily by myself. Funding contributors include the NIST Automated Manufacturing Research Facility (funded by the Navy Manufacturing Technology Program), the NIST Scientific and Technical Research Services, the ARPA Persistent Object Bases project and the Computer-aided Acquisition and the Logistic Support (CALS) program of the Office of the Secretary of Defense. Especially signicant contributions were made by John Ousterhout, Henry Spencer, and Rob Savoye. See the HISTORY file for others. -------------------- Commercial Support, Classes -------------------- Several companies provide commercial support for Expect. If your company has a financial investment in Expect or you wish to be assured of continuing support for Expect, you can buy a support contract this way. These companies currently include: ActiveState #200 - 580 Granville St Vancouver, BC V6C 1W6 Canada +1 (604) 484-6800 http://www.activestate.com/Company/contact.plex Cygnus Support 1937 Landings Drive Mountain View, CA 94043 +1 (415) 903-1400 info@cygnus.com http://www.cygnus.com Computerized Processes Unlimited (CPU) 4200 S. I-10 Service Rd., Suite 205 Metairie, LA 70006 +1 (504) 889-2784 info@cpu.com http://www.cpu.com http://www.cpu.com/cpu/expect.htm (Expect class page) CPU provides Expect support and also Expect classes. Contact them for more information. Neither NIST nor I have any financial relationship with these companies. Please contact me to be added to this list. expect5.45.4/expect.man0000664000175000017500000023255313235134350015326 0ustar pysslingpyssling.TH EXPECT 1 "29 December 1994" .SH NAME expect \- programmed dialogue with interactive programs, Version 5 .SH SYNOPSIS .B expect [ .B \-dDinN ] [ .B \-c .I cmds ] [ [ .BR \- [ f | b ] ] .I cmdfile ] [ .I args ] .SH INTRODUCTION .B Expect is a program that "talks" to other interactive programs according to a script. Following the script, .B Expect knows what can be expected from a program and what the correct response should be. An interpreted language provides branching and high-level control structures to direct the dialogue. In addition, the user can take control and interact directly when desired, afterward returning control to the script. .PP .B Expectk is a mixture of .B Expect and .BR Tk . It behaves just like .B Expect and .BR Tk 's .BR wish . .B Expect can also be used directly in C or C++ (that is, without Tcl). See libexpect(3). .PP The name "Expect" comes from the idea of .I send/expect sequences popularized by uucp, kermit and other modem control programs. However unlike uucp, .B Expect is generalized so that it can be run as a user-level command with any program and task in mind. .B Expect can actually talk to several programs at the same time. .PP For example, here are some things .B Expect can do: .RS .TP 4 \(bu Cause your computer to dial you back, so that you can login without paying for the call. .TP \(bu Start a game (e.g., rogue) and if the optimal configuration doesn't appear, restart it (again and again) until it does, then hand over control to you. .TP \(bu Run fsck, and in response to its questions, answer "yes", "no" or give control back to you, based on predetermined criteria. .TP \(bu Connect to another network or BBS (e.g., MCI Mail, CompuServe) and automatically retrieve your mail so that it appears as if it was originally sent to your local system. .TP \(bu Carry environment variables, current directory, or any kind of information across rlogin, telnet, tip, su, chgrp, etc. .RE .PP There are a variety of reasons why the shell cannot perform these tasks. (Try, you'll see.) All are possible with .BR Expect . .PP In general, .B Expect is useful for running any program which requires interaction between the program and the user. All that is necessary is that the interaction can be characterized programmatically. .B Expect can also give the user back control (without halting the program being controlled) if desired. Similarly, the user can return control to the script at any time. .SH USAGE .B Expect reads .I cmdfile for a list of commands to execute. .B Expect may also be invoked implicitly on systems which support the #! notation by marking the script executable, and making the first line in your script: #!/usr/local/bin/expect \-f Of course, the path must accurately describe where .B Expect lives. /usr/local/bin is just an example. The .B \-c flag prefaces a command to be executed before any in the script. The command should be quoted to prevent being broken up by the shell. This option may be used multiple times. Multiple commands may be executed with a single .B \-c by separating them with semicolons. Commands are executed in the order they appear. (When using Expectk, this option is specified as .BR \-command .) .PP The .B \-d flag enables some diagnostic output, which primarily reports internal activity of commands such as .B expect and .BR interact . This flag has the same effect as "exp_internal 1" at the beginning of an Expect script, plus the version of .B Expect is printed. (The .B strace command is useful for tracing statements, and the .B trace command is useful for tracing variable assignments.) (When using Expectk, this option is specified as .BR \-diag .) .PP The .B \-D flag enables an interactive debugger. An integer value should follow. The debugger will take control before the next Tcl procedure if the value is non-zero or if a ^C is pressed (or a breakpoint is hit, or other appropriate debugger command appears in the script). See the README file or SEE ALSO (below) for more information on the debugger. (When using Expectk, this option is specified as .BR \-Debug .) .PP The .B \-f flag prefaces a file from which to read commands from. The flag itself is optional as it is only useful when using the #! notation (see above), so that other arguments may be supplied on the command line. (When using Expectk, this option is specified as .BR \-file .) .PP By default, the command file is read into memory and executed in its entirety. It is occasionally desirable to read files one line at a time. For example, stdin is read this way. In order to force arbitrary files to be handled this way, use the .B \-b flag. (When using Expectk, this option is specified as .BR \-buffer .) Note that stdio-buffering may still take place however this shouldn't cause problems when reading from a fifo or stdin. .PP If the string "\-" is supplied as a filename, standard input is read instead. (Use "./\-" to read from a file actually named "\-".) .PP The .B \-i flag causes .B Expect to interactively prompt for commands instead of reading them from a file. Prompting is terminated via the .B exit command or upon EOF. See .B interpreter (below) for more information. .B \-i is assumed if neither a command file nor .B \-c is used. (When using Expectk, this option is specified as .BR \-interactive .) .PP .B \-\- may be used to delimit the end of the options. This is useful if you want to pass an option-like argument to your script without it being interpreted by .BR Expect . This can usefully be placed in the #! line to prevent any flag-like interpretation by Expect. For example, the following will leave the original arguments (including the script name) in the variable .IR argv . #!/usr/local/bin/expect \-\- Note that the usual getopt(3) and execve(2) conventions must be observed when adding arguments to the #! line. .PP The file $exp_library/expect.rc is sourced automatically if present, unless the .B \-N flag is used. (When using Expectk, this option is specified as .BR \-NORC .) Immediately after this, the file ~/.expect.rc is sourced automatically, unless the .B \-n flag is used. If the environment variable DOTDIR is defined, it is treated as a directory and .expect.rc is read from there. (When using Expectk, this option is specified as .BR \-norc .) This sourcing occurs only after executing any .B \-c flags. .PP .B \-v causes Expect to print its version number and exit. (The corresponding flag in Expectk, which uses long flag names, is \-version.) .PP Optional .I args are constructed into a list and stored in the variable named .IR argv . .I argc is initialized to the length of argv. .PP .I argv0 is defined to be the name of the script (or binary if no script is used). For example, the following prints out the name of the script and the first three arguments: .nf send_user "$argv0 [lrange $argv 0 2]\\n" .fi .SH COMMANDS .B Expect uses .I Tcl (Tool Command Language). Tcl provides control flow (e.g., if, for, break), expression evaluation and several other features such as recursion, procedure definition, etc. Commands used here but not defined (e.g., .BR set , .BR if , .BR exec ) are Tcl commands (see tcl(3)). .B Expect supports additional commands, described below. Unless otherwise specified, commands return the empty string. .PP Commands are listed alphabetically so that they can be quickly located. However, new users may find it easier to start by reading the descriptions of .BR spawn , .BR send , .BR expect , and .BR interact , in that order. Note that the best introduction to the language (both Expect and Tcl) is provided in the book "Exploring Expect" (see SEE ALSO below). Examples are included in this man page but they are very limited since this man page is meant primarily as reference material. Note that in the text of this man page, "Expect" with an uppercase "E" refers to the .B Expect program while "expect" with a lower-case "e" refers to the .B expect command within the .B Expect program.) .I .TP 6 .BI close " [-slave] [\-onexec 0|1] [\-i spawn_id]" closes the connection to the current process. Most interactive programs will detect EOF on their stdin and exit; thus .B close usually suffices to kill the process as well. The .B \-i flag declares the process to close corresponding to the named spawn_id. Both .B expect and .B interact will detect when the current process exits and implicitly do a .BR close . But if you kill the process by, say, "exec kill $pid", you will need to explicitly call .BR close . The .BR \-onexec flag determines whether the spawn id will be closed in any new spawned processes or if the process is overlayed. To leave a spawn id open, use the value 0. A non-zero integer value will force the spawn closed (the default) in any new processes. The .B \-slave flag closes the slave associated with the spawn id. (See "spawn -pty".) When the connection is closed, the slave is automatically closed as well if still open. No matter whether the connection is closed implicitly or explicitly, you should call .B wait to clear up the corresponding kernel process slot. .B close does not call .B wait since there is no guarantee that closing a process connection will cause it to exit. See .B wait below for more info. .TP .BI debug " [[-now] 0|1]" controls a Tcl debugger allowing you to step through statements, set breakpoints, etc. With no arguments, a 1 is returned if the debugger is not running, otherwise a 0 is returned. With a 1 argument, the debugger is started. With a 0 argument, the debugger is stopped. If a 1 argument is preceded by the .B \-now flag, the debugger is started immediately (i.e., in the middle of the .B debug command itself). Otherwise, the debugger is started with the next Tcl statement. The .B debug command does not change any traps. Compare this to starting Expect with the .B -D flag (see above). See the README file or SEE ALSO (below) for more information on the debugger. .TP .B disconnect disconnects a forked process from the terminal. It continues running in the background. The process is given its own process group (if possible). Standard I/O is redirected to /dev/null. .IP The following fragment uses .B disconnect to continue running the script in the background. .nf if {[fork]!=0} exit disconnect . . . .fi The following script reads a password, and then runs a program every hour that demands a password each time it is run. The script supplies the password so that you only have to type it once. (See the .B stty command which demonstrates how to turn off password echoing.) .nf send_user "password?\\ " expect_user -re "(.*)\\n" for {} 1 {} { if {[fork]!=0} {sleep 3600;continue} disconnect spawn priv_prog expect Password: send "$expect_out(1,string)\\r" . . . exit } .fi An advantage to using .B disconnect over the shell asynchronous process feature (&) is that .B Expect can save the terminal parameters prior to disconnection, and then later apply them to new ptys. With &, .B Expect does not have a chance to read the terminal's parameters since the terminal is already disconnected by the time .B Expect receives control. .TP .BI exit " [\-opts] [status]" causes .B Expect to exit or otherwise prepare to do so. The .B \-onexit flag causes the next argument to be used as an exit handler. Without an argument, the current exit handler is returned. The .B \-noexit flag causes .B Expect to prepare to exit but stop short of actually returning control to the operating system. The user-defined exit handler is run as well as Expect's own internal handlers. No further Expect commands should be executed. This is useful if you are running Expect with other Tcl extensions. The current interpreter (and main window if in the Tk environment) remain so that other Tcl extensions can clean up. If Expect's .B exit is called again (however this might occur), the handlers are not rerun. Upon exiting, all connections to spawned processes are closed. Closure will be detected as an EOF by spawned processes. .B exit takes no other actions beyond what the normal _exit(2) procedure does. Thus, spawned processes that do not check for EOF may continue to run. (A variety of conditions are important to determining, for example, what signals a spawned process will be sent, but these are system-dependent, typically documented under exit(3).) Spawned processes that continue to run will be inherited by init. .I status (or 0 if not specified) is returned as the exit status of .BR Expect . .B exit is implicitly executed if the end of the script is reached. .TP \fBexp_continue\fR [-continue_timer] The command .B exp_continue allows .B expect itself to continue executing rather than returning as it normally would. By default .B exp_continue resets the timeout timer. The .I -continue_timer flag prevents timer from being restarted. (See .B expect for more information.) .TP .BI exp_internal " [\-f file] value" causes further commands to send diagnostic information internal to .B Expect to stderr if .I value is non-zero. This output is disabled if .I value is 0. The diagnostic information includes every character received, and every attempt made to match the current output against the patterns. .IP If the optional .I file is supplied, all normal and debugging output is written to that file (regardless of the value of .IR value ). Any previous diagnostic output file is closed. The .B \-info flag causes exp_internal to return a description of the most recent non-info arguments given. .TP .BI exp_open " [args] [\-i spawn_id]" returns a Tcl file identifier that corresponds to the original spawn id. The file identifier can then be used as if it were opened by Tcl's .B open command. (The spawn id should no longer be used. A .B wait should not be executed. The .B \-leaveopen flag leaves the spawn id open for access through Expect commands. A .B wait must be executed on the spawn id. .TP .BI exp_pid " [\-i spawn_id]" returns the process id corresponding to the currently spawned process. If the .B \-i flag is used, the pid returned corresponds to that of the given spawn id. .TP .B exp_send is an alias for .BR send . .TP .B exp_send_error is an alias for .BR send_error . .TP .B exp_send_log is an alias for .BR send_log . .TP .B exp_send_tty is an alias for .BR send_tty . .TP .B exp_send_user is an alias for .BR send_user . .TP .BI exp_version " [[\-exit] version]" is useful for assuring that the script is compatible with the current version of Expect. .IP With no arguments, the current version of .B Expect is returned. This version may then be encoded in your script. If you actually know that you are not using features of recent versions, you can specify an earlier version. .IP Versions consist of three numbers separated by dots. First is the major number. Scripts written for versions of .B Expect with a different major number will almost certainly not work. .B exp_version returns an error if the major numbers do not match. .IP Second is the minor number. Scripts written for a version with a greater minor number than the current version may depend upon some new feature and might not run. .B exp_version returns an error if the major numbers match, but the script minor number is greater than that of the running .BR Expect . .IP Third is a number that plays no part in the version comparison. However, it is incremented when the .B Expect software distribution is changed in any way, such as by additional documentation or optimization. It is reset to 0 upon each new minor version. .IP With the .B \-exit flag, .B Expect prints an error and exits if the version is out of date. .TP .BI expect " [[\-opts] pat1 body1] ... [\-opts] patn [bodyn]" waits until one of the patterns matches the output of a spawned process, a specified time period has passed, or an end-of-file is seen. If the final body is empty, it may be omitted. .IP Patterns from the most recent .B expect_before command are implicitly used before any other patterns. Patterns from the most recent .B expect_after command are implicitly used after any other patterns. .IP If the arguments to the entire .B expect statement require more than one line, all the arguments may be "braced" into one so as to avoid terminating each line with a backslash. In this one case, the usual Tcl substitutions will occur despite the braces. .IP If a pattern is the keyword .BR eof , the corresponding body is executed upon end-of-file. If a pattern is the keyword .BR timeout , the corresponding body is executed upon timeout. If no timeout keyword is used, an implicit null action is executed upon timeout. The default timeout period is 10 seconds but may be set, for example to 30, by the command "set timeout 30". An infinite timeout may be designated by the value \-1. If a pattern is the keyword .BR default , the corresponding body is executed upon either timeout or end-of-file. .IP If a pattern matches, then the corresponding body is executed. .B expect returns the result of the body (or the empty string if no pattern matched). In the event that multiple patterns match, the one appearing first is used to select a body. .IP Each time new output arrives, it is compared to each pattern in the order they are listed. Thus, you may test for absence of a match by making the last pattern something guaranteed to appear, such as a prompt. In situations where there is no prompt, you must use .B timeout (just like you would if you were interacting manually). .IP Patterns are specified in three ways. By default, patterns are specified as with Tcl's .B string match command. (Such patterns are also similar to C-shell regular expressions usually referred to as "glob" patterns). The .B \-gl flag may may be used to protect patterns that might otherwise match .B expect flags from doing so. Any pattern beginning with a "-" should be protected this way. (All strings starting with "-" are reserved for future options.) .IP For example, the following fragment looks for a successful login. (Note that .B abort is presumed to be a procedure defined elsewhere in the script.) .nf .ta \w' expect 'u +\w'invalid password 'u expect { busy {puts busy\\n ; exp_continue} failed abort "invalid password" abort timeout abort connected } .fi Quotes are necessary on the fourth pattern since it contains a space, which would otherwise separate the pattern from the action. Patterns with the same action (such as the 3rd and 4th) require listing the actions again. This can be avoid by using regexp-style patterns (see below). More information on forming glob-style patterns can be found in the Tcl manual. .IP Regexp-style patterns follow the syntax defined by Tcl's .B regexp (short for "regular expression") command. regexp patterns are introduced with the flag .BR \-re . The previous example can be rewritten using a regexp as: .nf .ta \w' expect 'u +\w'connected 'u expect { busy {puts busy\\n ; exp_continue} \-re "failed|invalid password" abort timeout abort connected } .fi Both types of patterns are "unanchored". This means that patterns do not have to match the entire string, but can begin and end the match anywhere in the string (as long as everything else matches). Use ^ to match the beginning of a string, and $ to match the end. Note that if you do not wait for the end of a string, your responses can easily end up in the middle of the string as they are echoed from the spawned process. While still producing correct results, the output can look unnatural. Thus, use of $ is encouraged if you can exactly describe the characters at the end of a string. Note that in many editors, the ^ and $ match the beginning and end of lines respectively. However, because expect is not line oriented, these characters match the beginning and end of the data (as opposed to lines) currently in the expect matching buffer. (Also, see the note below on "system indigestion.") The .B \-ex flag causes the pattern to be matched as an "exact" string. No interpretation of *, ^, etc is made (although the usual Tcl conventions must still be observed). Exact patterns are always unanchored. .IP The .B \-nocase flag causes uppercase characters of the output to compare as if they were lowercase characters. The pattern is not affected. .IP While reading output, more than 2000 bytes can force earlier bytes to be "forgotten". This may be changed with the function .BR match_max . (Note that excessively large values can slow down the pattern matcher.) If .I patlist is .BR full_buffer , the corresponding body is executed if .I match_max bytes have been received and no other patterns have matched. Whether or not the .B full_buffer keyword is used, the forgotten characters are written to expect_out(buffer). If .I patlist is the keyword .BR null , and nulls are allowed (via the .B remove_nulls command), the corresponding body is executed if a single ASCII 0 is matched. It is not possible to match 0 bytes via glob or regexp patterns. Upon matching a pattern (or eof or full_buffer), any matching and previously unmatched output is saved in the variable .IR expect_out(buffer) . Up to 9 regexp substring matches are saved in the variables .I expect_out(1,string) through .IR expect_out(9,string) . If the .B -indices flag is used before a pattern, the starting and ending indices (in a form suitable for .BR lrange ) of the 10 strings are stored in the variables .I expect_out(X,start) and .I expect_out(X,end) where X is a digit, corresponds to the substring position in the buffer. 0 refers to strings which matched the entire pattern and is generated for glob patterns as well as regexp patterns. For example, if a process has produced output of "abcdefgh\\n", the result of: .nf expect "cd" .fi is as if the following statements had executed: .nf set expect_out(0,string) cd set expect_out(buffer) abcd .fi and "efgh\\n" is left in the output buffer. If a process produced the output "abbbcabkkkka\\n", the result of: .nf expect \-indices \-re "b(b*).*(k+)" .fi is as if the following statements had executed: .nf set expect_out(0,start) 1 set expect_out(0,end) 10 set expect_out(0,string) bbbcabkkkk set expect_out(1,start) 2 set expect_out(1,end) 3 set expect_out(1,string) bb set expect_out(2,start) 10 set expect_out(2,end) 10 set expect_out(2,string) k set expect_out(buffer) abbbcabkkkk .fi and "a\\n" is left in the output buffer. The pattern "*" (and -re ".*") will flush the output buffer without reading any more output from the process. .IP Normally, the matched output is discarded from Expect's internal buffers. This may be prevented by prefixing a pattern with the .B \-notransfer flag. This flag is especially useful in experimenting (and can be abbreviated to "-not" for convenience while experimenting). The spawn id associated with the matching output (or eof or full_buffer) is stored in .IR expect_out(spawn_id) . The .B \-timeout flag causes the current expect command to use the following value as a timeout instead of using the value of the timeout variable. By default, patterns are matched against output from the current process, however the .B \-i flag declares the output from the named spawn_id list be matched against any following patterns (up to the next .BR \-i ). The spawn_id list should either be a whitespace separated list of spawn_ids or a variable referring to such a list of spawn_ids. For example, the following example waits for "connected" from the current process, or "busy", "failed" or "invalid password" from the spawn_id named by $proc2. .nf expect { \-i $proc2 busy {puts busy\\n ; exp_continue} \-re "failed|invalid password" abort timeout abort connected } .fi The value of the global variable .I any_spawn_id may be used to match patterns to any spawn_ids that are named with all other .B \-i flags in the current .B expect command. The spawn_id from a .B \-i flag with no associated pattern (i.e., followed immediately by another .BR \-i ) is made available to any other patterns in the same .B expect command associated with .I any_spawn_id. The .B \-i flag may also name a global variable in which case the variable is read for a list of spawn ids. The variable is reread whenever it changes. This provides a way of changing the I/O source while the command is in execution. Spawn ids provided this way are called "indirect" spawn ids. Actions such as .B break and .B continue cause control structures (i.e., .BR for , .BR proc ) to behave in the usual way. The command .B exp_continue allows .B expect itself to continue executing rather than returning as it normally would. .IP This is useful for avoiding explicit loops or repeated expect statements. The following example is part of a fragment to automate rlogin. The .B exp_continue avoids having to write a second .B expect statement (to look for the prompt again) if the rlogin prompts for a password. .nf expect { Password: { stty -echo send_user "password (for $user) on $host: " expect_user -re "(.*)\\n" send_user "\\n" send "$expect_out(1,string)\\r" stty echo exp_continue } incorrect { send_user "invalid password or account\\n" exit } timeout { send_user "connection to $host timed out\\n" exit } eof { send_user \\ "connection to host failed: $expect_out(buffer)" exit } -re $prompt } .fi For example, the following fragment might help a user guide an interaction that is already totally automated. In this case, the terminal is put into raw mode. If the user presses "+", a variable is incremented. If "p" is pressed, several returns are sent to the process, perhaps to poke it in some way, and "i" lets the user interact with the process, effectively stealing away control from the script. In each case, the .B exp_continue allows the current .B expect to continue pattern matching after executing the current action. .nf stty raw \-echo expect_after { \-i $user_spawn_id "p" {send "\\r\\r\\r"; exp_continue} "+" {incr foo; exp_continue} "i" {interact; exp_continue} "quit" exit } .fi .IP By default, .B exp_continue resets the timeout timer. The timer is not restarted, if .B exp_continue is called with the .B \-continue_timer flag. .TP .BI expect_after " [expect_args]" works identically to the .B expect_before except that if patterns from both .B expect and .B expect_after can match, the .B expect pattern is used. See the .B expect_before command for more information. .TP .BI expect_background " [expect_args]" takes the same arguments as .BR expect , however it returns immediately. Patterns are tested whenever new input arrives. The pattern .B timeout and .B default are meaningless to .BR expect_background and are silently discarded. Otherwise, the .B expect_background command uses .B expect_before and .B expect_after patterns just like .B expect does. When .B expect_background actions are being evaluated, background processing for the same spawn id is blocked. Background processing is unblocked when the action completes. While background processing is blocked, it is possible to do a (foreground) .B expect on the same spawn id. It is not possible to execute an .B expect while an .B expect_background is unblocked. .B expect_background for a particular spawn id is deleted by declaring a new expect_background with the same spawn id. Declaring .B expect_background with no pattern removes the given spawn id from the ability to match patterns in the background. .TP .BI expect_before " [expect_args]" takes the same arguments as .BR expect , however it returns immediately. Pattern-action pairs from the most recent .B expect_before with the same spawn id are implicitly added to any following .B expect commands. If a pattern matches, it is treated as if it had been specified in the .B expect command itself, and the associated body is executed in the context of the .B expect command. If patterns from both .B expect_before and .B expect can match, the .B expect_before pattern is used. If no pattern is specified, the spawn id is not checked for any patterns. Unless overridden by a .B \-i flag, .B expect_before patterns match against the spawn id defined at the time that the .B expect_before command was executed (not when its pattern is matched). The \-info flag causes .B expect_before to return the current specifications of what patterns it will match. By default, it reports on the current spawn id. An optional spawn id specification may be given for information on that spawn id. For example .nf expect_before -info -i $proc .fi At most one spawn id specification may be given. The flag \-indirect suppresses direct spawn ids that come only from indirect specifications. Instead of a spawn id specification, the flag "-all" will cause "-info" to report on all spawn ids. The output of the \-info flag can be reused as the argument to expect_before. .TP .BI expect_tty " [expect_args]" is like .B expect but it reads characters from /dev/tty (i.e. keystrokes from the user). By default, reading is performed in cooked mode. Thus, lines must end with a return in order for .B expect to see them. This may be changed via .B stty (see the .B stty command below). .TP .BI expect_user " [expect_args]" is like .B expect but it reads characters from stdin (i.e. keystrokes from the user). By default, reading is performed in cooked mode. Thus, lines must end with a return in order for .B expect to see them. This may be changed via .B stty (see the .B stty command below). .TP .B fork creates a new process. The new process is an exact copy of the current .B Expect process. On success, .B fork returns 0 to the new (child) process and returns the process ID of the child process to the parent process. On failure (invariably due to lack of resources, e.g., swap space, memory), .B fork returns \-1 to the parent process, and no child process is created. .IP Forked processes exit via the .B exit command, just like the original process. Forked processes are allowed to write to the log files. If you do not disable debugging or logging in most of the processes, the result can be confusing. .IP Some pty implementations may be confused by multiple readers and writers, even momentarily. Thus, it is safest to .B fork before spawning processes. .TP .BI interact " [string1 body1] ... [stringn [bodyn]]" gives control of the current process to the user, so that keystrokes are sent to the current process, and the stdout and stderr of the current process are returned. .IP String-body pairs may be specified as arguments, in which case the body is executed when the corresponding string is entered. (By default, the string is not sent to the current process.) The .B interpreter command is assumed, if the final body is missing. .IP If the arguments to the entire .B interact statement require more than one line, all the arguments may be "braced" into one so as to avoid terminating each line with a backslash. In this one case, the usual Tcl substitutions will occur despite the braces. .IP For example, the following command runs interact with the following string-body pairs defined: When ^Z is pressed, .B Expect is suspended. (The .B \-reset flag restores the terminal modes.) When ^A is pressed, the user sees "you typed a control-A" and the process is sent a ^A. When $ is pressed, the user sees the date. When ^C is pressed, .B Expect exits. If "foo" is entered, the user sees "bar". When ~~ is pressed, the .B Expect interpreter runs interactively. .nf .ta \w' interact 'u +\w'$CTRLZ 'u +\w'{'u set CTRLZ \\032 interact { -reset $CTRLZ {exec kill \-STOP [pid]} \\001 {send_user "you typed a control\-A\\n"; send "\\001" } $ {send_user "The date is [clock format [clock seconds]]."} \\003 exit foo {send_user "bar"} ~~ } .fi .IP In string-body pairs, strings are matched in the order they are listed as arguments. Strings that partially match are not sent to the current process in anticipation of the remainder coming. If characters are then entered such that there can no longer possibly be a match, only the part of the string will be sent to the process that cannot possibly begin another match. Thus, strings that are substrings of partial matches can match later, if the original strings that was attempting to be match ultimately fails. .IP By default, string matching is exact with no wild cards. (In contrast, the .B expect command uses glob-style patterns by default.) The .B \-ex flag may be used to protect patterns that might otherwise match .B interact flags from doing so. Any pattern beginning with a "-" should be protected this way. (All strings starting with "-" are reserved for future options.) The .B \-re flag forces the string to be interpreted as a regexp-style pattern. In this case, matching substrings are stored in the variable .I interact_out similarly to the way .B expect stores its output in the variable .BR expect_out . The .B \-indices flag is similarly supported. The pattern .B eof introduces an action that is executed upon end-of-file. A separate .B eof pattern may also follow the .B \-output flag in which case it is matched if an eof is detected while writing output. The default .B eof action is "return", so that .B interact simply returns upon any EOF. The pattern .B timeout introduces a timeout (in seconds) and action that is executed after no characters have been read for a given time. The .B timeout pattern applies to the most recently specified process. There is no default timeout. The special variable "timeout" (used by the .B expect command) has no affect on this timeout. For example, the following statement could be used to autologout users who have not typed anything for an hour but who still get frequent system messages: .nf interact -input $user_spawn_id timeout 3600 return -output \\ $spawn_id .fi If the pattern is the keyword .BR null , and nulls are allowed (via the .B remove_nulls command), the corresponding body is executed if a single ASCII 0 is matched. It is not possible to match 0 bytes via glob or regexp patterns. Prefacing a pattern with the flag .B \-iwrite causes the variable .I interact_out(spawn_id) to be set to the spawn_id which matched the pattern (or eof). Actions such as .B break and .B continue cause control structures (i.e., .BR for , .BR proc ) to behave in the usual way. However .B return causes interact to return to its caller, while .B inter_return causes .B interact to cause a return in its caller. For example, if "proc foo" called .B interact which then executed the action .BR inter_return , .B proc foo would return. (This means that if .B interact calls .B interpreter interactively typing .B return will cause the interact to continue, while .B inter_return will cause the interact to return to its caller.) .IP During .BR interact , raw mode is used so that all characters may be passed to the current process. If the current process does not catch job control signals, it will stop if sent a stop signal (by default ^Z). To restart it, send a continue signal (such as by "kill \-CONT "). If you really want to send a SIGSTOP to such a process (by ^Z), consider spawning csh first and then running your program. On the other hand, if you want to send a SIGSTOP to .B Expect itself, first call interpreter (perhaps by using an escape character), and then press ^Z. .IP String-body pairs can be used as a shorthand for avoiding having to enter the interpreter and execute commands interactively. The previous terminal mode is used while the body of a string-body pair is being executed. .IP For speed, actions execute in raw mode by default. The .B \-reset flag resets the terminal to the mode it had before .B interact was executed (invariably, cooked mode). Note that characters entered when the mode is being switched may be lost (an unfortunate feature of the terminal driver on some systems). The only reason to use .B \-reset is if your action depends on running in cooked mode. .IP The .B \-echo flag sends characters that match the following pattern back to the process that generated them as each character is read. This may be useful when the user needs to see feedback from partially typed patterns. .IP If a pattern is being echoed but eventually fails to match, the characters are sent to the spawned process. If the spawned process then echoes them, the user will see the characters twice. .B \-echo is probably only appropriate in situations where the user is unlikely to not complete the pattern. For example, the following excerpt is from rftp, the recursive-ftp script, where the user is prompted to enter ~g, ~p, or ~l, to get, put, or list the current directory recursively. These are so far away from the normal ftp commands, that the user is unlikely to type ~ followed by anything else, except mistakenly, in which case, they'll probably just ignore the result anyway. .nf interact { -echo ~g {getcurdirectory 1} -echo ~l {getcurdirectory 0} -echo ~p {putcurdirectory} } .fi The .B \-nobuffer flag sends characters that match the following pattern on to the output process as characters are read. This is useful when you wish to let a program echo back the pattern. For example, the following might be used to monitor where a person is dialing (a Hayes-style modem). Each time "atd" is seen the script logs the rest of the line. .nf proc lognumber {} { interact -nobuffer -re "(.*)\\r" return puts $log "[clock format [clock seconds]]: dialed $interact_out(1,string)" } interact -nobuffer "atd" lognumber .fi .IP During .BR interact , previous use of .B log_user is ignored. In particular, .B interact will force its output to be logged (sent to the standard output) since it is presumed the user doesn't wish to interact blindly. .IP The .B \-o flag causes any following key-body pairs to be applied to the output of the current process. This can be useful, for example, when dealing with hosts that send unwanted characters during a telnet session. .IP By default, .B interact expects the user to be writing stdin and reading stdout of the .B Expect process itself. The .B \-u flag (for "user") makes .B interact look for the user as the process named by its argument (which must be a spawned id). .IP This allows two unrelated processes to be joined together without using an explicit loop. To aid in debugging, Expect diagnostics always go to stderr (or stdout for certain logging and debugging information). For the same reason, the .B interpreter command will read interactively from stdin. .IP For example, the following fragment creates a login process. Then it dials the user (not shown), and finally connects the two together. Of course, any process may be substituted for login. A shell, for example, would allow the user to work without supplying an account and password. .nf spawn login set login $spawn_id spawn tip modem # dial back out to user # connect user to login interact \-u $login .fi To send output to multiple processes, list each spawn id list prefaced by a .B \-output flag. Input for a group of output spawn ids may be determined by a spawn id list prefaced by a .B \-input flag. (Both .B \-input and .B \-output may take lists in the same form as the .B \-i flag in the .B expect command, except that any_spawn_id is not meaningful in .BR interact .) All following flags and strings (or patterns) apply to this input until another -input flag appears. If no .B \-input appears, .B \-output implies "\-input $user_spawn_id \-output". (Similarly, with patterns that do not have .BR \-input .) If one .B \-input is specified, it overrides $user_spawn_id. If a second .B \-input is specified, it overrides $spawn_id. Additional .B \-input flags may be specified. The two implied input processes default to having their outputs specified as $spawn_id and $user_spawn_id (in reverse). If a .B \-input flag appears with no .B \-output flag, characters from that process are discarded. The .B \-i flag introduces a replacement for the current spawn_id when no other .B \-input or .B \-output flags are used. A \-i flag implies a \-o flag. It is possible to change the processes that are being interacted with by using indirect spawn ids. (Indirect spawn ids are described in the section on the expect command.) Indirect spawn ids may be specified with the -i, -u, -input, or -output flags. .TP .B interpreter " [args]" causes the user to be interactively prompted for .B Expect and Tcl commands. The result of each command is printed. .IP Actions such as .B break and .B continue cause control structures (i.e., .BR for , .BR proc ) to behave in the usual way. However .B return causes interpreter to return to its caller, while .B inter_return causes .B interpreter to cause a return in its caller. For example, if "proc foo" called .B interpreter which then executed the action .BR inter_return , .B proc foo would return. Any other command causes .B interpreter to continue prompting for new commands. .IP By default, the prompt contains two integers. The first integer describes the depth of the evaluation stack (i.e., how many times Tcl_Eval has been called). The second integer is the Tcl history identifier. The prompt can be set by defining a procedure called "prompt1" whose return value becomes the next prompt. If a statement has open quotes, parens, braces, or brackets, a secondary prompt (by default "+> ") is issued upon newline. The secondary prompt may be set by defining a procedure called "prompt2". .IP During .BR interpreter , cooked mode is used, even if the its caller was using raw mode. .IP If stdin is closed, .B interpreter will return unless the .B \-eof flag is used, in which case the subsequent argument is invoked. .TP .BI log_file " [args] [[\-a] file]" If a filename is provided, .B log_file will record a transcript of the session (beginning at that point) in the file. .B log_file will stop recording if no argument is given. Any previous log file is closed. Instead of a filename, a Tcl file identifier may be provided by using the .B \-open or .B \-leaveopen flags. This is similar to the .B spawn command. (See .B spawn for more info.) The .B \-a flag forces output to be logged that was suppressed by the .B log_user command. By default, the .B log_file command .I appends to old files rather than truncating them, for the convenience of being able to turn logging off and on multiple times in one session. To truncate files, use the .B \-noappend flag. The .B -info flag causes log_file to return a description of the most recent non-info arguments given. .TP .BI log_user " -info|0|1" By default, the send/expect dialogue is logged to stdout (and a logfile if open). The logging to stdout is disabled by the command "log_user 0" and reenabled by "log_user 1". Logging to the logfile is unchanged. The .B -info flag causes log_user to return a description of the most recent non-info arguments given. .TP .BI match_max " [\-d] [\-i spawn_id] [size]" defines the size of the buffer (in bytes) used internally by .BR expect . With no .I size argument, the current size is returned. .IP With the .B \-d flag, the default size is set. (The initial default is 2000.) With the .B \-i flag, the size is set for the named spawn id, otherwise it is set for the current process. .TP .BI overlay " [\-# spawn_id] [\-# spawn_id] [...] program [args]" executes .IR "program args" in place of the current .B Expect program, which terminates. A bare hyphen argument forces a hyphen in front of the command name as if it was a login shell. All spawn_ids are closed except for those named as arguments. These are mapped onto the named file identifiers. .IP Spawn_ids are mapped to file identifiers for the new program to inherit. For example, the following line runs chess and allows it to be controlled by the current process \- say, a chess master. .nf overlay \-0 $spawn_id \-1 $spawn_id \-2 $spawn_id chess .fi This is more efficient than "interact \-u", however, it sacrifices the ability to do programmed interaction since the .B Expect process is no longer in control. .IP Note that no controlling terminal is provided. Thus, if you disconnect or remap standard input, programs that do job control (shells, login, etc) will not function properly. .TP .BI parity " [\-d] [\-i spawn_id] [value]" defines whether parity should be retained or stripped from the output of spawned processes. If .I value is zero, parity is stripped, otherwise it is not stripped. With no .I value argument, the current value is returned. .IP With the .B \-d flag, the default parity value is set. (The initial default is 1, i.e., parity is not stripped.) With the .B \-i flag, the parity value is set for the named spawn id, otherwise it is set for the current process. .TP .BI remove_nulls " [\-d] [\-i spawn_id] [value]" defines whether nulls are retained or removed from the output of spawned processes before pattern matching or storing in the variable .I expect_out or .IR interact_out . If .I value is 1, nulls are removed. If .I value is 0, nulls are not removed. With no .I value argument, the current value is returned. .IP With the .B \-d flag, the default value is set. (The initial default is 1, i.e., nulls are removed.) With the .B \-i flag, the value is set for the named spawn id, otherwise it is set for the current process. Whether or not nulls are removed, .B Expect will record null bytes to the log and stdout. .TP .BI send " [\-flags] string" Sends .IR string to the current process. For example, the command .nf send "hello world\\r" .fi sends the characters, h e l l o w o r l d to the current process. (Tcl includes a printf-like command (called .BR format ) which can build arbitrarily complex strings.) .IP Characters are sent immediately although programs with line-buffered input will not read the characters until a return character is sent. A return character is denoted "\\r". The .B \-\- flag forces the next argument to be interpreted as a string rather than a flag. Any string can be preceded by "\-\-" whether or not it actually looks like a flag. This provides a reliable mechanism to specify variable strings without being tripped up by those that accidentally look like flags. (All strings starting with "-" are reserved for future options.) The .B \-i flag declares that the string be sent to the named spawn_id. If the spawn_id is .IR user_spawn_id , and the terminal is in raw mode, newlines in the string are translated to return-newline sequences so that they appear as if the terminal was in cooked mode. The .B \-raw flag disables this translation. The .BR \-null flag sends null characters (0 bytes). By default, one null is sent. An integer may follow the .BR \-null to indicate how many nulls to send. The .B \-break flag generates a break condition. This only makes sense if the spawn id refers to a tty device opened via "spawn -open". If you have spawned a process such as tip, you should use tip's convention for generating a break. The .B \-s flag forces output to be sent "slowly", thus avoid the common situation where a computer outtypes an input buffer that was designed for a human who would never outtype the same buffer. This output is controlled by the value of the variable "send_slow" which takes a two element list. The first element is an integer that describes the number of bytes to send atomically. The second element is a real number that describes the number of seconds by which the atomic sends must be separated. For example, "set send_slow {10 .001}" would force "send \-s" to send strings with 1 millisecond in between each 10 characters sent. The .B \-h flag forces output to be sent (somewhat) like a human actually typing. Human-like delays appear between the characters. (The algorithm is based upon a Weibull distribution, with modifications to suit this particular application.) This output is controlled by the value of the variable "send_human" which takes a five element list. The first two elements are average interarrival time of characters in seconds. The first is used by default. The second is used at word endings, to simulate the subtle pauses that occasionally occur at such transitions. The third parameter is a measure of variability where .1 is quite variable, 1 is reasonably variable, and 10 is quite invariable. The extremes are 0 to infinity. The last two parameters are, respectively, a minimum and maximum interarrival time. The minimum and maximum are used last and "clip" the final time. The ultimate average can be quite different from the given average if the minimum and maximum clip enough values. As an example, the following command emulates a fast and consistent typist: .nf set send_human {.1 .3 1 .05 2} send \-h "I'm hungry. Let's do lunch." .fi while the following might be more suitable after a hangover: .nf set send_human {.4 .4 .2 .5 100} send \-h "Goodd party lash night!" .fi Note that errors are not simulated, although you can set up error correction situations yourself by embedding mistakes and corrections in a send argument. The flags for sending null characters, for sending breaks, for forcing slow output and for human-style output are mutually exclusive. Only the one specified last will be used. Furthermore, no .I string argument can be specified with the flags for sending null characters or breaks. It is a good idea to precede the first .B send to a process by an .BR expect . .B expect will wait for the process to start, while .B send cannot. In particular, if the first .B send completes before the process starts running, you run the risk of having your data ignored. In situations where interactive programs offer no initial prompt, you can precede .B send by a delay as in: .nf # To avoid giving hackers hints on how to break in, # this system does not prompt for an external password. # Wait for 5 seconds for exec to complete spawn telnet very.secure.gov sleep 5 send password\\r .fi .B exp_send is an alias for .BI send . If you are using Expectk or some other variant of Expect in the Tk environment, .B send is defined by Tk for an entirely different purpose. .B exp_send is provided for compatibility between environments. Similar aliases are provided for other Expect's other send commands. .TP .BI send_error " [\-flags] string" is like .BR send , except that the output is sent to stderr rather than the current process. .TP .BI send_log " [\--] string" is like .BR send , except that the string is only sent to the log file (see .BR log_file .) The arguments are ignored if no log file is open. .TP .BI send_tty " [\-flags] string" is like .BR send , except that the output is sent to /dev/tty rather than the current process. .TP .BI send_user " [\-flags] string" is like .BR send , except that the output is sent to stdout rather than the current process. .TP .BI sleep " seconds" causes the script to sleep for the given number of seconds. Seconds may be a decimal number. Interrupts (and Tk events if you are using Expectk) are processed while Expect sleeps. .TP .BI spawn " [args] program [args]" creates a new process running .IR "program args" . Its stdin, stdout and stderr are connected to Expect, so that they may be read and written by other .B Expect commands. The connection is broken by .B close or if the process itself closes any of the file identifiers. .IP When a process is started by .BR spawn , the variable .I spawn_id is set to a descriptor referring to that process. The process described by .I spawn_id is considered the .IR "current process" . .I spawn_id may be read or written, in effect providing job control. .IP .I user_spawn_id is a global variable containing a descriptor which refers to the user. For example, when .I spawn_id is set to this value, .B expect behaves like .BR expect_user . .I .I error_spawn_id is a global variable containing a descriptor which refers to the standard error. For example, when .I spawn_id is set to this value, .B send behaves like .BR send_error . .IP .I tty_spawn_id is a global variable containing a descriptor which refers to /dev/tty. If /dev/tty does not exist (such as in a cron, at, or batch script), then .I tty_spawn_id is not defined. This may be tested as: .nf if {[info vars tty_spawn_id]} { # /dev/tty exists } else { # /dev/tty doesn't exist # probably in cron, batch, or at script } .fi .IP .B spawn returns the UNIX process id. If no process is spawned, 0 is returned. The variable .I spawn_out(slave,name) is set to the name of the pty slave device. .IP By default, .B spawn echoes the command name and arguments. The .B \-noecho flag stops .B spawn from doing this. .IP The .B \-console flag causes console output to be redirected to the spawned process. This is not supported on all systems. Internally, .B spawn uses a pty, initialized the same way as the user's tty. This is further initialized so that all settings are "sane" (according to stty(1)). If the variable .I stty_init is defined, it is interpreted in the style of stty arguments as further configuration. For example, "set stty_init raw" will cause further spawned processes's terminals to start in raw mode. .B \-nottycopy skips the initialization based on the user's tty. .B \-nottyinit skips the "sane" initialization. .IP Normally, .B spawn takes little time to execute. If you notice spawn taking a significant amount of time, it is probably encountering ptys that are wedged. A number of tests are run on ptys to avoid entanglements with errant processes. (These take 10 seconds per wedged pty.) Running Expect with the .B \-d option will show if .B Expect is encountering many ptys in odd states. If you cannot kill the processes to which these ptys are attached, your only recourse may be to reboot. If .I program cannot be spawned successfully because exec(2) fails (e.g. when .I program doesn't exist), an error message will be returned by the next .B interact or .B expect command as if .I program had run and produced the error message as output. This behavior is a natural consequence of the implementation of .BR spawn . Internally, spawn forks, after which the spawned process has no way to communicate with the original .B Expect process except by communication via the spawn_id. The .B \-open flag causes the next argument to be interpreted as a Tcl file identifier (i.e., returned by .BR open .) The spawn id can then be used as if it were a spawned process. (The file identifier should no longer be used.) This lets you treat raw devices, files, and pipelines as spawned processes without using a pty. 0 is returned to indicate there is no associated process. When the connection to the spawned process is closed, so is the Tcl file identifier. The .B \-leaveopen flag is similar to .B \-open except that .B \-leaveopen causes the file identifier to be left open even after the spawn id is closed. The .B \-pty flag causes a pty to be opened but no process spawned. 0 is returned to indicate there is no associated process. Spawn_id is set as usual. The variable .I spawn_out(slave,fd) is set to a file identifier corresponding to the pty slave. It can be closed using "close -slave". The .B \-ignore flag names a signal to be ignored in the spawned process. Otherwise, signals get the default behavior. Signals are named as in the .B trap command, except that each signal requires a separate flag. .TP .BI strace " level" causes following statements to be printed before being executed. (Tcl's trace command traces variables.) .I level indicates how far down in the call stack to trace. For example, the following command runs .B Expect while tracing the first 4 levels of calls, but none below that. .nf expect \-c "strace 4" script.exp .fi The .B -info flag causes strace to return a description of the most recent non-info arguments given. .TP .BI stty " args" changes terminal modes similarly to the external stty command. By default, the controlling terminal is accessed. Other terminals can be accessed by appending "< /dev/tty..." to the command. (Note that the arguments should not be grouped into a single argument.) Requests for status return it as the result of the command. If no status is requested and the controlling terminal is accessed, the previous status of the raw and echo attributes are returned in a form which can later be used by the command. For example, the arguments .B raw or .B \-cooked put the terminal into raw mode. The arguments .B \-raw or .B cooked put the terminal into cooked mode. The arguments .B echo and .B \-echo put the terminal into echo and noecho mode respectively. .IP The following example illustrates how to temporarily disable echoing. This could be used in otherwise-automatic scripts to avoid embedding passwords in them. (See more discussion on this under EXPECT HINTS below.) .nf stty \-echo send_user "Password: " expect_user -re "(.*)\\n" set password $expect_out(1,string) stty echo .fi .TP .BI system " args" gives .I args to sh(1) as input, just as if it had been typed as a command from a terminal. .B Expect waits until the shell terminates. The return status from sh is handled the same way that .B exec handles its return status. .IP In contrast to .B exec which redirects stdin and stdout to the script, .B system performs no redirection (other than that indicated by the string itself). Thus, it is possible to use programs which must talk directly to /dev/tty. For the same reason, the results of .B system are not recorded in the log. .TP .BI timestamp " [args]" returns a timestamp. With no arguments, the number of seconds since the epoch is returned. The .B \-format flag introduces a string which is returned but with substitutions made according to the POSIX rules for strftime. For example %a is replaced by an abbreviated weekday name (i.e., Sat). Others are: .nf %a abbreviated weekday name %A full weekday name %b abbreviated month name %B full month name %c date-time as in: Wed Oct 6 11:45:56 1993 %d day of the month (01-31) %H hour (00-23) %I hour (01-12) %j day (001-366) %m month (01-12) %M minute (00-59) %p am or pm %S second (00-61) %u day (1-7, Monday is first day of week) %U week (00-53, first Sunday is first day of week one) %V week (01-53, ISO 8601 style) %w day (0-6) %W week (00-53, first Monday is first day of week one) %x date-time as in: Wed Oct 6 1993 %X time as in: 23:59:59 %y year (00-99) %Y year as in: 1993 %Z timezone (or nothing if not determinable) %% a bare percent sign .fi Other % specifications are undefined. Other characters will be passed through untouched. Only the C locale is supported. The .B \-seconds flag introduces a number of seconds since the epoch to be used as a source from which to format. Otherwise, the current time is used. The .B \-gmt flag forces timestamp output to use the GMT timezone. With no flag, the local timezone is used. .TP .BI trap " [[command] signals]" causes the given .I command to be executed upon future receipt of any of the given signals. The command is executed in the global scope. If .I command is absent, the signal action is returned. If .I command is the string SIG_IGN, the signals are ignored. If .I command is the string SIG_DFL, the signals are result to the system default. .I signals is either a single signal or a list of signals. Signals may be specified numerically or symbolically as per signal(3). The "SIG" prefix may be omitted. With no arguments (or the argument \-number), .B trap returns the signal number of the trap command currently being executed. The .B \-code flag uses the return code of the command in place of whatever code Tcl was about to return when the command originally started running. The .B \-interp flag causes the command to be evaluated using the interpreter active at the time the command started running rather than when the trap was declared. The .B \-name flag causes the .B trap command to return the signal name of the trap command currently being executed. The .B \-max flag causes the .B trap command to return the largest signal number that can be set. For example, the command "trap {send_user "Ouch!"} SIGINT" will print "Ouch!" each time the user presses ^C. By default, SIGINT (which can usually be generated by pressing ^C) and SIGTERM cause Expect to exit. This is due to the following trap, created by default when Expect starts. .nf trap exit {SIGINT SIGTERM} .fi If you use the -D flag to start the debugger, SIGINT is redefined to start the interactive debugger. This is due to the following trap: .nf trap {exp_debug 1} SIGINT .fi The debugger trap can be changed by setting the environment variable EXPECT_DEBUG_INIT to a new trap command. You can, of course, override both of these just by adding trap commands to your script. In particular, if you have your own "trap exit SIGINT", this will override the debugger trap. This is useful if you want to prevent users from getting to the debugger at all. If you want to define your own trap on SIGINT but still trap to the debugger when it is running, use: .nf if {![exp_debug]} {trap mystuff SIGINT} .fi Alternatively, you can trap to the debugger using some other signal. .B trap will not let you override the action for SIGALRM as this is used internally to .BR Expect . The disconnect command sets SIGALRM to SIG_IGN (ignore). You can reenable this as long as you disable it during subsequent spawn commands. See signal(3) for more info. .TP .BI wait " [args]" delays until a spawned process (or the current process if none is named) terminates. .IP .B wait normally returns a list of four integers. The first integer is the pid of the process that was waited upon. The second integer is the corresponding spawn id. The third integer is -1 if an operating system error occurred, or 0 otherwise. If the third integer was 0, the fourth integer is the status returned by the spawned process. If the third integer was -1, the fourth integer is the value of errno set by the operating system. The global variable errorCode is also set. Additional elements may appear at the end of the return value from .BR wait . An optional fifth element identifies a class of information. Currently, the only possible value for this element is CHILDKILLED in which case the next two values are the C-style signal name and a short textual description. .IP The .B \-i flag declares the process to wait corresponding to the named spawn_id (NOT the process id). Inside a SIGCHLD handler, it is possible to wait for any spawned process by using the spawn id -1. The .B \-nowait flag causes the wait to return immediately with the indication of a successful wait. When the process exits (later), it will automatically disappear without the need for an explicit wait. The .B wait command may also be used wait for a forked process using the arguments "-i -1". Unlike its use with spawned processes, this command can be executed at any time. There is no control over which process is reaped. However, the return value can be checked for the process id. .SH LIBRARIES Expect automatically knows about two built-in libraries for Expect scripts. These are defined by the directories named in the variables exp_library and exp_exec_library. Both are meant to contain utility files that can be used by other scripts. exp_library contains architecture-independent files. exp_exec_library contains architecture-dependent files. Depending on your system, both directories may be totally empty. The existence of the file $exp_exec_library/cat-buffers describes whether your /bin/cat buffers by default. .SH PRETTY-PRINTING A vgrind definition is available for pretty-printing .B Expect scripts. Assuming the vgrind definition supplied with the .B Expect distribution is correctly installed, you can use it as: .nf vgrind \-lexpect file .fi .SH EXAMPLES It many not be apparent how to put everything together that the man page describes. I encourage you to read and try out the examples in the example directory of the .B Expect distribution. Some of them are real programs. Others are simply illustrative of certain techniques, and of course, a couple are just quick hacks. The INSTALL file has a quick overview of these programs. .PP The .B Expect papers (see SEE ALSO) are also useful. While some papers use syntax corresponding to earlier versions of Expect, the accompanying rationales are still valid and go into a lot more detail than this man page. .SH CAVEATS Extensions may collide with Expect's command names. For example, .B send is defined by Tk for an entirely different purpose. For this reason, most of the .B Expect commands are also available as "exp_XXXX". Commands and variables beginning with "exp", "inter", "spawn", and "timeout" do not have aliases. Use the extended command names if you need this compatibility between environments. .B Expect takes a rather liberal view of scoping. In particular, variables read by commands specific to the .B Expect program will be sought first from the local scope, and if not found, in the global scope. For example, this obviates the need to place "global timeout" in every procedure you write that uses .BR expect . On the other hand, variables written are always in the local scope (unless a "global" command has been issued). The most common problem this causes is when spawn is executed in a procedure. Outside the procedure, .I spawn_id no longer exists, so the spawned process is no longer accessible simply because of scoping. Add a "global spawn_id" to such a procedure. If you cannot enable the multispawning capability (i.e., your system supports neither select (BSD *.*), poll (SVR>2), nor something equivalent), .B Expect will only be able to control a single process at a time. In this case, do not attempt to set .IR spawn_id , nor should you execute processes via exec while a spawned process is running. Furthermore, you will not be able to .B expect from multiple processes (including the user as one) at the same time. Terminal parameters can have a big effect on scripts. For example, if a script is written to look for echoing, it will misbehave if echoing is turned off. For this reason, Expect forces sane terminal parameters by default. Unfortunately, this can make things unpleasant for other programs. As an example, the emacs shell wants to change the "usual" mappings: newlines get mapped to newlines instead of carriage-return newlines, and echoing is disabled. This allows one to use emacs to edit the input line. Unfortunately, Expect cannot possibly guess this. You can request that Expect not override its default setting of terminal parameters, but you must then be very careful when writing scripts for such environments. In the case of emacs, avoid depending upon things like echoing and end-of-line mappings. The commands that accepted arguments braced into a single list (the .B expect variants and .BR interact ) use a heuristic to decide if the list is actually one argument or many. The heuristic can fail only in the case when the list actually does represent a single argument which has multiple embedded \\n's with non-whitespace characters between them. This seems sufficiently improbable, however the argument "\-nobrace" can be used to force a single argument to be handled as a single argument. This could conceivably be used with machine-generated Expect code. Similarly, -brace forces a single argument to be handle as multiple patterns/actions. .SH BUGS It was really tempting to name the program "sex" (for either "Smart EXec" or "Send-EXpect"), but good sense (or perhaps just Puritanism) prevailed. On some systems, when a shell is spawned, it complains about not being able to access the tty but runs anyway. This means your system has a mechanism for gaining the controlling tty that .B Expect doesn't know about. Please find out what it is, and send this information back to me. Ultrix 4.1 (at least the latest versions around here) considers timeouts of above 1000000 to be equivalent to 0. Digital UNIX 4.0A (and probably other versions) refuses to allocate ptys if you define a SIGCHLD handler. See grantpt page for more info. IRIX 6.0 does not handle pty permissions correctly so that if Expect attempts to allocate a pty previously used by someone else, it fails. Upgrade to IRIX 6.1. Telnet (verified only under SunOS 4.1.2) hangs if TERM is not set. This is a problem under cron, at and in cgi scripts, which do not define TERM. Thus, you must set it explicitly - to what type is usually irrelevant. It just has to be set to something! The following probably suffices for most cases. .nf set env(TERM) vt100 .fi Tip (verified only under BSDI BSD/OS 3.1 i386) hangs if SHELL and HOME are not set. This is a problem under cron, at and in cgi scripts, which do not define these environment variables. Thus, you must set them explicitly - to what type is usually irrelevant. It just has to be set to something! The following probably suffices for most cases. .nf set env(SHELL) /bin/sh set env(HOME) /usr/local/bin .fi Some implementations of ptys are designed so that the kernel throws away any unread output after 10 to 15 seconds (actual number is implementation-dependent) after the process has closed the file descriptor. Thus .B Expect programs such as .nf spawn date sleep 20 expect .fi will fail. To avoid this, invoke non-interactive programs with .B exec rather than .BR spawn . While such situations are conceivable, in practice I have never encountered a situation in which the final output of a truly interactive program would be lost due to this behavior. On the other hand, Cray UNICOS ptys throw away any unread output immediately after the process has closed the file descriptor. I have reported this to Cray and they are working on a fix. Sometimes a delay is required between a prompt and a response, such as when a tty interface is changing UART settings or matching baud rates by looking for start/stop bits. Usually, all this is require is to sleep for a second or two. A more robust technique is to retry until the hardware is ready to receive input. The following example uses both strategies: .nf send "speed 9600\\r"; sleep 1 expect { timeout {send "\\r"; exp_continue} $prompt } .fi trap \-code will not work with any command that sits in Tcl's event loop, such as sleep. The problem is that in the event loop, Tcl discards the return codes from async event handlers. A workaround is to set a flag in the trap code. Then check the flag immediately after the command (i.e., sleep). The expect_background command ignores -timeout arguments and has no concept of timeouts in general. .SH "EXPECT HINTS" There are a couple of things about .B Expect that may be non-intuitive. This section attempts to address some of these things with a couple of suggestions. A common expect problem is how to recognize shell prompts. Since these are customized differently by differently people and different shells, portably automating rlogin can be difficult without knowing the prompt. A reasonable convention is to have users store a regular expression describing their prompt (in particular, the end of it) in the environment variable EXPECT_PROMPT. Code like the following can be used. If EXPECT_PROMPT doesn't exist, the code still has a good chance of functioning correctly. .nf set prompt "(%|#|\\\\$) $" ;# default prompt catch {set prompt $env(EXPECT_PROMPT)} expect -re $prompt .fi I encourage you to write .B expect patterns that include the end of whatever you expect to see. This avoids the possibility of answering a question before seeing the entire thing. In addition, while you may well be able to answer questions before seeing them entirely, if you answer early, your answer may appear echoed back in the middle of the question. In other words, the resulting dialogue will be correct but look scrambled. Most prompts include a space character at the end. For example, the prompt from ftp is 'f', 't', 'p', '>' and . To match this prompt, you must account for each of these characters. It is a common mistake not to include the blank. Put the blank in explicitly. If you use a pattern of the form X*, the * will match all the output received from the end of X to the last thing received. This sounds intuitive but can be somewhat confusing because the phrase "last thing received" can vary depending upon the speed of the computer and the processing of I/O both by the kernel and the device driver. .PP In particular, humans tend to see program output arriving in huge chunks (atomically) when in reality most programs produce output one line at a time. Assuming this is the case, the * in the pattern of the previous paragraph may only match the end of the current line even though there seems to be more, because at the time of the match that was all the output that had been received. .PP .B expect has no way of knowing that further output is coming unless your pattern specifically accounts for it. .PP Even depending on line-oriented buffering is unwise. Not only do programs rarely make promises about the type of buffering they do, but system indigestion can break output lines up so that lines break at seemingly random places. Thus, if you can express the last few characters of a prompt when writing patterns, it is wise to do so. If you are waiting for a pattern in the last output of a program and the program emits something else instead, you will not be able to detect that with the .B timeout keyword. The reason is that .B expect will not timeout \- instead it will get an .B eof indication. Use that instead. Even better, use both. That way if that line is ever moved around, you won't have to edit the line itself. Newlines are usually converted to carriage return, linefeed sequences when output by the terminal driver. Thus, if you want a pattern that explicitly matches the two lines, from, say, printf("foo\\nbar"), you should use the pattern "foo\\r\\nbar". .PP A similar translation occurs when reading from the user, via .BR expect_user . In this case, when you press return, it will be translated to a newline. If .B Expect then passes that to a program which sets its terminal to raw mode (like telnet), there is going to be a problem, as the program expects a true return. (Some programs are actually forgiving in that they will automatically translate newlines to returns, but most don't.) Unfortunately, there is no way to find out that a program put its terminal into raw mode. .PP Rather than manually replacing newlines with returns, the solution is to use the command "stty raw", which will stop the translation. Note, however, that this means that you will no longer get the cooked line-editing features. .PP .B interact implicitly sets your terminal to raw mode so this problem will not arise then. It is often useful to store passwords (or other private information) in .B Expect scripts. This is not recommended since anything that is stored on a computer is susceptible to being accessed by anyone. Thus, interactively prompting for passwords from a script is a smarter idea than embedding them literally. Nonetheless, sometimes such embedding is the only possibility. .PP Unfortunately, the UNIX file system has no direct way of creating scripts which are executable but unreadable. Systems which support setgid shell scripts may indirectly simulate this as follows: .PP Create the .B Expect script (that contains the secret data) as usual. Make its permissions be 750 (\-rwxr\-x\-\-\-) and owned by a trusted group, i.e., a group which is allowed to read it. If necessary, create a new group for this purpose. Next, create a /bin/sh script with permissions 2751 (\-rwxr\-s\-\-x) owned by the same group as before. .PP The result is a script which may be executed (and read) by anyone. When invoked, it runs the .B Expect script. .SH "SEE ALSO" .BR Tcl (3), .BR libexpect (3) .br .I "Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" \fRby Don Libes, pp. 602, ISBN 1-56592-090-2, O'Reilly and Associates, 1995. .br .I "expect: Curing Those Uncontrollable Fits of Interactivity" \fRby Don Libes, Proceedings of the Summer 1990 USENIX Conference, Anaheim, California, June 11-15, 1990. .br .I "Using .B expect to Automate System Administration Tasks" \fRby Don Libes, Proceedings of the 1990 USENIX Large Installation Systems Administration Conference, Colorado Springs, Colorado, October 17-19, 1990. .br .I "Tcl: An Embeddable Command Language" \fRby John Ousterhout, Proceedings of the Winter 1990 USENIX Conference, Washington, D.C., January 22-26, 1990. .br .I "expect: Scripts for Controlling Interactive Programs" \fRby Don Libes, Computing Systems, Vol. 4, No. 2, University of California Press Journals, November 1991. .br .I "Regression Testing and Conformance Testing Interactive Programs", \fRby Don Libes, Proceedings of the Summer 1992 USENIX Conference, pp. 135-144, San Antonio, TX, June 12-15, 1992. .br .I "Kibitz \- Connecting Multiple Interactive Programs Together", \fRby Don Libes, Software \- Practice & Experience, John Wiley & Sons, West Sussex, England, Vol. 23, No. 5, May, 1993. .br .I "A Debugger for Tcl Applications", \fRby Don Libes, Proceedings of the 1993 Tcl/Tk Workshop, Berkeley, CA, June 10-11, 1993. .SH AUTHOR Don Libes, National Institute of Standards and Technology .SH ACKNOWLEDGMENTS Thanks to John Ousterhout for Tcl, and Scott Paisley for inspiration. Thanks to Rob Savoye for Expect's autoconfiguration code. .PP The HISTORY file documents much of the evolution of .BR expect . It makes interesting reading and might give you further insight to this software. Thanks to the people mentioned in it who sent me bug fixes and gave other assistance. .PP Design and implementation of .B Expect was paid for in part by the U.S. government and is therefore in the public domain. However the author and NIST would like credit if this program and documentation or portions of them are used. expect5.45.4/expect_comm.h0000664000175000017500000000434313235134350016007 0ustar pysslingpyssling/* expectcomm.h - public symbols common to both expect.h and expect_tcl.h Written by: Don Libes, libes@cme.nist.gov, NIST, 12/3/90 Design and implementation of this program was paid for by U.S. tax dollars. Therefore it is public domain. However, the author and NIST would appreciate credit if this program or parts of it are used. */ #ifndef _EXPECT_COMM_H #define _EXPECT_COMM_H /* common return codes for Expect functions */ /* The library actually only uses TIMEOUT and EOF */ #define EXP_ABEOF -1 /* abnormal eof in Expect */ /* when in library, this define is not used. */ /* Instead "-1" is used literally in the */ /* usual sense to check errors in system */ /* calls */ #define EXP_TIMEOUT -2 #define EXP_TCLERROR -3 #define EXP_FULLBUFFER -5 #define EXP_MATCH -6 #define EXP_NOMATCH -7 #define EXP_CANTMATCH EXP_NOMATCH #define EXP_CANMATCH -8 #define EXP_DATA_NEW -9 /* if select says there is new data */ #define EXP_DATA_OLD -10 /* if we already read data in another cmd */ #define EXP_EOF -11 #define EXP_RECONFIGURE -12 /* changes to indirect spawn id lists */ /* require us to reconfigure things */ /* in the unlikely event that a signal handler forces us to return this */ /* through expect's read() routine, we temporarily convert it to this. */ #define EXP_TCLRET -20 #define EXP_TCLCNT -21 #define EXP_TCLCNTTIMER -22 #define EXP_TCLBRK -23 #define EXP_TCLCNTEXP -24 #define EXP_TCLRETTCL -25 /* yet more TCL return codes */ /* Tcl does not safely provide a way to define the values of these, so */ /* use ridiculously different numbers for safety */ #define EXP_CONTINUE -101 /* continue expect command */ /* and restart timer */ #define EXP_CONTINUE_TIMER -102 /* continue expect command */ /* and continue timer */ #define EXP_TCL_RETURN -103 /* converted by interact */ /* and interpeter from */ /* inter_return into */ /* TCL_RETURN*/ /* * Everything below here should eventually be moved into expect.h * and Expect-thread-safe variables. */ EXTERN char *exp_pty_error; /* place to pass a string generated */ /* deep in the innards of the pty */ /* code but needed by anyone */ EXTERN int exp_disconnected; /* proc. disc'd from controlling tty */ #endif /* _EXPECT_COMM_H */ expect5.45.4/tests/0000755000175000017500000000000013235563420014473 5ustar pysslingpysslingexpect5.45.4/tests/cat.test0000644000175000017500000000133513235134350016141 0ustar pysslingpyssling# Commands covered: cat (UNIX) # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest # do this in a way that is backward compatible for Tcl 8.3 namespace import ::tcltest::test ::tcltest::cleanupTests } package require Expect #exp_internal -f /dev/ttyp5 0 catch {unset x} log_user 0 test cat-1.1 {basic cat operation} { exp_spawn cat -u exp_send "\r" set timeout 10 expect \r {set x 1} timeout {set x 0} exp_close exp_wait set x } {1} #exp_internal 0 cleanupTests return expect5.45.4/tests/all.tcl0000644000175000017500000000116713235134350015750 0ustar pysslingpyssling# all.tcl -- # # This file contains a top-level script to run all of the Tcl # tests. Execute it by invoking "source all" when running tclTest # in this directory. package require tcltest # do this in a way that is backward compatible for Tcl 8.3 namespace import ::tcltest::test ::tcltest::cleanupTests package require Expect set ::tcltest::testSingleFile false set ::tcltest::testsDirectory [file dirname [info script]] foreach file [lsort [::tcltest::getMatchingFiles]] { set tail [file tail $file] puts stdout $tail if {[catch {source $file} msg]} { puts stdout $msg } } ::tcltest::cleanupTests 1 return expect5.45.4/tests/send.test0000644000175000017500000000160213235134350016320 0ustar pysslingpyssling# Commands covered: send # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest # do this in a way that is backward compatible for Tcl 8.3 namespace import ::tcltest::test ::tcltest::cleanupTests } package require Expect log_user 0 #exp_internal -f /dev/ttyp5 0 test send-1.1 {basic send operation} { spawn cat after 1000 send "foo\r" expect foo after 1000 send "\u0004" expect eof regexp "\r\nfoo\r\n" $expect_out(buffer) } {1} test send-1.2 {send null} { spawn od -c send "a\u0000b\r" after 1000 send \u0004 expect eof regexp "a \\\\0 b" $expect_out(buffer) } {1} cleanupTests return expect5.45.4/tests/README0000644000175000017500000001137513235134350015356 0ustar pysslingpysslingExpect Test Suite ----------------- This directory contains a set of validation tests for the Expect commands. Each of the files whose name ends in ".test" is intended to fully exercise one or a few Expect commands. The commands tested by a given file are listed in the first line of the file. You can run the tests in three ways: (a) type "make test" in the parent directory to this one; this will run all of the tests. (b) type "expect ?