| 1 |
rousseau |
1734 |
# Process this file with autoconf to produce a configure script. |
| 2 |
|
|
# You may need to use autoconf 2.56 or newer |
| 3 |
rousseau |
402 |
|
| 4 |
rousseau |
1734 |
# $Id$ |
| 5 |
rousseau |
402 |
|
| 6 |
rousseau |
2452 |
# Require autoconf 2.61 |
| 7 |
|
|
AC_PREREQ(2.61) |
| 8 |
rousseau |
402 |
|
| 9 |
rousseau |
2757 |
AC_INIT(ccid, 1.3.2) |
| 10 |
rousseau |
402 |
AC_CONFIG_SRCDIR(src/ifdhandler.c) |
| 11 |
|
|
AC_CONFIG_AUX_DIR(build) |
| 12 |
|
|
AM_INIT_AUTOMAKE |
| 13 |
|
|
|
| 14 |
rousseau |
1734 |
# Default install dir |
| 15 |
rousseau |
402 |
AC_PREFIX_DEFAULT(/usr/local) |
| 16 |
|
|
|
| 17 |
rousseau |
1734 |
# Automake boilerplate. |
| 18 |
rousseau |
402 |
AC_CANONICAL_HOST |
| 19 |
|
|
|
| 20 |
rousseau |
1734 |
# create a config.h file (Automake will add -DHAVE_CONFIG_H) |
| 21 |
rousseau |
402 |
AM_CONFIG_HEADER(config.h) |
| 22 |
|
|
|
| 23 |
rousseau |
1734 |
# Options |
| 24 |
rousseau |
402 |
AM_MAINTAINER_MODE |
| 25 |
|
|
|
| 26 |
rousseau |
1734 |
# Checks for programs. |
| 27 |
rousseau |
402 |
AC_PROG_CC |
| 28 |
rousseau |
2632 |
AM_PROG_CC_C_O |
| 29 |
rousseau |
448 |
AC_PROG_CPP |
| 30 |
rousseau |
402 |
AC_PROG_INSTALL |
| 31 |
|
|
AC_PROG_MAKE_SET |
| 32 |
|
|
AC_PROG_LN_S |
| 33 |
|
|
AM_PROG_LEX |
| 34 |
rousseau |
2271 |
PKG_PROG_PKG_CONFIG |
| 35 |
rousseau |
1251 |
|
| 36 |
rousseau |
1734 |
# check pcsc-lite version |
| 37 |
rousseau |
2210 |
PCSC_NEEDED_VERSION="1.3.3" |
| 38 |
|
|
PKG_CHECK_MODULES(PCSC, libpcsclite >= $PCSC_NEEDED_VERSION, [], |
| 39 |
rousseau |
1842 |
[ AC_MSG_RESULT([no]) |
| 40 |
|
|
if test -f /usr/local/lib/pkgconfig/libpcsclite.pc -a "x$PKG_CONFIG" != x ; then |
| 41 |
rousseau |
1359 |
AC_MSG_ERROR([use PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure]) |
| 42 |
|
|
else |
| 43 |
rousseau |
2210 |
AC_MSG_WARN([install pcsc-lite $PCSC_NEEDED_VERSION or later]) |
| 44 |
rousseau |
1359 |
fi |
| 45 |
|
|
]) |
| 46 |
rousseau |
402 |
|
| 47 |
rousseau |
1767 |
saved_CPPFLAGS="$CPPFLAGS" |
| 48 |
|
|
CPPFLAGS="$CPPFLAGS $PCSC_CFLAGS" |
| 49 |
rousseau |
1328 |
AC_CHECK_HEADER(ifdhandler.h,, |
| 50 |
rousseau |
2210 |
[AC_MSG_ERROR([ifdhandler.h not found, install pcsc-lite $PCSC_NEEDED_VERSION or later, or use ./configure PCSC_CFLAGS=...])]) |
| 51 |
rousseau |
2240 |
AC_CHECK_DECL(IFD_NO_SUCH_DEVICE,, [AC_MSG_ERROR([install pcsc-lite $PCSC_NEEDED_VERSION or later])], [#include <ifdhandler.h>]) |
| 52 |
rousseau |
2773 |
AC_CHECK_DECLS(TAG_IFD_POLLING_THREAD,,, [#include <ifdhandler.h>]) |
| 53 |
rousseau |
1556 |
AC_CHECK_HEADER(reader.h,, |
| 54 |
rousseau |
2210 |
[AC_MSG_ERROR([reader.h not found, install pcsc-lite $PCSC_NEEDED_VERSION or later, or use ./configure PCSC_CFLAGS=...])]) |
| 55 |
rousseau |
1767 |
CPPFLAGS="$saved_CPPFLAGS" |
| 56 |
rousseau |
1253 |
|
| 57 |
rousseau |
1734 |
# Add libtool support. |
| 58 |
rousseau |
402 |
AM_PROG_LIBTOOL |
| 59 |
|
|
|
| 60 |
rousseau |
1734 |
# Automatically update the libtool script if it becomes out-of-date. |
| 61 |
rousseau |
402 |
AC_SUBST(LIBTOOL_DEPS) |
| 62 |
|
|
|
| 63 |
rousseau |
1734 |
# Checks for header files. |
| 64 |
rousseau |
402 |
AC_HEADER_STDC |
| 65 |
rousseau |
2116 |
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,, |
| 66 |
rousseau |
2118 |
[AC_MSG_ERROR([some header files not found])]) |
| 67 |
rousseau |
402 |
|
| 68 |
rousseau |
1734 |
# Checks for typedefs, structures, and compiler characteristics. |
| 69 |
rousseau |
402 |
AC_C_CONST |
| 70 |
|
|
AC_TYPE_SIZE_T |
| 71 |
|
|
AC_HEADER_TIME |
| 72 |
|
|
|
| 73 |
rousseau |
1734 |
# Checks for library functions. |
| 74 |
rousseau |
2451 |
AC_CHECK_FUNCS(select strerror strncpy memcpy strlcpy) |
| 75 |
rousseau |
402 |
|
| 76 |
rousseau |
1734 |
# Select OS specific versions of source files. |
| 77 |
rousseau |
402 |
AC_SUBST(BUNDLE_HOST) |
| 78 |
|
|
AC_SUBST(DYN_LIB_EXT) |
| 79 |
|
|
case "$host" in |
| 80 |
|
|
*-*-darwin*) |
| 81 |
|
|
BUNDLE_HOST="MacOS" |
| 82 |
|
|
DYN_LIB_EXT="dylib" |
| 83 |
|
|
|
| 84 |
|
|
AC_SUBST(COREFOUNDATION) |
| 85 |
|
|
COREFOUNDATION="-Wl,-framework,CoreFoundation" |
| 86 |
|
|
|
| 87 |
|
|
AC_SUBST(IOKIT) |
| 88 |
|
|
IOKIT="-Wl,-framework,IOKit" |
| 89 |
|
|
if test "$GCC" = "yes"; then |
| 90 |
|
|
CFLAGS="$CFLAGS -no-cpp-precomp" |
| 91 |
|
|
fi |
| 92 |
|
|
;; |
| 93 |
rousseau |
2078 |
*-*-freebsd*) |
| 94 |
|
|
BUNDLE_HOST="FreeBSD" |
| 95 |
|
|
DYN_LIB_EXT="so" |
| 96 |
|
|
;; |
| 97 |
rousseau |
1846 |
*-*-openbsd*) |
| 98 |
|
|
BUNDLE_HOST="OpenBSD" |
| 99 |
|
|
DYN_LIB_EXT="so.0.0" |
| 100 |
|
|
;; |
| 101 |
rousseau |
1925 |
*-*-solaris*) |
| 102 |
|
|
BUNDLE_HOST="Solaris" |
| 103 |
|
|
DYN_LIB_EXT="so" |
| 104 |
|
|
;; |
| 105 |
rousseau |
402 |
*) |
| 106 |
|
|
BUNDLE_HOST="Linux" |
| 107 |
|
|
DYN_LIB_EXT="so" |
| 108 |
|
|
esac |
| 109 |
|
|
|
| 110 |
rousseau |
1942 |
# --disable-libusb |
| 111 |
rousseau |
460 |
AC_ARG_ENABLE(libusb, |
| 112 |
rousseau |
1942 |
AC_HELP_STRING([--disable-libusb],[do not use libusb]), |
| 113 |
|
|
[ use_libusb="${enableval}" ], [ use_libusb=yes ] ) |
| 114 |
rousseau |
436 |
|
| 115 |
rousseau |
1770 |
# check if libusb is used |
| 116 |
|
|
if test "x$use_libusb" != xno ; then |
| 117 |
rousseau |
1784 |
PKG_CHECK_MODULES(LIBUSB, libusb, [], |
| 118 |
|
|
[ |
| 119 |
|
|
AC_MSG_RESULT([no]) |
| 120 |
|
|
AC_CHECK_PROG([LIBUSBCONFIG], [libusb-config], [yes]) |
| 121 |
rousseau |
1770 |
|
| 122 |
rousseau |
1784 |
if test "$LIBUSBCONFIG" = "yes" ; then |
| 123 |
|
|
LIBUSB_CFLAGS="$LIBUSB_CFLAGS `libusb-config --cflags`" |
| 124 |
|
|
LIBUSB_LIBS="$LIBUSB_LIBS `libusb-config --libs`" |
| 125 |
|
|
else |
| 126 |
|
|
AC_MSG_WARN([libusb-config not found.]) |
| 127 |
|
|
fi |
| 128 |
|
|
]) |
| 129 |
rousseau |
1770 |
|
| 130 |
rousseau |
1733 |
saved_CPPFLAGS="$CPPFLAGS" |
| 131 |
|
|
saved_LIBS="$LIBS" |
| 132 |
|
|
|
| 133 |
|
|
CPPFLAGS="$CPPFLAGS $LIBUSB_CFLAGS" |
| 134 |
|
|
LIBS="$LDFLAGS $LIBUSB_LIBS" |
| 135 |
|
|
|
| 136 |
rousseau |
565 |
AC_CHECK_HEADERS(usb.h, [], |
| 137 |
rousseau |
1770 |
[ AC_MSG_ERROR([usb.h not found, use ./configure LIBUSB_CFLAGS=...]) ]) |
| 138 |
rousseau |
436 |
|
| 139 |
rousseau |
565 |
LIBS="$LIBS $COREFOUNDATION $IOKIT" |
| 140 |
rousseau |
402 |
|
| 141 |
rousseau |
1770 |
AC_MSG_CHECKING([for usb_init]) |
| 142 |
|
|
AC_TRY_LINK_FUNC(usb_init, [ AC_MSG_RESULT([yes]) ], |
| 143 |
|
|
[ AC_MSG_ERROR([libusb not found, use ./configure LIBUSB_LIBS=...]) ]) |
| 144 |
|
|
|
| 145 |
|
|
AC_MSG_CHECKING([for usb_get_string_simple]) |
| 146 |
|
|
AC_TRY_LINK_FUNC(usb_get_string_simple, [ AC_MSG_RESULT([yes]) ], |
| 147 |
rousseau |
565 |
[ AC_MSG_ERROR([your libusb is too old. install version 0.1.7 or above]) ]) |
| 148 |
rousseau |
1733 |
|
| 149 |
rousseau |
2630 |
AC_CHECK_FUNC(usb_detach_kernel_driver_np, |
| 150 |
|
|
[ AC_DEFINE(HAVE_USB_DETACH_KERNEL_DRIVER_NP, 1, [Define if usb_detach_kernel_driver_np() is available]) ]) |
| 151 |
|
|
|
| 152 |
rousseau |
1769 |
CPPFLAGS="$saved_CPPFLAGS" |
| 153 |
rousseau |
1733 |
LIBS="$saved_LIBS" |
| 154 |
rousseau |
1942 |
|
| 155 |
|
|
use_libusb=yes |
| 156 |
rousseau |
565 |
fi |
| 157 |
rousseau |
1733 |
AC_SUBST(LIBUSB_CFLAGS) |
| 158 |
|
|
AC_SUBST(LIBUSB_LIBS) |
| 159 |
rousseau |
556 |
|
| 160 |
rousseau |
2011 |
# check if the compiler support -fvisibility=hidden (GCC >= 4) |
| 161 |
|
|
saved_CFLAGS="$CFLAGS" |
| 162 |
|
|
CFLAGS="$CFLAGS -fvisibility=hidden" |
| 163 |
|
|
AC_MSG_CHECKING([for -fvisibility=hidden]) |
| 164 |
|
|
AC_COMPILE_IFELSE([char foo;], |
| 165 |
|
|
[ AC_MSG_RESULT([yes]) |
| 166 |
|
|
SYMBOL_VISIBILITY="-fvisibility=hidden" ], |
| 167 |
|
|
AC_MSG_RESULT([no])) |
| 168 |
|
|
CFLAGS="$saved_CFLAGS" |
| 169 |
|
|
AC_SUBST(SYMBOL_VISIBILITY) |
| 170 |
|
|
|
| 171 |
rousseau |
1944 |
# --disable-multi-thread |
| 172 |
rousseau |
460 |
AC_ARG_ENABLE(multi-thread, |
| 173 |
rousseau |
1944 |
AC_HELP_STRING([--disable-multi-thread],[disable multi threading]), |
| 174 |
rousseau |
460 |
[ multithread="${enableval}" ], [ multithread=yes ] ) |
| 175 |
|
|
|
| 176 |
|
|
if test "${multithread}" != no ; then |
| 177 |
rousseau |
563 |
ACX_PTHREAD( |
| 178 |
|
|
[ AC_DEFINE(HAVE_PTHREAD, 1, |
| 179 |
|
|
[Define if you have POSIX threads libraries and header files.]) |
| 180 |
|
|
], [ AC_MSG_ERROR([POSIX thread support required]) ]) |
| 181 |
rousseau |
1944 |
|
| 182 |
|
|
multithread=yes |
| 183 |
rousseau |
460 |
fi |
| 184 |
|
|
|
| 185 |
rousseau |
1734 |
# --enable-bundle=NAME |
| 186 |
rousseau |
402 |
AC_ARG_ENABLE(bundle, |
| 187 |
rousseau |
460 |
AC_HELP_STRING([--enable-bundle=NAME],[bundle directory name |
| 188 |
|
|
(default ifd-ccid.bundle)]), |
| 189 |
|
|
[bundle="${enableval}"], [bundle=false]) |
| 190 |
rousseau |
402 |
if test "${bundle}" = false ; then |
| 191 |
|
|
bundle="ifd-ccid.bundle" |
| 192 |
|
|
fi |
| 193 |
|
|
AC_DEFINE_UNQUOTED(BUNDLE, "$bundle", [bundle directory name]) |
| 194 |
|
|
|
| 195 |
rousseau |
1734 |
# --enable-usbdropdir=DIR |
| 196 |
rousseau |
402 |
AC_ARG_ENABLE(usbdropdir, |
| 197 |
rousseau |
460 |
AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB |
| 198 |
rousseau |
871 |
drivers (default to pcscd config or $(prefix)/pcsc/drivers)]), |
| 199 |
rousseau |
460 |
[usbdropdir="${enableval}"], [usbdropdir=false]) |
| 200 |
rousseau |
402 |
if test "${usbdropdir}" = false ; then |
| 201 |
rousseau |
1328 |
usbdropdir=`pkg-config libpcsclite --variable=usbdropdir` |
| 202 |
rousseau |
402 |
fi |
| 203 |
|
|
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers]) |
| 204 |
rousseau |
1360 |
if test "${usbdropdir}" = "" ; then |
| 205 |
|
|
AC_MSG_ERROR([use --enable-usbdropdir=DIR]) |
| 206 |
|
|
fi |
| 207 |
rousseau |
402 |
|
| 208 |
rousseau |
2134 |
# --enable-twinserial |
| 209 |
|
|
AC_ARG_ENABLE(twinserial, |
| 210 |
|
|
AC_HELP_STRING([--enable-twinserial],[also compile and install the serial Twin driver]), |
| 211 |
rousseau |
2287 |
[twinserial="${enableval}"], [twinserial=no]) |
| 212 |
|
|
AM_CONDITIONAL(WITH_TWIN_SERIAL, test "${twinserial}" != "no") |
| 213 |
rousseau |
2134 |
|
| 214 |
rousseau |
1734 |
# --enable-ccidtwindir=DIR |
| 215 |
rousseau |
564 |
AC_ARG_ENABLE(ccidtwindir, |
| 216 |
|
|
AC_HELP_STRING([--enable-ccidtwindir=DIR],[directory to install the |
| 217 |
rousseau |
871 |
serial Twin driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]), |
| 218 |
rousseau |
564 |
[ccidtwindir="${enableval}"], [ccidtwindir=false]) |
| 219 |
|
|
if test "${ccidtwindir}" = false ; then |
| 220 |
rousseau |
1328 |
ccidtwindir=`pkg-config libpcsclite --variable=usbdropdir`/serial |
| 221 |
rousseau |
564 |
fi |
| 222 |
|
|
|
| 223 |
rousseau |
1943 |
# --disable-pcsclite |
| 224 |
rousseau |
896 |
AC_ARG_ENABLE(pcsclite, |
| 225 |
rousseau |
1943 |
AC_HELP_STRING([--disable-pcsclite],[do not use pcsc-lite debug support]), |
| 226 |
|
|
[ pcsclite="${enableval}" ], [ pcsclite=yes ] ) |
| 227 |
rousseau |
564 |
|
| 228 |
rousseau |
2288 |
if test "${pcsclite}" != no ; then |
| 229 |
rousseau |
1734 |
# check that pcsc-lite is installed |
| 230 |
rousseau |
1405 |
OLD_LIBS="$LIBS" |
| 231 |
rousseau |
1802 |
LIBS="$LIBS $PCSC_LIBS" |
| 232 |
rousseau |
2239 |
AC_MSG_CHECKING([for SCardEstablishContext]) |
| 233 |
|
|
AC_TRY_LINK_FUNC(SCardEstablishContext, |
| 234 |
|
|
[ AC_MSG_RESULT([yes]) ], |
| 235 |
rousseau |
2624 |
[ AC_MSG_ERROR([SCardEstablishContext() not found, install pcsc-lite 1.2.9-beta9 or later,or use PCSC_LIBS=... ./configure]) ]) |
| 236 |
rousseau |
1405 |
LIBS="$OLD_LIBS" |
| 237 |
rousseau |
1404 |
|
| 238 |
rousseau |
1943 |
pcsclite=yes |
| 239 |
rousseau |
896 |
fi |
| 240 |
rousseau |
2288 |
AM_CONDITIONAL(WITHOUT_PCSC, test "${pcsclite}" != "yes") |
| 241 |
rousseau |
896 |
|
| 242 |
rousseau |
2312 |
# --enable-udev |
| 243 |
|
|
AC_ARG_ENABLE(udev, |
| 244 |
|
|
AC_HELP_STRING([--enable-udev],[udev support for pcscd hotplug]), |
| 245 |
|
|
[udev="${enableval}"], [udev=no]) |
| 246 |
|
|
AM_CONDITIONAL(UDEV, test "${udev}" != "no") |
| 247 |
rousseau |
896 |
|
| 248 |
rousseau |
2312 |
|
| 249 |
rousseau |
1734 |
# Setup dist stuff |
| 250 |
rousseau |
402 |
AC_SUBST(ac_aux_dir) |
| 251 |
|
|
AC_SUBST(bundle) |
| 252 |
|
|
AC_SUBST(usbdropdir) |
| 253 |
rousseau |
564 |
AC_SUBST(ccidtwindir) |
| 254 |
rousseau |
402 |
|
| 255 |
rousseau |
2786 |
cat << EOF |
| 256 |
|
|
|
| 257 |
|
|
libccid has been configured with following options: |
| 258 |
|
|
|
| 259 |
|
|
Version: ${PACKAGE_VERSION} |
| 260 |
|
|
User binaries: $(eval eval eval echo "${bindir}") |
| 261 |
|
|
Configuration files: $(eval eval eval echo "${sysconfdir}") |
| 262 |
|
|
|
| 263 |
|
|
|
| 264 |
|
|
Host: ${host} |
| 265 |
|
|
Compiler: ${CC} |
| 266 |
|
|
Preprocessor flags: ${CPPFLAGS} |
| 267 |
|
|
Compiler flags: ${CFLAGS} |
| 268 |
|
|
Preprocessor flags: ${CPPFLAGS} |
| 269 |
|
|
Linker flags: ${LDFLAGS} |
| 270 |
|
|
Libraries: ${LIBS} |
| 271 |
|
|
|
| 272 |
|
|
PTHREAD_CFLAGS: ${PTHREAD_CFLAGS} |
| 273 |
|
|
PTHREAD_LIBS: ${PTHREAD_LIBS} |
| 274 |
|
|
BUNDLE_HOST: ${BUNDLE_HOST} |
| 275 |
|
|
DYN_LIB_EXT: ${DYN_LIB_EXT} |
| 276 |
|
|
LIBUSB_CFLAGS: ${LIBUSB_CFLAGS} |
| 277 |
|
|
LIBUSB_LIBS: ${LIBUSB_LIBS} |
| 278 |
|
|
SYMBOL_VISIBILITY: ${SYMBOL_VISIBILITY} |
| 279 |
|
|
|
| 280 |
|
|
libusb support: ${use_libusb} |
| 281 |
|
|
multi threading: ${multithread} |
| 282 |
|
|
bundle directory name: ${bundle} |
| 283 |
|
|
USB drop directory: ${usbdropdir} |
| 284 |
|
|
serial Twin support: ${twinserial} |
| 285 |
|
|
serial twin install dir: ${ccidtwindir} |
| 286 |
|
|
compiled for pcsc-lite: ${pcsclite} |
| 287 |
|
|
udev support: ${udev} |
| 288 |
|
|
|
| 289 |
|
|
EOF |
| 290 |
|
|
|
| 291 |
rousseau |
1734 |
# Write Makefiles. |
| 292 |
rousseau |
887 |
AC_CONFIG_FILES(Makefile |
| 293 |
|
|
aclocal/Makefile |
| 294 |
|
|
src/Makefile |
| 295 |
|
|
readers/Makefile |
| 296 |
rousseau |
2431 |
contrib/Makefile |
| 297 |
rousseau |
2432 |
contrib/Kobil_mIDentity_switch/Makefile |
| 298 |
rousseau |
2438 |
contrib/RSA_SecurID/Makefile |
| 299 |
rousseau |
887 |
examples/Makefile) |
| 300 |
|
|
|
| 301 |
rousseau |
402 |
AC_OUTPUT |
| 302 |
|
|
|