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.3.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_FUNCS(strerror) AC_CHECK_FUNCS(strncpy) AC_CHECK_HEADERS(errno.h) 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(fcntl.h stdlib.h unistd.h termios.h string.h errno.h sys/time.h sys/types.h stdarg.h) 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 -fno-common" 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 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" 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 $(prefix)/pcsc/drivers)]), [usbdropdir="${enableval}"], [usbdropdir=false]) if test "${usbdropdir}" = false ; then if test "$prefix" = NONE ; then usbdropdir="$ac_default_prefix/pcsc/drivers" else usbdropdir="$prefix/pcsc/drivers" 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 $(prefix)/pcsc/drivers/serial)]), [ccidtwindir="${enableval}"], [ccidtwindir=false]) if test "${ccidtwindir}" = false ; then if test "$prefix" = NONE ; then ccidtwindir="$ac_default_prefix/pcsc/drivers/serial" else ccidtwindir="$prefix/pcsc/drivers/serial" fi fi AC_MSG_RESULT([serial twin install dir : $ccidtwindir]) AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$ccidtwindir", [directory containing USB drivers]) dnl --enable-debugcritical AC_ARG_ENABLE(debugcritical, AC_HELP_STRING([--enable-debugcritical],[print critical debug messages (default yes)]), [ debugcritical="${enableval}" ], [ debugcritical=yes ]) dnl yes by default if test "${debugcritical}" != yes then AC_MSG_RESULT([critical debug messages : no]) else AC_MSG_RESULT([critical debug messages : yes]) AC_DEFINE_UNQUOTED(DEBUG_LEVEL_CRITICAL, 1, [print critical debug messages]) fi dnl --enable-debuginfo AC_ARG_ENABLE(debuginfo, AC_HELP_STRING([--enable-debuginfo],[print info debug messages (default yes)]), [ debuginfo="${enableval}" ], [ debuginfo=yes ]) dnl yes by default if test "${debuginfo}" != yes then AC_MSG_RESULT([info debug messages : no]) else AC_MSG_RESULT([info debug messages : yes]) AC_DEFINE_UNQUOTED(DEBUG_LEVEL_INFO, 1, [print info debug messages]) fi dnl --enable-debugperiodic AC_ARG_ENABLE(debugperiodic, AC_HELP_STRING([--enable-debugperiodic],[print periodic debug messages (default no)]), [ debugperiodic="${enableval}" ], [ debugperiodic=no ]) dnl no by default if test "${debugperiodic}" != no then AC_MSG_RESULT([periodic debug messages : yes]) AC_DEFINE_UNQUOTED(DEBUG_LEVEL_PERIODIC, 1, [print periodic debug messages]) else AC_MSG_RESULT([periodic debug messages : no]) fi dnl --enable-debugcomm AC_ARG_ENABLE(debugcomm, AC_HELP_STRING([--enable-debugcomm],[print comm debug messages (default no)]), [ debugcomm="${enableval}" ], [ debugcomm=no ]) dnl no by default if test "${debugcomm}" != no then AC_MSG_RESULT([comm debug messages : yes]) AC_DEFINE_UNQUOTED(DEBUG_LEVEL_COMM, 1, [print comm debug messages]) else AC_MSG_RESULT([comm debug messages : no]) fi 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) AC_OUTPUT