File: configure.in

package info (click to toggle)
ccid 1.3.11-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,716 kB
  • ctags: 897
  • sloc: sh: 10,390; ansic: 6,869; makefile: 318; lex: 160; perl: 113
file content (353 lines) | stat: -rw-r--r-- 10,080 bytes parent folder | download
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
# Process this file with autoconf to produce a configure script.
# You may need to use autoconf 2.56 or newer

# $Id: configure.in 4347 2009-07-28 20:52:50Z rousseau $

# Require autoconf 2.61
AC_PREREQ(2.61)

AC_INIT(ccid, 1.3.11)
AC_CONFIG_SRCDIR(src/ifdhandler.c)
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE(1.8 dist-bzip2 no-dist-gzip)

# Default install dir
AC_PREFIX_DEFAULT(/usr/local)

# Automake boilerplate.
AC_CANONICAL_HOST

# create a config.h file (Automake will add -DHAVE_CONFIG_H)
AM_CONFIG_HEADER(config.h)

# Options
AM_MAINTAINER_MODE

# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AM_PROG_LEX
PKG_PROG_PKG_CONFIG

# check pcsc-lite version
PCSC_NEEDED_VERSION="1.3.3"
PKG_CHECK_EXISTS([libpcsclite],
	[PKG_CHECK_MODULES(PCSC, libpcsclite >= $PCSC_NEEDED_VERSION, [],
	[
	if test -f /usr/local/lib/pkgconfig/libpcsclite.pc -a "x$PKG_CONFIG" != x ; then
		AC_MSG_ERROR([use PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure])
	  else
		AC_MSG_WARN([install pcsc-lite $PCSC_NEEDED_VERSION or later])
	  fi
	])],
	[AC_MSG_WARN([libpcsclite not found by pkg-config])]
)

saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PCSC_CFLAGS"
AC_CHECK_HEADER(ifdhandler.h,,
	[AC_MSG_ERROR([ifdhandler.h not found, install pcsc-lite $PCSC_NEEDED_VERSION or later, or use ./configure PCSC_CFLAGS=...])])
AC_CHECK_DECL(IFD_NO_SUCH_DEVICE,, [AC_MSG_ERROR([install pcsc-lite $PCSC_NEEDED_VERSION or later])], [#include <ifdhandler.h>])
AC_CHECK_DECLS(TAG_IFD_POLLING_THREAD,,, [#include <ifdhandler.h>])
AC_CHECK_HEADER(reader.h,,
	[AC_MSG_ERROR([reader.h not found, install pcsc-lite $PCSC_NEEDED_VERSION or later, or use ./configure PCSC_CFLAGS=...])])
CPPFLAGS="$saved_CPPFLAGS"

# Add libtool support.
AM_PROG_LIBTOOL

# Automatically update the libtool script if it becomes out-of-date.
AC_SUBST(LIBTOOL_DEPS)

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(errno.h fcntl.h stdlib.h unistd.h termios.h string.h errno.h sys/time.h sys/types.h stdarg.h arpa/inet.h,,
	[AC_MSG_ERROR([some header files not found])])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME

# Checks for library functions.
AC_CHECK_FUNCS(select strerror strncpy memcpy strlcpy strlcat)

# Select OS specific versions of source files.
AC_SUBST(BUNDLE_HOST)
AC_SUBST(DYN_LIB_EXT)
case "$host" in
*-*-darwin*)
	BUNDLE_HOST="MacOS"
	DYN_LIB_EXT="dylib"
	;;
*-*-freebsd*)
	BUNDLE_HOST="FreeBSD"
	DYN_LIB_EXT="so"
	;;
*-*-openbsd*)
	BUNDLE_HOST="OpenBSD"
	DYN_LIB_EXT="so.0.0"
	;;
*-*-solaris*)
	BUNDLE_HOST="Solaris"
	DYN_LIB_EXT="so"
	;;
*-*-dragonfly*)
	BUNDLE_HOST="DragonFly"
	DYN_LIB_EXT="so"
	;;
*)
	BUNDLE_HOST="Linux"
	DYN_LIB_EXT="so"
esac

# --disable-libusb
AC_ARG_ENABLE(libusb,
	AC_HELP_STRING([--disable-libusb],[do not use libusb]),
	[ use_libusb="${enableval}" ], [ use_libusb=yes ] )

use_usb_interrupt=no

