Daniel Drake wrote:
I know I designed how it is at the moment, but I think we should
change how imagemagick is called. Instead of supporting
imgdev->enlarge_factor, aes4000 should just call im_resize() directly,
and claim that the returned images are sized appropriately. im_resize
and supporting code can then be moved into it's own file, similar to
how aeslib is. This allows us to separate the resizing hack from the
non-hacky code, and also gets rid of REQUIRE_IMAGEMAGICK ifdefs.
Sorry, I don't (yet) understand the structure of the drivers so I can't
do a thing about this one, plus I don't want to start messing with
something I have no chance to test, sorry.
Also, you can avoid having to do cflags modifications like this one:
libfprint_la_CFLAGS += -DENABLE_URU4000
by using AC_DEFINE in configure.ac to place an entry in config.h
Thanks!
Daniel
OK, thanks, done :)
Only it didn't clean things the way I thought it would, AM_CONDITIONALs
are still there as autoconf complained when i tried to manage DRIVER_SRC
in configure.ac ("configure substitutions are not allowed in _SOURCES
variables"). Any other way around it?
Pavel
diff -ur a/configure.ac b/configure.ac
--- a/configure.ac 2008-07-17 14:06:12.000000000 +0200
+++ b/configure.ac 2008-07-20 11:09:27.000000000 +0200
@@ -18,6 +18,83 @@
AC_SUBST(lt_revision)
AC_SUBST(lt_age)
+all_drivers="upekts upektc upeksonly vcom5s uru4000 fdu2000 aes1610 aes2501 aes4000"
+
+require_imagemagick='no'
+require_aeslib='no'
+enable_upekts='no'
+enable_upektc='no'
+enable_upeksonly='no'
+enable_vcom5s='no'
+enable_uru4000='no'
+enable_fdu2000='no'
+enable_aes1610='no'
+enable_aes2501='no'
+enable_aes4000='no'
+
+AC_ARG_WITH([drivers],[AS_HELP_STRING([--with-drivers],
+ [List of drivers to enable])],
+ [drivers="$withval"],
+ [drivers="$all_drivers"])
+
+for driver in `echo ${drivers} | sed -e 's/,/ /g' -e 's/,$//g'`; do
+ case ${driver} in
+ upekts)
+ AC_DEFINE([ENABLE_UPEKTS], [], [Build UPEK TouchStrip driver])
+ enable_upekts="yes"
+ ;;
+ upektc)
+ AC_DEFINE([ENABLE_UPEKTC], [], [Build UPEK TouchChip driver])
+ enable_upektc="yes"
+ ;;
+ upeksonly)
+ AC_DEFINE([ENABLE_UPEKSONLY], [], [Build UPEK TouchStrip sensor-only driver])
+ enable_upeksonly="yes"
+ ;;
+ uru4000)
+ AC_DEFINE([ENABLE_URU4000], [], [Build Digital Persona U.are.U 4000 driver])
+ enable_uru4000="yes"
+ ;;
+ fdu2000)
+ AC_DEFINE([ENABLE_FDU2000], [], [Build Secugen FDU 2000 driver])
+ enable_fdu2000="yes"
+ ;;
+ vcom5s)
+ AC_DEFINE([ENABLE_VCOM5S], [], [Build Veridicom 5thSense driver])
+ enable_vcom5s="yes"
+ ;;
+ aes2501)
+ AC_DEFINE([ENABLE_AES2501], [], [Build AuthenTec AES2501 driver])
+ require_aeslib="yes"
+ enable_aes2501="yes"
+ ;;
+ aes1610)
+ AC_DEFINE([ENABLE_AES1610], [], [Build AuthenTec AES1610 driver])
+ require_aeslib="yes"
+ enable_aes1610="yes"
+ ;;
+ aes4000)
+ AC_DEFINE([ENABLE_AES4000], [], [Build AuthenTec AES4000 driver])
+ require_aeslib="yes"
+ require_imagemagick="yes"
+ enable_aes4000="yes"
+ ;;
+ esac
+done
+
+AM_CONDITIONAL([ENABLE_UPEKTS], [test "$enable_upekts" != "no"])
+#AM_CONDITIONAL([ENABLE_UPEKTC], [test "$enable_upektc" != "no"])
+AM_CONDITIONAL([ENABLE_UPEKSONLY], [test "$enable_upeksonly" != "no"])
+AM_CONDITIONAL([ENABLE_VCOM5S], [test "$enable_vcom5s" != "no"])
+AM_CONDITIONAL([ENABLE_URU4000], [test "$enable_uru4000" != "no"])
+#AM_CONDITIONAL([ENABLE_FDU2000], [test "$enable_fdu2000" != "no"])
+#AM_CONDITIONAL([ENABLE_AES1610], [test "$enable_aes1610" != "no"])
+AM_CONDITIONAL([ENABLE_AES2501], [test "$enable_aes2501" != "no"])
+AM_CONDITIONAL([ENABLE_AES4000], [test "$enable_aes4000" != "no"])
+AM_CONDITIONAL([REQUIRE_IMAGEMAGICK], [test "$require_imagemagick" != "no"])
+AM_CONDITIONAL([REQUIRE_AESLIB], [test "$require_aeslib" != "no"])
+
+
PKG_CHECK_MODULES(LIBUSB, [libusb-1.0 >= 0.9.1])
AC_SUBST(LIBUSB_CFLAGS)
AC_SUBST(LIBUSB_LIBS)
@@ -31,9 +108,11 @@
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
+if test "$require_imagemagick" != "no"; then
PKG_CHECK_MODULES(IMAGEMAGICK, "ImageMagick")
AC_SUBST(IMAGEMAGICK_CFLAGS)
AC_SUBST(IMAGEMAGICK_LIBS)
+fi;
# Examples build
AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
diff -ur a/libfprint/Makefile.am b/libfprint/Makefile.am
--- a/libfprint/Makefile.am 2008-07-17 14:06:23.000000000 +0200
+++ b/libfprint/Makefile.am 2008-07-20 11:09:49.000000000 +0200
@@ -10,8 +10,8 @@
FDU2000_SRC = drivers/fdu2000.c
VCOM5S_SRC = drivers/vcom5s.c
-DRIVER_SRC = $(UPEKTS_SRC) $(AES4000_SRC) $(AES2501_SRC) $(URU4000_SRC) $(VCOM5S_SRC) $(UPEKSONLY_SRC)
-#DRIVER_SRC = $(AES1610_SRC) $(UPEKTC_SRC) $(FDU2000_SRC)
+DRIVER_SRC = ""
+OTHER_SRC = ""
NBIS_SRC = \
nbis/include/bozorth.h \
@@ -50,9 +50,54 @@
nbis/mindtct/sort.c \
nbis/mindtct/util.c
-libfprint_la_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(IMAGEMAGICK_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CFLAGS)
+libfprint_la_CFLAGS = -fvisibility=hidden -I$(srcdir)/nbis/include $(LIBUSB_CFLAGS) $(GLIB_CFLAGS) $(CRYPTO_CFLAGS) $(AM_CFLAGS)
libfprint_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@
-libfprint_la_LIBADD = -lm $(LIBUSB_LIBS) $(GLIB_LIBS) $(IMAGEMAGICK_LIBS) $(CRYPTO_LIBS)
+libfprint_la_LIBADD = -lm $(LIBUSB_LIBS) $(GLIB_LIBS) $(CRYPTO_LIBS)
+
+if ENABLE_UPEKTS
+DRIVER_SRC += $(UPEKTS_SRC)
+endif
+
+if ENABLE_UPEKSONLY
+DRIVER_SRC += $(UPEKSONLY_SRC)
+endif
+
+#if ENABLE_UPEKTC
+#DRIVER_SRC += $(UPEKTC_SRC)
+#endif
+
+if ENABLE_URU4000
+DRIVER_SRC += $(URU4000_SRC)
+endif
+
+if ENABLE_VCOM5S
+DRIVER_SRC += $(VCOM5S_SRC)
+endif
+
+#if ENABLE_FDU2000
+#DRIVER_SRC += $(FDU2000_SRC)
+#endif
+
+#if ENABLE_AES1610
+#DRIVER_SRC += $(AES1610_SRC)
+#endif
+
+if ENABLE_AES2501
+DRIVER_SRC += $(AES2501_SRC)
+endif
+
+if ENABLE_AES4000
+DRIVER_SRC += $(AES4000_SRC)
+endif
+
+if REQUIRE_IMAGEMAGICK
+libfprint_la_CFLAGS += $(IMAGEMAGICK_CFLAGS) -DREQUIRE_IMAGEMAGICK
+libfprint_la_LIBADD += $(IMAGEMAGICK_LIBS)
+endif
+
+if REQUIRE_AESLIB
+OTHER_SRC += aeslib.c aeslib.h
+endif
libfprint_la_SOURCES = \
fp_internal.h \
@@ -64,9 +109,8 @@
imgdev.c \
poll.c \
sync.c \
- aeslib.c \
- aeslib.h \
$(DRIVER_SRC) \
+ $(OTHER_SRC) \
$(NBIS_SRC)
pkginclude_HEADERS = fprint.h
diff -ur a/libfprint/core.c b/libfprint/core.c
--- a/libfprint/core.c 2008-07-17 14:06:28.000000000 +0200
+++ b/libfprint/core.c 2008-07-20 11:09:49.000000000 +0200
@@ -327,18 +327,38 @@
}
static struct fp_driver * const primitive_drivers[] = {
+#ifdef ENABLE_UPEKTS
&upekts_driver,
+#endif
};
static struct fp_img_driver * const img_drivers[] = {
+#ifdef ENABLE_AES4000
&aes4000_driver,
+#endif
+#ifdef ENABLE_AES2501
&aes2501_driver,
+#endif
+#ifdef ENABLE_URU4000
&uru4000_driver,
+#endif
+#ifdef ENABLE_VCOM5S
&vcom5s_driver,
+#endif
+#ifdef ENABLE_UPEKSONLY
&upeksonly_driver,
- /* &aes1610_driver,
+#endif
+ /*
+#ifdef ENABLE_AES1610
+ &aes1610_driver,
+#endif
+#ifdef ENABLE_UPEKTC
&upektc_driver,
- &fdu2000_driver, */
+#endif
+#ifdef ENABLE_FDU2000
+ &fdu2000_driver,
+#endif
+ */
};
static void register_drivers(void)
diff -ur a/libfprint/fp_internal.h b/libfprint/fp_internal.h
--- a/libfprint/fp_internal.h 2008-07-17 14:06:38.000000000 +0200
+++ b/libfprint/fp_internal.h 2008-07-20 11:09:49.000000000 +0200
@@ -233,15 +233,33 @@
void (*deactivate)(struct fp_img_dev *dev);
};
+#ifdef ENABLE_UPEKTS
extern struct fp_driver upekts_driver;
+#endif
+#ifdef ENABLE_UPEKTC
extern struct fp_img_driver upektc_driver;
+#endif
+#ifdef ENABLE_UPEKSONLY
extern struct fp_img_driver upeksonly_driver;
+#endif
+#ifdef ENABLE_URU4000
extern struct fp_img_driver uru4000_driver;
+#endif
+#ifdef ENABLE_AES1610
extern struct fp_img_driver aes1610_driver;
+#endif
+#ifdef ENABLE_AES2501
extern struct fp_img_driver aes2501_driver;
+#endif
+#ifdef ENABLE_AES4000
extern struct fp_img_driver aes4000_driver;
+#endif
+#ifdef ENABLE_FDU2000
extern struct fp_img_driver fdu2000_driver;
+#endif
+#ifdef ENABLE_VCOM5S
extern struct fp_img_driver vcom5s_driver;
+#endif
extern libusb_context *fpi_usb_ctx;
extern GSList *opened_devices;
diff -ur a/libfprint/imgdev.c b/libfprint/imgdev.c
--- a/libfprint/imgdev.c 2008-07-17 14:06:33.000000000 +0200
+++ b/libfprint/imgdev.c 2008-07-20 11:09:49.000000000 +0200
@@ -20,7 +20,9 @@
#include <errno.h>
#include <glib.h>
+#ifdef REQUIRE_IMAGEMAGICK
#include <magick/ImageMagick.h>
+#endif
#include "fp_internal.h"
@@ -87,6 +89,7 @@
return imgdrv->change_state(imgdev, state);
}
+#ifdef REQUIRE_IMAGEMAGICK
static struct fp_img *im_resize(struct fp_img *img, unsigned int factor)
{
Image *mimg;
@@ -129,6 +132,7 @@
return newimg;
}
+#endif
/* check image properties and resize it if necessary. potentially returns a new
* image after freeing the old one. */
@@ -157,6 +161,7 @@
return -EINVAL;
}
+#ifdef REQUIRE_IMAGEMAGICK
if (imgdrv->enlarge_factor > 1) {
/* FIXME: enlarge_factor should not exist! instead, MINDTCT should
* actually look at the value of the pixels-per-mm parameter and
@@ -166,6 +171,7 @@
fp_img_free(img);
*_img = tmp;
}
+#endif
return 0;
}
_______________________________________________
fprint mailing list
[email protected]
http://lists.reactivated.net/mailman/listinfo/fprint