[Patches] openpty() and forkpty()

Thomas Wouters thomas@xs4all.net
Sun, 4 Jun 2000 02:09:46 +0200


--cNdxnHkX5QqsyA0e
Content-Type: text/plain; charset=us-ascii


Attached is a patch to add openpty() and forkpty() functions to the posix
module, if the target platform supports them.

openpty() is available on at least glibc-2.1 based (Linux) systems, and BSDI
and FreeBSD. I suspect other BSD-alike operating systems have it too, but
I'm not in a position to find out. On the systems that have it, openpty() is
the 'proper' way to obtain a new pseudo-terminal master/slave pair,
especially on Linux 2.1+ systems that use the Unix98 pty's (RedHat in any
case, and probably most other distributions too.) I am not sure how standard
Unix98 pty's are, but autoconf should at least be able to figure out which
systems have openpty.

forkpty() is a combination of openpty() and fork(), and basically does
exactly what pty.fork() already does. My only reason for including it is
symmetry. I also included 'configure' in the patch, which constitutes by far
most of it. The actual changes are minimal, but I thought I'd include the
configure patch for those who do not have autoconf. (BSDI, for instance ;P)

I haven't patched Lib/pty.py yet, mostly because I dont want to go through
the effort of rewriting it and figuring out wether 'master_open' and
'slave_open' are meant to be part of the interface or not, until I get some
positive feedback on this patch (or at least not too much negative feedback.
;)

For the record, in BSDI 4.x at least, openpty() is implemented as a function
that does exactly what pty.py currently does. But as it's a shared library,
using openpty() should be preferred. (We currently run a few BSDI systems
that need more than 256 terminals, and we had to change the name scheme to
accomodate. The old names are available, but still overused.) On Linux 2.1+
with Unix98 pty's configured, openpty() does something entirely different.

Also, I've included the info pages on these two functions, from glibc 2.1,
after the standard disclaimer. (There is no manpage on these functions, at
least not on BSDI and Linux.)


           I confirm that, to the best of my knowledge and belief, this
           contribution is free of any claims of third parties under
           copyright, patent or other rights or interests ("claims").  To
           the extent that I have any such claims, I hereby grant to CNRI a
           nonexclusive, irrevocable, royalty-free, worldwide license to
           reproduce, distribute, perform and/or display publicly, prepare
           derivative versions, and otherwise use this contribution as part
           of the Python software and its related documentation, or any
           derivative versions thereof, at no cost to CNRI or its licensed
           users, and to authorize others to do so.

           I acknowledge that CNRI may, at its sole discretion, decide
           whether or not to incorporate this contribution in the Python
           software and its related documentation.  I further grant CNRI
           permission to use my name and other identifying information
           provided to CNRI by me for use in connection with the Python
           software and its related documentation.


Opening a Pseudo-Terminal Pair
------------------------------

   These functions, derived from BSD, are available in the separate
`libutil' library, and declared in `pty.h'.

 - Function: int openpty (int *AMASTER, int *ASLAVE, char *NAME, struct
          termios *TERMP, struct winsize *WINP)
     This function allocates and opens a pseudo-terminal pair,
     returning the file descriptor for the master in *AMASTER, and the
     file descriptor for the slave in *ASLAVE.  If the argument NAME is
     not a null pointer, the file name of the slave pseudo-terminal
     device is stored in `*name'.  If TERMP is not a null pointer, the
     terminal attributes of the slave are set to the ones specified in
     the structure that TERMP points to (*note Terminal Modes::.).
     Likewise, if the WINP is not a null pointer, the screen size of
     the slave is set to the values specified in the structure that
     WINP points to.

     The normal return value from `openpty' is 0; a value of -1 is
     returned in case of failure.  The following `errno' conditions are
     defined for this function:

    `ENOENT'
          There are no free pseudo-terminal pairs available.

     *Warning:* Using the `openpty' function with NAME not set to
     `NULL' is *very dangerous* because it provides no protection
     against overflowing the string NAME.  You should use the `ttyname'
     function on the file descriptor returned in *SLAVE to find out the
     file name of the slave pseudo-terminal device instead.

 - Function: int forkpty (int *AMASTER, char *NAME, struct termios
          *TERMP, struct winsize *WINP)
     This function is similar to the `openpty' function, but in
     addition, forks a new process (*note Creating a Process::.) and
     makes the newly opened slave pseudo-terminal device the
     controlling terminal (*note Controlling Terminal::.) for the child
     process.

     If the operation is successful, there are then both parent and
     child processes and both see `forkpty' return, but with different
     values: it returns a value of 0 in the child process and returns
     the child's process ID in the parent process.

     If the allocation of a pseudo-terminal pair or the process creation
     failed, `forkpty' returns a value of -1 in the parent process.

     *Warning:* The `forkpty' function has the same problems with
     respect to the NAME argument as `openpty'.


-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

--cNdxnHkX5QqsyA0e
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="openpty.diff"

Index: config.h.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/config.h.in,v
retrieving revision 2.55
diff -c -r2.55 config.h.in
*** config.h.in	2000/05/11 18:41:31	2.55
--- config.h.in	2000/06/03 23:37:03
***************
*** 471,476 ****
--- 471,482 ----
  /* Define if you have the waitpid function.  */
  #undef HAVE_WAITPID
  
+ /* Define if you have the openpty function.  */
+ #undef HAVE_OPENPTY
+ 
+ /* Define if you have the forkpty function.  */
+ #undef HAVE_FORKPTY
+ 
  /* Define if you have the <dirent.h> header file.  */
  #undef HAVE_DIRENT_H
  
Index: configure
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure,v
retrieving revision 1.116
diff -c -r1.116 configure
*** configure	2000/05/26 12:22:54	1.116
--- configure	2000/06/03 23:37:06
***************
*** 1,6 ****
  #! /bin/sh
  
! # From configure.in Revision: 1.123 
  
  # Guess values for system-dependent variables and create Makefiles.
  # Generated automatically using autoconf version 2.13 
--- 1,6 ----
  #! /bin/sh
  
! # From configure.in Revision: 1.124 
  
  # Guess values for system-dependent variables and create Makefiles.
  # Generated automatically using autoconf version 2.13 
***************
*** 3594,3609 ****
  done
  
  
  # check for long file support functions
  for ac_func in fseek64 fseeko fstatvfs ftell64 ftello statvfs
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:3602: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3607 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
--- 3594,3808 ----
  done
  
  
