| 6 |
dnl Require autoconf 2.52 |
dnl Require autoconf 2.52 |
| 7 |
AC_PREREQ(2.52) |
AC_PREREQ(2.52) |
| 8 |
|
|
| 9 |
AC_INIT(ccid, 0.3.1) |
AC_INIT(ccid, 0.4.2) |
| 10 |
AC_CONFIG_SRCDIR(src/ifdhandler.c) |
AC_CONFIG_SRCDIR(src/ifdhandler.c) |
| 11 |
AC_CONFIG_AUX_DIR(build) |
AC_CONFIG_AUX_DIR(build) |
| 12 |
AM_INIT_AUTOMAKE |
AM_INIT_AUTOMAKE |
| 17 |
dnl Automake boilerplate. |
dnl Automake boilerplate. |
| 18 |
AC_CANONICAL_HOST |
AC_CANONICAL_HOST |
| 19 |
|
|
|
|
|
| 20 |
dnl create a config.h file (Automake will add -DHAVE_CONFIG_H) |
dnl create a config.h file (Automake will add -DHAVE_CONFIG_H) |
| 21 |
AM_CONFIG_HEADER(config.h) |
AM_CONFIG_HEADER(config.h) |
| 22 |
|
|
| 30 |
AC_PROG_MAKE_SET |
AC_PROG_MAKE_SET |
| 31 |
AC_PROG_LN_S |
AC_PROG_LN_S |
| 32 |
AM_PROG_LEX |
AM_PROG_LEX |
| 33 |
|
AC_CHECK_PROG([PKGCONFIG], [pkg-config], [yes]) |
|
AC_CHECK_FUNCS(strerror) |
|
|
AC_CHECK_FUNCS(strncpy) |
|
|
|
|
|
AC_CHECK_HEADERS(errno.h) |
|
| 34 |
|
|
| 35 |
dnl Add libtool support. |
dnl Add libtool support. |
| 36 |
AM_PROG_LIBTOOL |
AM_PROG_LIBTOOL |
| 40 |
|
|
| 41 |
dnl Checks for header files. |
dnl Checks for header files. |
| 42 |
AC_HEADER_STDC |
AC_HEADER_STDC |
| 43 |
AC_CHECK_HEADERS(fcntl.h stdlib.h unistd.h termios.h string.h errno.h sys/time.h sys/types.h stdarg.h) |
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,, |
| 44 |
|
[AC_MSG_WARN([some header files not found])]) |
| 45 |
|
|
| 46 |
|
AC_CHECK_HEADERS(PCSC/ifdhandler.h,, |
| 47 |
|
[AC_MSG_ERROR([PCSC/ifdhandler.h not found, install pcsc-lite 1.2.9-beta3 or later])], |
| 48 |
|
[ #include <PCSC/pcsclite.h> ]) |
| 49 |
|
|
| 50 |
|
|
| 51 |
dnl Checks for typedefs, structures, and compiler characteristics. |
dnl Checks for typedefs, structures, and compiler characteristics. |
| 52 |
AC_C_CONST |
AC_C_CONST |
| 80 |
AM_CONDITIONAL(NEED_PARSER, false) |
AM_CONDITIONAL(NEED_PARSER, false) |
| 81 |
esac |
esac |
| 82 |
|
|
| 83 |
CFLAGS="$CFLAGS -Wall -fno-common" |
CFLAGS="$CFLAGS -Wall" |
| 84 |
|
|
| 85 |
dnl --enable-libusb=PATH |
dnl --enable-libusb=PATH |
| 86 |
AC_ARG_ENABLE(libusb, [ --enable-libusb=PATH libusb path (default /usr)], |
AC_ARG_ENABLE(libusb, |
| 87 |
|
AC_HELP_STRING([--enable-libusb=PATH],[libusb path (default /usr)]), |
| 88 |
[ |
[ |
| 89 |
case ${enableval} in |
case ${enableval} in |
| 90 |
"" | "yes" | "YES") |
"" | "yes" | "YES") |
| 101 |
) |
) |
| 102 |
|
|
| 103 |
dnl check if libusb is available |
dnl check if libusb is available |
| 104 |
AC_SUBST(LIBUSB) |
if test "${use_libusb}" != false ; then |
| 105 |
AC_CHECK_HEADERS(usb.h, [], |
AC_SUBST(LIBUSB) |
| 106 |
[ AC_MSG_ERROR([usb.h not found, use --enable-libusb=PATH]) ]) |
AC_CHECK_HEADERS(usb.h, [], |
| 107 |
|
[ AC_MSG_ERROR([usb.h not found, use --enable-libusb=PATH]) ]) |
| 108 |
ac_save_LIBS="$LIBS" |
|
| 109 |
LIBS="$LIBS $COREFOUNDATION $IOKIT" |
ac_save_LIBS="$LIBS" |
| 110 |
AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb"], |
LIBS="$LIBS $COREFOUNDATION $IOKIT" |
| 111 |
[ AC_MSG_ERROR([libusb not found]) ]) |
AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb"], |
| 112 |
LIBS="$ac_save_LIBS" |
[ AC_MSG_ERROR([libusb not found]) ]) |
| 113 |
|
LIBS="$ac_save_LIBS" |
| 114 |
|
|
| 115 |
|
ac_save_LIBS="$LIBS" |
| 116 |
|
LIBS="$LIBS $COREFOUNDATION $IOKIT" |
| 117 |
|
AC_CHECK_LIB(usb, usb_get_string_simple, [LIBUSB="$LIBUSB -lusb"], |
| 118 |
|
[ AC_MSG_ERROR([your libusb is too old. install version 0.1.7 or above]) ]) |
| 119 |
|
LIBS="$ac_save_LIBS" |
| 120 |
|
fi |
| 121 |
|
|
| 122 |
dnl check shat to use for dlopen |
dnl check shat to use for dlopen |
| 123 |
AC_SUBST(LIBDL) |
AC_SUBST(LIBDL) |
| 124 |
AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no) |
AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no) |
| 125 |
|
|
| 126 |
|
dnl --enable-multi-thread |
| 127 |
|
AC_ARG_ENABLE(multi-thread, |
| 128 |
|
AC_HELP_STRING([--enable-multi-thread],[enable multi threading |
| 129 |
|
(default=yes)]), |
| 130 |
|
[ multithread="${enableval}" ], [ multithread=yes ] ) |
| 131 |
|
|
| 132 |
|
if test "${multithread}" != no ; then |
| 133 |
|
ACX_PTHREAD( |
| 134 |
|
[ AC_DEFINE(HAVE_PTHREAD, 1, |
| 135 |
|
[Define if you have POSIX threads libraries and header files.]) |
| 136 |
|
], [ AC_MSG_ERROR([POSIX thread support required]) ]) |
| 137 |
|
fi |
| 138 |
|
AC_MSG_RESULT([multi threading : $multithread]) |
| 139 |
|
|
| 140 |
dnl --enable-bundle=NAME |
dnl --enable-bundle=NAME |
| 141 |
AC_ARG_ENABLE(bundle, |
AC_ARG_ENABLE(bundle, |
| 142 |
[ --enable-bundle=NAME bundle directory name (default ifd-ccid.bundle)], |
AC_HELP_STRING([--enable-bundle=NAME],[bundle directory name |
| 143 |
[bundle="${enableval}"], [bundle=false]) |
(default ifd-ccid.bundle)]), |
| 144 |
|
[bundle="${enableval}"], [bundle=false]) |
| 145 |
if test "${bundle}" = false ; then |
if test "${bundle}" = false ; then |
| 146 |
bundle="ifd-ccid.bundle" |
bundle="ifd-ccid.bundle" |
| 147 |
fi |
fi |
| 150 |
|
|
| 151 |
dnl --enable-usbdropdir=DIR |
dnl --enable-usbdropdir=DIR |
| 152 |
AC_ARG_ENABLE(usbdropdir, |
AC_ARG_ENABLE(usbdropdir, |
| 153 |
[ --enable-usbdropdir=DIR directory containing USB drivers (default /usr/local/pcsc/drivers)], |
AC_HELP_STRING([--enable-usbdropdir=DIR],[directory containing USB |
| 154 |
[usbdropdir="${enableval}"], [usbdropdir=false]) |
drivers (default to pcscd config or $(prefix)/pcsc/drivers)]), |
| 155 |
|
[usbdropdir="${enableval}"], [usbdropdir=false]) |
| 156 |
if test "${usbdropdir}" = false ; then |
if test "${usbdropdir}" = false ; then |
| 157 |
usbdropdir="/usr/local/pcsc/drivers" |
if test "$PKGCONFIG" = yes ; then |
| 158 |
|
usbdropdir=`pkg-config libpcsclite --variable=usbdropdir` |
| 159 |
|
else |
| 160 |
|
usbdropdir="" |
| 161 |
|
fi |
| 162 |
|
if test -z "$usbdropdir" ; then |
| 163 |
|
if test "$prefix" = NONE ; then |
| 164 |
|
usbdropdir="$ac_default_prefix/pcsc/drivers" |
| 165 |
|
else |
| 166 |
|
usbdropdir="$prefix/pcsc/drivers" |
| 167 |
|
fi |
| 168 |
|
fi |
| 169 |
fi |
fi |
| 170 |
AC_MSG_RESULT([USB drop directory : $usbdropdir]) |
AC_MSG_RESULT([USB drop directory : $usbdropdir]) |
| 171 |
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers]) |
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers]) |
| 172 |
|
|
| 173 |
dnl --enable-debugcritical |
dnl --enable-ccidtwindir=DIR |
| 174 |
AC_ARG_ENABLE(debugcritical, |
AC_ARG_ENABLE(ccidtwindir, |
| 175 |
[ --enable-debugcritical print critical debug messages (default yes)], |
AC_HELP_STRING([--enable-ccidtwindir=DIR],[directory to install the |
| 176 |
[ debugcritical="${enableval}" ], [ debugcritical=yes ]) |
serial Twin driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]), |
| 177 |
dnl yes by default |
[ccidtwindir="${enableval}"], [ccidtwindir=false]) |
| 178 |
if test "${debugcritical}" != yes |
if test "${ccidtwindir}" = false ; then |
| 179 |
then |
if test "$PKGCONFIG" = yes ; then |
| 180 |
AC_MSG_RESULT([critical debug messages : no]) |
ccidtwindir=`pkg-config libpcsclite --variable=usbdropdir` |
| 181 |
else |
else |
| 182 |
AC_MSG_RESULT([critical debug messages : yes]) |
AC_MSG_RESULT([You should install pkg-config to get this configured automatically from pcsc-lite installation]) |
| 183 |
AC_DEFINE_UNQUOTED(DEBUG_LEVEL_CRITICAL, 1, [print critical debug messages]) |
ccidtwindir="" |
| 184 |
fi |
fi |
| 185 |
|
if test -z "$ccidtwindir" ; then |
| 186 |
dnl --enable-debuginfo |
if test "$prefix" = NONE ; then |
| 187 |
AC_ARG_ENABLE(debuginfo, |
ccidtwindir="$ac_default_prefix/pcsc/drivers" |
| 188 |
[ --enable-debuginfo print info debug messages (default yes)], |
else |
| 189 |
[ debuginfo="${enableval}" ], [ debuginfo=yes ]) |
ccidtwindir="$prefix/pcsc/drivers" |
| 190 |
dnl yes by default |
fi |
| 191 |
if test "${debuginfo}" != yes |
fi |
| 192 |
then |
ccidtwindir="$ccidtwindir/serial" |
|
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, |
|
|
[ --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, |
|
|
[ --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]) |
|
| 193 |
fi |
fi |
| 194 |
|
AC_MSG_RESULT([serial twin install dir : $ccidtwindir]) |
| 195 |
|
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$ccidtwindir", [directory containing USB drivers]) |
| 196 |
|
|
| 197 |
|
dnl --enable-pcsclite |
| 198 |
|
AC_ARG_ENABLE(pcsclite, |
| 199 |
|
AC_HELP_STRING([--enable-pcsclite],[compile for pcsc-lite (default=yes)]), |
| 200 |
|
[ pcsclite=no ], [ pcsclite=yes ] ) |
| 201 |
|
|
| 202 |
|
if test "${pcsclite}" = no ; then |
| 203 |
|
AM_CONDITIONAL(NEED_PARSER, true) |
| 204 |
|
fi |
| 205 |
|
AC_MSG_RESULT([compiled for pcsc-lite : $pcsclite]) |
| 206 |
|
|
| 207 |
|
|
| 208 |
dnl Setup dist stuff |
dnl Setup dist stuff |
| 209 |
AC_SUBST(ac_aux_dir) |
AC_SUBST(ac_aux_dir) |
| 210 |
AC_SUBST(bundle) |
AC_SUBST(bundle) |
| 211 |
AC_SUBST(usbdropdir) |
AC_SUBST(usbdropdir) |
| 212 |
|
AC_SUBST(ccidtwindir) |
| 213 |
|
|
| 214 |
dnl Write Makefiles. |
dnl Write Makefiles. |
| 215 |
AC_CONFIG_FILES(Makefile src/Makefile readers/Makefile) |
AC_CONFIG_FILES(Makefile |
| 216 |
|
aclocal/Makefile |
| 217 |
|
src/Makefile |
| 218 |
|
readers/Makefile |
| 219 |
|
examples/Makefile) |
| 220 |
|
|
| 221 |
AC_OUTPUT |
AC_OUTPUT |
| 222 |
|
|