-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathconfigure.win
More file actions
executable file
·75 lines (65 loc) · 1.97 KB
/
Copy pathconfigure.win
File metadata and controls
executable file
·75 lines (65 loc) · 1.97 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
#!/usr/bin/env sh
# Minimal configure.win to detect libcurl for optional HTTP VFS (best-effort)
set -e
CURL_CFLAGS=""
CURL_LIBS=""
update_makevars_var() {
var="$1"
val="$2"
file="src/Makevars.local"
tmp="${file}.tmp"
if [ ! -f "$file" ]; then
: > "$file"
fi
awk -v var="$var" -v val="$val" '
BEGIN{done=0}
$0 ~ ("^" var "=") {
if(!done){ print var "=" val; done=1 }
next
}
{ print }
END{ if(!done) print var "=" val }
' "$file" > "$tmp"
mv "$tmp" "$file"
}
# Try pkg-config first (msys2 environments)
if command -v pkg-config >/dev/null 2>&1; then
if pkg-config --exists libcurl; then
CURL_CFLAGS="$(pkg-config --cflags libcurl)"
CURL_LIBS="$(pkg-config --libs libcurl)"
fi
fi
# Fallback: curl-config if available
if [ -z "$CURL_LIBS" ] && command -v curl-config >/dev/null 2>&1; then
CURL_CFLAGS="$(curl-config --cflags 2>/dev/null || true)"
CURL_LIBS="$(curl-config --libs 2>/dev/null || true)"
fi
dedup_libs() {
out=""
for tok in $1; do
case " $out " in
*" $tok "*) ;;
*) out="$out $tok" ;;
esac
done
echo "$out" | sed -e 's/^ *//' -e 's/ */ /g'
}
if [ -n "$CURL_LIBS" ] && [ -f "src/vendor/extensions/http.c" ]; then
CURL_LIBS_DEDUP=$(dedup_libs "$CURL_LIBS")
echo "Found libcurl (deduped): $CURL_LIBS_DEDUP"
update_makevars_var "HTTPVFS_CPPFLAGS" "-DRSQLITE_ENABLE_HTTPVFS"
update_makevars_var "CURL_CFLAGS" "$CURL_CFLAGS"
update_makevars_var "CURL_LIBS" "$CURL_LIBS_DEDUP"
else
echo "libcurl not found; building without httpvfs (ok)"
update_makevars_var "HTTPVFS_CPPFLAGS" ""
update_makevars_var "CURL_CFLAGS" ""
update_makevars_var "CURL_LIBS" ""
fi
# Optional suppression of noisy third-party warnings; set RSQLITE_SILENCE_WARNINGS=1 to enable.
case "${RSQLITE_SILENCE_WARNINGS:-}" in
1|yes|YES|true|TRUE)
update_makevars_var "RSQLITE_CXXFLAGS" "-Wno-parentheses -Wno-unused-but-set-variable"
update_makevars_var "RSQLITE_CFLAGS" "-Wno-unused-but-set-variable"
;;
esac