1
1
dnl -*- mode: m4; -*-
2
dnl Process this file with autoconf to produce a configure script.
4
dnl Autoconf boilerplate/
5
AC_INIT(src/winscard.h)
6
AC_CONFIG_AUX_DIR(build)
8
dnl Default install dir
9
AC_PREFIX_DEFAULT(/usr/local/pcsc)
11
dnl Automake boilerplate.
13
AM_INIT_AUTOMAKE(pcsc-lite, 1.0.2.beta5)
2
dnl Process this file with autoconf to produce a configure script
4
# Require autoconf 2.52
8
AM_INIT_AUTOMAKE(pcsc-lite, 1.2.9-beta2)
14
9
AM_CONFIG_HEADER(config.h)
17
#AC_DISABLE_FAST_INSTALL
11
AC_CONFIG_SRCDIR(src/pcscdaemon.c)
13
AC_PREFIX_DEFAULT(/usr/local)
19
dnl Check for some target-specific stuff
22
CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED"
25
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
26
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
30
CPPFLAGS="$CPPFLAGS -DSUNOS4"
33
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
34
LDFLAGS="$LDFLAGS -L/usr/local/lib"
35
if (test "$LD" != "gcc" && test -z "$blibpath"); then
36
blibpath="/usr/lib:/lib:/usr/local/lib"
40
CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
43
AC_SUBST(COREFOUNDATION)
44
COREFOUNDATION="-Wl,-framework,CoreFoundation"
46
IOKIT="-Wl,-framework,IOKit"
47
if test "$GCC" = "yes"; then
48
CFLAGS="$CFLAGS -no-cpp-precomp"
21
dnl Select OS specific versions of source files.
23
linux-gnu) arch=linux ;;
25
*darwin*) arch=darwin ;;
26
*solaris*) arch=solaris ;;
28
*) AC_MSG_ERROR([Operating system ${build_os} not supported]) ;;
31
AM_CONDITIONAL(PCSC_ARCH_LINUX, test x$arch = xlinux)
32
AM_CONDITIONAL(PCSC_ARCH_BSD, test x$arch = xbsd)
33
AM_CONDITIONAL(PCSC_ARCH_OSX, test x$arch = xdarwin)
34
AM_CONDITIONAL(PCSC_ARCH_SOLARIS, test x$arch = xsolaris)
35
AM_CONDITIONAL(PCSC_ARCH_HPUX, test x$arch = xhpux)
37
if test x$arch = xlinux ; then
38
AC_DEFINE(PCSC_TARGET_LINUX, 1, [Linux])
41
if test x$arch = xbsd ; then
42
AC_DEFINE(PCSC_TARGET_BSD, 1, [BSD])
45
if test x$arch = xdarwin ; then
46
AC_DEFINE(PCSC_TARGET_OSX, 1, [OSX])
49
if test x$arch = xsolaris ; then
50
AC_DEFINE(PCSC_TARGET_SOLARIS, 1, [Solaris])
53
if test x$arch = xhpux ; then
54
AC_DEFINE(PCSC_TARGET_HPUX, 1, [HP-UX])
58
dnl Checks for programs.
56
dnl Checks for programs
62
AC_PATH_PROG(TEST_MINUS_S_SH, bash)
63
AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
64
AC_PATH_PROG(TEST_MINUS_S_SH, sh)
66
dnl Special check for pthread support.
66
dnl Special check for pthread support
69
AC_DEFINE(HAVE_PTHREAD,1,
69
AC_DEFINE(HAVE_PTHREAD, 1,
70
70
[Define if you have POSIX threads libraries and header files.])
72
72
AC_MSG_ERROR([POSIX thread support required])
75
LIBS="$PTHREAD_LIBS $LIBS"
76
CFLAGS="$CFLAGS -Wall -fno-common $PTHREAD_CFLAGS"
79
AC_CHECK_FUNCS(daemon)
82
dnl Add libtool support.
84
dnl Automatically update the libtool script if it becomes out-of-date.
85
AC_SUBST(LIBTOOL_DEPS)
87
dnl Checks for header files.
90
#AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)
92
dnl Checks for typedefs, structures, and compiler characteristics.
96
dnl Checks for library functions.
99
#AC_CHECK_FUNCS(gettimeofday strdup strtoul)
106
dnl --enable-usb option.
108
[ --enable-usb enable USB hotplug support (Linux only)],
109
[ case "${enableval}" in
111
case "${build_os}" in
112
linux-gnu) usb=true ;;
113
*) AC_MSG_WARN([USB hotplug support only available on Linux])
119
*) AC_MSG_ERROR([bad value ${enableval} for --enable-usb]) ;;
122
AC_MSG_RESULT([enable linux usb capability: $usb])
124
AM_CONDITIONAL(PCSC_LINUX_USB, test x$usb = xtrue)
75
dnl --enable-threadsafe
126
76
AC_ARG_ENABLE(threadsafe,
127
[ --enable-threadsafe enable client side thread safety.],
77
AC_HELP_STRING([--enable-threadsafe],[enable client side thread safety]),
128
78
[case "${enableval}" in
129
79
yes) threadsafe=true ;;
130
80
no) threadsafe=false ;;
131
81
*) AC_MSG_ERROR([bad value ${enableval} for --enable-threadsafe]) ;;
132
esac], [threadsafe=false])
134
AC_MSG_RESULT([enable threadsafe client : $threadsafe])
136
AM_CONDITIONAL(PCSC_THR_SAFE, test x$threadsafe = xtrue)
82
esac], [threadsafe=true])
84
if test x${threadsafe} = xtrue ; then
85
LIBS="$PTHREAD_LIBS $LIBS"
86
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
89
AC_SUBST(PTHREAD_LIBS)
90
AC_SUBST(PTHREAD_CFLAGS)
92
dnl Add libtool support
94
dnl Automatically update the libtool script if it becomes out-of-date
95
#AC_SUBST(LIBTOOL_DEPS)
97
dnl Checks for header files
100
AC_CHECK_HEADERS([dirent.h dl.h dlfcn.h errno.h fcntl.h getopt.h malloc.h stdlib.h string.h strings.h sys/filio.h sys/time.h syslog.h unistd.h smartcard/scf.h])
102
dnl Checks for typedefs, structures, and compiler characteristics
108
dnl Checks for library functions
109
AC_FUNC_ERROR_AT_LINE
112
AC_CHECK_FUNCS(daemon flock getopt_long nanosleep strerror strncpy vsnprintf)
114
dnl C Compiler features
116
if test "$GCC" = "yes"; then
117
CFLAGS="-Wall -fno-common $CFLAGS"
121
AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no)
123
dnl Use 'uname' output as an architecture define
130
AC_DEFINE_UNQUOTED(PCSC_ARCH, "$uname", [PC/SC target architecture])
132
dnl See if socket() is found from libsocket
133
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])
135
dnl Probe for a proper flex library
137
AC_CHECK_LIB(l, yywrap, [LIBFL="$LIBFL -ll"], AC_CHECK_LIB(fl, yywrap, [LIBFL="$LIBFL -lfl"]))
140
dnl --enable-libusb=DIR
141
AC_ARG_ENABLE(libusb,
142
AC_HELP_STRING([--enable-libusb=PATH],[enable USB hotplug using libusb]),
152
libusb_prefix=${enableval}
153
AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb" use_libusb=true ], [ use_libusb=false ], "-L${libusb_prefix}/lib")
154
AC_CHECK_HEADERS(${libusb_prefix}/include/usb.h, [ use_libusb=true ], [ use_libusb=false ])
155
if test x$use_libusb = xtrue; then
156
CPPFLAGS="$CPPFLAGS -I${libusb_prefix}/include"
157
LDFLAGS="$LDFLAGS -L${libusb_prefix}/lib"
164
dnl if use_libusb is not yet defined
165
if test x$use_libusb = x; then
166
dnl check if libusb is available
167
AC_CHECK_HEADERS(usb.h, [ use_libusb=true ], [ use_libusb=false ])
168
AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb" use_libusb=true ], [ use_libusb=false ])
171
AC_MSG_RESULT([enable libusb support : $use_libusb])
173
AM_CONDITIONAL(PCSC_USE_LIBUSB, test x$use_libusb = xtrue)
174
if test x$use_libusb = xtrue; then
175
AC_DEFINE(HAVE_LIBUSB,1, [Libusb is available])
178
dnl --enable-usbdropdir=DIR
179
AC_ARG_ENABLE(usbdropdir,
180
AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB
181
drivers (default /usr/local/pcsc/drivers)]),
182
[usbdropdir="${enableval}"], [usbdropdir=false])
183
if test x${usbdropdir} = xfalse ; then
184
usbdropdir="/usr/local/pcsc/drivers"
186
AC_MSG_RESULT([enable USB drop directory : $usbdropdir])
187
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers])
139
189
AC_ARG_ENABLE(debug,
140
[ --enable-debug enable debug messages from pcscd.],
190
AC_HELP_STRING([--enable-debug],[enable debug messages from pcscd]),
141
191
[ case "${enableval}" in
146
196
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
147
esac], [debug=false])
149
AC_MSG_RESULT([enable debug messages : $debug])
199
AC_MSG_RESULT([enable debug messages : $debug])
151
201
if test x${debug} = xtrue ; then
152
202
AC_DEFINE(PCSC_DEBUG, 1, [enable full PCSC debug messaging.])
203
AC_DEFINE(MSC_DEBUG, 1, [enable full MuscleCard debug messaging.])
206
dnl --enable-debugatr
156
207
AC_ARG_ENABLE(debugatr,
157
[ --enable-debugatr enable ATR debug messages from pcscd.],
208
AC_HELP_STRING([--enable-debugatr],[enable ATR debug messages from pcscd]),
158
209
[ case "${enableval}" in
159
210
yes) debugatr=true ;;
160
211
no) debugatr=false ;;
161
212
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debugatr]) ;;
162
213
esac], [debugatr=false])
164
AC_MSG_RESULT([enable ATR parsing messages: $debugatr])
215
AC_MSG_RESULT([enable ATR parsing messages : $debugatr])
166
217
if test x${debugatr} = xtrue ; then
167
218
AC_DEFINE(ATR_DEBUG, 1, [display ATR parsing debug messages.])
170
AC_ARG_ENABLE(syslog,
171
[ --enable-syslog send messages to syslog instead of stdout.],
172
[case "${enableval}" in
175
*) AC_MSG_ERROR([bad value ${enableval} for --enable-syslog]) ;;
176
esac], [syslog=false])
178
AC_MSG_RESULT([enable debug out to syslog : $syslog])
180
if test x${syslog} = xtrue ; then
181
AC_DEFINE(USE_SYSLOG, 1, [send messages to syslog instead of stdout])
185
AC_ARG_ENABLE(daemon,
186
[ --enable-daemon pcscd runs as a true daemon.],
187
[case "${enableval}" in
190
*) AC_MSG_ERROR([bad value ${enableval} for --enable-daemon]) ;;
191
esac], [daemon=false])
193
AC_MSG_RESULT([enable pcscd forked daemon : $daemon])
195
if test x${daemon} = xtrue ; then
196
AC_DEFINE(USE_DAEMON, 1, [pcsc runs as a daemon in the background.])
223
AC_HELP_STRING([--enable-scf],[use SCF for reader support]),
224
[ case "${enableval}" in
227
*) AC_MSG_ERROR([bad value ${enableval} for --enable-scf]) ;;
230
AC_SUBST(LIBSMARTCARD)
231
if test x$scf = xtrue -a x$ac_cv_header_smartcard_scf_h = xyes; then
232
AC_CHECK_LIB(smartcard, SCF_strerror, [LIBSMARTCARD="$LIBSMARTCARD -lsmartcard" scf=true], scf=false)
236
AC_MSG_RESULT([enable SCF reader support : $scf])
237
AM_CONDITIONAL(HAVE_SCF, test x$scf = xtrue)
239
dnl --disable-musclecard
240
AC_ARG_ENABLE(musclecard,
241
AC_HELP_STRING([--disable-musclecard],[MuscleCard framework disabled]),
242
[case "${enableval}" in
243
yes) musclecard=true ;;
244
no) musclecard=false ;;
245
*) AC_MSG_ERROR([bad value ${enableval} for --disable-musclecard]) ;;
246
esac], [musclecard=true])
248
AC_MSG_RESULT([enable MuscleCard : $musclecard])
250
AM_CONDITIONAL(HAVE_MUSCLECARD, test x$musclecard = xtrue)
252
dnl --enable-muscledropdir=DIR
253
AC_ARG_ENABLE(muscledropdir,
254
AC_HELP_STRING([--enable-muscledropdir=DIR],[directory containing
255
MuscleCard bundles (default /usr/local/pcsc/services)]),
256
[muscledropdir="${enableval}"], [muscledropdir=false])
257
if test x${muscledropdir} = xfalse ; then
258
muscledropdir="/usr/local/pcsc/services"
260
AC_MSG_RESULT([enable MuscleCard bundles dir : $muscledropdir])
261
AC_DEFINE_UNQUOTED(MSC_SVC_DROPDIR, "$muscledropdir", [directory containing MuscleCard bundles])
263
dnl --enable-confdir=DIR
200
264
AC_ARG_ENABLE(confdir,
201
[ --enable-confdir=DIR directory containing reader.conf (default /etc)],
265
AC_HELP_STRING([--enable-confdir=DIR],[directory containing reader.conf
202
267
[confdir="${enableval}"], [confdir=false])
204
269
if test x${confdir} != xfalse ; then
205
AC_MSG_RESULT([enable confdir : $confdir])
270
AC_MSG_RESULT([enable confdir : $confdir])
207
272
AC_DEFINE_UNQUOTED(USE_READER_CONF, "$confdir", [directory containing reader.conf (default /etc)])
209
AC_MSG_RESULT([enable confdir : /etc (default)])
275
AC_MSG_RESULT([enable confdir : /etc (default)])
278
dnl --enable-runpid=FILE
213
279
AC_ARG_ENABLE(runpid,
214
[ --enable-runpid=FILE file containing pcscd pid],
280
AC_HELP_STRING([--enable-runpid=FILE],[file containing pcscd pid]),
215
281
[runpid="${enableval}"], [runpid=false])
217
AC_MSG_RESULT([enable runpid : $runpid])
283
AC_MSG_RESULT([enable runpid : $runpid])
219
285
if test x${runpid} != xfalse ; then
220
286
AC_DEFINE_UNQUOTED(USE_RUN_PID, "$runpid", [file containing pcscd pid])
289
dnl --enable-ipcdir=DIR
290
AC_ARG_ENABLE(ipcdir,
291
AC_HELP_STRING([--enable-ipcdir=DIR],[directory containing IPC files
292
(default /var/run)]),
293
[ipcdir="${enableval}"], [ipcdir=false])
295
if test x${ipcdir} != xfalse ; then
296
AC_MSG_RESULT([enable ipcdir : $ipcdir])
298
AC_DEFINE_UNQUOTED(USE_IPCDIR, "$ipcdir", [directory containing IPC files (default /var/run)])
300
AC_MSG_RESULT([enable ipcdir : /var/run (default)])
303
AC_MSG_RESULT([enable threadsafe client : $threadsafe])
304
AM_CONDITIONAL(PCSC_THR_SAFE, test x$threadsafe = xtrue)
306
dnl --enable-extendedapdu
307
AC_ARG_ENABLE(extendedapdu,
308
AC_HELP_STRING([--enable-extendedapdu], [support of extended APDU (for APDU 256B < size < 32KB)]),
309
[ case "${enableval}" in
310
yes) extendedapdu=true ;;
311
no) extendedapdu=false ;;
312
*) AC_MSG_ERROR([bad value ${enableval} for --enable-extendedapdu]) ;;
313
esac], [extendedapdu=false])
315
AC_MSG_RESULT([enable extended APDU : $extendedapdu])
317
if test x${extendedapdu} = xtrue ; then
318
extended_apdu="#define PCSCLITE_ENHANCED_MESSAGING"
320
extended_apdu="#undef PCSCLITE_ENHANCED_MESSAGING"
323
dnl warning about pthread
224
324
if test x${threadsafe} = xtrue ; then
225
325
AC_MSG_RESULT([NOTE :: You must link pthread libraries with your app.])
226
326
AC_DEFINE(USE_THREAD_SAFETY, 1, [enable client side thread safety.])
230
AC_OUTPUT(Makefile src/Makefile src/utils/Makefile etc/Makefile doc/Makefile)
329
CPPFLAGS="-I\${top_srcdir}/src $CPPFLAGS"
332
AC_SUBST(muscledropdir)
336
AC_SUBST(extended_apdu)