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,
2010-08-17 16:40:35 +02:00
AC_HELP_STRING([--with-drivers=driver@<:@[[[,]]]driver...@:>@], [Only use specific drivers (available drivers: acr122,arygon,pn531_usb,pn533_usb,pn532_uart)]),
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)
]
)
case "${DRIVER_BUILD_LIST}" in
default)
DRIVER_BUILD_LIST="acr122 arygon pn531_usb pn533_usb"
;;
all)
DRIVER_BUILD_LIST="acr122 arygon pn531_usb pn533_usb pn532_uart"
;;
esac
DRIVERS_CFLAGS=""
2010-07-31 15:21:56 +02:00
driver_acr122_enabled="no"
driver_pn531_usb_enabled="no"
driver_pn533_usb_enabled="no"
driver_arygon_enabled="no"
driver_pn532_uart_enabled="no"
2010-04-15 16:41:13 +02:00
for driver in ${DRIVER_BUILD_LIST}
do
case "${driver}" in
acr122)
pcsc_required="yes"
2010-07-31 15:21:56 +02:00
driver_acr122_enabled="yes"
2010-04-15 16:41:13 +02:00
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_ACR122_ENABLED"
;;
pn531_usb)
libusb_required="yes"
2010-07-31 15:21:56 +02:00
driver_pn531_usb_enabled="yes"
2010-04-15 16:41:13 +02:00
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN531_USB_ENABLED"
;;
pn533_usb)
libusb_required="yes"
2010-07-31 15:21:56 +02:00
driver_pn533_usb_enabled="yes"
2010-04-15 16:41:13 +02:00
DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN533_USB_ENABLED"
;;
arygon)
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)
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"
;;
*)
AC_MSG_ERROR([Unknow driver: $driver])
;;
esac
done
AC_SUBST(DRIVERS_CFLAGS)
2010-07-31 15:21:56 +02:00
AM_CONDITIONAL(DRIVER_ACR122_ENABLED, [test x"$driver_acr122_enabled" = xyes])
AM_CONDITIONAL(DRIVER_PN531_USB_ENABLED, [test x"$driver_pn531_usb_enabled" = xyes])
AM_CONDITIONAL(DRIVER_PN533_USB_ENABLED, [test x"$driver_pn533_usb_enabled" = xyes])
AM_CONDITIONAL(DRIVER_ARYGON_ENABLED, [test x"$driver_arygon_enabled" = xyes])
AM_CONDITIONAL(DRIVER_PN532_UART_ENABLED, [test x"$driver_pn532_uart_enabled" = xyes])
])
AC_DEFUN([LIBNFC_DRIVERS_SUMMARY],[
echo
echo "Selected drivers:"
echo " acr122........... $driver_acr122_enabled"
echo " arygon........... $driver_arygon_enabled"
echo " pn531_usb........ $driver_pn531_usb_enabled"
echo " pn532_uart....... $driver_pn532_uart_enabled"
echo " pn533_usb........ $driver_pn533_usb_enabled"
2010-04-15 16:41:13 +02:00
])