Fix issue: Softhsm-daemon leaks memory when certificate is stored
[keystone-linux/ti-softhsmv2.git] / configure.ac
1 dnl
2 dnl $Id: configure.ac 6757 2012-10-22 19:40:31Z rb $
3 dnl
5 ##################
6 #                #
7 #    Version     #
8 #                #
9 ################
11 # Program version
13 define([SOFTHSM_VERSION_MAJOR], [2])
14 define([SOFTHSM_VERSION_MINOR], [0])
15 define([SOFTHSM_VERSION_FIX], [0])
16 define([PACKAGE_SUFFIX], [a1])
18 # Library version
20 # Code changed:                      SOFTHSM_VERSION_REVISION++
21 # Interface added/removed/changed:   SOFTHSM_VERSION_CURRENT++, SOFTHSM_VERSION_REVISION=0
22 # Interface added:                   SOFTHSM_VERSION_AGE++
23 # Interface removed:                 SOFTHSM_VERSION_AGE=0
25 define([SOFTHSM_VERSION_CURRENT], [2])
26 define([SOFTHSM_VERSION_AGE], [1])
27 define([SOFTHSM_VERSION_REVISION], [0])
29 ##################
30 #                #
31 # Configure code #
32 #                #
33 ##################
35 # Init
36 AC_PREREQ(2.61)
37 AC_INIT([SoftHSM],[SOFTHSM_VERSION_MAJOR.SOFTHSM_VERSION_MINOR.SOFTHSM_VERSION_FIX[]PACKAGE_SUFFIX])
38 AC_CONFIG_HEADER([config.h])
39 AC_CONFIG_SRCDIR([src/Makefile.am])
40 AC_CONFIG_MACRO_DIR([m4])
41 AM_INIT_AUTOMAKE(foreign)
42 ACX_PREFIXHACK
44 # Version info for the library
45 VERSION_INFO="SOFTHSM_VERSION_CURRENT:SOFTHSM_VERSION_REVISION:SOFTHSM_VERSION_AGE"
46 AC_SUBST(VERSION_INFO)
48 # Checks for compilers
49 AC_PROG_CC
50 AC_PROG_CXX
52 # Compiler flags
53 ACX_PEDANTIC
54 ACX_STRICT
56 # What crypto backend to use and if we want to have support GOST
57 ACX_CRYPTO_BACKEND
59 # Non-paged memory for secure storage
60 ACX_NON_PAGED_MEMORY
62 # Log level
63 AC_ARG_WITH(
64         [loglevel],
65         [AS_HELP_STRING([--with-loglevel=INT],[The log level. 0=No log 1=Error 2=Warning 3=Info 4=Debug (default INT=3)])],
66         [SOFTLOGLEVEL="$withval"],
67         [SOFTLOGLEVEL=3]
68 )
70 # If the user want to have the migration tool
71 # Requires SQLite3
72 AC_ARG_WITH(migrate,
73         AC_HELP_STRING([--with-migrate],
74                 [Build the migration tool. Requires SQLite3.]
75         ),
76         [build_migrate="${withval}"],
77         [build_migrate="no"]
78 )
79 AC_MSG_CHECKING(if building with softhsm-migrate)
80 if test "x${build_migrate}" = "xyes"; then
81         AC_MSG_RESULT(yes)
82         ACX_SQLITE3
83         ACX_YIELD
84 else
85         AC_MSG_RESULT(no)
86 fi
87 AM_CONDITIONAL([BUILD_MIGRATE], [test "x${build_migrate}" = "xyes"])
89 # Check for libraries
90 ACX_DLOPEN
91 ACX_SEMAPHORE
92 ACX_ZLIB(1.2.7)
93 # Check for headers
94 AC_CHECK_HEADERS([pthread.h])
96 # Set full directory paths
97 full_sysconfdir=`eval eval eval eval eval echo "${sysconfdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
98 full_localstatedir=`eval eval eval eval eval echo "${localstatedir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
99 full_libdir=`eval eval eval eval eval echo "${libdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
100 default_softhsm2_conf="`eval echo ${full_sysconfdir} | sed s,NONE,$ac_default_prefix,g`/softhsm2.conf"
101 # softhsmtokendir=${full_localstatedir}/lib/softhsm/tokens
102 softhsmserversock=/var/run/softhsm/server_sock
103 softhsmclientsock=/var/run/softhsm/client_sock
104 secstorekeyaddr=0x0c000000
105 secstorekeysize=0x20
106 secstorememaddr=0x0c000020
107 secstorememsize=0xffe0
108 secstorefile0=/mnt/securedbv0/securedb
109 secstorefile1=/mnt/securedbv1/securedb
110 internal_ossl_heap=no
112 # Install the library in a sub-directory
113 full_libdir="$full_libdir/softhsm"
114 libdir=$full_libdir
116 # Define some variables for the code
117 AC_DEFINE_UNQUOTED(
118         [VERSION_MAJOR],
119         [SOFTHSM_VERSION_MAJOR],
120         [SoftHSM major version number via PKCS#11]
122 AC_DEFINE_UNQUOTED(
123         [VERSION_MINOR],
124         [SOFTHSM_VERSION_MINOR],
125         [SoftHSM minor version number via PKCS#11]
127 AC_DEFINE_UNQUOTED(
128         [SOFTLOGLEVEL],
129         [$SOFTLOGLEVEL],
130         [The log level set by the user]
132 AC_DEFINE_UNQUOTED(
133         [MAX_PIN_LEN],
134         [255],
135         [Maximum PIN length]
137 AC_DEFINE_UNQUOTED(
138         [MIN_PIN_LEN],
139         [4],
140         [Minimum PIN length]
142 AC_DEFINE_UNQUOTED(
143         [DEFAULT_SOFTHSM2_CONF],
144         ["$default_softhsm2_conf"],
145         [The default location of softhsm2.conf]
147 AC_DEFINE_UNQUOTED(
148         [DEFAULT_PKCS11_LIB],
149         ["$full_libdir/libsofthsm.so"],
150         [The default PKCS#11 library]
152 AC_DEFINE_UNQUOTED(
153         [DEFAULT_SERVERSOCK],
154         ["$softhsmserversock"],
155         [The default unix socket name for softHSM daemon ]
157 AC_DEFINE_UNQUOTED(
158         [DEFAULT_CLIENTSOCK],
159         ["$softhsmclientsock"],
160         [The default unix socket name prefix for softHSM client ]
162 AC_DEFINE_UNQUOTED(
163         [DEFAULT_SECSTORE_KEYADDR],
164         ["$secstorekeyaddr"],
165         [The default secure database key location ]
167 AC_DEFINE_UNQUOTED(
168         [DEFAULT_SECSTORE_KEYSIZE],
169         ["$secstorekeysize"],
170         [The default secure database key size ]
172 AC_DEFINE_UNQUOTED(
173         [DEFAULT_SECSTORE_MEMADDR],
174         ["$secstorememaddr"],
175         [The default secure database base address ]
177 AC_DEFINE_UNQUOTED(
178         [DEFAULT_SECSTORE_MEMSIZE],
179         ["$secstorememsize"],
180         [The default secure database maximum length ]
182 AC_DEFINE_UNQUOTED(
183         [DEFAULT_SECSTORE_FILE0],
184         ["$secstorefile0"],
185         [The default secure store ubifs volume 0 for reduncancy level 2 ]
187 AC_DEFINE_UNQUOTED(
188         [DEFAULT_SECSTORE_FILE1],
189         ["$secstorefile1"],
190         [The default secure store ubifs volume 1 for reduncancy level 2 ]
192 AC_DEFINE_UNQUOTED(
193         [DEFAULT_OSSL_HEAP_FLAG],
194         ["$internal_ossl_heap"],
195         [Use internal memory for Openssl dynamic allocations]
198 AC_SUBST([default_softhsm2_conf])
199 AC_SUBST([softhsmserversock])
200 AC_SUBST([softhsmclientsock])
201 AC_SUBST([secstorekeyaddr])
202 AC_SUBST([secstorekeysize])
203 AC_SUBST([secstorememaddr])
204 AC_SUBST([secstorememsize])
205 AC_SUBST([secstorefile0])
206 AC_SUBST([secstorefile1])
207 AC_SUBST([internal_ossl_heap])
209 # Generate the libtool script and install script
210 AC_PROG_INSTALL
211 AC_PROG_LIBTOOL
213 # Generate the makefiles
214 AC_CONFIG_FILES([
215         Makefile
216         src/Makefile
217         src/lib/Makefile
218         src/lib/common/Makefile
219         src/lib/common/softhsm2.conf
220         src/lib/common/softhsm2.conf.5
221         src/lib/crypto/Makefile
222         src/lib/crypto/test/Makefile
223         src/lib/data_mgr/Makefile
224         src/lib/data_mgr/test/Makefile
225         src/lib/object_store/Makefile
226         src/lib/object_store/test/Makefile
227         src/lib/session_mgr/Makefile
228         src/lib/session_mgr/test/Makefile
229         src/lib/slot_mgr/Makefile
230         src/lib/slot_mgr/test/Makefile
231         src/lib/handle_mgr/Makefile
232         src/lib/handle_mgr/test/Makefile
233         src/lib/test/Makefile
234         src/lib/test/softhsm2.conf
235         src/lib/test/tokens/dummy
236         src/bin/Makefile
237         src/bin/common/Makefile
238         src/bin/keyconv/Makefile
239         src/bin/migrate/Makefile
240         src/bin/util/Makefile
241         src/bin/daemon/Makefile
242         src/lib/msg_handler/Makefile
243         src/lib/client/Makefile
244 ])
246 AC_OUTPUT