[fprint] [PATCH 5/8] build: add build support for dynamic loadable drivers.
Kunal Gangakhedkar
kunal.gangakhedkar at gmail.com
Mon Oct 8 07:39:29 PDT 2012
Here, we:
o. introduce '--enable-dynamic-drivers' flag to configure script.
o. add libfprint/drivers/Makefile.am to build drivers as shared objects.
o. re-arrange target for the test_driver program in examples/Makefile.am.
o. add recursive target "drivers" in libfprint/Makefile.am to automatically
build the drivers when building as shared objects.
Signed-off-by: Kunal Gangakhedkar <kunal.gangakhedkar at gmail.com>
---
configure.ac | 17 +++++-
examples/Makefile.am | 11 ++--
libfprint/Makefile.am | 19 ++++++-
libfprint/drivers/Makefile.am | 119 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 159 insertions(+), 7 deletions(-)
create mode 100644 libfprint/drivers/Makefile.am
diff --git a/configure.ac b/configure.ac
index 69f0a86..a5c4e8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,6 +188,15 @@ AC_ARG_ENABLE([x11-examples-build], [AS_HELP_STRING([--enable-x11-examples-build
[build_x11_examples='no'])
AM_CONDITIONAL([BUILD_X11_EXAMPLES], [test "x$build_x11_examples" != "xno"])
+# Dynamic drivers
+AC_ARG_ENABLE([dynamic-drivers], [AS_HELP_STRING([--enable-dynamic-drivers],
+ [Build drivers as shared objects which can be loaded dynamically (default n)])],
+ [dynamic_drivers=$enableval],
+ [dynamic_drivers='no'])
+if test "x$dynamic_drivers" != "xno"; then
+ AC_DEFINE([ENABLE_DYNAMIC_DRIVERS], 1, [Drivers as shared objects])
+fi
+AM_CONDITIONAL([ENABLE_DYNAMIC_DRIVERS], [test "x$dynamic_drivers" != "xno"])
if test "x$build_x11_examples" != "xno"; then
# check for Xv extensions
@@ -316,6 +325,12 @@ else
AC_MSG_NOTICE([ aeslib helper functions disabled])
fi
-AC_CONFIG_FILES([libfprint.pc] [Makefile] [libfprint/Makefile] [examples/Makefile] [doc/Makefile])
+if test x$dynamic_drivers != xno ; then
+ AC_MSG_NOTICE([** drivers will be built as shared object modules])
+else
+ AC_MSG_NOTICE([ drivers will be built statically])
+fi
+
+AC_CONFIG_FILES([libfprint.pc] [Makefile] [libfprint/Makefile] [libfprint/drivers/Makefile] [examples/Makefile] [doc/Makefile])
AC_OUTPUT
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 7d44efe..170c7bb 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,5 +1,5 @@
INCLUDES = -I$(top_srcdir)
-noinst_PROGRAMS = verify_live enroll verify img_capture cpp-test test_driver
+noinst_PROGRAMS = verify_live enroll verify img_capture cpp-test
verify_live_SOURCES = verify_live.c
verify_live_LDADD = ../libfprint/libfprint.la
@@ -16,9 +16,6 @@ img_capture_LDADD = ../libfprint/libfprint.la
cpp_test_SOURCES = cpp-test.cpp
cpp_test_LDADD = ../libfprint/libfprint.la
-test_driver_SOURCES = test_driver.c
-test_driver_LDADD = ../libfprint/libfprint.la
-
if BUILD_X11_EXAMPLES
noinst_PROGRAMS += img_capture_continuous
@@ -27,3 +24,9 @@ img_capture_continuous_SOURCES = img_capture_continuous.c
img_capture_continuous_LDADD = ../libfprint/libfprint.la $(X_LIBS) $(X_PRE_LIBS) $(XV_LIBS) -lX11 $(X_EXTRA_LIBS);
endif
+if ENABLE_DYNAMIC_DRIVERS
+noinst_PROGRAMS += test_driver
+
+test_driver_SOURCES = test_driver.c
+test_driver_LDADD = ../libfprint/libfprint.la
+endif
diff --git a/libfprint/Makefile.am b/libfprint/Makefile.am
index 96489e6..b360a5d 100644
--- a/libfprint/Makefile.am
+++ b/libfprint/Makefile.am
@@ -2,6 +2,7 @@ lib_LTLIBRARIES = libfprint.la
noinst_PROGRAMS = fprint-list-udev-rules
MOSTLYCLEANFILES = $(udev_rules_DATA)
+
UPEKE2_SRC = drivers/upeke2.c
UPEKTS_SRC = drivers/upekts.c
UPEKTC_SRC = drivers/upektc.c
@@ -79,7 +80,7 @@ libfprint_la_LIBADD = -lm $(LIBUSB_LIBS) $(GLIB_LIBS) $(CRYPTO_LIBS)
fprint_list_udev_rules_SOURCES = fprint-list-udev-rules.c
fprint_list_udev_rules_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(IMAGEMAGICK_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CFLAGS)
-fprint_list_udev_rules_LDADD = $(builddir)/libfprint.la
+fprint_list_udev_rules_LDADD = $(builddir)/libfprint.la $(GLIB_LIBS)
udev_rules_DATA = 60-fprint-autosuspend.rules
@@ -162,8 +163,22 @@ libfprint_la_SOURCES = \
imgdev.c \
poll.c \
sync.c \
- $(DRIVER_SRC) \
$(OTHER_SRC) \
$(NBIS_SRC)
+if ENABLE_DYNAMIC_DRIVERS
+libfprint_la_SOURCES += module.c
+else
+libfprint_la_SOURCES += $(DRIVER_SRC)
+endif
+
pkginclude_HEADERS = fprint.h
+
+# Force the start of build from libfprint.
+# This is required if the drivers are built as shared objects since they
+# depend on libfprint.la.
+SUBDIRS = .
+
+if ENABLE_DYNAMIC_DRIVERS
+SUBDIRS += drivers
+endif
diff --git a/libfprint/drivers/Makefile.am b/libfprint/drivers/Makefile.am
new file mode 100644
index 0000000..18f9c80
--- /dev/null
+++ b/libfprint/drivers/Makefile.am
@@ -0,0 +1,119 @@
+DRIVER_CFLAGS = -fvisibility=hidden -fPIC -DPIC -I../ -I$(top_srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CLFAGS)
+DRIVER_LDFLAGS = -module -version-info @lt_major@:@lt_revision@:@lt_age@ -shared
+
+DRIVER_LIBADD = -lm $(GLIB_LIBS) $(CRYPTO_LIBS) ../libfprint.la
+
+driver_LTLIBRARIES =
+driverdir=$(pkglibdir)/drivers
+
+drv_upeke2_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_upeke2_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_upeke2_la_LIBADD = $(DRIVER_LIBADD)
+drv_upeke2_la_SOURCES = upeke2.c
+
+# drv_upektc_la_CFLAGS = $(DRIVER_CFLAGS)
+# drv_upektc_la_LDFLAGS = $(DRIVER_LDFLAGS)
+# drv_upektc_la_LIBADD = $(DRIVER_LIBADD)
+# drv_upektc_la_SOURCES = upektc.c
+
+drv_upekts_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_upekts_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_upekts_la_LIBADD = $(DRIVER_LIBADD)
+drv_upekts_la_SOURCES = upekts.c
+
+drv_upeksonly_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_upeksonly_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_upeksonly_la_LIBADD = $(DRIVER_LIBADD)
+drv_upeksonly_la_SOURCES = upeksonly.c
+
+drv_vcom5s_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_vcom5s_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_vcom5s_la_LIBADD = $(DRIVER_LIBADD)
+drv_vcom5s_la_SOURCES = vcom5s.c
+
+drv_uru4000_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_uru4000_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_uru4000_la_LIBADD = $(DRIVER_LIBADD)
+drv_uru4000_la_SOURCES = uru4000.c
+
+drv_fdu2000_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_fdu2000_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_fdu2000_la_LIBADD = $(DRIVER_LIBADD)
+drv_fdu2000_la_SOURCES = fdu2000.c
+
+drv_aes1610_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_aes1610_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_aes1610_la_LIBADD = $(DRIVER_LIBADD)
+drv_aes1610_la_SOURCES = aes1610.c
+
+drv_aes2501_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_aes2501_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_aes2501_la_LIBADD = $(DRIVER_LIBADD)
+drv_aes2501_la_SOURCES = aes2501.c
+
+drv_aes4000_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_aes4000_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_aes4000_la_LIBADD = $(DRIVER_LIBADD)
+drv_aes4000_la_SOURCES = aes4000.c
+
+drv_vfs101_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_vfs101_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_vfs101_la_LIBADD = $(DRIVER_LIBADD)
+drv_vfs101_la_SOURCES = vfs101.c
+
+drv_vfs301_la_CFLAGS = $(DRIVER_CFLAGS)
+drv_vfs301_la_LDFLAGS = $(DRIVER_LDFLAGS)
+drv_vfs301_la_LIBADD = $(DRIVER_LIBADD)
+drv_vfs301_la_SOURCES = vfs301.c vfs301_proto.c
+
+if ENABLE_DYNAMIC_DRIVERS
+
+if ENABLE_UPEKE2
+driver_LTLIBRARIES += drv_upeke2.la
+endif # ENABLE_UPEKE2
+
+if ENABLE_UPEKTS
+driver_LTLIBRARIES += drv_upekts.la
+endif # ENABLE_UPEKTS
+
+# if ENABLE_UPEKTC
+# driver_LTLIBRARIES += drv_upektc.la
+# endif # ENABLE_UPEKTC
+
+if ENABLE_UPEKSONLY
+driver_LTLIBRARIES += drv_upeksonly.la
+endif # ENABLE_UPEKSONLY
+
+if ENABLE_VCOM5S
+driver_LTLIBRARIES += drv_vcom5s.la
+endif # ENABLE_VCOM5S
+
+if ENABLE_URU4000
+driver_LTLIBRARIES += drv_uru4000.la
+endif # ENABLE_URU4000
+
+if ENABLE_FDU2000
+driver_LTLIBRARIES += drv_fdu2000.la
+endif # ENABLE_FDU2000
+
+if ENABLE_AES1610
+driver_LTLIBRARIES += drv_aes1610.la
+endif # ENABLE_AES1610
+
+if ENABLE_AES2501
+driver_LTLIBRARIES += drv_aes2501.la
+endif # ENABLE_AES2501
+
+if ENABLE_AES4000
+driver_LTLIBRARIES += drv_aes4000.la
+endif # ENABLE_AES4000
+
+if ENABLE_VFS101
+driver_LTLIBRARIES += drv_vfs101.la
+endif # ENABLE_VFS101
+
+if ENABLE_VFS301
+driver_LTLIBRARIES += drv_vfs301.la
+endif # ENABLE_VFS301
+
+endif # ENABLE_DYNAMIC_DRIVERS
--
1.7.9.5
More information about the fprint
mailing list