From 9f27eff527cafd486c2b32b434ba3e64931f224c Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 17 Jul 2012 08:05:18 +0200 Subject: [PATCH] Use correct shared library extension on windows * The windows shared libraries have the .dll extension * This means we also need separate directories for the test module configs on win32 https://bugzilla.gnome.org/show_bug.cgi?id=44740 --- configure.ac | 4 ++++ p11-kit/Makefile.am | 14 ++++++++++++++ tests/files/system-modules/win32/one.module | 3 +++ tests/files/system-modules/win32/two-duplicate.module | 3 +++ tests/files/system-modules/win32/two.badname | 5 +++++ tests/files/user-modules/win32/one.module | 2 ++ tests/files/user-modules/win32/three.module | 5 +++++ tests/test-init.c | 2 +- 8 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/files/system-modules/win32/one.module create mode 100644 tests/files/system-modules/win32/two-duplicate.module create mode 100644 tests/files/system-modules/win32/two.badname create mode 100644 tests/files/user-modules/win32/one.module create mode 100644 tests/files/user-modules/win32/three.module diff --git a/configure.ac b/configure.ac index 0e1e2f8..8b4cf46 100644 --- a/configure.ac +++ b/configure.ac @@ -269,6 +269,10 @@ AC_SUBST(GENHTML) P11KIT_LT_RELEASE=$P11KIT_CURRENT:$P11KIT_REVISION:$P11KIT_AGE AC_SUBST(P11KIT_LT_RELEASE) +eval SHLEXT=$shrext_cmds +AC_DEFINE_UNQUOTED(SHLEXT, ["$SHLEXT"], [File extension for shared libraries]) +AC_SUBST(SHLEXT) + AC_CONFIG_FILES([Makefile doc/Makefile doc/version.xml diff --git a/p11-kit/Makefile.am b/p11-kit/Makefile.am index cba556e..2985d85 100644 --- a/p11-kit/Makefile.am +++ b/p11-kit/Makefile.am @@ -59,6 +59,18 @@ libp11_kit_testable_la_LDFLAGS = \ libp11_kit_testable_la_SOURCES = $(MODULE_SRCS) +if OS_WIN32 + +libp11_kit_testable_la_CFLAGS = \ + -DP11_SYSTEM_CONFIG_FILE=\""$(abs_top_srcdir)/tests/files/system-pkcs11.conf"\" \ + -DP11_SYSTEM_CONFIG_MODULES=\""$(abs_top_srcdir)/tests/files/system-modules/win32"\" \ + -DP11_USER_CONFIG_FILE=\""$(abs_top_srcdir)/tests/files/user-pkcs11.conf"\" \ + -DP11_USER_CONFIG_MODULES=\""$(abs_top_srcdir)/tests/files/user-modules/win32"\" \ + -DP11_MODULE_PATH=\""$(abs_top_builddir)/tests/.libs"\" \ + $(NULL) + +else + libp11_kit_testable_la_CFLAGS = \ -DP11_SYSTEM_CONFIG_FILE=\""$(abs_top_srcdir)/tests/files/system-pkcs11.conf"\" \ -DP11_SYSTEM_CONFIG_MODULES=\""$(abs_top_srcdir)/tests/files/system-modules"\" \ @@ -67,6 +79,8 @@ libp11_kit_testable_la_CFLAGS = \ -DP11_MODULE_PATH=\""$(abs_top_builddir)/tests/.libs"\" \ $(NULL) +endif + libp11_kit_compat_la_SOURCES = \ debug.c debug.h \ messages.c \ diff --git a/tests/files/system-modules/win32/one.module b/tests/files/system-modules/win32/one.module new file mode 100644 index 0000000..5f80304 --- /dev/null +++ b/tests/files/system-modules/win32/one.module @@ -0,0 +1,3 @@ + +module: mock-one.dll +setting: system1 \ No newline at end of file diff --git a/tests/files/system-modules/win32/two-duplicate.module b/tests/files/system-modules/win32/two-duplicate.module new file mode 100644 index 0000000..e80c9e8 --- /dev/null +++ b/tests/files/system-modules/win32/two-duplicate.module @@ -0,0 +1,3 @@ + +# This is a duplicate of the 'two' module +module: mock-two.dll diff --git a/tests/files/system-modules/win32/two.badname b/tests/files/system-modules/win32/two.badname new file mode 100644 index 0000000..ae44b83 --- /dev/null +++ b/tests/files/system-modules/win32/two.badname @@ -0,0 +1,5 @@ +# This module doesn't have a .module extension, but p11-kit doesn't yet +# enforce the naming, just warns, so it should still be loaded + +module: mock-two.dll +setting: system2 diff --git a/tests/files/user-modules/win32/one.module b/tests/files/user-modules/win32/one.module new file mode 100644 index 0000000..c371e4a --- /dev/null +++ b/tests/files/user-modules/win32/one.module @@ -0,0 +1,2 @@ + +setting: user1 \ No newline at end of file diff --git a/tests/files/user-modules/win32/three.module b/tests/files/user-modules/win32/three.module new file mode 100644 index 0000000..58f883d --- /dev/null +++ b/tests/files/user-modules/win32/three.module @@ -0,0 +1,5 @@ + +module: mock-three.dll +setting: user3 + +enable-in: test-enable \ No newline at end of file diff --git a/tests/test-init.c b/tests/test-init.c index 8128db6..d872afa 100644 --- a/tests/test-init.c +++ b/tests/test-init.c @@ -273,7 +273,7 @@ test_load_and_initialize (CuTest *tc) CK_RV rv; int ret; - rv = p11_kit_load_initialize_module (BUILDDIR "/.libs/mock-one.so", &module); + rv = p11_kit_load_initialize_module (BUILDDIR "/.libs/mock-one" SHLEXT, &module); CuAssertTrue (tc, rv == CKR_OK); CuAssertTrue (tc, module != NULL); -- 1.7.10.4