2.9p1 patches

openssh-unix-dev at thewrittenword.com openssh-unix-dev at thewrittenword.com
Mon May 21 14:09:45 EST 2001


1. Add support for files >2GB via Paul Eggert's AC_SYS_LARGEFILE
   macro. This macro is now part of autoconf 2.50. Because of this,
   "config.h" needs to be included before system headers to get
   the appropriate defines for LFS support.
     openbsd-compat/sigact.c
     configure.in
     acinclude.m4
2. AIX defines TILDE in <sys/ioctl.h>. Rename to TILDE_CHAR. Feel
   free to pick a better name.
     openbsd-compat/glob.c
3. You should *not* place custom macros in aclocal.m4. They should
   be in acinclude.m4 and then you should use aclocal to generate
   aclocal.m4 from acinclude.m4.
     acinclude.m4
4. A better --with-pcre and --with-zlib configure test.
     configure.in

Some comments regarding your code in configure.in:
  1. Hardcoding the need for -lsocket and -lnsl via
     $no_libsocket and $no_libnslis gross. Doing this means you
     don't know how to write a proper autoconf test to determine
     if these two libraries are needed. The solution is not to
     hack in the value with a case statement but to figure out
     the proper autoconf way of solving the problem, independent
     of the hardcoding the solution for every platform. A solution
     proposed below is:
       AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
       AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
     We could probably also add:
       AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
  2. Checks such as the following are wrong:
       AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
     Don't check if the function exists in the library. Check
     first if the function exists *without* the library and then
     with the library if need be (and, FYI, AC_CHECK_LIB(lib,func)
     will automatically add "-l[lib]" to $LIBS):
       AC_CHECK_FUNC(getspnam, , AC_CHECK_LIB(gen, getspnam))

If our autoconf checks aren't correct, let's find out why and fix it.
I'd like to move in a direction where there are *no* hardcoded case
statements per platform in configure.in.

-- 
albert chin (china at thewrittenword.com)

-- snip snip
--- openbsd-compat/sigact.c.orig	Fri May 18 20:48:57 2001
+++ openbsd-compat/sigact.c	Fri May 18 20:49:05 2001
@@ -33,8 +33,8 @@
  *     and: Eric S. Raymond <esr at snark.thyrsus.com>                         *
  ****************************************************************************/
 
-#include <signal.h>
 #include "config.h"
+#include <signal.h>
 #include "sigact.h"
 
 /* This file provides sigaction() emulation using sigvec() */
--- openbsd-compat/glob.c.orig	Fri May 18 20:49:30 2001
+++ openbsd-compat/glob.c	Fri May 18 20:49:42 2001
@@ -97,7 +97,7 @@
 #define	RBRACKET	']'
 #define	SEP		'/'
 #define	STAR		'*'
-#define	TILDE		'~'
+#define	TILDE_CHAR	'~'
 #define	UNDERSCORE	'_'
 #define	LBRACE		'{'
 #define	RBRACE		'}'
@@ -354,7 +354,7 @@
 	const Char *p;
 	Char *b, *eb;
 
-	if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
+	if (*pattern != TILDE_CHAR || !(pglob->gl_flags & GLOB_TILDE))
 		return pattern;
 
 	/* Copy up to the end of the string or / */
--- configure.in.orig	Fri May 18 20:50:43 2001
+++ configure.in	Fri May 18 23:45:09 2001
@@ -9,6 +9,7 @@
 
 # Checks for programs.
 AC_PROG_CPP
+AC_SYS_LARGEFILE
 AC_PROG_RANLIB
 AC_PROG_INSTALL
 AC_PATH_PROG(AR, ar)
@@ -285,35 +256,56 @@
 	]	
 )
 
