changeset 14122:4b32051cadc5

remove error module stuff in openat-die.c when GNULIB_LIBPOSIX
author Bruce Korb <bkorb@gnu.org>
date Thu, 30 Dec 2010 16:54:34 -0800
parents 94601a984b2b
children 514ae5562fd2
files ChangeLog lib/openat-die.c libposix/bootstrap libposix/configure.ac
diffstat 4 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 2010-12-30  Bruce Korb  <bkorb@gnu.org>
 
 	* libposix/bootstrap (posix_list): remove unnecessary temp file
+	(modules): install all modules to tmp/modules that reference
+	the 'error' module.
+	* libposix/configure.ac (GNULIB_LIBPOSIX): define this in
+	config.h so that openat-die.c can omit calls to error().
+	* lib/openat-die.c: remove error module stuff when GNULIB_LIBPOSIX
+	is defined.
 
 2010-12-29  Eric Blake  <eblake@redhat.com>
 
--- a/lib/openat-die.c
+++ b/lib/openat-die.c
@@ -21,7 +21,9 @@
 
 #include <stdlib.h>
 
+#ifndef GNULIB_LIBPOSIX
 #include "error.h"
+#endif  GNULIB_LIBPOSIX
 #include "exitfail.h"
 
 #include "gettext.h"
@@ -30,9 +32,10 @@
 void
 openat_save_fail (int errnum)
 {
+#ifndef GNULIB_LIBPOSIX
   error (exit_failure, errnum,
          _("unable to record current working directory"));
-
+#endif  GNULIB_LIBPOSIX
   /* The `noreturn' attribute cannot be applied to error, since it returns
      when its first argument is 0.  To help compilers understand that this
      function does not return, call abort.  Also, the abort is a
@@ -48,8 +51,10 @@
 void
 openat_restore_fail (int errnum)
 {
+#ifndef GNULIB_LIBPOSIX
   error (exit_failure, errnum,
          _("failed to return to initial working directory"));
+#endif  GNULIB_LIBPOSIX
 
   /* As above.  */
   abort ();
--- a/libposix/bootstrap
+++ b/libposix/bootstrap
@@ -14,7 +14,7 @@
 
 posix_list=`
 {   echo alloca
-    posix-modules
+    posix-modules | sed '/^error$/d'
 } | tr -d ' \t' | sed '/^$/d' | sort -u`
 
 cat > tmp/modules/libposix <<- _EOF_
@@ -41,6 +41,21 @@
 	Gary V. Vaughan
 	_EOF_
 
+# We cannot tell which modules will get pulled in via dependencies
+# when gnulib-tool gets run.  Therefore, strip out "error" from all
+# modules that mention it.  Either we won't use the module, or the
+# module will have to be tweaked to remove the dependency for libposix.
+# "GNULIB_LIBPOSIX" is a CPP symbol for libposix.
+#
+set -- `egrep -l '^error$' ../modules/[a-z]*`
+
+for mod
+do
+    test "X$mod" = Xerror && continue
+    echo 'NOTE: removing "error" dependency from' ${mod}
+    d=`basename $mod`
+    sed '/^error$/d' ${mod} > tmp/modules/$d
+done >&2
 
 opts='--local-dir=tmp
 	--import
@@ -55,10 +70,13 @@
 	--with-longrunning-tests'
 
 # Bootstrap for autotools.
+#
 gnulib-tool ${opts} git-version-gen libposix
 
 # No need to maintain a Makefile.am just to include gnulib.mk.
+#
 mv tests/gnulib.mk tests/Makefile.am
 
 # Run autotools.
+#
 autoreconf --force --install --verbose --symlink
--- a/libposix/configure.ac
+++ b/libposix/configure.ac
@@ -28,6 +28,7 @@
 AC_SUBST([LTV_CURRENT], 0)
 AC_SUBST([LTV_REVISION], 0)
 AC_SUBST([LTV_AGE], 0)
+AC_DEFINE_UNQUOTED(GNULIB_LIBPOSIX,1,[we are libposix])
 
 AC_PROG_CC
 LIBPOSIX_EARLY