# check if libusb is used
if test "x$use_libusb" != xno ; then
	PKG_CHECK_EXISTS([libusb], [
	PKG_CHECK_MODULES(LIBUSB, libusb, [],
		[
			AC_CHECK_PROG([LIBUSBCONFIG], [libusb-config], [yes])

			if test "$LIBUSBCONFIG" = "yes" ; then
				LIBUSB_CFLAGS="$LIBUSB_CFLAGS `libusb-config --cflags`"
				LIBUSB_LIBS="$LIBUSB_LIBS `libusb-config --libs`"
			else
				AC_MSG_WARN([libusb-config not found.])
			fi
		])
	])

	saved_CPPFLAGS="$CPPFLAGS"
	saved_LIBS="$LIBS"

	CPPFLAGS="$CPPFLAGS $LIBUSB_CFLAGS"
	LIBS="$LDFLAGS $LIBUSB_LIBS"

	AC_CHECK_HEADERS(usb.h, [],
		[ AC_MSG_ERROR([usb.h not found, install libusb or use ./configure LIBUSB_CFLAGS=...]) ])

	AC_MSG_CHECKING([for usb_init])
	AC_TRY_LINK_FUNC(usb_init, [ AC_MSG_RESULT([yes]) ],
		[ AC_MSG_ERROR([libusb not found, use ./configure LIBUSB_LIBS=...]) ])

	AC_MSG_CHECKING([for usb_interrupt_read])
	AC_TRY_LINK_FUNC(usb_interrupt_read, [ AC_MSG_RESULT([yes]) ],
		[ AC_MSG_ERROR([your libusb is too old. install version 0.1.12 or above]) ])

	AC_CHECK_FUNC(usb_detach_kernel_driver_np,
		[ AC_DEFINE(HAVE_USB_DETACH_KERNEL_DRIVER_NP, 1, [Define if usb_detach_kernel_driver_np() is available]) ])

	CPPFLAGS="$saved_CPPFLAGS"
	LIBS="$saved_LIBS"

	use_libusb=yes

	AC_MSG_CHECKING([if libusb is emulated by libusb-compat])
	a=`$PKG_CONFIG --variable=emulated libusb`
	if test "x$a" = "x1";
	then
		AC_MSG_RESULT([yes])
		use_usb_interrupt=yes
	else
		AC_MSG_RESULT([no])
	fi

fi
AC_SUBST(LIBUSB_CFLAGS)
AC_SUBST(LIBUSB_LIBS)
AM_CONDITIONAL(WITH_LIBUSB, test "${use_libusb}" != "no")

# --enable-usb-interrupt
AC_ARG_ENABLE(usb-interrupt,
	AC_HELP_STRING([--enable-usb-interrupt], [force the use of USB
	interrupt even with an old libusb]),
	[ use_usb_interrupt="${enableval}" ] )

if test "x$use_usb_interrupt" = xyes; then
	AC_DEFINE(USE_USB_INTERRUPT, 1, [use libusb usb_interrupt_read()
	instead of polling])
fi

# --enable-composite-as-multislot
use_composite_as_multislot=no
AC_ARG_ENABLE(composite-as-multislot,
	AC_HELP_STRING([--enable-composite-as-multislot],
		[composite device are seen as multi-slots]),
	[ use_composite_as_multislot="${enableval}" ] )

if test "x$use_composite_as_multislot" = xyes; then
	AC_DEFINE(USE_COMPOSITE_AS_MULTISLOT, 1, [composite device are seen as multi-slots])
fi

# check if the compiler support -fvisibility=hidden (GCC >= 4)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden"
AC_MSG_CHECKING([for -fvisibility=hidden])
AC_COMPILE_IFELSE([char foo;],
    [   AC_MSG_RESULT([yes])
        SYMBOL_VISIBILITY="-fvisibility=hidden" ],
    AC_MSG_RESULT([no]))
CFLAGS="$saved_CFLAGS"
AC_SUBST(SYMBOL_VISIBILITY)

# --disable-multi-thread
AC_ARG_ENABLE(multi-thread,
	AC_HELP_STRING([--disable-multi-thread],[disable multi threading]),
	[ multithread="${enableval}" ], [ multithread=yes ] )

if test "${multithread}" != no ; then
	ACX_PTHREAD(
		[ AC_DEFINE(HAVE_PTHREAD, 1,
			[Define if you have POSIX threads libraries and header files.])
	   	], [ AC_MSG_ERROR([POSIX thread support required]) ])

	multithread=yes
fi

# --enable-bundle=NAME
AC_ARG_ENABLE(bundle,
	AC_HELP_STRING([--enable-bundle=NAME],[bundle directory name
	(default ifd-ccid.bundle)]),
	[bundle="${enableval}"], [bundle=false])
if test "${bundle}" = false ; then
	bundle="ifd-ccid.bundle"
fi
AC_DEFINE_UNQUOTED(BUNDLE, "$bundle", [bundle directory name])

# --enable-usbdropdir=DIR
AC_ARG_ENABLE(usbdropdir,
	AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB
	drivers (default to pcscd config or $(prefix)/pcsc/drivers)]),
	[usbdropdir="${enableval}"], [usbdropdir=false])
if test "${usbdropdir}" = false ; then
	usbdropdir=`$PKG_CONFIG libpcsclite --variable=usbdropdir`
