forked from dengert/libp11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
268 lines (231 loc) · 6.12 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
dnl -*- mode: m4; -*-
AC_PREREQ(2.60)
define([PACKAGE_VERSION_MAJOR], [0])
define([PACKAGE_VERSION_MINOR], [2])
define([PACKAGE_VERSION_FIX], [9])
define([PACKAGE_SUFFIX], [-svn])
AC_INIT([libp11],[PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX[]PACKAGE_SUFFIX])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}])
LIBP11_VERSION_MAJOR="PACKAGE_VERSION_MAJOR"
LIBP11_VERSION_MINOR="PACKAGE_VERSION_MINOR"
LIBP11_VERSION_FIX="PACKAGE_VERSION_FIX"
# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
# (Oldest interface removed: OLDEST++)
# (Interfaces added: CURRENT++, REVISION=0)
LIBP11_LT_CURRENT="4"
LIBP11_LT_OLDEST="2"
LIBP11_LT_REVISION="0"
LIBP11_LT_AGE="$((${LIBP11_LT_CURRENT}-${LIBP11_LT_OLDEST}))"
AC_CONFIG_SRCDIR([src/libp11.h])
AC_CANONICAL_HOST
AC_PROG_CC
PKG_PROG_PKG_CONFIG
AC_C_BIGENDIAN
AC_MSG_CHECKING([svn checkout])
if test -e "${srcdir}/packaged"; then
svn_checkout="no"
else
svn_checkout="yes"
fi
AC_MSG_RESULT([${svn_checkout}])
AC_ARG_WITH(
[cygwin-native],
[AS_HELP_STRING([--with-cygwin-native],[compile native win32])],
,
[with_cygwin_native="no"]
)
dnl Check for some target-specific stuff
test -z "${WIN32}" && WIN32="no"
test -z "${CYGWIN}" && CYGWIN="no"
case "${host}" in
*-mingw*|*-winnt*)
WIN32="yes"
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
WIN_LIBPREFIX="lib"
;;
*-cygwin*)
AC_MSG_CHECKING([cygwin mode to use])
CYGWIN="yes"
if test "${with_cygwin_native}" = "yes"; then
AC_MSG_RESULT([Using native win32])
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
CFLAGS="${CFLAGS} -mno-cygwin"
WIN32="yes"
else
AC_MSG_RESULT([Using cygwin])
CPPFLAGS="${CPPFLAGS} -DCRYPTOKI_FORCE_WIN32"
WIN_LIBPREFIX="cyg"
AC_DEFINE([USE_CYGWIN], [1], [Define if you are on Cygwin])
fi
;;
esac
AC_ARG_ENABLE(
[strict],
[AS_HELP_STRING([--enable-strict],[enable strict compile mode @<:@disabled@:>@])],
,
[enable_strict="no"]
)
AC_ARG_ENABLE(
[pedantic],
[AS_HELP_STRING([--enable-pedantic],[enable pedantic compile mode @<:@disabled@:>@])],
,
[enable_pedantic="no"]
)
AC_ARG_ENABLE(
[doc],
[AS_HELP_STRING([--enable-doc],[enable installation of documents @<:@disabled@:>@])],
,
[enable_doc="no"]
)
AC_ARG_ENABLE(
[api-doc],
[AS_HELP_STRING([--enable-api-doc],[enable generation and installation of api documents @<:@disabled@:>@])],
,
[enable_api_doc="no"]
)
AC_ARG_WITH(
[apidocdir],
[AS_HELP_STRING([--with-apidocdir],[put API documents at this directory @<:@HTMLDIR/api@:>@])],
[apidocdir="${with_apidocdir}"],
[apidocdir="\$(htmldir)/api"]
)
dnl Checks for programs.
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_SED
AC_PROG_MAKE_SET
dnl Add libtool support.
ifdef(
[LT_INIT],
[
LT_INIT([win32-dll])
LT_LANG([Windows Resource])
],
[
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_RC
AC_PROG_LIBTOOL
]
)
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([ \
errno.h fcntl.h malloc.h stdlib.h \
inttypes.h string.h strings.h sys/time.h \
unistd.h locale.h getopt.h dlfcn.h utmp.h \
])
AC_CHECK_PROGS([DOXYGEN],[doxygen])
test "${enable_api_doc}" = "yes" -a -z "${DOXYGEN}" && AC_MSG_ERROR([doxygen is required for api doc])
dnl These required for svn checkout
AC_ARG_VAR([XSLTPROC], [xsltproc utility])
AC_ARG_VAR([SVN], [subversion utility])
AC_ARG_VAR([WGET], [wget utility])
AC_ARG_VAR([WGET_OPTS], [wget options])
AC_ARG_VAR([TR], [tr utility])
AC_CHECK_PROGS([XSLTPROC],[xsltproc])
AC_CHECK_PROGS([SVN],[svn])
AC_CHECK_PROGS([WGET],[wget])
AC_CHECK_PROGS([TR],[tr])
test -z "${WGET_OPTS}" && WGET_OPTS="-nv"
dnl svn checkout dependencies
if test "${svn_checkout}" = "yes"; then
AC_MSG_CHECKING([XSLTPROC requirement])
if test -n "${XSLTPROC}"; then
AC_MSG_RESULT([ok])
else
if test "${enable_doc}" = "yes"; then
AC_MSG_ERROR([Missing XSLTPROC svn build with doc])
else
AC_MSG_WARN(["make dist" will not work])
fi
fi
AC_MSG_CHECKING([svn doc build dependencies])
if test -n "${SVN}" -a -n "${TR}" -a -n "${WGET}"; then
AC_MSG_RESULT([ok])
else
if test "${enable_doc}" = "yes"; then
AC_MSG_ERROR([Missing SVN, TR or WGET for svn doc build])
else
AC_MSG_WARN(["make dist" will not work])
fi
fi
fi
if test "${WIN32}" != "yes"; then
AC_CHECK_LIB(
[dl],
[dlopen],
,
[AC_MSG_ERROR([libdl required])]
)
fi
PKG_CHECK_MODULES(
[OPENSSL],
[libcrypto >= 0.9.7],
,
[PKG_CHECK_MODULES(
[OPENSSL],
[openssl >= 0.9.7],
,
[AC_CHECK_LIB(
[crypto],
[RSA_version],
[OPENSSL_LIBS="-lcrypto"],
[AC_MSG_ERROR([Cannot find OpenSSL])]
)]
)]
)
pkgconfigdir="\$(libdir)/pkgconfig"
AC_SUBST([pkgconfigdir])
AC_SUBST([apidocdir])
AC_SUBST([LIBP11_VERSION_MAJOR])
AC_SUBST([LIBP11_VERSION_MINOR])
AC_SUBST([LIBP11_VERSION_FIX])
AC_SUBST([LIBP11_LT_CURRENT])
AC_SUBST([LIBP11_LT_REVISION])
AC_SUBST([LIBP11_LT_AGE])
AC_SUBST([LIBP11_LT_OLDEST])
AC_SUBST([WIN_LIBPREFIX])
AM_CONDITIONAL([SVN_CHECKOUT], [test "${svn_checkout}" = "yes"])
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
AM_CONDITIONAL([CYGWIN], [test "${CYGWIN}" = "yes"])
AM_CONDITIONAL([ENABLE_DOC], [test "${enable_doc}" = "yes"])
AM_CONDITIONAL([ENABLE_API_DOC], [test "${enable_api_doc}" = "yes"])
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes";
CFLAGS="${CFLAGS} -pedantic"
fi
if test "${enable_strict}" = "yes"; then
CFLAGS="${CFLAGS} -Wall -Wextra"
fi
AC_CONFIG_FILES([
Makefile
src/Makefile
src/libp11.pc
src/versioninfo.rc
doc/Makefile
doc/doxygen.conf
doc/nonpersistent/Makefile
])
AC_OUTPUT
cat <<EOF
libp11 has been configured with the following options:
Version: ${PACKAGE_VERSION}
Libraries: $(eval eval eval echo "${libdir}")
doc support: ${enable_doc}
api doc support: ${enable_api_doc}
Host: ${host}
Compiler: ${CC}
Preprocessor flags: ${CPPFLAGS}
Compiler flags: ${CFLAGS}
Linker flags: ${LDFLAGS}
Libraries: ${LIBS}
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
OPENSSL_LIBS: ${OPENSSL_LIBS}
EOF