X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Ffree.m4;h=3587b86e0ef82eaf55002027f11328281c0fdfb4;hb=7ef6c64e210ac0979d7e8ac69bc5b5208c2405ab;hp=5e7546530b385a2bbc064d3fcc18d55822c22c87;hpb=bbe3a5c49043d2109dc7b091c326a48633f127b9;p=gnulib.git diff --git a/m4/free.m4 b/m4/free.m4 index 5e7546530..3587b86e0 100644 --- a/m4/free.m4 +++ b/m4/free.m4 @@ -1,12 +1,9 @@ # Check whether free (NULL) is supposed to work. -# Copyright (C) 2003, 2004 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. +# Copyright (C) 2003-2005, 2009-2014 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. @@ -19,25 +16,27 @@ AC_DEFUN([gl_FUNC_FREE], [ - AC_CHECK_HEADERS_ONCE(unistd.h) + AC_REQUIRE([AC_CANONICAL_HOST]) 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])]) + [case "$host_os" in + mingw*) gl_cv_func_free=yes ;; + *) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include ]], + [[@%:@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_LIBOBJ(free) - AC_DEFINE(free, rpl_free, + AC_DEFINE([free], [rpl_free], [Define to rpl_free if the replacement function should be used.]) fi ])