| 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.3.1)
|
| 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 |
|
| 21 |
dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
|
| 22 |
AM_CONFIG_HEADER(config.h)
|
| 23 |
|
| 24 |
dnl Options
|
| 25 |
AM_MAINTAINER_MODE
|
| 26 |
|
| 27 |
dnl Checks for programs.
|
| 28 |
AC_PROG_CC
|
| 29 |
AC_PROG_INSTALL
|
| 30 |
AC_PROG_MAKE_SET
|
| 31 |
AC_PROG_LN_S
|
| 32 |
AM_PROG_LEX
|
| 33 |
|
| 34 |
AC_CHECK_FUNCS(strerror)
|
| 35 |
AC_CHECK_FUNCS(strncpy)
|
| 36 |
|
| 37 |
AC_CHECK_HEADERS(errno.h)
|
| 38 |
|
| 39 |
dnl Add libtool support.
|
| 40 |
AM_PROG_LIBTOOL
|
| 41 |
|
| 42 |
dnl Automatically update the libtool script if it becomes out-of-date.
|
| 43 |
AC_SUBST(LIBTOOL_DEPS)
|
| 44 |
|
| 45 |
dnl Checks for header files.
|
| 46 |
AC_HEADER_STDC
|
| 47 |
AC_CHECK_HEADERS(fcntl.h stdlib.h unistd.h termios.h string.h errno.h sys/time.h sys/types.h stdarg.h)
|
| 48 |
|
| 49 |
dnl Checks for typedefs, structures, and compiler characteristics.
|
| 50 |
AC_C_CONST
|
| 51 |
AC_TYPE_SIZE_T
|
| 52 |
AC_HEADER_TIME
|
| 53 |
|
| 54 |
dnl Checks for library functions.
|
| 55 |
AC_CHECK_FUNCS(select strerror strncpy memcpy)
|
| 56 |
|
| 57 |
dnl Select OS specific versions of source files.
|
| 58 |
AC_SUBST(BUNDLE_HOST)
|
| 59 |
AC_SUBST(DYN_LIB_EXT)
|
| 60 |
case "$host" in
|
| 61 |
*-*-darwin*)
|
| 62 |
BUNDLE_HOST="MacOS"
|
| 63 |
DYN_LIB_EXT="dylib"
|
| 64 |
AM_CONDITIONAL(NEED_PARSER, true)
|
| 65 |
|
| 66 |
AC_SUBST(COREFOUNDATION)
|
| 67 |
COREFOUNDATION="-Wl,-framework,CoreFoundation"
|
| 68 |
|
| 69 |
AC_SUBST(IOKIT)
|
| 70 |
IOKIT="-Wl,-framework,IOKit"
|
| 71 |
if test "$GCC" = "yes"; then
|
| 72 |
CFLAGS="$CFLAGS -no-cpp-precomp"
|
| 73 |
fi
|
| 74 |
;;
|
| 75 |
*)
|
| 76 |
BUNDLE_HOST="Linux"
|
| 77 |
DYN_LIB_EXT="so"
|
| 78 |
AM_CONDITIONAL(NEED_PARSER, false)
|
| 79 |
esac
|
| 80 |
|
| 81 |
CFLAGS="$CFLAGS -Wall -fno-common"
|
| 82 |
|
| 83 |
dnl --enable-libusb=PATH
|
| 84 |
AC_ARG_ENABLE(libusb, [ --enable-libusb=PATH libusb path (default /usr)],
|
| 85 |
[
|
| 86 |
case ${enableval} in
|
| 87 |
"" | "yes" | "YES")
|
| 88 |
;;
|
| 89 |
"no" | "NO")
|
| 90 |
use_libusb=false
|
| 91 |
;;
|
| 92 |
*)
|
| 93 |
CPPFLAGS="$CPPFLAGS -I${enableval}/include"
|
| 94 |
LDFLAGS="$LDFLAGS -L${enableval}/lib"
|
| 95 |
;;
|
| 96 |
esac
|
| 97 |
]
|
| 98 |
)
|
| 99 |
|
| 100 |
dnl check if libusb is available
|
| 101 |
AC_SUBST(LIBUSB)
|
| 102 |
AC_CHECK_HEADERS(usb.h, [],
|
| 103 |
[ AC_MSG_ERROR([usb.h not found, use --enable-libusb=PATH]) ])
|
| 104 |
|
| 105 |
ac_save_LIBS="$LIBS"
|
| 106 |
LIBS="$LIBS $COREFOUNDATION $IOKIT"
|
| 107 |
AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb"],
|
| 108 |
[ AC_MSG_ERROR([libusb not found]) ])
|
| 109 |
LIBS="$ac_save_LIBS"
|
| 110 |
|
| 111 |
dnl check shat to use for dlopen
|
| 112 |
AC_SUBST(LIBDL)
|
| 113 |
AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no)
|
| 114 |
|
| 115 |
dnl --enable-bundle=NAME
|
| 116 |
AC_ARG_ENABLE(bundle,
|
| 117 |
[ --enable-bundle=NAME bundle directory name (default ifd-ccid.bundle)],
|
| 118 |
[bundle="${enableval}"], [bundle=false])
|
| 119 |
if test "${bundle}" = false ; then
|
| 120 |
bundle="ifd-ccid.bundle"
|
| 121 |
fi
|
| 122 |
AC_MSG_RESULT([bundle directory name : $bundle])
|
| 123 |
AC_DEFINE_UNQUOTED(BUNDLE, "$bundle", [bundle directory name])
|
| 124 |
|
| 125 |
dnl --enable-usbdropdir=DIR
|
| 126 |
AC_ARG_ENABLE(usbdropdir,
|
| 127 |
[ --enable-usbdropdir=DIR directory containing USB drivers (default /usr/local/pcsc/drivers)],
|
| 128 |
[usbdropdir="${enableval}"], [usbdropdir=false])
|
| 129 |
if test "${usbdropdir}" = false ; then
|
| 130 |
usbdropdir="/usr/local/pcsc/drivers"
|
| 131 |
fi
|
| 132 |
AC_MSG_RESULT([USB drop directory : $usbdropdir])
|
| 133 |
AC_DEFINE_UNQUOTED(PCSCLITE_HP_DROPDIR, "$usbdropdir", [directory containing USB drivers])
|
| 134 |
|
| 135 |
dnl --enable-debugcritical
|
| 136 |
AC_ARG_ENABLE(debugcritical,
|
| 137 |
[ --enable-debugcritical print critical debug messages (default yes)],
|
| 138 |
[ debugcritical="${enableval}" ], [ debugcritical=yes ])
|
| 139 |
dnl yes by default
|
| 140 |
if test "${debugcritical}" != yes
|
| 141 |
then
|
| 142 |
AC_MSG_RESULT([critical debug messages : no])
|
| 143 |
else
|
| 144 |
AC_MSG_RESULT([critical debug messages : yes])
|
| 145 |
AC_DEFINE_UNQUOTED(DEBUG_LEVEL_CRITICAL, 1, [print critical debug messages])
|
| 146 |
fi
|
| 147 |
|
| 148 |
dnl --enable-debuginfo
|
| 149 |
AC_ARG_ENABLE(debuginfo,
|
| 150 |
[ --enable-debuginfo print info debug messages (default yes)],
|
| 151 |
[ debuginfo="${enableval}" ], [ debuginfo=yes ])
|
| 152 |
dnl yes by default
|
| 153 |
if test "${debuginfo}" != yes
|
| 154 |
then
|
| 155 |
AC_MSG_RESULT([info debug messages : no])
|
| 156 |
else
|
| 157 |
AC_MSG_RESULT([info debug messages : yes])
|
| 158 |
AC_DEFINE_UNQUOTED(DEBUG_LEVEL_INFO, 1, [print info debug messages])
|
| 159 |
fi
|
| 160 |
|
| 161 |
dnl --enable-debugperiodic
|
| 162 |
AC_ARG_ENABLE(debugperiodic,
|
| 163 |
[ --enable-debugperiodic print periodic debug messages (default no)],
|
| 164 |
[ debugperiodic="${enableval}" ], [ debugperiodic=no ])
|
| 165 |
dnl no by default
|
| 166 |
if test "${debugperiodic}" != no
|
| 167 |
then
|
| 168 |
AC_MSG_RESULT([periodic debug messages : yes])
|
| 169 |
AC_DEFINE_UNQUOTED(DEBUG_LEVEL_PERIODIC, 1, [print periodic debug messages])
|
| 170 |
else
|
| 171 |
AC_MSG_RESULT([periodic debug messages : no])
|
| 172 |
fi
|
| 173 |
|
| 174 |
dnl --enable-debugcomm
|
| 175 |
AC_ARG_ENABLE(debugcomm,
|
| 176 |
[ --enable-debugcomm print comm debug messages (default no)],
|
| 177 |
[ debugcomm="${enableval}" ], [ debugcomm=no ])
|
| 178 |
dnl no by default
|
| 179 |
if test "${debugcomm}" != no
|
| 180 |
then
|
| 181 |
AC_MSG_RESULT([comm debug messages : yes])
|
| 182 |
AC_DEFINE_UNQUOTED(DEBUG_LEVEL_COMM, 1, [print comm debug messages])
|
| 183 |
else
|
| 184 |
AC_MSG_RESULT([comm debug messages : no])
|
| 185 |
fi
|
| 186 |
|
| 187 |
dnl Setup dist stuff
|
| 188 |
AC_SUBST(ac_aux_dir)
|
| 189 |
AC_SUBST(bundle)
|
| 190 |
AC_SUBST(usbdropdir)
|
| 191 |
|
| 192 |
dnl Write Makefiles.
|
| 193 |
AC_CONFIG_FILES(Makefile src/Makefile readers/Makefile)
|
| 194 |
AC_OUTPUT
|
| 195 |
|