# Process this file with autoconf to produce a configure script. # You may need to use autoconf 2.56 or newer # $Id: configure.in 2692 2007-11-16 13:27:00Z rousseau $ # Require autoconf 2.61 AC_PREREQ(2.61) AC_INIT(ccid, 1.3.1) AC_CONFIG_SRCDIR(src/ifdhandler.c) AC_CONFIG_AUX_DIR(build) AM_INIT_AUTOMAKE # 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_MODULES(PCSC, libpcsclite >= $PCSC_NEEDED_VERSION, [], [ AC_MSG_RESULT([no]) 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 ]) 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 ]) 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) # 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" 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 ;; *-*-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" ;; *) 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 ] ) # check if libusb is used if test "x$use_libusb" != xno ; then 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]) ]) 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 fi AC_SUBST(LIBUSB_CFLAGS) AC_SUBST(LIBUSB_LIBS) AC_MSG_RESULT([use libusb : $use_libusb]) # 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 AC_MSG_RESULT([multi threading : $multithread]) # --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_MSG_RESULT([bundle directory name : $bundle]) 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_MSG_RESULT([USB drop directory : $usbdropdir]) 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]) AC_MSG_RESULT([build and install serial Twin driver : $twinserial]) 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 AC_MSG_RESULT([serial twin install dir : $ccidtwindir]) # --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" LIBS="$LIBS $PCSC_LIBS" 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" pcsclite=yes fi AC_MSG_RESULT([compiled for pcsc-lite : $pcsclite]) 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]) AC_MSG_RESULT([udev support : $udev]) AM_CONDITIONAL(UDEV, test "${udev}" != "no") # Setup dist stuff AC_SUBST(ac_aux_dir) AC_SUBST(bundle) AC_SUBST(usbdropdir) AC_SUBST(ccidtwindir) # Write Makefiles. AC_CONFIG_FILES(Makefile aclocal/Makefile src/Makefile readers/Makefile contrib/Makefile contrib/Kobil_mIDentity_switch/Makefile contrib/RSA_SecurID/Makefile examples/Makefile) AC_OUTPUT