configure.ac rework

- Put libusb and PC/SC check in m4 macros.
- Suppress --disable-pcsclite and --disable-libusb
- Add --with-drivers option: we now could choose which driver to build. without this option a default set is build (ATM all drivers except PN532_UART)
This commit is contained in:
Romuald Conty 2010-04-15 14:41:13 +00:00
parent b747573dc7
commit b55400a0d5
13 changed files with 230 additions and 122 deletions

View file

@ -1,25 +1,26 @@
SUBDIRS = chips buses drivers .
# set the include path found by configure
INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
INCLUDES = $(all_includes) $(LIBNFC_CFLAGS)
noinst_HEADERS = chips.h buses.h drivers.h bitutils.h
lib_LTLIBRARIES = libnfc.la
libnfc_la_SOURCES = nfc.c bitutils.c
libnfc_la_LDFLAGS = -no-undefined -version-info=0:0:0
libnfc_la_CFLAGS =
libnfc_la_CFLAGS = @DRIVERS_CFLAGS@
libnfc_la_LIBADD = \
$(top_builddir)/libnfc/chips/libnfcchips.la \
$(top_builddir)/libnfc/buses/libnfcbuses.la \
$(top_builddir)/libnfc/drivers/libnfcdrivers.la
if PCSC_LITE_ENABLED
libnfc_la_CFLAGS += @LIBPCSCLITE_CFLAGS@ -DHAVE_PCSC_LITE
libnfc_la_LIBADD += @LIBPCSCLITE_LIBS@
if PCSC_ENABLED
libnfc_la_CFLAGS += @libpcsclite_CFLAGS@ -DHAVE_PCSC
libnfc_la_LIBADD += @libpcsclite_LIBS@
endif
if LIBUSB_ENABLED
libnfc_la_CFLAGS += @LIBUSB_CFLAGS@ -DHAVE_LIBUSB
libnfc_la_LIBADD += @LIBUSB_LIBS@
libnfc_la_CFLAGS += @libusb_CFLAGS@ -DHAVE_LIBUSB
libnfc_la_LIBADD += @libusb_LIBS@
endif
EXTRA_DIST = CMakeLists.txt chips.h buses.h drivers.h bitutils.h
EXTRA_DIST = CMakeLists.txt

View file

@ -27,33 +27,50 @@
#include <nfc/nfc-types.h>
#ifdef HAVE_PCSC_LITE
#if defined (DRIVER_ACR122_ENABLED)
#include "drivers/acr122.h"
#endif /* HAVE_PCSC_LITE */
#endif /* DRIVER_ACR122_ENABLED */
#ifdef HAVE_LIBUSB
#if defined (DRIVER_PN531_USB_ENABLED) || defined (DRIVER_PN533_USB_ENABLED)
#include "drivers/pn53x_usb.h"
#include "drivers/pn531_usb.h"
#include "drivers/pn533_usb.h"
#endif /* HAVE_LIBUSB */
#endif /* DRIVER_PN531_USB_ENABLED || DRIVER_PN533_USB_ENABLED */
#include "drivers/arygon.h"
#include "drivers/pn532_uart.h"
#if defined (DRIVER_PN531_USB_ENABLED)
#include "drivers/pn531_usb.h"
#endif /* DRIVER_PN531_USB_ENABLED */
#if defined (DRIVER_PN533_USB_ENABLED)
#include "drivers/pn533_usb.h"
#endif /* DRIVER_PN533_USB_ENABLED */
#if defined (DRIVER_ARYGON_ENABLED)
#include "drivers/arygon.h"
#endif /* DRIVER_ARYGON_ENABLED */
#if defined (DRIVER_PN532_UART_ENABLED)
#include "drivers/pn532_uart.h"
#endif /* DRIVER_PN532_UART_ENABLED */
#define DRIVERS_MAX_DEVICES 16
#define MAX_FRAME_LEN 264
static const struct driver_callbacks drivers_callbacks_list[] = {
// Driver Name Pick Device List Devices Connect Transceive Disconnect
#ifdef HAVE_PCSC_LITE
#if defined (DRIVER_ACR122_ENABLED)
{ ACR122_DRIVER_NAME, acr122_pick_device, acr122_list_devices, acr122_connect, acr122_transceive, acr122_disconnect },
#endif /* HAVE_PCSC_LITE */
#ifdef HAVE_LIBUSB
{ PN531_USB_DRIVER_NAME, pn531_usb_pick_device, pn531_usb_list_devices, pn531_usb_connect, pn53x_usb_transceive, pn53x_usb_disconnect },
{ PN533_USB_DRIVER_NAME, pn533_usb_pick_device, pn533_usb_list_devices, pn533_usb_connect, pn53x_usb_transceive, pn53x_usb_disconnect },
#endif /* HAVE_LIBUSB */
{ PN532_UART_DRIVER_NAME, pn532_uart_pick_device, pn532_uart_list_devices, pn532_uart_connect, pn532_uart_transceive, pn532_uart_disconnect },
#endif /* DRIVER_ACR122_ENABLED */
#if defined (DRIVER_PN531_USB_ENABLED)
{ PN531_USB_DRIVER_NAME, pn531_usb_pick_device, pn531_usb_list_devices, pn531_usb_connect, pn53x_usb_transceive, pn53x_usb_disconnect },
#endif /* DRIVER_PN531_USB_ENABLED */
#if defined (DRIVER_PN533_USB_ENABLED)
{ PN533_USB_DRIVER_NAME, pn533_usb_pick_device, pn533_usb_list_devices, pn533_usb_connect, pn53x_usb_transceive, pn53x_usb_disconnect },
#endif /* DRIVER_PN533_USB_ENABLED */
#if defined (DRIVER_ARYGON_ENABLED)
{ ARYGON_DRIVER_NAME, arygon_pick_device, arygon_list_devices, arygon_connect, arygon_transceive, arygon_disconnect }
#endif /* DRIVER_ARYGON_ENABLED */
#if defined (DRIVER_PN532_UART_ENABLED)
{ PN532_UART_DRIVER_NAME, pn532_uart_pick_device, pn532_uart_list_devices, pn532_uart_connect, pn532_uart_transceive, pn532_uart_disconnect },
#endif /* DRIVER_PN532_UART_ENABLED */
};
#endif // __NFC_DRIVERS_H__

