# HG changeset patch # User Bruce Korb # Date 1293756874 28800 # Node ID 4b32051cadc5532f1fcb8c07dbb92a1af60649ad # Parent 94601a984b2be14fc7e9964c1e03c2115d634d17 remove error module stuff in openat-die.c when GNULIB_LIBPOSIX diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ 2010-12-30 Bruce Korb * 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 diff --git a/lib/openat-die.c b/lib/openat-die.c --- a/lib/openat-die.c +++ b/lib/openat-die.c @@ -21,7 +21,9 @@ #include +#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 (); diff --git a/libposix/bootstrap b/libposix/bootstrap --- 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 diff --git a/libposix/configure.ac b/libposix/configure.ac --- 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