diff options
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 35e3e4488..cddf70f4e 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -314,19 +314,46 @@ define(GNUPG_CHECK_IPC, # Check whether mlock is broken (hpux 10.20 raises a SIGBUS if mlock # is not called from uid 0 (not tested whether uid 0 works) # For DECs Tru64 we have also to check whether mlock is in librt +# mlock is there a macro using memlk() ###################################################################### dnl GNUPG_CHECK_MLOCK dnl define(GNUPG_CHECK_MLOCK, [ AC_CHECK_FUNCS(mlock) - if test "$ac_cv_func_mlock" = "yes"; then - AC_TRY_LINK_FUNC(mlock,tmp=yes,tmp=no) - if test $tmp = no; then - # We could not link a test program, so check whether - # we can do it by linking against librt - # this adds librt to the path. This adds librt to LIBS. - AC_CHECK_LIB(rt, mlock) + if test "$ac_cv_func_mlock" = "no"; then + AC_CHECK_HEADERS(sys/mman.h) + if test "$ac_cv_header_sys_mman_h" = "yes"; then + # Add librt to LIBS: + AC_CHECK_LIB(rt, memlk) + AC_CACHE_CHECK([whether mlock is in sys/mman.h], + gnupg_cv_mlock_is_in_sys_mman, + [AC_TRY_LINK([ + #include <assert.h> + #ifdef HAVE_SYS_MMAN_H + #include <sys/mman.h> + #endif + ], [ + mkdir ("foo", 0); + int i; + /* glibc defines this for functions which it implements + * to always fail with ENOSYS. Some functions are actually + * named something starting with __ and the normal name + * is an alias. */ + #if defined (__stub_mlock) || defined (__stub___mlock) + choke me + #else + mlock(&i, 4); + #endif + ; return 0; + ], + gnupg_cv_mlock_is_in_sys_mman=yes, + gnupg_cv_mlock_is_in_sys_mman=no)]) + if test "$gnupg_cv_mlock_is_in_sys_mman" = "yes"; then + AC_DEFINE(HAVE_MLOCK) + fi fi + fi + if test "$ac_cv_func_mlock" = "yes"; then AC_MSG_CHECKING(whether mlock is broken) AC_CACHE_VAL(gnupg_cv_have_broken_mlock, AC_TRY_RUN([ |