File: configure.in

package info (click to toggle)
pcsc-lite 1.8.4-1+deb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,472 kB
  • sloc: ansic: 13,182; sh: 11,636; python: 720; lex: 552; makefile: 203
file content (423 lines) | stat: -rw-r--r-- 11,453 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
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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# -*- mode: m4; -*-
# Process this file with autoconf to produce a configure script

AC_PREREQ([2.69])

AC_INIT([pcsc-lite],[1.8.4])
AC_CONFIG_SRCDIR(src/pcscdaemon.c)
AM_INIT_AUTOMAKE(1.8 dist-bzip2 no-dist-gzip)
AC_CONFIG_HEADERS([config.h])

AC_CONFIG_MACRO_DIR(m4)

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AC_CANONICAL_HOST
AC_PROG_CC
AC_C_BIGENDIAN

# Check for some target-specific stuff
case "$host" in
*-*-hpux*)
	CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED"
	;;
*-*-solaris*)
	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
	LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
	need_dash_r=1
	;;
*-*-sunos4*)
	CPPFLAGS="$CPPFLAGS -DSUNOS4"
	;;
*-*-aix*)
	CPPFLAGS="$CPPFLAGS -I/usr/local/include"
	LDFLAGS="$LDFLAGS -L/usr/local/lib"
	if (test "$LD" != "gcc" && test -z "$blibpath"); then
		blibpath="/usr/lib:/lib:/usr/local/lib"
	fi
	;;
*-*-osf*)
	CPPFLAGS="$CPPFLAGS -D_POSIX_PII_SOCKET"
	;;
*-*-darwin*)
	AC_SUBST(COREFOUNDATION)
	COREFOUNDATION="-Wl,-framework,CoreFoundation"
	AC_SUBST(IOKIT)
	IOKIT="-Wl,-framework,IOKit"
	if test "$GCC" = "yes"; then
		CFLAGS="$CFLAGS -no-cpp-precomp"
	fi
	use_libusb=no
	AC_MSG_WARN([libusb disabled on Darwin for pcsc-lite])
	;;
esac

# Options
AM_MAINTAINER_MODE

# Checks for programs
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_LEX
PKG_PROG_PKG_CONFIG
AM_PROG_CC_C_O
AM_PROG_AR

# Special check for pthread support
ACX_PTHREAD(
[
 AC_DEFINE(HAVE_PTHREAD, 1,
  [Define if you have POSIX threads libraries and header files.])
], [
 AC_MSG_ERROR([POSIX thread support required])
])

CC="$PTHREAD_CC"

AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)

# check for pthread_cancel()
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_CHECK_FUNCS(pthread_cancel)
CFLAGS="$saved_CFLAGS"

# Add libtool support
# Static lib is disabled by default. Use --enable-static if needed
LT_INIT(disable-static)
LT_INIT
# Automatically update the libtool script if it becomes out-of-date
#AC_SUBST(LIBTOOL_DEPS)

# Checks for header files
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([getopt.h sys/filio.h syslog.h dl.h fcntl.h ])

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

# Checks for library functions
AC_FUNC_ERROR_AT_LINE
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(daemon flock getopt_long nanosleep strerror vsnprintf)

# strlcpy, strlcat from OpenBSD
AC_CHECK_FUNCS(strlcpy strlcat)

# C Compiler features
AC_C_INLINE
if test "$GCC" = "yes"; then
	CFLAGS="-Wall -fno-common $CFLAGS"
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([AC_LANG_SOURCE([char foo;])],
	[	AC_MSG_RESULT([yes])
		SYMBOL_VISIBILITY="-fvisibility=hidden" ],
	AC_MSG_RESULT([no]))
CFLAGS="$saved_CFLAGS"
AC_SUBST(SYMBOL_VISIBILITY)

AC_SUBST(LIBDL)
AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no)

# Use 'uname' output as an architecture define
PCSC_ARCH=`uname | sed -e s,/,_,`
case "$PCSC_ARCH" in
Darwin)
	PCSC_ARCH=MacOS
	;;
SunOS)
	PCSC_ARCH=Solaris
	;;
esac
AC_DEFINE_UNQUOTED(PCSC_ARCH, "$PCSC_ARCH", [PC/SC target architecture])
PCSCLITE_FEATURES="${PCSCLITE_FEATURES} $PCSC_ARCH $host"

# See if socket() is found from libsocket
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])

# check for mq_getattr()
AC_CHECK_LIB(rt, mq_getattr, [LIBS="$LIBS -lrt"])

# --disable-serial
AC_ARG_ENABLE(serial,
	AS_HELP_STRING([--disable-serial],[do not use serial reader.conf file]),
	[ use_serial="${enableval}" ], [ use_serial="yes" ] )
