HP-UX 10.20 and 11.0 fixes, configure.in fixes

gnupg-devel at thewrittenword.com gnupg-devel at thewrittenword.com
Wed May 30 23:50:01 CEST 2001


1. Better test if -lsocket and -lnsl needed. Works fine for
   Solaris 2.5.1, 2.6, 7, 8, and IRIX 6.2, 6.5. Hardcoding the
   result goes against the "autoconf"-way of doing things. If this
   test doesn't fix it then we need to find out why and augment it.
2. Better test for gethrtime().
3. Allow specifying the path to the zlib library if it is
   not in the default compiler/linker search path.
4. Sync G10_LOCALEDIR with new value from upgraded gettext.
5. More up-to-date LFS test (this is included with autoconf 2.50).
6. HP-UX 10.20 has a broken mlock but it does have plock. Plock()
   locks the entire process space in memory. Not the best but
   it's better than swapping the process out. So, if
   HAVE_BROKEN_MLOCK is defined and plock() is available, we
   use plock.

-- 
albert chin (china at thewrittenword.com)

-- snip snip
--- configure.in.orig	Tue May 29 14:21:06 2001
+++ configure.in	Tue May 29 14:24:27 2001
@@ -320,29 +307,8 @@
 fi
 fi
 
-dnl Solaris needs -lsocket and -lnsl. Unisys system includes
-dnl gethostbyname in libsocket but needs libnsl for socket.
-dnl The test does not workfor all system, so some are hardcoded here.
-case "${target}" in
-   i386-univel-sysv4*)
-        LIBS="$LIBS -lsocket -lnsl"
-        ;;
-   *)
-      AC_CHECK_LIB(nsl, gethostbyname)
-      AC_CHECK_LIB(socket, socket, ac_need_libsocket=1, ac_try_nsl=1)
-      if test x$ac_need_libsocket = x1; then
-          LIBS="$LIBS -lsocket"
-      fi
-      if test x$ac_try_nsl = x1; then
-         AC_CHECK_LIB(nsl, gethostbyname, ac_need_libnsl=1)
-         if test x$ac_need_libnsl = x1
-         then
-            LIBS="$LIBS -lnsl"
-         fi
-      fi
-      ;;
-esac
-
+AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
+AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
 
 if test "$try_dynload" = yes ; then
   AC_CHECK_LIB(dl,dlopen)
@@ -428,10 +394,17 @@
 dnl Checks for library functions.
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS(strerror stpcpy strlwr stricmp tcgetattr rand strtoul mmap)
-AC_CHECK_FUNCS(memmove gettimeofday getrusage gethrtime setrlimit clock_gettime)
+AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
 AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime nl_langinfo)
 AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask fseeko)
 
+AC_MSG_CHECKING(for gethrtime)
+AC_TRY_LINK([#include <sys/times.h>],[
+hrtime_t tv;
+tv = gethrtime();],[
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_GETHRTIME)], AC_MSG_RESULT(no))
+
 GNUPG_CHECK_MLOCK
 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
 
@@ -674,10 +647,23 @@
 if test "$g10_force_zlib" = "yes"; then
   :
 else
-  AC_CHECK_HEADERS(zlib.h)
-  if test "$ac_cv_header_zlib_h" = yes ; then
-      AC_CHECK_LIB(z,deflateInit2_,use_local_zlib=no,:)
-  fi
+  _cppflags="${CPPFLAGS}"
+  _ldflags="${LDFLAGS}"
+
+  AC_ARG_WITH(zlib,
+  [  --with-zlib=DIR         use libz in DIR],[
+    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,
+       use_local_zlib=no
+       LIBS="$LIBS -lz",
+       CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
+      CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
 fi
 
 if test "$use_local_zlib" = yes ; then
@@ -688,11 +674,9 @@
 else
     AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
     ZLIBS=
-    LIBS="-lz $LIBS"
 fi
 AC_SUBST(ZLIBS)
 
-
 # Allow users to append something to the version string without
 # flagging it as development version.  The user version parts is
 # considered everything after a dash.
@@ -737,7 +721,7 @@
   #define GNUPG_DATADIR "c:/lib/gnupg"
   #define GNUPG_HOMEDIR "c:/gnupg"
 #else
-  #define G10_LOCALEDIR "${prefix}/${DATADIRNAME}/locale"
+  #define G10_LOCALEDIR "${datadir}/locale"
   #define GNUPG_LIBDIR  "${libdir}/gnupg"
   #define GNUPG_DATADIR "${datadir}/gnupg"
   #ifdef __VMS
@@ -765,18 +749,6 @@
 ])
 
 
