From 08300ab7405f7b23ae453b920d3c0730ae6fc633 Mon Sep 17 00:00:00 2001 From: Christian Thaeter Date: Sun, 20 Dec 2009 20:16:43 +0100 Subject: [PATCH] fix and use the mmap-anon.m4 macro for our purpose (untested) --- configure.ac | 1 + m4/mmap-anon.m4 | 29 ++++++++++++----------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index c692e4c..2b070b7 100644 --- a/configure.ac +++ b/configure.ac @@ -32,6 +32,7 @@ ACX_PTHREAD AM_CONDITIONAL([HAVE_THREADING], [test x"$acx_pthread_ok" = xyes]) AC_CHECK_HEADER([execinfo.h], AC_DEFINE(HAVE_EXECINFO_H)) +nobug_FUNC_MMAP_ANON # # Need to check for pkg-config, otherwise the next line doesn't work. diff --git a/m4/mmap-anon.m4 b/m4/mmap-anon.m4 index 14b6270..8a4ef92 100644 --- a/m4/mmap-anon.m4 +++ b/m4/mmap-anon.m4 @@ -1,4 +1,6 @@ # mmap-anon.m4 serial 8 +dnl Copyright (C) 2009 Christian Thaeter +dnl parts are borrowed from gnulib: dnl Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -13,23 +15,17 @@ dnl with or without modifications, as long as this notice is preserved. # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be # used. -AC_DEFUN([gl_FUNC_MMAP_ANON], +AC_DEFUN([nobug_FUNC_MMAP_ANON], [ dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. AC_REQUIRE([AC_PROG_CPP]) AC_REQUIRE([AC_PROG_EGREP]) - dnl Persuade glibc to define MAP_ANONYMOUS. - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - - # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it - # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is - # irrelevant for anonymous mappings. - AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) + AC_FUNC_MMAP # Try to allow MAP_ANONYMOUS. - gl_have_mmap_anonymous=no - if test $gl_have_mmap = yes; then + nobug_have_mmap_anonymous=no + if test $ac_cv_func_mmap = yes; then AC_MSG_CHECKING([for MAP_ANONYMOUS]) AC_EGREP_CPP([I cant identify this map.], [ #include @@ -37,8 +33,8 @@ AC_DEFUN([gl_FUNC_MMAP_ANON], I cant identify this map. #endif ], - [gl_have_mmap_anonymous=yes]) - if test $gl_have_mmap_anonymous != yes; then + [nobug_have_mmap_anonymous=yes]) + if test $nobug_have_mmap_anonymous != yes; then AC_EGREP_CPP([I cant identify this map.], [ #include #ifdef MAP_ANON @@ -47,13 +43,12 @@ AC_DEFUN([gl_FUNC_MMAP_ANON], ], [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.]) - gl_have_mmap_anonymous=yes]) + nobug_have_mmap_anonymous=yes]) fi - AC_MSG_RESULT([$gl_have_mmap_anonymous]) - if test $gl_have_mmap_anonymous = yes; then + AC_MSG_RESULT([$nobug_have_mmap_anonymous]) + if test $nobug_have_mmap_anonymous = yes; then AC_DEFINE([HAVE_MAP_ANONYMOUS], [1], - [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including - config.h and .]) + [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available.]) fi fi ]) -- 2.11.4.GIT