1AC_INIT([libfprint], [0.7.0])
2AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz check-news subdir-objects])
3AC_CONFIG_MACRO_DIR([m4])
4AC_CONFIG_SRCDIR([libfprint/core.c])
5AC_CONFIG_HEADERS([config.h])
6
7# Enable silent build when available (Automake 1.11)
8m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
9
10AC_PREREQ([2.50])
11AC_PROG_CC
12AC_PROG_LIBTOOL
13AC_C_INLINE
14AM_PROG_CC_C_O
15AC_PROG_CXX
16AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
17
18# Library versioning
19lt_major="0"
20lt_revision="0"
21lt_age="0"
22AC_SUBST(lt_major)
23AC_SUBST(lt_revision)
24AC_SUBST(lt_age)
25
26all_drivers="upekts upektc upeksonly vcom5s uru4000 fdu2000 aes1610 aes1660 aes2501 aes2550 aes2660 aes3500 aes4000 vfs101 vfs301 vfs5011 upektc_img etes603 vfs0050"
27
28require_imaging='no'
29require_aeslib='no'
30require_aesX660='no'
31require_aes3k='no'
32enable_upeke2='no'
33enable_upekts='no'
34enable_upektc='no'
35enable_upeksonly='no'
36enable_vcom5s='no'
37enable_uru4000='no'
38enable_fdu2000='no'
39enable_aes1610='no'
40enable_aes1660='no'
41enable_aes2501='no'
42enable_aes2550='no'
43enable_aes2660='no'
44enable_aes3500='no'
45enable_aes4000='no'
46enable_vfs101='no'
47enable_vfs301='no'
48enable_vfs5011='no'
49enable_upektc_img='no'
50enable_etes603='no'
51enable_vfs0050='no'
52
53AC_ARG_WITH([drivers],[AS_HELP_STRING([--with-drivers],
54	[List of drivers to enable])],
55	[drivers="$withval"],
56	[drivers="$all_drivers"])
57
58if test "x$drivers" = "xall" ; then
59	drivers=$all_drivers
60fi
61
62for driver in `echo ${drivers} | sed -e 's/,/ /g' -e 's/,$//g'`; do
63	case ${driver} in
64		upekts)
65			AC_DEFINE([ENABLE_UPEKTS], [], [Build UPEK TouchStrip driver])
66			enable_upekts="yes"
67		;;
68		upeke2)
69			AC_DEFINE([ENABLE_UPEKE2], [], [Build UPEK Eikon 2])
70			enable_upeke2="yes"
71		;;
72		upektc)
73			AC_DEFINE([ENABLE_UPEKTC], [], [Build UPEK TouchChip driver])
74			enable_upektc="yes"
75		;;
76		upeksonly)
77			AC_DEFINE([ENABLE_UPEKSONLY], [], [Build UPEK TouchStrip sensor-only driver])
78			enable_upeksonly="yes"
79		;;
80		uru4000)
81			AC_DEFINE([ENABLE_URU4000], [], [Build Digital Persona U.are.U 4000 driver])
82			enable_uru4000="yes"
83		;;
84		fdu2000)
85			AC_DEFINE([ENABLE_FDU2000], [], [Build Secugen FDU 2000 driver])
86			enable_fdu2000="no"
87			# Driver not ported
88		;;
89		vcom5s)
90			AC_DEFINE([ENABLE_VCOM5S], [], [Build Veridicom 5thSense driver])
91			enable_vcom5s="yes"
92		;;
93		aes2501)
94			AC_DEFINE([ENABLE_AES2501], [], [Build AuthenTec AES2501 driver])
95			require_aeslib="yes"
96			enable_aes2501="yes"
97		;;
98		aes2550)
99			AC_DEFINE([ENABLE_AES2550], [], [Build AuthenTec AES2550/AES2810 driver])
100			require_aeslib="yes"
101			enable_aes2550="yes"
102		;;
103		aes1610)
104			AC_DEFINE([ENABLE_AES1610], [], [Build AuthenTec AES1610 driver])
105			require_aeslib="yes"
106			enable_aes1610="yes"
107		;;
108		aes1660)
109			AC_DEFINE([ENABLE_AES1660], [], [Build AuthenTec AES1660 driver])
110			require_aeslib="yes"
111			require_aesX660="yes"
112			enable_aes1660="yes"
113		;;
114		aes2660)
115			AC_DEFINE([ENABLE_AES2660], [], [Build AuthenTec AES1660 driver])
116			require_aeslib="yes"
117			require_aesX660="yes"
118			enable_aes2660="yes"
119		;;
120		aes3500)
121			AC_DEFINE([ENABLE_AES3500], [], [Build AuthenTec AES3500 driver])
122			require_aeslib="yes"
123			require_imaging="yes"
124			require_aes3k="yes"
125			enable_aes3500="yes"
126		;;
127		aes4000)
128			AC_DEFINE([ENABLE_AES4000], [], [Build AuthenTec AES4000 driver])
129			require_aeslib="yes"
130			require_imaging="yes"
131			require_aes3k="yes"
132			enable_aes4000="yes"
133		;;
134		vfs101)
135			AC_DEFINE([ENABLE_VFS101], [], [Build Validity VFS101 driver])
136			enable_vfs101="yes"
137		;;
138		vfs301)
139			AC_DEFINE([ENABLE_VFS301], [], [Build Validity VFS301/VFS300 driver])
140			enable_vfs301="yes"
141		;;
142		vfs5011)
143			AC_DEFINE([ENABLE_VFS5011], [], [Build Validity VFS5011 driver])
144			enable_vfs5011="yes"
145		;;
146		upektc_img)
147			AC_DEFINE([ENABLE_UPEKTC_IMG], [], [Build Upek TouchChip Fingerprint Coprocessor driver])
148			enable_upektc_img="yes"
149		;;
150		etes603)
151			AC_DEFINE([ENABLE_ETES603], [], [Build EgisTec ES603 driver])
152			enable_etes603="yes"
153		;;
154		vfs0050)
155			AC_DEFINE([ENABLE_VFS0050], [], [Build Validity VFS0050 driver])
156			enable_vfs0050="yes"
157		;;
158	esac
159done
160
161AM_CONDITIONAL([ENABLE_UPEKTS], [test "$enable_upekts" = "yes"])
162AM_CONDITIONAL([ENABLE_UPEKE2], [test "$enable_upeke2" = "yes"])
163AM_CONDITIONAL([ENABLE_UPEKTC], [test "$enable_upektc" = "yes"])
164AM_CONDITIONAL([ENABLE_UPEKSONLY], [test "$enable_upeksonly" = "yes"])
165AM_CONDITIONAL([ENABLE_VCOM5S], [test "$enable_vcom5s" = "yes"])
166AM_CONDITIONAL([ENABLE_URU4000], [test "$enable_uru4000" = "yes"])
167AM_CONDITIONAL([ENABLE_FDU2000], [test "$enable_fdu2000" = "yes"])
168AM_CONDITIONAL([ENABLE_AES1610], [test "$enable_aes1610" = "yes"])
169AM_CONDITIONAL([ENABLE_AES1660], [test "$enable_aes1660" = "yes"])
170AM_CONDITIONAL([ENABLE_AES2501], [test "$enable_aes2501" = "yes"])
171AM_CONDITIONAL([ENABLE_AES2550], [test "$enable_aes2550" = "yes"])
172AM_CONDITIONAL([ENABLE_AES2660], [test "$enable_aes2660" = "yes"])
173AM_CONDITIONAL([ENABLE_AES3500], [test "$enable_aes3500" = "yes"])
174AM_CONDITIONAL([ENABLE_AES4000], [test "$enable_aes4000" = "yes"])
175AM_CONDITIONAL([REQUIRE_AESLIB], [test "$require_aeslib" = "yes"])
176AM_CONDITIONAL([REQUIRE_AESX660], [test "$require_aesX660" = "yes"])
177AM_CONDITIONAL([REQUIRE_AES3K], [test "$require_aes3k" = "yes"])
178AM_CONDITIONAL([ENABLE_VFS101], [test "$enable_vfs101" = "yes"])
179AM_CONDITIONAL([ENABLE_VFS301], [test "$enable_vfs301" = "yes"])
180AM_CONDITIONAL([ENABLE_VFS5011], [test "$enable_vfs5011" = "yes"])
181AM_CONDITIONAL([ENABLE_UPEKTC_IMG], [test "$enable_upektc_img" = "yes"])
182AM_CONDITIONAL([ENABLE_ETES603], [test "$enable_etes603" = "yes"])
183AM_CONDITIONAL([ENABLE_VFS0050], [test "$enable_vfs0050" = "yes"])
184
185
186PKG_CHECK_MODULES(LIBUSB, [libusb-1.0 >= 0.9.1])
187AC_SUBST(LIBUSB_CFLAGS)
188AC_SUBST(LIBUSB_LIBS)
189
190# check for OpenSSL's libcrypto
191PKG_CHECK_MODULES(CRYPTO, nss)
192AC_SUBST(CRYPTO_CFLAGS)
193AC_SUBST(CRYPTO_LIBS)
194
195PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.28])
196AC_SUBST(GLIB_CFLAGS)
197AC_SUBST(GLIB_LIBS)
198
199pixman_found=no
200
201AC_ARG_ENABLE(udev-rules,
202	AC_HELP_STRING([--enable-udev-rules],[Update the udev rules]),
203	[case "${enableval}" in
204	yes) ENABLE_UDEV_RULES=yes ;;
205	no) ENABLE_UDEV_RULES=no ;;
206	*) AC_MSG_ERROR(bad value ${enableval} for --enable-udev-rules) ;;
207	esac],
208	[ENABLE_UDEV_RULES=yes]) dnl Default value
209AM_CONDITIONAL(ENABLE_UDEV_RULES, test x$ENABLE_UDEV_RULES = "xyes")
210
211if test $ENABLE_UDEV_RULES = no && test -d .git/ ; then
212	AC_MSG_ERROR(--disable-udev-rules can only be used when building from tarballs)
213fi
214
215AC_ARG_WITH(udev-rules-dir,
216	    AS_HELP_STRING([--with-udev-rules-dir=DIR],[Installation path for udev rules @<:@auto@:>@]),
217	    [ac_with_udev_rules_dir=$withval],
218	    [ac_with_udev_rules_dir=""])
219
220if test "${ac_with_udev_rules_dir}" = ""; then
221	ac_with_udev_rules_dir=`$PKG_CONFIG --variable=udevdir udev`/rules.d
222fi
223AC_MSG_NOTICE([installing udev rules in ${ac_with_udev_rules_dir}])
224AC_SUBST([udev_rulesdir],[${ac_with_udev_rules_dir}])
225
226if test "$require_imaging" = "yes"; then
227	PKG_CHECK_MODULES(IMAGING, pixman-1, [pixman_found=yes], [pixman_found=no])
228	if test "$pixman_found" != "yes"; then
229		AC_MSG_ERROR([pixman is required for imaging support])
230	fi
231fi
232
233AM_CONDITIONAL([REQUIRE_PIXMAN], [test "$pixman_found" = "yes"])
234AC_SUBST(IMAGING_CFLAGS)
235AC_SUBST(IMAGING_LIBS)
236
237# Examples build
238AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
239	[build example applications (default n)])],
240	[build_examples=$enableval],
241	[build_examples='no'])
242AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
243
244# Examples build
245AC_ARG_ENABLE([x11-examples-build], [AS_HELP_STRING([--enable-x11-examples-build],
246	[build X11 example applications (default n)])],
247	[build_x11_examples=$enableval],
248	[build_x11_examples='no'])
249AM_CONDITIONAL([BUILD_X11_EXAMPLES], [test "x$build_x11_examples" != "xno"])
250
251
252if test "x$build_x11_examples" != "xno"; then
253	# check for Xv extensions
254	# imported from Coriander
255	AC_DEFUN([AC_CHECK_XV],[
256		AC_SUBST(XV_CFLAGS)
257		AC_SUBST(XV_LIBS)
258		AC_MSG_CHECKING(for Xv extensions)
259		AC_TRY_COMPILE([
260		#include <X11/Xlib.h>
261		#include <X11/extensions/Xvlib.h>],[
262		int main(void) { (void) XvGetPortAttribute(0, 0, 0, 0); return 0; }
263		],xv=yes,xv=no);
264		AC_MSG_RESULT($xv)
265		if test x$xv = xyes; then
266	       XV_LIBS="-lXv -lXext"
267	       XV_CFLAGS=""
268		   AC_DEFINE(HAVE_XV,1,[defined if XV video overlay is available])
269		else
270			AC_MSG_ERROR([XV is required for X11 examples])
271		fi
272	])
273	AC_CHECK_XV
274fi
275
276# Message logging
277AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])],
278	[log_enabled=$enableval],
279	[log_enabled='yes'])
280if test "x$log_enabled" != "xno"; then
281	AC_DEFINE([ENABLE_LOGGING], 1, [Message logging])
282fi
283
284AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log],
285	[enable debug logging (default n)])],
286	[debug_log_enabled=$enableval],
287	[debug_log_enabled='no'])
288if test "x$debug_log_enabled" != "xno"; then
289	AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
290fi
291
292# Restore gnu89 inline semantics on gcc 4.3 and newer
293saved_cflags="$CFLAGS"
294CFLAGS="$CFLAGS -fgnu89-inline"
295AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], inline_cflags="-fgnu89-inline", inline_cflags="")
296CFLAGS="$saved_cflags"
297
298AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
299AM_CFLAGS="-std=gnu99 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
300AC_SUBST(AM_CFLAGS)
301
302if test "$require_imaging" = "yes"; then
303	if test x$pixman_found != no; then
304		AC_MSG_NOTICE([** Using pixman for imaging])
305	fi
306else
307	AC_MSG_NOTICE([   Imaging support disabled])
308fi
309
310if test x$enable_upekts != xno ; then
311	AC_MSG_NOTICE([** upekts driver enabled])
312else
313	AC_MSG_NOTICE([   upekts driver disabled])
314fi
315if test x$enable_upeke2 != xno ; then
316	AC_MSG_NOTICE([** upeke2 driver enabled])
317else
318	AC_MSG_NOTICE([   upeke2 driver disabled (handled by upektc_img driver)])
319fi
320if test x$enable_upektc != xno ; then
321	AC_MSG_NOTICE([** upektc driver enabled])
322else
323	AC_MSG_NOTICE([   upektc driver disabled])
324fi
325if test x$enable_upeksonly != xno ; then
326	AC_MSG_NOTICE([** upeksonly driver enabled])
327else
328	AC_MSG_NOTICE([   upeksonly driver disabled])
329fi
330if test x$enable_vcom5s != xno ; then
331	AC_MSG_NOTICE([** vcom5s driver enabled])
332else
333	AC_MSG_NOTICE([   vcom5s driver disabled])
334fi
335if test x$enable_uru4000 != xno ; then
336	AC_MSG_NOTICE([** uru4000 driver enabled])
337else
338	AC_MSG_NOTICE([   uru4000 driver disabled])
339fi
340if test x$enable_fdu2000 != xno ; then
341	AC_MSG_NOTICE([** fdu2000 driver enabled])
342else
343	AC_MSG_NOTICE([   fdu2000 driver disabled (not ported)])
344fi
345if test x$enable_aes1610 != xno ; then
346	AC_MSG_NOTICE([** aes1610 driver enabled])
347else
348	AC_MSG_NOTICE([   aes1610 driver disabled])
349fi
350if test x$enable_aes1660 != xno ; then
351	AC_MSG_NOTICE([** aes1660 driver enabled])
352else
353	AC_MSG_NOTICE([   aes1660 driver disabled])
354fi
355if test x$enable_aes2501 != xno ; then
356	AC_MSG_NOTICE([** aes2501 driver enabled])
357else
358	AC_MSG_NOTICE([   aes2501 driver disabled])
359fi
360if test x$enable_aes2550 != xno ; then
361	AC_MSG_NOTICE([** aes2550/aes2810 driver enabled])
362else
363	AC_MSG_NOTICE([   aes2550/aes2810 driver disabled])
364fi
365if test x$enable_aes2660 != xno ; then
366	AC_MSG_NOTICE([** aes2660 driver enabled])
367else
368	AC_MSG_NOTICE([   aes2660 driver disabled])
369fi
370if test x$enable_aes3500 != xno ; then
371	AC_MSG_NOTICE([** aes3500 driver enabled])
372else
373	AC_MSG_NOTICE([   aes3500 driver disabled])
374fi
375if test x$enable_aes4000 != xno ; then
376	AC_MSG_NOTICE([** aes4000 driver enabled])
377else
378	AC_MSG_NOTICE([   aes4000 driver disabled])
379fi
380if test x$enable_vfs101 != xno ; then
381	AC_MSG_NOTICE([** vfs101 driver enabled])
382else
383	AC_MSG_NOTICE([   vfs101 driver disabled])
384fi
385if test x$enable_vfs301 != xno ; then
386	AC_MSG_NOTICE([** vfs301 driver enabled])
387else
388	AC_MSG_NOTICE([   vfs301 driver disabled])
389fi
390if test x$enable_vfs5011 != xno ; then
391	AC_MSG_NOTICE([** vfs5011 driver enabled])
392else
393	AC_MSG_NOTICE([   vfs5011 driver disabled])
394fi
395if test x$enable_upektc_img != xno ; then
396	AC_MSG_NOTICE([** upektc_img driver enabled])
397else
398	AC_MSG_NOTICE([   upektc_img driver disabled])
399fi
400if test x$enable_etes603 != xno ; then
401	AC_MSG_NOTICE([** etes603 driver enabled])
402else
403	AC_MSG_NOTICE([   etes603 driver disabled])
404fi
405if test x$enable_vfs0050 != xno ; then
406	AC_MSG_NOTICE([** vfs0050 driver enabled])
407else
408	AC_MSG_NOTICE([   vfs0050 driver disabled])
409fi
410if test x$require_aeslib != xno ; then
411	AC_MSG_NOTICE([** aeslib helper functions enabled])
412else
413	AC_MSG_NOTICE([   aeslib helper functions disabled])
414fi
415if test x$require_aesX660 != xno ; then
416	AC_MSG_NOTICE([** aesX660 common routines enabled])
417else
418	AC_MSG_NOTICE([   aesX660 common routines disabled])
419fi
420if test x$require_aes3k != xno ; then
421	AC_MSG_NOTICE([** aes3k common routines enabled])
422else
423	AC_MSG_NOTICE([   aes3k common routines disabled])
424fi
425
426AC_CONFIG_FILES([libfprint.pc] [Makefile] [libfprint/Makefile] [examples/Makefile] [doc/Makefile])
427AC_OUTPUT
428
429