| 1 |
dnl Process this file with autoconf to produce a configure script.
|
| 2 |
dnl You may need to use autoconf 2.56 or newer
|
| 3 |
|
| 4 |
dnl $Id$
|
| 5 |
|
| 6 |
dnl Require autoconf 2.52
|
| 7 |
AC_PREREQ(2.52)
|
| 8 |
|
| 9 |
AC_INIT(ccid, 0.9.2)
|
| 10 |
AC_CONFIG_SRCDIR(src/ifdhandler.c)
|
| 11 |
AC_CONFIG_AUX_DIR(build)
|
| 12 |
AM_INIT_AUTOMAKE
|
| 13 |
|
| 14 |
dnl Default install dir
|
| 15 |
AC_PREFIX_DEFAULT(/usr/local)
|
| 16 |
|
| 17 |
dnl Automake boilerplate.
|
| 18 |
AC_CANONICAL_HOST
|
| 19 |
|
| 20 |
dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
|
| 21 |
AM_CONFIG_HEADER(config.h)
|
| 22 |
|
| 23 |
dnl Options
|
| 24 |
AM_MAINTAINER_MODE
|
| 25 |
|
| 26 |
dnl 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 |
|
| 34 |
dnl check pcsc-lite version
|
| 35 |
PKG_CHECK_MODULES(PCSC, libpcsclite >= 1.2.9-beta5, [],
|
| 36 |
[ if test -f /usr/local/lib/pkgconfig/libpcsclite.pc ; then
|
| 37 |
AC_MSG_ERROR([use PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure])
|
| 38 |
else
|
| 39 |
AC_MSG_WARN([install pcsc-lite 1.2.9-beta5 or later])
|
| 40 |
fi
|
| 41 |
])
|
| 42 |
|
| 43 |
OLD_CFLAGS="$CFLAGS"
|
| 44 |
CFLAGS="$CFLAGS $PCSC_CFLAGS"
|
| 45 |
AC_CHECK_HEADER(ifdhandler.h,,
|
| 46 |
[AC_MSG_ERROR([ifdhandler.h not found, install pcsc-lite 1.2.9-beta5 or later, or use CFLAGS=... ./configure])],
|
| 47 |
[ #include <ifdhandler.h> ])
|
| 48 |
CFLAGS="$OLD_CFLAGS"
|
| 49 |
|
| 50 |
OLD_LDLIBS="$LDLIBS"
|
| 51 |
LDLIBS="$LDLIBS $PCSCLITE_LIBS"
|
| 52 |
AC_CHECK_LIB(pcsclite, SCardEstablishContext, [],
|
| 53 |
[AC_MSG_ERROR([SCardEstablishContext() not found, install pcsc-lite 1.2.9-beta5 or later,or use LDLIBS=... ./configure])])
|
| 54 |
LDLIBS="$OLD_LDLIBS"
|
| 55 |
|
| 56 |
dnl Add libtool support.
|
| 57 |
AM_PROG_LIBTOOL
|
| 58 |
|
| 59 |
dnl Automatically update the libtool script if it becomes out-of-date.
|
| 60 |
AC_SUBST(LIBTOOL_DEPS)
|
| 61 |
|
| 62 |
dnl Checks for header files.
|
| 63 |
AC_HEADER_STDC
|
| 64 |
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,,
|
| 65 |
[AC_MSG_WARN([some header files not found])])
|
| 66 |
|
| 67 |
dnl Checks for typedefs, structures, and compiler characteristics.
|
| 68 |
AC_C_CONST
|
| 69 |
AC_TYPE_SIZE_T
|
| 70 |
AC_HEADER_TIME
|
| 71 |
|
| 72 |
dnl Checks for library functions.
|
| 73 |
AC_CHECK_FUNCS(select strerror strncpy memcpy)
|
| 74 |
|
| 75 |
dnl Select OS specific versions of source files.
|
| 76 |
AC_SUBST(BUNDLE_HOST)
|
| 77 |
AC_SUBST(DYN_LIB_EXT)
|
| 78 |
case "$host" in
|
| 79 |
*-*-darwin*)
|
| 80 |
BUNDLE_HOST="MacOS"
|
| 81 |
DYN_LIB_EXT="dylib"
|
| 82 |
AM_CONDITIONAL(NEED_PARSER, true)
|
| 83 |
|
| 84 |
AC_SUBST(COREFOUNDATION)
|
| 85 |
COREFOUNDATION="-Wl,-framework,CoreFoundation"
|
| 86 |
|
| 87 |
AC_SUBST(IOKIT)
|
| 88 |
IOKIT="-Wl,-framework,IOKit"
|
| 89 |
if test "$GCC" = "yes"; then
|
| 90 |
CFLAGS="$CFLAGS -no-cpp-precomp"
|
| 91 |
fi
|
| 92 |
;;
|
| 93 |
*)
|
| 94 |
BUNDLE_HOST="Linux"
|
| 95 |
DYN_LIB_EXT="so"
|
| 96 |
AM_CONDITIONAL(NEED_PARSER, false)
|
| 97 |
esac
|
| 98 |
|
| 99 |
CFLAGS="$CFLAGS -Wall"
|
| 100 |
|
| 101 |
dnl --enable-libusb=PATH
|
| 102 |
AC_ARG_ENABLE(libusb,
|
| 103 |
AC_HELP_STRING([--enable-libusb=PATH],[libusb path (default /usr)]),
|
| 104 |
[
|
| 105 |
case ${enableval} in
|
| 106 |
"" | "yes" | "YES")
|
| 107 |
;;
|
| 108 |
"no" | "NO")
|
| 109 |
use_libusb=false
|
| 110 |
;;
|
| 111 |
*)
|
| 112 |
CPPFLAGS="$CPPFLAGS -I${enableval}/include"
|
| 113 |
LDFLAGS="$LDFLAGS -L${enableval}/lib"
|
| 114 |
;;
|
| 115 |
esac
|
| 116 |
]
|
| 117 |
)
|
| 118 |
|
| 119 |
dnl check if libusb is available
|
| 120 |
if test "${use_libusb}" != false ; then
|
| 121 |
AC_SUBST(LIBUSB)
|
| 122 |
AC_CHECK_HEADERS(usb.h, [],
|
| 123 |
[ AC_MSG_ERROR([usb.h not found, use --enable-libusb=PATH]) ])
|
| 124 |
|
| 125 |
ac_save_LIBS="$LIBS"
|
| 126 |
LIBS="$LIBS $COREFOUNDATION $IOKIT"
|
| 127 |
AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb"],
|
| 128 |
[ AC_MSG_ERROR([libusb not found]) ])
|
| 129 |
LIBS="$ac_save_LIBS"
|
| 130 |
|
| 131 |
ac_save_LIBS="$LIBS"
|
| 132 |
LIBS="$LIBS $COREFOUNDATION $IOKIT"
|
| 133 |
AC_CHECK_LIB(usb, usb_get_string_simple, [LIBUSB="$LIBUSB -lusb"],
|
| 134 |
[ AC_MSG_ERROR([your libusb is too old. install version 0.1.7 or above]) ])
|
| 135 |
LIBS="$ac_save_LIBS"
|
| 136 |
fi
|
| 137 |
|
| 138 |
dnl check what to use for dlopen
|
| 139 |
AC_SUBST(LIBDL)
|
| 140 |
AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no)
|
| 141 |
|
| 142 |
dnl --enable-multi-thread
|
| 143 |
AC_ARG_ENABLE(multi-thread,
|
| 144 |
AC_HELP_STRING([--enable-multi-thread],[enable multi threading
|
| 145 |
(default=yes)]),
|
| 146 |
[ multithread="${enableval}" ], [ multithread=yes ] )
|
| 147 |
|
| 148 |
if test "${multithread}" != no ; then
|
| 149 |
ACX_PTHREAD(
|
| 150 |
[ AC_DEFINE(HAVE_PTHREAD, 1,
|
| 151 |
[Define if you have POSIX threads libraries and header files.])
|
| 152 |
], [ AC_MSG_ERROR([POSIX thread support required]) ])
|
| 153 |
fi
|
| 154 |
AC_MSG_RESULT([multi threading : $multithread])
|
| 155 |
|
| 156 |
dnl --enable-bundle=NAME
|
| 157 |
AC_ARG_ENABLE(bundle,
|
| 158 |
AC_HELP_STRING([--enable-bundle=NAME],[bundle directory name
|
| 159 |
(default ifd-ccid.bundle)]),
|
| 160 |
[bundle="${enableval}"], [bundle=false])
|
| 161 |
if test "${bundle}" = false ; then
|
| 162 |
bundle="ifd-ccid.bundle"
|
| 163 |
fi
|
| 164 |
AC_MSG_RESULT([bundle directory name : $bundle])
|
| 165 |
AC_DEFINE_UNQUOTED(BUNDLE, "$bundle", [bundle directory name])
|
| 166 |
|
| 167 |
dnl --enable-usbdropdir=DIR
|
| 168 |
AC_ARG_ENABLE(usbdropdir,
|
| 169 |
AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB
|
| 170 |
drivers (default to pcscd config or $(prefix)/pcsc/drivers)]),
|
| 171 |
[usbdropdir="${enableval}"], [usbdropdir=false])
|
| 172 |
if test "${usbdropdir}" = false ; then
|
| 173 |
usbdropdir=`pkg-config libpcsclite --variable=usbdropdir`
|
| 174 |
fi
|
| 175 |
AC_MSG_RESULT([USB drop directory : $usbdropdir])
|
| 176 |
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers])
|
| 177 |
if test "${usbdropdir}" = "" ; then
|
| 178 |
AC_MSG_ERROR([use --enable-usbdropdir=DIR])
|
| 179 |
fi
|
| 180 |
|
| 181 |
dnl --enable-ccidtwindir=DIR
|
| 182 |
AC_ARG_ENABLE(ccidtwindir,
|
| 183 |
AC_HELP_STRING([--enable-ccidtwindir=DIR],[directory to install the
|
| 184 |
serial Twin driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]),
|
| 185 |
[ccidtwindir="${enableval}"], [ccidtwindir=false])
|
| 186 |
if test "${ccidtwindir}" = false ; then
|
| 187 |
ccidtwindir=`pkg-config libpcsclite --variable=usbdropdir`/serial
|
| 188 |
fi
|
| 189 |
AC_MSG_RESULT([serial twin install dir : $ccidtwindir])
|
| 190 |
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$ccidtwindir", [directory containing USB drivers])
|
| 191 |
|
| 192 |
dnl --enable-pcsclite
|
| 193 |
AC_ARG_ENABLE(pcsclite,
|
| 194 |
AC_HELP_STRING([--enable-pcsclite],[compile for pcsc-lite (default=yes)]),
|
| 195 |
[ pcsclite=no ], [ pcsclite=yes ] )
|
| 196 |
|
| 197 |
if test "${pcsclite}" = no ; then
|
| 198 |
AM_CONDITIONAL(WITHOUT_PCSC, true)
|
| 199 |
AM_CONDITIONAL(NEED_PARSER, true)
|
| 200 |
else
|
| 201 |
AM_CONDITIONAL(WITHOUT_PCSC, false)
|
| 202 |
fi
|
| 203 |
AC_MSG_RESULT([compiled for pcsc-lite : $pcsclite])
|
| 204 |
|
| 205 |
|
| 206 |
dnl Setup dist stuff
|
| 207 |
AC_SUBST(ac_aux_dir)
|
| 208 |
AC_SUBST(bundle)
|
| 209 |
AC_SUBST(usbdropdir)
|
| 210 |
AC_SUBST(ccidtwindir)
|
| 211 |
|
| 212 |
dnl Write Makefiles.
|
| 213 |
AC_CONFIG_FILES(Makefile
|
| 214 |
aclocal/Makefile
|
| 215 |
src/Makefile
|
| 216 |
readers/Makefile
|
| 217 |
examples/Makefile)
|
| 218 |
|
| 219 |
AC_OUTPUT
|
| 220 |
|