Subject: building pine3.91 on Solaris2.4 with gcc2.7.0?

From: [email-masked] (Ken Yap)
Date: Wed, 8 Nov 1995 01:53:06 GMT

Has anybody succeeded in doing this? The only thing that doesn't build
is pine and this is what happens when I do ./build sol:

Making Pine.
cc -DSV4   -DDEBUG -ansi -DANSI  -c  addrbook.c
In file included from ../c-client/osdep.h:40,
                 from headers.h:78,
                 from addrbook.c:65:
/usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/string.h:30: warning: conflicting types for built-in function `memcpy'
/usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/string.h:32: warning: conflicting types for built-in function `strcpy'
/usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/string.h:38: warning: conflicting types for built-in function `memcmp'
/usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/string.h:39: warning: conflicting types for built-in function `strcmp'
In file included from ../c-client/osdep.h:46,
                 from headers.h:78,
                 from addrbook.c:65:
/usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/unistd.h:225: conflicting types for `rename'
/usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/stdio.h:153: previous declaration of `rename'

cc is a link to gcc. The two occurences of rename in the gcc includes are:

/usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/stdio.h:extern int     rename(const char *, const char *);
/usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/unistd.h:extern int rename(const char *, const char *);

which look consistent to me. I've tried looking for the prototype for
rename in the pine code but got lost in a twisty maze of OS dependent
files. Any clues?

	Thanks, Ken
	[email-masked]

---

From: [email-masked] (Johan Holmberg)
Date: 11 Nov 1995 13:42:20 +0100

>  cc -DSV4   -DDEBUG -ansi -DANSI  -c  addrbook.c
[...stuff deleted...]
>  /usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/unistd.h:225: \
>      conflicting types for `rename'
>  /usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/stdio.h:153: \
>      previous declaration of `rename'
>  
>  /usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/stdio.h:\
>      extern int     rename(const char *, const char *);
>  /usr/GNU/lib/gcc-lib/sparc-sun-solaris2.4/2.7.0/include/unistd.h:\
>      extern int rename(const char *, const char *);
>  

The problem is that there is a define of "const" --> ""
ie. every occurence of the string "const" will be substituted by an empty
string. This definition is inconsistently applied.

I have a patch to PINE3.91 that works for me (also GCC 2.7.0 and
Solaris 2.4). Some things to think about if you try using it:

  1) I don't know if I have done this "the right way". Because of the
     strange way the makefiles are organized in 3.91 I think it is
     very difficult to make a change in *one* place and have if
     affect all other parts of the PINE source tree.

  2) I didn't have "cc" as a link to "gcc". Instead I used:

         ./build sol CC=gcc

     I assume both ways work.

The patch follows below.

Johan Holmberg

-----------------------------------------------------------------------
Johan Holmberg                     Email:   [email-masked]
Telia Promotor AB                  Phone:   +46 18  18 94 55
Box 1218                           Mobile:  +46 70 528 94 55
751 42 Uppsala, SWEDEN             Fax:     +46 18  18 94 99
-----------------------------------------------------------------------

-------------------------BEGIN PATCH----------------------------------
diff -r -c pine3.91/imap/non-ANSI/c-client/Makefile pine3.91-sol-gcc/imap/non-ANSI/c-client/Makefile
*** pine3.91/imap/non-ANSI/c-client/Makefile	Tue Oct 11 00:13:22 1994
--- pine3.91-sol-gcc/imap/non-ANSI/c-client/Makefile	Sat Nov 11 12:20:49 1995
***************
*** 181,187 ****
  sol:	# Solaris
  	$(MAKE) mtest OS=sv4 EXTRADRIVERS="$(EXTRADRIVERS)" \
  		STDPROTO=bezerkproto \
! 		RSHPATH=/usr/bin/rsh CFLAGS="-g -Dconst= $(EXTRACFLAGS)" \
  		RANLIB=true LDFLAGS="-lsocket -lnsl -lgen"
  
  ssn:	# Secure SUN-OS
--- 181,188 ----
  sol:	# Solaris
  	$(MAKE) mtest OS=sv4 EXTRADRIVERS="$(EXTRADRIVERS)" \
  		STDPROTO=bezerkproto \
