From: tmcconne@sedona.intel.com (Tom McConnell)
Newsgroups: gnu.utils.bug
Subject: more m4-1.0 patches.
Date: 20 Jul 92 12:29:01 GMT
Distribution: gnu
Organization: GNUs Not Usenet


  Hello again.

  I have gotten m4-1.0 up on the following platforms, using gcc-2.2.2 for
each case:

     Machine           Operating System    Configure Command

   IBM RS/6000           AIX 3.1.6          ./configure aix
   IBM RS/6000           AIX 3.2            ./configure aix32
   Sun 4/330 (SPARC)     SunOS 4.1          ./configure sunos
   Sun 386i              SunOS 4.0.2        ./configure sunos
   NCR (i486)            SVR4               ./configure svr4
   DEC VAXstation 3100   ultrix 3.1         ./configure ultrix

  The svr4 port was the worst, because I had to rewrite m4.c, m4.h, and
/usr/include/sys/types.h to fix a definition problem with "boolean". I
also added a flag, "HAVE_BOOLEAN", to help out m4.h. I had to move
"#include <sys/types>" from m4.c to m4.h for this same problem.

  I have gcc-2.2.2 ported to all these machines, and to simplify the
ports I relied on gcc for the compiling. "gmake check" runs to
completion on all platforms, with occasional "stdout mismatch" lines.
These are usually one or two line differences, and do not seem to affect
m4. I did not really investigate why there were differences, as long as
the test ran. The differences usually look like this:

    Input file: examples/33.divert
    "m4.texinfo": 1702: Origin here
    examples/33.divert: stdout mismatch
    3d2
    < 

  For AIX 3.2, which defines getopt in <stdlib.h> without "const", I
introduced "BROKEN_GETOPT", which is used to define "CONST" as "" in
./lib/getopt.h, ./lib/getopt.c and ./lib/getopt1.c. ./lib/getopt.h was
modified to use "CONST" for this purpose.

  The definition of "POINTER" was modified in ./lib/obstack.c to make it
more ANSIish ("void *" instead of "char *" when "__STDC__").

  And finally, I changed setbuf() and rewind() to void.

  Here are the patches. I hope they work :)

    Cheers,

    Tom McConnell

 Tom McConnell          |     Internet: tmcconne@sedona.intel.com
 Intel, Corp. C3-21     |     Phone: (602)-554-8229
 5000 W. Chandler Blvd. | The opinions expressed are my own. No one in 
 Chandler, AZ  85226    | their right mind would claim them.


This patch file was created on Mon Jul 20 19:16:28 MST 1992.

The top level directory was /a/stor/gnu/src/m4-1.0


