two configure patches for 1.1.0
Tim Mooney
mooney at dogbert.cc.ndsu.nodak.edu
Mon Feb 28 12:54:17 CET 2000
[I'm not on the -devel list, so Cc: me if you want me to see a reply]
I've noticed that configure for gnupg doesn't detect mlock or SHM_LOCK on
Tru64 Unix. I spent some time looking at the configure tests, and I've
included a patch that improves the situation in both cases.
The reason that SHM_LOCK isn't being detected is that the AC_TRY_COMPILE is
being called incorrectly -- its second argument should be a function *body*,
not a complete function. You'll see what I mean if you investigate the code
that's generated in configure as a result of the existing code in the
GNUPG_CHECK_IPC test in aclocal.m4. This test probably wasn't working on
many platforms because of the error.
The mlock problem is probably specific to systems of OSF origin. Basically,
some #defines from sys/mman.h need to be picked up before mlock functionality
will be found, since it's mapped to the function `memlk'. It's probably
academic, since mlock on Tru64 systems is documented as failing unless
you're the superuser (like HP-UX), but the additions I've made to the
checks should make it more robust in general. Oddly enough once my patch
is in place and mlock is found, the "mlock is broken" test outputs no,
even though the man page for mlock clearly states that superuser priviledges
are required to even call the functions (and I'm building as myself, not
root). Either the man page is wrong or the configure test isn't detecting
the problem.
I'm running into unrelated link problems (at least with 1.1.0 -- the earlier
releases are fine) while building mpicalc in the tools directory, so I
haven't had a chance to see what the overall affect these changes have on how
gnupg functions. I think the changes I made improve things, but I can't
yet verify that supposition.
The included patch is against 1.1.0.
Also, I really had to hunt to confirm my guess as to where I should mail
this. You might want to add a "How to report bugs" section to the web
pages and to the BUGS file in the distribution itself.
Tim
--
Tim Mooney mooney at dogbert.cc.ndsu.NoDak.edu
Information Technology Services (701) 231-1076 (Voice)
Room 242-J1, IACC Building (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
--- gnupg-1.1.0.orig/aclocal.m4 Tue Oct 26 07:18:26 1999
+++ gnupg-1.1.0/aclocal.m4 Mon Feb 28 10:44:54 2000
@@ -281,7 +281,8 @@
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>],[
- int foo( int shm_id ) { shmctl(shm_id, SHM_LOCK, 0); }
+ int shm_id;
+ shmctl(shm_id, SHM_LOCK, 0);
],
gnupg_cv_ipc_have_shm_lock="yes",
gnupg_cv_ipc_have_shm_lock="no"
@@ -301,9 +302,50 @@
# is not called from uid 0 (not tested whether uid 0 works)
dnl GNUPG_CHECK_MLOCK
dnl
+dnl It's not enough to just AC_CHECK_FUNCTIONS(mlock), since some OSes use
+dnl #defines in sys/mman.h to map mlock to a different name (like memlk).
+dnl For this reason, we AC_TRY_COMPILE instead.
define(GNUPG_CHECK_MLOCK,
- [ AC_CHECK_FUNCS(mlock)
- if test "$ac_cv_func_mlock" = "yes"; then
+ [ AC_MSG_CHECKING(for mlock)
+ AC_CACHE_VAL(gnupg_cv_mlock_have_mlock,
+ AC_TRY_LINK([#include <sys/types.h>
+ #include <sys/mman.h>
+ ],
+ [
+ mlock(NULL, 4096);
+ ],
+ gnupg_cv_mlock_have_mlock="yes",
+ gnupg_cv_mlock_have_mlock="no"
+ )
+ )
+ AC_MSG_RESULT($gnupg_cv_mlock_have_mlock)
+ #
+ # If it wasn't found, check for it in the realtime library, and emulate
+ # how AC_CHECK_LIBS works. We have to do it ourself since AC_CHECK_LIBS
+ # doesn't allow us to specify header files we want to include to try
+ # make things work.
+ #
+ if test "$gnupg_cv_mlock_have_mlock" = "no"; then
+ mlock_libs_pre="$LIBS"
+ LIBS="$LIBS -lrt"
+ AC_MSG_CHECKING(for mlock in -lrt)
+ AC_TRY_LINK([#include <sys/types.h>
+ #include <sys/mman.h>
+ ],
+ [
+ mlock(NULL, 4096);
+ ],
+ gnupg_cv_mlock_have_mlock="yes",
+ [
+ gnupg_cv_mlock_have_mlock="no"
+ LIBS="$mlock_libs_pre"
+ ]
+ )
+ AC_MSG_RESULT($gnupg_cv_mlock_have_mlock)
+ fi
+
+ # Hopefully we've found mlock by this point.
+ if test "$gnupg_cv_mlock_have_mlock" = "yes"; then
AC_MSG_CHECKING(whether mlock is broken)
AC_CACHE_VAL(gnupg_cv_have_broken_mlock,
AC_TRY_RUN([
More information about the Gnupg-devel
mailing list