AM_CONDITIONAL(ENABLE_SERIAL, test "$use_serial" != "no")
if test "$use_serial" != "no"; then
	AC_DEFINE(USE_SERIAL, 1, [Use serial conf file mechanism])
	PCSCLITE_FEATURES="${PCSCLITE_FEATURES} serial"
fi

# --disable-usb
AC_ARG_ENABLE(usb,
	AS_HELP_STRING([--disable-usb],[do not use usb hotplug]),
	[ use_usb="${enableval}" ], [ use_usb="yes" ] )
AM_CONDITIONAL(ENABLE_USB, test "$use_usb" != "no")
if test "$use_usb" != "no"; then
	AC_DEFINE(USE_USB, 1, [Use USB hotplug mechanism])
	PCSCLITE_FEATURES="${PCSCLITE_FEATURES} usb"
fi

# --enable-libudev
AC_ARG_ENABLE(libudev,
	AS_HELP_STRING([--disable-libudev],[do not use libudev]),
	[ use_libudev="${enableval}" ],
	[	if test "$PCSC_ARCH" != "Linux" ; then
			use_libudev="no"
		else
			 use_libudev="${use_libudev-yes}"
		fi ])

# disable libudev check is USB is not used
if test "$use_usb" == "no"; then
	use_libudev="no"
fi

# check if libudev is used
if test "x$use_libudev" != xno ; then
	PKG_CHECK_MODULES(LIBUDEV, libudev, [],
		[ AC_MSG_ERROR([install libudev-dev or use --disable-libudev]) ])

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

	CPPFLAGS="$CPPFLAGS $LIBUDEV_CFLAGS"
	LIBS="$LDFLAGS $LIBUDEV_LIBS"

	AC_CHECK_HEADERS(libudev.h, [],
		[ AC_MSG_ERROR([libudev.h not found, use ./configure LIBUDEV_CFLAGS=...]) ])

	LIBS="$LIBS $COREFOUNDATION $IOKIT"

	AC_MSG_CHECKING([for udev_monitor_unref])
	AC_TRY_LINK_FUNC(udev_monitor_unref, [ AC_MSG_RESULT([yes]) ],
		[ AC_MSG_ERROR([udev_monitor_unref not found, use ./configure LIBUDEV_LIBS=...]) ])

	# everything needed for libudev support is present
	use_libudev=yes

	CPPFLAGS="$saved_CPPFLAGS"
	LIBS="$saved_LIBS"
fi
AC_SUBST(LIBUDEV_CFLAGS)
AC_SUBST(LIBUDEV_LIBS)

if test x$use_libudev = xyes; then
  AC_DEFINE(HAVE_LIBUDEV, 1, [Libudev is available])
  PCSCLITE_FEATURES="${PCSCLITE_FEATURES} libudev"
fi

# --enable-libusb
AC_ARG_ENABLE(libusb,
	AS_HELP_STRING([--enable-libusb],[use libusb]),
	[ use_libusb="${enableval}" ],
	[ if test "x$use_libudev" = xyes ; then use_libusb="${use_libusb-no}" ;
	else use_libusb="${use_libusb-yes}" ; fi ] )

# disable libusb check is USB is not used
if test "$use_usb" == "no"; then
	use_libusb="no"
fi

# check if libusb is used
if test "x$use_libusb" != xno ; then
	if  test "x$use_libudev" != xno ; then
		AC_MSG_ERROR([You can't use libudev _and_ libusb. Select only one.])
	fi

	PKG_CHECK_MODULES(LIBUSB, libusb-1.0, [],
		[
			AC_MSG_RESULT([no])
			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(libusb.h, [],
		[ AC_MSG_ERROR([libusb.h not found, use ./configure LIBUSB_CFLAGS=...]) ])

	LIBS="$LIBS $COREFOUNDATION $IOKIT"

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

	# everything needed for libusb support is present
	use_libusb=yes

	CPPFLAGS="$saved_CPPFLAGS"
	LIBS="$saved_LIBS"
fi
AC_SUBST(LIBUSB_CFLAGS)
AC_SUBST(LIBUSB_LIBS)

if test x$use_libusb = xyes; then
  AC_DEFINE(HAVE_LIBUSB, 1, [Libusb is available])
  PCSCLITE_FEATURES="${PCSCLITE_FEATURES} libusb"
fi

# --with-systemdsystemunitdir=DIR
AC_ARG_WITH([systemdsystemunitdir],
  AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
  [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
if test "x$with_systemdsystemunitdir" != xno; then
  AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])

# --enable-embedded
AC_ARG_ENABLE(embedded,
  AS_HELP_STRING([--enable-embedded],[limit RAM and CPU ressources by disabling features (log)]),
  [ use_embedded="${enableval}" ])

if test x$use_embedded = xyes; then
  AC_DEFINE(NO_LOG, 1, [Disable logging support])
  PCSCLITE_FEATURES="${PCSCLITE_FEATURES} nolog"
fi

# --enable-usbdropdir=DIR
AC_ARG_ENABLE(usbdropdir,
  AS_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB
				  drivers (default /usr/local/lib/pcsc/drivers)]),
[usbdropdir="${enableval}"], [usbdropdir=false])
if test x${usbdropdir} = xfalse ; then
	if test "x$libdir" != xNONE; then
		usbdropdir="$libdir/pcsc/drivers"
	else
		usbdropdir="$ac_default_libdir/pcsc/drivers"
	fi
fi
AS_AC_EXPAND(usbdropdir_exp,$usbdropdir)
usbdropdir=$usbdropdir_exp
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers])
PCSCLITE_FEATURES="${PCSCLITE_FEATURES} usbdropdir=${usbdropdir}"