+dnl for PCRE regex library
 AC_ARG_WITH(pcre,
-	[  --with-pcre             Override built in regex library with pcre],
-	[
-
-		AC_CHECK_LIB(pcre, pcre_info, 
-			[ 
-				AC_DEFINE(HAVE_LIBPCRE) 
-				LIBS="$LIBS -lpcreposix -lpcre" 
-				no_comp_check="yes"
-			],
-			[ AC_MSG_ERROR([*** Can not locate pcre libraries.]) ]
-		)
-	]	
-)
+  [  --with-pcre[=PATH]      Override builtin regex library with PCRE
+                          (optionally in DIR)],[
+  case "$withval" in
+  no) ;;
+  *)
+    if test "x$withval" != "xyes"; then
+      CPPFLAGS="${CPPFLAGS} -I$withval/include"
+      LDFLAGS="${LDFLAGS} -L$withval/lib"
+    fi
+
+    AC_CHECK_HEADER(pcreposix.h,
+      AC_CHECK_LIB(pcre, pcre_info,[
+        AC_DEFINE(HAVE_LIBPCRE)
+        LIBS="$LIBS -lpcreposix -lpcre"
+        no_comp_check=yes],
+        AC_MSG_ERROR([*** unable to locate pcre library ***])),
+      AC_MSG_ERROR([*** unable to locate pcreposix.h include file ***]))
+    ;;
+  esac
+])
 
 # Checks for libraries.
-if test -z "$no_libnsl" ; then
-	AC_CHECK_LIB(nsl, yp_match, , )
-fi
-if test -z "$no_libsocket" ; then
-	AC_CHECK_LIB(socket, main, , )
-fi
+AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
+AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
 
 dnl SCO OS3 needs this for libwrap
-AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
+AC_CHECK_FUNC(innetgr, ,
+  AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc))
 
-AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")
-AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
-AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
+AC_CHECK_FUNC(getspnam, ,
+  AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
+AC_CHECK_FUNC(login, ,
+  AC_CHECK_LIB(util, login,
+    AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil"))
+
+dnl zlib is required
+AC_ARG_WITH(zlib,
+[  --with-zlib=PATH        Use zlib in PATH],[
+  if test -d "$withval"; then
+    CPPFLAGS="${CPPFLAGS} -I$withval/include"
+    LDFLAGS="${LDFLAGS} -L$withval/lib"
+  fi
+])
+
+AC_CHECK_HEADER(zlib.h,
+  AC_CHECK_LIB(z, gzread, ,
+    AC_MSG_ERROR([*** zlib missing. install first or check config.log ***])),
+  AC_MSG_ERROR([*** zlib missing. install first or check config.log ***]))
 
 # We don't want to check if we did an pcre override.
 if test -z "$no_comp_check" ; then
@@ -396,7 +388,7 @@
 # Check whether user wants S/Key support
 SKEY_MSG="no" 
 AC_ARG_WITH(skey,
-	[  --with-skey=PATH         Enable S/Key support],
+	[  --with-skey=PATH        Enable S/Key support],
 	[
 		if test "x$withval" != "xno" ; then
 
--- /dev/null	Sat Nov 11 12:59:35 2000
+++ acinclude.m4	Fri May 18 20:50:37 2001
@@ -0,0 +1,137 @@
+dnl $Id: aclocal.m4,v 1.4 2000/06/26 00:20:19 djm Exp $
+dnl
+dnl OpenSSH-specific autoconf macros
+dnl
+
+
+dnl OSSH_CHECK_HEADER_FOR_FIELD(field, header, symbol)
+dnl Does AC_EGREP_HEADER on 'header' for the string 'field'
+dnl If found, set 'symbol' to be defined. Cache the result.
+dnl TODO: This is not foolproof, better to compile and read from there
+AC_DEFUN(OSSH_CHECK_HEADER_FOR_FIELD, [
+# look for field '$1' in header '$2'
+	dnl This strips characters illegal to m4 from the header filename
+	ossh_safe=`echo "$2" | sed 'y%./+-%__p_%'`
+	dnl
+	ossh_varname="ossh_cv_$ossh_safe""_has_"$1
+	AC_MSG_CHECKING(for $1 field in $2)
+	AC_CACHE_VAL($ossh_varname, [
+		AC_EGREP_HEADER($1, $2, [ dnl
+			eval "$ossh_varname=yes" dnl
+		], [ dnl
+			eval "$ossh_varname=no" dnl
+		]) dnl
+	])
+	ossh_result=`eval 'echo $'"$ossh_varname"`
+	if test -n "`echo $ossh_varname`"; then
+		AC_MSG_RESULT($ossh_result)
+		if test "x$ossh_result" = "xyes"; then
+			AC_DEFINE($3)
+		fi
+	else
+		AC_MSG_RESULT(no)
+	fi
+])
+
+dnl OSSH_PATH_ENTROPY_PROG(variablename, command):
+dnl Tidiness function, sets 'undef' if not found, and does the AC_SUBST
+AC_DEFUN(OSSH_PATH_ENTROPY_PROG, [
+	AC_PATH_PROG($1, $2)
+	if test -z "[$]$1" ; then
+		$1="undef"
+	fi
+	AC_SUBST($1)
+])
+
+#serial 19
+
+dnl By default, many hosts won't let programs access large files;
+dnl one must use special compiler options to get large-file access to work.
+dnl For more details about this brain damage please see:
+dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
+
+dnl Written by Paul Eggert <eggert at twinsun.com>.
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_TEST_INCLUDES
+AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
+  [[#include <sys/types.h>
+    /* Check that off_t can represent 2**63 - 1 correctly.
+       We can't simply "#define LARGE_OFF_T 9223372036854775807",
+       since some C++ compilers masquerading as C compilers
+       incorrectly reject 9223372036854775807.  */
+#   define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+    int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+			&& LARGE_OFF_T % 2147483647 == 1)
+		       ? 1 : -1];
+  ]])
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
+AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
+  [AC_CACHE_CHECK([for $1 value needed for large files], $3,
+     [$3=no
+      AC_TRY_COMPILE([$5],
+	[$6], 
+	,
+	[AC_TRY_COMPILE([#define $1 $2]
+[$5]
+	   ,
+	   [$6],
+	   [$3=$2])])])
+   if test "[$]$3" != no; then
+     AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
+   fi])
+
+AC_DEFUN(AC_SYS_LARGEFILE,
+  [AC_REQUIRE([AC_PROG_CC])
+   AC_ARG_ENABLE(largefile,
+     [  --disable-largefile     omit support for large files])
+   if test "$enable_largefile" != no; then
+
+     AC_CACHE_CHECK([for special C compiler options needed for large files],
+       ac_cv_sys_largefile_CC,
+       [ac_cv_sys_largefile_CC=no
+        if test "$GCC" != yes; then
+	  # IRIX 6.2 and later do not support large files by default,
+	  # so use the C compiler's -n32 option if that helps.
+	  AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
+	    [ac_save_CC="$CC"
+	     CC="$CC -n32"
+	     AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
+	       ac_cv_sys_largefile_CC=' -n32')
+	     CC="$ac_save_CC"])
+        fi])
+     if test "$ac_cv_sys_largefile_CC" != no; then
+       CC="$CC$ac_cv_sys_largefile_CC"
+     fi
+
+     AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
+       ac_cv_sys_file_offset_bits,
+       [Number of bits in a file offset, on hosts where this is settable.],
+       AC_SYS_LARGEFILE_TEST_INCLUDES)
+     AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
+       ac_cv_sys_large_files,
+       [Define for large files, on AIX-style hosts.],
+       AC_SYS_LARGEFILE_TEST_INCLUDES)
+   fi
+  ])
+
+AC_DEFUN(AC_FUNC_FSEEKO,
+  [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
+     ac_cv_sys_largefile_source,
+     [Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
+     [#include <stdio.h>], [return !fseeko;])
+   # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+   # in glibc 2.1.3, but that breaks too many other things.
+   # If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+
+   AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko,
+     [ac_cv_func_fseeko=no
+      AC_TRY_LINK([#include <stdio.h>],
+        [return fseeko && fseeko (stdin, 0, 0);],
+	[ac_cv_func_fseeko=yes])])
+   if test $ac_cv_func_fseeko != no; then
+     AC_DEFINE(HAVE_FSEEKO, 1,
+       [Define if fseeko (and presumably ftello) exists and is declared.])
+   fi])



More information about the openssh-unix-dev mailing list