fi
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers])
if test "${usbdropdir}" = "" ; then
	AC_MSG_ERROR([use --enable-usbdropdir=DIR])
fi

# --enable-twinserial
AC_ARG_ENABLE(twinserial,
	AC_HELP_STRING([--enable-twinserial],[also compile and install the serial Twin driver]),
	[twinserial="${enableval}"], [twinserial=no])
AM_CONDITIONAL(WITH_TWIN_SERIAL, test "${twinserial}" != "no")

# --enable-ccidtwindir=DIR
AC_ARG_ENABLE(ccidtwindir,
	AC_HELP_STRING([--enable-ccidtwindir=DIR],[directory to install the
	serial Twin driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]),
	[ccidtwindir="${enableval}"], [ccidtwindir=false])
if test "${ccidtwindir}" = false ; then
	ccidtwindir=`$PKG_CONFIG libpcsclite --variable=usbdropdir`/serial
fi

# --disable-pcsclite
AC_ARG_ENABLE(pcsclite,
	AC_HELP_STRING([--disable-pcsclite],[do not use pcsc-lite debug support]),
	[ pcsclite="${enableval}" ], [ pcsclite=yes ] )

if test "${pcsclite}" != no ; then
	# check that pcsc-lite is installed
	OLD_LIBS="$LIBS"
	OLD_CFLAGS="$CFLAGS"
	LIBS="$LIBS $PCSC_LIBS"
	CFLAGS="$CFLAGS $PCSC_CFLAGS"
	AC_MSG_CHECKING([for SCardEstablishContext])
	AC_TRY_LINK_FUNC(SCardEstablishContext,
	    [ AC_MSG_RESULT([yes]) ],
		[ AC_MSG_ERROR([SCardEstablishContext() not found, install pcsc-lite 1.2.9-beta9 or later,or use PCSC_LIBS=...  ./configure]) ])
	LIBS="$OLD_LIBS"
	CFLAGS="$OLD_CFLAGS"

	pcsclite=yes
fi
AM_CONDITIONAL(WITHOUT_PCSC, test "${pcsclite}" != "yes")

# --enable-udev
AC_ARG_ENABLE(udev,
	AC_HELP_STRING([--enable-udev],[udev support for pcscd hotplug]),
	[udev="${enableval}"], [udev=no])
AM_CONDITIONAL(UDEV, test "${udev}" != "no")

# --disable-class
AC_ARG_ENABLE(class,
	AC_HELP_STRING([--disable-class],[remove the CCIDCLASSDRIVER from Info.plist]),
	[class="${enableval}"], [class=yes])
if test "${class}" != yes ; then
	NOCLASS="--no-class"
fi
AC_SUBST(NOCLASS)


# Setup dist stuff
AC_SUBST(ac_aux_dir)
AC_SUBST(bundle)
AC_SUBST(usbdropdir)
AC_SUBST(ccidtwindir)

cat << EOF

libccid has been configured with following options:

Version:             ${PACKAGE_VERSION}
User binaries:       $(eval eval eval echo "${bindir}")
Configuration files: $(eval eval eval echo "${sysconfdir}")


Host:                ${host}
Compiler:            ${CC}
Preprocessor flags:  ${CPPFLAGS}
Compiler flags:      ${CFLAGS}
Preprocessor flags:  ${CPPFLAGS}
Linker flags:        ${LDFLAGS}
Libraries:           ${LIBS}

PCSC_CFLAGS:         ${PCSC_CFLAGS}
PCSC_LIBS:           ${PCSC_LIBS}
PTHREAD_CFLAGS:      ${PTHREAD_CFLAGS}
PTHREAD_LIBS:        ${PTHREAD_LIBS}
BUNDLE_HOST:         ${BUNDLE_HOST}
DYN_LIB_EXT:         ${DYN_LIB_EXT}
LIBUSB_CFLAGS:       ${LIBUSB_CFLAGS}
LIBUSB_LIBS:         ${LIBUSB_LIBS}
SYMBOL_VISIBILITY:   ${SYMBOL_VISIBILITY}
NOCLASS:             ${NOCLASS}

libusb support:          ${use_libusb}
use USB interrupt:       ${use_usb_interrupt}
composite as multislot:  ${use_composite_as_multislot}
multi threading:         ${multithread}
bundle directory name:   ${bundle}
USB drop directory:      ${usbdropdir}
serial Twin support:     ${twinserial}
serial twin install dir: ${ccidtwindir}
compiled for pcsc-lite:  ${pcsclite}
udev support:            ${udev}
class driver:            ${class}

EOF

# Write Makefiles.
AC_CONFIG_FILES(Makefile
	m4/Makefile
	src/Makefile
	readers/Makefile
	contrib/Makefile
	contrib/Kobil_mIDentity_switch/Makefile
	contrib/RSA_SecurID/Makefile
	examples/Makefile)

AC_OUTPUT