From 8a0ee66150a7dc4daa5255549121d1ea8533db2e Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Mon, 17 Jan 2022 07:40:14 +0000 Subject: [PATCH] initial patch set --- patches/Cabal-3.2.1.0.patch | 20 + patches/basement-0.0.12.patch | 19 + patches/clock-0.8.2.patch | 42 + patches/cryptonite-0.29.patch | 575 ++++ patches/double-conversion-2.0.2.0.patch | 221 ++ patches/foundation-0.0.26.1.patch | 104 + patches/network-3.1.2.1.patch | 3720 +++++++++++++++++++++++ patches/network-3.1.2.5.patch | 21 + patches/terminal-size-0.3.2.1.patch | 14 + patches/unix-compat-0.5.3.patch | 13 + 10 files changed, 4749 insertions(+) create mode 100644 patches/Cabal-3.2.1.0.patch create mode 100644 patches/basement-0.0.12.patch create mode 100644 patches/clock-0.8.2.patch create mode 100644 patches/cryptonite-0.29.patch create mode 100644 patches/double-conversion-2.0.2.0.patch create mode 100644 patches/foundation-0.0.26.1.patch create mode 100644 patches/network-3.1.2.1.patch create mode 100644 patches/network-3.1.2.5.patch create mode 100644 patches/terminal-size-0.3.2.1.patch create mode 100644 patches/unix-compat-0.5.3.patch diff --git a/patches/Cabal-3.2.1.0.patch b/patches/Cabal-3.2.1.0.patch new file mode 100644 index 0000000..aa80165 --- /dev/null +++ b/patches/Cabal-3.2.1.0.patch @@ -0,0 +1,20 @@ +diff --git a/Distribution/Simple/GHCJS.hs b/Distribution/Simple/GHCJS.hs +index 4ad5bb18c..5db4d27e7 100644 +--- a/Distribution/Simple/GHCJS.hs ++++ b/Distribution/Simple/GHCJS.hs +@@ -317,13 +317,10 @@ checkPackageDbStack :: Verbosity -> PackageDBStack -> IO () + checkPackageDbStack _ (GlobalPackageDB:rest) + | GlobalPackageDB `notElem` rest = return () + checkPackageDbStack verbosity rest +- | GlobalPackageDB `notElem` rest = +- die' verbosity $ "With current ghc versions the global package db is always used " +- ++ "and must be listed first. This ghc limitation may be lifted in " +- ++ "future, see http://ghc.haskell.org/trac/ghc/ticket/5977" +-checkPackageDbStack verbosity _ = ++ | GlobalPackageDB `elem` rest = + die' verbosity $ "If the global package db is specified, it must be " + ++ "specified first and cannot be specified multiple times" ++checkPackageDbStack _ _ = return () + + getInstalledPackages' :: Verbosity -> [PackageDB] -> ProgramDb + -> IO [(PackageDB, [InstalledPackageInfo])] diff --git a/patches/basement-0.0.12.patch b/patches/basement-0.0.12.patch new file mode 100644 index 0000000..c072cc3 --- /dev/null +++ b/patches/basement-0.0.12.patch @@ -0,0 +1,19 @@ +diff --git b/basement.cabal a/basement.cabal +index 72125e015..b7670c3ee 100644 +--- b/basement.cabal ++++ a/basement.cabal +@@ -160,3 +160,5 @@ library + c-sources: cbits/foundation_mem.c + if impl(ghc < 8.2) + c-sources: cbits/basement_rts.c ++ if os(ghcjs) ++ js-sources: jsbits/basement.js +diff --git b/jsbits/basement.js a/jsbits/basement.js +new file mode 100644 +index 000000000..3d9172147 +--- /dev/null ++++ a/jsbits/basement.js +@@ -0,0 +1,3 @@ ++function h$_foundation_memcmp(s1, o1, off1, s2, o2, off2, n) { ++ h$memcmp(s1, o1 + off2, s2, o2 + off2, n); ++} diff --git a/patches/clock-0.8.2.patch b/patches/clock-0.8.2.patch new file mode 100644 index 0000000..75c23c9 --- /dev/null +++ b/patches/clock-0.8.2.patch @@ -0,0 +1,42 @@ +diff --git b/clock.cabal a/clock.cabal +index 253033538..8a73b9640 100644 +--- b/clock.cabal ++++ a/clock.cabal +@@ -84,6 +84,8 @@ library + if flag(llvm) + ghc-options: -fllvm -optlo-O3 + ++ if os(ghcjs) ++ js-sources: jsbits/gettime.js + + test-suite test + default-language: Haskell2010 +diff --git b/jsbits/gettime.js a/jsbits/gettime.js +new file mode 100644 +index 000000000..a09f351b9 +--- /dev/null ++++ a/jsbits/gettime.js +@@ -0,0 +1,23 @@ ++function h$clock_gettime(when, p_d, p_o) { ++ /* XXX: guess if we have to write 64 bit values: ++ alloca is often used and will give us 16 bytes ++ if timespec contains two 64 bit values ++ but we really should fix this by not having hsc2hs values ++ from the build system leak here ++ */ ++ var is64 = p_d.i3.length == 4 && p_o == 0; ++ var o = p_o >> 2, ++ t = Date.now ? Date.now() : new Date().getTime(), ++ tf = Math.floor(t / 1000), ++ tn = 1000000 * (t - (1000 * tf)); ++ if(is64) { ++ p_d.i3[o] = tf|0; ++ p_d.i3[o+1] = 0; ++ p_d.i3[o+2] = tn|0; ++ p_d.i3[o+3] = 0; ++ } else { ++ p_d.i3[o] = tf|0; ++ p_d.i3[o+1] = tn|0; ++ } ++ return 0; ++} diff --git a/patches/cryptonite-0.29.patch b/patches/cryptonite-0.29.patch new file mode 100644 index 0000000..c2e928b --- /dev/null +++ b/patches/cryptonite-0.29.patch @@ -0,0 +1,575 @@ +diff --git b/cryptonite.cabal a/cryptonite.cabal +index 83d100b4a..f21284388 100644 +--- b/cryptonite.cabal ++++ a/cryptonite.cabal +@@ -59,6 +59,8 @@ extra-source-files: cbits/*.h + cbits/aes/x86ni_impl.c + cbits/cryptonite_hash_prefix.c + tests/*.hs ++ jsbits/bindings.js ++ + + source-repository head + type: git +@@ -389,6 +391,9 @@ Library + else + Other-modules: Crypto.Random.Entropy.Unix + ++ if os(ghcjs) ++ js-sources: jsbits/bindings.js ++ + if impl(ghc) && flag(integer-gmp) + Build-depends: integer-gmp + +diff --git b/jsbits/bindings.js a/jsbits/bindings.js +new file mode 100644 +index 000000000..01e9c5078 +--- /dev/null ++++ a/jsbits/bindings.js +@@ -0,0 +1,525 @@ ++/* ++ Pointers in emscripten compiled code are represented as offsets ++ into the global HEAP ArrayBuffer. ++ ++ GHCJS pointers (Addr#) and unlifted arrays (ByteArray# etc.) are represented ++ as a pair of a buffer and an offset. ++ */ ++ ++// EMCC:EXPORTED_FUNCTIONS _malloc _free ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_md5_init _cryptonite_md5_update _cryptonite_md5_finalize ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_sha256_init _cryptonite_sha256_update _cryptonite_sha256_finalize ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_sha512_init _cryptonite_sha512_update _cryptonite_sha512_finalize ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_sha3_init _cryptonite_sha3_update _cryptonite_sha3_finalize ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_blake2b_init _cryptonite_blake2b_update _cryptonite_blake2b_finalize ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_poly1305_init _cryptonite_poly1305_update _cryptonite_poly1305_finalize ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_chacha_init _cryptonite_chacha_combine _cryptonite_chacha_generate ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_chacha_random ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_chacha_init_core ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_fastpbkdf2_hmac_sha512 ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_ed25519_point_base_scalarmul ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_ed25519_point_encode ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_ed25519_scalar_decode_long ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_ed25519_sign_open ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_ed25519_sign ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_ed25519_publickey ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_ed25519_point_add ++// EMCC:EXPORTED_FUNCTIONS _cryptonite_aes_cpu_init ++ ++ ++function h$logWrapper(x) { ++ /* console.log(x); */ ++} ++ ++function h$copyToHeap(buf_d, buf_o, tgt, len) { ++ if(len === 0) return; ++ var u8 = buf_d.u8; ++ var hexes = ""; ++ for(var i=0;i " + len + " " + hexes + " " + buf_o + " " + buf_d.len); ++} ++ ++function h$copyFromHeap(src, buf_d, buf_o, len) { ++ var u8 = buf_d.u8; ++ var hexes = ""; ++ for(var i=0;i 0) { ++ _free(h$buffers[n]); ++ } ++ h$buffers[n] = _malloc(2*minSize); // fixme 2* shouldn't be needed ++ h$bufferSizes[n] = minSize; ++ } ++ return h$buffers[n]; ++} ++ ++function h$getTmpBufferWith(n, buf_d, buf_o, len) { ++ // fixme: we can avoid the copying if the buffer is already the actual ++ // heap buffer ++ var buf_ptr = h$getTmpBuffer(n, len); ++ h$copyToHeap(buf_d, buf_o, buf_ptr, len); ++ return buf_ptr; ++} ++ ++/* MD5 */ ++var h$md5_ctx_size = 76; // fixme test ++var h$md5_digest_size = 16; ++ ++function h$cryptonite_md5_init(ctx_d, ctx_o) { ++ h$logWrapper("h$cryptonite_md5_init"); ++ var ctx_ptr = h$getTmpBuffer(0, h$md5_ctx_size); ++ _cryptonite_md5_init(ctx_ptr); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$md5_ctx_size); ++} ++ ++function h$cryptonite_md5_update(ctx_d, ctx_o, data_d, data_o, len) { ++ h$logWrapper("h$cryptonite_md5_update"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$md5_ctx_size), ++ data_ptr = h$getTmpBufferWith(1, data_d, data_o, len); ++ _cryptonite_md5_update(ctx_ptr, data_ptr, len); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$md5_ctx_size); ++} ++ ++function h$cryptonite_md5_finalize(ctx_d, ctx_o, out_d, out_o) { ++ h$logWrapper("h$cryptonite_md5_finalize"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$md5_ctx_size), ++ out_ptr = h$getTmpBuffer(1, h$md5_digest_size); ++ _cryptonite_md5_finalize(ctx_ptr, out_ptr); ++ h$copyFromHeap(out_ptr, out_d, out_o, h$md5_digest_size); ++} ++ ++/* SHA256 */ ++var h$sha256_ctx_size = 192; // 168; ++var h$sha256_digest_size = 32; ++ ++function h$cryptonite_sha256_init(ctx_d, ctx_o) { ++ h$logWrapper("h$cryptonite_sha256_init"); ++ var ctx_ptr = h$getTmpBuffer(0, h$sha256_ctx_size); ++ _cryptonite_sha256_init(ctx_ptr); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$sha256_ctx_size); ++} ++ ++function h$cryptonite_sha256_update(ctx_d, ctx_o, data_d, data_o, len) { ++ h$logWrapper("h$cryptonite_sha256_update"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$sha256_ctx_size), ++ data_ptr = h$getTmpBufferWith(1, data_d, data_o, len); ++ _cryptonite_sha256_update(ctx_ptr, data_ptr, len); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$sha256_ctx_size); ++} ++ ++function h$cryptonite_sha256_finalize(ctx_d, ctx_o, out_d, out_o) { ++ h$logWrapper("h$cryptonite_sha256_finalize"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$sha256_ctx_size), ++ out_ptr = h$getTmpBuffer(1, h$sha256_digest_size); ++ _cryptonite_sha256_finalize(ctx_ptr, out_ptr); ++ h$copyFromHeap(out_ptr, out_d, out_o, h$sha256_digest_size); ++} ++ ++/* SHA512 */ ++var h$sha512_ctx_size = 256; // 208; // 256? ++var h$sha512_digest_size = 64; ++ ++function h$cryptonite_sha512_init(ctx_d, ctx_o) { ++ h$logWrapper("h$cryptonite_sha512_init"); ++ var ctx_ptr = h$getTmpBuffer(0, h$sha512_ctx_size); ++ _cryptonite_sha512_init(ctx_ptr); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$sha512_ctx_size); ++} ++ ++function h$cryptonite_sha512_update(ctx_d, ctx_o, data_d, data_o, len) { ++ h$logWrapper("h$cryptonite_sha512_update"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$sha512_ctx_size), ++ data_ptr = h$getTmpBufferWith(1, data_d, data_o, len); ++ _cryptonite_sha512_update(ctx_ptr, data_ptr, len); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$sha512_ctx_size); ++} ++ ++function h$cryptonite_sha512_finalize(ctx_d, ctx_o, out_d, out_o) { ++ h$logWrapper("h$cryptonite_sha512_finalize"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$sha512_ctx_size), ++ out_ptr = h$getTmpBuffer(1, h$sha512_digest_size); ++ _cryptonite_sha512_finalize(ctx_ptr, out_ptr); ++ h$copyFromHeap(out_ptr, out_d, out_o, h$sha512_digest_size); ++} ++ ++/* SHA3 */ ++ ++/* ++ SHA3 has a variable digest size, which affects the size of the context. ++ ++ Rather than figuring out exactly how much is needed, we just copy a bit ++ more data back and forth, up to the maximum context and diegest size, ++ while ensuring that we don't overrun our ArrayBuffer ++ */ ++var h$sha3_ctx_size_max = 376; // maximum size ++var h$sha3_digest_size_max = 64; // maximum size ++ ++function h$cryptonite_sha3_init(ctx_d, ctx_o, hashlen) { ++ h$logWrapper("h$cryptonite_sha3_init"); ++ var ctx_size = Math.min(h$sha3_ctx_size_max, ctx_d.len-ctx_o); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, ctx_size); ++ _cryptonite_sha3_init(ctx_ptr, hashlen); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, ctx_size); ++} ++ ++function h$cryptonite_sha3_update(ctx_d, ctx_o, data_d, data_o, len) { ++ h$logWrapper("h$cryptonite_sha3_update"); ++ var ctx_size = Math.min(h$sha3_ctx_size_max, ctx_d.len-ctx_o); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, ctx_size), ++ data_ptr = h$getTmpBufferWith(1, data_d, data_o, len); ++ _cryptonite_sha3_update(ctx_ptr, data_ptr, len); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, ctx_size); ++} ++ ++function h$cryptonite_sha3_finalize(ctx_d, ctx_o, hashlen, out_d, out_o) { ++ h$logWrapper("h$cryptonite_sha3_finalize"); ++ var ctx_size = Math.min(h$sha3_ctx_size_max, ctx_d.len-ctx_o); ++ // digest_size = Math.min(h$sha3_digest_size_max,out_d.len-out_o); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, ctx_size), ++ out_ptr = h$getTmpBufferWith(1, out_d, out_o, hashlen / 8); ++ _cryptonite_sha3_finalize(ctx_ptr, hashlen, out_ptr); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, ctx_size); ++ h$copyFromHeap(out_ptr, out_d, out_o, hashlen / 8); ++} ++ ++/* BLAKE2B */ ++ ++var h$blake2b_state_size = 248; // fixme, this number may be wrong for different hash sizes than the wallet uses ++ ++function h$cryptonite_blake2b_init(ctx_d, ctx_o, hashlen) { ++ h$logWrapper("h$cryptonite_blake2b_init"); ++ var ctx_ptr = h$getTmpBuffer(0, ctx_d, ctx_o, h$blake2b_state_size); ++ _cryptonite_blake2b_init(ctx_ptr, hashlen); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$blake2b_state_size); ++} ++ ++function h$cryptonite_blake2b_update(ctx_d, ctx_o, data_d, data_o, len) { ++ h$logWrapper("h$cryptonite_blake2b_update"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$blake2b_state_size), ++ data_ptr = h$getTmpBufferWith(1, data_d, data_o, len); ++ _cryptonite_blake2b_update(ctx_ptr, data_ptr, len); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$blake2b_state_size); ++} ++ ++function h$cryptonite_blake2b_finalize(ctx_d, ctx_o, hashlen, out_d, out_o) { ++ h$logWrapper("h$cryptonite_blake2b_finalize"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$blake2b_state_size), ++ out_ptr = h$getTmpBuffer(1, hashlen); ++ _cryptonite_blake2b_finalize(ctx_ptr, hashlen, out_ptr); ++ h$copyFromHeap(out_ptr, out_d, out_o, hashlen); ++} ++ ++/* ED25519 */ ++var h$ed25519_pk_size = 32; ++var h$ed25519_sk_size = 64; ++var h$ed25519_sig_size = 64; ++ ++function h$cryptonite_ed25519_point_base_scalarmul(r_d, r_o, s_d, s_o) { ++ h$logWrapper("h$cardano_crypto_ed25519_point_base_scalarmul"); ++ // XXX sizes ++ var s_ptr = h$getTmpBufferWith(0, s_d, s_o, 40), ++ r_ptr = h$getTmpBuffer(1, 160); ++ _cryptonite_ed25519_point_base_scalarmul(r_ptr, s_ptr); ++ h$copyFromHeap(r_ptr, r_d, r_o, 160); ++} ++ ++function h$cryptonite_ed25519_point_encode(out_d, out_o, in_d, in_o) { ++ // XXX sizes ++ h$logWrapper("h$cardano_crypto_ed25519_point_encode"); ++ var in_ptr = h$getTmpBufferWith(0, in_d, in_o, 160), ++ out_ptr = h$getTmpBuffer(1, 32); ++ _cryptonite_ed25519_point_encode(out_ptr, in_ptr); ++ h$copyFromHeap(out_ptr, out_d, out_o, 32); ++} ++ ++function h$cryptonite_ed25519_scalar_decode_long(out_d, out_o, in_d, in_o, len) { ++ h$logWrapper("h$cardano_crypto_ed25519_decode_long"); ++ // XXX sizes ++ var in_ptr = h$getTmpBufferWith(0, in_d, in_o, len), ++ out_ptr = h$getTmpBuffer(1, 40); ++ var r = _cryptonite_ed25519_scalar_decode_long(out_ptr, in_ptr, len); ++ h$copyFromHeap(out_ptr, out_d, out_o, 40); ++ return r; ++} ++ ++function h$cryptonite_ed25519_sign_open(m_d, m_o, mlen, pk_d, pk_o, sig_d, sig_o) { ++ h$logWrapper("h$cryptonite_ed25519_sign_open"); ++ var m_ptr = h$getTmpBufferWith(0, m_d, m_o, mlen), ++ pk_ptr = h$getTmpBufferWith(1, pk_d, pk_o, h$ed25519_pk_size), ++ sig_ptr = h$getTmpBufferWith(2, sig_d, sig_o, h$ed25519_sig_size); ++ return _cryptonite_ed25519_sign_open(m_ptr, mlen, pk_ptr, sig_ptr); ++} ++ ++function h$cryptonite_ed25519_sign(m_d, m_o, mlen, salt_d, salt_o, slen, sk_d, sk_o, pk_d, pk_o, sig_d, sig_o) { ++ h$logWrapper("h$cryptonite_ed25519_sign"); ++ var m_ptr = h$getTmpBufferWith(0, m_d, m_o, mlen), ++ salt_ptr = h$getTmpBufferWith(1, salt_d, salt_o, slen), ++ sk_ptr = h$getTmpBufferWith(2, sk_d, sk_o, h$ed25519_sk_size), ++ pk_ptr = h$getTmpBufferWith(3, pk_d, pk_o, h$ed25519_pk_size), ++ sig_ptr = h$getTmpBuffer(4, h$ed25519_sig_size); ++ _cryptonite_ed25519_sign ++ (m_ptr, mlen, salt_ptr, slen, sk_ptr, pk_ptr, sig_ptr); ++ h$copyFromHeap(sig_ptr, sig_d, sig_o, h$ed25519_sig_size); ++} ++ ++function h$cryptonite_ed25519_publickey(sk_d, sk_o, pk_d, pk_o) { ++ h$logWrapper("h$cryptonite_ed25519_publickey"); ++ var sk_ptr = h$getTmpBufferWith(0, sk_d, sk_o, h$ed25519_sk_size), ++ pk_ptr = h$getTmpBuffer(1, h$ed25519_pk_size); ++ _cryptonite_ed25519_publickey(sk_ptr, pk_ptr); ++ h$copyFromHeap(pk_ptr, pk_d, pk_o, h$ed25519_pk_size); ++} ++ ++function h$cryptonite_ed25519_point_add(pk1_d, pk1_o, pk2_d, pk2_o, res_d, res_o) { ++ h$logWrapper("h$cryptonite_ed25519_point_add"); ++ var pk1_ptr = h$getTmpBufferWith(0, pk1_d, pk1_o, h$ed25519_pk_size), ++ pk2_ptr = h$getTmpBufferWith(1, pk2_d, pk2_o, h$ed25519_pk_size), ++ res_ptr = h$getTmpBuffer(2, h$ed25519_pk_size); ++ var r = _cryptonite_ed25519_point_add(pk1_ptr, pk2_ptr, res_ptr); ++ h$copyFromHeap(res_ptr, res_d, res_o, h$ed25519_pk_size); ++ return r; ++} ++ ++/* pbkdf */ ++ ++function h$cryptonite_fastpbkdf2_hmac_sha512( pw_d, pw_o, pw_len ++ , salt_d, salt_o, salt_len ++ , iterations ++ , out_d, out_o, out_len) { ++ h$logWrapper("h$cryptonite_fastpbkdf2_hmac_sha512"); ++ var pw_ptr = h$getTmpBufferWith(0, pw_d, pw_o, pw_len), ++ salt_ptr = h$getTmpBufferWith(1, salt_d, salt_o, salt_len), ++ out_ptr = h$getTmpBuffer(2, out_len); ++ _cryptonite_fastpbkdf2_hmac_sha512(pw_ptr, pw_len, salt_ptr, salt_len, iterations, out_ptr, out_len); ++ h$copyFromHeap(out_ptr, out_d, out_o, out_len); ++} ++ ++/* wallet stuff */ ++var h$secret_key_seed_size = 32; ++var h$chain_code_size = 32; ++var h$public_key_size = 32; ++var h$master_key_size = 96; ++var h$encrypted_key_size = 64; ++var h$full_key_size = h$encrypted_key_size + h$public_key_size + h$chain_code_size; ++ ++function h$wallet_encrypted_derive_public( pub_in_d, pub_in_o ++ , cc_in_d, cc_in_o ++ , index ++ , pub_out_d, pub_out_o ++ , cc_out_d, cc_out_o ++ , mode) { ++ h$logWrapper("h$wallet_encrypted_derive_public"); ++ var pub_in_ptr = h$getTmpBufferWith(0, pub_in_d, pub_in_o, h$public_key_size), ++ cc_in_ptr = h$getTmpBufferWith(1, cc_in_d, cc_in_o, h$chain_code_size), ++ pub_out_ptr = h$getTmpBuffer(2, h$public_key_size), ++ cc_out_ptr = h$getTmpBuffer(3, h$chain_code_size); ++ var r = _wallet_encrypted_derive_public(pub_in_ptr, cc_in_ptr, index, pub_out_ptr, cc_out_ptr, mode); ++ h$copyFromHeap(pub_out_ptr, pub_out_d, pub_out_o, h$public_key_size); ++ h$copyFromHeap(cc_out_ptr, cc_out_d, cc_out_o, h$chain_code_size); ++ return r; ++} ++ ++function h$wallet_encrypted_derive_private( in_d, in_o, ++ pass_d, pass_o, pass_len, ++ index, ++ out_d, out_o, ++ mode ++ ) { ++ h$logWrapper("h$wallet_encrypted_derive_private"); ++ // console.log(arguments); ++ var in_ptr = h$getTmpBufferWith(0, in_d, in_o, h$full_key_size), ++ pass_ptr = h$getTmpBufferWith(1, pass_d, pass_o, pass_len), ++ out_ptr = h$getTmpBuffer(2, h$full_key_size); ++ _wallet_encrypted_derive_private(in_ptr, pass_ptr, pass_len, index, out_ptr, mode); ++ h$copyFromHeap(out_ptr, out_d, out_o, h$full_key_size); ++} ++ ++function h$wallet_encrypted_sign( encrypted_key_d, encrypted_key_o ++ , pass_d, pass_o, pass_len ++ , data_d, data_o, data_len ++ , sig_d, sig_o) { ++ h$logWrapper("h$wallet_encrypted_sign"); ++ var ec_ptr = h$getTmpBufferWith(0, encrypted_key_d, encrypted_key_o, h$full_key_size), ++ pass_ptr = h$getTmpBufferWith(1, pass_d, pass_o, pass_len), ++ data_ptr = h$getTmpBufferWith(2, data_d, data_o, data_len), ++ sig_ptr = h$getTmpBuffer(3, h$ed25519_sig_size); ++ _wallet_encrypted_sign(ec_ptr, pass_ptr, pass_len, data_ptr, data_len, sig_ptr); ++ h$copyFromHeap(sig_ptr, sig_d, sig_o, h$ed25519_sig_size); ++} ++ ++function h$wallet_encrypted_from_secret( pass_d, pass_o, pass_len ++ , seed_d, seed_o ++ , cc_d, cc_o ++ , encrypted_key_d, encrypted_key_o ++ ) { ++ h$logWrapper("h$wallet_encrypted_from_secret"); ++ var pass_ptr = h$getTmpBufferWith(0, pass_d, pass_o, pass_len), ++ seed_ptr = h$getTmpBufferWith(1, seed_d, seed_o, h$secret_key_seed_size), ++ cc_ptr = h$getTmpBufferWith(2, cc_d, cc_o, h$chain_code_size), ++ ec_ptr = h$getTmpBufferWith(3, encrypted_key_d, encrypted_key_o, h$full_key_size); ++ var r = _wallet_encrypted_from_secret(pass_ptr, pass_len, seed_ptr, cc_ptr, ec_ptr); ++ h$copyFromHeap(ec_ptr, encrypted_key_d, encrypted_key_o, h$full_key_size); ++ return r; ++} ++ ++function h$wallet_encrypted_change_pass( in_d, in_o ++ , old_pass_d, old_pass_o, old_pass_len ++ , new_pass_d, new_pass_o, new_pass_len ++ , out_d, out_o) { ++ h$logWrapper("h$wallet_encrypted_change_pass"); ++ var in_ptr = h$getTmpBufferWith(0, in_d, in_o, h$full_key_size), ++ old_pass_ptr = h$getTmpBufferWith(1, old_pass_d, old_pass_o, old_pass_len), ++ new_pass_ptr = h$getTmpBufferWith(2, new_pass_d, new_pass_o, new_pass_len), ++ out_ptr = h$getTmpBuffer(3, h$full_key_size); ++ _wallet_encrypted_change_pass(in_ptr, old_pass_ptr, old_pass_len, new_pass_ptr, new_pass_len, out_ptr); ++ h$copyFromHeap(out_ptr, out_d, out_o, h$full_key_size); ++} ++ ++function h$wallet_encrypted_new_from_mkg( pass_d, pass_o, pass_len ++ , master_key_d, master_key_o ++ , encrypted_key_d, encrypted_key_o) { ++ h$logWrapper("h$wallet_encrypted_new_from_mkg"); ++ var pass_ptr = h$getTmpBufferWith(0, pass_d, pass_o, pass_len), ++ master_ptr = h$getTmpBufferWith(1, master_key_d, master_key_o, h$master_key_size), ++ encrypted_ptr = h$getTmpBuffer(2, h$full_key_size); ++ var r = _wallet_encrypted_new_from_mkg(pass_ptr, pass_len, master_ptr, encrypted_ptr); ++ h$copyFromHeap(encrypted_ptr, encrypted_key_d, encrypted_key_o, h$full_key_size); ++ return r; ++} ++ ++/* chacha */ ++var h$chacha_ctx_size = 132; ++var h$chacha_state_size = 64; ++ ++function h$cryptonite_chacha_generate(dst_d, dst_o, ctx_d, ctx_o, bytes) { ++ h$logWrapper("h$cryptonite_chacha_generate"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$chacha_ctx_size), ++ dst_ptr = h$getTmpBuffer(1, bytes); ++ _cryptonite_chacha_generate(dst_ptr, ctx_ptr, bytes); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$chacha_ctx_size); ++ h$copyFromHeap(dst_ptr, dst_d, dst_o, bytes); ++} ++ ++function h$cryptonite_chacha_combine(dst_d, dst_o, ctx_d, ctx_o, src_d, src_o, bytes) { ++ h$logWrapper("h$cryptonite_chacha_generate"); ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$chacha_ctx_size), ++ src_ptr = h$getTmpBufferWith(1, src_d, src_o, bytes), ++ dst_ptr = h$getTmpBuffer(2, bytes); ++ _cryptonite_chacha_combine(dst_ptr, ctx_ptr, src_ptr, bytes); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$chacha_ctx_size); ++ h$copyFromHeap(dst_ptr, dst_d, dst_o, bytes); ++} ++ ++function h$cryptonite_chacha_init( ctx_d, ctx_o, nb_rounds, keylen, key_d, key_o, ivlen, iv_d, iv_o) { ++ var key_ptr = h$getTmpBufferWith(0, key_d, key_o, keylen), ++ iv_ptr = h$getTmpBufferWith(1, iv_d, iv_o, ivlen), ++ ctx_ptr = h$getTmpBuffer(2, h$chacha_ctx_size); ++ _cryptonite_chacha_init(ctx_ptr, nb_rounds, keylen, key_ptr, ivlen, iv_ptr); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$chacha_ctx_size); ++} ++ ++function h$cryptonite_chacha_random( rounds, dst_d, dst_o, st_d, st_o, bytes) { ++ var dst_ptr = h$getTmpBufferWith(0, dst_d, dst_o, bytes); ++ st_ptr = h$getTmpBufferWith(1, st_d, st_o, h$chacha_state_size); ++ _cryptonite_chacha_random( rounds, dst_ptr, st_ptr, bytes); ++ // we might have modified the state. ++ h$copyFromHeap(st_ptr, st_d, st_o, h$chacha_state_size); ++ h$copyFromHeap(dst_ptr, dst_d, dst_o, bytes); ++} ++ ++function h$cryptonite_chacha_init_core( st_d, st_o, keylen, key_d, key_o, ivlen, iv_d, iv_o) { ++ var key_ptr = h$getTmpBufferWith(0, key_d, key_o, keylen), ++ iv_ptr = h$getTmpBufferWith(1, iv_d, iv_o, ivlen), ++ st_ptr = h$getTmpBuffer(2, h$chacha_state_size); ++ _cryptonite_chacha_init_core(st_ptr, keylen, key_ptr, ivlen, iv_ptr); ++ h$copyFromHeap(st_ptr, st_d, st_o, h$chacha_state_size); ++} ++ ++ ++ ++/* poly1305 */ ++var h$poly1305_ctx_size = 88; ++var h$poly1305_key_size = 32; ++var h$poly1305_mac_size = 16; ++ ++function h$cryptonite_poly1305_init(ctx_d, ctx_o, key_d, key_o) { ++ var ctx_ptr = h$getTmpBuffer(0, h$poly1305_ctx_size), ++ key_ptr = h$getTmpBufferWith(1, key_d, key_o, h$poly1305_key_size); ++ _cryptonite_poly1305_init(ctx_ptr, key_ptr); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$poly1305_ctx_size); ++} ++ ++function h$cryptonite_poly1305_update(ctx_d, ctx_o, data_d, data_o, length) { ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$poly1305_ctx_size), ++ data_ptr = h$getTmpBufferWith(1, data_d, data_o, length >>> 0); ++ _cryptonite_poly1305_update(ctx_ptr, data_ptr, length); ++ h$copyFromHeap(ctx_ptr, ctx_d, ctx_o, h$poly1305_ctx_size); ++} ++ ++function h$cryptonite_poly1305_finalize(mac8_d, mac8_o, ctx_d, ctx_o) { ++ var ctx_ptr = h$getTmpBufferWith(0, ctx_d, ctx_o, h$poly1305_ctx_size), ++ mac8_ptr = h$getTmpBuffer(1, h$poly1305_mac_size); ++ _cryptonite_poly1305_finalize(mac8_ptr, ctx_ptr); ++ h$copyFromHeap(mac8_ptr, mac8_d, mac8_o, h$poly1305_mac_size); ++} ++ ++function h$cryptonite_aes_cpu_init() { ++ h$ret1 = _cryptonite_aes_cpu_init(); ++ return { dv: new DataView(HEAPU8.buffer), u8: HEAPU8 }; ++} ++ ++// temporary fixes ++ ++// XXX fix this in thrunner.js probably ++if(typeof __dirname == 'undefined') { ++ var __dirname = '/'; ++} ++ ++// TODO: remove ++// TODO: stub, add real implementation ++function h$geteuid() { ++ return 1; ++} ++ ++// TODO: stub, add real implementation ++function h$sysconf() { ++ return 0; ++} ++ ++// TODO: stub, add real implementation ++function h$getpwuid_r(uid, pwd_d, pwd_o, buf_d, buf_o, buflen, result_d, result_o) { ++ var i, name = h$encodeUtf8("user"), max = Math.min(72, pwd_d.len); ++ if(!result_d.arr) result_d.arr = []; ++ result_d.arr[0] = [pwd_d, pwd_o]; ++ if(!pwd_d.arr) pwd_d.arr = []; ++ // we don't really know where the pointers to strings are supposed to go, ++ // so we just point to our dummy string everywhere ++ for(i = 0; i < max; i+=4) pwd_d.arr[i+pwd_o] = [name, 0]; ++ for(i = 0; i < (max>>2); i++) pwd_d.i3[i+(pwd_o>>2)] = 1; ++ return 0; ++} ++ ++// TODO: move to foundation ++function h$foundation_sysrandom_linux(buf_d, buf_o, size) { ++ cryptoObj.getRandomValues(typedArray); ++} +diff --git b/tests/Number.hs a/tests/Number.hs +index 85b5a3dc3..c5681e48e 100644 +--- b/tests/Number.hs ++++ a/tests/Number.hs +@@ -48,11 +48,11 @@ tests = testGroup "number" + bits = 5 + baseBits -- generating lower than 5 bits causes an error .. + prime = withTestDRG testDRG $ generatePrime bits + in bits == numBits prime +- , testProperty "generate-safe-prime" $ \testDRG (Int0_2901 baseBits') -> +- let baseBits = baseBits' `mod` 200 +- bits = 6 + baseBits +- prime = withTestDRG testDRG $ generateSafePrime bits +- in bits == numBits prime ++ -- , testProperty "generate-safe-prime" $ \testDRG (Int0_2901 baseBits') -> ++ -- let baseBits = baseBits' `mod` 200 ++ -- bits = 6 + baseBits ++ -- prime = withTestDRG testDRG $ generateSafePrime bits ++ -- in bits == numBits prime + , testProperty "as-power-of-2-and-odd" $ \n -> + let (e, a1) = asPowerOf2AndOdd n + in n == (2^e)*a1 diff --git a/patches/double-conversion-2.0.2.0.patch b/patches/double-conversion-2.0.2.0.patch new file mode 100644 index 0000000..7a478d8 --- /dev/null +++ b/patches/double-conversion-2.0.2.0.patch @@ -0,0 +1,221 @@ +diff --git b/Data/Double/Conversion/ByteString.hs a/Data/Double/Conversion/ByteString.hs +index 64373c19a..54f20d5ef 100644 +--- b/Data/Double/Conversion/ByteString.hs ++++ a/Data/Double/Conversion/ByteString.hs +@@ -1,20 +1,3 @@ +--- | +--- Module : Data.Double.Conversion.ByteString +--- Copyright : (c) 2011 MailRank, Inc. +--- +--- License : BSD-style +--- Maintainer : bos@serpentine.com +--- Stability : experimental +--- Portability : GHC +--- +--- Fast, efficient support for converting between double precision +--- floating point values and text. +--- +--- Although about 15 times faster than plain 'show', these functions +--- are /slower/ than their 'Text' counterparts, at roughly half the +--- speed. (This seems to be due to the cost of allocating +--- 'ByteString' values via @malloc@.) +- + module Data.Double.Conversion.ByteString + ( + toExponential +@@ -23,54 +6,17 @@ module Data.Double.Conversion.ByteString + , toShortest + ) where + +-import Control.Monad (when) +-import Foreign.ForeignPtr (withForeignPtr) +-import Data.Double.Conversion.FFI +-import Data.Word (Word8) +-import Data.ByteString.Internal (ByteString(..), mallocByteString) +-import Foreign.C.Types (CDouble, CInt) +-import Foreign.Ptr (Ptr) +-import System.IO.Unsafe (unsafePerformIO) ++import Data.ByteString.Internal (ByteString) + +--- | Compute a representation in exponential format with the requested +--- number of digits after the decimal point. The last emitted digit is +--- rounded. If -1 digits are requested, then the shortest exponential +--- representation is computed. + toExponential :: Int -> Double -> ByteString +-toExponential ndigits = convert "toExponential" len $ \val mba -> +- c_ToExponential val mba (fromIntegral ndigits) +- where len = c_ToExponentialLength +- {-# NOINLINE len #-} ++toExponential _ _ = error "toExponential not implemented" + +--- | Compute a decimal representation with a fixed number of digits +--- after the decimal point. The last emitted digit is rounded. + toFixed :: Int -> Double -> ByteString +-toFixed ndigits = convert "toFixed" len $ \val mba -> +- c_ToFixed val mba (fromIntegral ndigits) +- where len = c_ToFixedLength +- {-# NOINLINE len #-} ++toFixed _ _ = error "toFixed not implemented" + +--- | Compute the shortest string of digits that correctly represent +--- the input number. + toShortest :: Double -> ByteString +-toShortest = convert "toShortest" len c_ToShortest +- where len = c_ToShortestLength +- {-# NOINLINE len #-} ++toShortest _ = error "toShortest not implemented" + +--- | Compute @precision@ leading digits of the given value either in +--- exponential or decimal format. The last computed digit is rounded. + toPrecision :: Int -> Double -> ByteString +-toPrecision ndigits = convert "toPrecision" len $ \val mba -> +- c_ToPrecision val mba (fromIntegral ndigits) +- where len = c_ToPrecisionLength +- {-# NOINLINE len #-} ++toPrecision _ = error "toPrecision not implemented" + +-convert :: String -> CInt -> (CDouble -> Ptr Word8 -> IO CInt) +- -> Double -> ByteString +-convert func len act val = unsafePerformIO $ do +- fp <- mallocByteString (fromIntegral len) +- size <- withForeignPtr fp $ act (realToFrac val) +- when (size == -1) . +- fail $ "Data.Double.Conversion.ByteString." ++ func ++ +- ": conversion failed (invalid precision requested)" +- return $ PS fp 0 (fromIntegral size) +diff --git b/Data/Double/Conversion/Text.hs a/Data/Double/Conversion/Text.hs +index 2e897052f..bc57818b0 100644 +--- b/Data/Double/Conversion/Text.hs ++++ a/Data/Double/Conversion/Text.hs +@@ -1,20 +1,3 @@ +-{-# LANGUAGE CPP, MagicHash, Rank2Types #-} +- +--- | +--- Module : Data.Double.Conversion.Text +--- Copyright : (c) 2011 MailRank, Inc. +--- +--- License : BSD-style +--- Maintainer : bos@serpentine.com +--- Stability : experimental +--- Portability : GHC +--- +--- Fast, efficient support for converting between double precision +--- floating point values and text. +--- +--- These functions are about 30 times faster than the default 'show' +--- implementation for the 'Double' type. +- + module Data.Double.Conversion.Text + ( + toExponential +@@ -23,62 +6,17 @@ module Data.Double.Conversion.Text + , toShortest + ) where + +-import Control.Monad (when) +-#if MIN_VERSION_base(4,4,0) +-import Control.Monad.ST.Unsafe (unsafeIOToST) +-#else +-import Control.Monad.ST (unsafeIOToST) +-#endif +-import Control.Monad.ST (runST) +-import Data.Double.Conversion.FFI +-import Data.Text.Internal (Text(Text)) +-import Foreign.C.Types (CDouble, CInt) +-import GHC.Prim (MutableByteArray#) +-import qualified Data.Text.Array as A ++import Data.Text (Text) + +--- | Compute a representation in exponential format with the requested +--- number of digits after the decimal point. The last emitted digit is +--- rounded. If -1 digits are requested, then the shortest exponential +--- representation is computed. + toExponential :: Int -> Double -> Text +-toExponential ndigits = convert "toExponential" len $ \val mba -> +- c_Text_ToExponential val mba (fromIntegral ndigits) +- where len = c_ToExponentialLength +- {-# NOINLINE len #-} ++toExponential _ _ = error "toExponential not implemented" + +--- | Compute a decimal representation with a fixed number of digits +--- after the decimal point. The last emitted digit is rounded. + toFixed :: Int -> Double -> Text +-toFixed ndigits = convert "toFixed" len $ \val mba -> +- c_Text_ToFixed val mba (fromIntegral ndigits) +- where len = c_ToFixedLength +- {-# NOINLINE len #-} ++toFixed _ _ = error "toFixed not implemented" + +--- | Compute the shortest string of digits that correctly represent +--- the input number. + toShortest :: Double -> Text +-toShortest = convert "toShortest" len c_Text_ToShortest +- where len = c_ToShortestLength +- {-# NOINLINE len #-} ++toShortest _ = error "toShortest not implemented" + +--- | Compute @precision@ leading digits of the given value either in +--- exponential or decimal format. The last computed digit is rounded. + toPrecision :: Int -> Double -> Text +-toPrecision ndigits = convert "toPrecision" len $ \val mba -> +- c_Text_ToPrecision val mba (fromIntegral ndigits) +- where len = c_ToPrecisionLength +- {-# NOINLINE len #-} ++toPrecision _ = error "toPrecision not implemented" + +-convert :: String -> CInt +- -> (forall s. CDouble -> MutableByteArray# s -> IO CInt) +- -> Double -> Text +-convert func len act val = runST go +- where +- go = do +- buf <- A.new (fromIntegral len) +- size <- unsafeIOToST $ act (realToFrac val) (A.maBA buf) +- when (size == -1) . +- fail $ "Data.Double.Conversion.Text." ++ func ++ +- ": conversion failed (invalid precision requested)" +- frozen <- A.unsafeFreeze buf +- return $ Text frozen 0 (fromIntegral size) +diff --git b/double-conversion.cabal a/double-conversion.cabal +index 96114ee10..0fdeb480d 100644 +--- b/double-conversion.cabal ++++ a/double-conversion.cabal +@@ -60,28 +60,6 @@ flag developer + manual: True + + library +- c-sources: +- cbits/hs-double-conversion.cc +- double-conversion/src/bignum.cc +- double-conversion/src/bignum-dtoa.cc +- double-conversion/src/cached-powers.cc +- double-conversion/src/diy-fp.cc +- double-conversion/src/double-conversion.cc +- double-conversion/src/fast-dtoa.cc +- double-conversion/src/fixed-dtoa.cc +- double-conversion/src/strtod.cc +- +- if os(windows) +- if arch(x86_64) +- extra-libraries: stdc++-6 gcc_s_seh-1 +- else +- extra-libraries: stdc++-6 gcc_s_dw2-1 +- else +- if os(darwin) +- extra-libraries: c++ +- else +- extra-libraries: stdc++ +- + include-dirs: + double-conversion/src + include +@@ -90,9 +68,6 @@ library + Data.Double.Conversion.ByteString + Data.Double.Conversion.Text + +- other-modules: +- Data.Double.Conversion.FFI +- + build-depends: + base == 4.*, + bytestring, diff --git a/patches/foundation-0.0.26.1.patch b/patches/foundation-0.0.26.1.patch new file mode 100644 index 0000000..e82e1e3 --- /dev/null +++ b/patches/foundation-0.0.26.1.patch @@ -0,0 +1,104 @@ +diff --git b/foundation.cabal a/foundation.cabal +index 224c61308..ef25e37f8 100644 +--- b/foundation.cabal ++++ a/foundation.cabal +@@ -1,3 +1,4 @@ ++cabal-version: 2.0 + name: foundation + version: 0.0.26.1 + synopsis: Alternative prelude with batteries and no dependencies +@@ -28,7 +29,6 @@ category: foundation + build-type: Simple + homepage: https://github.com/haskell-foundation/foundation + bug-reports: https://github.com/haskell-foundation/foundation/issues +-cabal-version: 1.18 + extra-source-files: cbits/*.h + + source-repository head +@@ -190,13 +190,17 @@ library + if os(osx) + exposed-modules: Foundation.System.Bindings.Macos + ++ if os(ghcjs) ++ js-sources: jsbits/bindings.js ++ extra-bundled-libraries: EMCCfoundation EMCCfoundation.exported ++ + default-extensions: NoImplicitPrelude + RebindableSyntax + TypeFamilies + BangPatterns + DeriveDataTypeable + +- if impl(ghc < 8.0) ++ if impl(ghc < 8.0) + buildable: False + else + build-depends: base +diff --git b/jsbits/bindings.js a/jsbits/bindings.js +new file mode 100644 +index 000000000..fc51a85fe +--- /dev/null ++++ a/jsbits/bindings.js +@@ -0,0 +1,61 @@ ++ ++// EMCC:EXPORTED_FUNCTIONS _malloc _free ++// EMCC:EXPORTED_FUNCTIONS _foundation_rngV1_generate ++ ++function h$foundation_sysrandom_linux(buf_d, buf_o, size) { ++ return -19; // ENODEV; foundation returns the same for non-linux hosts. ++} ++ ++// c_rngv1_generate :: Ptr Word8 -- new key ++// -> Ptr Word8 -- destination ++// -> Ptr Word8 -- current key ++// -> CountOf Word8 -- number of bytes to generate ++// -> IO Word32 ++// ++// int foundation_rngV1_generate(uint8_t newkey[CHACHA_KEY_SIZE], uint8_t *dst, uint8_t key[CHACHA_KEY_SIZE], FsCountOf bytes) ++// ++// #define CHACHA_KEY_SIZE 3 ++ ++function h$copyToHeap(buf_d, buf_o, tgt, len) { ++ if(len === 0) return; ++ var u8 = buf_d.u8; ++ for(var i=0;i. ++# along with this program; if not, see . + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a +@@ -27,19 +27,19 @@ timestamp='2017-03-05' + # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. + # + # You can get the latest version of this script from: +-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess ++# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess + # + # Please send patches to . + + +-me=`echo "$0" | sed -e 's,.*/,,'` ++me=$(echo "$0" | sed -e 's,.*/,,') + + usage="\ + Usage: $0 [OPTION] + + Output the configuration name of the system \`$me' is run on. + +-Operation modes: ++Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit +@@ -50,7 +50,7 @@ version="\ + GNU config.guess ($timestamp) + + Originally written by Per Bothner. +-Copyright 1992-2017 Free Software Foundation, Inc. ++Copyright 1992-2021 Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +@@ -84,8 +84,6 @@ if test $# != 0; then + exit 1 + fi + +-trap 'exit 1' 1 2 15 +- + # CC_FOR_BUILD -- compiler used by this script. Note that the use of a + # compiler to aid in system detection is discouraged as it requires + # temporary files to be created and, as you can see below, it is a +@@ -96,66 +94,89 @@ trap 'exit 1' 1 2 15 + + # Portable tmp directory creation inspired by the Autoconf team. + +-set_cc_for_build=' +-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +-: ${TMPDIR=/tmp} ; +- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || +- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || +- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || +- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +-dummy=$tmp/dummy ; +-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +-case $CC_FOR_BUILD,$HOST_CC,$CC in +- ,,) echo "int x;" > $dummy.c ; +- for c in cc gcc c89 c99 ; do +- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then +- CC_FOR_BUILD="$c"; break ; +- fi ; +- done ; +- if test x"$CC_FOR_BUILD" = x ; then +- CC_FOR_BUILD=no_compiler_found ; +- fi +- ;; +- ,,*) CC_FOR_BUILD=$CC ;; +- ,*,*) CC_FOR_BUILD=$HOST_CC ;; +-esac ; set_cc_for_build= ;' ++tmp= ++# shellcheck disable=SC2172 ++trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 ++ ++set_cc_for_build() { ++ # prevent multiple calls if $tmp is already set ++ test "$tmp" && return 0 ++ : "${TMPDIR=/tmp}" ++ # shellcheck disable=SC2039 ++ { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } || ++ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || ++ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || ++ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ++ dummy=$tmp/dummy ++ case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ++ ,,) echo "int x;" > "$dummy.c" ++ for driver in cc gcc c89 c99 ; do ++ if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then ++ CC_FOR_BUILD="$driver" ++ break ++ fi ++ done ++ if test x"$CC_FOR_BUILD" = x ; then ++ CC_FOR_BUILD=no_compiler_found ++ fi ++ ;; ++ ,,*) CC_FOR_BUILD=$CC ;; ++ ,*,*) CC_FOR_BUILD=$HOST_CC ;; ++ esac ++} + + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. + # (ghazi@noc.rutgers.edu 1994-08-24) +-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then ++if test -f /.attbin/uname ; then + PATH=$PATH:/.attbin ; export PATH + fi + +-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown ++UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown ++UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown ++UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown ++UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown + +-case "${UNAME_SYSTEM}" in ++case $UNAME_SYSTEM in + Linux|GNU|GNU/*) +- # If the system lacks a compiler, then just pick glibc. +- # We could probably try harder. +- LIBC=gnu ++ LIBC=unknown + +- eval $set_cc_for_build +- cat <<-EOF > $dummy.c ++ set_cc_for_build ++ cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc +- #else ++ #elif defined(__GLIBC__) + LIBC=gnu ++ #else ++ #include ++ /* First heuristic to detect musl libc. */ ++ #ifdef __DEFINED_va_list ++ LIBC=musl ++ #endif + #endif + EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ++ eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')" ++ ++ # Second heuristic to detect musl libc. ++ if [ "$LIBC" = unknown ] && ++ command -v ldd >/dev/null && ++ ldd --version 2>&1 | grep -q ^musl; then ++ LIBC=musl ++ fi ++ ++ # If the system lacks a compiler, then just pick glibc. ++ # We could probably try harder. ++ if [ "$LIBC" = unknown ]; then ++ LIBC=gnu ++ fi + ;; + esac + + # Note: order is significant - the case branches are not exclusive. + +-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ++case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, +@@ -167,32 +188,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". +- sysctl="sysctl -n hw.machine_arch" +- UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ +- /sbin/$sysctl 2>/dev/null || \ +- /usr/sbin/$sysctl 2>/dev/null || \ +- echo unknown)` +- case "${UNAME_MACHINE_ARCH}" in ++ UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ ++ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ ++ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ ++ echo unknown)) ++ case $UNAME_MACHINE_ARCH in ++ aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) +- arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` +- endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` +- machine=${arch}${endian}-unknown ++ arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,') ++ endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p') ++ machine="${arch}${endian}"-unknown + ;; +- *) machine=${UNAME_MACHINE_ARCH}-unknown ;; ++ *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. +- case "${UNAME_MACHINE_ARCH}" in ++ case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) +- eval $set_cc_for_build ++ set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then +@@ -208,10 +229,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + ;; + esac + # Determine ABI tags. +- case "${UNAME_MACHINE_ARCH}" in ++ case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' +- abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` ++ abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr") + ;; + esac + # The OS release +@@ -219,61 +240,82 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. +- case "${UNAME_VERSION}" in ++ case $UNAME_VERSION in + Debian*) + release='-gnu' + ;; + *) +- release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ++ release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2) + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. +- echo "${machine}-${os}${release}${abi}" ++ echo "$machine-${os}${release}${abi-}" + exit ;; + *:Bitrig:*:*) +- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` +- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} ++ UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//') ++ echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" + exit ;; + *:OpenBSD:*:*) +- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` +- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} ++ UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//') ++ echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" ++ exit ;; ++ *:SecBSD:*:*) ++ UNAME_MACHINE_ARCH=$(arch | sed 's/SecBSD.//') ++ echo "$UNAME_MACHINE_ARCH"-unknown-secbsd"$UNAME_RELEASE" + exit ;; + *:LibertyBSD:*:*) +- UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` +- echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} ++ UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//') ++ echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" ++ exit ;; ++ *:MidnightBSD:*:*) ++ echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + exit ;; + *:ekkoBSD:*:*) +- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} ++ echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" + exit ;; + *:SolidBSD:*:*) +- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} ++ echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" ++ exit ;; ++ *:OS108:*:*) ++ echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" + exit ;; + macppc:MirBSD:*:*) +- echo powerpc-unknown-mirbsd${UNAME_RELEASE} ++ echo powerpc-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:MirBSD:*:*) +- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} ++ echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:Sortix:*:*) +- echo ${UNAME_MACHINE}-unknown-sortix ++ echo "$UNAME_MACHINE"-unknown-sortix ++ exit ;; ++ *:Twizzler:*:*) ++ echo "$UNAME_MACHINE"-unknown-twizzler ++ exit ;; ++ *:Redox:*:*) ++ echo "$UNAME_MACHINE"-unknown-redox ++ exit ;; ++ mips:OSF1:*.*) ++ echo mips-dec-osf1 + exit ;; + alpha:OSF1:*:*) ++ # Reset EXIT trap before exiting to avoid spurious non-zero exit code. ++ trap '' 0 + case $UNAME_RELEASE in + *4.0) +- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ++ UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}') + ;; + *5.*) +- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ++ UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}') + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. +- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` +- case "$ALPHA_CPU_TYPE" in ++ ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1) ++ case $ALPHA_CPU_TYPE in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") +@@ -310,28 +352,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. +- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` +- # Reset EXIT trap before exiting to avoid spurious non-zero exit code. +- exitcode=$? +- trap '' 0 +- exit $exitcode ;; +- Alpha\ *:Windows_NT*:*) +- # How do we know it's Interix rather than the generic POSIX subsystem? +- # Should we change UNAME_MACHINE based on the output of uname instead +- # of the specific Alpha model? +- echo alpha-pc-interix +- exit ;; +- 21064:Windows_NT:50:3) +- echo alpha-dec-winnt3.5 ++ echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)" + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) +- echo ${UNAME_MACHINE}-unknown-amigaos ++ echo "$UNAME_MACHINE"-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) +- echo ${UNAME_MACHINE}-unknown-morphos ++ echo "$UNAME_MACHINE"-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition +@@ -343,7 +373,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) +- echo arm-acorn-riscix${UNAME_RELEASE} ++ echo arm-acorn-riscix"$UNAME_RELEASE" + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos +@@ -353,7 +383,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. +- if test "`(/bin/universe) 2>/dev/null`" = att ; then ++ if test "$( (/bin/universe) 2>/dev/null)" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd +@@ -366,28 +396,28 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) +- case `/usr/bin/uname -p` in ++ case $(/usr/bin/uname -p) in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) +- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" + exit ;; + sun4H:SunOS:5.*:*) +- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) +- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) +- echo i386-pc-auroraux${UNAME_RELEASE} ++ echo i386-pc-auroraux"$UNAME_RELEASE" + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) +- eval $set_cc_for_build ++ set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. +- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then ++ if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null +@@ -395,40 +425,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + SUN_ARCH=x86_64 + fi + fi +- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. +- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + sun4*:SunOS:*:*) +- case "`/usr/bin/arch -k`" in ++ case $(/usr/bin/arch -k) in + Series*|S4*) +- UNAME_RELEASE=`uname -v` ++ UNAME_RELEASE=$(uname -v) + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. +- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` ++ echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')" + exit ;; + sun3*:SunOS:*:*) +- echo m68k-sun-sunos${UNAME_RELEASE} ++ echo m68k-sun-sunos"$UNAME_RELEASE" + exit ;; + sun*:*:4.2BSD:*) +- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` +- test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 +- case "`/bin/arch`" in ++ UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null) ++ test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 ++ case $(/bin/arch) in + sun3) +- echo m68k-sun-sunos${UNAME_RELEASE} ++ echo m68k-sun-sunos"$UNAME_RELEASE" + ;; + sun4) +- echo sparc-sun-sunos${UNAME_RELEASE} ++ echo sparc-sun-sunos"$UNAME_RELEASE" + ;; + esac + exit ;; + aushp:SunOS:*:*) +- echo sparc-auspex-sunos${UNAME_RELEASE} ++ echo sparc-auspex-sunos"$UNAME_RELEASE" + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not +@@ -439,44 +469,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} ++ echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} ++ echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) +- echo m68k-atari-mint${UNAME_RELEASE} ++ echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) +- echo m68k-milan-mint${UNAME_RELEASE} ++ echo m68k-milan-mint"$UNAME_RELEASE" + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) +- echo m68k-hades-mint${UNAME_RELEASE} ++ echo m68k-hades-mint"$UNAME_RELEASE" + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) +- echo m68k-unknown-mint${UNAME_RELEASE} ++ echo m68k-unknown-mint"$UNAME_RELEASE" + exit ;; + m68k:machten:*:*) +- echo m68k-apple-machten${UNAME_RELEASE} ++ echo m68k-apple-machten"$UNAME_RELEASE" + exit ;; + powerpc:machten:*:*) +- echo powerpc-apple-machten${UNAME_RELEASE} ++ echo powerpc-apple-machten"$UNAME_RELEASE" + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) +- echo mips-dec-ultrix${UNAME_RELEASE} ++ echo mips-dec-ultrix"$UNAME_RELEASE" + exit ;; + VAX*:ULTRIX*:*:*) +- echo vax-dec-ultrix${UNAME_RELEASE} ++ echo vax-dec-ultrix"$UNAME_RELEASE" + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) +- echo clipper-intergraph-clix${UNAME_RELEASE} ++ echo clipper-intergraph-clix"$UNAME_RELEASE" + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c ++ set_cc_for_build ++ sed 's/^ //' << EOF > "$dummy.c" + #ifdef __cplusplus + #include /* for printf() prototype */ + int main (int argc, char *argv[]) { +@@ -485,23 +515,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + #endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) +- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); ++ printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) +- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); ++ printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) +- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); ++ printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c && +- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && +- SYSTEM_NAME=`$dummy $dummyarg` && ++ $CC_FOR_BUILD -o "$dummy" "$dummy.c" && ++ dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') && ++ SYSTEM_NAME=$("$dummy" "$dummyarg") && + { echo "$SYSTEM_NAME"; exit; } +- echo mips-mips-riscos${UNAME_RELEASE} ++ echo mips-mips-riscos"$UNAME_RELEASE" + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax +@@ -526,18 +556,18 @@ EOF + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures +- UNAME_PROCESSOR=`/usr/bin/uname -p` +- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] ++ UNAME_PROCESSOR=$(/usr/bin/uname -p) ++ if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then +- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ +- [ ${TARGET_BINARY_INTERFACE}x = x ] ++ if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ ++ test "$TARGET_BINARY_INTERFACE"x = x + then +- echo m88k-dg-dgux${UNAME_RELEASE} ++ echo m88k-dg-dgux"$UNAME_RELEASE" + else +- echo m88k-dg-dguxbcs${UNAME_RELEASE} ++ echo m88k-dg-dguxbcs"$UNAME_RELEASE" + fi + else +- echo i586-dg-dgux${UNAME_RELEASE} ++ echo i586-dg-dgux"$UNAME_RELEASE" + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) +@@ -554,26 +584,26 @@ EOF + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) +- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` ++ echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')" + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id +- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' ++ exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) +- if [ -x /usr/bin/oslevel ] ; then +- IBM_REV=`/usr/bin/oslevel` ++ if test -x /usr/bin/oslevel ; then ++ IBM_REV=$(/usr/bin/oslevel) + else +- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} ++ IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi +- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} ++ echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c ++ set_cc_for_build ++ sed 's/^ //' << EOF > "$dummy.c" + #include + + main() +@@ -584,7 +614,7 @@ EOF + exit(0); + } + EOF +- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` ++ if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") + then + echo "$SYSTEM_NAME" + else +@@ -597,28 +627,28 @@ EOF + fi + exit ;; + *:AIX:*:[4567]) +- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` +- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then ++ IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }') ++ if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi +- if [ -x /usr/bin/lslpp ] ; then +- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | +- awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` ++ if test -x /usr/bin/lslpp ; then ++ IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc | ++ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/) + else +- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} ++ IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi +- echo ${IBM_ARCH}-ibm-aix${IBM_REV} ++ echo "$IBM_ARCH"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; +- ibmrt:4.4BSD:*|romp-ibm:BSD:*) ++ ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and +- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to ++ echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx +@@ -633,28 +663,28 @@ EOF + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) +- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` +- case "${UNAME_MACHINE}" in +- 9000/31? ) HP_ARCH=m68000 ;; +- 9000/[34]?? ) HP_ARCH=m68k ;; ++ HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') ++ case $UNAME_MACHINE in ++ 9000/31?) HP_ARCH=m68000 ;; ++ 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) +- if [ -x /usr/bin/getconf ]; then +- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` +- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` +- case "${sc_cpu_version}" in ++ if test -x /usr/bin/getconf; then ++ sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null) ++ sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null) ++ case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 +- case "${sc_kernel_bits}" in ++ case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi +- if [ "${HP_ARCH}" = "" ]; then +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c ++ if test "$HP_ARCH" = ""; then ++ set_cc_for_build ++ sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include +@@ -687,13 +717,13 @@ EOF + exit (0); + } + EOF +- (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` ++ (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy") + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac +- if [ ${HP_ARCH} = hppa2.0w ] ++ if test "$HP_ARCH" = hppa2.0w + then +- eval $set_cc_for_build ++ set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler +@@ -712,15 +742,15 @@ EOF + HP_ARCH=hppa64 + fi + fi +- echo ${HP_ARCH}-hp-hpux${HPUX_REV} ++ echo "$HP_ARCH"-hp-hpux"$HPUX_REV" + exit ;; + ia64:HP-UX:*:*) +- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` +- echo ia64-hp-hpux${HPUX_REV} ++ HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') ++ echo ia64-hp-hpux"$HPUX_REV" + exit ;; + 3050*:HI-UX:*:*) +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c ++ set_cc_for_build ++ sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () +@@ -745,11 +775,11 @@ EOF + exit (0); + } + EOF +- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && ++ $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; +- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) ++ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) +@@ -758,17 +788,17 @@ EOF + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; +- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) ++ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) +- if [ -x /usr/sbin/sysversion ] ; then +- echo ${UNAME_MACHINE}-unknown-osf1mk ++ if test -x /usr/sbin/sysversion ; then ++ echo "$UNAME_MACHINE"-unknown-osf1mk + else +- echo ${UNAME_MACHINE}-unknown-osf1 ++ echo "$UNAME_MACHINE"-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) +@@ -793,131 +823,123 @@ EOF + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) +- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' ++ echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) +- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ ++ echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) +- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' ++ echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) +- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' ++ echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) +- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' ++ echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) +- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' ++ echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) +- FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` +- FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` ++ FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz) ++ FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') ++ FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/') + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) +- FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` +- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` ++ FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') ++ FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/') + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) +- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} ++ echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" + exit ;; + sparc*:BSD/OS:*:*) +- echo sparc-unknown-bsdi${UNAME_RELEASE} ++ echo sparc-unknown-bsdi"$UNAME_RELEASE" + exit ;; + *:BSD/OS:*:*) +- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} ++ echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" ++ exit ;; ++ arm:FreeBSD:*:*) ++ UNAME_PROCESSOR=$(uname -p) ++ set_cc_for_build ++ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ ++ | grep -q __ARM_PCS_VFP ++ then ++ echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi ++ else ++ echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf ++ fi + exit ;; + *:FreeBSD:*:*) +- UNAME_PROCESSOR=`/usr/bin/uname -p` +- case ${UNAME_PROCESSOR} in ++ UNAME_PROCESSOR=$(/usr/bin/uname -p) ++ case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac +- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ++ echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" + exit ;; + i*:CYGWIN*:*) +- echo ${UNAME_MACHINE}-pc-cygwin ++ echo "$UNAME_MACHINE"-pc-cygwin + exit ;; + *:MINGW64*:*) +- echo ${UNAME_MACHINE}-pc-mingw64 ++ echo "$UNAME_MACHINE"-pc-mingw64 + exit ;; + *:MINGW*:*) +- echo ${UNAME_MACHINE}-pc-mingw32 ++ echo "$UNAME_MACHINE"-pc-mingw32 + exit ;; + *:MSYS*:*) +- echo ${UNAME_MACHINE}-pc-msys +- exit ;; +- i*:windows32*:*) +- # uname -m includes "-pc" on this system. +- echo ${UNAME_MACHINE}-mingw32 ++ echo "$UNAME_MACHINE"-pc-msys + exit ;; + i*:PW*:*) +- echo ${UNAME_MACHINE}-pc-pw32 ++ echo "$UNAME_MACHINE"-pc-pw32 + exit ;; + *:Interix*:*) +- case ${UNAME_MACHINE} in ++ case $UNAME_MACHINE in + x86) +- echo i586-pc-interix${UNAME_RELEASE} ++ echo i586-pc-interix"$UNAME_RELEASE" + exit ;; + authenticamd | genuineintel | EM64T) +- echo x86_64-unknown-interix${UNAME_RELEASE} ++ echo x86_64-unknown-interix"$UNAME_RELEASE" + exit ;; + IA64) +- echo ia64-unknown-interix${UNAME_RELEASE} ++ echo ia64-unknown-interix"$UNAME_RELEASE" + exit ;; + esac ;; +- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) +- echo i${UNAME_MACHINE}-pc-mks +- exit ;; +- 8664:Windows_NT:*) +- echo x86_64-pc-mks +- exit ;; +- i*:Windows_NT*:* | Pentium*:Windows_NT*:*) +- # How do we know it's Interix rather than the generic POSIX subsystem? +- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we +- # UNAME_MACHINE based on the output of uname instead of i386? +- echo i586-pc-interix +- exit ;; + i*:UWIN*:*) +- echo ${UNAME_MACHINE}-pc-uwin ++ echo "$UNAME_MACHINE"-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) +- echo x86_64-unknown-cygwin +- exit ;; +- p*:CYGWIN*:*) +- echo powerpcle-unknown-cygwin ++ echo x86_64-pc-cygwin + exit ;; + prep*:SunOS:5.*:*) +- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` ++ echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + *:GNU:*:*) + # the GNU system +- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` ++ echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')" + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland +- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} ++ echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC" + exit ;; +- i*86:Minix:*:*) +- echo ${UNAME_MACHINE}-pc-minix ++ *:Minix:*:*) ++ echo "$UNAME_MACHINE"-unknown-minix + exit ;; + aarch64:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + alpha:Linux:*:*) +- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; +@@ -928,140 +950,181 @@ EOF + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; +- arc:Linux:*:* | arceb:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ arc:Linux:*:* | arceb:Linux:*:* | arc64:Linux:*:*) ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arm*:Linux:*:*) +- eval $set_cc_for_build ++ set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + else +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + cris:Linux:*:*) +- echo ${UNAME_MACHINE}-axis-linux-${LIBC} ++ echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + crisv32:Linux:*:*) +- echo ${UNAME_MACHINE}-axis-linux-${LIBC} ++ echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + e2k:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + frv:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + hexagon:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:Linux:*:*) +- echo ${UNAME_MACHINE}-pc-linux-${LIBC} ++ echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + exit ;; + ia64:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + k1om:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" ++ exit ;; ++ loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m32r*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m68*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) +- eval $set_cc_for_build +- sed 's/^ //' << EOF >$dummy.c ++ set_cc_for_build ++ IS_GLIBC=0 ++ test x"${LIBC}" = xgnu && IS_GLIBC=1 ++ sed 's/^ //' << EOF > "$dummy.c" + #undef CPU +- #undef ${UNAME_MACHINE} +- #undef ${UNAME_MACHINE}el ++ #undef mips ++ #undef mipsel ++ #undef mips64 ++ #undef mips64el ++ #if ${IS_GLIBC} && defined(_ABI64) ++ LIBCABI=gnuabi64 ++ #else ++ #if ${IS_GLIBC} && defined(_ABIN32) ++ LIBCABI=gnuabin32 ++ #else ++ LIBCABI=${LIBC} ++ #endif ++ #endif ++ ++ #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 ++ CPU=mipsisa64r6 ++ #else ++ #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 ++ CPU=mipsisa32r6 ++ #else ++ #if defined(__mips64) ++ CPU=mips64 ++ #else ++ CPU=mips ++ #endif ++ #endif ++ #endif ++ + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +- CPU=${UNAME_MACHINE}el ++ MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) +- CPU=${UNAME_MACHINE} ++ MIPS_ENDIAN= + #else +- CPU= ++ MIPS_ENDIAN= + #endif + #endif + EOF +- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` +- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ++ eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')" ++ test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + openrisc*:Linux:*:*) +- echo or1k-unknown-linux-${LIBC} ++ echo or1k-unknown-linux-"$LIBC" + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + padre:Linux:*:*) +- echo sparc-unknown-linux-${LIBC} ++ echo sparc-unknown-linux-"$LIBC" + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) +- echo hppa64-unknown-linux-${LIBC} ++ echo hppa64-unknown-linux-"$LIBC" + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level +- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in +- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; +- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; +- *) echo hppa-unknown-linux-${LIBC} ;; ++ case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in ++ PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; ++ PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; ++ *) echo hppa-unknown-linux-"$LIBC" ;; + esac + exit ;; + ppc64:Linux:*:*) +- echo powerpc64-unknown-linux-${LIBC} ++ echo powerpc64-unknown-linux-"$LIBC" + exit ;; + ppc:Linux:*:*) +- echo powerpc-unknown-linux-${LIBC} ++ echo powerpc-unknown-linux-"$LIBC" + exit ;; + ppc64le:Linux:*:*) +- echo powerpc64le-unknown-linux-${LIBC} ++ echo powerpc64le-unknown-linux-"$LIBC" + exit ;; + ppcle:Linux:*:*) +- echo powerpcle-unknown-linux-${LIBC} ++ echo powerpcle-unknown-linux-"$LIBC" + exit ;; +- riscv32:Linux:*:* | riscv64:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) +- echo ${UNAME_MACHINE}-ibm-linux-${LIBC} ++ echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + exit ;; + sh64*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sh*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + tile*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + vax:Linux:*:*) +- echo ${UNAME_MACHINE}-dec-linux-${LIBC} ++ echo "$UNAME_MACHINE"-dec-linux-"$LIBC" + exit ;; + x86_64:Linux:*:*) +- echo ${UNAME_MACHINE}-pc-linux-${LIBC} ++ set_cc_for_build ++ LIBCABI=$LIBC ++ if test "$CC_FOR_BUILD" != no_compiler_found; then ++ if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ ++ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_X32 >/dev/null ++ then ++ LIBCABI="$LIBC"x32 ++ fi ++ fi ++ echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" + exit ;; + xtensa*:Linux:*:*) +- echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. +@@ -1075,51 +1138,51 @@ EOF + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. +- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} ++ echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. +- echo ${UNAME_MACHINE}-pc-os2-emx ++ echo "$UNAME_MACHINE"-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) +- echo ${UNAME_MACHINE}-unknown-stop ++ echo "$UNAME_MACHINE"-unknown-stop + exit ;; + i*86:atheos:*:*) +- echo ${UNAME_MACHINE}-unknown-atheos ++ echo "$UNAME_MACHINE"-unknown-atheos + exit ;; + i*86:syllable:*:*) +- echo ${UNAME_MACHINE}-pc-syllable ++ echo "$UNAME_MACHINE"-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) +- echo i386-unknown-lynxos${UNAME_RELEASE} ++ echo i386-unknown-lynxos"$UNAME_RELEASE" + exit ;; + i*86:*DOS:*:*) +- echo ${UNAME_MACHINE}-pc-msdosdjgpp ++ echo "$UNAME_MACHINE"-pc-msdosdjgpp + exit ;; +- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) +- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` ++ i*86:*:4.*:*) ++ UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//') + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then +- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} ++ echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + else +- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} ++ echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. +- case `/bin/uname -X | grep "^Machine"` in ++ case $(/bin/uname -X | grep "^Machine") in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac +- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ++ echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then +- UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then +- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` ++ UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //')) + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 +@@ -1127,9 +1190,9 @@ EOF + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 +- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL ++ echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + else +- echo ${UNAME_MACHINE}-pc-sysv32 ++ echo "$UNAME_MACHINE"-pc-sysv32 + fi + exit ;; + pc:*:*:*) +@@ -1149,9 +1212,9 @@ EOF + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then +- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 ++ echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. +- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 ++ echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) +@@ -1169,41 +1232,41 @@ EOF + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ +- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` ++ && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && { echo i486-ncr-sysv4.3${OS_REL}; exit; } ++ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ +- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; ++ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ +- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` ++ && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ +- && { echo i486-ncr-sysv4.3${OS_REL}; exit; } ++ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ +- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ++ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ +- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; ++ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) +- echo m68k-unknown-lynxos${UNAME_RELEASE} ++ echo m68k-unknown-lynxos"$UNAME_RELEASE" + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) +- echo sparc-unknown-lynxos${UNAME_RELEASE} ++ echo sparc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + rs6000:LynxOS:2.*:*) +- echo rs6000-unknown-lynxos${UNAME_RELEASE} ++ echo rs6000-unknown-lynxos"$UNAME_RELEASE" + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) +- echo powerpc-unknown-lynxos${UNAME_RELEASE} ++ echo powerpc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + SM[BE]S:UNIX_SV:*:*) +- echo mips-dde-sysv${UNAME_RELEASE} ++ echo mips-dde-sysv"$UNAME_RELEASE" + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 +@@ -1213,8 +1276,8 @@ EOF + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then +- UNAME_MACHINE=`(uname -p) 2>/dev/null` +- echo ${UNAME_MACHINE}-sni-sysv4 ++ UNAME_MACHINE=$( (uname -p) 2>/dev/null) ++ echo "$UNAME_MACHINE"-sni-sysv4 + else + echo ns32k-sni-sysv + fi +@@ -1234,23 +1297,23 @@ EOF + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. +- echo ${UNAME_MACHINE}-stratus-vos ++ echo "$UNAME_MACHINE"-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) +- echo m68k-apple-aux${UNAME_RELEASE} ++ echo m68k-apple-aux"$UNAME_RELEASE" + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) +- if [ -d /usr/nec ]; then +- echo mips-nec-sysv${UNAME_RELEASE} ++ if test -d /usr/nec; then ++ echo mips-nec-sysv"$UNAME_RELEASE" + else +- echo mips-unknown-sysv${UNAME_RELEASE} ++ echo mips-unknown-sysv"$UNAME_RELEASE" + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. +@@ -1269,83 +1332,97 @@ EOF + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) +- echo sx4-nec-superux${UNAME_RELEASE} ++ echo sx4-nec-superux"$UNAME_RELEASE" + exit ;; + SX-5:SUPER-UX:*:*) +- echo sx5-nec-superux${UNAME_RELEASE} ++ echo sx5-nec-superux"$UNAME_RELEASE" + exit ;; + SX-6:SUPER-UX:*:*) +- echo sx6-nec-superux${UNAME_RELEASE} ++ echo sx6-nec-superux"$UNAME_RELEASE" + exit ;; + SX-7:SUPER-UX:*:*) +- echo sx7-nec-superux${UNAME_RELEASE} ++ echo sx7-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8:SUPER-UX:*:*) +- echo sx8-nec-superux${UNAME_RELEASE} ++ echo sx8-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8R:SUPER-UX:*:*) +- echo sx8r-nec-superux${UNAME_RELEASE} ++ echo sx8r-nec-superux"$UNAME_RELEASE" + exit ;; + SX-ACE:SUPER-UX:*:*) +- echo sxace-nec-superux${UNAME_RELEASE} ++ echo sxace-nec-superux"$UNAME_RELEASE" + exit ;; + Power*:Rhapsody:*:*) +- echo powerpc-apple-rhapsody${UNAME_RELEASE} ++ echo powerpc-apple-rhapsody"$UNAME_RELEASE" + exit ;; + *:Rhapsody:*:*) +- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} ++ echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" ++ exit ;; ++ arm64:Darwin:*:*) ++ echo aarch64-apple-darwin"$UNAME_RELEASE" + exit ;; + *:Darwin:*:*) +- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown +- eval $set_cc_for_build +- if test "$UNAME_PROCESSOR" = unknown ; then +- UNAME_PROCESSOR=powerpc ++ UNAME_PROCESSOR=$(uname -p) ++ case $UNAME_PROCESSOR in ++ unknown) UNAME_PROCESSOR=powerpc ;; ++ esac ++ if command -v xcode-select > /dev/null 2> /dev/null && \ ++ ! xcode-select --print-path > /dev/null 2> /dev/null ; then ++ # Avoid executing cc if there is no toolchain installed as ++ # cc will be a stub that puts up a graphical alert ++ # prompting the user to install developer tools. ++ CC_FOR_BUILD=no_compiler_found ++ else ++ set_cc_for_build + fi +- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then +- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then +- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ +- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ +- grep IS_64BIT_ARCH >/dev/null +- then +- case $UNAME_PROCESSOR in +- i386) UNAME_PROCESSOR=x86_64 ;; +- powerpc) UNAME_PROCESSOR=powerpc64 ;; +- esac +- fi ++ if test "$CC_FOR_BUILD" != no_compiler_found; then ++ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ ++ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_64BIT_ARCH >/dev/null ++ then ++ case $UNAME_PROCESSOR in ++ i386) UNAME_PROCESSOR=x86_64 ;; ++ powerpc) UNAME_PROCESSOR=powerpc64 ;; ++ esac ++ fi ++ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc ++ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ ++ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ ++ grep IS_PPC >/dev/null ++ then ++ UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then +- # Avoid executing cc on OS X 10.9, as it ships with a stub +- # that puts up a graphical alert prompting to install +- # developer tools. Any system running Mac OS X 10.7 or +- # later (Darwin 11 and later) is required to have a 64-bit +- # processor. This is not true of the ARM version of Darwin +- # that Apple uses in portable devices. +- UNAME_PROCESSOR=x86_64 ++ # uname -m returns i386 or x86_64 ++ UNAME_PROCESSOR=$UNAME_MACHINE + fi +- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} ++ echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) +- UNAME_PROCESSOR=`uname -p` ++ UNAME_PROCESSOR=$(uname -p) + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi +- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} ++ echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; +- NEO-?:NONSTOP_KERNEL:*:*) +- echo neo-tandem-nsk${UNAME_RELEASE} ++ NEO-*:NONSTOP_KERNEL:*:*) ++ echo neo-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) +- echo nse-tandem-nsk${UNAME_RELEASE} ++ echo nse-tandem-nsk"$UNAME_RELEASE" + exit ;; +- NSR-?:NONSTOP_KERNEL:*:*) +- echo nsr-tandem-nsk${UNAME_RELEASE} ++ NSR-*:NONSTOP_KERNEL:*:*) ++ echo nsr-tandem-nsk"$UNAME_RELEASE" + exit ;; +- NSX-?:NONSTOP_KERNEL:*:*) +- echo nsx-tandem-nsk${UNAME_RELEASE} ++ NSV-*:NONSTOP_KERNEL:*:*) ++ echo nsv-tandem-nsk"$UNAME_RELEASE" ++ exit ;; ++ NSX-*:NONSTOP_KERNEL:*:*) ++ echo nsx-tandem-nsk"$UNAME_RELEASE" + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux +@@ -1354,18 +1431,18 @@ EOF + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) +- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} ++ echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. +- if test "$cputype" = 386; then ++ if test "${cputype-}" = 386; then + UNAME_MACHINE=i386 +- else ++ elif test "x${cputype-}" != x; then + UNAME_MACHINE="$cputype" + fi +- echo ${UNAME_MACHINE}-unknown-plan9 ++ echo "$UNAME_MACHINE"-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 +@@ -1386,14 +1463,14 @@ EOF + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) +- echo mips-sei-seiux${UNAME_RELEASE} ++ echo mips-sei-seiux"$UNAME_RELEASE" + exit ;; + *:DragonFly:*:*) +- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ++ echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" + exit ;; + *:*VMS:*:*) +- UNAME_MACHINE=`(uname -p) 2>/dev/null` +- case "${UNAME_MACHINE}" in ++ UNAME_MACHINE=$( (uname -p) 2>/dev/null) ++ case $UNAME_MACHINE in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; +@@ -1402,32 +1479,190 @@ EOF + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) +- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` ++ echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')" + exit ;; + i*86:rdos:*:*) +- echo ${UNAME_MACHINE}-pc-rdos ++ echo "$UNAME_MACHINE"-pc-rdos + exit ;; +- i*86:AROS:*:*) +- echo ${UNAME_MACHINE}-pc-aros ++ *:AROS:*:*) ++ echo "$UNAME_MACHINE"-unknown-aros + exit ;; + x86_64:VMkernel:*:*) +- echo ${UNAME_MACHINE}-unknown-esx ++ echo "$UNAME_MACHINE"-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; ++ *:Unleashed:*:*) ++ echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" ++ exit ;; ++esac ++ ++# No uname command or uname output not recognized. ++set_cc_for_build ++cat > "$dummy.c" < ++#include ++#endif ++#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) ++#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) ++#include ++#if defined(_SIZE_T_) || defined(SIGLOST) ++#include ++#endif ++#endif ++#endif ++main () ++{ ++#if defined (sony) ++#if defined (MIPSEB) ++ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, ++ I don't know.... */ ++ printf ("mips-sony-bsd\n"); exit (0); ++#else ++#include ++ printf ("m68k-sony-newsos%s\n", ++#ifdef NEWSOS4 ++ "4" ++#else ++ "" ++#endif ++ ); exit (0); ++#endif ++#endif ++ ++#if defined (NeXT) ++#if !defined (__ARCHITECTURE__) ++#define __ARCHITECTURE__ "m68k" ++#endif ++ int version; ++ version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null); ++ if (version < 4) ++ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); ++ else ++ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); ++ exit (0); ++#endif ++ ++#if defined (MULTIMAX) || defined (n16) ++#if defined (UMAXV) ++ printf ("ns32k-encore-sysv\n"); exit (0); ++#else ++#if defined (CMU) ++ printf ("ns32k-encore-mach\n"); exit (0); ++#else ++ printf ("ns32k-encore-bsd\n"); exit (0); ++#endif ++#endif ++#endif ++ ++#if defined (__386BSD__) ++ printf ("i386-pc-bsd\n"); exit (0); ++#endif ++ ++#if defined (sequent) ++#if defined (i386) ++ printf ("i386-sequent-dynix\n"); exit (0); ++#endif ++#if defined (ns32000) ++ printf ("ns32k-sequent-dynix\n"); exit (0); ++#endif ++#endif ++ ++#if defined (_SEQUENT_) ++ struct utsname un; ++ ++ uname(&un); ++ if (strncmp(un.version, "V2", 2) == 0) { ++ printf ("i386-sequent-ptx2\n"); exit (0); ++ } ++ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ ++ printf ("i386-sequent-ptx1\n"); exit (0); ++ } ++ printf ("i386-sequent-ptx\n"); exit (0); ++#endif ++ ++#if defined (vax) ++#if !defined (ultrix) ++#include ++#if defined (BSD) ++#if BSD == 43 ++ printf ("vax-dec-bsd4.3\n"); exit (0); ++#else ++#if BSD == 199006 ++ printf ("vax-dec-bsd4.3reno\n"); exit (0); ++#else ++ printf ("vax-dec-bsd\n"); exit (0); ++#endif ++#endif ++#else ++ printf ("vax-dec-bsd\n"); exit (0); ++#endif ++#else ++#if defined(_SIZE_T_) || defined(SIGLOST) ++ struct utsname un; ++ uname (&un); ++ printf ("vax-dec-ultrix%s\n", un.release); exit (0); ++#else ++ printf ("vax-dec-ultrix\n"); exit (0); ++#endif ++#endif ++#endif ++#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) ++#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) ++#if defined(_SIZE_T_) || defined(SIGLOST) ++ struct utsname *un; ++ uname (&un); ++ printf ("mips-dec-ultrix%s\n", un.release); exit (0); ++#else ++ printf ("mips-dec-ultrix\n"); exit (0); ++#endif ++#endif ++#endif ++ ++#if defined (alliant) && defined (i860) ++ printf ("i860-alliant-bsd\n"); exit (0); ++#endif ++ ++ exit (1); ++} ++EOF ++ ++$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) && ++ { echo "$SYSTEM_NAME"; exit; } ++ ++# Apollos put the system type in the environment. ++test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } ++ ++echo "$0: unable to guess system type" >&2 ++ ++case $UNAME_MACHINE:$UNAME_SYSTEM in ++ mips:Linux | mips64:Linux) ++ # If we got here on MIPS GNU/Linux, output extra information. ++ cat >&2 <&2 <&2 </dev/null || echo unknown` +-uname -r = `(uname -r) 2>/dev/null || echo unknown` +-uname -s = `(uname -s) 2>/dev/null || echo unknown` +-uname -v = `(uname -v) 2>/dev/null || echo unknown` ++uname -m = $( (uname -m) 2>/dev/null || echo unknown) ++uname -r = $( (uname -r) 2>/dev/null || echo unknown) ++uname -s = $( (uname -s) 2>/dev/null || echo unknown) ++uname -v = $( (uname -v) 2>/dev/null || echo unknown) + +-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +-/bin/uname -X = `(/bin/uname -X) 2>/dev/null` ++/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null) ++/bin/uname -X = $( (/bin/uname -X) 2>/dev/null) + +-hostinfo = `(hostinfo) 2>/dev/null` +-/bin/universe = `(/bin/universe) 2>/dev/null` +-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +-/bin/arch = `(/bin/arch) 2>/dev/null` +-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` ++hostinfo = $( (hostinfo) 2>/dev/null) ++/bin/universe = $( (/bin/universe) 2>/dev/null) ++/usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null) ++/bin/arch = $( (/bin/arch) 2>/dev/null) ++/usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null) ++/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null) + +-UNAME_MACHINE = ${UNAME_MACHINE} +-UNAME_RELEASE = ${UNAME_RELEASE} +-UNAME_SYSTEM = ${UNAME_SYSTEM} +-UNAME_VERSION = ${UNAME_VERSION} ++UNAME_MACHINE = "$UNAME_MACHINE" ++UNAME_RELEASE = "$UNAME_RELEASE" ++UNAME_SYSTEM = "$UNAME_SYSTEM" ++UNAME_VERSION = "$UNAME_VERSION" + EOF ++fi + + exit 1 + + # Local variables: +-# eval: (add-hook 'write-file-hooks 'time-stamp) ++# eval: (add-hook 'before-save-hook 'time-stamp) + # time-stamp-start: "timestamp='" + # time-stamp-format: "%:y-%02m-%02d" + # time-stamp-end: "'" +-# End: ++# End: +\ No newline at end of file +diff --git b/config.sub a/config.sub +index 40ea5dfe1..5174bdb09 100644 +--- b/config.sub ++++ a/config.sub +@@ -33,7 +33,1871 @@ timestamp='2017-04-02' + # Otherwise, we print the canonical config type on stdout and succeed. + + # You can get the latest version of this script from: +-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub ++# http://git.savannah.gnu.org/gitweb/?p=co#! /bin/sh ++# Configuration validation subroutine script. ++# Copyright 1992-2021 Free Software Foundation, Inc. ++ ++timestamp='2021-04-30' ++ ++# This file is free software; you can redistribute it and/or modify it ++# under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, see . ++# ++# As a special exception to the GNU General Public License, if you ++# distribute this file as part of a program that contains a ++# configuration script generated by Autoconf, you may include it under ++# the same distribution terms that you use for the rest of that ++# program. This Exception is an additional permission under section 7 ++# of the GNU General Public License, version 3 ("GPLv3"). ++ ++ ++# Please send patches to . ++# ++# Configuration subroutine to validate and canonicalize a configuration type. ++# Supply the specified configuration type as an argument. ++# If it is invalid, we print an error message on stderr and exit with code 1. ++# Otherwise, we print the canonical config type on stdout and succeed. ++ ++# You can get the latest version of this script from: ++# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub ++ ++# This file is supposed to be the same for all GNU packages ++# and recognize all the CPU types, system types and aliases ++# that are meaningful with *any* GNU software. ++# Each package is responsible for reporting which valid configurations ++# it does not support. The user should be able to distinguish ++# a failure to support a valid configuration from a meaningless ++# configuration. ++ ++# The goal of this file is to map all the various variations of a given ++# machine specification into a single specification in the form: ++# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM ++# or in some cases, the newer four-part form: ++# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM ++# It is wrong to echo any other type of specification. ++ ++me=$(echo "$0" | sed -e 's,.*/,,') ++ ++usage="\ ++Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS ++ ++Canonicalize a configuration name. ++ ++Options: ++ -h, --help print this help, then exit ++ -t, --time-stamp print date of last modification, then exit ++ -v, --version print version number, then exit ++ ++Report bugs and patches to ." ++ ++version="\ ++GNU config.sub ($timestamp) ++ ++Copyright 1992-2021 Free Software Foundation, Inc. ++ ++This is free software; see the source for copying conditions. There is NO ++warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." ++ ++help=" ++Try \`$me --help' for more information." ++ ++# Parse command line ++while test $# -gt 0 ; do ++ case $1 in ++ --time-stamp | --time* | -t ) ++ echo "$timestamp" ; exit ;; ++ --version | -v ) ++ echo "$version" ; exit ;; ++ --help | --h* | -h ) ++ echo "$usage"; exit ;; ++ -- ) # Stop option processing ++ shift; break ;; ++ - ) # Use stdin as input. ++ break ;; ++ -* ) ++ echo "$me: invalid option $1$help" >&2 ++ exit 1 ;; ++ ++ *local*) ++ # First pass through any local machine types. ++ echo "$1" ++ exit ;; ++ ++ * ) ++ break ;; ++ esac ++done ++ ++case $# in ++ 0) echo "$me: missing argument$help" >&2 ++ exit 1;; ++ 1) ;; ++ *) echo "$me: too many arguments$help" >&2 ++ exit 1;; ++esac ++ ++# Split fields of configuration type ++# shellcheck disable=SC2162 ++IFS="-" read field1 field2 field3 field4 <&2 ++ exit 1 ++ ;; ++ *-*-*-*) ++ basic_machine=$field1-$field2 ++ basic_os=$field3-$field4 ++ ;; ++ *-*-*) ++ # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two ++ # parts ++ maybe_os=$field2-$field3 ++ case $maybe_os in ++ nto-qnx* | linux-* | uclinux-uclibc* \ ++ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ ++ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ ++ | storm-chaos* | os2-emx* | rtmk-nova*) ++ basic_machine=$field1 ++ basic_os=$maybe_os ++ ;; ++ android-linux) ++ basic_machine=$field1-unknown ++ basic_os=linux-android ++ ;; ++ *) ++ basic_machine=$field1-$field2 ++ basic_os=$field3 ++ ;; ++ esac ++ ;; ++ *-*) ++ # A lone config we happen to match not fitting any pattern ++ case $field1-$field2 in ++ decstation-3100) ++ basic_machine=mips-dec ++ basic_os= ++ ;; ++ *-*) ++ # Second component is usually, but not always the OS ++ case $field2 in ++ # Prevent following clause from handling this valid os ++ sun*os*) ++ basic_machine=$field1 ++ basic_os=$field2 ++ ;; ++ # Manufacturers ++ dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ ++ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ ++ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ ++ | convergent* | ncr* | news | 32* | 3600* | 3100* \ ++ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ ++ | ultra | tti* | harris | dolphin | highlevel | gould \ ++ | cbm | ns | masscomp | apple | axis | knuth | cray \ ++ | microblaze* | sim | cisco \ ++ | oki | wec | wrs | winbond) ++ basic_machine=$field1-$field2 ++ basic_os= ++ ;; ++ *) ++ basic_machine=$field1 ++ basic_os=$field2 ++ ;; ++ esac ++ ;; ++ esac ++ ;; ++ *) ++ # Convert single-component short-hands not valid as part of ++ # multi-component configurations. ++ case $field1 in ++ 386bsd) ++ basic_machine=i386-pc ++ basic_os=bsd ++ ;; ++ a29khif) ++ basic_machine=a29k-amd ++ basic_os=udi ++ ;; ++ adobe68k) ++ basic_machine=m68010-adobe ++ basic_os=scout ++ ;; ++ alliant) ++ basic_machine=fx80-alliant ++ basic_os= ++ ;; ++ altos | altos3068) ++ basic_machine=m68k-altos ++ basic_os= ++ ;; ++ am29k) ++ basic_machine=a29k-none ++ basic_os=bsd ++ ;; ++ amdahl) ++ basic_machine=580-amdahl ++ basic_os=sysv ++ ;; ++ amiga) ++ basic_machine=m68k-unknown ++ basic_os= ++ ;; ++ amigaos | amigados) ++ basic_machine=m68k-unknown ++ basic_os=amigaos ++ ;; ++ amigaunix | amix) ++ basic_machine=m68k-unknown ++ basic_os=sysv4 ++ ;; ++ apollo68) ++ basic_machine=m68k-apollo ++ basic_os=sysv ++ ;; ++ apollo68bsd) ++ basic_machine=m68k-apollo ++ basic_os=bsd ++ ;; ++ aros) ++ basic_machine=i386-pc ++ basic_os=aros ++ ;; ++ aux) ++ basic_machine=m68k-apple ++ basic_os=aux ++ ;; ++ balance) ++ basic_machine=ns32k-sequent ++ basic_os=dynix ++ ;; ++ blackfin) ++ basic_machine=bfin-unknown ++ basic_os=linux ++ ;; ++ cegcc) ++ basic_machine=arm-unknown ++ basic_os=cegcc ++ ;; ++ convex-c1) ++ basic_machine=c1-convex ++ basic_os=bsd ++ ;; ++ convex-c2) ++ basic_machine=c2-convex ++ basic_os=bsd ++ ;; ++ convex-c32) ++ basic_machine=c32-convex ++ basic_os=bsd ++ ;; ++ convex-c34) ++ basic_machine=c34-convex ++ basic_os=bsd ++ ;; ++ convex-c38) ++ basic_machine=c38-convex ++ basic_os=bsd ++ ;; ++ cray) ++ basic_machine=j90-cray ++ basic_os=unicos ++ ;; ++ crds | unos) ++ basic_machine=m68k-crds ++ basic_os= ++ ;; ++ da30) ++ basic_machine=m68k-da30 ++ basic_os= ++ ;; ++ decstation | pmax | pmin | dec3100 | decstatn) ++ basic_machine=mips-dec ++ basic_os= ++ ;; ++ delta88) ++ basic_machine=m88k-motorola ++ basic_os=sysv3 ++ ;; ++ dicos) ++ basic_machine=i686-pc ++ basic_os=dicos ++ ;; ++ djgpp) ++ basic_machine=i586-pc ++ basic_os=msdosdjgpp ++ ;; ++ ebmon29k) ++ basic_machine=a29k-amd ++ basic_os=ebmon ++ ;; ++ es1800 | OSE68k | ose68k | ose | OSE) ++ basic_machine=m68k-ericsson ++ basic_os=ose ++ ;; ++ gmicro) ++ basic_machine=tron-gmicro ++ basic_os=sysv ++ ;; ++ go32) ++ basic_machine=i386-pc ++ basic_os=go32 ++ ;; ++ h8300hms) ++ basic_machine=h8300-hitachi ++ basic_os=hms ++ ;; ++ h8300xray) ++ basic_machine=h8300-hitachi ++ basic_os=xray ++ ;; ++ h8500hms) ++ basic_machine=h8500-hitachi ++ basic_os=hms ++ ;; ++ harris) ++ basic_machine=m88k-harris ++ basic_os=sysv3 ++ ;; ++ hp300 | hp300hpux) ++ basic_machine=m68k-hp ++ basic_os=hpux ++ ;; ++ hp300bsd) ++ basic_machine=m68k-hp ++ basic_os=bsd ++ ;; ++ hppaosf) ++ basic_machine=hppa1.1-hp ++ basic_os=osf ++ ;; ++ hppro) ++ basic_machine=hppa1.1-hp ++ basic_os=proelf ++ ;; ++ i386mach) ++ basic_machine=i386-mach ++ basic_os=mach ++ ;; ++ isi68 | isi) ++ basic_machine=m68k-isi ++ basic_os=sysv ++ ;; ++ m68knommu) ++ basic_machine=m68k-unknown ++ basic_os=linux ++ ;; ++ magnum | m3230) ++ basic_machine=mips-mips ++ basic_os=sysv ++ ;; ++ merlin) ++ basic_machine=ns32k-utek ++ basic_os=sysv ++ ;; ++ mingw64) ++ basic_machine=x86_64-pc ++ basic_os=mingw64 ++ ;; ++ mingw32) ++ basic_machine=i686-pc ++ basic_os=mingw32 ++ ;; ++ mingw32ce) ++ basic_machine=arm-unknown ++ basic_os=mingw32ce ++ ;; ++ monitor) ++ basic_machine=m68k-rom68k ++ basic_os=coff ++ ;; ++ morphos) ++ basic_machine=powerpc-unknown ++ basic_os=morphos ++ ;; ++ moxiebox) ++ basic_machine=moxie-unknown ++ basic_os=moxiebox ++ ;; ++ msdos) ++ basic_machine=i386-pc ++ basic_os=msdos ++ ;; ++ msys) ++ basic_machine=i686-pc ++ basic_os=msys ++ ;; ++ mvs) ++ basic_machine=i370-ibm ++ basic_os=mvs ++ ;; ++ nacl) ++ basic_machine=le32-unknown ++ basic_os=nacl ++ ;; ++ ncr3000) ++ basic_machine=i486-ncr ++ basic_os=sysv4 ++ ;; ++ netbsd386) ++ basic_machine=i386-pc ++ basic_os=netbsd ++ ;; ++ netwinder) ++ basic_machine=armv4l-rebel ++ basic_os=linux ++ ;; ++ news | news700 | news800 | news900) ++ basic_machine=m68k-sony ++ basic_os=newsos ++ ;; ++ news1000) ++ basic_machine=m68030-sony ++ basic_os=newsos ++ ;; ++ necv70) ++ basic_machine=v70-nec ++ basic_os=sysv ++ ;; ++ nh3000) ++ basic_machine=m68k-harris ++ basic_os=cxux ++ ;; ++ nh[45]000) ++ basic_machine=m88k-harris ++ basic_os=cxux ++ ;; ++ nindy960) ++ basic_machine=i960-intel ++ basic_os=nindy ++ ;; ++ mon960) ++ basic_machine=i960-intel ++ basic_os=mon960 ++ ;; ++ nonstopux) ++ basic_machine=mips-compaq ++ basic_os=nonstopux ++ ;; ++ os400) ++ basic_machine=powerpc-ibm ++ basic_os=os400 ++ ;; ++ OSE68000 | ose68000) ++ basic_machine=m68000-ericsson ++ basic_os=ose ++ ;; ++ os68k) ++ basic_machine=m68k-none ++ basic_os=os68k ++ ;; ++ paragon) ++ basic_machine=i860-intel ++ basic_os=osf ++ ;; ++ parisc) ++ basic_machine=hppa-unknown ++ basic_os=linux ++ ;; ++ psp) ++ basic_machine=mipsallegrexel-sony ++ basic_os=psp ++ ;; ++ pw32) ++ basic_machine=i586-unknown ++ basic_os=pw32 ++ ;; ++ rdos | rdos64) ++ basic_machine=x86_64-pc ++ basic_os=rdos ++ ;; ++ rdos32) ++ basic_machine=i386-pc ++ basic_os=rdos ++ ;; ++ rom68k) ++ basic_machine=m68k-rom68k ++ basic_os=coff ++ ;; ++ sa29200) ++ basic_machine=a29k-amd ++ basic_os=udi ++ ;; ++ sei) ++ basic_machine=mips-sei ++ basic_os=seiux ++ ;; ++ sequent) ++ basic_machine=i386-sequent ++ basic_os= ++ ;; ++ sps7) ++ basic_machine=m68k-bull ++ basic_os=sysv2 ++ ;; ++ st2000) ++ basic_machine=m68k-tandem ++ basic_os= ++ ;; ++ stratus) ++ basic_machine=i860-stratus ++ basic_os=sysv4 ++ ;; ++ sun2) ++ basic_machine=m68000-sun ++ basic_os= ++ ;; ++ sun2os3) ++ basic_machine=m68000-sun ++ basic_os=sunos3 ++ ;; ++ sun2os4) ++ basic_machine=m68000-sun ++ basic_os=sunos4 ++ ;; ++ sun3) ++ basic_machine=m68k-sun ++ basic_os= ++ ;; ++ sun3os3) ++ basic_machine=m68k-sun ++ basic_os=sunos3 ++ ;; ++ sun3os4) ++ basic_machine=m68k-sun ++ basic_os=sunos4 ++ ;; ++ sun4) ++ basic_machine=sparc-sun ++ basic_os= ++ ;; ++ sun4os3) ++ basic_machine=sparc-sun ++ basic_os=sunos3 ++ ;; ++ sun4os4) ++ basic_machine=sparc-sun ++ basic_os=sunos4 ++ ;; ++ sun4sol2) ++ basic_machine=sparc-sun ++ basic_os=solaris2 ++ ;; ++ sun386 | sun386i | roadrunner) ++ basic_machine=i386-sun ++ basic_os= ++ ;; ++ sv1) ++ basic_machine=sv1-cray ++ basic_os=unicos ++ ;; ++ symmetry) ++ basic_machine=i386-sequent ++ basic_os=dynix ++ ;; ++ t3e) ++ basic_machine=alphaev5-cray ++ basic_os=unicos ++ ;; ++ t90) ++ basic_machine=t90-cray ++ basic_os=unicos ++ ;; ++ toad1) ++ basic_machine=pdp10-xkl ++ basic_os=tops20 ++ ;; ++ tpf) ++ basic_machine=s390x-ibm ++ basic_os=tpf ++ ;; ++ udi29k) ++ basic_machine=a29k-amd ++ basic_os=udi ++ ;; ++ ultra3) ++ basic_machine=a29k-nyu ++ basic_os=sym1 ++ ;; ++ v810 | necv810) ++ basic_machine=v810-nec ++ basic_os=none ++ ;; ++ vaxv) ++ basic_machine=vax-dec ++ basic_os=sysv ++ ;; ++ vms) ++ basic_machine=vax-dec ++ basic_os=vms ++ ;; ++ vsta) ++ basic_machine=i386-pc ++ basic_os=vsta ++ ;; ++ vxworks960) ++ basic_machine=i960-wrs ++ basic_os=vxworks ++ ;; ++ vxworks68) ++ basic_machine=m68k-wrs ++ basic_os=vxworks ++ ;; ++ vxworks29k) ++ basic_machine=a29k-wrs ++ basic_os=vxworks ++ ;; ++ xbox) ++ basic_machine=i686-pc ++ basic_os=mingw32 ++ ;; ++ ymp) ++ basic_machine=ymp-cray ++ basic_os=unicos ++ ;; ++ *) ++ basic_machine=$1 ++ basic_os= ++ ;; ++ esac ++ ;; ++esac ++ ++# Decode 1-component or ad-hoc basic machines ++case $basic_machine in ++ # Here we handle the default manufacturer of certain CPU types. It is in ++ # some cases the only manufacturer, in others, it is the most popular. ++ w89k) ++ cpu=hppa1.1 ++ vendor=winbond ++ ;; ++ op50n) ++ cpu=hppa1.1 ++ vendor=oki ++ ;; ++ op60c) ++ cpu=hppa1.1 ++ vendor=oki ++ ;; ++ ibm*) ++ cpu=i370 ++ vendor=ibm ++ ;; ++ orion105) ++ cpu=clipper ++ vendor=highlevel ++ ;; ++ mac | mpw | mac-mpw) ++ cpu=m68k ++ vendor=apple ++ ;; ++ pmac | pmac-mpw) ++ cpu=powerpc ++ vendor=apple ++ ;; ++ ++ # Recognize the various machine names and aliases which stand ++ # for a CPU type and a company and sometimes even an OS. ++ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) ++ cpu=m68000 ++ vendor=att ++ ;; ++ 3b*) ++ cpu=we32k ++ vendor=att ++ ;; ++ bluegene*) ++ cpu=powerpc ++ vendor=ibm ++ basic_os=cnk ++ ;; ++ decsystem10* | dec10*) ++ cpu=pdp10 ++ vendor=dec ++ basic_os=tops10 ++ ;; ++ decsystem20* | dec20*) ++ cpu=pdp10 ++ vendor=dec ++ basic_os=tops20 ++ ;; ++ delta | 3300 | motorola-3300 | motorola-delta \ ++ | 3300-motorola | delta-motorola) ++ cpu=m68k ++ vendor=motorola ++ ;; ++ dpx2*) ++ cpu=m68k ++ vendor=bull ++ basic_os=sysv3 ++ ;; ++ encore | umax | mmax) ++ cpu=ns32k ++ vendor=encore ++ ;; ++ elxsi) ++ cpu=elxsi ++ vendor=elxsi ++ basic_os=${basic_os:-bsd} ++ ;; ++ fx2800) ++ cpu=i860 ++ vendor=alliant ++ ;; ++ genix) ++ cpu=ns32k ++ vendor=ns ++ ;; ++ h3050r* | hiux*) ++ cpu=hppa1.1 ++ vendor=hitachi ++ basic_os=hiuxwe2 ++ ;; ++ hp3k9[0-9][0-9] | hp9[0-9][0-9]) ++ cpu=hppa1.0 ++ vendor=hp ++ ;; ++ hp9k2[0-9][0-9] | hp9k31[0-9]) ++ cpu=m68000 ++ vendor=hp ++ ;; ++ hp9k3[2-9][0-9]) ++ cpu=m68k ++ vendor=hp ++ ;; ++ hp9k6[0-9][0-9] | hp6[0-9][0-9]) ++ cpu=hppa1.0 ++ vendor=hp ++ ;; ++ hp9k7[0-79][0-9] | hp7[0-79][0-9]) ++ cpu=hppa1.1 ++ vendor=hp ++ ;; ++ hp9k78[0-9] | hp78[0-9]) ++ # FIXME: really hppa2.0-hp ++ cpu=hppa1.1 ++ vendor=hp ++ ;; ++ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) ++ # FIXME: really hppa2.0-hp ++ cpu=hppa1.1 ++ vendor=hp ++ ;; ++ hp9k8[0-9][13679] | hp8[0-9][13679]) ++ cpu=hppa1.1 ++ vendor=hp ++ ;; ++ hp9k8[0-9][0-9] | hp8[0-9][0-9]) ++ cpu=hppa1.0 ++ vendor=hp ++ ;; ++ i*86v32) ++ cpu=$(echo "$1" | sed -e 's/86.*/86/') ++ vendor=pc ++ basic_os=sysv32 ++ ;; ++ i*86v4*) ++ cpu=$(echo "$1" | sed -e 's/86.*/86/') ++ vendor=pc ++ basic_os=sysv4 ++ ;; ++ i*86v) ++ cpu=$(echo "$1" | sed -e 's/86.*/86/') ++ vendor=pc ++ basic_os=sysv ++ ;; ++ i*86sol2) ++ cpu=$(echo "$1" | sed -e 's/86.*/86/') ++ vendor=pc ++ basic_os=solaris2 ++ ;; ++ j90 | j90-cray) ++ cpu=j90 ++ vendor=cray ++ basic_os=${basic_os:-unicos} ++ ;; ++ iris | iris4d) ++ cpu=mips ++ vendor=sgi ++ case $basic_os in ++ irix*) ++ ;; ++ *) ++ basic_os=irix4 ++ ;; ++ esac ++ ;; ++ miniframe) ++ cpu=m68000 ++ vendor=convergent ++ ;; ++ *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) ++ cpu=m68k ++ vendor=atari ++ basic_os=mint ++ ;; ++ news-3600 | risc-news) ++ cpu=mips ++ vendor=sony ++ basic_os=newsos ++ ;; ++ next | m*-next) ++ cpu=m68k ++ vendor=next ++ case $basic_os in ++ openstep*) ++ ;; ++ nextstep*) ++ ;; ++ ns2*) ++ basic_os=nextstep2 ++ ;; ++ *) ++ basic_os=nextstep3 ++ ;; ++ esac ++ ;; ++ np1) ++ cpu=np1 ++ vendor=gould ++ ;; ++ op50n-* | op60c-*) ++ cpu=hppa1.1 ++ vendor=oki ++ basic_os=proelf ++ ;; ++ pa-hitachi) ++ cpu=hppa1.1 ++ vendor=hitachi ++ basic_os=hiuxwe2 ++ ;; ++ pbd) ++ cpu=sparc ++ vendor=tti ++ ;; ++ pbb) ++ cpu=m68k ++ vendor=tti ++ ;; ++ pc532) ++ cpu=ns32k ++ vendor=pc532 ++ ;; ++ pn) ++ cpu=pn ++ vendor=gould ++ ;; ++ power) ++ cpu=power ++ vendor=ibm ++ ;; ++ ps2) ++ cpu=i386 ++ vendor=ibm ++ ;; ++ rm[46]00) ++ cpu=mips ++ vendor=siemens ++ ;; ++ rtpc | rtpc-*) ++ cpu=romp ++ vendor=ibm ++ ;; ++ sde) ++ cpu=mipsisa32 ++ vendor=sde ++ basic_os=${basic_os:-elf} ++ ;; ++ simso-wrs) ++ cpu=sparclite ++ vendor=wrs ++ basic_os=vxworks ++ ;; ++ tower | tower-32) ++ cpu=m68k ++ vendor=ncr ++ ;; ++ vpp*|vx|vx-*) ++ cpu=f301 ++ vendor=fujitsu ++ ;; ++ w65) ++ cpu=w65 ++ vendor=wdc ++ ;; ++ w89k-*) ++ cpu=hppa1.1 ++ vendor=winbond ++ basic_os=proelf ++ ;; ++ none) ++ cpu=none ++ vendor=none ++ ;; ++ leon|leon[3-9]) ++ cpu=sparc ++ vendor=$basic_machine ++ ;; ++ leon-*|leon[3-9]-*) ++ cpu=sparc ++ vendor=$(echo "$basic_machine" | sed 's/-.*//') ++ ;; ++ ++ *-*) ++ # shellcheck disable=SC2162 ++ IFS="-" read cpu vendor <&2 ++ exit 1 ++ ;; ++ esac ++ ;; ++esac ++ ++# Here we canonicalize certain aliases for manufacturers. ++case $vendor in ++ digital*) ++ vendor=dec ++ ;; ++ commodore*) ++ vendor=cbm ++ ;; ++ *) ++ ;; ++esac ++ ++# Decode manufacturer-specific aliases for certain operating systems. ++ ++if test x$basic_os != x ++then ++ ++# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just ++# set os. ++case $basic_os in ++ gnu/linux*) ++ kernel=linux ++ os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') ++ ;; ++ os2-emx) ++ kernel=os2 ++ os=$(echo $basic_os | sed -e 's|os2-emx|emx|') ++ ;; ++ nto-qnx*) ++ kernel=nto ++ os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') ++ ;; ++ *-*) ++ # shellcheck disable=SC2162 ++ IFS="-" read kernel os <&2 ++ exit 1 ++ ;; ++esac ++ ++# As a final step for OS-related things, validate the OS-kernel combination ++# (given a valid OS), if there is a kernel. ++case $kernel-$os in ++ linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) ++ ;; ++ uclinux-uclibc* ) ++ ;; ++ -dietlibc* | -newlib* | -musl* | -uclibc* ) ++ # These are just libc implementations, not actual OSes, and thus ++ # require a kernel. ++ echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 ++ exit 1 ++ ;; ++ kfreebsd*-gnu* | kopensolaris*-gnu*) ++ ;; ++ vxworks-simlinux | vxworks-simwindows | vxworks-spe) ++ ;; ++ nto-qnx*) ++ ;; ++ os2-emx) ++ ;; ++ *-eabi* | *-gnueabi*) ++ ;; ++ -*) ++ # Blank kernel with real OS is always fine. ++ ;; ++ *-*) ++ echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 ++ exit 1 ++ ;; ++esac ++ ++# Here we handle the case where we know the os, and the CPU type, but not the ++# manufacturer. We pick the logical manufacturer. ++case $vendor in ++ unknown) ++ case $cpu-$os in ++ *-riscix*) ++ vendor=acorn ++ ;; ++ *-sunos*) ++ vendor=sun ++ ;; ++ *-cnk* | *-aix*) ++ vendor=ibm ++ ;; ++ *-beos*) ++ vendor=be ++ ;; ++ *-hpux*) ++ vendor=hp ++ ;; ++ *-mpeix*) ++ vendor=hp ++ ;; ++ *-hiux*) ++ vendor=hitachi ++ ;; ++ *-unos*) ++ vendor=crds ++ ;; ++ *-dgux*) ++ vendor=dg ++ ;; ++ *-luna*) ++ vendor=omron ++ ;; ++ *-genix*) ++ vendor=ns ++ ;; ++ *-clix*) ++ vendor=intergraph ++ ;; ++ *-mvs* | *-opened*) ++ vendor=ibm ++ ;; ++ *-os400*) ++ vendor=ibm ++ ;; ++ s390-* | s390x-*) ++ vendor=ibm ++ ;; ++ *-ptx*) ++ vendor=sequent ++ ;; ++ *-tpf*) ++ vendor=ibm ++ ;; ++ *-vxsim* | *-vxworks* | *-windiss*) ++ vendor=wrs ++ ;; ++ *-aux*) ++ vendor=apple ++ ;; ++ *-hms*) ++ vendor=hitachi ++ ;; ++ *-mpw* | *-macos*) ++ vendor=apple ++ ;; ++ *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) ++ vendor=atari ++ ;; ++ *-vos*) ++ vendor=stratus ++ ;; ++ esac ++ ;; ++esac ++ ++echo "$cpu-$vendor-${kernel:+$kernel-}$os" ++exit ++ ++# Local variables: ++# eval: (add-hook 'before-save-hook 'time-stamp) ++# time-stamp-start: "timestamp='" ++# time-stamp-format: "%:y-%02m-%02d" ++# time-stamp-end: "'" ++# End:nfig.git;a=blob_plain;f=config.sub + + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases +diff --git b/include/alignment.h a/include/alignment.h +index 787fe4a58..e69de29bb 100644 +--- b/include/alignment.h ++++ a/include/alignment.h +@@ 0,3 +0,2 @@ + #if __GLASGOW_HASKELL__ < 711 +-#define hsc_alignment(t ) hsc_printf ( "%lu", (unsigned long)offsetof(struct {char x__; t(y__); }, y__)); + #endif diff --git a/patches/network-3.1.2.5.patch b/patches/network-3.1.2.5.patch new file mode 100644 index 0000000..eed51de --- /dev/null +++ b/patches/network-3.1.2.5.patch @@ -0,0 +1,21 @@ +diff --git a/config.sub b/config.sub +index d74fb6d..d4f35df 100644 +--- a/config.sub ++++ b/config.sub +@@ -1748,7 +1748,7 @@ case $os in + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ +- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*) ++ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* | ghcjs*) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) +diff --git a/include/alignment.h b/include/alignment.h +index 787fe4a..e5778c7 100644 +--- a/include/alignment.h ++++ b/include/alignment.h +@@ -1,3 +1,2 @@ + #if __GLASGOW_HASKELL__ < 711 +-#define hsc_alignment(t ) hsc_printf ( "%lu", (unsigned long)offsetof(struct {char x__; t(y__); }, y__)); + #endif diff --git a/patches/terminal-size-0.3.2.1.patch b/patches/terminal-size-0.3.2.1.patch new file mode 100644 index 0000000..2d31677 --- /dev/null +++ b/patches/terminal-size-0.3.2.1.patch @@ -0,0 +1,14 @@ +diff --git b/src/System/Console/Terminal/Posix.hsc a/src/System/Console/Terminal/Posix.hsc +index 33f958565..455e3aeb4 100644 +--- b/src/System/Console/Terminal/Posix.hsc ++++ a/src/System/Console/Terminal/Posix.hsc +@@ -20,10 +20,6 @@ import System.Posix.Types (Fd(Fd)) + #include + #include + +- +-#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__) +- +- + -- Interesting part of @struct winsize@ + data CWin = CWin CUShort CUShort diff --git a/patches/unix-compat-0.5.3.patch b/patches/unix-compat-0.5.3.patch new file mode 100644 index 0000000..390f3c3 --- /dev/null +++ b/patches/unix-compat-0.5.3.patch @@ -0,0 +1,13 @@ +diff --git b/unix-compat.cabal a/unix-compat.cabal +index 7c59b9fd7..b77275eda 100644 +--- b/unix-compat.cabal ++++ a/unix-compat.cabal +@@ -68,6 +68,7 @@ Library + include-dirs: include + includes: HsUnixCompat.h + install-includes: HsUnixCompat.h +- c-sources: cbits/HsUnixCompat.c ++ if !os(ghcjs) ++ c-sources: cbits/HsUnixCompat.c + if os(solaris) + cc-options: -DSOLARIS