forked from softhsm/SoftHSMv1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
179 lines (155 loc) · 4.18 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
##################
# #
# Version #
# #
################
# Program version
define([SOFTHSM_VERSION_MAJOR], [1])
define([SOFTHSM_VERSION_MINOR], [3])
define([SOFTHSM_VERSION_FIX], [7])
define([PACKAGE_SUFFIX], [])
# Library version
# Code changed: SOFTHSM_VERSION_REVISION++
# Interface added/removed/changed: SOFTHSM_VERSION_CURRENT++, SOFTHSM_VERSION_REVISION=0
# Interface added: SOFTHSM_VERSION_AGE++
# Interface removed: SOFTHSM_VERSION_AGE=0
define([SOFTHSM_VERSION_CURRENT], [1])
define([SOFTHSM_VERSION_AGE], [0])
define([SOFTHSM_VERSION_REVISION], [11])
##################
# #
# Configure code #
# #
##################
# Init
AC_PREREQ(2.61)
AC_INIT([SoftHSM],[SOFTHSM_VERSION_MAJOR.SOFTHSM_VERSION_MINOR.SOFTHSM_VERSION_FIX[]PACKAGE_SUFFIX])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([src/Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(foreign)
ACX_PREFIXHACK
# Version info for the library
VERSION_INFO="SOFTHSM_VERSION_CURRENT:SOFTHSM_VERSION_REVISION:SOFTHSM_VERSION_AGE"
AC_SUBST(VERSION_INFO)
# Checks for compilers
AC_PROG_CXX
AC_PROG_CC
ACX_PEDANTIC
ACX_STRICT
# Do not give warnings for long-long. So that we can build with newer SQLite3
CPPFLAGS="${CPPFLAGS} -Wno-long-long"
# Configure arguments
AC_ARG_WITH(
[loglevel],
[AS_HELP_STRING([--with-loglevel=INT],[The log level. 0=No log 1=Error 2=Warning 3=Info 4=Debug (default INT=3)])],
[SOFTLOGLEVEL="$withval"],
[SOFTLOGLEVEL=3]
)
ACX_64BIT
# Check for library include arguments
ACX_BOTAN
ACX_LIBSQLITE3
ACX_DLOPEN
YIELD_LIB=
dnl Solaris has sched_yield in librt, not in libpthread or libc.
AC_CHECK_LIB(rt, sched_yield, [YIELD_LIB=-lrt],
[dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt.
AC_CHECK_LIB(posix4, sched_yield, [YIELD_LIB=-lposix4])])
AC_SUBST([YIELD_LIB])
AC_CHECK_FUNCS(getpassphrase)
AC_CHECK_HEADERS([sys/time.h dlfcn.h pthread.h syslog.h], [], [],
[[#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
]])
# Set full directory paths
full_sysconfdir=`eval eval eval eval eval echo "${sysconfdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
full_localstatedir=`eval eval eval eval eval echo "${localstatedir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
full_libdir=`eval eval eval eval eval echo "${libdir}" | sed "s#NONE#${prefix}#" | sed "s#NONE#${ac_default_prefix}#"`
default_softhsm_conf="`eval echo ${full_sysconfdir} | sed s,NONE,$ac_default_prefix,g`/softhsm.conf"
# Install the library in a sub-directory
full_libdir="$full_libdir/softhsm"
libdir=$full_libdir
# Define some variables for the code
AC_DEFINE_UNQUOTED(
[VERSION_MAJOR],
[SOFTHSM_VERSION_MAJOR],
[SoftHSM version number via PKCS#11]
)
AC_DEFINE_UNQUOTED(
[VERSION_MINOR],
[SOFTHSM_VERSION_MINOR],
[SoftHSM version number via PKCS#11]
)
AC_DEFINE_UNQUOTED(
[SOFTLOGLEVEL],
[$SOFTLOGLEVEL],
[The log level set by the user]
)
AC_DEFINE_UNQUOTED(
[MAX_SESSION_COUNT],
[256],
[Maximum number of concurrent sessions]
)
AC_DEFINE_UNQUOTED(
[MAX_PIN_LEN],
[255],
[Maximum PIN length]
)
AC_DEFINE_UNQUOTED(
[MIN_PIN_LEN],
[4],
[Minimum PIN length]
)
AC_DEFINE_UNQUOTED(
[DEFAULT_SOFTHSM_CONF],
["$default_softhsm_conf"],
[The default location of softhsm.conf]
)
# Host specific configuration
AC_CANONICAL_HOST
case "${host}" in
*-*-winnt* | *-*-mingw* | *-*-cygwin*)
AC_DEFINE_UNQUOTED(
[DEFAULT_PKCS11_LIB],
["$full_libdir/libsofthsm.dll"],
[The default PKCS#11 library]
)
;;
*)
AC_DEFINE_UNQUOTED(
[DEFAULT_PKCS11_LIB],
["$full_libdir/libsofthsm.so"],
[The default PKCS#11 library]
)
;;
esac
# Generate the libtool script and install script
AC_PROG_INSTALL
ifdef(
[LT_INIT],
[
LT_INIT([win32-dll])
LT_LANG([Windows Resource])
],
[
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
]
)
softhsmdbdir=${full_localstatedir}/lib/softhsm
AC_SUBST([softhsmdbdir])
AC_SUBST([default_softhsm_conf])
# Generate the make files
AC_CONFIG_FILES([
Makefile
src/Makefile
src/lib/Makefile
src/bin/Makefile
checks/Makefile
softhsm.conf
softhsm.conf.5
src/bin/softhsm.1
])
AC_OUTPUT