bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build failure on Solaris with CVS


From: Paul Eggert
Subject: Re: Build failure on Solaris with CVS
Date: Wed, 03 Nov 2004 15:06:32 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Albert Chin <address@hidden> writes:

> lib/getdate.y calls setenv() but Solaris only has putenv(). So, I
> copied in m4/setenv.m4 and lib/unsetenv.c from gnulib and added the
> gt_FUNC_SETENV call to configure.ac to use lib/setenv.c and
> lib/unsetenv.c

Thanks.  That's usually put in the underlying m4 files.  Jim Meyering
fixed some of this, and I installed this to try to fix the rest:

2004-11-03  Paul Eggert  <address@hidden>

        * lib/Makefile.am (libfetish_a_SOURCES): Remove setenv.c.
        * m4/prereq.m4 (gl_PREREQ): Require gt_FUNC_SETENV.
        * m4/setenv.m4: New file, from gnulib.

Index: lib/Makefile.am
===================================================================
RCS file: /fetish/cu/lib/Makefile.am,v
retrieving revision 1.197
diff -p -u -r1.197 Makefile.am
--- lib/Makefile.am     3 Nov 2004 09:20:23 -0000       1.197
+++ lib/Makefile.am     3 Nov 2004 22:40:39 -0000
@@ -102,7 +102,7 @@ libfetish_a_SOURCES = \
   same.c same.h \
   save-cwd.c save-cwd.h \
   savedir.c savedir.h \
-  setenv.c setenv.h \
+  setenv.h \
   settime.c \
   sha1.c sha1.h \
   sig2str.h \
Index: m4/prereq.m4
===================================================================
RCS file: /fetish/cu/m4/prereq.m4,v
retrieving revision 1.95
diff -p -u -r1.95 prereq.m4
--- m4/prereq.m4        9 Aug 2004 18:16:24 -0000       1.95
+++ m4/prereq.m4        3 Nov 2004 22:41:02 -0000
@@ -1,4 +1,4 @@
-#serial 45
+#serial 46
 
 dnl We use gl_ for non Autoconf macros.
 m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl
@@ -48,6 +48,7 @@ AC_DEFUN([gl_PREREQ],
   AC_REQUIRE([gl_FUNC_READLINK])
   AC_REQUIRE([gl_FUNC_RMDIR])
   AC_REQUIRE([gl_FUNC_RPMATCH])
+  AC_REQUIRE([gt_FUNC_SETENV])
   AC_REQUIRE([gl_FUNC_SIG2STR])
   AC_REQUIRE([gl_FUNC_STPCPY])
   AC_REQUIRE([gl_FUNC_STRCSPN])
--- /dev/null   2003-03-18 13:55:57 -0800
+++ m4/setenv.m4        2004-11-03 00:05:39 -0800
@@ -0,0 +1,72 @@
+# setenv.m4 serial 5
+dnl Copyright (C) 2001-2004 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+AC_DEFUN([gt_FUNC_SETENV],
+[
+  AC_REPLACE_FUNCS(setenv unsetenv)
+  if test $ac_cv_func_setenv = no; then
+    gl_PREREQ_SETENV
+  fi
+  if test $ac_cv_func_unsetenv = no; then
+    gl_PREREQ_UNSETENV
+  else
+    AC_CACHE_CHECK([for unsetenv() return type], gt_cv_func_unsetenv_ret,
+      [AC_TRY_COMPILE([#include <stdlib.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+int unsetenv (const char *name);
+#else
+int unsetenv();
+#endif
+], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')])
+    if test $gt_cv_func_unsetenv_ret = 'void'; then
+      AC_DEFINE(VOID_UNSETENV, 1, [Define if unsetenv() returns void, not 
int.])
+    fi
+  fi
+])
+
+# Check if a variable is properly declared.
+# gt_CHECK_VAR_DECL(includes,variable)
+AC_DEFUN([gt_CHECK_VAR_DECL],
+[
+  define([gt_cv_var], [gt_cv_var_]$2[_declaration])
+  AC_MSG_CHECKING([if $2 is properly declared])
+  AC_CACHE_VAL(gt_cv_var, [
+    AC_TRY_COMPILE([$1
+      extern struct { int foo; } $2;],
+      [$2.foo = 1;],
+      gt_cv_var=no,
+      gt_cv_var=yes)])
+  AC_MSG_RESULT($gt_cv_var)
+  if test $gt_cv_var = yes; then
+    AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_DECL], 1,
+              [Define if you have the declaration of $2.])
+  fi
+])
+
+# Prerequisites of lib/setenv.c.
+AC_DEFUN([gl_PREREQ_SETENV],
+[
+  AC_REQUIRE([AC_FUNC_ALLOCA])
+  AC_CHECK_HEADERS_ONCE(unistd.h)
+  AC_CHECK_HEADERS(search.h)
+  AC_CHECK_FUNCS(tsearch)
+  gt_CHECK_VAR_DECL([#include <errno.h>], errno)
+  gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
+])
+
+# Prerequisites of lib/unsetenv.c.
+AC_DEFUN([gl_PREREQ_UNSETENV],
+[
+  AC_CHECK_HEADERS_ONCE(unistd.h)
+  gt_CHECK_VAR_DECL([#include <errno.h>], errno)
+  gt_CHECK_VAR_DECL([#include <unistd.h>], environ)
+])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]