From 2397cca268daadab9b69f9ffba42bbcc08264034 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 5 Nov 2003 22:47:37 +0000 Subject: *** empty log message *** --- m4/ChangeLog | 5 +++++ m4/free.m4 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 m4/free.m4 (limited to 'm4') diff --git a/m4/ChangeLog b/m4/ChangeLog index 244d5269e..b7cdaf48d 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,5 +1,10 @@ 2003-11-05 Jim Meyering + * jm-macros.m4 (jm_MACROS): Require gl_FUNC_FREE. + * free.m4: New file, from gnulib. + + * exitfail.m4, host-os.m4, strndup.m4: Update from gnulib. + * jm-macros.m4 (jm_MACROS): Require autoconf-2.58. (AC_LANG_SOURCE): Remove definition, now that we require autoconf-2.58. diff --git a/m4/free.m4 b/m4/free.m4 new file mode 100644 index 000000000..537fb893e --- /dev/null +++ b/m4/free.m4 @@ -0,0 +1,46 @@ +# Check whether free (NULL) is supposed to work. + +# Copyright (C) 2003 Free Software Foundation, Inc. + +# This file is free software, distributed under the terms of the GNU +# General Public License. As a special exception to the GNU General +# Public License, this file may be distributed as part of a program +# that contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. + +# 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_CHECK_HEADERS_ONCE(unistd.h) + AC_CACHE_CHECK([whether free (NULL) is known to work], + [gl_cv_func_free], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@if HAVE_UNISTD_H + @%:@include + @%:@endif]], + [[@%:@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])]) + + if test $gl_cv_func_free = yes; then + AC_LIBOBJ(free) + 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], [:]) -- cgit v1.2.3-54-g00ecf