# --enable-debugatr
AC_ARG_ENABLE(debugatr,
  AS_HELP_STRING([--enable-debugatr],[enable ATR debug messages from pcscd]),
[ case "${enableval}" in
  yes)	debugatr=true ;;
  no)	debugatr=false ;;
  *) AC_MSG_ERROR([bad value ${enableval} for --enable-debugatr]) ;;
esac], [debugatr=false])

if test x${debugatr} = xtrue ; then
  AC_DEFINE(ATR_DEBUG, 1, [display ATR parsing debug messages.])
  PCSCLITE_FEATURES="${PCSCLITE_FEATURES} debugatr"
fi

# --enable-ipcdir=DIR
AC_ARG_ENABLE(ipcdir,
  AS_HELP_STRING([--enable-ipcdir=DIR],[directory containing IPC files
				  (default /var/run/pcscd)]),
[ipcdir="${enableval}"], [ipcdir=false])

if test x${ipcdir} = xfalse ; then
	ipcdir="/var/run/pcscd"
fi
AC_DEFINE_UNQUOTED(USE_IPCDIR, "$ipcdir", [directory containing IPC files])
PCSCLITE_FEATURES="${PCSCLITE_FEATURES} ipcdir=${ipcdir}"

CPPFLAGS="-I\${top_srcdir}/src $CPPFLAGS"

# --enable-confdir=DIR
AC_ARG_ENABLE(confdir,
AS_HELP_STRING([--enable-confdir=DIR],[directory containing reader configurations (default /etc/reader.conf.d)]),
	[confdir="${enableval}"],
	[confdir="${sysconfdir}/reader.conf.d"])

# Setup dist stuff
AC_SUBST(usbdropdir)
AC_SUBST(ipcdir)
AC_SUBST(host_to_ccid_16)
AC_SUBST(host_to_ccid_32)
AS_AC_EXPAND(confdir_exp,$confdir)
AS_AC_EXPAND(sbindir_exp,$sbindir)
AS_AC_EXPAND(localstatedir_exp,$localstatedir)

PCSCLITE_CONFIG_DIR="${confdir_exp}"
AC_SUBST(PCSCLITE_CONFIG_DIR)
PCSCLITE_FEATURES="${PCSCLITE_FEATURES} configdir=${PCSCLITE_CONFIG_DIR}"
AC_DEFINE_UNQUOTED([PCSCLITE_FEATURES], ["${PCSCLITE_FEATURES}"], [Enabled PC/SC lite features])
PCSCD_BINARY="${sbindir_exp}/pcscd"
AC_DEFINE_UNQUOTED([PCSCD_BINARY], ["$PCSCD_BINARY"], [pcscd filename])

cat << EOF

PC/SC lite has been configured with following options:

Version:             ${PACKAGE_VERSION}
System binaries:     $(eval eval eval echo "${sbindir_exp}")
Configuration dir:   ${PCSCLITE_CONFIG_DIR}


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

PTHREAD_CFLAGS:      ${PTHREAD_CFLAGS}
PTHREAD_LIBS:        ${PTHREAD_LIBS}
PCSC_ARCH:           ${PCSC_ARCH}

pcscd binary            ${PCSCD_BINARY}
libudev support:        ${use_libudev}
libusb support:         ${use_libusb}
USB drop directory:     ${usbdropdir}
ATR parsing messages:   ${debugatr}
ipcdir:                 ${ipcdir}
use serial:             ${use_serial}
use usb:                ${use_usb}
systemd unit directory: ${with_systemdsystemunitdir}

PCSCLITE_FEATURES:      ${PCSCLITE_FEATURES}

EOF

# Write Makefiles
AC_CONFIG_FILES([
Makefile
m4/Makefile
doc/Makefile
doc/doxygen.conf
doc/pcscd.8
doc/reader.conf.5
doc/example/Makefile
etc/Makefile
etc/pcscd.service
etc/pcscd.socket
src/Makefile
src/libpcsclite.pc
src/pcscd.h
src/PCSC/pcsclite.h
src/spy/Makefile
])
AC_OUTPUT