[comp.sys.next] PERL 4.0 on NeXT

louie@sayshell.umd.edu (Louis A. Mamakos) (03/23/91)

I was finally able to get perl 4.0 to compile and pass all tests on my
NeXT workstation.  I had three major problems:

1. The extern char **environ bug.  This was mentioned on the newsgroup
before.  For some reason, this declaration is #ifdef'ed out if __STDC__.
I'm not sure why this is, but I moved the delcaration to perl.h so it could
be dealt with once, rather than everyplace that it occured in the C files.

2.  The memcpy 'problem'.  I had to manually turn off this definition in
config.sh since it conflicted with a #define that is in the NeXT header files.
I'm not sure why perl needed to define this, since Configure found a bcmp()
routine anyway.

3.  The group id test.  It seems that although gid_t is defined as a short
in <sys/types.h>, the getgroups() syscall returns an array of integers for
"compatibility" purposes.  It even says so in the man page.  To make this
work, answer 'int' instead of 'gid_t' at the Configure prompt.

Here's the diffs that I've applied to the released version of perl4.0.
The one that really did the trick for me was the change to cons.c
which fixed a bunch of the failing tests.

*** perl.h.orig	Wed Mar 20 11:46:23 1991
--- perl.h	Wed Mar 20 12:48:43 1991
***************
*** 86,91 ****
--- 86,96 ----
  #include <string.h>
  #endif /* __STDC__ */
  
+ #if	!defined(__STDC__) || defined(NeXT)
+ extern char **environ;
+ #endif /* ! __STDC__ */
+ 
+ 
  #if defined(HAS_MEMCMP) && defined(mips) && BYTEORDER == 0x1234
  #undef HAS_MEMCMP
  #endif
*** consarg.c.orig	Wed Mar 20 11:45:48 1991
--- consarg.c	Fri Mar 22 23:21:05 1991
***************
*** 555,564 ****
  	if (str) {
  	    arg->arg_type = O_ITEM;	/* note arg1 type is already SINGLE */
  	    str_free(s1);
- 	    str_free(s2);
  	    arg[1].arg_ptr.arg_str = str;
! 	    arg[2].arg_ptr.arg_str = Nullstr;
! 	    arg[2].arg_type = A_NULL;
  	}
      }
  }
--- 555,566 ----
  	if (str) {
  	    arg->arg_type = O_ITEM;	/* note arg1 type is already SINGLE */
  	    str_free(s1);
  	    arg[1].arg_ptr.arg_str = str;
! 	    if (s2 != Nullstr) {
! 		str_free(s2);
! 		arg[2].arg_ptr.arg_str = Nullstr;
! 		arg[2].arg_type = A_NULL;
! 	    }
  	}
      }
  }
*** doarg.c.orig	Wed Mar 20 11:44:59 1991
--- doarg.c	Wed Mar 20 12:50:43 1991
***************
*** 20,29 ****
  
  extern unsigned char fold[];
  
- #ifndef __STDC__
- extern char **environ;
- #endif /* ! __STDC__ */
- 
  #ifdef BUGGY_MSC
   #pragma function(memcmp)
  #endif /* BUGGY_MSC */
--- 20,25 ----
*** perl.c.orig	Wed Mar 20 11:45:21 1991
--- perl.c	Wed Mar 20 12:50:41 1991
***************
*** 34,42 ****
  
  static char* moreswitches();
  static char* cddir;
- #ifndef __STDC__
- extern char **environ;
- #endif /* ! __STDC__ */
  static bool minus_c;
  static char patchlevel[6];
  static char *nrs = "\n";
--- 34,39 ----
***************
*** 50,56 ****
--- 47,55 ----
  {
      register STR *str;
      register char *s;
+ #ifndef	__STDC__
      char *index(), *strcpy(), *getenv();
+ #endif
      bool dosearch = FALSE;
  #ifdef DOSUID
      char *validarg = "";
*** stab.c.orig	Wed Mar 20 11:46:16 1991
--- stab.c	Fri Mar 22 23:44:08 1991
***************
*** 192,197 ****
--- 192,198 ----
  		while (*s) s++;
  	    }
  	}
+ 
  #endif
  	str_set(stab_val(stab),buf);
  	break;
*** str.c.orig	Wed Mar 20 11:45:13 1991
--- str.c	Wed Mar 20 12:50:35 1991
***************
*** 16,25 ****
  #include "perl.h"
  #include "perly.h"
  
- #ifndef __STDC__
- extern char **environ;
- #endif /* ! __STDC__ */
- 
  #ifndef str_get
  char *
  str_get(str)
--- 16,21 ----
*** util.c.orig	Wed Mar 20 11:45:28 1991
--- util.c	Wed Mar 20 12:50:30 1991
***************
*** 955,964 ****
  }
  #endif
  
- #ifndef __STDC__
- extern char **environ;
- #endif
- 
  void
  setenv(nam,val)
  char *nam, *val;
--- 955,960 ----