aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-03-03 00:26:05 +0100
committerRobin Jarry <robin@jarry.cc>2023-03-03 21:42:50 +0100
commitd5e47e300a42ed64c17e4b391b77234e22c9f915 (patch)
tree2d54528dbceafbe404c2784ce2978165fb971d44 /contrib
parentb63c93563c622e70cda7006c1816dc6b59e75844 (diff)
downloadaerc-d5e47e300a42ed64c17e4b391b77234e22c9f915.tar.gz
mk: detect if notmuch headers & libs are available
Detect if notmuch is available by trying to compile a minimal go program that uses the notmuch.h header and links to libnotmuch.so. If that succeeds, set the default GOFLAGS value to -tags=notmuch. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Inwit <inwit@sindominio.net>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/check-notmuch.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/contrib/check-notmuch.sh b/contrib/check-notmuch.sh
new file mode 100755
index 00000000..6b5beb62
--- /dev/null
+++ b/contrib/check-notmuch.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+tmp=$(mktemp -d)
+trap "rm -rf $tmp" EXIT
+
+cat > $tmp/src.go <<EOF
+package main
+
+// #cgo LDFLAGS: -lnotmuch
+// #include <notmuch.h>
+import "C"
+
+func main() {
+ C.notmuch_status_to_string(C.NOTMUCH_STATUS_SUCCESS)
+}
+EOF
+
+${GO:-go} build -o $tmp/out $tmp/src.go