summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2022-05-17 14:49:29 +0200
committerdoyougnu <jeffrey.young@iohk.io>2022-06-13 13:42:44 -0400
commit32c586a467643e7d2358d000e9cdb526a1a938da (patch)
treece0d13c4fd211edf855758fd4ee948db13ccf0ce
parentac49ac0d222ee16bb89e250cc8d8c667582ac6e7 (diff)
downloadhaskell-32c586a467643e7d2358d000e9cdb526a1a938da.tar.gz
Configure: fix echo on Mac, add ghcjs target OS
-rw-r--r--configure.ac52
1 files changed, 52 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 9bcfae04c6..ef46f7a5a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -346,6 +346,58 @@ AC_SUBST(TargetHasRTSLinker)
# Requires FPTOOLS_SET_PLATFORMS_VARS to be run first.
FP_FIND_ROOT
+if test "$TargetOS" = "ghcjs"
+then
+
+ AC_ARG_VAR(EMSDK,[Use as the full path to Emscripten. [default=autodetect]])
+ AC_ARG_VAR(EMSDK_LLVM,[Use as the full path to Emscripten LLVM. [default=autodetect]])
+
+ if test "$EMSDK" != "" ; then
+ echo "Using emsdk: $EMSDK"
+ else
+ echo -e "Error: Could not find Emscripten SDK.\nCheck the EMSDK environment variable."
+ exit 1
+ fi
+
+ if test "$EMSDK_LLVM" != "" ; then
+ echo "Using emsdk LLVM: $EMSDK_LLVM"
+ else
+ echo -e "Error: Could not find LLVM for Emscripten SDK.\nCheck the EMSDK_LLVM environment variable."
+ exit 1
+ fi
+
+ test -d inplace || mkdir inplace
+
+ ghcjsbin="$hardtop/inplace/ghcjs_toolchain/bin/"
+ mkdir -p $ghcjsbin
+
+ echo "#!/usr/bin/env bash" > "$ghcjsbin/js-unknown-ghcjs-cc"
+ echo "exec \"$EMSDK/emcc\" \"\$@\"" >> "$ghcjsbin/js-unknown-ghcjs-cc"
+ chmod 755 "$ghcjsbin/js-unknown-ghcjs-cc"
+
+ echo "#!/usr/bin/env bash" > "$ghcjsbin/js-unknown-ghcjs-ar"
+ echo "\\nexec \"$EMSDK_LLVM/bin/llvm-ar\" \"\$@\"" >> "$ghcjsbin/js-unknown-ghcjs-ar"
+ chmod 755 "$ghcjsbin/js-unknown-ghcjs-ar"
+
+ echo "#!/usr/bin/env bash" > "$ghcjsbin/js-unknown-ghcjs-ranlib"
+ echo "nexec \"$EMSDK_LLVM/bin/llvm-ranlib\" \"\$@\"" >> "$ghcjsbin/js-unknown-ghcjs-ranlib"
+ chmod 755 "$ghcjsbin/js-unknown-ghcjs-ranlib"
+
+ echo "#!/usr/bin/env bash" > "$ghcjsbin/js-unknown-ghcjs-nm"
+ echo "nexec \"$EMSDK_LLVM/bin/llvm-nm\" \"\$@\"" >> "$ghcjsbin/js-unknown-ghcjs-nm"
+ chmod 755 "$ghcjsbin/js-unknown-ghcjs-nm"
+
+ dnl the linker shouldn't be used because GHC does the JS linking.
+ dnl it makes no harm to pass emscripten's one here though and it avoids
+ dnl dealing with the rest of the build system that assumes that a linker is
+ dnl available.
+ echo "#!/usr/bin/env bash" > "$ghcjsbin/js-unknown-ghcjs-ld"
+ echo "nexec \"$EMSDK_LLVM/bin/llvm-ld\" \"\$@\"" >> "$ghcjsbin/js-unknown-ghcjs-ld"
+ chmod 755 "$ghcjsbin/js-unknown-ghcjs-ld"
+
+ export PATH=$ghcjsbin:$PATH
+fi
+
# Extract and configure the Windows toolchain
if test "$HostOS" = "mingw32" -a "$EnableDistroToolchain" = "NO"; then
FP_SETUP_WINDOWS_TOOLCHAIN