Do not build pn532_spi if spi is not available

Check if the include file linux/spi/spidev.h is available and, only if
the header file is present, add the driver pn532_spi for "default" and
"all" driver configuration.

This Linux header file is not present on Mac OS X for example.
This commit is contained in:
Ludovic Rousseau 2013-04-03 16:08:34 +02:00
parent 8b8b8d49a7
commit a57793fe5a
2 changed files with 11 additions and 2 deletions

View file

@ -48,6 +48,7 @@ fi
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_CHECK_HEADERS([fcntl.h limits.h stdio.h stdlib.h stdint.h stddef.h stdbool.h sys/ioctl.h sys/param.h sys/time.h termios.h])
AC_CHECK_HEADERS([linux/spi/spidev.h], [spi_available="yes"])
AC_CHECK_FUNCS([memmove memset select strdup strerror strstr strtol usleep],
[AC_DEFINE([_XOPEN_SOURCE], [600], [Enable POSIX extensions if present])])

View file

@ -25,10 +25,18 @@ AC_DEFUN([LIBNFC_ARG_WITH_DRIVERS],
case "${DRIVER_BUILD_LIST}" in
default)
DRIVER_BUILD_LIST="acr122_usb acr122s arygon pn53x_usb pn532_uart pn532_spi"
DRIVER_BUILD_LIST="acr122_usb acr122s arygon pn53x_usb pn532_uart"
if test x"$spi_available" = x"yes"
then
DRIVER_BUILD_LIST="$DRIVER_BUILD_LIST pn532_spi"
fi
;;
all)
DRIVER_BUILD_LIST="acr122_pcsc acr122_usb acr122s arygon pn53x_usb pn532_uart pn532_spi"
DRIVER_BUILD_LIST="acr122_pcsc acr122_usb acr122s arygon pn53x_usb pn532_uart"
if test x"$spi_available" = x"yes"
then
DRIVER_BUILD_LIST="$DRIVER_BUILD_LIST pn532_spi"
fi
;;
esac