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