-AC_OUTPUT([
-Makefile
-intl/Makefile
-po/Makefile.in
-util/Makefile
-mpi/Makefile
-cipher/Makefile
-g10/Makefile
-doc/Makefile
-tools/Makefile
-zlib/Makefile
-checks/Makefile
-])
+AC_OUTPUT([Makefile intl/Makefile po/Makefile.in util/Makefile mpi/Makefile cipher/Makefile g10/Makefile doc/Makefile tools/Makefile zlib/Makefile checks/Makefile])
 
 dnl *-*wedit:notab*-*  Please keep this as the last line.
--- util/secmem.c.orig	Tue May 29 14:02:42 2001
+++ util/secmem.c	Tue May 29 14:04:00 2001
@@ -32,6 +32,9 @@
   #ifdef USE_CAPABILITIES
     #include <sys/capability.h>
   #endif
+  #ifdef HAVE_PLOCK
+    #include <sys/lock.h>
+  #endif
 #endif
 
 #include "types.h"
@@ -120,6 +123,13 @@
     uid = getuid();
 
   #ifdef HAVE_BROKEN_MLOCK
+    /* ick. but at least we get secured memory. about to lock
+       entire data segment. */
+  #ifdef HAVE_PLOCK
+    err = plock( DATLOCK );
+    if( err && errno )
+        err = errno;
+  #else
     if( uid ) {
 	errno = EPERM;
 	err = errno;
@@ -129,6 +139,7 @@
 	if( err && errno )
 	    err = errno;
     }
+  #endif
   #else
     err = mlock( p, n );
     if( err && errno )
--- acinclude.m4.orig	Tue May 29 14:01:46 2001
+++ acinclude.m4	Tue May 29 14:02:07 2001
@@ -450,6 +450,7 @@
          if test "$gnupg_cv_have_broken_mlock" = "yes"; then
              AC_DEFINE(HAVE_BROKEN_MLOCK)
              AC_MSG_RESULT(yes)
+             AC_CHECK_FUNCS(plock)
          else
             if test "$gnupg_cv_have_broken_mlock" = "no"; then
                 AC_MSG_RESULT(no)
@@ -752,10 +753,7 @@
 fi
 ])
 
- 
-dnl AC_SYS_LARGEFILE is stolen from tar.
-dnl This can be removed once the official successor to autoconf 2.13 is out.
-#serial 12
+#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.
@@ -768,32 +766,36 @@
 dnl AC_SYS_LARGEFILE_TEST_INCLUDES
 AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
   [[#include <sys/types.h>
-    int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
+    /* 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,
-dnl                              COMMENT, INCLUDES,FUNCTION-BODY)
+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(AC_SYS_LARGEFILE_TEST_INCLUDES
-$5
-        ,
-       [$6],
-       ,
-       [AC_TRY_COMPILE([#define $1 $2]
-AC_SYS_LARGEFILE_TEST_INCLUDES
-$5
-          ,
-          [$6],
-          [$3=$2])])])
+      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_ARG_ENABLE(largefile,
+  [AC_REQUIRE([AC_PROG_CC])
+   AC_ARG_ENABLE(largefile,
      [  --disable-largefile     omit support for large files])
    if test "$enable_largefile" != no; then
 
@@ -801,14 +803,14 @@
        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"])
+	  # 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"
@@ -816,18 +818,30 @@
 
      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_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
-       ac_cv_sys_largefile_source,
-       [Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
-       [#include <stdio.h>], [return !ftello;])
+       [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_MACRO_VALUE(_XOPEN_SOURCE, 500,
-       ac_cv_sys_xopen_source,
-       [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
-       [#include <stdio.h>], [return !ftello;])
+       [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 Gnupg-devel mailing list