[PATCH 1/5] Always build wayland-scanner
Jasper St. Pierre
jstpierre at mecheye.net
Tue May 27 07:46:08 PDT 2014
You need to use AS_IF instead of shell 'if' if you want to use AC_SUBST
inside a conditional.
On Tue, May 27, 2014 at 3:23 AM, Thierry Reding <thierry.reding at gmail.com>wrote:
> On Tue, May 27, 2014 at 09:22:30AM +0300, Pekka Paalanen wrote:
> > On Mon, 19 May 2014 17:12:39 +0200
> > Thierry Reding <thierry.reding at gmail.com> wrote:
> >
> > > From: Thierry Reding <treding at nvidia.com>
> > >
> > > When cross-compiling, wayland-scanner cannot be used to generate files
> > > because it is built for the host architecture. To overcome this, users
> > > currently need to instruct the build not to create wayland-scanner and
> > > provide a native variant in the PATH. This has the disadvantage of not
> > > installing the scanner either and in turn users running a distribution
> > > that was cross-built cannot use it.
> > >
> > > This commit changes the build process to always create and install the
> > > wayland-scanner binary. The configure script determines whether to use
> > > the version being built or a native version found in the PATH.
> > >
> > > Signed-off-by: Thierry Reding <treding at nvidia.com>
> > > ---
> > > Makefile.am | 11 +++--------
> > > configure.ac | 31 ++++++++++++++++---------------
> > > 2 files changed, 19 insertions(+), 23 deletions(-)
> > >
> > > diff --git a/Makefile.am b/Makefile.am
> > > index c15d8b8b853d..028d0d4837b5 100644
> > > --- a/Makefile.am
> > > +++ b/Makefile.am
> > > @@ -61,25 +61,20 @@ nodist_libwayland_client_la_SOURCES = \
> > >
> > > pkgconfig_DATA += src/wayland-client.pc src/wayland-server.pc
> > >
> > > -if ENABLE_SCANNER
> > > -wayland_scanner = $(top_builddir)/wayland-scanner
> > > bin_PROGRAMS = wayland-scanner
> > > wayland_scanner_SOURCES = src/scanner.c
> > > wayland_scanner_LDADD = $(EXPAT_LIBS) libwayland-util.la
> > > $(BUILT_SOURCES) : wayland-scanner
> > > pkgconfig_DATA += src/wayland-scanner.pc
> > > -else
> > > -wayland_scanner = wayland-scanner
> > > -endif
> > >
> > > protocol/%-protocol.c : $(top_srcdir)/protocol/%.xml
> > > - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< >
> $@
> > > + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(WAYLAND_SCANNER) code < $< >
> $@
> > >
> > > protocol/%-server-protocol.h : $(top_srcdir)/protocol/%.xml
> > > - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner)
> server-header < $< > $@
> > > + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(WAYLAND_SCANNER)
> server-header < $< > $@
> > >
> > > protocol/%-client-protocol.h : $(top_srcdir)/protocol/%.xml
> > > - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner)
> client-header < $< > $@
> > > + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(WAYLAND_SCANNER)
> client-header < $< > $@
> > >
> > > BUILT_SOURCES = \
> > > $(nodist_libwayland_server_la_SOURCES) \
> > > diff --git a/configure.ac b/configure.ac
> > > index 393310cd6699..d14142bbc8c3 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -31,6 +31,17 @@ AC_PROG_CC
> > > LT_PREREQ([2.2])
> > > LT_INIT
> > >
> > > +if test "x$cross_compiling" = "xyes"; then
> > > + AC_PATH_PROG(WAYLAND_SCANNER, wayland-scanner)
> > > +
> > > + if test "x$WAYLAND_SCANNER" = "x"; then
> > > + AC_MSG_ERROR([Cross-compiling but wayland-scanner not
> found.])
> > > + fi
> > > +else
> > > + WAYLAND_SCANNER='$(top_builddir)/wayland-scanner'
> > > + AC_SUBST([WAYLAND_SCANNER])
> > > +fi
> >
> > Is it ok to have AC_SUBST inside a condition?
> > I found one message where it seems to imply, that it is not a good
> > practice:
> > http://lists.gnu.org/archive/html/autoconf/2010-01/msg00091.html
> >
> > Otherwise looks fine to me.
>
> I think it doesn't matter at all where AC_SUBST is placed since it will
> be evaluated outside of the shell context anyway. If you prefer I can
> move it outside of the conditional block, though.
>
> Thierry
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
>
--
Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140527/1b59550e/attachment-0001.html>
More information about the wayland-devel
mailing list