From fc420d58aff427d500abb879a0f9adf85d0c77c4 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 27 Mar 2013 16:58:01 +0100 Subject: [PATCH] Only include SPI related files when (at least) one SPI driver is enabled --- configure.ac | 5 ++++- libnfc/buses/Makefile.am | 5 +++-- m4/libnfc_drivers.m4 | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 6176591..5e7e486 100644 --- a/configure.ac +++ b/configure.ac @@ -118,9 +118,12 @@ fi # Handle --with-drivers option LIBNFC_ARG_WITH_DRIVERS -# Enable UART if +# Enable UART if AM_CONDITIONAL(UART_ENABLED, [test x"$uart_required" = x"yes"]) +# Enable SPI if +AM_CONDITIONAL(SPI_ENABLED, [test x"$spi_required" = x"yes"]) + # Documentation (default: no) AC_ARG_ENABLE([doc],AS_HELP_STRING([--enable-doc],[Enable documentation generation.]),[enable_doc=$enableval],[enable_doc="no"]) diff --git a/libnfc/buses/Makefile.am b/libnfc/buses/Makefile.am index c1b8056..a875ed7 100644 --- a/libnfc/buses/Makefile.am +++ b/libnfc/buses/Makefile.am @@ -8,11 +8,12 @@ libnfcbuses_la_CFLAGS = -I$(top_srcdir)/libnfc libnfcbuses_la_LIBADD = EXTRA_DIST = -# SPI_ENABLED +if SPI_ENABLED libnfcbuses_la_SOURCES += spi.c spi.h libnfcbuses_la_CFLAGS += libnfcbuses_la_LIBADD += -EXTRA_DIST = spi_posix.c +endif +EXTRA_DIST = spi.c spi.h if UART_ENABLED libnfcbuses_la_SOURCES += uart.c uart.h diff --git a/m4/libnfc_drivers.m4 b/m4/libnfc_drivers.m4 index 62f734a..e27eed1 100644 --- a/m4/libnfc_drivers.m4 +++ b/m4/libnfc_drivers.m4 @@ -76,6 +76,7 @@ AC_DEFUN([LIBNFC_ARG_WITH_DRIVERS], DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN532_UART_ENABLED" ;; pn532_spi) + spi_required="yes" driver_pn532_spi_enabled="yes" DRIVERS_CFLAGS="$DRIVERS_CFLAGS -DDRIVER_PN532_SPI_ENABLED" ;;