summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2010-05-26 02:37:42 +0200
committerGuillem Jover <guillem@debian.org>2010-05-26 02:51:28 +0200
commite844672595246c81f4a8e45ca842dc6aa3a4dbc8 (patch)
treeffbef18e22bd0241b148fd9bad87c8264ed96180 /m4
parente1ce8e5e0027333a0f3071b9d8bd81b53cbb1011 (diff)
downloaddpkg-e844672595246c81f4a8e45ca842dc6aa3a4dbc8.tar.gz
build: Only use mmap in parser if explicitly requested
The current mmap code is not reliable, as it does not handle SIGBUS, which can happen on I/O errors (among others). Switch the code to check for USE_MMAP instead of HAVE_MMAP so that it can be explicitly enabled on build, to produce consistent results by making sure it does not get reactivated accidentally. Disable it by default due to the above, in addition to not having been used by released tarballs since 1.14.15.
Diffstat (limited to 'm4')
-rw-r--r--m4/dpkg-funcs.m416
1 files changed, 16 insertions, 0 deletions
diff --git a/m4/dpkg-funcs.m4 b/m4/dpkg-funcs.m4
index 188fa6bd8..3f0cf5261 100644
--- a/m4/dpkg-funcs.m4
+++ b/m4/dpkg-funcs.m4
@@ -68,6 +68,22 @@ AS_IF([test "x$dpkg_cv_c99_snprintf" = "xyes"],
AM_CONDITIONAL(HAVE_C99_SNPRINTF, [test "x$dpkg_cv_c99_snprintf" = "xyes"])
])# DPKG_FUNC_C99_SNPRINTF
+# DPKG_MMAP
+# ---------
+# Define USE_MMAP if mmap() is available and it was requested
+AC_DEFUN([DPKG_MMAP],
+[
+ AC_ARG_ENABLE([mmap],
+ AS_HELP_STRING([--enable-mmap],
+ [enable usage of unrealiable mmap if available]),
+ [
+ AC_CHECK_FUNCS([mmap])
+ AC_DEFINE(USE_MMAP, 1, [Use unreliable mmap support])
+ ],
+ []
+ )
+])
+
# DPKG_FUNC_ASYNC_SYNC
# --------------------
# Define HAVE_ASYNC_SYNC if sync() is asynchronous