view m4/putenv.m4 @ 7356:0af37e82a5e3

* fsusage.m4 (gl_STATFS_TRUNCATES): Avoid unused variable. * getdate.m4 (gl_C_COMPOUND_LITERALS): Likewise. * jm-winsz1.m4 (gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H): Likewise; also add missing comma that caused broken test. * link-follow.m4 (gl_AC_FUNC_LINK_FOLLOWS_SYMLINK): Include stdlib.h, for `abort'. * ls-mntd-fs.m4 (gl_LIST_MOUNTED_FILE_SYSTEMS): Avoid unused variables. * mkdir-slash.m4 (gl_FUNC_MKDIR_TRAILING_SLASH): Check for and include unistd.h if present, for `rmdir'. * physmem.m4 (gl_SYS__SYSTEM_CONFIGURATION): Avoid unused variables. * putenv.m4 (gl_FUNC_PUTENV): Rewrite using AC_RUN_IFELSE, and in the process include standard headers for prototypes. * readutmp.m4 (gl_READUTMP): Require AC_GNU_SOURCE, so utmpxname gets declared on GNU/Linux. * rmdir-errno.m4 (gl_FUNC_RMDIR_NOTEMPTY): Check for and include unistd.h, for `rmdir'. * time_r.m4 (gl_TIME_R): Avoid unused variables.
author Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
date Fri, 22 Sep 2006 18:09:47 +0000
parents 3d99d01160aa
children b839560eec9f
line wrap: on
line source

# putenv.m4 serial 12
dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl From Jim Meyering.
dnl
dnl Check whether putenv ("FOO") removes FOO from the environment.
dnl The putenv in libc on at least SunOS 4.1.4 does *not* do that.

AC_DEFUN([gl_FUNC_PUTENV],
[AC_CACHE_CHECK([for SVID conformant putenv], jm_cv_func_svid_putenv,
  [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[
    /* Put it in env.  */
    if (putenv ("CONFTEST_putenv=val"))
      return 1;

    /* Try to remove it.  */
    if (putenv ("CONFTEST_putenv"))
      return 1;

    /* Make sure it was deleted.  */
    if (getenv ("CONFTEST_putenv") != 0)
      return 1;

    return 0;
	      ])],
	     jm_cv_func_svid_putenv=yes,
	     jm_cv_func_svid_putenv=no,
	     dnl When crosscompiling, assume putenv is broken.
	     jm_cv_func_svid_putenv=no)
  ])
  if test $jm_cv_func_svid_putenv = no; then
    AC_LIBOBJ(putenv)
    AC_DEFINE(putenv, rpl_putenv,
      [Define to rpl_putenv if the replacement function should be used.])
  fi
])