variables in _SOURCES

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

variables in _SOURCES

Daniel Pocock


According to the "Warning" in this page[1], it is not permitted to use
variables in _SOURCES.  Is this deliberate or is it a bug?

In our project, we started getting the warnings about subdir-objects and
so we added[2]

  AM_INIT_AUTOMAKE([foreign subdir-objects])

However, since that time the build has been failing[3] and it appears to
be because one module[4] is using a variable in _SOURCES

The $PYCXX_SRCDIR variable is used to refer to the sources provided by
the PyCXX[5] library.  PyCXX is not distributed as a compiled library
that can be linked against, the sources are simply placed under
/usr/share by the packages (e.g. on Debian[6]) and users have to compile
them into their projects by referring to them from their Makefile.

What is the recommended way of using such sources in a build?  I could
write some Makefile rule to copy or symlink the sources in to the tree,
but is there an official way to solve this with autotools?

More specifically, I am using them like this:

configure:

./configure ... \
   --with-python \
   PYCXX_SRCDIR=/usr/share/python2.7/CXX/Python2


Makefile.am:

nodist_libpyroute_la_SOURCES = $(PYCXX_SRCDIR)/cxxextensions.c
nodist_libpyroute_la_SOURCES += $(PYCXX_SRCDIR)/cxx_extensions.cxx
nodist_libpyroute_la_SOURCES += $(PYCXX_SRCDIR)/cxxsupport.cxx
nodist_libpyroute_la_SOURCES +=
$(PYCXX_SRCDIR)/../IndirectPythonInterface.cxx




1. https://autotools.io/automake/nonrecursive.html
2.
https://github.com/resiprocate/resiprocate/commit/fb37bc86db9f1b7d569eb2a17acd1e683b6ce55f
3. https://travis-ci.org/resiprocate/resiprocate/builds/131873177
4.
https://github.com/resiprocate/resiprocate/blob/master/repro/plugins/pyroute/Makefile.am
5. http://cxx.sourceforge.net/
6.
https://packages.debian.org/search?searchon=contents&keywords=cxxextensions.c&mode=path&suite=stable&arch=any


Reply | Threaded
Open this post in threaded view
|

Re: variables in _SOURCES

Gavin Smith
> configure:
>
> ./configure ... \
>    --with-python \
>    PYCXX_SRCDIR=/usr/share/python2.7/CXX/Python2
>
>
> Makefile.am:
>
> nodist_libpyroute_la_SOURCES = $(PYCXX_SRCDIR)/cxxextensions.c
> nodist_libpyroute_la_SOURCES += $(PYCXX_SRCDIR)/cxx_extensions.cxx
> nodist_libpyroute_la_SOURCES += $(PYCXX_SRCDIR)/cxxsupport.cxx
> nodist_libpyroute_la_SOURCES +=
> $(PYCXX_SRCDIR)/../IndirectPythonInterface.cxx

It's possible that this would work if PYCXX_SRCDIR was a variable in
Makefile.am (I haven't checked). The page you linked to said that this
wouldn't work, though.

What you've done here is different: supplying the value of
PYCXX_SRCDIR with configure. This won't work because all the files
need to be given explicitly in Makefile.am.
(https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html#FOOT3)

Reply | Threaded
Open this post in threaded view
|

Re: variables in _SOURCES

Bert Wesarg-2
In reply to this post by Daniel Pocock
Daniel,

this is still a known bug in released versions of autotools, see

http://debbugs.gnu.org/13928

Best,
Bert

On Sun, Jun 12, 2016 at 9:22 AM, Daniel Pocock <[hidden email]> wrote:

>
>
> According to the "Warning" in this page[1], it is not permitted to use
> variables in _SOURCES.  Is this deliberate or is it a bug?
>
> In our project, we started getting the warnings about subdir-objects and
> so we added[2]
>
>   AM_INIT_AUTOMAKE([foreign subdir-objects])
>
> However, since that time the build has been failing[3] and it appears to
> be because one module[4] is using a variable in _SOURCES
>
> The $PYCXX_SRCDIR variable is used to refer to the sources provided by
> the PyCXX[5] library.  PyCXX is not distributed as a compiled library
> that can be linked against, the sources are simply placed under
> /usr/share by the packages (e.g. on Debian[6]) and users have to compile
> them into their projects by referring to them from their Makefile.
>
> What is the recommended way of using such sources in a build?  I could
> write some Makefile rule to copy or symlink the sources in to the tree,
> but is there an official way to solve this with autotools?
>
> More specifically, I am using them like this:
>
> configure:
>
> ./configure ... \
>    --with-python \
>    PYCXX_SRCDIR=/usr/share/python2.7/CXX/Python2
>
>
> Makefile.am:
>
> nodist_libpyroute_la_SOURCES = $(PYCXX_SRCDIR)/cxxextensions.c
> nodist_libpyroute_la_SOURCES += $(PYCXX_SRCDIR)/cxx_extensions.cxx
> nodist_libpyroute_la_SOURCES += $(PYCXX_SRCDIR)/cxxsupport.cxx
> nodist_libpyroute_la_SOURCES +=
> $(PYCXX_SRCDIR)/../IndirectPythonInterface.cxx
>
>
>
>
> 1. https://autotools.io/automake/nonrecursive.html
> 2.
> https://github.com/resiprocate/resiprocate/commit/fb37bc86db9f1b7d569eb2a17acd1e683b6ce55f
> 3. https://travis-ci.org/resiprocate/resiprocate/builds/131873177
> 4.
> https://github.com/resiprocate/resiprocate/blob/master/repro/plugins/pyroute/Makefile.am
> 5. http://cxx.sourceforge.net/
> 6.
> https://packages.debian.org/search?searchon=contents&keywords=cxxextensions.c&mode=path&suite=stable&arch=any
>
>

Reply | Threaded
Open this post in threaded view
|

Re: variables in _SOURCES

Mathieu Lirzin
In reply to this post by Daniel Pocock
Hello,

Daniel Pocock <[hidden email]> writes:

> According to the "Warning" in this page[1], it is not permitted to use
> variables in _SOURCES.  Is this deliberate or is it a bug?
>
> In our project, we started getting the warnings about subdir-objects and
> so we added[2]
>
>   AM_INIT_AUTOMAKE([foreign subdir-objects])
>
> However, since that time the build has been failing[3] and it appears to
> be because one module[4] is using a variable in _SOURCES
>
> The $PYCXX_SRCDIR variable is used to refer to the sources provided by
> the PyCXX[5] library.  PyCXX is not distributed as a compiled library
> that can be linked against, the sources are simply placed under
> /usr/share by the packages (e.g. on Debian[6]) and users have to compile
> them into their projects by referring to them from their Makefile.
>
> What is the recommended way of using such sources in a build?  I could
> write some Makefile rule to copy or symlink the sources in to the tree,
> but is there an official way to solve this with autotools?

The idiomatic way is to distribute every source files that could be
built.  One way to achieve that would be to make a 'bootstrap' script
that fetches PyCXX sources before doing ‘autoreconf -vfi’.

--
Mathieu Lirzin