Skip to content

Commit 5c0099a

Browse files
committedSep 30, 2016
Issue softhsm#230: Move configuration to an M4 script and update documentation
1 parent a0804df commit 5c0099a

7 files changed

+59
-26
lines changed
 

‎Makefile.am

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
ACLOCAL_AMFLAGS = -I m4
22

3-
if P11_MODULE_FILE
4-
p11moddir = $(pk_module_configs)
5-
p11mod_DATA = softhsm2.module
6-
endif
7-
83
MAINTAINERCLEANFILES = \
94
config.log config.status softhsm2.module \
105
$(srcdir)/Makefile.in \
@@ -16,6 +11,11 @@ MAINTAINERCLEANFILES = \
1611

1712
SUBDIRS = src
1813

14+
if WITH_P11KIT
15+
p11moddir = @P11KIT_PATH@
16+
p11mod_DATA = softhsm2.module
17+
endif
18+
1919
EXTRA_DIST = $(srcdir)/aes_wrap_key_with_pad/botan-diff \
2020
$(srcdir)/aes_wrap_key_with_pad/README \
2121
$(srcdir)/FIPS-NOTES.md \

‎NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ SoftHSM develop
2222
(Patch from Lars Silvén)
2323
* Issue #223: Mark public key as non private by default.
2424
(Patch from Nikos Mavrogiannopoulos)
25+
* Issue #230: Install p11-kit module, to disable use --disable-p11-kit.
26+
(Patch from David Woodhouse)
2527
* Issue #237: Add windows continuous integration build.
2628
(Patch from Peter Polačko)
2729

‎README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ because of the PKCS#11 interface.
2525

2626
## Developers
2727

28-
- Rickard Bellgrim (.SE, The Internet Infrastructure Foundation, www.iis.se)
28+
- Rickard Bellgrim (Knowit Secure AB, www.knowitgroup.com)
2929
- Francis Dupont (ISC, www.isc.org)
3030
- René Post (XPT Software and Consulting, www.xpt.nl)
3131
- Roland van Rijswijk (SURFnet bv, www.surfnet.nl)
@@ -72,6 +72,9 @@ Options:
7272
--with-objectstore-backend-db
7373
Build with database object store (SQLite3)
7474
--with-sqlite3=PATH Specify prefix of path of SQLite3
75+
--disable-p11-kit Disable p11-kit integration (default enabled)
76+
--with-p11-kit=PATH Specify install path of the p11-kit module, will
77+
override path given by pkg-config
7578

7679
For more options:
7780

‎configure.ac

