[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 00/15] Add libunistring-optional module
From: |
Bruno Haible |
Subject: |
Re: [PATCH 00/15] Add libunistring-optional module |
Date: |
Fri, 4 Jun 2010 00:21:58 +0200 |
User-agent: |
KMail/1.9.9 |
Hi all,
On 2010-05-25, I wrote:
> Since that change, that introduced the m4/libunistring-base.m4 file,
> users of libunistring modules from gnulib *must* use the automake option
> 'subdir-objects'.
Ralf and I investigated this issue and found out [1][2] that there's simply
no reasonable way to make AC_LIBOBJ work with files in subdirectories, without
modifying some Automake internals.
[1] http://lists.gnu.org/archive/html/bug-automake/2010-05/msg00012.html
[2] http://lists.gnu.org/archive/html/bug-automake/2010-05/msg00018.html
The solution is to use automake conditionals.
This patch implements it. The module files were updated through a couple
of shell commands:
$ nl='
'
$ sedexpr1='s/^modules\///'
$ sedexpr2='/^gl_LIBUNISTRING_LIBSOURCE/{s/gl_LIBUNISTRING_LIBSOURCE(\[.*\],
\[\(.*\)\])$/\1/;p}'
$ for f in `grep -rl gl_LIBUNISTRING_LIBSOURCE modules`; do
m=`echo $f | sed -e "$sedexpr1"`
M=`echo $m | LC_ALL=C tr a-z/.- A-Z___`
sources=`sed -n -e "$sedexpr2" < $f`
sedexpr3='/^gl_LIBUNISTRING_LIBSOURCE/{s|gl_LIBUNISTRING_LIBSOURCE(\[\(.*\)\],
\[.*\])$|gl_LIBUNISTRING_MODULE([\1], ['"$m"'])|}'
sedexpr4='/^Makefile\.am:$/{s|$|%%NEWLINE%%if
LIBUNISTRING_COMPILE_'"$M"'%%NEWLINE%%lib_SOURCES +=
'"$sources"'%%NEWLINE%%endif|}'
sedexpr5="s/%%NEWLINE%%/\\$nl/g"
mv $f $f'~'
sed -e "$sedexpr3" -e "$sedexpr4" -e "$sedexpr5" < $f'~' > $f
done
2010-06-03 Bruno Haible <address@hidden>
Don't use AC_LIBOBJ with file names in subdirectories.
* m4/libunistring-base.m4 (gl_LIBUNISTRING_MODULE): Renamed from
gl_LIBUNISTRING_LIBSOURCE. Take a module name as argument, not a file
name. Define an automake conditional. Don't invoke AC_LIBOBJ.
* m4/libunistring.m4 (gl_LIBUNISTRING): Update AC_BEFORE invocation.
* modules/uni*/* (configure.ac): Use gl_LIBUNISTRING_MODULE instead of
gl_LIBUNISTRING_LIBSOURCE.
(Makefile.am): Augment lib_SOURCES here, conditionally.
* NEWS: Drop requirement for Automake option 'subdir-objects'.
--- m4/libunistring-base.m4.orig Thu Jun 3 23:57:37 2010
+++ m4/libunistring-base.m4 Thu Jun 3 23:56:11 2010
@@ -1,4 +1,4 @@
-# libunistring-base.m4 serial 4
+# libunistring-base.m4 serial 5
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,28 +6,26 @@
dnl From Paolo Bonzini and Bruno Haible.
-dnl gl_LIBUNISTRING_LIBSOURCE([VERSION], [SourceFile])
-dnl Declares that SourceFile should be compiled, unless we are linking
-dnl with libunistring and its version is >= the given VERSION.
-dnl SourceFile should be relative to the lib directory and end in '.c'.
+dnl gl_LIBUNISTRING_MODULE([VERSION], [Module])
+dnl Declares that the source files of Module should be compiled, unless we
+dnl are linking with libunistring and its version is >= the given VERSION.
+dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is
+dnl true if the source files of Module should be compiled.
dnl This macro is to be used for public libunistring API, not for
dnl undocumented API.
dnl
dnl You have to bump the VERSION argument to the next projected version
dnl number each time you make a change that affects the behaviour of the
-dnl functions defined in SourceFile (even if SourceFile itself does not
+dnl functions defined in Module (even if the sources of Module itself do not
dnl change).
-AC_DEFUN([gl_LIBUNISTRING_LIBSOURCE],
+AC_DEFUN([gl_LIBUNISTRING_MODULE],
[
AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
dnl gl_LIBUNISTRING_CORE if that macro has been run.
- if gl_LIBUNISTRING_VERSION_CMP([$1]); then
- m4_foreach_w([gl_source_file], [$2],
- [AC_LIBOBJ(m4_bpatsubst(m4_defn([gl_source_file]), [\.c$], []))
- ])
- fi
+ AM_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]),
+ [gl_LIBUNISTRING_VERSION_CMP([$1])])
])
dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile])
@@ -38,8 +36,8 @@
dnl
dnl When we are linking with the already installed libunistring and its version
dnl is < VERSION, we create HeaderFile here, because we may compile functions
-dnl (via gl_LIBUNISTRING_LIBSOURCE above) that are not contained in the
-dnl installed version.
+dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed
+dnl version.
dnl When we are linking with the already installed libunistring and its version
dnl is > VERSION, we don't create HeaderFile here: it could cause compilation
dnl errors in other libunistring header files if some types are missing.
--- m4/libunistring.m4.orig Thu Jun 3 23:57:37 2010
+++ m4/libunistring.m4 Thu Jun 3 23:55:52 2010
@@ -1,4 +1,4 @@
-# libunistring.m4 serial 8
+# libunistring.m4 serial 9
dnl Copyright (C) 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -29,7 +29,7 @@
[$1], [$2])]]))
gl_libunistring_AC_DEFUN([gl_LIBUNISTRING],
[
- AC_BEFORE([$0], [gl_LIBUNISTRING_LIBSOURCE])
+ AC_BEFORE([$0], [gl_LIBUNISTRING_MODULE])
AC_BEFORE([$0], [gl_LIBUNISTRING_LIBHEADER])
AC_BEFORE([$0], [gl_LIBUNISTRING_LIB_PREPARE])
--- NEWS.orig Thu Jun 3 23:57:37 2010
+++ NEWS Thu Jun 3 23:55:52 2010
@@ -6,9 +6,6 @@
Date Modules Changes
-2010-05-18 uni*/* The Makefile.am now needs to declare the Automake
- option 'subdir-objects'.
-
2010-04-02 maintainer-makefile
The macro _prohibit_regexp has been revamped into
a new macro _sc_search_regexp; custom syntax
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 00/15] Add libunistring-optional module,
Bruno Haible <=