-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure.in
396 lines (331 loc) · 10.2 KB
/
configure.in
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
dnl
dnl This file is part of GPKCS11.
dnl (c) 1999-2001 TC TrustCenter GmbH
dnl
dnl GPKCS11 is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl GPKCS11 is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with GPKCS11; see the file COPYING. If not, write to the Free
dnl Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA.
dnl
dnl RCSID: $Id$
dnl Source: $Source$
dnl Last Delta: $Date$ $Revision$ $Author$
dnl State: $State$ $Locker$
dnl NAME: configure.in
dnl SYNOPSIS: -
dnl DESCRIPTION: -
dnl FILES: -
dnl SEE/ALSO: -
dnl AUTHOR: lbe
dnl BUGS: -
dnl
dnl Process this file with autoconf to produce a configure script.
AC_INIT(gpkcs11_install.js)
AM_CONFIG_HEADER(conf.h)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(gpkcs11, 0.8.0)
dnl global package information
PACKAGE=gpkcs11
AC_DEFINE(CRYPTOKI_VERSION_MAJOR,2,[major version number of cryptoki that this implements])
AC_DEFINE(CRYPTOKI_VERSION_MINOR,11,[minor version number of cryptoki that this implements])
dnl too bad that the automake version is a string
dnl maybe we can split it appart to make the below settings automagically.
AC_DEFINE(LIBRARY_VERSION_MAJOR,0,[major version number of gpkcs11])
AC_DEFINE(LIBRARY_VERSION_MINOR,8,[minor version number of gpkcs11])
AC_DEFINE(TC_LIB_VERSION,0,[patch level of gpkcs11])
dnl configure architecture support in cryptoki.h
if test $host_os = "cygwin32" ; then
AC_DEFINE(CK_Win32, 1)
else
AC_DEFINE(CK_GENERIC, 1)
fi
ARCH_TYPE=$target_os
AC_SUBST(ARCH_TYPE)
TARGET_ARCH=$target
AC_SUBST(TARGET_ARCH)
dnl Checks for programs.
AC_PROG_CC
dnl AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h sgtty.h sys/file.h sys/ioctl.h sys/time.h termio.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_STRUCT_TM
dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
dnl use pthread functions for mutexes?
AC_CHECK_HEADERS(pthread.h)
dnl check the existence of a upper limit to the number of signals
dnl this only works for linux and solaris
TC_CHECK_DEFINE(MAXSIG,signal.h,[
tc_max_sig_num="MAXSIG"
], [
TC_CHECK_DEFINE(_NSIG,signal.h,[
tc_max_sig_num="_NSIG"
], [
dnl this should be large enough for the important signals
tc_max_sig_num="99"
])
])
AC_DEFINE_UNQUOTED(MAX_SIG_NUM, $tc_max_sig_num , [ the maximum number of signals ])
AC_ARG_WITH(openssl_includes,[\
--with-openssl-includes=DIR set the directory for OpenSSL include headers
to DIR. (default is /usr/local/ssl/include) ],
[
OPENSSL_INCLUDES=$with_openssl_includes
] , [
OPENSSL_INCLUDES="/usr/local/ssl/includes"
])
AC_SUBST(OPENSSL_INCLUDES)
dnl ### configure the libtool ###
dnl some stuff is loaded dynamically at run-time
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
dnl #### check for functions in seperate libraries ####
dnl on linux socket() and all it relies on is in the libc
AC_CHECK_FUNC(socket, [
dnl just use the function from libc
], [
dnl use the separate libraries
AC_CHECK_LIB(posix4,_nanosleep)
AC_CHECK_LIB(nsl,gethostbyname)
AC_CHECK_LIB(socket,socket)
])
dnl ################### check where to find guile #################
AC_MSG_CHECKING([guile base])
AC_ARG_WITH(guile,[\
--with-guile[=DIR] set the base directory of the guile files to DIR
(default is no, if used DIR=/usr/local) ],
[
case "${withval}" in
yes)
use_guile=false
GUILE_BASE=/usr/local
;;
no)
use_guile=false
;;
*)
use_guile=true
GUILE_BASE="${withval}"
;;
esac
],[
use_guile=false
])
AM_CONDITIONAL(USE_GUILE, test x$use_guile = xtrue)
if test x$use_guile = xtrue
then
dnl only the libs that are relevant to all libraries and binaries
dnl are written into LIBS, the extra stuff is put into GUILE_LIBS
dnl save the LIBS for later
tc_all_libs="$LIBS"
AC_MSG_RESULT([$GUILE_BASE])
INCLUDES="$INCLUDES -I$GUILE_BASE/include"
AC_CHECK_LIB(curses,initscr)
AC_CHECK_LIB(readline,readline)
AC_CHECK_LIB(guile,gh_enter)
AC_CHECK_LIB(dl,dlopen)
GUILE_LIBS="$LIBS"
LIBS="$tc_all_libs"
AC_SUBST(GUILE_LIBS)
fi
dnl ##################### check for a system gdbm library ############
AC_ARG_WITH(system-gdbm,
[ --with-system-gdbm Use an allready installed gdbm library],
[
case "${withval}" in
yes)
use_own_gdbm=false
;;
no)
use_own_gdbm=true
;;
*) AC_MSG_ERROR(bad value ${withval} for --with-system-gdbm)
;;
esac
],[
use_own_gdbm=true
])
AM_CONDITIONAL(USE_OWN_GDBM, test x$use_own_gdbm = xtrue)
if test x$use_own_gdbm = xtrue
then
AC_CONFIG_SUBDIRS(gdbm-1.8.0)
fi
dnl #################### figure out what threading to use ##############
dnl allways compile this stuff prepared for threading
CFLAGS="${CFLAGS} -D_REENTRANT"
AC_ARG_WITH(thread,
[ --with-thread=TYPE which threading library to use. Default is off,
yes equals pthread. Currently supported are: none,
pthread.],
[
case "${withval}" in
yes | pthread)
AC_CHECK_LIB(pthread,pthread_create)
AC_DEFINE(HAVE_THREADING,1, [Threads are activated, C_WaitForSlotEvent will work.])
;;
no | none)
;;
*) AC_MSG_ERROR(bad value ${withval} for --with-thread)
;;
esac
],[
AC_MSG_RESULT(threading deactivated)
])
AC_SUBST(THREADOBJS)
dnl ################ determine which token to use #############
echo "Selecting Token:"
dnl ceay-token
AC_ARG_ENABLE(ceay-token, [\
--enable-ceay-token Use the Software-Token based on the Crypto-Library
by the OpenSSL Group ],
[
case "${enableval}" in
yes)
use_ceay_token=true
AC_MSG_RESULT([ ceay-token used])
TOKEN_LIST="ceay $TOKEN_LIST"
;;
no)
use_ceay_token=false
AC_MSG_RESULT([ ceay-token not used])
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-ceay-token)
;;
esac
], [
use_ceay_token=false
AC_MSG_RESULT([ ceay-token not used])
])
dnl tcsc-token
AC_ARG_ENABLE(tcsc-token, [\
--enable-tcsc-token Use the TC SCard Library to access different
SmartCards by various vendors. This requires thread support],
[
case "${enableval}" in
yes)
use_tcsc_token=true
AC_CHECK_LIB(tc_scard,SCard_GetContext)
AC_MSG_RESULT([ tcsc-token used])
TOKEN_LIST="tcsc $TOKEN_LIST"
;;
no)
use_tcsc_token=false
AC_MSG_RESULT([ tcsc-token not used])
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-tcsc-token)
;;
esac
], [
use_tcsc_token=false
AC_MSG_RESULT([ tcsc-token not used])
])
dnl data-token
AC_ARG_ENABLE(data-token, [\
--enable-data-token Use the TC SCard Library to access different
SmartCards by various vendors ],
[
case "${enableval}" in
yes)
use_data_token=true
AC_MSG_RESULT([ data-token used])
TOKEN_LIST="data $TOKEN_LIST"
# We need threads
AC_CHECK_LIB(pthread,pthread_create)
LIBOBJS="$LIBOBJS thread.o"
AC_DEFINE(HAVE_THREADING,1, [Threads are activated, C_WaitForSlotEvent will work.])
INCLUDES="-D_REENTRANT $INCLUDES"
;;
no)
use_data_token=false
AC_MSG_RESULT([ data-token not used])
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-data-token)
;;
esac
], [
use_data_token=false
AC_MSG_RESULT([ data-token not used])
])
AM_CONDITIONAL(USE_CEAY_TOKEN, test x$use_ceay_token = xtrue)
AM_CONDITIONAL(USE_TCSC_TOKEN, test x$use_tcsc_token = xtrue)
AM_CONDITIONAL(USE_DATA_TOKEN, test x$use_data_token = xtrue)
dnl generate Token configuration
if test -z "$TOKEN_LIST" ; then
echo " *** No Token Selected! *** " ;
else
dnl generate the text for the token initialisation
for i in $TOKEN_LIST;
do
TOKEN_LIBS="$TOKEN_LIBS -l${i}_tok"
done
fi
dnl ###################### enable use openssl+pkcs11 code ###########
dnl if the ceay token is used we have to find the proper openssl library
AC_CHECK_LIB(crypto,SHA1)
dnl ###################### enable use of purify ###################
dnl TC_GET_PURIFY
dnl ##################### check for the JAVA path ###############
AC_ARG_WITH(java_bin, [\
--with-java-bin=DIR set the bin directory where to look for the java
compiler and virtual machine.
(default is '/usr/local/java/bin') ],
[
JAVA_BIN_DIR=$with_java_bin
] , [
JAVA_BIN_DIR=/usr/local/java/bin
])
AC_ARG_WITH(classpath, [\
--with-classpath=DIR set the CLASSPATH variable.
(default is current environment Variable) ],
[
CLASSPATH_COMMAND="-classpath $with_classpath"
] , [
CLASSPATH_COMMAND=""
])
AC_SUBST(CLASSPATH_COMMAND)
dnl check for the existence of the needed java tools and classes
AC_CHECK_TOOL(JAVAC, javac, /bin/true, "$PATH:$JAVA_BIN_DIR")
dnl #### perform substitutions ####
AC_SUBST(PACKAGE)
AC_SUBST(SSLEAY_DIR)
AC_SUBST(GUILE_BASE)
AC_SUBST(PURIFY_DIR)
AC_SUBST(TOKEN_TARGETS)
AC_SUBST(TOKEN_LIBS)
AC_SUBST(INCLUDES)
dnl DLOPEN="-dlopen"
AC_SUBST(DLOPEN)
AC_SUBST(DLPREOPEN)
AC_SUBST(LIBS)
AC_SUBST(CFLAGS)
dnl the things that are commented out below are only used by TC inhouse
dnl AC_CONFIG_SUBDIRS(tools)
dnl AC_OUTPUT(./etc/Makefile ./docs/Makefile ./ceay_token/Makefile \
dnl ./cryptsh/Makefile ./libgpkcs11/Makefile ./Makefile \
dnl ./tests/Makefile ./tests/config/Makefile \
dnl ./tests/gpkcs11.base/Makefile \
dnl ./tcsc_token/Makefile ./data_token/Makefile)
AC_OUTPUT(./etc/Makefile ./docs/Makefile ./ceay_token/Makefile \
./cryptsh/Makefile ./libgpkcs11/Makefile ./Makefile \
./tests/Makefile ./tests/config/Makefile \
./tests/gpkcs11.base/Makefile )