-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·83 lines (73 loc) · 2.85 KB
/
Copy pathconfigure
File metadata and controls
executable file
·83 lines (73 loc) · 2.85 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh
# configure -- FlowCodeUnmixRcpp
#
# On macOS: detects or installs Homebrew + libomp, then enables OpenMP.
# On Linux: OpenMP is handled natively by GCC; no detection needed.
# On Windows: configure is not run; src/Makevars.win is used directly.
OPENMP_CPPFLAGS=""
OPENMP_LIBS=""
FLIBS_LINE=""
if [ "$(uname)" = "Darwin" ]; then
# --- Ensure Homebrew is present ---
if ! command -v brew >/dev/null 2>&1; then
if [ -t 1 ]; then
echo "configure: Homebrew not found -- installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
for BREW_BIN in /opt/homebrew/bin /usr/local/bin; do
if [ -f "${BREW_BIN}/brew" ]; then
export PATH="${BREW_BIN}:${PATH}"
break
fi
done
else
echo "configure: Homebrew not found and session is non-interactive -- cannot auto-install"
echo "configure: to enable OpenMP, open a terminal and run:"
echo "configure: /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
echo "configure: brew install libomp"
echo "configure: then reinstall the package"
echo "configure: building without OpenMP (single-threaded) for now"
fi
fi
# --- Ensure libomp is present ---
LIBOMP_DIR=""
for HOMEBREW_PREFIX in /opt/homebrew /usr/local; do
if [ -d "${HOMEBREW_PREFIX}/opt/libomp" ]; then
LIBOMP_DIR="${HOMEBREW_PREFIX}/opt/libomp"
break
fi
done
if [ -z "${LIBOMP_DIR}" ] && command -v brew >/dev/null 2>&1; then
if [ -t 1 ]; then
echo "configure: libomp not found -- installing via Homebrew"
brew install libomp
for HOMEBREW_PREFIX in /opt/homebrew /usr/local; do
if [ -d "${HOMEBREW_PREFIX}/opt/libomp" ]; then
LIBOMP_DIR="${HOMEBREW_PREFIX}/opt/libomp"
break
fi
done
else
echo "configure: libomp not found and session is non-interactive -- cannot auto-install"
echo "configure: to enable OpenMP, open a terminal and run: brew install libomp"
echo "configure: then reinstall the package"
echo "configure: building without OpenMP (single-threaded) for now"
fi
fi
if [ -n "${LIBOMP_DIR}" ]; then
OPENMP_CPPFLAGS="-Xpreprocessor -fopenmp -I${LIBOMP_DIR}/include"
OPENMP_LIBS="-L${LIBOMP_DIR}/lib -lomp"
echo "configure: OpenMP enabled using libomp at ${LIBOMP_DIR}"
echo "configure: note -- keep n_threads conservative to avoid conflict with Accelerate BLAS"
else
echo "configure: building without OpenMP (single-threaded C++ only)"
fi
else
# Linux: gfortran expected; include $(FLIBS). OpenMP via GCC natively.
FLIBS_LINE='$(FLIBS)'
fi
sed \
-e "s|@OPENMP_CPPFLAGS@|${OPENMP_CPPFLAGS}|g" \
-e "s|@OPENMP_LIBS@|${OPENMP_LIBS}|g" \
-e "s|@FLIBS_LINE@|${FLIBS_LINE}|g" \
src/Makevars.in > src/Makevars
exit 0