diff --git a/meson.build b/meson.build
index e602b84..2baf475 100644
--- a/meson.build
+++ b/meson.build
@@ -267,6 +267,14 @@ endif
 # Check if a minimal SpiderMonkey program compiles, links, and runs. If not,
 # it's most likely the case that SpiderMonkey was configured incorrectly, for
 # example by building mozglue as a shared library.
+recommended_configuration = ''' Check the recommended configuration:
+https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples/blob/esr91/docs/Building%20SpiderMonkey.md'''
+if meson.is_cross_build()
+    warning('''This is a cross build. A check that a minimal
+SpiderMonkey program executes will not be performed. Before shipping GJS, you
+should check that it does not crash on startup, since building SpiderMonkey with
+the wrong configuration may cause that.''' + recommended_configuration)
+else
 minimal_program = cxx.run('''
 #include <js/Initialization.h>
 int main(void) {
@@ -278,22 +286,16 @@ int main(void) {
     args: debug_arg, dependencies: spidermonkey,
     name: 'SpiderMonkey sanity check')
 
-recommended_configuration = ''' Check the recommended configuration:
-https://github.com/spidermonkey-embedders/spidermonkey-embedding-examples/blob/esr91/docs/Building%20SpiderMonkey.md'''
 if not minimal_program.compiled()
     error('''A minimal SpiderMonkey program
 could not be compiled or linked. Most likely you should build it with a
 different configuration.''' + recommended_configuration)
-elif meson.is_cross_build()
-    warning('''This is a cross build. A check that a minimal
-SpiderMonkey program executes will not be performed. Before shipping GJS, you
-should check that it does not crash on startup, since building SpiderMonkey with
-the wrong configuration may cause that.''' + recommended_configuration)
 elif minimal_program.returncode() != 0
     error('''A minimal SpiderMonkey program
 failed to execute. Most likely you should build it with a different
 configuration.''' + recommended_configuration)
 endif
+endif
 
 have_printf_alternative_int = cc.compiles('''
 #include <stdio.h>