*** ./config/hmake-aix_orig	Mon Jul 20 13:25:29 1992
--- ./config/hmake-aix	Mon Jul 20 13:51:36 1992
***************
*** 0 ****
--- 1,4 ----
+ OS	= -DAIX
+ LOADLIBES = -lPW	# for alloca()
+ CC	= gcc
+ CFLAGS	= -O -g -fsigned-char
*** ./config/hmake-aix32_orig	Mon Jul 20 17:49:06 1992
--- ./config/hmake-aix32	Mon Jul 20 17:49:36 1992
***************
*** 0 ****
--- 1,4 ----
+ OS	= -DAIX
+ LOADLIBES = -lPW	# for alloca()
+ CC	= gcc
+ CFLAGS	= -O -g -fsigned-char
*** ./config/s-aix32.h_orig	Mon Jul 20 17:49:52 1992
--- ./config/s-aix32.h	Mon Jul 20 17:52:58 1992
***************
*** 0 ****
--- 1,37 ----
+ /* 
+  * System V config.h
+  */
+ 
+ 
+ /* 
+  * Define this if your system has the tmpfile(3) function.
+  */
+ #define HAVE_TMPFILE
+ 
+ /* 
+  * Define this if your system has the mkstemp(3) function.  This is only
+  * used if HAVE_TMPFILE is NOT defined.
+  */
+ #undef HAVE_MKSTEMP
+ 
+ /* 
+  * Define this is your system supports the [efg]cvt(3) functions.  This
+  * is used in format.c
+  */
+ #define HAVE_EFGCVT	(1)
+ 
+ /* 
+  * Define this if you have <stdlib.h>.
+  */
+ #define STDC_HEADERS
+ 
+ /* 
+  * Define this if <string.h> and <memory.h> conflicts.  This has been
+  * observed on some systems.
+  */
+ #undef NO_MEMORY_H
+ 
+ /* 
+  * Define this if <stdlib.h> defines getopt without "const".
+  */
+ #define BROKEN_GETOPT
*** ./config/s-aix.h_orig	Mon Jul 20 13:25:30 1992
--- ./config/s-aix.h	Mon Jul 20 13:25:30 1992
***************
*** 0 ****
--- 1,32 ----
+ /* 
+  * System V config.h
+  */
+ 
+ 
+ /* 
+  * Define this if your system has the tmpfile(3) function.
+  */
+ #define HAVE_TMPFILE
+ 
+ /* 
+  * Define this if your system has the mkstemp(3) function.  This is only
+  * used if HAVE_TMPFILE is NOT defined.
+  */
+ #undef HAVE_MKSTEMP
+ 
+ /* 
+  * Define this is your system supports the [efg]cvt(3) functions.  This
+  * is used in format.c
+  */
+ #define HAVE_EFGCVT	(1)
+ 
+ /* 
+  * Define this if you have <stdlib.h>.
+  */
+ #define STDC_HEADERS
+ 
+ /* 
+  * Define this if <string.h> and <memory.h> conflicts.  This has been
+  * observed on some systems.
+  */
+ #undef NO_MEMORY_H
*** ./config/hmake-svr4_orig	Mon Jul 20 19:01:59 1992
--- ./config/hmake-svr4	Mon Jul 20 19:01:37 1992
***************
*** 0 ****
--- 1,4 ----
+ OS	= -DUSG
+ LOADLIBES =
+ CC	= gcc
+ CFLAGS	= -O -g
*** ./config/s-svr4.h_orig	Mon Jul 20 19:01:51 1992
--- ./config/s-svr4.h	Mon Jul 20 18:33:04 1992
***************
*** 0 ****
--- 1,37 ----
+ /* 
+  * System V config.h
+  */
+ 
+ 
+ /* 
+  * Define this if your system has the tmpfile(3) function.
+  */
+ #define HAVE_TMPFILE
+ 
+ /* 
+  * Define this if your system has the mkstemp(3) function.  This is only
+  * used if HAVE_TMPFILE is NOT defined.
+  */
+ #undef HAVE_MKSTEMP
+ 
+ /* 
+  * Define this is your system supports the [efg]cvt(3) functions.  This
+  * is used in format.c
+  */
+ #define HAVE_EFGCVT	(1)
+ 
+ /* 
+  * Define this if you have <stdlib.h>.
+  */
+ #define STDC_HEADERS
+ 
+ /* 
+  * Define this if <string.h> and <memory.h> conflicts.  This has been
+  * observed on some systems.
+  */
+ #undef NO_MEMORY_H
+ 
+ /* 
+  * Define this if <sys/types.h> defines boolean.
+  */
+ #define HAVE_BOOLEAN
*** ./lib/getopt.h_orig	Mon Jul 20 17:56:10 1992
--- ./lib/getopt.h	Mon Jul 20 18:09:12 1992
***************
*** 16,19 ****
--- 16,25 ----
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
+ #if defined (__STDC__) && !defined (BROKEN_GETOPT)
+ #define CONST const
+ #else
+ #define CONST
+ #endif
+ 
  /* For communication from `getopt' to the caller.
     When `getopt' finds an option that takes an argument,
***************
*** 79,87 ****
  };
  
! #ifdef __STDC__
! extern const struct option *_getopt_long_options;
! #else
! extern struct option *_getopt_long_options;
! #endif
  
  /* If nonzero, '-' can introduce long-named options.
--- 85,89 ----
  };
  
! extern CONST struct option *_getopt_long_options;
  
  /* If nonzero, '-' can introduce long-named options.
***************
*** 97,105 ****
  
  #ifdef __STDC__
! int getopt (int argc, char **argv, const char *shortopts);
! int getopt_long (int argc, char **argv, const char *shortopts,
! 		 const struct option *longopts, int *longind);
! int getopt_long_only (int argc, char **argv, const char *shortopts,
! 		      const struct option *longopts, int *longind);
  void envopt(int *pargc, char ***pargv, char *optstr);
  #else
--- 99,111 ----
  
  #ifdef __STDC__
! #ifdef USG
! int getopt (int argc, char *CONST *argv, CONST char *shortopts);
! #else
! int getopt (int argc, char **argv, CONST char *shortopts);
! #endif /* USG */
! int getopt_long (int argc, char **argv, CONST char *shortopts,
! 		 CONST struct option *longopts, int *longind);
! int getopt_long_only (int argc, char **argv, CONST char *shortopts,
! 		      CONST struct option *longopts, int *longind);
  void envopt(int *pargc, char ***pargv, char *optstr);
  #else
