Allow drivers to be included/excluded at compile time

This commit is contained in:
Pavel Herrman 2008-08-10 14:21:58 -05:00 committed by Daniel Drake
parent b6dabaacc8
commit bba1c1085f
6 changed files with 176 additions and 8 deletions

1
THANKS
View file

@ -6,3 +6,4 @@ Craig Watson (NIST)
James Vasile (SFLC)
Toby Howard (University of Manchester)
Seemant Kulleen
Pavel Herrman

View file

@ -18,6 +18,83 @@ AC_SUBST(lt_major)
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 @@ PKG_CHECK_MODULES(GLIB, "glib-2.0")
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],

View file

@ -10,8 +10,8 @@ AES4000_SRC = drivers/aes4000.c
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_SRC = \
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 @@ libfprint_la_SOURCES = \
imgdev.c \
poll.c \
sync.c \
aeslib.c \
aeslib.h \
$(DRIVER_SRC) \
$(OTHER_SRC) \
$(NBIS_SRC)
pkginclude_HEADERS = fprint.h

View file

@ -327,18 +327,38 @@ static void register_driver(struct fp_driver *drv)
}
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)

View file

@ -233,15 +233,33 @@ struct fp_img_driver {
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;

View file

@ -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 @@ static int dev_change_state(struct fp_img_dev *imgdev,
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 @@ static struct fp_img *im_resize(struct fp_img *img, unsigned int factor)
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 @@ static int sanitize_image(struct fp_img_dev *imgdev, struct fp_img **_img)
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 @@ static int sanitize_image(struct fp_img_dev *imgdev, struct fp_img **_img)
fp_img_free(img);
*_img = tmp;
}
#endif
return 0;
}