+ # check for openpty and forkpty
+ 
+ for ac_func in openpty
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:3603: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 3608 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+ #include <assert.h>
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char $ac_func();
+ 
+ int main() {
+ 
+ /* 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_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ $ac_func();
+ #endif
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:3631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=no"
+ fi
+ rm -f conftest*
+ fi
+ 
+ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_func 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for openpty in -lutil""... $ac_c" 1>&6
+ echo "configure:3653: checking for openpty in -lutil" >&5
+ ac_lib_var=`echo util'_'openpty | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   ac_save_LIBS="$LIBS"
+ LIBS="-lutil  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 3661 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char openpty();
+ 
+ int main() {
+ openpty()
+ ; return 0; }
+ EOF
+ if { (eval echo configure:3672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=no"
+ fi
+ rm -f conftest*
+ LIBS="$ac_save_LIBS"
+ 
+ fi
+ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+   cat >> confdefs.h <<\EOF
+ #define HAVE_OPENPTY 1
+ EOF
+  LIBS="$LIBS -lutil"
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ fi
+ done
+ 
+ for ac_func in forkpty
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+ echo "configure:3701: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   cat > conftest.$ac_ext <<EOF
+ #line 3706 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+     which can conflict with char $ac_func(); below.  */
+ #include <assert.h>
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char $ac_func();
+ 
+ int main() {
+ 
+ /* 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_$ac_func) || defined (__stub___$ac_func)
+ choke me
+ #else
+ $ac_func();
+ #endif
+ 
+ ; return 0; }
+ EOF
+ if { (eval echo configure:3729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_func_$ac_func=no"
+ fi
+ rm -f conftest*
+ fi
+ 
+ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+     ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+   cat >> confdefs.h <<EOF
+ #define $ac_tr_func 1
+ EOF
+  
+ else
+   echo "$ac_t""no" 1>&6
+ echo $ac_n "checking for forkpty in -lutil""... $ac_c" 1>&6
+ echo "configure:3751: checking for forkpty in -lutil" >&5
+ ac_lib_var=`echo util'_'forkpty | sed 'y%./+-%__p_%'`
+ if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   ac_save_LIBS="$LIBS"
+ LIBS="-lutil  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 3759 "configure"
+ #include "confdefs.h"
+ /* Override any gcc2 internal prototype to avoid an error.  */
+ /* We use char because int might match the return type of a gcc2
+     builtin and then its argument prototype would still apply.  */
+ char forkpty();
+ 
+ int main() {
+ forkpty()
+ ; return 0; }
+ EOF
+ if { (eval echo configure:3770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=yes"
+ else
+   echo "configure: failed program was:" >&5
+   cat conftest.$ac_ext >&5
+   rm -rf conftest*
+   eval "ac_cv_lib_$ac_lib_var=no"
+ fi
+ rm -f conftest*
+ LIBS="$ac_save_LIBS"
+ 
+ fi
+ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+   echo "$ac_t""yes" 1>&6
+   cat >> confdefs.h <<\EOF
+ #define HAVE_FORKPTY 1
+ EOF
+  LIBS="$LIBS -lutil"
+ else
+   echo "$ac_t""no" 1>&6
+ fi
+ 
+ fi
+ done
+ 
+ 
  # check for long file support functions
  for ac_func in fseek64 fseeko fstatvfs ftell64 ftello statvfs
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:3801: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3806 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
***************
*** 3626,3632 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:3630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
--- 3825,3831 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:3829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
***************
*** 3654,3665 ****
  for ac_func in dup2 getcwd strdup strerror memmove
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:3658: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3663 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
--- 3853,3864 ----
  for ac_func in dup2 getcwd strdup strerror memmove
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:3857: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3862 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
***************
*** 3682,3688 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:3686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
--- 3881,3887 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:3885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
***************
*** 3709,3720 ****
  
  
  echo $ac_n "checking for getpgrp""... $ac_c" 1>&6
! echo "configure:3713: checking for getpgrp" >&5
  if eval "test \"`echo '$''{'ac_cv_func_getpgrp'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3718 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char getpgrp(); below.  */
--- 3908,3919 ----
  
  
  echo $ac_n "checking for getpgrp""... $ac_c" 1>&6
! echo "configure:3912: checking for getpgrp" >&5
  if eval "test \"`echo '$''{'ac_cv_func_getpgrp'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3917 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char getpgrp(); below.  */
***************
*** 3737,3743 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:3741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_getpgrp=yes"
  else
--- 3936,3942 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:3940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_getpgrp=yes"
  else
***************
*** 3752,3765 ****
  if eval "test \"`echo '$ac_cv_func_'getpgrp`\" = yes"; then
    echo "$ac_t""yes" 1>&6
    cat > conftest.$ac_ext <<EOF
! #line 3756 "configure"
  #include "confdefs.h"
  #include <unistd.h>
  int main() {
  getpgrp(0);
  ; return 0; }
  EOF
! if { (eval echo configure:3763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define GETPGRP_HAVE_ARG 1
--- 3951,3964 ----
  if eval "test \"`echo '$ac_cv_func_'getpgrp`\" = yes"; then
    echo "$ac_t""yes" 1>&6
    cat > conftest.$ac_ext <<EOF
! #line 3955 "configure"
  #include "confdefs.h"
  #include <unistd.h>
  int main() {
  getpgrp(0);
  ; return 0; }
  EOF
! if { (eval echo configure:3962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define GETPGRP_HAVE_ARG 1
***************
*** 3775,3786 ****
  fi
  
  echo $ac_n "checking for setpgrp""... $ac_c" 1>&6
! echo "configure:3779: checking for setpgrp" >&5
  if eval "test \"`echo '$''{'ac_cv_func_setpgrp'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3784 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char setpgrp(); below.  */
--- 3974,3985 ----
  fi
  
  echo $ac_n "checking for setpgrp""... $ac_c" 1>&6
! echo "configure:3978: checking for setpgrp" >&5
  if eval "test \"`echo '$''{'ac_cv_func_setpgrp'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3983 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char setpgrp(); below.  */
***************
*** 3803,3809 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:3807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_setpgrp=yes"
  else
--- 4002,4008 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:4006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_setpgrp=yes"
  else
***************
*** 3818,3831 ****
  if eval "test \"`echo '$ac_cv_func_'setpgrp`\" = yes"; then
    echo "$ac_t""yes" 1>&6
    cat > conftest.$ac_ext <<EOF
! #line 3822 "configure"
  #include "confdefs.h"
  #include <unistd.h>
  int main() {
  setpgrp(0,0);
  ; return 0; }
  EOF
! if { (eval echo configure:3829: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define SETPGRP_HAVE_ARG 1
--- 4017,4030 ----
  if eval "test \"`echo '$ac_cv_func_'setpgrp`\" = yes"; then
    echo "$ac_t""yes" 1>&6
    cat > conftest.$ac_ext <<EOF
! #line 4021 "configure"
  #include "confdefs.h"
  #include <unistd.h>
  int main() {
  setpgrp(0,0);
  ; return 0; }
  EOF
! if { (eval echo configure:4028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define SETPGRP_HAVE_ARG 1
***************
*** 3841,3852 ****
  fi
  
  echo $ac_n "checking for gettimeofday""... $ac_c" 1>&6
! echo "configure:3845: checking for gettimeofday" >&5
  if eval "test \"`echo '$''{'ac_cv_func_gettimeofday'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3850 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char gettimeofday(); below.  */
--- 4040,4051 ----
  fi
  
  echo $ac_n "checking for gettimeofday""... $ac_c" 1>&6
! echo "configure:4044: checking for gettimeofday" >&5
  if eval "test \"`echo '$''{'ac_cv_func_gettimeofday'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4049 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char gettimeofday(); below.  */
***************
*** 3869,3875 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:3873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_gettimeofday=yes"
  else
--- 4068,4074 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:4072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_gettimeofday=yes"
  else
***************
*** 3884,3897 ****
  if eval "test \"`echo '$ac_cv_func_'gettimeofday`\" = yes"; then
    echo "$ac_t""yes" 1>&6
    cat > conftest.$ac_ext <<EOF
! #line 3888 "configure"
  #include "confdefs.h"
  #include <sys/time.h>
  int main() {
  gettimeofday((struct timeval*)0,(struct timezone*)0);
  ; return 0; }
  EOF
! if { (eval echo configure:3895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    :
  else
    echo "configure: failed program was:" >&5
--- 4083,4096 ----
  if eval "test \"`echo '$ac_cv_func_'gettimeofday`\" = yes"; then
    echo "$ac_t""yes" 1>&6
    cat > conftest.$ac_ext <<EOF
! #line 4087 "configure"
  #include "confdefs.h"
  #include <sys/time.h>
  int main() {
  gettimeofday((struct timeval*)0,(struct timezone*)0);
  ; return 0; }
  EOF
! if { (eval echo configure:4094: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    :
  else
    echo "configure: failed program was:" >&5
***************
*** 3910,3921 ****
  
  # checks for structures
  echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
! echo "configure:3914: checking whether time.h and sys/time.h may both be included" >&5
  if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3919 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <sys/time.h>
--- 4109,4120 ----
  
  # checks for structures
  echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
! echo "configure:4113: checking whether time.h and sys/time.h may both be included" >&5
  if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4118 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <sys/time.h>
***************
*** 3924,3930 ****
  struct tm *tp;
  ; return 0; }
  EOF
! if { (eval echo configure:3928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_header_time=yes
  else
--- 4123,4129 ----
  struct tm *tp;
  ; return 0; }
  EOF
! if { (eval echo configure:4127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_header_time=yes
  else
***************
*** 3945,3956 ****
  fi
  
  echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
! echo "configure:3949: checking whether struct tm is in sys/time.h or time.h" >&5
  if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3954 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <time.h>
--- 4144,4155 ----
  fi
  
  echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
! echo "configure:4148: checking whether struct tm is in sys/time.h or time.h" >&5
  if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4153 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <time.h>
***************
*** 3958,3964 ****
  struct tm *tp; tp->tm_sec;
  ; return 0; }
  EOF
! if { (eval echo configure:3962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_struct_tm=time.h
  else
--- 4157,4163 ----
  struct tm *tp; tp->tm_sec;
  ; return 0; }
  EOF
! if { (eval echo configure:4161: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_struct_tm=time.h
  else
***************
*** 3979,3990 ****
  fi
  
  echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
! echo "configure:3983: checking for tm_zone in struct tm" >&5
  if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 3988 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <$ac_cv_struct_tm>
--- 4178,4189 ----
  fi
  
  echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
! echo "configure:4182: checking for tm_zone in struct tm" >&5
  if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4187 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <$ac_cv_struct_tm>
***************
*** 3992,3998 ****
  struct tm tm; tm.tm_zone;
  ; return 0; }
  EOF
! if { (eval echo configure:3996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_struct_tm_zone=yes
  else
--- 4191,4197 ----
  struct tm tm; tm.tm_zone;
  ; return 0; }
  EOF
! if { (eval echo configure:4195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_struct_tm_zone=yes
  else
***************
*** 4012,4023 ****
  
  else
    echo $ac_n "checking for tzname""... $ac_c" 1>&6
! echo "configure:4016: checking for tzname" >&5
  if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4021 "configure"
  #include "confdefs.h"
  #include <time.h>
  #ifndef tzname /* For SGI.  */
--- 4211,4222 ----
  
  else
    echo $ac_n "checking for tzname""... $ac_c" 1>&6
! echo "configure:4215: checking for tzname" >&5
  if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4220 "configure"
  #include "confdefs.h"
  #include <time.h>
  #ifndef tzname /* For SGI.  */
***************
*** 4027,4033 ****
  atoi(*tzname);
  ; return 0; }
  EOF
! if { (eval echo configure:4031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    ac_cv_var_tzname=yes
  else
--- 4226,4232 ----
  atoi(*tzname);
  ; return 0; }
  EOF
! if { (eval echo configure:4230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    ac_cv_var_tzname=yes
  else
***************
*** 4050,4068 ****
  
  
  echo $ac_n "checking for time.h that defines altzone""... $ac_c" 1>&6
! echo "configure:4054: checking for time.h that defines altzone" >&5
  if eval "test \"`echo '$''{'ac_cv_header_time_altzone'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4059 "configure"
  #include "confdefs.h"
  #include <time.h>
  int main() {
  return altzone;
  ; return 0; }
  EOF
! if { (eval echo configure:4066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_header_time_altzone=yes
  else
--- 4249,4267 ----
  
  
  echo $ac_n "checking for time.h that defines altzone""... $ac_c" 1>&6
! echo "configure:4253: checking for time.h that defines altzone" >&5
  if eval "test \"`echo '$''{'ac_cv_header_time_altzone'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4258 "configure"
  #include "confdefs.h"
  #include <time.h>
  int main() {
  return altzone;
  ; return 0; }
  EOF
! if { (eval echo configure:4265: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_header_time_altzone=yes
  else
***************
*** 4084,4092 ****
  
  was_it_defined=no
  echo $ac_n "checking whether sys/select.h and sys/time.h may both be included""... $ac_c" 1>&6
! echo "configure:4088: checking whether sys/select.h and sys/time.h may both be included" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4090 "configure"
  #include "confdefs.h"
  
  #include <sys/types.h>
--- 4283,4291 ----
  
  was_it_defined=no
  echo $ac_n "checking whether sys/select.h and sys/time.h may both be included""... $ac_c" 1>&6
! echo "configure:4287: checking whether sys/select.h and sys/time.h may both be included" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4289 "configure"
  #include "confdefs.h"
  
  #include <sys/types.h>
***************
*** 4097,4103 ****
  ;
  ; return 0; }
  EOF
! if { (eval echo configure:4101: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define SYS_SELECT_WITH_SYS_TIME 1
--- 4296,4302 ----
  ;
  ; return 0; }
  EOF
! if { (eval echo configure:4300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define SYS_SELECT_WITH_SYS_TIME 1
***************
*** 4113,4126 ****
  # checks for compiler characteristics
  
  echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
! echo "configure:4117: checking whether char is unsigned" >&5
  if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    if test "$GCC" = yes; then
    # GCC predefines this symbol on systems where it applies.
  cat > conftest.$ac_ext <<EOF
! #line 4124 "configure"
  #include "confdefs.h"
  #ifdef __CHAR_UNSIGNED__
    yes
--- 4312,4325 ----
  # checks for compiler characteristics
  
  echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
! echo "configure:4316: checking whether char is unsigned" >&5
  if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    if test "$GCC" = yes; then
    # GCC predefines this symbol on systems where it applies.
  cat > conftest.$ac_ext <<EOF
! #line 4323 "configure"
  #include "confdefs.h"
  #ifdef __CHAR_UNSIGNED__
    yes
***************
*** 4142,4148 ****
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 4146 "configure"
  #include "confdefs.h"
  /* volatile prevents gcc2 from optimizing the test away on sparcs.  */
  #if !defined(__STDC__) || __STDC__ != 1
--- 4341,4347 ----
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 4345 "configure"
  #include "confdefs.h"
  /* volatile prevents gcc2 from optimizing the test away on sparcs.  */
  #if !defined(__STDC__) || __STDC__ != 1
***************
*** 4152,4158 ****
    volatile char c = 255; exit(c < 0);
  }
  EOF
! if { (eval echo configure:4156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    ac_cv_c_char_unsigned=yes
  else
--- 4351,4357 ----
    volatile char c = 255; exit(c < 0);
  }
  EOF
! if { (eval echo configure:4355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    ac_cv_c_char_unsigned=yes
  else
***************
*** 4176,4187 ****
  fi
  
  echo $ac_n "checking for working const""... $ac_c" 1>&6
! echo "configure:4180: checking for working const" >&5
  if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4185 "configure"
  #include "confdefs.h"
  
  int main() {
--- 4375,4386 ----
  fi
  
  echo $ac_n "checking for working const""... $ac_c" 1>&6
! echo "configure:4379: checking for working const" >&5
  if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4384 "configure"
  #include "confdefs.h"
  
  int main() {
***************
*** 4230,4236 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:4234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_c_const=yes
  else
--- 4429,4435 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:4433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_c_const=yes
  else
***************
*** 4251,4271 ****
  fi
  
  echo $ac_n "checking for inline""... $ac_c" 1>&6
! echo "configure:4255: checking for inline" >&5
  if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    ac_cv_c_inline=no
  for ac_kw in inline __inline__ __inline; do
    cat > conftest.$ac_ext <<EOF
! #line 4262 "configure"
  #include "confdefs.h"
  
  int main() {
  } $ac_kw foo() {
  ; return 0; }
  EOF
! if { (eval echo configure:4269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_c_inline=$ac_kw; break
  else
--- 4450,4470 ----
  fi
  
  echo $ac_n "checking for inline""... $ac_c" 1>&6
! echo "configure:4454: checking for inline" >&5
  if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    ac_cv_c_inline=no
  for ac_kw in inline __inline__ __inline; do
    cat > conftest.$ac_ext <<EOF
! #line 4461 "configure"
  #include "confdefs.h"
  
  int main() {
  } $ac_kw foo() {
  ; return 0; }
  EOF
! if { (eval echo configure:4468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_c_inline=$ac_kw; break
  else
***************
*** 4293,4308 ****
  
  works=no
  echo $ac_n "checking for working volatile""... $ac_c" 1>&6
! echo "configure:4297: checking for working volatile" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4299 "configure"
  #include "confdefs.h"
  
  int main() {
  volatile int x; x = 0;
  ; return 0; }
  EOF
! if { (eval echo configure:4306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    works=yes
  else
--- 4492,4507 ----
  
  works=no
  echo $ac_n "checking for working volatile""... $ac_c" 1>&6
! echo "configure:4496: checking for working volatile" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4498 "configure"
  #include "confdefs.h"
  
  int main() {
  volatile int x; x = 0;
  ; return 0; }
  EOF
! if { (eval echo configure:4505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    works=yes
  else
***************
*** 4319,4334 ****
  
  works=no
  echo $ac_n "checking for working signed char""... $ac_c" 1>&6
! echo "configure:4323: checking for working signed char" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4325 "configure"
  #include "confdefs.h"
  
  int main() {
  signed char c;
  ; return 0; }
  EOF
! if { (eval echo configure:4332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    works=yes
  else
--- 4518,4533 ----
  
  works=no
  echo $ac_n "checking for working signed char""... $ac_c" 1>&6
! echo "configure:4522: checking for working signed char" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4524 "configure"
  #include "confdefs.h"
  
  int main() {
  signed char c;
  ; return 0; }
  EOF
! if { (eval echo configure:4531: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    works=yes
  else
***************
*** 4345,4360 ****
  
  have_prototypes=no
  echo $ac_n "checking for prototypes""... $ac_c" 1>&6
! echo "configure:4349: checking for prototypes" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4351 "configure"
  #include "confdefs.h"
  int foo(int x) { return 0; }
  int main() {
  return foo(10);
  ; return 0; }
  EOF
! if { (eval echo configure:4358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_PROTOTYPES 1
--- 4544,4559 ----
  
  have_prototypes=no
  echo $ac_n "checking for prototypes""... $ac_c" 1>&6
! echo "configure:4548: checking for prototypes" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4550 "configure"
  #include "confdefs.h"
  int foo(int x) { return 0; }
  int main() {
  return foo(10);
  ; return 0; }
  EOF
! if { (eval echo configure:4557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_PROTOTYPES 1
***************
*** 4369,4377 ****
  
  works=no
  echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6
! echo "configure:4373: checking for variable length prototypes and stdarg.h" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4375 "configure"
  #include "confdefs.h"
  
  #include <stdarg.h>
--- 4568,4576 ----
  
  works=no
  echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6
! echo "configure:4572: checking for variable length prototypes and stdarg.h" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4574 "configure"
  #include "confdefs.h"
  
  #include <stdarg.h>
***************
*** 4388,4394 ****
  return foo(10, "", 3.14);
  ; return 0; }
  EOF
! if { (eval echo configure:4392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_STDARG_PROTOTYPES 1
--- 4587,4593 ----
  return foo(10, "", 3.14);
  ; return 0; }
  EOF
! if { (eval echo configure:4591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    cat >> confdefs.h <<\EOF
  #define HAVE_STDARG_PROTOTYPES 1
***************
*** 4404,4419 ****
  if test "$have_prototypes" = yes; then
  bad_prototypes=no
  echo $ac_n "checking for bad exec* prototypes""... $ac_c" 1>&6
! echo "configure:4408: checking for bad exec* prototypes" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4410 "configure"
  #include "confdefs.h"
  #include <unistd.h>
  int main() {
  char **t;execve("@",t,t);
  ; return 0; }
  EOF
! if { (eval echo configure:4417: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    :
  else
    echo "configure: failed program was:" >&5
--- 4603,4618 ----
  if test "$have_prototypes" = yes; then
  bad_prototypes=no
  echo $ac_n "checking for bad exec* prototypes""... $ac_c" 1>&6
! echo "configure:4607: checking for bad exec* prototypes" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4609 "configure"
  #include "confdefs.h"
  #include <unistd.h>
  int main() {
  char **t;execve("@",t,t);
  ; return 0; }
  EOF
! if { (eval echo configure:4616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    :
  else
    echo "configure: failed program was:" >&5
***************
*** 4430,4441 ****
  
  bad_forward=no
  echo $ac_n "checking for bad static forward""... $ac_c" 1>&6
! echo "configure:4434: checking for bad static forward" >&5
  if test "$cross_compiling" = yes; then
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 4439 "configure"
  #include "confdefs.h"
  
  struct s { int a; int b; };
--- 4629,4640 ----
  
  bad_forward=no
  echo $ac_n "checking for bad static forward""... $ac_c" 1>&6
! echo "configure:4633: checking for bad static forward" >&5
  if test "$cross_compiling" = yes; then
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 4638 "configure"
  #include "confdefs.h"
  
  struct s { int a; int b; };
***************
*** 4451,4457 ****
  }
  
  EOF
! if { (eval echo configure:4455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    :
  else
--- 4650,4656 ----
  }
  
  EOF
! if { (eval echo configure:4654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    :
  else
***************
*** 4470,4478 ****
  
  va_list_is_array=no
  echo $ac_n "checking whether va_list is an array""... $ac_c" 1>&6
! echo "configure:4474: checking whether va_list is an array" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4476 "configure"
  #include "confdefs.h"
  
  #ifdef HAVE_STDARG_PROTOTYPES
--- 4669,4677 ----
  
  va_list_is_array=no
  echo $ac_n "checking whether va_list is an array""... $ac_c" 1>&6
! echo "configure:4673: checking whether va_list is an array" >&5
  cat > conftest.$ac_ext <<EOF
! #line 4675 "configure"
  #include "confdefs.h"
  
  #ifdef HAVE_STDARG_PROTOTYPES
***************
*** 4485,4491 ****
  va_list list1, list2; list1 = list2;
  ; return 0; }
  EOF
! if { (eval echo configure:4489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    :
  else
    echo "configure: failed program was:" >&5
--- 4684,4690 ----
  va_list list1, list2; list1 = list2;
  ; return 0; }
  EOF
! if { (eval echo configure:4688: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    :
  else
    echo "configure: failed program was:" >&5
***************
*** 4501,4512 ****
  
  # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
  echo $ac_n "checking for gethostbyname_r""... $ac_c" 1>&6
! echo "configure:4505: checking for gethostbyname_r" >&5
  if eval "test \"`echo '$''{'ac_cv_func_gethostbyname_r'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4510 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char gethostbyname_r(); below.  */
--- 4700,4711 ----
  
  # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
  echo $ac_n "checking for gethostbyname_r""... $ac_c" 1>&6
! echo "configure:4704: checking for gethostbyname_r" >&5
  if eval "test \"`echo '$''{'ac_cv_func_gethostbyname_r'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4709 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char gethostbyname_r(); below.  */
***************
*** 4529,4535 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:4533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_gethostbyname_r=yes"
  else
--- 4728,4734 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:4732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_gethostbyname_r=yes"
  else
***************
*** 4549,4559 ****
  EOF
  
    echo $ac_n "checking gethostbyname_r with 6 args""... $ac_c" 1>&6
! echo "configure:4553: checking gethostbyname_r with 6 args" >&5
    OLD_CFLAGS=$CFLAGS
    CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
    cat > conftest.$ac_ext <<EOF
! #line 4557 "configure"
  #include "confdefs.h"
  
  #   include <netdb.h>
--- 4748,4758 ----
  EOF
  
    echo $ac_n "checking gethostbyname_r with 6 args""... $ac_c" 1>&6
! echo "configure:4752: checking gethostbyname_r with 6 args" >&5
    OLD_CFLAGS=$CFLAGS
    CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
    cat > conftest.$ac_ext <<EOF
! #line 4756 "configure"
  #include "confdefs.h"
  
  #   include <netdb.h>
***************
*** 4570,4576 ****
    
  ; return 0; }
  EOF
! if { (eval echo configure:4574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    
      cat >> confdefs.h <<\EOF
--- 4769,4775 ----
    
  ; return 0; }
  EOF
! if { (eval echo configure:4773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    
      cat >> confdefs.h <<\EOF
***************
*** 4590,4598 ****
    
      echo "$ac_t""no" 1>&6
      echo $ac_n "checking gethostbyname_r with 5 args""... $ac_c" 1>&6
! echo "configure:4594: checking gethostbyname_r with 5 args" >&5
      cat > conftest.$ac_ext <<EOF
! #line 4596 "configure"
  #include "confdefs.h"
  
  #     include <netdb.h>
--- 4789,4797 ----
    
      echo "$ac_t""no" 1>&6
      echo $ac_n "checking gethostbyname_r with 5 args""... $ac_c" 1>&6
! echo "configure:4793: checking gethostbyname_r with 5 args" >&5
      cat > conftest.$ac_ext <<EOF
! #line 4795 "configure"
  #include "confdefs.h"
  
  #     include <netdb.h>
***************
*** 4609,4615 ****
      
  ; return 0; }
  EOF
! if { (eval echo configure:4613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    
        cat >> confdefs.h <<\EOF
--- 4808,4814 ----
      
  ; return 0; }
  EOF
! if { (eval echo configure:4812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    
        cat >> confdefs.h <<\EOF
***************
*** 4629,4637 ****
    
        echo "$ac_t""no" 1>&6
        echo $ac_n "checking gethostbyname_r with 3 args""... $ac_c" 1>&6
! echo "configure:4633: checking gethostbyname_r with 3 args" >&5
        cat > conftest.$ac_ext <<EOF
! #line 4635 "configure"
  #include "confdefs.h"
  
  #       include <netdb.h>
--- 4828,4836 ----
    
        echo "$ac_t""no" 1>&6
        echo $ac_n "checking gethostbyname_r with 3 args""... $ac_c" 1>&6
! echo "configure:4832: checking gethostbyname_r with 3 args" >&5
        cat > conftest.$ac_ext <<EOF
! #line 4834 "configure"
  #include "confdefs.h"
  
  #       include <netdb.h>
***************
*** 4646,4652 ****
        
  ; return 0; }
  EOF
! if { (eval echo configure:4650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    
          cat >> confdefs.h <<\EOF
--- 4845,4851 ----
        
  ; return 0; }
  EOF
! if { (eval echo configure:4849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    
          cat >> confdefs.h <<\EOF
***************
*** 4680,4691 ****
    echo "$ac_t""no" 1>&6
  
    echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
! echo "configure:4684: checking for gethostbyname" >&5
  if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4689 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char gethostbyname(); below.  */
--- 4879,4890 ----
    echo "$ac_t""no" 1>&6
  
    echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
! echo "configure:4883: checking for gethostbyname" >&5
  if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4888 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char gethostbyname(); below.  */
***************
*** 4708,4714 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:4712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_gethostbyname=yes"
  else
--- 4907,4913 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:4911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_gethostbyname=yes"
  else
***************
*** 4744,4750 ****
  
  # Linux requires this for correct f.p. operations
  echo $ac_n "checking for __fpu_control in -lieee""... $ac_c" 1>&6
! echo "configure:4748: checking for __fpu_control in -lieee" >&5
  ac_lib_var=`echo ieee'_'__fpu_control | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
--- 4943,4949 ----
  
  # Linux requires this for correct f.p. operations
  echo $ac_n "checking for __fpu_control in -lieee""... $ac_c" 1>&6
! echo "configure:4947: checking for __fpu_control in -lieee" >&5
  ac_lib_var=`echo ieee'_'__fpu_control | sed 'y%./+-%__p_%'`
  if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
***************
*** 4752,4758 ****
    ac_save_LIBS="$LIBS"
  LIBS="-lieee  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 4756 "configure"
  #include "confdefs.h"
  /* Override any gcc2 internal prototype to avoid an error.  */
  /* We use char because int might match the return type of a gcc2
--- 4951,4957 ----
    ac_save_LIBS="$LIBS"
  LIBS="-lieee  $LIBS"
  cat > conftest.$ac_ext <<EOF
! #line 4955 "configure"
  #include "confdefs.h"
  /* Override any gcc2 internal prototype to avoid an error.  */
  /* We use char because int might match the return type of a gcc2
***************
*** 4763,4769 ****
  __fpu_control()
  ; return 0; }
  EOF
! if { (eval echo configure:4767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
--- 4962,4968 ----
  __fpu_control()
  ; return 0; }
  EOF
! if { (eval echo configure:4966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_lib_$ac_lib_var=yes"
  else
***************
*** 4793,4799 ****
  
  # Check for --with-fpectl
  echo $ac_n "checking for --with-fpectl""... $ac_c" 1>&6
! echo "configure:4797: checking for --with-fpectl" >&5
  # Check whether --with-fpectl or --without-fpectl was given.
  if test "${with_fpectl+set}" = set; then
    withval="$with_fpectl"
--- 4992,4998 ----
  
  # Check for --with-fpectl
  echo $ac_n "checking for --with-fpectl""... $ac_c" 1>&6
! echo "configure:4996: checking for --with-fpectl" >&5
  # Check whether --with-fpectl or --without-fpectl was given.
  if test "${with_fpectl+set}" = set; then
    withval="$with_fpectl"
***************
*** 4818,4824 ****
  *) LIBM=-lm
  esac
  echo $ac_n "checking for --with-libm=STRING""... $ac_c" 1>&6
! echo "configure:4822: checking for --with-libm=STRING" >&5
  # Check whether --with-libm or --without-libm was given.
  if test "${with_libm+set}" = set; then
    withval="$with_libm"
--- 5017,5023 ----
  *) LIBM=-lm
  esac
  echo $ac_n "checking for --with-libm=STRING""... $ac_c" 1>&6
! echo "configure:5021: checking for --with-libm=STRING" >&5
  # Check whether --with-libm or --without-libm was given.
  if test "${with_libm+set}" = set; then
    withval="$with_libm"
***************
*** 4839,4845 ****
  # check for --with-libc=...
  
  echo $ac_n "checking for --with-libc=STRING""... $ac_c" 1>&6
! echo "configure:4843: checking for --with-libc=STRING" >&5
  # Check whether --with-libc or --without-libc was given.
  if test "${with_libc+set}" = set; then
    withval="$with_libc"
--- 5038,5044 ----
  # check for --with-libc=...
  
  echo $ac_n "checking for --with-libc=STRING""... $ac_c" 1>&6
! echo "configure:5042: checking for --with-libc=STRING" >&5
  # Check whether --with-libc or --without-libc was given.
  if test "${with_libc+set}" = set; then
    withval="$with_libc"
***************
*** 4863,4874 ****
  for ac_func in hypot
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:4867: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4872 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
--- 5062,5073 ----
  for ac_func in hypot
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:5066: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 5071 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
***************
*** 4891,4897 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:4895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
--- 5090,5096 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:5094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
***************
*** 4918,4929 ****
  for ac_func in hypot
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:4922: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4927 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
--- 5117,5128 ----
  for ac_func in hypot
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:5121: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 5126 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
***************
*** 4946,4952 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:4950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
--- 5145,5151 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:5149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
***************
*** 4980,4991 ****
  for ac_func in rint
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:4984: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 4989 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
--- 5179,5190 ----
  for ac_func in rint
  do
  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
! echo "configure:5183: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 5188 "configure"
  #include "confdefs.h"
  /* System header to define __stub macros and hopefully few prototypes,
      which can conflict with char $ac_func(); below.  */
***************
*** 5008,5014 ****
  
  ; return 0; }
  EOF
! if { (eval echo configure:5012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
--- 5207,5213 ----
  
  ; return 0; }
  EOF
! if { (eval echo configure:5211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
    eval "ac_cv_func_$ac_func=yes"
  else
***************
*** 5036,5042 ****
  
  # check for getopt
  echo $ac_n "checking for genuine getopt""... $ac_c" 1>&6
! echo "configure:5040: checking for genuine getopt" >&5
  if eval "test \"`echo '$''{'ac_cv_func_getopt'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 5235,5241 ----
  
  # check for getopt
  echo $ac_n "checking for genuine getopt""... $ac_c" 1>&6
! echo "configure:5239: checking for genuine getopt" >&5
  if eval "test \"`echo '$''{'ac_cv_func_getopt'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 5044,5050 ****
    ac_cv_func_getopt=no
  else
    cat > conftest.$ac_ext <<EOF
! #line 5048 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  extern int optind, opterr, getopt();
--- 5243,5249 ----
    ac_cv_func_getopt=no
  else
    cat > conftest.$ac_ext <<EOF
! #line 5247 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  extern int optind, opterr, getopt();
***************
*** 5056,5062 ****
  	exit(0);
  }
  EOF
! if { (eval echo configure:5060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    ac_cv_func_getopt=yes
  else
--- 5255,5261 ----
  	exit(0);
  }
  EOF
! if { (eval echo configure:5259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    ac_cv_func_getopt=yes
  else
***************
*** 5074,5080 ****
  
  # check whether malloc(0) returns NULL or not
  echo $ac_n "checking what malloc(0) returns""... $ac_c" 1>&6
! echo "configure:5078: checking what malloc(0) returns" >&5
  if eval "test \"`echo '$''{'ac_cv_malloc_zero'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
--- 5273,5279 ----
  
  # check whether malloc(0) returns NULL or not
  echo $ac_n "checking what malloc(0) returns""... $ac_c" 1>&6
! echo "configure:5277: checking what malloc(0) returns" >&5
  if eval "test \"`echo '$''{'ac_cv_malloc_zero'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
***************
*** 5082,5088 ****
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 5086 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  #ifdef HAVE_STDLIB
--- 5281,5287 ----
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 5285 "configure"
  #include "confdefs.h"
  #include <stdio.h>
  #ifdef HAVE_STDLIB
***************
*** 5101,5107 ****
  	exit(0);
  }
  EOF
! if { (eval echo configure:5105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    ac_cv_malloc_zero=nonnull
  else
--- 5300,5306 ----
  	exit(0);
  }
  EOF
! if { (eval echo configure:5304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    ac_cv_malloc_zero=nonnull
  else
***************
*** 5127,5143 ****
  # check for wchar.h
  ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'`
  echo $ac_n "checking for wchar.h""... $ac_c" 1>&6
! echo "configure:5131: checking for wchar.h" >&5
  if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 5136 "configure"
  #include "confdefs.h"
  #include <wchar.h>
  EOF
  ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
! { (eval echo configure:5141: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  if test -z "$ac_err"; then
    rm -rf conftest*
--- 5326,5342 ----
  # check for wchar.h
  ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'`
  echo $ac_n "checking for wchar.h""... $ac_c" 1>&6
! echo "configure:5330: checking for wchar.h" >&5
  if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 5335 "configure"
  #include "confdefs.h"
  #include <wchar.h>
  EOF
  ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
! { (eval echo configure:5340: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
  if test -z "$ac_err"; then
    rm -rf conftest*
***************
*** 5167,5178 ****
  # check for usable wchar_t
  usable_wchar_t="unkown"
  echo $ac_n "checking for usable wchar_t""... $ac_c" 1>&6
! echo "configure:5171: checking for usable wchar_t" >&5
  if test "$cross_compiling" = yes; then
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 5176 "configure"
  #include "confdefs.h"
  
  #include "wchar.h"
--- 5366,5377 ----
  # check for usable wchar_t
  usable_wchar_t="unkown"
  echo $ac_n "checking for usable wchar_t""... $ac_c" 1>&6
! echo "configure:5370: checking for usable wchar_t" >&5
  if test "$cross_compiling" = yes; then
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 5375 "configure"
  #include "confdefs.h"
  
  #include "wchar.h"
***************
*** 5186,5192 ****
  }
  
  EOF
! if { (eval echo configure:5190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    cat >> confdefs.h <<\EOF
  #define HAVE_USABLE_WCHAR_T 1
--- 5385,5391 ----
  }
  
  EOF
! if { (eval echo configure:5389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    cat >> confdefs.h <<\EOF
  #define HAVE_USABLE_WCHAR_T 1
***************
*** 5205,5218 ****
  
  # check for endianness
  echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
! echo "configure:5209: checking whether byte ordering is bigendian" >&5
  if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    ac_cv_c_bigendian=unknown
  # See if sys/param.h defines the BYTE_ORDER macro.
  cat > conftest.$ac_ext <<EOF
! #line 5216 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <sys/param.h>
--- 5404,5417 ----
  
  # check for endianness
  echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
! echo "configure:5408: checking whether byte ordering is bigendian" >&5
  if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    ac_cv_c_bigendian=unknown
  # See if sys/param.h defines the BYTE_ORDER macro.
  cat > conftest.$ac_ext <<EOF
! #line 5415 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <sys/param.h>
***************
*** 5223,5233 ****
  #endif
  ; return 0; }
  EOF
! if { (eval echo configure:5227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    # It does; now see whether it defined to BIG_ENDIAN or not.
  cat > conftest.$ac_ext <<EOF
! #line 5231 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <sys/param.h>
--- 5422,5432 ----
  #endif
  ; return 0; }
  EOF
! if { (eval echo configure:5426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    # It does; now see whether it defined to BIG_ENDIAN or not.
  cat > conftest.$ac_ext <<EOF
! #line 5430 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #include <sys/param.h>
***************
*** 5238,5244 ****
  #endif
  ; return 0; }
  EOF
! if { (eval echo configure:5242: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_c_bigendian=yes
  else
--- 5437,5443 ----
  #endif
  ; return 0; }
  EOF
! if { (eval echo configure:5441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
    ac_cv_c_bigendian=yes
  else
***************
*** 5258,5264 ****
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 5262 "configure"
  #include "confdefs.h"
  main () {
    /* Are we little or big endian?  From Harbison&Steele.  */
--- 5457,5463 ----
      { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
  else
    cat > conftest.$ac_ext <<EOF
! #line 5461 "configure"
  #include "confdefs.h"
  main () {
    /* Are we little or big endian?  From Harbison&Steele.  */
***************
*** 5271,5277 ****
    exit (u.c[sizeof (long) - 1] == 1);
  }
  EOF
! if { (eval echo configure:5275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    ac_cv_c_bigendian=no
  else
--- 5470,5476 ----
    exit (u.c[sizeof (long) - 1] == 1);
  }
  EOF
! if { (eval echo configure:5474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
    ac_cv_c_bigendian=no
  else
***************
*** 5297,5303 ****
  
  # Check for --with-wctype-functions
  echo $ac_n "checking for --with-wctype-functions""... $ac_c" 1>&6
! echo "configure:5301: checking for --with-wctype-functions" >&5
  # Check whether --with-wctype-functions or --without-wctype-functions was given.
  if test "${with_wctype_functions+set}" = set; then
    withval="$with_wctype_functions"
--- 5496,5502 ----
  
  # Check for --with-wctype-functions
  echo $ac_n "checking for --with-wctype-functions""... $ac_c" 1>&6
! echo "configure:5500: checking for --with-wctype-functions" >&5
  # Check whether --with-wctype-functions or --without-wctype-functions was given.
  if test "${with_wctype_functions+set}" = set; then
    withval="$with_wctype_functions"
***************
*** 5322,5333 ****
  #endif
  EOF
  echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
! echo "configure:5326: checking for socklen_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 5331 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
--- 5521,5532 ----
  #endif
  EOF
  echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
! echo "configure:5525: checking for socklen_t" >&5
  if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
  else
    cat > conftest.$ac_ext <<EOF
! #line 5530 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
  #if STDC_HEADERS
Index: configure.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure.in,v
retrieving revision 1.124
diff -c -r1.124 configure.in
*** configure.in	2000/05/26 12:22:54	1.124
--- configure.in	2000/06/03 23:37:06
***************
*** 770,775 ****
--- 770,780 ----
   tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
   truncate uname waitpid)
  
+ # check for openpty and forkpty
+ 
+ AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
+ AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
+ 
  # check for long file support functions
  AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
  
Index: Modules/posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.135
diff -c -r2.135 posixmodule.c
*** Modules/posixmodule.c	2000/06/01 02:02:46	2.135
--- Modules/posixmodule.c	2000/06/03 23:37:08
***************
*** 1731,1737 ****
--- 1731,1779 ----
  }
  #endif
  
+ #ifdef HAVE_OPENPTY
+ static char posix_openpty__doc__[] =
+ "openpty() -> (master_fd, slave_fd)\n\
+ Open a pseudo-terminal, returning open fd's for both master and slave end.\n";
  
+ static PyObject *
+ posix_openpty(self, args)
+ 	PyObject *self;
+ 	PyObject *args;
+ {
+ 	int master_fd, slave_fd;
+ 	if (!PyArg_ParseTuple(args, ":openpty"))
+ 		return NULL;
+ 	if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0)
+ 		return posix_error();
+ 	return Py_BuildValue("(ii)", master_fd, slave_fd);
+ }
+ #endif
+ 
+ #ifdef HAVE_FORKPTY
+ static char posix_forkpty__doc__[] =
+ "forkpty() -> (pid, master_fd)\n\
+ Fork a new process with a new pseudo-terminal as controlling tty.\n\n\
+ Like fork(), return 0 as pid to child process, and PID of child to parent.\n\
+ To both, return fd of newly opened pseudo-terminal.\n";
+ 
+ static PyObject *
+ posix_forkpty(self, args)
+ 	PyObject *self;
+ 	PyObject *args;
+ {
+ 	int master_fd, pid;
+ 	
+ 	if (!PyArg_ParseTuple(args, ":forkpty"))
+ 		return NULL;
+ 	pid = forkpty(&master_fd, NULL, NULL, NULL);
+ 	if (pid == -1)
+ 		return posix_error();
+ 	PyOS_AfterFork();
+ 	return Py_BuildValue("(ii)", pid, master_fd);
+ }
+ #endif
+ 
  #ifdef HAVE_GETEGID
  static char posix_getegid__doc__[] =
  "getegid() -> egid\n\
***************
*** 4514,4519 ****
--- 4556,4567 ----
  #ifdef HAVE_FORK
  	{"fork",	posix_fork, METH_VARARGS, posix_fork__doc__},
  #endif /* HAVE_FORK */
+ #ifdef HAVE_OPENPTY
+ 	{"openpty",	posix_openpty, METH_VARARGS, posix_openpty__doc__},
+ #endif /* HAVE_OPENPTY */
+ #ifdef HAVE_FORKPTY
+ 	{"forkpty",	posix_forkpty, METH_VARARGS, posix_forkpty__doc__},
+ #endif /* HAVE_FORKPTY */
  #ifdef HAVE_GETEGID
  	{"getegid",	posix_getegid, METH_VARARGS, posix_getegid__doc__},
  #endif /* HAVE_GETEGID */

--cNdxnHkX5QqsyA0e--