*** ./lib/getopt.c_orig	Mon Jul 20 15:04:35 1992
--- ./lib/getopt.c	Mon Jul 20 17:53:08 1992
***************
*** 16,20 ****
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
! #ifdef __STDC__
  #define CONST const
  #else
--- 16,20 ----
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
! #if defined (__STDC__) && !defined (BROKEN_GETOPT)
  #define CONST const
  #else
*** ./lib/getopt1.c_orig	Mon Jul 20 15:04:38 1992
--- ./lib/getopt1.c	Mon Jul 20 17:53:18 1992
***************
*** 18,22 ****
  #include "getopt.h"
  
! #ifdef __STDC__
  #define CONST const
  #else
--- 18,22 ----
  #include "getopt.h"
  
! #if defined (__STDC__) && !defined (BROKEN_GETOPT)
  #define CONST const
  #else
*** ./lib/obstack.c_orig	Wed Jul 31 17:34:50 1991
--- ./lib/obstack.c	Mon Jul 20 13:25:31 1992
***************
*** 20,28 ****
  #ifdef __STDC__
  #define POINTER void *
  #else
  #define POINTER char *
- #endif
- 
  extern int abort();
  
  /* Determine default alignment.  */
--- 20,28 ----
  #ifdef __STDC__
  #define POINTER void *
+ extern void abort();
  #else
  #define POINTER char *
  extern int abort();
+ #endif
  
  /* Determine default alignment.  */
*** ./m4.c_orig	Mon Jul 20 18:43:00 1992
--- ./m4.c	Mon Jul 20 18:45:32 1992
***************
*** 21,25 ****
  #include "version.h"
  #include "getopt.h"
- #include <sys/types.h>
  #include <sys/signal.h>
  
--- 21,24 ----
*** ./m4.h_orig	Thu Oct 24 07:32:23 1991
--- ./m4.h	Mon Jul 20 18:45:38 1992
***************
*** 21,24 ****
--- 21,25 ----
  #include <ctype.h>
  #include <varargs.h>
+ #include <sys/types.h>
  
  #include "config.h"
***************
*** 57,61 ****
  extern void free();
  
! extern int setbuf();
  extern int sscanf();
  extern int fputs();
--- 58,62 ----
  extern void free();
  
! extern void setbuf();
  extern int sscanf();
  extern int fputs();
***************
*** 66,70 ****
  extern int fclose();
  extern int ungetc();
! extern int rewind();
  
  extern int atoi();
--- 67,71 ----
  extern int fclose();
  extern int ungetc();
! extern void rewind();
  
  extern int atoi();
***************
*** 84,88 ****
--- 85,91 ----
  #define nil 0
  
+ #ifndef HAVE_BOOLEAN
  typedef enum boolean { false = 0, true = 1 } boolean;
+ #endif
  
  extern int errno;
Newsgroups: gnu.utils.bug