summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2007-04-16 15:09:30 +0000
committerWerner Koch <wk@gnupg.org>2007-04-16 15:09:30 +0000
commit591697fc7621e8aa16abb3f60dc297ea9af1048f (patch)
tree76fb0761768c69d50818ff9f88f6aeeb8fb83b33 /acinclude.m4
parentef72b801762550f0ec1dd483e36ab95fe8f6629e (diff)
downloadlibgcrypt-591697fc7621e8aa16abb3f60dc297ea9af1048f.tar.gz
./
* configure.ac: Check for sysconf. * acinclude.m4 (GNUPG_CHECK_MLOCK): Try to use sysconf to get the page size and use getpagesize only then if available. cipher/ * ecc.c (_gcry_ecc_generate): Renamed DUMMY to CURVE and use it. src/ * secmem.c (init_pool): Use sysconf() if available to determine page size.
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m482
1 files changed, 47 insertions, 35 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 7fb5c7d8..dae5e223 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -152,18 +152,18 @@ define(GNUPG_CHECK_MLOCK,
#include <sys/mman.h>
#endif
], [
- 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;
+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)])
@@ -174,33 +174,45 @@ define(GNUPG_CHECK_MLOCK,
fi
fi
if test "$ac_cv_func_mlock" = "yes"; then
+ AC_CHECK_FUNCS(sysconf getpagesize)
AC_MSG_CHECKING(whether mlock is broken)
AC_CACHE_VAL(gnupg_cv_have_broken_mlock,
AC_TRY_RUN([
- #include <stdlib.h>
- #include <unistd.h>
- #include <errno.h>
- #include <sys/mman.h>
- #include <sys/types.h>
- #include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+int main()
+{
+ char *pool;
+ int err;
+ long int pgsize;
+
+#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
+ pgsize = sysconf (_SC_PAGESIZE);
+#elif defined (HAVE_GETPAGESIZE)
+ pgsize = getpagesize();
+#else
+ pgsize = -1;
+#endif
- int main()
- {
- char *pool;
- int err;
- long int pgsize = getpagesize();
+ if (pgsize == -1)
+ pgsize = 4096;
- pool = malloc( 4096 + pgsize );
- if( !pool )
- return 2;
- pool += (pgsize - ((long int)pool % pgsize));
+ pool = malloc( 4096 + pgsize );
+ if( !pool )
+ return 2;
+ pool += (pgsize - ((long int)pool % pgsize));
- err = mlock( pool, 4096 );
- if( !err || errno == EPERM )
- return 0; /* okay */
+ err = mlock( pool, 4096 );
+ if( !err || errno == EPERM )
+ return 0; /* okay */
- return 1; /* hmmm */
- }
+ return 1; /* hmmm */
+}
],
gnupg_cv_have_broken_mlock="no",
@@ -317,10 +329,10 @@ AC_DEFUN([TYPE_SOCKLEN_T],
for arg2 in "struct sockaddr" void; do
for t in int size_t unsigned long "unsigned long"; do
AC_TRY_COMPILE([
- #include <sys/types.h>
- #include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/socket.h>
- int getpeername (int, $arg2 *, $t *);
+int getpeername (int, $arg2 *, $t *);
],[
$t len;
getpeername(0,0,&len);