view m4/free.m4 @ 6275:fd0ccce602e4

Sync from coreutils. * .cppi-disable: Add regcomp.c, regex_internal.c, regex_internal.h, stat-time.h. * argmatch.h: Include verify.h (ARGMATCH_VERIFY): Use verify rather than rolling our own. (ARGMATCH_ASSERT): Remove; unused. * canonicalize.c: Assume STDC_HEADERS. * exclude.c: Include "strcase.h". * regex_internal.h [!defined _LIBC]: Likewise. * getusershell.c: Include stdio--.h rather than stdio.h and stdio-safer.h. (getusershell): Call fopen, not fopen_safer. * save-cwd.c: Include fcntl--.h rather than fcntl.h. Do not include unistd-safer.h. (save_cwd): Don't call fd_safer; no longer needed now that we include fcntl--.h. * modules/argmatch (Depends-on): Add verify. * modules/getloadavg (Depends-on): Depend on fcntl-safer, not unistd-safer. * modules/save-cwd (Depends-on): Likewise. * backupfile.m4, calloc.m4, chown.m4, cloexec.m4, dup2.m4: * fileblocks.m4, free.m4, ftruncate.m4, getcwd.m4, getpagesize.m4: * getugroups.m4, group-member.m4, idcache.m4, link-follow.m4: * mkstemp.m4, mktime.m4, mountlist.m4, nanosleep.m4, pathmax.m4: * physmem.m4, posixver.m4, putenv.m4, safe-read.m4, same.m4: * save-cwd.m4, stdio-safer.m4, unistd-safer.m4, unlinkdir.m4: * userspec.m4, xgetcwd.m4, xreadlink.m4: Don't bother checking for string.h, stdlib.h, unistd.h. * fts.m4 (gl_FUNC_FTS_CORE): Don't require AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK; that's now the lstat module's job. * jm-macros.m4 (gl_MACROS): Likewise. * prereq.m4 (gl_PREREQ): Add gl_FUNC_LSTAT. * backupfile.c: Use ARGMATCH_VERIFY, just in case. * posixtm.c (posixtime) [lint]: Initialize *all* of tm0, not just the .tm_year member, since otherwise gcc-4.0 would now warn about tm_zone, tm_gmtoff, tm_isdst, tm_yday, tm_wday. * quotearg.c (quotearg_n_options): Change code to be suboptimal, in order to avoid an unsuppressible warning from gcc on 64-bit systems. * lstat.m4 (gl_FUNC_LSTAT): Use AC_LIBSOURCES to require lstat.c and lstat.h. Remove obsolete comment. * xreadlink.m4: Use AC_LIBSOURCES and AC_LIBOBJ. * xstrtod.m4: Likewise.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 23 Sep 2005 04:15:13 +0000
parents 87c42e194f4a
children f6cba5a556ce
line wrap: on
line source

# Check whether free (NULL) is supposed to work.

# Copyright (C) 2003, 2004, 2005 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_CACHE_CHECK([whether free (NULL) is known to work],
    [gl_cv_func_free],
    [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])])

  if test $gl_cv_func_free = no; 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], [:])