-
Notifications
You must be signed in to change notification settings - Fork 69
/
configure
executable file
·59 lines (55 loc) · 1.47 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -eu
while [[ $# -gt 0 ]]; do
case $1 in
--with-dragonegg)
USE_DRAGONEGG="true"
shift
;;
--with-flang)
shift
;;
*)
echo "Unknown argument $1"
exit 1
;;
esac
done
rm -f tools/fortran.mk
function configure_emfc {
EMFC_ROOT=`dirname ${EMFC}`
if [ -f "${FORTRAN_WASM_LIB-}" ]; then
EMFC_FLIB=${FORTRAN_WASM_LIB}
elif [ -f "${EMFC_ROOT}/../../wasm/lib/libFortranRuntime.a" ]; then
EMFC_FLIB=`realpath ${EMFC_ROOT}/../../wasm/lib/libFortranRuntime.a`
else
echo "Error: Can't find Fortran runtime library."
echo "Set FORTRAN_WASM_LIB to the location of libFortranRuntime.a,"\
"or unset EMFC to build LLVM flang from source."
exit 1
fi
echo "Found Fortran runtime library: ${EMFC_FLIB}"
cat << EOF > tools/fortran.mk
EMFC = ${EMFC}
FORTRAN_WASM_LIB = ${EMFC_FLIB}
FORTRAN_WASM_LDADD = ${EMFC_FLIB}
.PHONY: clean-tools
clean-tools:
@
EOF
}
if [ -n "${USE_DRAGONEGG-}" ]; then
# Build dragonegg from source
ln -s fortran-dragonegg.mk tools/fortran.mk
elif [ -n "${EMFC-}" ]; then
if [ -f "${EMFC-}" ]; then
echo "Found Fortran compiler: ${EMFC}"
configure_emfc
else
echo "Error: Can't find Fortran compiler, check EMFC value."
exit 1
fi
else
# Build LLVM flang from source
ln -s fortran-flang.mk tools/fortran.mk
fi