[comp.lang.perl] Patches for RS/6000 AIX 3.1 perl

ejk@uxh.cso.uiuc.edu (Ed Kubaitis) (08/08/90)

The attached patches to perl (patch level 18) allowed a successful make
and "make test" on an IBM RS/6000 520 running AIX 3.1. They have not been
exhaustively tested and may well not be the best solutions, but they may save
you some time until the standard perl distribution can deal with AIX 3.1
idiosyncracies.

Notes on the patches:

   o The default answer was taken for all questions posed by Configure.
     (thus cc rather than xlc or c89 was used.)

   o "#pragma alloca" is needed in perl.y and x2p/a2p.y

   o The definition of sprintf had to be removed from perl.h

   o A reference to the passwd element "pw_comment" had to be removed in
     doio.c as AIX's passwd structure does not have it.

   o There is a conflict between O_EXEC in arg.h and AIX fcntl.h. Resolved
     by changing O_EXEC to O_EXEC1 in arg.h, eval.c, and toke.c.

   o "#ifdef undef" in x2p/util.c was changed to "#ifdef undefined"
     to get around an "expecting macro name on #ifdef" error.

   o AIX does not have "patch" so you may have to apply these patches by
     hand. (BTW, was enable to install patch by getting rid of all of
     the "3b2*" and "3b5*" #ifdef symbols in the configure script, and
     commenting out the declaration of sprintf in common.h).

Ed Kubaitis (ejk@uxh.cso.uiuc.edu)
Computing Services Office
University of Illinois, Urbana

patches to files in the perl directory:
------------------------------------------------------------------------
---------
*** arg.h-	Tue Aug  7 09:30:14 1990
--- arg.h	Tue Aug  7 09:31:58 1990
***************
*** 119,125 ****
  #define O_EACH 89
  #define O_CHOP 90
  #define O_FORK 91
! #define O_EXEC 92
  #define O_SYSTEM 93
  #define O_OCT 94
  #define O_HEX 95
--- 119,125 ----
  #define O_EACH 89
  #define O_CHOP 90
  #define O_FORK 91
! #define O_EXEC1 92
  #define O_SYSTEM 93
  #define O_OCT 94
  #define O_HEX 95
*** doio.c-	Tue Aug  7 09:25:24 1990
--- doio.c	Tue Aug  7 09:26:27 1990
***************
*** 1762,1768 ****
  #ifdef PWCLASS
  	str_set(str,pwent->pw_class);
  #else
! 	str_set(str, pwent->pw_comment);
  #endif
  	(void)astore(ary, ++sp, str = str_static(&str_no));
  	str_set(str, pwent->pw_gecos);
--- 1762,1768 ----
  #ifdef PWCLASS
  	str_set(str,pwent->pw_class);
  #else
! 	str_set(str, "");
  #endif
  	(void)astore(ary, ++sp, str = str_static(&str_no));
  	str_set(str, pwent->pw_gecos);
*** eval.c-	Tue Aug  7 09:42:15 1990
--- eval.c	Tue Aug  7 09:42:31 1990
***************
*** 1412,1418 ****
  	}
  	goto donumset;
  #endif /* FORK */
!     case O_EXEC:
  	if ((arg[1].arg_type & A_MASK) == A_STAB)
  	    value = (double)do_aexec(st[1],arglast);
  	else if (arglast[2] - arglast[1] != 1)
--- 1412,1418 ----
  	}
  	goto donumset;
  #endif /* FORK */
!     case O_EXEC1:
  	if ((arg[1].arg_type & A_MASK) == A_STAB)
  	    value = (double)do_aexec(st[1],arglast);
  	else if (arglast[2] - arglast[1] != 1)
*** perl.h-	Tue Aug  7 09:15:36 1990
--- perl.h	Tue Aug  7 09:16:45 1990
***************
*** 301,307 ****
  #ifdef CHARSPRINTF
      char *sprintf();
  #else
!     int sprintf();
  #endif
  #endif
  
--- 301,307 ----
  #ifdef CHARSPRINTF
      char *sprintf();
  #else
! /*    int sprintf();*/
  #endif
  #endif
  
*** perl.y-	Tue Aug  7 09:11:43 1990
--- perl.y	Tue Aug  7 09:12:13 1990
***************
*** 35,40 ****
--- 35,41 ----
   */
  
  %{
+ #pragma alloca
  #include "INTERN.h"
  #include "perl.h"
  
*** toke.c-	Tue Aug  7 09:42:44 1990
--- toke.c	Tue Aug  7 09:42:56 1990
***************
*** 649,655 ****
  	    HFUN(O_EACH);
  	if (strEQ(d,"exec")) {
  	    set_csh();
! 	    LOP(O_EXEC);
  	}
  	if (strEQ(d,"endhostent"))
  	    FUN0(O_EHOSTENT);
--- 649,655 ----
  	    HFUN(O_EACH);
  	if (strEQ(d,"exec")) {
  	    set_csh();
! 	    LOP(O_EXEC1);
  	}
  	if (strEQ(d,"endhostent"))
  	    FUN0(O_EHOSTENT);
------------------------------------------------------------------------
---------

patches to files in the perl/x2p directory:
------------------------------------------------------------------------
---------
*** a2p.y-	Tue Aug  7 09:10:58 1990
--- a2p.y	Tue Aug  7 09:11:22 1990
***************
*** 15,20 ****
--- 15,21 ----
   * 
   */
  
+ #pragma alloca
  #include "INTERN.h"
  #include "a2p.h"
  
*** util.c-	Tue Aug  7 10:08:56 1990
--- util.c	Tue Aug  7 10:09:19 1990
***************
*** 103,109 ****
      return to;
  }
  
! #ifdef undef
  /* safe version of string concatenate, with \n deletion and space padding */
  
  char *
--- 103,109 ----
      return to;
  }
  
! #ifdef undefined
  /* safe version of string concatenate, with \n deletion and space padding */
  
  char *

ejk@uxh.cso.uiuc.edu (Ed Kubaitis) (08/13/90)

The previously posted patches to allow perl (patchlevel 18) to compile on
IBM RS/6000 AIX 3.1 should have the following additional instruction:

     o  Make sure that the perl Makefile "libs" parameter has -lm before
	-lbsd, i.e:

	   libs = -ldbm -lm -lbsd

-------------------------
Ed Kubaitis (ejk@uxh.cso.uiuc.edu)
Computing Services Office - University of Illinois, Urbana

ejk@uxh.cso.uiuc.edu (Ed Kubaitis) (08/15/90)

These previously posted patches also work at perl patchlevel 28. One minor
problem: When I ran Configure after applying perl patch 28, the Makefile
libs parameter had -lm both before and after -lbsd, which resulted in
many loader error messages regarding math routines. Removing the trailing
redundant -lm fixed the problem. (-lm should appear before -lbsd to prevent
a segmentation fault when the perl "**" operator is used. See the note
regarding the "pow" function in /usr/lpp/bos/bsdport.)

-------------------------
Ed Kubaitis (ejk@uxh.cso.uiuc.edu)
Computing Services Office - University of Illinois, Urbana