While working on freej we'd need to update spidermonkey/mozjs to the latest version and while doing that integrate it better with the rest of autoconf/automake. AFAICT spidermonkey/mozjs is distributed as part of XULRunner nowadays.
The requirements are to make it easy to put a new version of spidermonkey into
the tree and redistribute it with
make dist and also to have a
The first step is a trick explained in automake manual about third-party Makefiles so we're using a GNUMakefile.in (git) to "proxy" the targets down to the real Makefile or to ignore some targets called by autotools, e.g:
# otherwise linking static libmozjs.a with dynamic libfreej.so won't work CFLAGS += -fPIC # the makefile to proxy targets to js_makefile = $(builddir)/Makefile # proxy these targets to the real makefile all export js-config clean libs tools: $(MAKE) -f $(js_makefile) $(AM_MAKEFLAGS) $@ # targets required by autotools but which we don't need at all .PHONY: dvi pdf ps info html installcheck check install uninstall dvi pdf ps info html installcheck check install uninstall:
This more or less fixes the
make part, now for the
autoconf part there's a similar tecnique in the autoconf manual
involving running arbitrary configuration
I first tried to treat spidermonkey as a separate project via
AC_CONFIG_SUBDIRS as expained in Configuring Other Packages in
but it didn't work and I forgot exactly why.
The configure.ac (git) snippet is something like this: (sorry no highlighting, highlight doesn't support m4 yet)
This will run spidermonkey configure after the main configure, at this point
config.status will also expand GNUmakefile.in into GNUmakefile with the correct
The final step after all this work is of course to add the spidermonkey
directory to SUBDIRS (e.g.
While this is nice it doesn't cater for the
make dist family of
autotools targets which build the real distribution tarball.
To accomplish this I've used an explicit list of spidermonkey files that will
end up in the tarball and made
make distdir to copy only those
GNUmakefile.in and the list itself
.js-distfiles). Which is the second part of the
above, i.e. distdir/distfiles targets plus distclean to clean them up, see
comments in the file as well.
I hope this is somewhat useful to people who are trying to properly (autotools-wise) ship spidermonkey in their project, comments welcome as usual