File: configure.in

package info (click to toggle)
pcsc-lite 1.5.5-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,004 kB
  • ctags: 1,733
  • sloc: ansic: 13,289; sh: 10,563; lex: 406; makefile: 267
file content (384 lines) | stat: -rw-r--r-- 10,070 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
# -*- mode: m4; -*-
# Process this file with autoconf to produce a configure script

AC_PREREQ(2.58)

AC_INIT(pcsc-lite, 1.5.5)
AC_CONFIG_SRCDIR(src/pcscdaemon.c)
AM_INIT_AUTOMAKE(1.8 dist-bzip2 no-dist-gzip)
AM_CONFIG_HEADER(config.h)

AC_CONFIG_MACRO_DIR(m4)

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

# 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)

# 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_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([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`
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"

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

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

# check if libhal is used
if test "x$use_libhal" != xno ; then
	PKG_CHECK_MODULES(LIBHAL, hal, [],
		[ AC_MSG_ERROR([install libhal-dev or use --disable-libhal]) ])

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

	CPPFLAGS="$CPPFLAGS $LIBHAL_CFLAGS"
	LIBS="$LDFLAGS $LIBHAL_LIBS"

	AC_CHECK_HEADERS(libhal.h, [],
		[ AC_MSG_ERROR([libhal.h not found, use ./configure LIBHAL_CFLAGS=...]) ])

	LIBS="$LIBS $COREFOUNDATION $IOKIT"

	AC_MSG_CHECKING([for libhal_ctx_new])
	AC_TRY_LINK_FUNC(libhal_ctx_new, [ AC_MSG_RESULT([yes]) ],
		[ AC_MSG_ERROR([libhal not found, use ./configure LIBHAL_LIBS=...]) ])

	# everything needed for libhal support is present
	use_libhal=yes

	CPPFLAGS="$saved_CPPFLAGS"
	LIBS="$saved_LIBS"
fi
AC_SUBST(LIBHAL_CFLAGS)
AC_SUBST(LIBHAL_LIBS)

if test x$use_libhal = xyes; then
  AC_DEFINE(HAVE_LIBHAL, 1, [Libhal is available])
  PCSCLITE_FEATURES="${PCSCLITE_FEATURES} libhal"
fi

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

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

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

	LIBS="$LIBS $COREFOUNDATION $IOKIT"

	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_get_string_simple])
	AC_TRY_LINK_FUNC(usb_get_string_simple, [ AC_MSG_RESULT([yes]) ],
		[ AC_MSG_ERROR([your libusb is too old. install version 0.1.7 or above]) ])

	# 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

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

# --enable-debugatr
AC_ARG_ENABLE(debugatr,
  AC_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-scf
AC_ARG_ENABLE(scf,
  AC_HELP_STRING([--enable-scf],[use SCF for reader support]),
[ case "${enableval}" in
  yes)	scf=true ;;
  no)	scf=false ;;
  *) AC_MSG_ERROR([bad value ${enableval} for --enable-scf]) ;;
esac], [scf=false])

AC_SUBST(LIBSMARTCARD)
if test x$scf = xtrue -a x$ac_cv_header_smartcard_scf_h = xyes; then
  AC_CHECK_LIB(smartcard, SCF_strerror, [LIBSMARTCARD="$LIBSMARTCARD -lsmartcard" scf=true], scf=false)
else
  scf=false
fi
AM_CONDITIONAL(HAVE_SCF, test x$scf = xtrue)

# --enable-confdir=DIR
AC_ARG_ENABLE(confdir,
AC_HELP_STRING([--enable-confdir=DIR],[directory containing reader.conf
				(default /etc)]),
[confdir="${enableval}"], [confdir=false])
if test x${confdir} = xfalse ; then
	confdir="/etc"
fi
PCSCLITE_FEATURES="${PCSCLITE_FEATURES} confdir=${confdir}"

# --enable-ipcdir=DIR
AC_ARG_ENABLE(ipcdir,
  AC_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"

# HOST_TO_CCID
if test "x$ac_cv_c_bigendian" = "xyes"; then
	AC_SUBST(host_to_ccid_16, ['((((x) >> 8) & 0xFF) + ((x & 0xFF) << 8))'])
	AC_SUBST(host_to_ccid_32, ['((((x) >> 24) & 0xFF) + (((x) >> 8) & 0xFF00) + ((x & 0xFF00) << 8) + (((x) & 0xFF) << 24))'])
	AC_MSG_RESULT([plateform endianess           : big endian])
else
	AC_SUBST(host_to_ccid_16, ['(x)'])
	AC_SUBST(host_to_ccid_32, ['(x)'])
	AC_MSG_RESULT([plateform endianess           : little endian])
fi

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

AC_DEFINE_UNQUOTED([PCSCLITE_FEATURES], ["${PCSCLITE_FEATURES}"], [Enabled PC/SC lite features])

cat << EOF

PC/SC lite has been configured with following options:

Version:             ${PACKAGE_VERSION}
System binaries:     $(eval eval eval echo "${sbindir_exp}")
Configuration files: $(eval eval eval echo "${sysconfdir_exp}")


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}

libhal support:       ${use_libhal}
libusb support:       ${use_libusb}
SCF reader support:   ${scf}
USB drop directory:   ${usbdropdir}
ATR parsing messages: ${debugatr}
confdir:              ${confdir}
ipcdir:               ${ipcdir}

EOF

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