summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libgcrypt-test.c32
-rw-r--r--src/libgcrypt.mk6
2 files changed, 38 insertions, 0 deletions
diff --git a/src/libgcrypt-test.c b/src/libgcrypt-test.c
new file mode 100644
index 0000000..5b4ec31
--- /dev/null
+++ b/src/libgcrypt-test.c
@@ -0,0 +1,32 @@
+/*
+ * This file is part of MXE.
+ * See index.html for further information.
+ */
+
+#include <stdio.h>
+#include <gcrypt.h>
+
+int main(int argc, char *argv[])
+{
+ (void)argc;
+ (void)argv;
+
+ if (!gcry_check_version (GCRYPT_VERSION)) {
+ fputs ("libgcrypt version mismatch\n", stderr);
+ exit (2);
+ }
+
+ gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
+ gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
+ gcry_control (GCRYCTL_RESUME_SECMEM_WARN);
+ gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
+
+ if (!gcry_control (GCRYCTL_INITIALIZATION_FINISHED_P)) {
+ fputs ("libgcrypt has not been initialized\n", stderr);
+ abort ();
+ }
+
+ printf("gcrypt version: %s", GCRYPT_VERSION );
+
+ return 0;
+}
diff --git a/src/libgcrypt.mk b/src/libgcrypt.mk
index e2bc452..a299660 100644
--- a/src/libgcrypt.mk
+++ b/src/libgcrypt.mk
@@ -24,4 +24,10 @@ define $(PKG)_BUILD
--prefix='$(PREFIX)/$(TARGET)' \
--with-gpg-error-prefix='$(PREFIX)/$(TARGET)'
$(MAKE) -C '$(1)' -j '$(JOBS)' install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS=
+ ln -sf '$(PREFIX)/$(TARGET)/bin/libgcrypt-config' '$(PREFIX)/bin/$(TARGET)-libgcrypt-config'
+
+ '$(TARGET)-gcc' \
+ -W -Wall -Werror -ansi -pedantic \
+ '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-libgcrypt.exe' \
+ `$(TARGET)-libgcrypt-config --cflags --libs`
endef