diff --git a/configure.ac b/configure.ac index 8f2a64f..0a60684 100644 --- a/configure.ac +++ b/configure.ac @@ -24,13 +24,25 @@ AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_INT32_T +# --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"]) + +AC_MSG_CHECKING(for pcsc-lite support) +AC_MSG_RESULT($enable_pcsc_lite) + +if test x"$enable_pcsc_lite" = "xno" +then + WITH_PCSC=0 +fi +AM_CONDITIONAL(PCSC_LITE_ENABLED, [test x"$enable_pcsc_lite" = xyes]) + # --enable-debug support AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Debug flags]),[enable_debug=$enableval],[enable_debug="no"]) AC_MSG_CHECKING(for debug flag) AC_MSG_RESULT($enable_debug) -if test "x$enable_debug" = "xyes" +if test x"$enable_debug" = "xyes" then CFLAGS="$CFLAGS -g -Wall -DDEBUG -pedantic" fi @@ -46,12 +58,15 @@ AC_SUBST(LIBUSB_LIBS) AC_SUBST(LIBUSB_CFLAGS) ## libpcsclite -PKG_CHECK_MODULES(LIBPCSCLITE, libpcsclite, [WITH_PCSC=1], [WITH_PCSC=0]) -if test "$WITH_PCSC" == "0" ; then - AC_MSG_ERROR([libpcsclite is mandatory.]) +if test "x$enable_pcsc_lite" = "xyes" +then + PKG_CHECK_MODULES(LIBPCSCLITE, libpcsclite, [WITH_PCSC=1], [WITH_PCSC=0]) + if test "$WITH_PCSC" == "0" ; then + AC_MSG_ERROR([libpcsclite is mandatory.]) + fi + AC_SUBST(LIBPCSCLITE_LIBS) + AC_SUBST(LIBPCSCLITE_CFLAGS) fi -AC_SUBST(LIBPCSCLITE_LIBS) -AC_SUBST(LIBPCSCLITE_CFLAGS) # Set C standard to C99 CFLAGS="$CFLAGS -std=c99" diff --git a/libnfc.pc.in b/libnfc.pc.in index 1edf5b4..a09e1d5 100644 --- a/libnfc.pc.in +++ b/libnfc.pc.in @@ -6,5 +6,5 @@ Name: libnfc Description: Near Field Communication (NFC) library Version: @VERSION@ Requires: libusb, libpcsclite -Libs: -L${libdir} -lmytoolkit +Libs: -L${libdir} -lnfc Cflags: -I${includedir} diff --git a/src/Makefile.am b/src/Makefile.am index 3836b9f..716ff04 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,16 +1,24 @@ +enable_pcsc_lite = @enable_pcsc_lite@ + bin_PROGRAMS = nfc-anticol nfc-list nfc-mftool nfc-relay nfc-emulate # set the include path found by configure INCLUDES= $(all_includes) -nfcinclude_HEADERS = libnfc.h bitutils.h defines.h dev_acr122.h dev_pn531.h types.h mifaretag.h devices.h +nfcinclude_HEADERS = libnfc.h bitutils.h defines.h types.h mifaretag.h devices.h nfcincludedir = $(includedir)/libnfc lib_LTLIBRARIES = libnfc.la +libnfc_la_SOURCES = bitutils.c libnfc.c +libnfc_la_CFLAGS = +libnfc_la_LIBADD = -libnfc_la_CFLAGS = @LIBUSB_CFLAGS@ @LIBPCSCLITE_CFLAGS@ -libnfc_la_SOURCES = dev_pn531.c dev_acr122.c bitutils.c libnfc.c -libnfc_la_LIBADD = @LIBUSB_LIBS@ @LIBPCSCLITE_LIBS@ +if PCSC_LITE_ENABLED + nfcinclude_HEADERS += dev_acr122.h dev_pn531.h + libnfc_la_CFLAGS += @LIBUSB_CFLAGS@ @LIBPCSCLITE_CFLAGS@ + libnfc_la_SOURCES += dev_pn531.c dev_acr122.c + libnfc_la_LIBADD += @LIBUSB_LIBS@ @LIBPCSCLITE_LIBS@ +endif nfc_anticol_SOURCES = anticol.c nfc_anticol_LDADD = libnfc.la