From a57793fe5aa169c5ca985eaa7fcb19eae2599268 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Wed, 3 Apr 2013 16:08:34 +0200 Subject: [PATCH] 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. --- configure.ac | 1 + m4/libnfc_drivers.m4 | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5e7e486..d2b7030 100644 --- a/configure.ac +++ b/configure.ac @@ -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])]) diff --git a/m4/libnfc_drivers.m4 b/m4/libnfc_drivers.m4 index f83f825..0a0e47f 100644 --- a/m4/libnfc_drivers.m4 +++ b/m4/libnfc_drivers.m4 @@ -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