dnl Process this file with autoconf to produce a configure script. dnl You may need to use autoconf 2.56 or newer dnl $Id$ dnl Require autoconf 2.52 AC_PREREQ(2.52) AC_INIT(ccid, 0.9.2) AC_CONFIG_SRCDIR(src/ifdhandler.c) AC_CONFIG_AUX_DIR(build) AM_INIT_AUTOMAKE dnl Default install dir AC_PREFIX_DEFAULT(/usr/local) dnl Automake boilerplate. AC_CANONICAL_HOST dnl create a config.h file (Automake will add -DHAVE_CONFIG_H) AM_CONFIG_HEADER(config.h) dnl Options AM_MAINTAINER_MODE dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_LN_S AM_PROG_LEX AC_CHECK_PROG([PKGCONFIG], [pkg-config], [yes]) dnl pcsc-lite install .pc files in /usr/local/lib/pkgconfig by default PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" export PKG_CONFIG_PATH if test "$PKGCONFIG" = "yes"; then if ! `pkg-config --print-errors --atleast-version=1.2.9-beta5 libpcsclite` then AC_MSG_ERROR([install pcsc-lite 1.2.9-beta5 or later]) fi fi AM_CPPFLAGS=`pkg-config libpcsclite --cflags` AC_SUBST(AM_CPPFLAGS) dnl Add libtool support. AM_PROG_LIBTOOL dnl Automatically update the libtool script if it becomes out-of-date. AC_SUBST(LIBTOOL_DEPS) dnl 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,, [AC_MSG_WARN([some header files not found])]) OLD_CFLAGS="$CFLAGS" CFLAGS=`pkg-config libpcsclite --cflags` CFLAGS="$OLD_CFLAGS $CFLAGS" AC_CHECK_HEADER(ifdhandler.h,, [AC_MSG_ERROR([ifdhandler.h not found, install pcsc-lite 1.2.9-beta5 or later])], [ #include ]) CFLAGS="$OLD_CFLAGS" dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_HEADER_TIME dnl Checks for library functions. AC_CHECK_FUNCS(select strerror strncpy memcpy) dnl 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" AM_CONDITIONAL(NEED_PARSER, true) 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 ;; *) BUNDLE_HOST="Linux" DYN_LIB_EXT="so" AM_CONDITIONAL(NEED_PARSER, false) esac CFLAGS="$CFLAGS -Wall" dnl --enable-libusb=PATH AC_ARG_ENABLE(libusb, AC_HELP_STRING([--enable-libusb=PATH],[libusb path (default /usr)]), [ case ${enableval} in "" | "yes" | "YES") ;; "no" | "NO") use_libusb=false ;; *) CPPFLAGS="$CPPFLAGS -I${enableval}/include" LDFLAGS="$LDFLAGS -L${enableval}/lib" ;; esac ] ) dnl check if libusb is available if test "${use_libusb}" != false ; then AC_SUBST(LIBUSB) AC_CHECK_HEADERS(usb.h, [], [ AC_MSG_ERROR([usb.h not found, use --enable-libusb=PATH]) ]) ac_save_LIBS="$LIBS" LIBS="$LIBS $COREFOUNDATION $IOKIT" AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb"], [ AC_MSG_ERROR([libusb not found]) ]) LIBS="$ac_save_LIBS" ac_save_LIBS="$LIBS" LIBS="$LIBS $COREFOUNDATION $IOKIT" AC_CHECK_LIB(usb, usb_get_string_simple, [LIBUSB="$LIBUSB -lusb"], [ AC_MSG_ERROR([your libusb is too old. install version 0.1.7 or above]) ]) LIBS="$ac_save_LIBS" fi dnl check shat to use for dlopen AC_SUBST(LIBDL) AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no) dnl --enable-multi-thread AC_ARG_ENABLE(multi-thread, AC_HELP_STRING([--enable-multi-thread],[enable multi threading (default=yes)]), [ 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]) ]) fi AC_MSG_RESULT([multi threading : $multithread]) dnl --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]) dnl --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 if test "$PKGCONFIG" = yes ; then usbdropdir=`pkg-config libpcsclite --variable=usbdropdir` else usbdropdir="" fi if test -z "$usbdropdir" ; then if test "$prefix" = NONE ; then usbdropdir="$ac_default_prefix/pcsc/drivers" else usbdropdir="$prefix/pcsc/drivers" fi fi fi AC_MSG_RESULT([USB drop directory : $usbdropdir]) AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers]) dnl --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 if test "$PKGCONFIG" = yes ; then ccidtwindir=`pkg-config libpcsclite --variable=usbdropdir` else AC_MSG_RESULT([You should install pkg-config to get this configured automatically from pcsc-lite installation]) ccidtwindir="" fi if test -z "$ccidtwindir" ; then if test "$prefix" = NONE ; then ccidtwindir="$ac_default_prefix/pcsc/drivers" else ccidtwindir="$prefix/pcsc/drivers" fi fi ccidtwindir="$ccidtwindir/serial" fi AC_MSG_RESULT([serial twin install dir : $ccidtwindir]) AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$ccidtwindir", [directory containing USB drivers]) dnl --enable-pcsclite AC_ARG_ENABLE(pcsclite, AC_HELP_STRING([--enable-pcsclite],[compile for pcsc-lite (default=yes)]), [ pcsclite=no ], [ pcsclite=yes ] ) if test "${pcsclite}" = no ; then AM_CONDITIONAL(NEED_PARSER, true) fi AC_MSG_RESULT([compiled for pcsc-lite : $pcsclite]) dnl Setup dist stuff AC_SUBST(ac_aux_dir) AC_SUBST(bundle) AC_SUBST(usbdropdir) AC_SUBST(ccidtwindir) dnl Write Makefiles. AC_CONFIG_FILES(Makefile aclocal/Makefile src/Makefile readers/Makefile examples/Makefile) AC_OUTPUT