configure.ac |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 686a75b54ecfcceba6f1747c6b308b79624c3543
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Thu Jan 12 21:47:24 2023 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Thu Feb 23 18:24:04 2023 +0000

    Fix Emscripten version check to still work with older SDK versions
    
    Change-Id: I051b5edd5936bcb94521f88ec7a7a762c66c9283
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145419
    Tested-by: Jenkins
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Tor Lillqvist <t...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147517
    Tested-by: Tor Lillqvist <t...@collabora.com>

diff --git a/configure.ac b/configure.ac
index 05534dc6a8c2..392e8020813c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1406,11 +1406,17 @@ if test "$_os" = "Emscripten"; then
     AS_IF([test -z "$EMSDK"],
           [AC_MSG_ERROR([No \$EMSDK environment variable.])])
     
EMSCRIPTEN_VERSION_H=$EMSDK/upstream/emscripten/cache/sysroot/include/emscripten/version.h
-    AS_IF([test ! -f "$EMSCRIPTEN_VERSION_H"],
-          [AC_MSG_ERROR([Could not find the <emscripten/version.h> in the 
Emscripten SDK.])])
-    EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" | 
$SED -ne 's/.*__EMSCRIPTEN_major__ //p')
-    EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" | 
$SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
-    EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | $SED 
-ne 's/.*__EMSCRIPTEN_tiny__ //p')
+    if test -f "$EMSCRIPTEN_VERSION_H"; then
+        EMSCRIPTEN_MAJOR=$($GREP __EMSCRIPTEN_major__ "$EMSCRIPTEN_VERSION_H" 
| $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
+        EMSCRIPTEN_MINOR=$($GREP __EMSCRIPTEN_minor__ "$EMSCRIPTEN_VERSION_H" 
| $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
+        EMSCRIPTEN_TINY=$($GREP __EMSCRIPTEN_tiny__ "$EMSCRIPTEN_VERSION_H" | 
$SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
+    else
+        EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
+        EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 
's/.*__EMSCRIPTEN_major__ //p')
+        EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 
's/.*__EMSCRIPTEN_minor__ //p')
+        EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 
's/.*__EMSCRIPTEN_tiny__ //p')
+    fi
+
     
EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
 
     check_semantic_version_three_prefixed EMSCRIPTEN MIN

Reply via email to