[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: missing dependencies [Re: inline.m4: use compiler, not cpp
From: |
Bruno Haible |
Subject: |
Re: missing dependencies [Re: inline.m4: use compiler, not cpp |
Date: |
Mon, 13 Nov 2006 20:13:01 +0100 |
User-agent: |
KMail/1.9.1 |
Jim Meyering wrote:
> It is inaccurate and uncharitable to call that automake work
> short-sighted. The problem is that development on that front seems to
> have stalled. Since that part of automake is incomplete, if you don't
> know the history, I can see how you would think it short-sighted.
OK, I withdraw the word "short-sighted". I don't know much about how
automake evolved.
> However, that change breaks coreutils' build-from-bootstrap process:
>
> doc/Makefile.am:21: installing `build-aux/texinfo.tex'
> lib/gnulib.mk:21: automatically discovered file `alloca.c' should not be
> explicitly mentioned
> lib/Makefile.am:20: `lib/gnulib.mk' included from here
> lib/gnulib.mk:21: automatically discovered file `error.c' should not be
> explicitly mentioned
> lib/Makefile.am:20: `lib/gnulib.mk' included from here
> lib/gnulib.mk:21: automatically discovered file `lstat.c' should not be
> explicitly mentioned
> lib/Makefile.am:20: `lib/gnulib.mk' included from here
> lib/gnulib.mk:21: automatically discovered file `obstack.c' should not be
> explicitly mentioned
> lib/Makefile.am:20: `lib/gnulib.mk' included from here
These are apparently triggered by the use of $(LIBOBJS) in coreutils'
lib/Makefile.am. Although it is a bit uncommon to combine pieces of
gnulib and different pieces from outside gnulib in the same library, I
think gnulib-tool should support this.
3 among the 4 errors go away with the following gnulib-tool patch.
2006-11-13 Bruno Haible <address@hidden>
* 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.
diff -c -3 -r1.194 gnulib-tool
*** gnulib-tool 13 Nov 2006 12:35:41 -0000 1.194
--- gnulib-tool 13 Nov 2006 18:38:44 -0000
***************
*** 1394,1401 ****
--- 1394,1415 ----
# - 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,1408 ****
--- 1417,1423 ----
# - 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,1441 ****
--- 1451,1461 ----
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
The remaining error, regarding lstat.c, is because coreutils/m4/root-dev-ino.m4
invokes AC_FUNC_LSTAT from outside the gnulib scope, but it is also invoked
from inside the gnulib scope. (I.e. lstat.o will end up in both LIBOBJS and
gl_LIBOBJS.) This situation can not be well supported in gnulib-tool.
A workaround I found for this is appended: to move the gnulib-like stuff
"into the gnulib scope". It is a bit hairy; alternatively you can use
a gnulib-local-dir to ensure that all calls to AC_FUNC_LSTAT come from
inside the gnulib scope.
Bruno
diff -c -3 -r1.132 prereq.m4
*** m4/prereq.m4 21 Aug 2006 07:30:47 -0000 1.132
--- m4/prereq.m4 13 Nov 2006 18:33:03 -0000
***************
*** 35,40 ****
--- 35,50 ----
# We don't use c-stack.c.
# AC_REQUIRE([gl_C_STACK])
+ # The lib/Makefile.am compiles both LIBOBJS from autoconf and gl_LIBOBJS
+ # from gnulib. Where they overlap, automake signals an error:
+ # "automatically discovered file `lstat.c' should not be explicitly
mentioned".
+ # The pushdefs here move the object file from LIBOBJS to gl_LIBOBJS and, as
a
+ # side effect, make the automake error go away.
+ m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
+ m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
+ # Do *not* override AC_LIBSOURCES here, otherwise "make dist" will fail to
+ # distribute all files.
+
# Invoke macros of modules that may migrate into gnulib.
# There's no need to list gnulib modules here, since gnulib-tool
# handles that; see ../bootstrap.conf.
***************
*** 50,53 ****
--- 60,66 ----
AC_REQUIRE([gl_SHA512])
AC_REQUIRE([gl_STRINTCMP])
AC_REQUIRE([gl_STRNUMCMP])
+
+ m4_popdef([AC_REPLACE_FUNCS])
+ m4_popdef([AC_LIBOBJ])
])
- inline.m4: use compiler, not cpp, Jim Meyering, 2006/11/10
- Re: [bug-gnulib] inline.m4: use compiler, not cpp, Bruno Haible, 2006/11/10
- Re: inline.m4: use compiler, not cpp, Jim Meyering, 2006/11/10
- Re: inline.m4: use compiler, not cpp, Ralf Wildenhues, 2006/11/10
- missing dependencies [Re: inline.m4: use compiler, not cpp, Jim Meyering, 2006/11/10
- Re: missing dependencies [Re: inline.m4: use compiler, not cpp, Bruno Haible, 2006/11/10
- Re: missing dependencies [Re: inline.m4: use compiler, not cpp, Bruno Haible, 2006/11/13
- Re: missing dependencies [Re: inline.m4: use compiler, not cpp, Jim Meyering, 2006/11/13
- Re: missing dependencies [Re: inline.m4: use compiler, not cpp,
Bruno Haible <=
- Re: missing dependencies [Re: inline.m4: use compiler, not cpp, Jim Meyering, 2006/11/14
- Re: missing dependencies, Ralf Wildenhues, 2006/11/14
- Re: missing dependencies, Bruno Haible, 2006/11/13
- Re: missing dependencies, Ralf Wildenhues, 2006/11/14
- Re: missing dependencies, Jim Meyering, 2006/11/14
Re: inline.m4: use compiler, not cpp, Eric Blake, 2006/11/11