[comp.unix.aix] Mods to make perl under AIX 3.01 - and possible compiler bug

rab@tauon.ph.unimelb.edu.au (Richard Alan Brown) (02/05/91)

The following modifications needed to be made to the perl (Release 3
patchlevel 28) source to compile on an IBM RS/6000 running AIX 3.01:

I am posting this:
	(a) for your information
	(b) for your ideas - particularly about problem 4. below.

1. in x2p/util.c

   the AIX xlc compiler throws up on:
   #ifdef undef
   ...it regards 'undef' as a illegal keyword
   I changed `undef' to `UNDEF'

2. in perl.h

   can't redefine sprintf(). Enclose within #ifndef AIX / #endif pair
   (and add -DAIX to CFLAGS in the makefile)

3. in doio.c

   In the conditional compilation determined by PWCLASS, the code assumes that
   if pw_class is not present, then pw_comment is. This is not true for AIX.
   I have set it to pw_gecos for want of a better idea.

4. in eval.c

   The compiler complains about multiple instances of the `case' 32 in the big
   switch statement. This appears to be a bug in the compiler, since inspection
   of the preprocessor output confirms that there  is only one instance of the
   case '32'. Changing the definition of O_COMPLEMENT from 32 to 247 made the
   problem disappear.

With the above mods, perl compiles and links. Doing 'make test' shows that
this version of perl fails the following tests:

	io.pipe	test 1
	op.exec	test 8

the others are ok. Since i am a perl novice, i haven't looked closely at this.

rab
------------------------------------------------------------------------
Richard Brown                     | E-mail: rab@tauon.ph.unimelb.EDU.AU
School of Physics                 | Phone : +61 3 344 5081
University of Melbourne           | Fax   : +61 3 347 4783
Parkville Victoria AUSTRALIA 3052 | Telex : AA35185

ejk@ux2.cso.uiuc.edu (Ed Kubaitis) (02/05/91)

Some of the problems you reported building perl at patchlevel 28 have been 
addressed in later versions of perl. Here is a recipe for building perl at
patchlevel 44 on AIX 3.1 (3001) that passes all tests in "make test". Note 
that "cc", not "xlc" or "bsdcc" is used.

   o  used perl-3.0.41.tar.Z from prep.ai.mit.edu
   o  applied patches 42, 43, & 44
   o  ./Configure  
      Default answer on all questions, EXCEPT:
      "Do you wish to attempt to use the malloc that comes with perl? [y] n"

   o  apply attached patch which:
	 o defines SYMLINK in config.h
	 o prevents redefintion of sprintf in perl.h
	 o inserts "#pragma alloca" in x2p/a2p.y
   o  make depend
   o  make
   o  make test
   o  make install

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

Attachment: patch for config.h, perl.h, x2p/a2p.y
==============================================================================
*** config.h-	Mon Jan 14 10:16:13 1991
--- config.h	Mon Jan 14 10:16:54 1991
***************
*** 418,424 ****
   *	This symbol, if defined, indicates that the symlink routine is available
   *	to create symbolic links.
   */
! /*#undef	SYMLINK		/**/
  
  /* SYSCALL:
   *	This symbol, if defined, indicates that the syscall routine is available
--- 418,424 ----
   *	This symbol, if defined, indicates that the symlink routine is available
   *	to create symbolic links.
   */
! #define	SYMLINK		/**/
  
  /* SYSCALL:
   *	This symbol, if defined, indicates that the syscall routine is available
*** perl.h-	Mon Jan 14 08:09:19 1991
--- perl.h	Mon Jan 14 08:23:20 1991
***************
*** 415,421 ****
  #   define I286
  #endif
  
! #ifndef	__STDC__
  #ifdef CHARSPRINTF
      char *sprintf();
  #else
--- 415,421 ----
  #   define I286
  #endif
  
! #if !defined(__STDC__) && !defined(_IBMR2)
  #ifdef CHARSPRINTF
      char *sprintf();
  #else
*** x2p/a2p.y-	Mon Jan 14 08:11:01 1991
--- x2p/a2p.y	Mon Jan 14 08:11:34 1991
***************
*** 22,27 ****
--- 22,28 ----
   * 
   */
  
+ #pragma alloca
  #include "INTERN.h"
  #include "a2p.h"
  

marc@ibmpa.awdpa.ibm.com (Marc Pawliger) (02/06/91)

In article <406@ariel.ucs.unimelb.edu.au>, rab@tauon.ph.unimelb.edu.au (Richard Alan Brown) writes:
|> The following modifications needed to be made to the perl (Release 3
|> patchlevel 28) source to compile on an IBM RS/6000 running AIX 3.01:

[fixes deleted]

Perl release 3 is currently at patchlevel 44.  The patches are available from
uunet.uu.net, prep.ai.mit.edu and jpl-devvax.jpl.nasa.gov via anonymous ftp. 
_Many_ fixes have been made since pl28.

Anyway, perl3@44 compiles quite nicely on the '6000 with just one fix in
malloc.c.  If you answered 'no' the the question 'Do you wish to use the
malloc that comes with perl?', then perl compiles clean right out of the box
and passes all the tests.  If you answered 'yes', then all you need do is
change the declaration of free in malloc.c to be 'void free(cp) void * cp;'
instead of the supplied 'free(cp) char * cp;'  This is because the stdlib.h
supplied with the '6000 uses the POSIX/ANSI definition of free and would not
allow it to be redeclared with a different signature.

+--Marc Pawliger----IBM Advanced Workstations Division----Palo Alto, CA---+
|   Internet: marc@ibminet.awdpa.ibm.com        VNET:    MARCP at AUSVM6  |
|    UUCP:     uunet!ibminet.awdpa.ibm.com!marc  Phone:   (415) 855-3493  |
+-----IBMinet:  marc@ibmpa.awdpa.ibm.com----------IBM T/L:  465-3493------+

As always, these are my opinions and not IBM's etc etc etc