! 		RSHPATH=/usr/bin/rsh CFLAGS="-g $(EXTRACFLAGS)" \
! 		CC="gcc"\
  		RANLIB=true LDFLAGS="-lsocket -lnsl -lgen"
  
  ssn:	# Secure SUN-OS
diff -r -c pine3.91/pico/makefile.sol pine3.91-sol-gcc/pico/makefile.sol
*** pine3.91/pico/makefile.sol	Fri Feb 25 19:37:22 1994
--- pine3.91-sol-gcc/pico/makefile.sol	Sat Nov 11 12:20:49 1995
***************
*** 48,54 ****
  # it only has /usr/ucb/cc) then change LDCC to the following line and
  # give that a try.  This is still using the Solaris compiler but
  # leaving out the UCB compatibility includes and libraries.
! LDCC= cc5.sol
  
  #CFLAGS=	-Dsv4 -DPOSIX -DJOB_CONTROL -ansi
  #otherwise
--- 48,55 ----
  # it only has /usr/ucb/cc) then change LDCC to the following line and
  # give that a try.  This is still using the Solaris compiler but
  # leaving out the UCB compatibility includes and libraries.
! #LDCC= cc5.sol   # use gcc instead
! LDCC= gcc
  
  #CFLAGS=	-Dsv4 -DPOSIX -DJOB_CONTROL -ansi
  #otherwise
diff -r -c pine3.91/pine/makefile.sol pine3.91-sol-gcc/pine/makefile.sol
*** pine3.91/pine/makefile.sol	Wed Oct  5 07:14:50 1994
--- pine3.91-sol-gcc/pine/makefile.sol	Sat Nov 11 12:50:10 1995
***************
*** 69,81 ****
  LOCLIBES=    $(PICODIR)/libpico.a $(IMAPDIR)/c-client.a
  
  # Use these for the Solaris C compiler
! CFLAGS= -DSV4 $(OPTIMIZE) $(PROFILE) $(DEBUG) -DSYSTYPE=\"SOL\"
! # LDCC= /usr/bin/cc
  # If you don't have /usr/bin/cc (our Solaris 2.2 doesn't seem to have it,
  # it only has /usr/ucb/cc) then change LDCC to the following line and
  # give that a try.  This is still using the Solaris compiler but
  # leaving out the UCB compatibility includes and libraries.
! LDCC= $(PICODIR)/cc5.sol
  
  # Use these for the gcc compiler
  # CC=	gcc
--- 69,81 ----
  LOCLIBES=    $(PICODIR)/libpico.a $(IMAPDIR)/c-client.a
  
  # Use these for the Solaris C compiler
! CFLAGS= -DSV4 $(OPTIMIZE) $(PROFILE) $(DEBUG) -DANSI -DSYSTYPE=\"SOL\"
! LDCC= gcc
  # If you don't have /usr/bin/cc (our Solaris 2.2 doesn't seem to have it,
  # it only has /usr/ucb/cc) then change LDCC to the following line and
  # give that a try.  This is still using the Solaris compiler but
  # leaving out the UCB compatibility includes and libraries.
! #LDCC= $(PICODIR)/cc5.sol
  
  # Use these for the gcc compiler
  # CC=	gcc
diff -r -c pine3.91/pine/osdep/os-sv4.h pine3.91-sol-gcc/pine/osdep/os-sv4.h
*** pine3.91/pine/osdep/os-sv4.h	Mon Oct 10 23:30:01 1994
--- pine3.91-sol-gcc/pine/osdep/os-sv4.h	Sat Nov 11 12:20:50 1995
***************
*** 187,193 ****
--- 187,195 ----
  /*----------------- Are we ANSI? ---------------------------------------*/
  /* #define ANSI          /* this is an ANSI compiler */
  
+ #ifndef ANSI
  #define	const		/* compiler doesn't support const */
+ #endif
  
  /*------ If our compiler doesn't understand type void ------------------*/
  /* #define void char     /* no void in compiler */
-------------------------END PATCH -----------------------------------
-- 
-----------------------------------------------------------------------
Johan Holmberg                     Email:   [email-masked]
Telia Promotor AB                  Phone:   +46 18  18 94 55
Box 1218                           Mobile:  +46 70 528 94 55
751 42 Uppsala, SWEDEN             Fax:     +46 18  18 94 99
-----------------------------------------------------------------------