[comp.sources.bugs] Perl 3.0 PL12 -- patches for Xenix/386 2.3

chip@tct.uucp (Chip Salzenberg) (03/08/90)

Compiling Perl 3.0 PL12 on Xenix/386, I fixed four small bugs:

1.  The Xenix C compiler automatically defines "M_XENIX", not "xenix".
    In perl.h, the wrong macro was being tested; as well, the presence
    of <sys/dir.h> was preventing the correct use of <sys/ndir.h>.
    Patch is below.

2.  In stab.h, an ifdef checks for specific variations of readdir() headers.
    It should simply check for READDIR.  Patch is below.

3.  The Configure script runs cc with the -D options after the source file
    when trying to determine the correct time headers to use.  Xenix cc
    requires that the options go before the source file.  Patch is below.

4.  Configure tries to compile a varargs program, but it doesn't include
    <stdio.h> before <varargs.h>, so it fails under Xenix.  Patch is below.

Incidentally, Larry, the regression testing doesn't check readdir().
Perhaps we need an io.readdir module in there.

Index: perl.h
***************
*** 198,215 ****
  #endif
  
! #if defined(I_DIRENT) && !defined(xenix)
  #   include <dirent.h>
  #   define DIRENT dirent
  #else
! #   ifdef I_SYSDIR
! #	ifdef hp9000s500
! #	    include <ndir.h>	/* may be wrong in the future */
! #	else
! #	    include <sys/dir.h>
! #	endif
  #	define DIRENT direct
  #   else
! #	ifdef I_SYSNDIR
! #	    include <sys/ndir.h>
  #	    define DIRENT direct
  #	endif
--- 198,215 ----
  #endif
  
! #if defined(I_DIRENT) && !defined(M_XENIX)
  #   include <dirent.h>
  #   define DIRENT dirent
  #else
! #   ifdef I_SYSNDIR
! #	include <sys/ndir.h>
  #	define DIRENT direct
  #   else
! #	ifdef I_SYSDIR
! #	    ifdef hp9000s500
! #		include <ndir.h>	/* may be wrong in the future */
! #	    else
! #		include <sys/dir.h>
! #	    endif
  #	    define DIRENT direct
  #	endif

Index: stab.h
***************
*** 64,68 ****
      FILE	*ifp;		/* ifp and ofp are normally the same */
      FILE	*ofp;		/* but sockets need separate streams */
! #if defined(I_DIRENT) || defined(I_SYSDIR)
      DIR		*dirp;		/* for opendir, readdir, etc */
  #endif
--- 64,68 ----
      FILE	*ifp;		/* ifp and ofp are normally the same */
      FILE	*ofp;		/* but sockets need separate streams */
! #ifdef READDIR
      DIR		*dirp;		/* for opendir, readdir, etc */
  #endif

Index: Configure
***************
*** 1516,1519 ****
--- 1516,1520 ----
      d_vprintf="$define"
      cat >.ucbsprf.c <<'EOF'
+ #include <stdio.h>
  #include <varargs.h>
  
***************
*** 2010,2016 ****
  		case "$flags" in
  		'') echo Trying $i_time $i_systime $d_systimekernel $s_timeval
! 		    if $cc try.c $ccflags \
  			    $i_time $i_systime $d_systimekernel $s_timeval \
! 			    -o try >/dev/null 2>&1 ; then
  			set X $i_time $i_systime $d_systimekernel $s_timeval
  			shift
--- 2011,2017 ----
  		case "$flags" in
  		'') echo Trying $i_time $i_systime $d_systimekernel $s_timeval
! 		    if $cc $ccflags \
  			    $i_time $i_systime $d_systimekernel $s_timeval \
! 			    try.c -o try >/dev/null 2>&1 ; then
  			set X $i_time $i_systime $d_systimekernel $s_timeval
  			shift
-- 
Chip Salzenberg at ComDev/TCT   <chip%tct@ateng.com>, <uunet!ateng!tct!chip>
          "The Usenet, in a very real sense, does not exist."