setenv: Add missing declaration on OSF/1 5.1.
authorBruno Haible <bruno@clisp.org>
Sun, 19 Dec 2010 17:08:03 +0000 (18:08 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 19 Dec 2010 17:08:03 +0000 (18:08 +0100)
* lib/stdlib.in.h (setenv): Test HAVE_DECL_SETENV, not HAVE_SETENV.
* m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Test whether setenv is
declared. Don't set HAVE_SETENV.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_SETENV,
not HAVE_SETENV.
* modules/stdlib (Makefile.am): Substitute HAVE_DECL_SETENV, not
HAVE_SETENV.
* doc/posix-functions/setenv.texi: Mention the OSF/1 5.1 problem.

ChangeLog
doc/posix-functions/setenv.texi
lib/stdlib.in.h
m4/setenv.m4
m4/stdlib_h.m4
modules/stdlib

index c2a99f0267bf4a48fcb2b39873fd7a9a4f26aa09..34174308413ce21a4bdbc1fd58e7832e59e39fcb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-19  Bruno Haible  <bruno@clisp.org>
+
+       setenv: Add missing declaration on OSF/1 5.1.
+       * lib/stdlib.in.h (setenv): Test HAVE_DECL_SETENV, not HAVE_SETENV.
+       * m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Test whether setenv is
+       declared. Don't set HAVE_SETENV.
+       * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_SETENV,
+       not HAVE_SETENV.
+       * modules/stdlib (Makefile.am): Substitute HAVE_DECL_SETENV, not
+       HAVE_SETENV.
+       * doc/posix-functions/setenv.texi: Mention the OSF/1 5.1 problem.
+
 2010-12-19  Bruno Haible  <bruno@clisp.org>
 
        nl_langinfo tests: Avoid gcc warning.
index 889215678e6a8d250e8a2d259e60d2313956b978..b5c397f31ff3aa0a0fdb58d55485297ceb36d4fe 100644 (file)
@@ -12,6 +12,9 @@ Portability problems fixed by Gnulib:
 This function is missing on some platforms:
 AIX 4.3.2, HP-UX 11.23, IRIX 6.5, Solaris 9, mingw, BeOS.
 @item
+This function is not declared on some platforms:
+OSF/1 5.1.
+@item
 On some platforms, this function does not fail with @samp{EINVAL} when
 passed an empty string or a string containing @samp{=}:
 MacOS X 10.5, FreeBSD 6.0, NetBSD 1.6, OpenBSD 3.8, Cygwin 1.5.x.
index e6dcdbc8412a014cce5a4d6215d6b13fb884620d..84097dce027cad17f1289c023e8e12c4dbb1485b 100644 (file)
@@ -584,7 +584,7 @@ _GL_FUNCDECL_RPL (setenv, int,
 _GL_CXXALIAS_RPL (setenv, int,
                   (const char *name, const char *value, int replace));
 # else
-#  if !@HAVE_SETENV@
+#  if !@HAVE_DECL_SETENV@
 _GL_FUNCDECL_SYS (setenv, int,
                   (const char *name, const char *value, int replace)
                   _GL_ARG_NONNULL ((1)));
@@ -592,7 +592,9 @@ _GL_FUNCDECL_SYS (setenv, int,
 _GL_CXXALIAS_SYS (setenv, int,
                   (const char *name, const char *value, int replace));
 # endif
+# if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
 _GL_CXXALIASWARN (setenv);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef setenv
 # if HAVE_RAW_DECL_SETENV
index 4948079bf9bce76952aecd07dd98a9e3e4c1286e..fec4a2cce36698334cbc6138500d62653a6ae5d3 100644 (file)
@@ -16,10 +16,12 @@ AC_DEFUN([gl_FUNC_SETENV],
 AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([setenv])
+  if test $ac_cv_have_decl_setenv = no; then
+    HAVE_DECL_SETENV=0
+  fi
   AC_CHECK_FUNCS_ONCE([setenv])
-  if test $ac_cv_func_setenv = no; then
-    HAVE_SETENV=0
-  else
+  if test $ac_cv_func_setenv = yes; then
     AC_CACHE_CHECK([whether setenv validates arguments],
       [gl_cv_func_setenv_works],
       [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
index e4697ce213caa3b0874979390b37bf39052928a6..8cbda59ae356a93590144b9275bbfda8b00d17b0 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 31
+# stdlib_h.m4 serial 32
 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -92,7 +92,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_RANDOM_R=1;           AC_SUBST([HAVE_RANDOM_R])
   HAVE_REALPATH=1;           AC_SUBST([HAVE_REALPATH])
   HAVE_RPMATCH=1;            AC_SUBST([HAVE_RPMATCH])
-  HAVE_SETENV=1;             AC_SUBST([HAVE_SETENV])
+  HAVE_DECL_SETENV=1;        AC_SUBST([HAVE_DECL_SETENV])
   HAVE_STRTOD=1;             AC_SUBST([HAVE_STRTOD])
   HAVE_STRTOLL=1;            AC_SUBST([HAVE_STRTOLL])
   HAVE_STRTOULL=1;           AC_SUBST([HAVE_STRTOULL])
index 4b889a1e1b1aaab9094a76062c09bc1607712548..0058c7677315ea9b0bb02c7180b8d8b637d9f4f8 100644 (file)
@@ -71,7 +71,7 @@ stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
              -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
              -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
-             -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
+             -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
              -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
              -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
              -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \