| 1 |
rousseau |
402 |
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 |
rousseau |
1095 |
AC_INIT(ccid, 0.9.2) |
| 10 |
rousseau |
402 |
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 |
rousseau |
448 |
AC_PROG_CPP |
| 29 |
rousseau |
402 |
AC_PROG_INSTALL |
| 30 |
|
|
AC_PROG_MAKE_SET |
| 31 |
|
|
AC_PROG_LN_S |
| 32 |
|
|
AM_PROG_LEX |
| 33 |
rousseau |
872 |
AC_CHECK_PROG([PKGCONFIG], [pkg-config], [yes]) |
| 34 |
rousseau |
1096 |
if test "$PKGCONFIG" = "yes"; then |
| 35 |
|
|
if ! `pkg-config --print-errors --atleast-version=1.2.9-beta5 libpcsclite` |
| 36 |
|
|
then |
| 37 |
|
|
AC_MSG_ERROR([install pcsc-lite 1.2.9-beta5 or later]) |
| 38 |
|
|
fi |
| 39 |
|
|
fi |
| 40 |
rousseau |
402 |
|
| 41 |
|
|
dnl Add libtool support. |
| 42 |
|
|
AM_PROG_LIBTOOL |
| 43 |
|
|
|
| 44 |
|
|
dnl Automatically update the libtool script if it becomes out-of-date. |
| 45 |
|
|
AC_SUBST(LIBTOOL_DEPS) |
| 46 |
|
|
|
| 47 |
|
|
dnl Checks for header files. |
| 48 |
|
|
AC_HEADER_STDC |
| 49 |
rousseau |
876 |
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,, |
| 50 |
|
|
[AC_MSG_WARN([some header files not found])]) |
| 51 |
rousseau |
402 |
|
| 52 |
rousseau |
1183 |
OLD_CFLAGS="$CFLAGS" |
| 53 |
|
|
CFLAGS=`pkg-config libpcsclite --cflags` |
| 54 |
|
|
CFLAGS="$OLD_CFLAGS $CFLAGS" |
| 55 |
|
|
AC_CHECK_HEADER(ifdhandler.h,, |
| 56 |
|
|
[AC_MSG_ERROR([ifdhandler.h not found, install pcsc-lite 1.2.9-beta5 or later])], |
| 57 |
|
|
[ #include <pcsclite.h> ]) |
| 58 |
|
|
CFLAGS="$OLD_CFLAGS" |
| 59 |
rousseau |
876 |
|
| 60 |
rousseau |
402 |
dnl Checks for typedefs, structures, and compiler characteristics. |
| 61 |
|
|
AC_C_CONST |
| 62 |
|
|
AC_TYPE_SIZE_T |
| 63 |
|
|
AC_HEADER_TIME |
| 64 |
|
|
|
| 65 |
|
|
dnl Checks for library functions. |
| 66 |
|
|
AC_CHECK_FUNCS(select strerror strncpy memcpy) |
| 67 |
|
|
|
| 68 |
|
|
dnl Select OS specific versions of source files. |
| 69 |
|
|
AC_SUBST(BUNDLE_HOST) |
| 70 |
|
|
AC_SUBST(DYN_LIB_EXT) |
| 71 |
|
|
case "$host" in |
| 72 |
|
|
*-*-darwin*) |
| 73 |
|
|
BUNDLE_HOST="MacOS" |
| 74 |
|
|
DYN_LIB_EXT="dylib" |
| 75 |
|
|
AM_CONDITIONAL(NEED_PARSER, true) |
| 76 |
|
|
|
| 77 |
|
|
AC_SUBST(COREFOUNDATION) |
| 78 |
|
|
COREFOUNDATION="-Wl,-framework,CoreFoundation" |
| 79 |
|
|
|
| 80 |
|
|
AC_SUBST(IOKIT) |
| 81 |
|
|
IOKIT="-Wl,-framework,IOKit" |
| 82 |
|
|
if test "$GCC" = "yes"; then |
| 83 |
|
|
CFLAGS="$CFLAGS -no-cpp-precomp" |
| 84 |
|
|
fi |
| 85 |
|
|
;; |
| 86 |
|
|
*) |
| 87 |
|
|
BUNDLE_HOST="Linux" |
| 88 |
|
|
DYN_LIB_EXT="so" |
| 89 |
|
|
AM_CONDITIONAL(NEED_PARSER, false) |
| 90 |
|
|
esac |
| 91 |
|
|
|
| 92 |
rousseau |
887 |
CFLAGS="$CFLAGS -Wall" |
| 93 |
rousseau |
402 |
|
| 94 |
rousseau |
436 |
dnl --enable-libusb=PATH |
| 95 |
rousseau |
460 |
AC_ARG_ENABLE(libusb, |
| 96 |
|
|
AC_HELP_STRING([--enable-libusb=PATH],[libusb path (default /usr)]), |
| 97 |
rousseau |
436 |
[ |
| 98 |
|
|
case ${enableval} in |
| 99 |
|
|
"" | "yes" | "YES") |
| 100 |
|
|
;; |
| 101 |
|
|
"no" | "NO") |
| 102 |
|
|
use_libusb=false |
| 103 |
|
|
;; |
| 104 |
|
|
*) |
| 105 |
|
|
CPPFLAGS="$CPPFLAGS -I${enableval}/include" |
| 106 |
|
|
LDFLAGS="$LDFLAGS -L${enableval}/lib" |
| 107 |
|
|
;; |
| 108 |
|
|
esac |
| 109 |
|
|
] |
| 110 |
|
|
) |
| 111 |
|
|
|
| 112 |
rousseau |
402 |
dnl check if libusb is available |
| 113 |
rousseau |
565 |
if test "${use_libusb}" != false ; then |
| 114 |
|
|
AC_SUBST(LIBUSB) |
| 115 |
|
|
AC_CHECK_HEADERS(usb.h, [], |
| 116 |
|
|
[ AC_MSG_ERROR([usb.h not found, use --enable-libusb=PATH]) ]) |
| 117 |
rousseau |
436 |
|
| 118 |
rousseau |
565 |
ac_save_LIBS="$LIBS" |
| 119 |
|
|
LIBS="$LIBS $COREFOUNDATION $IOKIT" |
| 120 |
|
|
AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb"], |
| 121 |
|
|
[ AC_MSG_ERROR([libusb not found]) ]) |
| 122 |
|
|
LIBS="$ac_save_LIBS" |
| 123 |
rousseau |
402 |
|
| 124 |
rousseau |
565 |
ac_save_LIBS="$LIBS" |
| 125 |
|
|
LIBS="$LIBS $COREFOUNDATION $IOKIT" |
| 126 |
|
|
AC_CHECK_LIB(usb, usb_get_string_simple, [LIBUSB="$LIBUSB -lusb"], |
| 127 |
|
|
[ AC_MSG_ERROR([your libusb is too old. install version 0.1.7 or above]) ]) |
| 128 |
|
|
LIBS="$ac_save_LIBS" |
| 129 |
|
|
fi |
| 130 |
rousseau |
556 |
|
| 131 |
rousseau |
402 |
dnl check shat to use for dlopen |
| 132 |
|
|
AC_SUBST(LIBDL) |
| 133 |
|
|
AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no) |
| 134 |
|
|
|
| 135 |
rousseau |
460 |
dnl --enable-multi-thread |
| 136 |
|
|
AC_ARG_ENABLE(multi-thread, |
| 137 |
|
|
AC_HELP_STRING([--enable-multi-thread],[enable multi threading |
| 138 |
|
|
(default=yes)]), |
| 139 |
|
|
[ multithread="${enableval}" ], [ multithread=yes ] ) |
| 140 |
|
|
|
| 141 |
|
|
if test "${multithread}" != no ; then |
| 142 |
rousseau |
563 |
ACX_PTHREAD( |
| 143 |
|
|
[ AC_DEFINE(HAVE_PTHREAD, 1, |
| 144 |
|
|
[Define if you have POSIX threads libraries and header files.]) |
| 145 |
|
|
], [ AC_MSG_ERROR([POSIX thread support required]) ]) |
| 146 |
rousseau |
460 |
fi |
| 147 |
|
|
AC_MSG_RESULT([multi threading : $multithread]) |
| 148 |
|
|
|
| 149 |
rousseau |
402 |
dnl --enable-bundle=NAME |
| 150 |
|
|
AC_ARG_ENABLE(bundle, |
| 151 |
rousseau |
460 |
AC_HELP_STRING([--enable-bundle=NAME],[bundle directory name |
| 152 |
|
|
(default ifd-ccid.bundle)]), |
| 153 |
|
|
[bundle="${enableval}"], [bundle=false]) |
| 154 |
rousseau |
402 |
if test "${bundle}" = false ; then |
| 155 |
|
|
bundle="ifd-ccid.bundle" |
| 156 |
|
|
fi |
| 157 |
|
|
AC_MSG_RESULT([bundle directory name : $bundle]) |
| 158 |
|
|
AC_DEFINE_UNQUOTED(BUNDLE, "$bundle", [bundle directory name]) |
| 159 |
|
|
|
| 160 |
|
|
dnl --enable-usbdropdir=DIR |
| 161 |
|
|
AC_ARG_ENABLE(usbdropdir, |
| 162 |
rousseau |
460 |
AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB |
| 163 |
rousseau |
871 |
drivers (default to pcscd config or $(prefix)/pcsc/drivers)]), |
| 164 |
rousseau |
460 |
[usbdropdir="${enableval}"], [usbdropdir=false]) |
| 165 |
rousseau |
402 |
if test "${usbdropdir}" = false ; then |
| 166 |
rousseau |
910 |
if test "$PKGCONFIG" = yes ; then |
| 167 |
|
|
usbdropdir=`pkg-config libpcsclite --variable=usbdropdir` |
| 168 |
|
|
else |
| 169 |
|
|
usbdropdir="" |
| 170 |
|
|
fi |
| 171 |
|
|
if test -z "$usbdropdir" ; then |
| 172 |
|
|
if test "$prefix" = NONE ; then |
| 173 |
|
|
usbdropdir="$ac_default_prefix/pcsc/drivers" |
| 174 |
rousseau |
872 |
else |
| 175 |
rousseau |
910 |
usbdropdir="$prefix/pcsc/drivers" |
| 176 |
rousseau |
872 |
fi |
| 177 |
rousseau |
564 |
fi |
| 178 |
rousseau |
402 |
fi |
| 179 |
|
|
AC_MSG_RESULT([USB drop directory : $usbdropdir]) |
| 180 |
|
|
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers]) |
| 181 |
|
|
|
| 182 |
rousseau |
564 |
dnl --enable-ccidtwindir=DIR |
| 183 |
|
|
AC_ARG_ENABLE(ccidtwindir, |
| 184 |
|
|
AC_HELP_STRING([--enable-ccidtwindir=DIR],[directory to install the |
| 185 |
rousseau |
871 |
serial Twin driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]), |
| 186 |
rousseau |
564 |
[ccidtwindir="${enableval}"], [ccidtwindir=false]) |
| 187 |
|
|
if test "${ccidtwindir}" = false ; then |
| 188 |
rousseau |
910 |
if test "$PKGCONFIG" = yes ; then |
| 189 |
|
|
ccidtwindir=`pkg-config libpcsclite --variable=usbdropdir` |
| 190 |
|
|
else |
| 191 |
|
|
AC_MSG_RESULT([You should install pkg-config to get this configured automatically from pcsc-lite installation]) |
| 192 |
|
|
ccidtwindir="" |
| 193 |
|
|
fi |
| 194 |
|
|
if test -z "$ccidtwindir" ; then |
| 195 |
|
|
if test "$prefix" = NONE ; then |
| 196 |
|
|
ccidtwindir="$ac_default_prefix/pcsc/drivers" |
| 197 |
rousseau |
872 |
else |
| 198 |
rousseau |
910 |
ccidtwindir="$prefix/pcsc/drivers" |
| 199 |
rousseau |
872 |
fi |
| 200 |
rousseau |
564 |
fi |
| 201 |
rousseau |
910 |
ccidtwindir="$ccidtwindir/serial" |
| 202 |
rousseau |
564 |
fi |
| 203 |
|
|
AC_MSG_RESULT([serial twin install dir : $ccidtwindir]) |
| 204 |
|
|
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$ccidtwindir", [directory containing USB drivers]) |
| 205 |
|
|
|
| 206 |
rousseau |
896 |
dnl --enable-pcsclite |
| 207 |
|
|
AC_ARG_ENABLE(pcsclite, |
| 208 |
|
|
AC_HELP_STRING([--enable-pcsclite],[compile for pcsc-lite (default=yes)]), |
| 209 |
|
|
[ pcsclite=no ], [ pcsclite=yes ] ) |
| 210 |
rousseau |
564 |
|
| 211 |
rousseau |
896 |
if test "${pcsclite}" = no ; then |
| 212 |
|
|
AM_CONDITIONAL(NEED_PARSER, true) |
| 213 |
|
|
fi |
| 214 |
|
|
AC_MSG_RESULT([compiled for pcsc-lite : $pcsclite]) |
| 215 |
|
|
|
| 216 |
|
|
|
| 217 |
rousseau |
402 |
dnl Setup dist stuff |
| 218 |
|
|
AC_SUBST(ac_aux_dir) |
| 219 |
|
|
AC_SUBST(bundle) |
| 220 |
|
|
AC_SUBST(usbdropdir) |
| 221 |
rousseau |
564 |
AC_SUBST(ccidtwindir) |
| 222 |
rousseau |
402 |
|
| 223 |
|
|
dnl Write Makefiles. |
| 224 |
rousseau |
887 |
AC_CONFIG_FILES(Makefile |
| 225 |
|
|
aclocal/Makefile |
| 226 |
|
|
src/Makefile |
| 227 |
|
|
readers/Makefile |
| 228 |
|
|
examples/Makefile) |
| 229 |
|
|
|
| 230 |
rousseau |
402 |
AC_OUTPUT |
| 231 |
|
|
|