blob: eb95bdd7dd502d292d57e26b2a5295ab5a3e5b0c [file] [log] [blame]
NingSun0c89b3c2018-02-08 08:34:03 -08001##################
2# #
3# Version #
4# #
NingSunda00ff62018-03-14 16:35:31 -07005##################
NingSun0c89b3c2018-02-08 08:34:03 -08006
7# Program version
8
9define([SOFTHSM_VERSION_MAJOR], [2])
NingSunda00ff62018-03-14 16:35:31 -070010define([SOFTHSM_VERSION_MINOR], [4])
NingSun0c89b3c2018-02-08 08:34:03 -080011define([SOFTHSM_VERSION_FIX], [0])
12define([PACKAGE_SUFFIX], [])
13
14# Library version
15
16# Code changed: SOFTHSM_VERSION_REVISION++
17# Interface added/removed/changed: SOFTHSM_VERSION_CURRENT++, SOFTHSM_VERSION_REVISION=0
18# Interface added: SOFTHSM_VERSION_AGE++
19# Interface removed: SOFTHSM_VERSION_AGE=0
20
21define([SOFTHSM_VERSION_CURRENT], [2])
22define([SOFTHSM_VERSION_AGE], [1])
NingSunda00ff62018-03-14 16:35:31 -070023define([SOFTHSM_VERSION_REVISION], [4])
NingSun0c89b3c2018-02-08 08:34:03 -080024
25##################
26# #
27# Configure code #
28# #
29##################
30
31# Init
32AC_PREREQ(2.61)
33AC_INIT([SoftHSM],[SOFTHSM_VERSION_MAJOR.SOFTHSM_VERSION_MINOR.SOFTHSM_VERSION_FIX[]PACKAGE_SUFFIX])
34AC_CONFIG_HEADER([config.h])
35AC_CONFIG_SRCDIR([src/Makefile.am])
36AC_CONFIG_MACRO_DIR([m4])
37AM_INIT_AUTOMAKE([foreign subdir-objects])
38ACX_PREFIXHACK
39
40# Version info for the library
41VERSION_INFO="SOFTHSM_VERSION_CURRENT:SOFTHSM_VERSION_REVISION:SOFTHSM_VERSION_AGE"
42AC_SUBST(VERSION_INFO)
43
44# Checks for compilers
45AC_PROG_CC
46AC_PROG_CXX
47
48# Compiler flags
49ACX_PEDANTIC
50ACX_STRICT
51ACX_64BIT
52AX_CXX_COMPILE_STDCXX_11([noext],[optional])
53
54# Check for libraries (-ldl can be required by OpenSSL too)
55ACX_DLOPEN
56
57# Check for headers
58AC_CHECK_HEADERS([pthread.h])
59
60# What crypto backend to use and if we want to have support GOST
61ACX_CRYPTO_BACKEND
62
63# Non-paged memory for secure storage
64ACX_NON_PAGED_MEMORY
65
66# If the user want to have the migration tool
67# Requires SQLite3
68AC_ARG_WITH(migrate,
69 AC_HELP_STRING([--with-migrate],
70 [Build the migration tool. Requires SQLite3.]
71 ),
72 [build_migrate="${withval}"],
73 [build_migrate="no"]
74)
75AC_MSG_CHECKING(if building with softhsm2-migrate)
76if test "x${build_migrate}" = "xyes"; then
77 AC_MSG_RESULT(yes)
78 ACX_YIELD
79else
80 AC_MSG_RESULT(no)
81fi
82AM_CONDITIONAL([BUILD_MIGRATE], [test "x${build_migrate}" = "xyes"])
83
84# If the user wants to have the database storage backend
85AC_ARG_WITH([objectstore-backend-db],
86 AC_HELP_STRING([--with-objectstore-backend-db],
87 [Build with object store backend database (SQLite3).]
88 ),
89 [build_objectstore_backend_db="${withval}"],
90 [build_objectstore_backend_db="no"]
91)
92AC_MSG_CHECKING(if building database object store backend)
93if test "x${build_objectstore_backend_db}" = "xyes"; then
94 AC_MSG_RESULT(yes)
95 AC_DEFINE_UNQUOTED(
96 [HAVE_OBJECTSTORE_BACKEND_DB],
97 [1],
98 [Build with object store database backend.]
99 )
100else
101 AC_MSG_RESULT(no)
102fi
103AM_CONDITIONAL([BUILD_OBJECTSTORE_BACKEND_DB], [test "x${build_objectstore_backend_db}" = "xyes"])
104
105# Require SQLite3 if either building --with-migrate or --with-objectstore-backend-db
106AC_MSG_CHECKING(if SQLite3 required)
107if test "x${build_migrate}" = "xyes" -o "x${build_objectstore_backend_db}" = "xyes"; then
108 AC_MSG_RESULT(yes)
109 ACX_SQLITE3
110else
111 AC_MSG_RESULT(no)
112fi
113
114# Set visibility flags so only PKCS#11 entry points are exported
115ACX_VISIBILITY
116
117# If we should install the p11-kit module
118ACX_P11KIT
119
120# cppunit settings
121ACX_CPPUNIT
122
123# Set full directory paths
124full_sysconfdir=`eval eval eval eval eval echo "${sysconfdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
125full_localstatedir=`eval eval eval eval eval echo "${localstatedir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
126full_libdir=`eval eval eval eval eval echo "${libdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
127default_softhsm2_conf="`eval echo ${full_sysconfdir} | sed s,NONE,$ac_default_prefix,g`/softhsm2.conf"
128softhsmtokendir=${full_localstatedir}/lib/softhsm/tokens/
129
130# Install the library in a sub-directory
131full_libdir="$full_libdir/softhsm"
132libdir=$full_libdir
133default_softhsm2_lib="$full_libdir/libsofthsm2.so"
134
135# For getConfigPath()
136AC_CHECK_FUNCS([getpwuid_r])
137
138# Define some variables for the code
139AC_DEFINE_UNQUOTED(
140 [VERSION_MAJOR],
141 [SOFTHSM_VERSION_MAJOR],
142 [SoftHSM major version number via PKCS#11]
143)
144AC_DEFINE_UNQUOTED(
145 [VERSION_MINOR],
146 [SOFTHSM_VERSION_MINOR],
147 [SoftHSM minor version number via PKCS#11]
148)
149AC_DEFINE_UNQUOTED(
150 [MAX_PIN_LEN],
151 [255],
152 [Maximum PIN length]
153)
154AC_DEFINE_UNQUOTED(
155 [MIN_PIN_LEN],
156 [4],
157 [Minimum PIN length]
158)
159AC_DEFINE_UNQUOTED(
160 [DEFAULT_SOFTHSM2_CONF],
161 ["$default_softhsm2_conf"],
162 [The default location of softhsm2.conf]
163)
164AC_DEFINE_UNQUOTED(
165 [DEFAULT_TOKENDIR],
166 ["$softhsmtokendir"],
167 [The default location of the token directory]
168)
169AC_DEFINE_UNQUOTED(
170 [DEFAULT_OBJECTSTORE_BACKEND],
171 ["file"],
172 [Default storage backend for token objects]
173)
174AC_DEFINE_UNQUOTED(
175 [DEFAULT_LOG_LEVEL],
176 ["INFO"],
177 [The default log level]
178)
179AC_DEFINE_UNQUOTED(
180 [DEFAULT_PKCS11_LIB],
181 ["$default_softhsm2_lib"],
182 [The default PKCS#11 library]
183)
184
185AC_SUBST([softhsmtokendir])
186AC_SUBST([default_softhsm2_conf])
187AC_SUBST([default_softhsm2_lib])
188
189# Generate the libtool script and install script
190AC_PROG_INSTALL
191AC_PROG_LIBTOOL
192
193# Generate the makefiles
194AC_CONFIG_FILES([
195 Makefile
196 softhsm2.module
197 src/Makefile
198 src/lib/Makefile
199 src/lib/common/Makefile
200 src/lib/common/softhsm2.conf
201 src/lib/common/softhsm2.conf.5
202 src/lib/crypto/Makefile
203 src/lib/crypto/test/Makefile
204 src/lib/data_mgr/Makefile
205 src/lib/data_mgr/test/Makefile
206 src/lib/object_store/Makefile
207 src/lib/object_store/test/Makefile
208 src/lib/session_mgr/Makefile
209 src/lib/session_mgr/test/Makefile
210 src/lib/slot_mgr/Makefile
211 src/lib/slot_mgr/test/Makefile
212 src/lib/handle_mgr/Makefile
213 src/lib/handle_mgr/test/Makefile
Pramod Raghavendra Jayathirth4ba28822018-03-27 09:24:56 -0700214 src/lib/HwInfra/Makefile
NingSun0c89b3c2018-02-08 08:34:03 -0800215 src/lib/test/Makefile
216 src/lib/test/softhsm2.conf
217 src/lib/test/softhsm2-alt.conf
218 src/lib/test/tokens/dummy
219 src/bin/Makefile
220 src/bin/common/Makefile
221 src/bin/dump/Makefile
222 src/bin/keyconv/Makefile
223 src/bin/migrate/Makefile
224 src/bin/util/Makefile
225])
226
227AC_OUTPUT