Add ./configure option to disable libusb (removes PN531USB and PN533USB support).

Enhance "./configure --help" options descriptions.
This commit is contained in:
Romuald Conty 2009-09-10 10:39:25 +00:00
parent 3ec00eb06c
commit 6634d185bb
2 changed files with 63 additions and 43 deletions

View file

@ -33,8 +33,8 @@ AC_TYPE_UINT32_T
AC_TYPE_UINT64_T AC_TYPE_UINT64_T
AC_TYPE_INT32_T AC_TYPE_INT32_T
# --enable-debug support (default:no) # Debug support (default:no)
AC_ARG_ENABLE([debug],AS_HELP_STRING([--enable-debug],[Debug flags]),[enable_debug=$enableval],[enable_debug="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_CHECKING(for debug flag)
AC_MSG_RESULT($enable_debug) AC_MSG_RESULT($enable_debug)
@ -45,8 +45,8 @@ then
fi fi
AC_SUBST([DEBUG_CFLAGS]) AC_SUBST([DEBUG_CFLAGS])
# --enable-serial-autoprobe support (default:yes) # Serial autoprobing 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"]) 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_CHECKING(for serial autoprobe flag)
AC_MSG_RESULT($enable_serial_autoprobe) AC_MSG_RESULT($enable_serial_autoprobe)
@ -56,8 +56,8 @@ then
CFLAGS="$CFLAGS -DDISABLE_SERIAL_AUTOPROBE" CFLAGS="$CFLAGS -DDISABLE_SERIAL_AUTOPROBE"
fi fi
# --enable-pcsc-lite support (default: yes) # 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_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_CHECKING(for pcsc-lite support)
AC_MSG_RESULT($enable_pcsc_lite) AC_MSG_RESULT($enable_pcsc_lite)
@ -68,49 +68,62 @@ then
fi fi
AM_CONDITIONAL(PCSC_LITE_ENABLED, [test x"$enable_pcsc_lite" = xyes]) AM_CONDITIONAL(PCSC_LITE_ENABLED, [test x"$enable_pcsc_lite" = xyes])
## libusb # libusb support (default: yes)
if test x"$PKG_CONFIG" = "x"; then AC_ARG_ENABLE([libusb],AS_HELP_STRING([--disable-libusb],[Disable libusb dependency (removes PN531USB and PN533USB support)]),[enable_libusb=$enableval],[enable_libusb="yes"])
AC_PATH_PROG(LIBUSB_CONFIG,libusb-config)
if test x"$LIBUSB_CONFIG" = "x" ; then AC_MSG_CHECKING(for libusb support)
WITH_USB=0 AC_MSG_RESULT($enable_libusb)
else
LIBUSB_CFLAGS=`$LIBUSB_CONFIG --cflags` if test x"$enable_libsub" = "xno"
LIBUSB_LIBS=`$LIBUSB_CONFIG --libs` then
WITH_USB=1 WITH_LIBUSB=0
fi
else
PKG_CHECK_MODULES(LIBUSB, libusb, [WITH_USB=1], [WITH_USB=0])
fi fi
AM_CONDITIONAL(LIBUSB_ENABLED, [test x"$enable_libusb" = xyes])
if test x"$WITH_USB" = "x0"; then ## libusb
AC_MSG_ERROR([libusb is mandatory.]) 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 fi
AC_SUBST(LIBUSB_LIBS)
AC_SUBST(LIBUSB_CFLAGS)
## libpcsclite ## libpcsclite
if test "x$enable_pcsc_lite" = "xyes" if test "x$enable_pcsc_lite" = "xyes"; then
then case "$host" in
case "$host" in *darwin*)
*darwin*) AC_MSG_WARN(Using darwin PCSC Framework)
AC_MSG_WARN(Using darwin PCSC Framework) LIBPCSCLITE_LIBS="-Wl,-framework,PCSC"
LIBPCSCLITE_LIBS="-Wl,-framework,PCSC" LIBPCSCLITE_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Headers"
LIBPCSCLITE_CFLAGS="-I/System/Library/Frameworks/PCSC.framework/Headers" ;;
;; *)
*) PKG_CHECK_MODULES(LIBPCSCLITE, libpcsclite, [WITH_PCSC=1], [WITH_PCSC=0])
PKG_CHECK_MODULES(LIBPCSCLITE, libpcsclite, [WITH_PCSC=1], [WITH_PCSC=0]) if test x"$WITH_PCSC" = "x0" ; then
if test x"$WITH_PCSC" = "x0" ; then AC_MSG_ERROR([libpcsclite is mandatory.])
AC_MSG_ERROR([libpcsclite is mandatory.]) fi
fi ;;
;; esac
esac
AC_SUBST(LIBPCSCLITE_LIBS) AC_SUBST(LIBPCSCLITE_LIBS)
AC_SUBST(LIBPCSCLITE_CFLAGS) AC_SUBST(LIBPCSCLITE_CFLAGS)
fi fi
# Set C standard to C99 # Set C standard to C99
# --disable-std-c99 support (default: no) # C99 standard support (default: yes)
AC_ARG_ENABLE([std-c99],AS_HELP_STRING([--disable-pcsc-lite],[compile using C99 standard]),[enable_std_c99=$enableval],[enable_std_c99="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_CHECKING(for C99 support)
AC_MSG_RESULT($enable_std_c99) AC_MSG_RESULT($enable_std_c99)

View file

@ -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 # set the include path found by configure
INCLUDES= $(all_includes) 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 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 = libnfc.h bitutils.h defines.h types.h rs232.h devices.h messages.h
nfcinclude_HEADERS += $(nfc_devices_headers) nfcinclude_HEADERS += $(nfc_devices_headers)
@ -13,9 +13,9 @@ nfcinclude_HEADERS += $(nfc_examples_headers)
nfcincludedir = $(includedir)/libnfc nfcincludedir = $(includedir)/libnfc
lib_LTLIBRARIES = libnfc.la lib_LTLIBRARIES = libnfc.la
libnfc_la_SOURCES = bitutils.c libnfc.c rs232.c dev_arygon.c dev_pn531.c dev_pn533.c libnfc_la_SOURCES = bitutils.c libnfc.c rs232.c dev_arygon.c
libnfc_la_CFLAGS = @LIBUSB_CFLAGS@ libnfc_la_CFLAGS =
libnfc_la_LIBADD = @LIBUSB_LIBS@ libnfc_la_LIBADD =
if PCSC_LITE_ENABLED if PCSC_LITE_ENABLED
nfcinclude_HEADERS += dev_acr122.h nfcinclude_HEADERS += dev_acr122.h
@ -24,6 +24,13 @@ if PCSC_LITE_ENABLED
libnfc_la_LIBADD += @LIBPCSCLITE_LIBS@ libnfc_la_LIBADD += @LIBPCSCLITE_LIBS@
endif 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_SOURCES = anticol.c
nfc_anticol_LDADD = libnfc.la nfc_anticol_LDADD = libnfc.la