changeset 7646:33bd42644eec

Override also AC_LIBSOURCES. Works around an automake error "automatically discovered file `error.c' should not be explicitly mentioned" in some circumstances.
author Bruno Haible <bruno@clisp.org>
date Mon, 13 Nov 2006 19:07:29 +0000
parents 515df78f2849
children c26d75cebcfa
files ChangeLog gnulib-tool
diffstat 2 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-13  Bruno Haible  <bruno@clisp.org>
+
+	* gnulib-tool (func_emit_initmacro_start): Also override AC_LIBSOURCES.
+	(func_emit_initmacro_end): Undo the override here.
+	(func_emit_initmacro_done): Emit a definition for gl_LIBSOURCES.
+	Works around the famous automake error in coreutils.
+
 2006-11-13  Eric Blake  <ebb9@byu.net>
 
 	* lib/gl_anytree_oset.h (gl_tree_search_atleast): Return the
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2006-11-13 12:35:41 $'
+cvsdatestamp='$Date: 2006-11-13 19:07:29 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 nl='
@@ -1394,8 +1394,22 @@
 # - macro_prefix    prefix of gl_EARLY, gl_INIT macros to use
 func_emit_initmacro_start ()
 {
+  # Overriding AC_LIBOBJ and AC_REPLACE_FUNCS has the effect of storing
+  # platform-dependent object files in ${macro_prefix}_LIBOBJS instead of
+  # LIBOBJS.  The purpose is to allow several gnulib instantiations under
+  # a single configure.ac file.  (AC_CONFIG_LIBOBJ_DIR does not allow this
+  # flexibility.)
+  # Furthermore it avoids an automake error like this when a Makefile.am
+  # that uses pieces of gnulib also uses $(LIBOBJ):
+  #   automatically discovered file `error.c' should not be explicitly mentioned
   echo "  m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix}_LIBOBJ]))"
   echo "  m4_pushdef([AC_REPLACE_FUNCS], m4_defn([${macro_prefix}_REPLACE_FUNCS]))"
+  # Overriding AC_LIBSOURCES has the same purpose of avoiding the automake
+  # error when a Makefile.am that uses pieces of gnulib also uses $(LIBOBJ):
+  #   automatically discovered file `error.c' should not be explicitly mentioned
+  # We let automake know about the files to be distributed through the
+  # EXTRA_lib_SOURCES variable.
+  echo "  m4_pushdef([AC_LIBSOURCES], m4_defn([${macro_prefix}_LIBSOURCES]))"
 }
 
 # func_emit_initmacro_end
@@ -1403,6 +1417,7 @@
 # - macro_prefix    prefix of gl_EARLY, gl_INIT macros to use
 func_emit_initmacro_end ()
 {
+  echo "  m4_popdef([AC_LIBSOURCES])"
   echo "  m4_popdef([AC_REPLACE_FUNCS])"
   echo "  m4_popdef([AC_LIBOBJ])"
   echo "  AC_CONFIG_COMMANDS_PRE(["
@@ -1436,6 +1451,11 @@
   echo "# into ${macro_prefix}_LIBOBJS instead of into LIBOBJS."
   echo "AC_DEFUN([${macro_prefix}_REPLACE_FUNCS],"
   echo "  [AC_CHECK_FUNCS([\$1], , [${macro_prefix}_LIBOBJ(\$ac_func)])])"
+  echo
+  echo "# Like AC_LIBSOURCES, except that it does nothing."
+  echo "# We rely on EXTRA_lib..._SOURCES instead."
+  echo "AC_DEFUN([${macro_prefix}_LIBSOURCES],"
+  echo "  [])"
 }
 
 # func_import modules