View file

@ -1,23 +1,19 @@
# set the include path found by configure
INCLUDES= $(all_includes) $(LIBNFC_CFLAGS)
noinst_HEADERS = arygon.h pn532_uart.h
noinst_HEADERS = acr122.h arygon.h pn531_usb.h pn532_uart.h pn533_usb.h pn53x_usb.h
noinst_LTLIBRARIES = libnfcdrivers.la
libnfcdrivers_la_SOURCES = arygon.c pn532_uart.c
libnfcdrivers_la_CFLAGS = -I$(top_srcdir)/libnfc -I$(top_srcdir)/libnfc/buses
libnfcdrivers_la_SOURCES = acr122.c arygon.c pn531_usb.c pn532_uart.c pn533_usb.c pn53x_usb.c
libnfcdrivers_la_CFLAGS = @DRIVERS_CFLAGS@ -I$(top_srcdir)/libnfc -I$(top_srcdir)/libnfc/buses
libnfcdrivers_la_LIBADD =
if PCSC_LITE_ENABLED
noinst_HEADERS += acr122.h
libnfcdrivers_la_CFLAGS += @LIBPCSCLITE_CFLAGS@ -DHAVE_PCSC_LITE
libnfcdrivers_la_SOURCES += acr122.c
libnfcdrivers_la_LIBADD += @LIBPCSCLITE_LIBS@
if PCSC_ENABLED
libnfcdrivers_la_CFLAGS += @libpcsclite_CFLAGS@
libnfcdrivers_la_LIBADD += @libpcsclite_LIBS@
endif
if LIBUSB_ENABLED
noinst_HEADERS += pn531_usb.h pn533_usb.h pn53x_usb.h
libnfcdrivers_la_CFLAGS += @LIBUSB_CFLAGS@ -DHAVE_LIBUSB
libnfcdrivers_la_SOURCES += pn531_usb.c pn533_usb.c pn53x_usb.c
libnfcdrivers_la_LIBADD += @LIBUSB_LIBS@
libnfcdrivers_la_CFLAGS += @libusb_CFLAGS@
libnfcdrivers_la_LIBADD += @libusb_LIBS@
endif

View file

@ -22,6 +22,8 @@
* @brief
*/
#ifdef DRIVER_ACR122_ENABLED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
@ -361,3 +363,5 @@ bool acr122_led_red(const nfc_device_spec_t nds, bool bOn)
}
}
#endif // DRIVER_ACR122_ENABLED

View file

@ -25,6 +25,8 @@
* UART connection can be direct (host<->arygon_uc) or could be provided by internal USB to serial interface (e.g. host<->ftdi_chip<->arygon_uc)
*/
#ifdef DRIVER_ARYGON_ENABLED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
@ -297,3 +299,6 @@ bool arygon_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const s
return true;
}
#endif // DRIVER_ARYGON_ENABLED

View file

@ -26,6 +26,8 @@
Thanks to d18c7db and Okko for example code
*/
#ifdef DRIVER_PN531_USB_ENABLED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
@ -70,3 +72,6 @@ nfc_device_t* pn531_usb_connect(const nfc_device_desc_t* pndd)
{
return pn53x_usb_connect(pndd, pndd->acDevice, NC_PN531);
}
#endif // DRIVER_PN531_USB_ENABLED

View file

@ -22,6 +22,8 @@
* @brief PN532 driver using UART bus (UART, RS232, etc.)
*/
#ifdef DRIVER_PN532_UART_ENABLED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
@ -310,3 +312,6 @@ pn532_uart_wakeup(const nfc_device_spec_t nds)
}
return true;
}
#endif // DRIVER_PN532_UART_ENABLED

View file

@ -26,6 +26,8 @@
Thanks to d18c7db and Okko for example code
*/
#ifdef DRIVER_PN533_USB_ENABLED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
@ -68,3 +70,6 @@ nfc_device_t* pn533_usb_connect(const nfc_device_desc_t* pndd)
{
return pn53x_usb_connect(pndd, pndd->acDevice, NC_PN533);
}
#endif // DRIVER_PN533_USB_ENABLED

View file

@ -30,6 +30,8 @@
Thanks to d18c7db and Okko for example code
*/
#if defined (DRIVER_PN531_USB_ENABLED) || defined (DRIVER_PN533_USB_ENABLED)
#include <stdio.h>
#include <stdlib.h>
#include <usb.h>
@ -329,3 +331,5 @@ bool pn53x_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, cons
return true;
}
#endif // DRIVER_PN531_USB_ENABLED || DRIVER_PN533_USB_ENABLED