]> Savannah Git Hosting - gnulib.git/commitdiff
remove error module stuff in openat-die.c when GNULIB_LIBPOSIX
authorBruce Korb <bkorb@gnu.org>
Fri, 31 Dec 2010 00:54:34 +0000 (16:54 -0800)
committerBruce Korb <bkorb@gnu.org>
Fri, 31 Dec 2010 00:54:34 +0000 (16:54 -0800)
ChangeLog
lib/openat-die.c
libposix/bootstrap
libposix/configure.ac

index c809bc0753641cd038f962835df3d17b9b063945..afac8d8d3397984739c83dc1317d1db32b3ebc9c 100644 (file)
--- 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>
 
index a8639e11dedd95b5cd281aa1016ac918adbd9c21..ad2476ffba417156ff224c0987d9c538ec3be052 100644 (file)
@@ -21,7 +21,9 @@
 
 #include <stdlib.h>
 
+#ifndef GNULIB_LIBPOSIX
 #include "error.h"
+#endif  GNULIB_LIBPOSIX
 #include "exitfail.h"
 
 #include "gettext.h"
 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 @@ openat_save_fail (int errnum)
 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 ();
index bfb80ec8a8ed5f6117d28f70441748747599efa1..d96524073de7dd2e64b6144c4fe35e0c11278fb8 100755 (executable)
@@ -14,7 +14,7 @@ fi
 
 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 @@ cat > tmp/modules/libposix <<- _EOF_
        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 @@ opts='--local-dir=tmp
        --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
index b1bd65281032b84646f48ed2297d74310d5a5401..db49a02b983d6b896f238d8f2aba77b64e2998b5 100644 (file)
@@ -28,6 +28,7 @@ LT_INIT
 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