[PATCH 2/4] Cleanup configure and add support for mozjs24

Jeremy Linton jeremy.linton at arm.com
Thu Aug 4 16:57:48 UTC 2016


We want to support more than two mozjs versions, so
cleanup the mozjs configure selection and add an
additional stanza.

Signed-off-by: Jeremy Linton <jeremy.linton at arm.com>
---
 configure.ac | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 18c1f4e..007f99f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,18 +131,20 @@ AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_30],
 AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [G_ENCODE_VERSION(2,34)],
         [Notify us when we'll need to transition away from g_type_init()])
 
-AC_ARG_WITH(mozjs, AS_HELP_STRING([--with-mozjs=@<:@mozjs185/mozjs-17.0|auto@:>@],
+AC_ARG_WITH(mozjs, AS_HELP_STRING([--with-mozjs=@<:@mozjs-24|mozjs185|mozjs-17.0|auto@:>@],
 		                  [Specify version of Spidermonkey to use]),,
             with_mozjs=auto)
-AS_IF([test x${with_mozjs} != xauto], [
-  PKG_CHECK_MODULES(LIBJS, ${with_mozjs})
-], [
-  PKG_CHECK_MODULES(LIBJS, [mozjs185], have_mozjs185=yes, have_mozjs185=no)
-  AS_IF([test x${have_mozjs185} = xno], [
-  PKG_CHECK_MODULES(LIBJS, [mozjs-17.0], have_mozjs17=yes,
-   [AC_MSG_ERROR([Could not find mozjs185 or mozjs-17.0; see http://ftp.mozilla.org/pub/mozilla.org/js/])])
-  ])
-])
+AS_IF( [test x${with_mozjs} != xauto]                           , [PKG_CHECK_MODULES(LIBJS, ${with_mozjs})],
+       [PKG_CHECK_MODULES(LIBJS, [mozjs-24],   [true], [false])], [ ],
+       [PKG_CHECK_MODULES(LIBJS, [mozjs185],   [true], [false])], [ ],
+       [PKG_CHECK_MODULES(LIBJS, [mozjs-17.0], [true], [false])], [ ],
+       [AC_MSG_ERROR([Could not find mozjs; see http://ftp.mozilla.org/pub/mozilla.org/js/])]
+      )
+
+# deal with the newer mozjs's not having a version macro by adding our own
+AS_IF( [ test x${LIBJS_LIBS} == x-lmozjs-24] , [ LIBJS_CFLAGS="${LIBJS_CFLAGS} -DJS_VERSION2=24" ],
+       [ ])
+
 AC_SUBST(LIBJS_CFLAGS)
 AC_SUBST(LIBJS_CXXFLAGS)
 AC_SUBST(LIBJS_LIBS)
-- 
2.9.2



More information about the polkit-devel mailing list