bug-automake
[Top][All Lists]
Advanced

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

Re: AC_LIBOBJ with file in subdirectory does not work


From: Bruno Haible
Subject: Re: AC_LIBOBJ with file in subdirectory does not work
Date: Thu, 27 May 2010 11:32:45 +0200
User-agent: KMail/1.9.9

Hi Ralf,

> >   - How to use Automake conditionals or AC_SUBSTed variables without
> >     file names as replacement for AC_LIBOBJ.
> 
> That's fine only for projects where the list of libobjs is taken from a
> static list of file names.  Thus it may be fine for gnulib, but it is
> not something we can generally impose.

Huh? The Automake doc, under EXTRA_maude_SOURCES, says: "Automake needs
to know the list of files you intend to compile _statically_." What are
the cases where you don't know that list of files, and "make dist"
still is able to enumerate all the files?

> > I will work on the latter topic, for gnulib, in the next few days.
> 
> I have looked into enabling subdir-objects for libobjs only.  That is
> not feasible.

OK.

> - Autoconf can have a new macro AC_LIBOBJS_FLATTEN or so ...

Or another idea: Extend AC_LIBOBJ so that it accepts file names with
slashes. In the configure file, replace the 2 variables LIBOBJS and
LTLIBOBJS with 4 variables LIBOBJS, LTLIBOBJS, SOLIBOBJS, LTSOLIBOBJS.
If AC_LIBOBJ([subdir/foo/bar]) is executed, then
  LIBOBJS     will contain  bar.$ac_objext
  LTLIBOBJS   will contain  bar.lo
  SOLIBOBJS   will contain  subdir/foo/bar.$ac_objext
  LTSOLIBOBJS will contain  subdir/foo/bar.lo
In the Makefile.in generated by Automake from Makefile.am, generate the
lines
  LIBOBJS = @LIBOBJS@
  LTLIBOBJS = @LTLIBOBJS@
if subdir-objects is turned off, or
  LIBOBJS = @SOLIBOBJS@
  LTLIBOBJS = @LTSOLIBOBJS@
if it is turned on. Thus the LIBOBJS and LTLIBOBJS become "special"
Makefile variables, like srcdir, top_srcdir, and VPATH. Finally, document
that users should use $(LIBOBJS) instead of @LIBOBJS@, and $(LTLIBOBJS)
instead of @address@hidden

Btw, when doing this, it would also be useful to lift the limitation to
C source files. AC_LIBOBJ can not be used for source files in C++, Fortran,
Java, Python, etc. While at it, you could introduce a macro AC_LIBOBJSOURCE
that is like AC_LIBOBJ except that its argument includes the source file
suffix:
   AC_LIBOBJSOURCE([subdir/foo/bar.c]) == AC_LIBOBJ([subdir/foo/bar])

Bruno



reply via email to

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