diff --git a/configure.ac b/configure.ac index 5e5a2c7..5971a4c 100644 --- a/configure.ac +++ b/configure.ac @@ -33,8 +33,8 @@ AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_INT32_T -# --enable-debug support (default:no) -AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Debug flags]),[enable_debug=$enableval],[enable_debug="no"]) +# Debug support (default:no) +AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Enable debug output]),[enable_debug=$enableval],[enable_debug="no"]) AC_MSG_CHECKING(for debug flag) AC_MSG_RESULT($enable_debug) @@ -45,8 +45,8 @@ then fi AC_SUBST([DEBUG_CFLAGS]) -# --enable-serial-autoprobe support (default:yes) -AC_ARG_ENABLE([serial-autoprobe],AS_HELP_STRING([--enable-serial-autoprobe],[Serial autoprobing flag]),[enable_serial_autoprobe=$enableval],[enable_serial_autoprobe="yes"]) +# Serial autoprobing support (default:yes) +AC_ARG_ENABLE([serial-autoprobe],AS_HELP_STRING([--disable-serial-autoprobe],[Disable serial autoprobing]),[enable_serial_autoprobe=$enableval],[enable_serial_autoprobe="yes"]) AC_MSG_CHECKING(for serial autoprobe flag) AC_MSG_RESULT($enable_serial_autoprobe) @@ -56,8 +56,8 @@ then CFLAGS="$CFLAGS -DDISABLE_SERIAL_AUTOPROBE" fi -# --enable-pcsc-lite support (default: yes) -AC_ARG_ENABLE([pcsc-lite],AS_HELP_STRING([--enable-pcsc-lite],[pcsc-lite feature flag]),[enable_pcsc_lite=$enableval],[enable_pcsc_lite="yes"]) +# PCSC-lite support (default: yes) +AC_ARG_ENABLE([pcsc-lite],AS_HELP_STRING([--disable-pcsc-lite],[Disable PCSC-lite dependency (removes ACR122 support)]),[enable_pcsc_lite=$enableval],[enable_pcsc_lite="yes"]) AC_MSG_CHECKING(for pcsc-lite support) AC_MSG_RESULT($enable_pcsc_lite) @@ -68,49 +68,62 @@ then fi AM_CONDITIONAL(PCSC_LITE_ENABLED, [test x"$enable_pcsc_lite" = xyes]) -## libusb -if test x"$PKG_CONFIG" = "x"; then - AC_PATH_PROG(LIBUSB_CONFIG,libusb-config) - if test x"$LIBUSB_CONFIG" = "x" ; then - WITH_USB=0 - else - LIBUSB_CFLAGS=`$LIBUSB_CONFIG --cflags` - LIBUSB_LIBS=`$LIBUSB_CONFIG --libs` - WITH_USB=1 - fi -else - PKG_CHECK_MODULES(LIBUSB, libusb, [WITH_USB=1], [WITH_USB=0]) +# libusb support (default: yes) +AC_ARG_ENABLE([libusb],AS_HELP_STRING([--disable-libusb],[Disable libusb dependency (removes PN531USB and PN533USB support)]),[enable_libusb=$enableval],[enable_libusb="yes"]) + +AC_MSG_CHECKING(for libusb support) +AC_MSG_RESULT($enable_libusb) + +if test x"$enable_libsub" = "xno" +then + WITH_LIBUSB=0 fi +AM_CONDITIONAL(LIBUSB_ENABLED, [test x"$enable_libusb" = xyes]) -if test x"$WITH_USB" = "x0"; then - AC_MSG_ERROR([libusb is mandatory.]) +## libusb +if test "x$enable_libusb" = "xyes"; then + if test x"$PKG_CONFIG" = "x"; then + AC_PATH_PROG(LIBUSB_CONFIG,libusb-config) + if test x"$LIBUSB_CONFIG" = "x" ; then + WITH_USB=0 + else + LIBUSB_CFLAGS=`$LIBUSB_CONFIG --cflags` + LIBUSB_LIBS=`$LIBUSB_CONFIG --libs` + WITH_USB=1 + fi + else + PKG_CHECK_MODULES(LIBUSB, libusb, [WITH_USB=1], [WITH_USB=0]) + fi + + if test x"$WITH_USB" = "x0"; then + AC_MSG_ERROR([libusb is mandatory.]) + fi + AC_SUBST(LIBUSB_LIBS) + AC_SUBST(LIBUSB_CFLAGS) fi -AC_SUBST(LIBUSB_LIBS) -AC_SUBST(LIBUSB_CFLAGS) ## libpcsclite -if test "x$enable_pcsc_lite" = "xyes" -then -case "$host" in - *darwin*) - AC_MSG_WARN(Using darwin PCSC Framework) - LIBPCSCLITE_LIBS="-Wl,-framework,PCSC" - LIBPCSCLITE_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Headers" - ;; - *) - PKG_CHECK_MODULES(LIBPCSCLITE, libpcsclite, [WITH_PCSC=1], [WITH_PCSC=0]) - if test x"$WITH_PCSC" = "x0" ; then - AC_MSG_ERROR([libpcsclite is mandatory.]) - fi - ;; -esac +if test "x$enable_pcsc_lite" = "xyes"; then + case "$host" in + *darwin*) + AC_MSG_WARN(Using darwin PCSC Framework) + LIBPCSCLITE_LIBS="-Wl,-framework,PCSC" + LIBPCSCLITE_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Headers" + ;; + *) + PKG_CHECK_MODULES(LIBPCSCLITE, libpcsclite, [WITH_PCSC=1], [WITH_PCSC=0]) + if test x"$WITH_PCSC" = "x0" ; then + AC_MSG_ERROR([libpcsclite is mandatory.]) + fi + ;; + esac AC_SUBST(LIBPCSCLITE_LIBS) AC_SUBST(LIBPCSCLITE_CFLAGS) fi # Set C standard to C99 -# --disable-std-c99 support (default: no) -AC_ARG_ENABLE([std-c99],AS_HELP_STRING([--disable-pcsc-lite],[compile using C99 standard]),[enable_std_c99=$enableval],[enable_std_c99="yes"]) +# C99 standard support (default: yes) +AC_ARG_ENABLE([std-c99],AS_HELP_STRING([--disable-std-c99],[Disable C99 standard when compiling]),[enable_std_c99=$enableval],[enable_std_c99="yes"]) AC_MSG_CHECKING(for C99 support) AC_MSG_RESULT($enable_std_c99) diff --git a/src/Makefile.am b/src/Makefile.am index 93a0099..47a50bf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,7 +5,7 @@ bin_PROGRAMS = nfc-anticol nfc-list nfc-mftool nfc-mfultool nfc-relay nfc-emulat # set the include path found by configure INCLUDES= $(all_includes) -nfc_devices_headers = dev_arygon.h dev_pn531.h dev_pn533.h +nfc_devices_headers = dev_arygon.h nfc_examples_headers = mifaretag.h mifareultag.h nfcinclude_HEADERS = libnfc.h bitutils.h defines.h types.h rs232.h devices.h messages.h nfcinclude_HEADERS += $(nfc_devices_headers) @@ -13,9 +13,9 @@ nfcinclude_HEADERS += $(nfc_examples_headers) nfcincludedir = $(includedir)/libnfc lib_LTLIBRARIES = libnfc.la -libnfc_la_SOURCES = bitutils.c libnfc.c rs232.c dev_arygon.c dev_pn531.c dev_pn533.c -libnfc_la_CFLAGS = @LIBUSB_CFLAGS@ -libnfc_la_LIBADD = @LIBUSB_LIBS@ +libnfc_la_SOURCES = bitutils.c libnfc.c rs232.c dev_arygon.c +libnfc_la_CFLAGS = +libnfc_la_LIBADD = if PCSC_LITE_ENABLED nfcinclude_HEADERS += dev_acr122.h @@ -24,6 +24,13 @@ if PCSC_LITE_ENABLED libnfc_la_LIBADD += @LIBPCSCLITE_LIBS@ endif +if LIBUSB_ENABLED + nfcinclude_HEADERS += dev_pn531.h dev_pn533.h + libnfc_la_CFLAGS += @LIBUSB_CFLAGS@ -DHAVE_LIBUSB + libnfc_la_SOURCES += dev_pn531.c dev_pn533.c + libnfc_la_LIBADD += @LIBUSB_LIBS@ +endif + nfc_anticol_SOURCES = anticol.c nfc_anticol_LDADD = libnfc.la