aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/check-notmuch.sh20
-rwxr-xr-xcontrib/goflags.sh19
2 files changed, 19 insertions, 20 deletions
diff --git a/contrib/check-notmuch.sh b/contrib/check-notmuch.sh
deleted file mode 100755
index 6b5beb62..00000000
--- a/contrib/check-notmuch.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/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
diff --git a/contrib/goflags.sh b/contrib/goflags.sh
new file mode 100755
index 00000000..90e4d9ee
--- /dev/null
+++ b/contrib/goflags.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+tags=
+
+if ${CC:-cc} -x c - -o/dev/null -lnotmuch; then
+ tags="$tags,notmuch"
+fi <<EOF
+#include <notmuch.h>
+
+void main(void) {
+ notmuch_status_to_string(NOTMUCH_STATUS_SUCCESS);
+}
+EOF
+
+if [ -n "$tags" ]; then
+ printf -- '-tags=%s\n' "${tags#,}"
+fi