2010-04-15 16:41:13 +02:00
dnl Handle drivers arguments list
AC_DEFUN([LIBNFC_ARG_WITH_DRIVERS],
[
AC_MSG_CHECKING(which drivers to build)
AC_ARG_WITH(drivers,
2013-01-20 17:00:21 +01:00
AS_HELP_STRING([--with-drivers=DRIVERS], [Use a custom driver set, where DRIVERS is a coma-separated list of drivers to build support for. Available drivers are: 'acr122_pcsc', 'acr122_usb', 'acr122s', 'arygon', 'pn532_uart' and 'pn53x_usb'. Default drivers set is 'acr122_usb,acr122s,arygon,pn532_uart,pn53x_usb'. The special driver set 'all' compile all available drivers.]),
2010-04-15 16:41:13 +02:00
[ case "${withval}" in
yes | no)
dnl ignore calls without any arguments
DRIVER_BUILD_LIST="default"
AC_MSG_RESULT(default drivers)
;;
*)
DRIVER_BUILD_LIST=`echo ${withval} | sed "s/,/ /g"`
AC_MSG_RESULT(${DRIVER_BUILD_LIST})
;;
esac
],
[
DRIVER_BUILD_LIST="default"
AC_MSG_RESULT(default drivers)
]
)
2013-02-28 23:24:42 +01:00
2010-04-15 16:41:13 +02:00
case "${DRIVER_BUILD_LIST}" in
default)
2013-02-28 23:24:42 +01:00
DRIVER_BUILD_LIST="acr122_usb acr122s arygon pn53x_usb pn532_uart pn532_spi"
2010-04-15 16:41:13 +02:00
;;
all)
2013-02-28 23:24:42 +01:00
DRIVER_BUILD_LIST="acr122_pcsc acr122_usb acr122s arygon pn53x_usb pn532_uart pn532_spi"
2010-04-15 16:41:13 +02:00
;;
esac
2013-02-28 23:24:42 +01:00
2010-04-15 16:41:13 +02:00
DRIVERS_CFLAGS=""
2012-05-02 01:09:57 +02:00
driver_acr122_pcsc_enabled="no"
driver_acr122_usb_enabled="no"
2011-11-23 04:05:12 +01:00
driver_acr122s_enabled="no"
2011-03-05 20:54:52 +01:00
driver_pn53x_usb_enabled="no"
2010-07-31 15:21:56 +02:00
driver_arygon_enabled="no"
driver_pn532_uart_enabled="no"
2013-02-28 23:24:42 +01:00
driver_pn532_spi_enabled="no"
2010-07-31 15:21:56 +02:00
2010-04-15 16:41:13 +02:00
for driver in ${DRIVER_BUILD_LIST}
do
case "${driver}" in
2012-05-02 01:09:57 +02:00
acr122_pcsc)
2010-04-15 16:41:13 +02:00
pcsc_required="yes"
2012-05-02 01:09:57 +02:00
driver_acr122_pcsc_enabled="yes"
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_ACR122_PCSC_ENABLED"
;;
acr122_usb)
2012-01-26 16:23:11 +01:00
libusb_required="yes"
2012-05-02 01:09:57 +02:00
driver_acr122_usb_enabled="yes"
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_ACR122_USB_ENABLED"
2010-04-15 16:41:13 +02:00
;;
2011-11-23 04:05:12 +01:00
acr122s)
2013-03-18 23:07:19 +01:00
uart_required="yes"
2011-11-23 04:05:12 +01:00
driver_acr122s_enabled="yes"
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_ACR122S_ENABLED"
;;
2011-03-05 20:54:52 +01:00
pn53x_usb)
2010-04-15 16:41:13 +02:00
libusb_required="yes"
2012-05-02 01:09:57 +02:00
driver_pn53x_usb_enabled="yes"
2011-03-05 20:54:52 +01:00
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN53X_USB_ENABLED"
2010-04-15 16:41:13 +02:00
;;
arygon)
2013-03-18 23:07:19 +01:00
uart_required="yes"
2010-07-31 15:21:56 +02:00
driver_arygon_enabled="yes"
2010-04-15 16:41:13 +02:00
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_ARYGON_ENABLED"
;;
pn532_uart)
2013-03-18 23:07:19 +01:00
uart_required="yes"
2010-07-31 15:21:56 +02:00
driver_pn532_uart_enabled="yes"
2010-04-15 16:41:13 +02:00
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN532_UART_ENABLED"
;;
2013-02-28 23:24:42 +01:00
pn532_spi)
driver_pn532_spi_enabled="yes"
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN532_SPI_ENABLED"
;;
2010-04-15 16:41:13 +02:00
*)
AC_MSG_ERROR([Unknow driver: $driver])
;;
esac
done
AC_SUBST(DRIVERS_CFLAGS)
2012-05-02 01:09:57 +02:00
AM_CONDITIONAL(DRIVER_ACR122_PCSC_ENABLED, [test x"$driver_acr122_pcsc_enabled" = xyes])
AM_CONDITIONAL(DRIVER_ACR122_USB_ENABLED, [test x"$driver_acr122_usb_enabled" = xyes])
2011-11-23 04:05:12 +01:00
AM_CONDITIONAL(DRIVER_ACR122S_ENABLED, [test x"$driver_acr122s_enabled" = xyes])
2011-03-05 20:54:52 +01:00
AM_CONDITIONAL(DRIVER_PN53X_USB_ENABLED, [test x"$driver_pn53x_usb_enabled" = xyes])
2010-07-31 15:21:56 +02:00
AM_CONDITIONAL(DRIVER_ARYGON_ENABLED, [test x"$driver_arygon_enabled" = xyes])
AM_CONDITIONAL(DRIVER_PN532_UART_ENABLED, [test x"$driver_pn532_uart_enabled" = xyes])
2013-02-28 23:24:42 +01:00
AM_CONDITIONAL(DRIVER_PN532_SPI_ENABLED, [test x"$driver_pn532_spi_enabled" = xyes])
2010-07-31 15:21:56 +02:00
])
AC_DEFUN([LIBNFC_DRIVERS_SUMMARY],[
echo
echo "Selected drivers:"
2012-05-02 01:09:57 +02:00
echo " acr122_pcsc...... $driver_acr122_pcsc_enabled"
echo " acr122_usb....... $driver_acr122_usb_enabled"
2011-11-23 04:05:12 +01:00
echo " acr122s.......... $driver_acr122s_enabled"
2010-07-31 15:21:56 +02:00
echo " arygon........... $driver_arygon_enabled"
2011-03-05 20:54:52 +01:00
echo " pn53x_usb........ $driver_pn53x_usb_enabled"
2010-07-31 15:21:56 +02:00
echo " pn532_uart....... $driver_pn532_uart_enabled"
2013-02-28 23:24:42 +01:00
echo " pn532_spi....... $driver_pn532_spi_enabled"
2010-04-15 16:41:13 +02:00
])