dnl Process this file with autoconf to produce a configure script. dnl You may need to use autoconf 2.56 or newer dnl $Id$ AC_INIT(src/winscard.h) AC_CONFIG_AUX_DIR(build) dnl Default install dir AC_PREFIX_DEFAULT(/usr/local) dnl Automake boilerplate. AC_CANONICAL_HOST dnl Every other copy of the package version number gets its value from here AM_INIT_AUTOMAKE(pcsc-lite, 1.2.0-rc1) 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 dnl Special check for pthread support. ACX_PTHREAD( [ AC_DEFINE(HAVE_PTHREAD, 1, [Define if you have POSIX threads libraries and header files.]) ], [ AC_MSG_ERROR([POSIX thread support required]) ]) AC_CHECK_FUNCS(daemon) AC_CHECK_FUNCS(getopt_long) AC_CHECK_FUNCS(snprintf vsnprintf) AC_CHECK_FUNCS(strerror) AC_CHECK_FUNCS(strncpy) AC_CHECK_HEADERS(getopt.h) 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_HEADER_SYS_WAIT #AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. #AC_C_CONST #AC_HEADER_TIME dnl Checks for library functions. #AC_FUNC_MMAP #AC_TYPE_SIGNAL #AC_CHECK_FUNCS(gettimeofday strdup strtoul) dnl Select OS specific versions of source files. case "${build_os}" in *linux*) arch=linux ;; *bsd*) arch=bsd ;; *darwin*) arch=darwin ;; *solaris*) arch=solaris ;; *hpux*) arch=hpux ;; *osf*) arch=tru64 ;; *aix*) arch=aix ;; *) AC_MSG_ERROR([Operating system ${build_os} not supported]) ;; esac AM_CONDITIONAL(PCSC_ARCH_LINUX, test x$arch = xlinux) AM_CONDITIONAL(PCSC_ARCH_BSD, test x$arch = xbsd) AM_CONDITIONAL(PCSC_ARCH_OSX, test x$arch = xdarwin) AM_CONDITIONAL(PCSC_ARCH_SOLARIS, test x$arch = xsolaris) AM_CONDITIONAL(PCSC_ARCH_HPUX, test x$arch = xhpux) AM_CONDITIONAL(PCSC_ARCH_TRU64, test x$arch = xtru64) AM_CONDITIONAL(PCSC_ARCH_AIX, test x$arch = xaix) if test x$arch = xlinux ; then AC_DEFINE(PCSC_TARGET_LINUX, 1, [Linux]) AC_DEFINE(MSC_TARGET_LINUX, 1, [Linux]) fi if test x$arch = xbsd ; then AC_DEFINE(PCSC_TARGET_BSD, 1, [BSD]) AC_DEFINE(MSC_TARGET_BSD, 1, [BSD]) fi if test x$arch = xdarwin ; then AC_DEFINE(PCSC_TARGET_OSX, 1, [OSX]) AC_DEFINE(MSC_TARGET_OSX, 1, [OSX]) fi if test x$arch = xsolaris ; then AC_DEFINE(PCSC_TARGET_SOLARIS, 1, [Solaris]) AC_DEFINE(MSC_TARGET_SOLARIS, 1, [Solaris]) fi if test x$arch = xhpux ; then AC_DEFINE(PCSC_TARGET_HPUX, 1, [HP-UX]) AC_DEFINE(MSC_TARGET_HPUX, 1, [HP-UX]) fi if test x$arch = xtru64 ; then AC_DEFINE(PCSC_TARGET_TRU64, 1, [TRU64]) AC_DEFINE(MSC_TARGET_TRU64, 1, [TRU64]) fi if test x$arch = xaix ; then AC_DEFINE(PCSC_TARGET_AIX, 1, [AIX]) AC_DEFINE(MSC_TARGET_AIX, 1, [AIX]) fi dnl check if libusb is available AC_CHECK_LIB(usb, usb_init, [ use_libusb=true ], [ use_libusb=false ]) AC_CHECK_HEADERS(usb.h, [ use_libusb=true ], [ use_libusb=false ]) dnl --enable-libusb=DIR AC_ARG_ENABLE(libusb, [ --enable-libusb=PATH enable USB hotplug using libusb], [ use_libusb=false case ${enableval} in "" | "yes" | "YES") if test x$use_libusb = xtrue; then LIBS="${LIBS} -lusb" fi ;; "no" | "NO") use_libusb=false ;; *) libusb_prefix=${enableval} AC_CHECK_LIB(usb, usb_init, [ use_libusb=true ], [ use_libusb=false ], "-L${libusb_prefix}/lib") AC_CHECK_HEADERS(${libusb_prefix}/include/usb.h, [ use_libusb=true ], [ use_libusb=false ]) if test x$use_libusb = xtrue; then CPPFLAGS="$CPPFLAGS -I${libusb_prefix}/include" LDFLAGS="$LDFLAGS -L${libusb_prefix}/lib" LIBS="${LIBS} -lusb" fi ;; esac ] ) AC_MSG_RESULT([enable libusb support : $use_libusb]) AM_CONDITIONAL(PCSC_USE_LIBUSB, test x$use_libusb = xtrue) dnl --enable-threadsafe AC_ARG_ENABLE(threadsafe, [ --enable-threadsafe enable client side thread safety.], [case "${enableval}" in yes) threadsafe=true ;; no) threadsafe=false ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-threadsafe]) ;; esac], [threadsafe=true]) AC_MSG_RESULT([enable threadsafe client : $threadsafe]) AM_CONDITIONAL(PCSC_THR_SAFE, test x$threadsafe = xtrue) dnl --enable-usb option. AC_ARG_ENABLE(usb, [ --enable-usb enable USB hotplug support (Linux only), deprecated], [ case "${enableval}" in yes) AC_MSG_WARN([This option is deprecated. Use libusb instead.]) case "${build_os}" in *linux*) usb=true libusb=false ;; *) AC_MSG_WARN([USB hotplug support only available on Linux]) usb=false ;; esac ;; no) usb=false ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-usb]) ;; esac], [ usb=false ]) AC_MSG_RESULT([enable linux usb capability : $usb (deprecated, use libusb)]) AM_CONDITIONAL(PCSC_LINUX_USB, test x$usb = xtrue) dnl --enable-usbdropdir=DIR AC_ARG_ENABLE(usbdropdir, [ --enable-usbdropdir=DIR directory containing USB drivers (default /usr/local/pcsc/drivers/)], [usbdropdir="${enableval}"], [usbdropdir=false]) if test x${usbdropdir} = xfalse ; then usbdropdir="/usr/local/pcsc/drivers/" fi AC_MSG_RESULT([enable USB drop directory : $usbdropdir]) AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers]) AC_ARG_ENABLE(debug, [ --enable-debug enable debug messages from pcscd.], [ case "${enableval}" in yes) debug=true ;; no) debug=false ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; esac], [debug=true]) AC_MSG_RESULT([enable debug messages : $debug]) if test x${debug} = xtrue ; then AC_DEFINE(PCSC_DEBUG, 1, [enable full PCSC debug messaging.]) AC_DEFINE(MSC_DEBUG, 1, [enable full musclecard debug messaging.]) fi dnl --enable-debugatr AC_ARG_ENABLE(debugatr, [ --enable-debugatr enable ATR debug messages from pcscd.], [ case "${enableval}" in yes) debugatr=true ;; no) debugatr=false ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-debugatr]) ;; esac], [debugatr=false]) AC_MSG_RESULT([enable ATR parsing messages : $debugatr]) if test x${debugatr} = xtrue ; then AC_DEFINE(ATR_DEBUG, 1, [display ATR parsing debug messages.]) fi dnl --enable-scf AC_ARG_ENABLE(scf, [ --enable-scf use SCF for reader support.], [ case "${enableval}" in yes) scf=true ;; no) scf=false ;; *) AC_MSG_ERROR([bad value ${enableval} for --enable-scf]) ;; esac], [scf=false]) AC_MSG_RESULT([enable SCF reader support : $scf]) AM_CONDITIONAL(MSC_ENABLE_SCF, test x$scf = xtrue) dnl --disable-musclecard AC_ARG_ENABLE(musclecard, [ --disable-musclecard musclecard framework disabled.], [case "${enableval}" in yes) musclecard=false ;; no) musclecard=true ;; *) AC_MSG_ERROR([bad value ${enableval} for --disable-musclecard]) ;; esac], [musclecard=false]) AC_MSG_RESULT([disable musclecard : $musclecard]) AM_CONDITIONAL(MCARD_ENABLED, test x$musclecard = xfalse) dnl --enable-muscledropdir=DIR AC_ARG_ENABLE(muscledropdir, [ --enable-muscledropdir=DIR directory containing MuscleCard bundles (default /usr/local/pcsc/services/)], [muscledropdir="${enableval}"], [muscledropdir=false]) if test x${muscledropdir} = xfalse ; then muscledropdir="/usr/local/pcsc/services/" fi AC_MSG_RESULT([enable MuscleCard bundles dir : $muscledropdir]) AC_DEFINE_UNQUOTED(MSC_SVC_DROPDIR, "$muscledropdir", [directory containing MuscleCard bundles]) dnl --enable-confdir=DIR AC_ARG_ENABLE(confdir, [ --enable-confdir=DIR directory containing reader.conf (default /etc)], [confdir="${enableval}"], [confdir=false]) if test x${confdir} != xfalse ; then AC_MSG_RESULT([enable confdir : $confdir]) AC_DEFINE_UNQUOTED(USE_READER_CONF, "$confdir", [directory containing reader.conf (default /etc)]) else AC_MSG_RESULT([enable confdir : /etc (default)]) fi dnl --enable-runpid=FILE AC_ARG_ENABLE(runpid, [ --enable-runpid=FILE file containing pcscd pid], [runpid="${enableval}"], [runpid=false]) AC_MSG_RESULT([enable runpid : $runpid]) if test x${runpid} != xfalse ; then AC_DEFINE_UNQUOTED(USE_RUN_PID, "$runpid", [file containing pcscd pid]) fi dnl --enable-ipcdir=DIR AC_ARG_ENABLE(ipcdir, [ --enable-ipcdir=DIR directory containing IPC files (default /var/run/)], [ipcdir="${enableval}"], [ipcdir=false]) if test x${ipcdir} != xfalse ; then AC_MSG_RESULT([enable ipcdir : $ipcdir]) AC_DEFINE_UNQUOTED(USE_IPCDIR, "$ipcdir", [directory containing IPC files (default /var/run/)]) else AC_MSG_RESULT([enable ipcdir : /var/run/ (default)]) fi dnl warning about pthread if test x${threadsafe} = xtrue ; then AC_MSG_RESULT([NOTE :: You must link pthread libraries with your app.]) AC_DEFINE(USE_THREAD_SAFETY, 1, [enable client side thread safety.]) LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" fi CFLAGS="$CFLAGS -Wall -fno-common" dnl Setup dist stuff AC_SUBST(ac_aux_dir) AC_SUBST(muscledropdir) AC_SUBST(usbdropdir) AC_SUBST(confdir) AC_SUBST(runpid) dnl Write Makefiles. AC_CONFIG_FILES(Makefile src/Makefile src/utils/Makefile etc/Makefile doc/Makefile doc/bundleTool.8 doc/pcscd.8 doc/example/Makefile etc/reader.conf src/libpcsclite.pc) AC_OUTPUT