bison-patches
[Top][All Lists]
Advanced

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

[PATCH] master: gnulib: improve prefixing.


From: Akim Demaille
Subject: [PATCH] master: gnulib: improve prefixing.
Date: Wed, 12 Aug 2009 14:30:55 -0000

        * configure.ac (gl_PREFIXED_LIBOBJS): Don't rename it, rather,
        change the value of...
        (gl_LIBOBJS): this.
        Adjust more variables.
        * etc/prefix-gnulib-mk (prefix_assignment): Don't rename
        gl_LIBOBJS.
        (prefix): Also transform rules whose targets have slashes.
        Use $prefix liberally.
        Map @MKDIR_P@ to $(MKDIR_P).
        Prefix directories that are mkdir'd.
---
 ChangeLog            |   14 ++++++++++++++
 configure.ac         |   10 ++++++----
 etc/prefix-gnulib-mk |   15 +++++++++------
 3 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6fb1ae2..5668c72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2009-08-12  Akim Demaille  <address@hidden>
 
+       gnulib: improve prefixing.
+       * configure.ac (gl_PREFIXED_LIBOBJS): Don't rename it, rather,
+       change the value of...
+       (gl_LIBOBJS): this.
+       Adjust more variables.
+       * etc/prefix-gnulib-mk (prefix_assignment): Don't rename
+       gl_LIBOBJS.
+       (prefix): Also transform rules whose targets have slashes.
+       Use $prefix liberally.
+       Map @MKDIR_P@ to $(MKDIR_P).
+       Prefix directories that are mkdir'd.
+
+2009-08-12  Akim Demaille  <address@hidden>
+
        build: fix paths.
        When using $(top_builddir) inconsistently, Make (including GNU
        Make) is sometimes confused.  As a result it may want to build
diff --git a/configure.ac b/configure.ac
index 871b0df..fa2a8e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,11 +145,13 @@ AC_SUBST([O0CXXFLAGS], [`echo $CXXFLAGS | sed 
's/-O[[0-9]] *//'`])
 gt_JAVACOMP([1.3], [1.4])
 gt_JAVAEXEC
 
-AC_SUBST([gl_PREFIXED_LIBOBJS],
-         [$(echo "$gl_LIBOBJS" | sed -e 's, , lib/,g')])
-for ac_var in ERRNO_H GETOPT_H INTTYPES_H STDBOOL_H STDINT_H WCHAR_H WCTYPE_H
+# We use gnulib, but from lib/local.mk instead of lib/Makefile.am.
+# So prefix paths with lib/.  See also etc/prefix-gnulib-mk.
+gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, , lib/,g'`
+for ac_var in ALLOCA_H ERRNO_H FCNTL_H GETOPT_H INTTYPES_H \
+              STDBOOL_H STDINT_H SYS_WAIT_H WCHAR_H WCTYPE_H
 do
-  eval "$ac_var=lib/\$$ac_var"
+  eval "test 'x$ac_var' = x || $ac_var=lib/\$$ac_var"
 done
 AC_CONFIG_FILES([Makefile
                 po/Makefile.in
diff --git a/etc/prefix-gnulib-mk b/etc/prefix-gnulib-mk
index 08d22f2..e969663 100755
--- a/etc/prefix-gnulib-mk
+++ b/etc/prefix-gnulib-mk
@@ -73,9 +73,6 @@ sub prefix_assignment ($$)
   # lib_libbison_a_SOURCES.
   $lhs_and_assign_op =~ s/(libbison)/lib_$1/g;
 
-  # Do not use gl_LIBOBJS, but its prefixed version.
-  $rhs =~ s/gl_LIBOBJS/gl_PREFIXED_LIBOBJS/g;
-
   return $lhs_and_assign_op . $rhs;
 }
 
@@ -93,7 +90,7 @@ sub prefix ($)
   # Prefix all the occurrence of files in rules.  If there is nothing
   # after in the :, it's probably a phony target, or a suffix rule.
   # Don't touch it.
-  s{^([\w.]+ *: *\w.*)$}
+  s{^([\w./]+ *: *\w.*)$}
    {prefix_words($1)}gem;
 
   # Prefix files in variables.
@@ -103,7 +100,7 @@ sub prefix ($)
   # These three guys escape all the other regular rules.
   s{(charset\.alias|ref-add\.sed|ref-del\.sed)}{$prefix$1}g;
   # Unfortunately, as a result we sometimes have lib/lib.
-  s{lib/lib/}{lib/}g;
+  s{($prefix){2}}{$1}g;
 
   # $(srcdir) is actually $(top_srcdir)/lib.
   s{\$\(srcdir\)}{\$(top_srcdir)/lib}g;
@@ -112,6 +109,12 @@ sub prefix ($)
   # not work when we have a $@ with a directory in it.
   address@hidden@-t}g;
 
+  # Some AC_SUBST patterns remain and would better be Make macros.
+  s{\@(MKDIR_P)address@hidden($1)}g;
+
+  # Adjust paths in mkdir.
+  s{(\$\(MKDIR_P\))\s*(\w+)}{$1 $prefix$2}g;
+
   return $_;
 }
 
@@ -128,7 +131,7 @@ sub process ($)
   print $out $contents;
 }
 
-process ("lib/gnulib.mk")
+process ("${prefix}gnulib.mk")
 
 
 ### Setup "GNU" style for perl-mode and cperl-mode.
-- 
1.6.4





reply via email to

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