From: jtc@gain.COM (J.T. Conklin)
Subject: cpio-2.0 and SunOS 4.1.2, Solaris 2.0, AIX 3.2, HPUX 8.07, and IRIX 4.0.1
Reply-To: jtc@gain.com
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 12 Sep 1992 07:48:55 GMT

IRIX:
	``#define const'' causes problems with system header files.
	For example, system() is prototyped in <stdio.h> and
	<stdlib.h>.  If const is defined in between, the prototypes
	conflict.  I removed all cases of ``#define const'' and
	replaced them with AC_CONST in configure.in.

SOLARIS:
	Added cast to ``&size'' argument of setsockopt() in rmt.c to
	avoid conflict with prototype.

	Network stuff in -lsocket and -lnsl.  Added tests in
	configure.in.


SUNOS, AIX, HPUX, ULTRIX:
	No problems.

diff -c gnu/cpio/configure:1.1.1.1 gnu/cpio/configure:1.2
*** gnu/cpio/configure:1.1.1.1	Sat Sep 12 14:48:28 1992
--- gnu/cpio/configure	Sat Sep 12 14:48:28 1992
***************
*** 505,510 ****
--- 505,522 ----
    fi
  fi

+ echo checking for working const
+ echo "
+ main() { exit(0); } t() { /* Ultrix mips cc rejects this.  */
+ typedef int charset[2]; const charset x;
+  }" > conftest.c
+ if eval $compile; then
+   :
+ else
+   DEFS="$DEFS -Dconst="
+ fi
+ rm -f conftest*
+
  echo checking for directory library header
  echo checking for dirent.h
  cat <<EOF > conftest.c
***************
*** 580,585 ****
--- 592,606 ----
    *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
    esac
  fi
+
+ if test -f /lib/libsocket.a; then
+ 	LIBS="$LIBS -lsocket"
+ fi
+
+ if test -f /lib/libnsl.a; then
+ 	LIBS="$LIBS -lnsl"
+ fi
+

  if test -n "$prefix"; then
    test -z "$exec_prefix" && exec_prefix='$(prefix)'
diff -c gnu/cpio/configure.in:1.1.1.1 gnu/cpio/configure.in:1.2
*** gnu/cpio/configure.in:1.1.1.1	Sat Sep 12 14:48:29 1992
--- gnu/cpio/configure.in	Sat Sep 12 14:48:29 1992
***************
*** 23,27 ****
--- 23,37 ----
  AC_HAVE_FUNCS(strerror lchown)
  AC_VPRINTF
  AC_ALLOCA
+ AC_CONST
  AC_XENIX_DIR
+ if test -f /lib/libsocket.a; then
+ 	LIBS="$LIBS -lsocket"
+ fi
+
+ if test -f /lib/libnsl.a; then
+ 	LIBS="$LIBS -lnsl"
+ fi
+
+
  AC_OUTPUT(Makefile)
diff -c gnu/cpio/fnmatch.c:1.1.1.1 gnu/cpio/fnmatch.c:1.2
*** gnu/cpio/fnmatch.c:1.1.1.1	Sat Sep 12 14:48:29 1992
--- gnu/cpio/fnmatch.c	Sat Sep 12 14:48:29 1992
***************
*** 22,31 ****
  extern int errno;
  #endif

- #if !__STDC__
- #define const
- #endif
-
  /* Match STRING against the filename pattern PATTERN, returning zero if
     it matches, nonzero if not.  */
  int
--- 22,27 ----
diff -c gnu/cpio/fnmatch.h:1.1.1.1 gnu/cpio/fnmatch.h:1.2
*** gnu/cpio/fnmatch.h:1.1.1.1	Sat Sep 12 14:48:30 1992
--- gnu/cpio/fnmatch.h	Sat Sep 12 14:48:30 1992
***************
*** 30,37 ****
  #else /* Not C++ or ANSI C.  */
  #undef	__P
  #define	__P(args)	()
- #undef	const
- #define	const
  #endif /* C++ or ANSI C.  */

  /* Bits set in the FLAGS argument to `fnmatch'.  */
--- 30,35 ----
diff -c gnu/cpio/getopt.c:1.1.1.1 gnu/cpio/getopt.c:1.2
*** gnu/cpio/getopt.c:1.1.1.1	Sat Sep 12 14:48:31 1992
--- gnu/cpio/getopt.c	Sat Sep 12 14:48:31 1992
***************
*** 51,60 ****
  #define	__alloca	alloca
  #endif	/* GNU C library.  */

- #if !__STDC__
- #define const
- #endif
-
  /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
     long-named option.  Because this is not POSIX.2 compliant, it is
     being phased out.  */
--- 51,56 ----
diff -c gnu/cpio/getopt1.c:1.1.1.1 gnu/cpio/getopt1.c:1.2
*** gnu/cpio/getopt1.c:1.1.1.1	Sat Sep 12 14:48:31 1992
--- gnu/cpio/getopt1.c	Sat Sep 12 14:48:31 1992
***************
*** 17,26 ****
  
  #include "getopt.h"

- #ifndef __STDC__
- #define const
- #endif
-
  #if defined(STDC_HEADERS) || defined(__GNU_LIBRARY__) || defined (LIBC)
  #include <stdlib.h>
  #else /* STDC_HEADERS or __GNU_LIBRARY__ */
--- 17,22 ----
diff -c gnu/cpio/rmt.c:1.1.1.1 gnu/cpio/rmt.c:1.2
*** gnu/cpio/rmt.c:1.1.1.1	Sat Sep 12 14:48:32 1992
--- gnu/cpio/rmt.c	Sat Sep 12 14:48:32 1992
***************
*** 252,258 ****
  	maxrecsize = size;
  #ifdef SO_RCVBUF
  	while (size > 1024 &&
! 	       setsockopt(0, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size)) < 0)
  		size -= 1024;
  #else
  	size= 1+((size-1)%1024);
--- 252,258 ----
  	maxrecsize = size;
  #ifdef SO_RCVBUF
  	while (size > 1024 &&
! 	       setsockopt(0, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof (size)) < 0)
  		size -= 1024;
  #else
  	size= 1+((size-1)%1024);


Newsgroups: gnu.utils.bug