Skip to content

Commit

Permalink
Do not build pn532_spi if spi is not available
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ludovic Rousseau committed Apr 3, 2013
1 parent 8b8b8d4 commit a57793f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])])

Expand Down
12 changes: 10 additions & 2 deletions m4/libnfc_drivers.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a57793f

Please sign in to comment.