Remove win32 support in SoftHSMv2
[aaf/sshsm.git] / SoftHSMv2 / configure.ac
1 ##################
2 #                #
3 #    Version     #
4 #                #
5 ##################
6
7 # Program version
8
9 define([SOFTHSM_VERSION_MAJOR], [2])
10 define([SOFTHSM_VERSION_MINOR], [4])
11 define([SOFTHSM_VERSION_FIX], [0])
12 define([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
21 define([SOFTHSM_VERSION_CURRENT], [2])
22 define([SOFTHSM_VERSION_AGE], [1])
23 define([SOFTHSM_VERSION_REVISION], [4])
24
25 ##################
26 #                #
27 # Configure code #
28 #                #
29 ##################
30
31 # Init
32 AC_PREREQ(2.61)
33 AC_INIT([SoftHSM],[SOFTHSM_VERSION_MAJOR.SOFTHSM_VERSION_MINOR.SOFTHSM_VERSION_FIX[]PACKAGE_SUFFIX])
34 AC_CONFIG_HEADER([config.h])
35 AC_CONFIG_SRCDIR([src/Makefile.am])
36 AC_CONFIG_MACRO_DIR([m4])
37 AM_INIT_AUTOMAKE([foreign subdir-objects])
38 ACX_PREFIXHACK
39
40 # Version info for the library
41 VERSION_INFO="SOFTHSM_VERSION_CURRENT:SOFTHSM_VERSION_REVISION:SOFTHSM_VERSION_AGE"
42 AC_SUBST(VERSION_INFO)
43
44 # Checks for compilers
45 AC_PROG_CC
46 AC_PROG_CXX
47
48 # Compiler flags
49 ACX_PEDANTIC
50 ACX_STRICT
51 ACX_64BIT
52 AX_CXX_COMPILE_STDCXX_11([noext],[optional])
53
54 # Check for libraries (-ldl can be required by OpenSSL too)
55 ACX_DLOPEN
56
57 # Check for headers
58 AC_CHECK_HEADERS([pthread.h])
59
60 # What crypto backend to use and if we want to have support GOST
61 ACX_CRYPTO_BACKEND
62
63 # Non-paged memory for secure storage
64 ACX_NON_PAGED_MEMORY
65
66 # If the user want to have the migration tool
67 # Requires SQLite3
68 AC_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 )
75 AC_MSG_CHECKING(if building with softhsm2-migrate)
76 if test "x${build_migrate}" = "xyes"; then
77         AC_MSG_RESULT(yes)
78         ACX_YIELD
79 else
80         AC_MSG_RESULT(no)
81 fi
82 AM_CONDITIONAL([BUILD_MIGRATE], [test "x${build_migrate}" = "xyes"])
83
84 # If the user wants to have the database storage backend
85 AC_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 )
92 AC_MSG_CHECKING(if building database object store backend)
93 if 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         )
100 else
101         AC_MSG_RESULT(no)
102 fi
103 AM_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
106 AC_MSG_CHECKING(if SQLite3 required)
107 if test "x${build_migrate}" = "xyes" -o "x${build_objectstore_backend_db}" = "xyes"; then
108         AC_MSG_RESULT(yes)
109         ACX_SQLITE3
110 else
111         AC_MSG_RESULT(no)
112 fi
113
114 # Set visibility flags so only PKCS#11 entry points are exported
115 ACX_VISIBILITY
116
117 # If we should install the p11-kit module
118 ACX_P11KIT
119
120 # cppunit settings
121 ACX_CPPUNIT
122
123 # Set full directory paths
124 full_sysconfdir=`eval eval eval eval eval echo "${sysconfdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
125 full_localstatedir=`eval eval eval eval eval echo "${localstatedir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
126 full_libdir=`eval eval eval eval eval echo "${libdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
127 default_softhsm2_conf="`eval echo ${full_sysconfdir} | sed s,NONE,$ac_default_prefix,g`/softhsm2.conf"
128 softhsmtokendir=${full_localstatedir}/lib/softhsm/tokens/
129
130 # Install the library in a sub-directory
131 full_libdir="$full_libdir/softhsm"
132 libdir=$full_libdir
133 default_softhsm2_lib="$full_libdir/libsofthsm2.so"
134
135 # For getConfigPath()
136 AC_CHECK_FUNCS([getpwuid_r])
137
138 # Define some variables for the code
139 AC_DEFINE_UNQUOTED(
140         [VERSION_MAJOR],
141         [SOFTHSM_VERSION_MAJOR],
142         [SoftHSM major version number via PKCS#11]
143 )
144 AC_DEFINE_UNQUOTED(
145         [VERSION_MINOR],
146         [SOFTHSM_VERSION_MINOR],
147         [SoftHSM minor version number via PKCS#11]
148 )
149 AC_DEFINE_UNQUOTED(
150         [MAX_PIN_LEN],
151         [255],
152         [Maximum PIN length]
153 )
154 AC_DEFINE_UNQUOTED(
155         [MIN_PIN_LEN],
156         [4],
157         [Minimum PIN length]
158 )
159 AC_DEFINE_UNQUOTED(
160         [DEFAULT_SOFTHSM2_CONF],
161         ["$default_softhsm2_conf"],
162         [The default location of softhsm2.conf]
163 )
164 AC_DEFINE_UNQUOTED(
165         [DEFAULT_TOKENDIR],
166         ["$softhsmtokendir"],
167         [The default location of the token directory]
168 )
169 AC_DEFINE_UNQUOTED(
170         [DEFAULT_OBJECTSTORE_BACKEND],
171         ["file"],
172         [Default storage backend for token objects]
173 )
174 AC_DEFINE_UNQUOTED(
175         [DEFAULT_LOG_LEVEL],
176         ["INFO"],
177         [The default log level]
178 )
179 AC_DEFINE_UNQUOTED(
180         [DEFAULT_PKCS11_LIB],
181         ["$default_softhsm2_lib"],
182         [The default PKCS#11 library]
183 )
184
185 AC_SUBST([softhsmtokendir])
186 AC_SUBST([default_softhsm2_conf])
187 AC_SUBST([default_softhsm2_lib])
188
189 # Generate the libtool script and install script
190 AC_PROG_INSTALL
191 AC_PROG_LIBTOOL
192
193 # Generate the makefiles
194 AC_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
214         src/lib/test/Makefile
215         src/lib/test/softhsm2.conf
216         src/lib/test/softhsm2-alt.conf
217         src/lib/test/tokens/dummy
218         src/bin/Makefile
219         src/bin/common/Makefile
220         src/bin/dump/Makefile
221         src/bin/keyconv/Makefile
222         src/bin/migrate/Makefile
223         src/bin/util/Makefile
224 ])
225
226 AC_OUTPUT