+7-16
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ AC_INIT([SoftHSM],[SOFTHSM_VERSION_MAJOR.SOFTHSM_VERSION_MINOR.SOFTHSM_VERSION_F
3434
AC_CONFIG_HEADER([config.h])
3535
AC_CONFIG_SRCDIR([src/Makefile.am])
3636
AC_CONFIG_MACRO_DIR([m4])
37-
AM_INIT_AUTOMAKE(foreign)
37+
AM_INIT_AUTOMAKE([foreign subdir-objects])
3838
ACX_PREFIXHACK
3939

4040
# Version info for the library
@@ -113,6 +113,9 @@ fi
113113
# Set visibility flags so only PKCS#11 entry points are exported
114114
ACX_VISIBILITY
115115

116+
# If we should install the p11-kit module
117+
ACX_P11KIT
118+
116119
# Set full directory paths
117120
full_sysconfdir=`eval eval eval eval eval echo "${sysconfdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
118121
full_localstatedir=`eval eval eval eval eval echo "${localstatedir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
@@ -123,19 +126,7 @@ softhsmtokendir=${full_localstatedir}/lib/softhsm/tokens/
123126
# Install the library in a sub-directory
124127
full_libdir="$full_libdir/softhsm"
125128
libdir=$full_libdir
126-
127-
AC_ARG_ENABLE([p11-kit],
128-
AS_HELP_STRING([--disable-p11-kit], [Disable p11-kit integration]),
129-
[use_p11kit=$enableval], [use_p11kit=yes])
130-
131-
pk_module_configs=
132-
if test "x${use_p11kit}" != "xno"; then
133-
AC_PATH_PROG(PKGCONFIG, [pkg-config])
134-
if test "x${PKGCONFIG}" != "x" && ${PKGCONFIG} --exists p11-kit-1; then
135-
pk_module_configs=`${PKGCONFIG} --variable=p11_module_configs p11-kit-1`
136-
fi
137-
fi
138-
AM_CONDITIONAL([P11_MODULE_FILE], [test "x${pk_module_configs}" != "x"])
129+
default_softhsm2_lib="$full_libdir/libsofthsm2.so"
139130

140131
# For getConfigPath()
141132
AC_CHECK_FUNCS([getpwuid_r])
@@ -183,13 +174,13 @@ AC_DEFINE_UNQUOTED(
183174
)
184175
AC_DEFINE_UNQUOTED(
185176
[DEFAULT_PKCS11_LIB],
186-
["$full_libdir/libsofthsm2.so"],
177+
["$default_softhsm2_lib"],
187178
[The default PKCS#11 library]
188179
)
189180

190-
AC_SUBST([pk_module_configs])
191181
AC_SUBST([softhsmtokendir])
192182
AC_SUBST([default_softhsm2_conf])
183+
AC_SUBST([default_softhsm2_lib])
193184

194185
# Generate the libtool script and install script
195186
AC_PROG_INSTALL

‎m4/acx_p11kit.m4

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
AC_DEFUN([ACX_P11KIT],[
2+
AC_ARG_ENABLE([p11-kit],
3+
AC_HELP_STRING([--enable-p11-kit],
4+
[Enable p11-kit integration (default enabled)]
5+
),
6+
[enable_p11kit="${enableval}"],
7+
[enable_p11kit="yes"]
8+
)
9+
10+
AC_ARG_WITH(p11-kit,
11+
AC_HELP_STRING([--with-p11-kit=PATH],[Specify install path of the p11-kit module, will override path given by pkg-config]),
12+
[P11KIT_PATH="$withval"],
13+
[P11KIT_PATH=""]
14+
)
15+
16+
AC_MSG_CHECKING(for p11-kit integration)
17+
if test "x${enable_p11kit}" = "xyes"; then
18+
AC_MSG_RESULT(yes)
19+
if test "x${P11KIT_PATH}" = "x"; then
20+
AC_PATH_PROG(PKGCONFIG, [pkg-config])
21+
if test "x${PKGCONFIG}" != "x" && ${PKGCONFIG} --exists p11-kit-1; then
22+
P11KIT_PATH=`${PKGCONFIG} --variable=p11_module_configs p11-kit-1`
23+
fi
24+
fi
25+
AC_MSG_CHECKING(where to install the p11-kit module)
26+
AC_MSG_RESULT($P11KIT_PATH)
27+
if test "x${P11KIT_PATH}" = "x"; then
28+
AC_MSG_ERROR([Missing install path for the p11-kit module])
29+
fi
30+
else
31+
AC_MSG_RESULT(no)
32+
fi
33+
34+
AC_SUBST(P11KIT_PATH)
35+
AM_CONDITIONAL([WITH_P11KIT], [test "x${enable_p11kit}" = "xyes"])
36+
])

‎softhsm2.module.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# This file describes how to load the pk11 module
22
# See: http://p11-glue.freedesktop.org/doc/p11-kit/config.html
33

4-
module: @libdir@/libsofthsm2.so
4+
module: @default_softhsm2_lib@

‎testing/build-softhsm2.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ case "$DISTRIBUTION" in
2828
cd build &&
2929
../configure --prefix="$INSTALL_ROOT" \
3030
--disable-non-paged-memory \
31-
--disable-p11-kit \
31+
--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
3232
--with-migrate \
3333
--with-crypto-backend=botan \
3434
--with-botan="$INSTALL_ROOT" &&
@@ -46,7 +46,7 @@ case "$DISTRIBUTION" in
4646
cd build &&
4747
../configure --prefix="$INSTALL_ROOT" \
4848
--disable-non-paged-memory \
49-
--disable-p11-kit \
49+
--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
5050
--with-migrate \
5151
--with-crypto-backend=botan \
5252
--with-botan="$INSTALL_ROOT" \
@@ -66,6 +66,7 @@ case "$DISTRIBUTION" in
6666
cd build &&
6767
../configure --prefix="$INSTALL_ROOT" \
6868
--disable-non-paged-memory \
69+
--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
6970
--with-migrate \
7071
--with-crypto-backend=botan \
7172
--with-botan="$INSTALL_ROOT" \
@@ -85,7 +86,7 @@ case "$DISTRIBUTION" in
8586
cd build &&
8687
../configure --prefix="$INSTALL_ROOT" \
8788
--disable-non-paged-memory \
88-
--disable-p11-kit \
89+
--with-p11-kit="$INSTALL_ROOT/usr/local/share/p11-kit/modules" \
8990
--with-migrate \
9091
--with-crypto-backend=botan \
9192
--with-botan="$INSTALL_ROOT" &&

0 commit comments

Comments
 (0)
Please sign in to comment.