summaryrefslogtreecommitdiff
path: root/gnulib/m4/free.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib/m4/free.m4')
m---------gnulib0
-rw-r--r--gnulib/m4/free.m445
2 files changed, 45 insertions, 0 deletions
diff --git a/gnulib b/gnulib
deleted file mode 160000
-Subproject 443bc5ffcf7429e557f4a371b0661abe98ddbc1
diff --git a/gnulib/m4/free.m4 b/gnulib/m4/free.m4
new file mode 100644
index 0000000..76bca66
--- /dev/null
+++ b/gnulib/m4/free.m4
@@ -0,0 +1,45 @@
+# Check whether free (NULL) is supposed to work.
+
+# Copyright (C) 2003-2005, 2009-2011 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Written by Paul Eggert.
+
+# We can't test for free (NULL) even at runtime, since it might
+# happen to "work" for our test program, but not in general. So, be
+# conservative and use feature tests for relatively modern hosts,
+# where free (NULL) is known to work. This costs a bit of
+# performance on some older hosts, but we can fix that later if
+# needed.
+
+AC_DEFUN([gl_FUNC_FREE],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CACHE_CHECK([whether free (NULL) is known to work],
+ [gl_cv_func_free],
+ [case "$host_os" in
+ mingw*) gl_cv_func_free=yes ;;
+ *)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[@%:@include <unistd.h>]],
+ [[@%:@if _POSIX_VERSION < 199009L && \
+ (defined unix || defined _unix || defined _unix_ \
+ || defined __unix || defined __unix__)
+ @%:@error "'free (NULL)' is not known to work"
+ @%:@endif]])],
+ [gl_cv_func_free=yes],
+ [gl_cv_func_free=no])
+ esac
+ ])
+
+ if test $gl_cv_func_free = no; then
+ AC_DEFINE([free], [rpl_free],
+ [Define to rpl_free if the replacement function should be used.])
+ fi
+])
+
+# Prerequisites of lib/free.c.
+AC_DEFUN([gl_PREREQ_FREE], [:])