[comp.lang.perl] patch 7 /usr/include/utime.h check doesn't work on Ultrix 3.1

sahayman@iuvax.cs.indiana.edu (Steve Hayman) (12/23/89)

Patch 7 adds code to Configure to check for /usr/include/utime.h,
on the assumption that DG/UX is the only Unix that has this.
Unfortunately, Ultrix 3.1 has a slightly  incompatible file by the same name.

The Ultrix file declares 
    struct utimbuf
	    {
	    time_t	actime;
	    time_t	modtime;
    };

and apparently the DG/UX one also declares "acusec" and "modusec" fields.
So "doio.c" won't compile under Ultrix 3.1 .

One quick fix would be to change Configure to check not only for
/usr/include/utime.h but also for "acusec" in that file, and 
define two different symbols.  Here's a patch for Configure,
config.h.SH and doio.c that does that.  Hope it's of use to someone.

*** Configure.old	Fri Dec 22 15:50:09 1989
--- Configure	Fri Dec 22 15:39:44 1989
***************
*** 176,181 ****
--- 176,182 ----
  i_systime=''
  d_systimekernel=''
  i_utime=''
+ i_utimeacusec=''
  i_varargs=''
  i_vfork=''
  intsize=''
***************
*** 2217,2228 ****
  fi
  
  : see if this is DG/UX with a funky utime.h
  echo " "
  if $test -r /usr/include/utime.h ; then
      i_utime="$define"
!     echo "utime.h found."
  else
      i_utime="$undef"
      echo "No utime.h found, but that's ok."
  fi
  
--- 2218,2240 ----
  fi
  
  : see if this is DG/UX with a funky utime.h
+ 
+ : also make sure the file contains 'acusec', since the ultrix one does not
+ : sahayman@iuvax.cs.indiana.edu
+ 
  echo " "
  if $test -r /usr/include/utime.h ; then
      i_utime="$define"
!     if $contains acusec /usr/include/utime.h >/dev/null 2>&1 ; then
! 	i_utimeacusec="$define"
! 	echo "utime.h found."
!     else
! 	echo "utime.h found, but it doesn't declare 'acusec', that's ok."
! 	i_utimeacusec="$undef"
!     fi
  else
      i_utime="$undef"
+     i_utimeacusec="$undef"
      echo "No utime.h found, but that's ok."
  fi
  
***************
*** 2605,2610 ****
--- 2617,2623 ----
  i_systime='$i_systime'
  d_systimekernel='$d_systimekernel'
  i_utime='$i_utime'
+ i_utimeacusec='$i_utimeacusec'
  i_varargs='$i_varargs'
  i_vfork='$i_vfork'
  intsize='$intsize'
*** config.h.SH.old	Fri Dec 22 15:55:48 1989
--- config.h.SH	Fri Dec 22 15:56:11 1989
***************
*** 544,550 ****
--- 544,558 ----
   *	This symbol, if defined, indicates to the C program that it should
   *	include utime.h (a DG/UX thingie).
   */
+ /*
+  * I_UTIMEACUSEC:
+  *	This symbol, if defined, indicates that utime.h includes an
+  *	"acusec" field.  Ultrix also has a utime.h file but only the
+  *	DG/UX one defines "acusec".    sahayman@iuvax.cs.indiana.edu
+  */
  #$i_utime	I_UTIME		/**/
+ #$i_utimeacusec	I_UTIMEACUSEC		/**/
+ 
  
  /* I_VARARGS:
   *	This symbol, if defined, indicates to the C program that it should
*** doio.c.old	Fri Dec 22 15:50:16 1989
--- doio.c	Fri Dec 22 15:40:44 1989
***************
*** 1993,2000 ****
  
  	    utbuf.actime = (long)str_gnum(st[++sp]);    /* time accessed */
  	    utbuf.modtime = (long)str_gnum(st[++sp]);    /* time modified */
! #ifdef I_UTIME
! 	    utbuf.acusec = 0;		/* hopefully I_UTIME implies these */
  	    utbuf.modusec = 0;
  #endif
  	    items -= 2;
--- 1993,2000 ----
  
  	    utbuf.actime = (long)str_gnum(st[++sp]);    /* time accessed */
  	    utbuf.modtime = (long)str_gnum(st[++sp]);    /* time modified */
! #if defined(I_UTIME) && defined(I_UTIMEACUSEC)
! 	    utbuf.acusec = 0;		/* not all utime.h's define these */
  	    utbuf.modusec = 0;
  #endif
  	    items -= 2;

aem@mthvax.cs.miami.edu (a.e.mossberg) (12/23/89)

In article <32017@iuvax.cs.indiana.edu> sahayman@iuvax.cs.indiana.edu (Steve Hayman) writes:
>Patch 7 adds code to Configure to check for /usr/include/utime.h,
>on the assumption that DG/UX is the only Unix that has this.
>Unfortunately, Ultrix 3.1 has a slightly  incompatible file by the same name.

This problem is also manifested under Ultrix 3.0

Thanks for the patch, I hadn't gotten around to poking through the
sources yet when the compile failed.


aem
--
a.e.mossberg / aem@mthvax.cs.miami.edu / aem@umiami.BITNET / Pahayokee Bioregion
The ACLU has stood foursquare against the recurring tides of hysteria that from
time to time threaten freedoms everywhere.	- Chief Justice Earl Warren

brian@hpausla.aso.hp.com (Brian Coogan) (12/29/89)

In article <32017@iuvax.cs.indiana.edu> sahayman@iuvax.cs.indiana.edu (Steve Hayman) writes:
>Patch 7 adds code to Configure to check for /usr/include/utime.h,
>on the assumption that DG/UX is the only Unix that has this.

HP-UX was also bitten by this one.  Isn't utime.h a System V type
thing?