summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README4
-rw-r--r--configure.in25
-rw-r--r--src/Makefile.am6
-rw-r--r--src/librfid.pc.in11
4 files changed, 37 insertions, 9 deletions
diff --git a/README b/README
index 18c122e..e5926bb 100644
--- a/README
+++ b/README
@@ -103,7 +103,9 @@ interface to it, i.e. you can't use CT-API/OpenCT/PCSC API's to access RFID
transponders.
In order to use this backend, you need to use the
-'--with-openct=/path/to/openct' option.
+'--enable-openct' option and - if it is not installed in a default
+location like /usr or /usr/local - set the environment variables
+PATH, LD_LIBRARY_PATH and PKG_CONFIG_PATH so all files are found.
4. Testing
diff --git a/configure.in b/configure.in
index 10d72be..895c7b3 100644
--- a/configure.in
+++ b/configure.in
@@ -17,11 +17,24 @@ AC_ARG_ENABLE(ccid,
# AC_SUBST(MY_CCID)
AM_CONDITIONAL(ENABLE_CCID, test "$MY_CCID" == "1")
-AC_ARG_WITH(openct,
- [ --with-openct Use (patched) OpenCT for CM5121 CCID access],
- [OPENCT_PATH="$withval"], [OPENCT_PATH=""])
-AC_SUBST(OPENCT_PATH)
-AM_CONDITIONAL(ENABLE_OPENCT, test "$OPENCT_PATH" != "")
+dnl Enable/disable openct
+AC_ARG_ENABLE(openct,
+ AC_HELP_STRING([--enable-openct], [Use (patched) OpenCT for CM5121 CCID access. [[default=no]]]),
+ [ENABLE_OPENCT="${enableval}"],
+ [ENABLE_OPENCT="no"])
+
+OPENCT_MSG=no
+if test "x${ENABLE_OPENCT}" = "xyes"; then
+ PKG_CHECK_MODULES(OPENCT, [libopenct], [
+ OPENCT_MSG=yes
+ AC_DEFINE(HAVE_OPENCT, 1, [Have OpenCT libraries and header files])
+ ], [
+ OPENCT_MSG=no
+ ])
+ AC_SUBST(OPENCT_CFLAGS)
+ AC_SUBST(OPENCT_LIBS)
+fi
+AM_CONDITIONAL(HAVE_OPENCT, test "x$OPENCT_MSG" = "xyes")
AC_ARG_WITH(firmware,
[ --with-firmware=PATH Compile for running inside firmware],
@@ -51,4 +64,4 @@ AC_CHECK_LIB(usb, usb_close,,)
AM_CONDITIONAL(HAVE_LIBUSB, test "x$have_libusb" = "xyes")
dnl Output the makefile
-AC_OUTPUT(Makefile src/Makefile include/Makefile include/librfid/Makefile utils/Makefile)
+AC_OUTPUT(Makefile src/Makefile include/Makefile include/librfid/Makefile utils/Makefile src/librfid.pc)
diff --git a/src/Makefile.am b/src/Makefile.am
index 692273b..78f9645 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,7 +26,7 @@ if ENABLE_CCID
READER_LOW_CCID=ccid/rfid_reader_cm5121_ccid_direct.c ccid/ccid-driver.c
endif
-if ENABLE_OPENCT
+if HAVE_OPENCT
READER_LOW_OPENCT=rfid_reader_cm5121_openct.c
LDFLAGS_OPENCT=-lopenct
endif
@@ -34,7 +34,7 @@ endif
endif
INCLUDES = $(all_includes) -I$(top_srcdir)/include $(INCLUDES_FIRMWARE) \
- $(INCLUDES_STATIC)
+ $(INCLUDES_STATIC) $(OPENCT_CFLAGS)
AM_CFLAGS = -std=gnu99 -D__LIBRFID__ $(AM_CFLAGS_FIRMWARE) $(AM_CFLAGS_STATIC) \
$(AM_CFLAGS_CM5121)
@@ -44,3 +44,5 @@ librfid_la_SOURCES = $(CORE) $(L2) $(PROTO) $(ASIC) $(MISC) \
$(READER) \
$(READER_CM5121) $(READER_LOW_CCID) $(READER_LOW_OPENCT)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = librfid.pc
diff --git a/src/librfid.pc.in b/src/librfid.pc.in
new file mode 100644
index 0000000..6c64c00
--- /dev/null
+++ b/src/librfid.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+sysincludedir=@sysincludedir@
+
+Name: librfid
+Description: librfid
+Version: @VERSION@
+Libs: -L${libdir} @LIBS@ -lrfid
+Cflags: -I${sysincludedir} -I${includedir}
personal git repositories of Harald Welte. Your mileage may vary