[gjs] build: Allow compiling without RTTI



commit eccf3a14b9b0d6aae89baeaa32dd53f07b2b77d7
Author: Philip Chimento <philip endlessm com>
Date:   Tue Nov 22 11:56:34 2016 -0500

    build: Allow compiling without RTTI
    
    In order to inherit from C++ classes defined in the SpiderMonkey "JS
    Friend API" we must match whichever of these flags SpiderMonkey was
    compiled with. Otherwise, linking will fail, complaining about missing
    type info for the parent class.
    
    I'm not sure of a good way to check programmatically how SpiderMonkey was
    compiled, so let's just add the same flag here and say that it must match
    SpiderMonkey. RTTI is turned off by default there, and probably not ever
    turned on except for debugging upstream.
    
    The check is implemented in the same way as in SpiderMonkey (the -GR-
    flag is for MinGW, although we can be much simpler and don't have to
    check the platform explicitly, since we have AX_APPEND_COMPILER_FLAG.)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751252

 configure.ac |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ce572cb..1f12c35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,6 +186,16 @@ AC_ARG_ENABLE([Bsymbolic],
 AS_IF([test "x$enable_Bsymbolic" != "xno"],
   [AX_APPEND_LINK_FLAGS([-Bsymbolic-functions])])
 
+dnl If SpiderMonkey was compiled with this configure option, then GJS needs to
+dnl be compiled with it as well, because we inherit from a SpiderMonkey class in
+dnl jsapi-constructor-proxy.cpp. See build/autoconf/compiler-opts.m4 in mozjs31.
+AC_ARG_ENABLE([cpp-rtti],
+  [AS_HELP_STRING([--enable-cpp-rtti],
+    [needs to match SpiderMonkey's config option @<:@default=off@:>@])])
+AS_IF([test "x$enable_cpp_rtti" != "xyes"],
+  [AX_APPEND_COMPILE_FLAGS([-fno-rtti])],
+  [AX_APPEND_COMPILE_FLAGS([-GR-])])
+
 AC_ARG_WITH([xvfb-tests],
   [AS_HELP_STRING([--with-xvfb-tests],
     [Run all tests under an XVFB server @<:@default=no@:>@])])


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