Update spec file for license macro
[platform/upstream/libzbar.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ([2.61])
3 AC_INIT([zbar], [0.10], [spadix@users.sourceforge.net])
4 AC_CONFIG_AUX_DIR(config)
5 AC_CONFIG_MACRO_DIR(config)
6 AM_INIT_AUTOMAKE([1.10 foreign subdir-objects std-options dist-bzip2])
7 AC_CONFIG_HEADERS([include/config.h])
8 AC_CONFIG_SRCDIR(zbar/scanner.c)
9 LT_PREREQ([2.2])
10 LT_INIT([dlopen win32-dll])
11 LT_LANG([Windows Resource])
12
13 dnl update these just before each release (along w/pacakge version above)
14 dnl   LIB_VERSION update instructions copied from libtool docs:
15 dnl   library version follows the form current:revision:age
16 dnl   - If the library source code has changed at all since the last update,
17 dnl     then increment revision (c:r:a becomes c:r+1:a).
18 dnl   - If any interfaces have been added, removed, or changed,
19 dnl     increment current, and set revision to 0.
20 dnl   - If any interfaces have been added since the last public release,
21 dnl     then increment age.
22 dnl   - If any interfaces have been removed since the last public release,
23 dnl     then set age to 0. 
24 AC_SUBST([LIB_VERSION], [2:0:2])
25 AC_SUBST([RELDATE], [2009-10-23])
26
27 dnl widget libraries use their own versioning.
28 dnl NB pygtk wrapper is *unversioned*
29 AC_SUBST([ZGTK_LIB_VERSION], [0:2:0])
30 AC_SUBST([ZQT_LIB_VERSION], [0:2:0])
31
32 AC_DEFINE_UNQUOTED([ZBAR_VERSION_MAJOR],
33   [[`echo "$PACKAGE_VERSION" | sed -e 's/\..*$//'`]],
34   [Program major version (before the '.') as a number])
35 AC_DEFINE_UNQUOTED([ZBAR_VERSION_MINOR],
36   [[`echo "$PACKAGE_VERSION" | sed -e 's/^[^.]*\.\([^.]*\)$/\1/'`]],
37   [Program minor version (after '.') as a number])
38
39 cur=`echo "$LIB_VERSION" | sed -e 's/:.*$//'`
40 age=`echo "$LIB_VERSION" | sed -e 's/^.*://'`
41 AC_DEFINE_UNQUOTED([LIB_VERSION_MAJOR], [[$(( $cur - $age ))]],
42   [Library major version])
43 AC_DEFINE_UNQUOTED([LIB_VERSION_MINOR], [[$age]],
44   [Library minor version])
45 AC_DEFINE_UNQUOTED([LIB_VERSION_REVISION],
46   [[`echo "$LIB_VERSION" | sed -e 's/^[^:]*:\([^:]*\):.*$/\1/'`]],
47   [Library revision])
48
49 AM_CPPFLAGS="-I$srcdir/include"
50 AM_CFLAGS=""
51 AM_CXXFLAGS="$AM_CFLAGS"
52 AC_SUBST([AM_CPPFLAGS])
53 AC_SUBST([AM_CFLAGS])
54 AC_SUBST([AM_CXXFLAGS])
55
56 dnl windows build
57
58 AC_CANONICAL_HOST
59 case $host_os in
60   *cygwin* | *mingw* | *uwin* | *djgpp* | *ems* )
61     win32="yes"
62     AC_DEFINE([_WIN32_WINNT], [0x0500], [Minimum Windows API version])
63   ;;
64   * )
65     win32="no"
66   ;;
67 esac
68 AM_CONDITIONAL([WIN32], [test "x$win32" = "xyes"])
69
70 dnl programs
71
72 AC_PROG_CC
73 AM_PROG_CC_C_O
74 AC_PROG_CXX
75
76 PKG_PROG_PKG_CONFIG
77
78 AC_ARG_VAR([XMLTO], [location of xmlto, used for optional \
79 documentation generation])
80 AC_ARG_VAR([XMLTOFLAGS], [additional arguments for xmlto])
81 AC_CHECK_PROGS([XMLTO], [xmlto], [:])
82
83 have_java="maybe"
84 AC_ARG_VAR([JAVA_HOME], [root location of JDK])
85 AS_IF([test "x$JAVA_HOME" = "x"],
86   [JAVA_PATH="$PATH"],
87   [JAVA_PATH="$JAVA_HOME/bin$PATH_SEPARATOR$PATH"])
88
89 AC_ARG_VAR([JAVAC], [location of Java language compiler])
90 AC_PATH_PROGS([JAVAC], [javac jikes ecj gcj], [:], [$JAVA_PATH])
91 AS_IF([test "x$JAVAC" = "x:"], [have_java="no"])
92
93 AC_ARG_VAR([JAVAH], [location of Java header generator])
94 AC_PATH_PROGS([JAVAH], [javah], [/bin/false], [$JAVA_PATH])
95
96 AC_ARG_VAR([JAR], [location of Java archive tool])
97 AC_PATH_PROGS([JAR], [jar], [:], [$JAVA_PATH])
98 AS_IF([test "x$JAR" = "x:"], [have_java="no"])
99
100 AC_ARG_VAR([JAVA], [location of Java application launcher])
101 AC_PATH_PROGS([JAVA], [java], [/bin/false], [$JAVA_PATH])
102
103 AC_ARG_VAR([CLASSPATH], [Java class path (include JUnit to run java tests)])
104 AS_IF([test "x$CLASSPATH" = "x"], [CLASSPATH="."])
105
106 dnl symbologies
107
108 AC_ARG_ENABLE([codes],
109   [AS_HELP_STRING([--enable-codes=SYMS],
110     [select symbologies to compile [default=ean,databar,code128,code93,code39,codabar,i25,qrcode]])],
111   [],
112   [enable_codes="ean,databar,code128,code93,code39,codabar,i25,qrcode"])
113
114 AC_DEFUN([ZBAR_CHK_CODE], [
115   AC_MSG_CHECKING([whether to build $2])
116   enable_$1="no"
117   AH_TEMPLATE([ENABLE_]translit($1, a-z, A-Z),
118     [whether to build support for $2])
119   AS_CASE([$enable_codes],
120     [*$1* | *all*],
121     [enable_$1="yes"
122      AC_DEFINE([ENABLE_]translit($1, a-z, A-Z), [1])
123     ])
124   AM_CONDITIONAL([ENABLE_]translit($1, a-z, A-Z),
125     [test "x$enable_$1" = "xyes"])
126   AC_MSG_RESULT([$enable_$1])
127 ])dnl
128
129 ZBAR_CHK_CODE([ean], [EAN symbologies])
130 ZBAR_CHK_CODE([databar], [DataBar symbology])
131 ZBAR_CHK_CODE([code128], [Code 128 symbology])
132 ZBAR_CHK_CODE([code93], [Code 93 symbology])
133 ZBAR_CHK_CODE([code39], [Code 39 symbology])
134 ZBAR_CHK_CODE([codabar], [Codabar symbology])
135 ZBAR_CHK_CODE([i25], [Interleaved 2 of 5 symbology])
136 ZBAR_CHK_CODE([qrcode], [QR Code])
137 ZBAR_CHK_CODE([pdf417], [PDF417 symbology])
138
139 dnl libraries
140
141 AC_SEARCH_LIBS([clock_gettime], [rt])
142 AM_ICONV()
143
144 dnl poll support
145
146 AC_CHECK_HEADERS([poll.h], [have_poll="yes"], [have_poll="no"])
147 AM_CONDITIONAL([HAVE_POLL], [test "x$have_poll" = "xyes"])
148
149 dnl pthreads
150 dnl FIXME this doesn't port well, integrate something like this:
151 dnl     http://autoconf-archive.cryp.to/acx_pthread.html
152
153 AC_ARG_ENABLE([pthread],
154   [AS_HELP_STRING([--disable-pthread],
155     [omit support for threaded applications])],
156   [],
157   [AS_IF([test "x$win32" = "xno"],
158    [enable_pthread="yes"],
159    [enable_pthread="no"
160 ])])
161
162 AS_IF([test "x$enable_pthread" != "xno"],
163   [AC_CHECK_HEADERS([pthread.h], [],
164      [AC_MSG_FAILURE([test for pthread support failed!
165 configure --disable-pthread to skip threaded support.])])
166    AC_CHECK_LIB([pthread], [pthread_create], [],
167      [AC_MSG_FAILURE([unable to link against -lpthread, although you
168 appear to have pthread.h? set LDFLAGS and/or LIBS to help the linker,
169 or configure --disable-pthread to skip threaded support.])])
170    AC_DEFINE([__USE_UNIX98], [1], [used only for pthread debug attributes])
171 ])
172
173 dnl video
174 AC_ARG_ENABLE([video],
175   [AS_HELP_STRING([--disable-video],
176     [exclude video scanner features])],
177   [],
178   [enable_video="yes"])
179
180 have_v4l1="no"
181 have_v4l2="no"
182 AS_IF([test "x$enable_video" = "xno"],
183   [],
184   [test "x$win32" = "xno"],
185   [AC_CHECK_HEADERS([linux/videodev.h], [have_v4l1="yes"])
186    AC_CHECK_HEADERS([linux/videodev2.h], [have_v4l2="yes"])
187    AS_IF([test "x$have_v4l2" = "xno" && test "x$have_v4l1" = "xno"],
188      [AC_MSG_FAILURE([test for video support failed!
189 rebuild your kernel to include video4linux support or
190 configure --disable-video to skip building video support.])],
191      [test "x$have_v4l2" = "xno"],
192      [AC_MSG_WARN([v4l2 API not detected, upgrade your kernel!])])],
193   [AC_CHECK_HEADERS([vfw.h], [with_video="vfw"],
194     [AC_MSG_FAILURE([test for VfW video support failed!
195 configure --disable-video to skip building video support.])])])
196
197 AM_CONDITIONAL([HAVE_VIDEO], [test "x$enable_video" != "xno"])
198 AM_CONDITIONAL([HAVE_V4L1], [test "x$have_v4l1" != "xno"])
199 AM_CONDITIONAL([HAVE_V4L2], [test "x$have_v4l2" != "xno"])
200
201 dnl X
202 AC_ARG_VAR([XSHM_LIBS], [linker flags for X shared memory extension])
203
204 AS_IF([test "x$win32" != "xno"],
205   [have_x="no"],
206   [AC_PATH_XTRA
207    AH_BOTTOM([#ifndef X_DISPLAY_MISSING
208 # define HAVE_X
209 #endif
210 ])])
211 AM_CONDITIONAL([HAVE_X], [test "x$have_x" = "xyes"])
212
213 AS_IF([test "x$XSHM_LIBS" = "x"], [XSHM_LIBS="-lXext"])
214 AC_ARG_WITH([xshm],
215   [AS_HELP_STRING([--without-xshm],
216     [disable support for X shared memory extension])],
217   [],
218   [with_xshm="check"])
219
220 AS_IF([test "x$with_xshm" != "xno"],
221   [AC_CHECK_HEADERS([X11/extensions/XShm.h],
222     [with_xshm="yes"],
223     [AS_IF([test "x$with_xshm" = "xcheck"],
224       [with_xshm="no"],
225       [AC_MSG_FAILURE([test for X shared memory extension failed!
226 install the X shared memory extension, specify --x-includes or
227 configure --without-xshm to disable the extension])])],
228     [[#include <X11/Xlib.h>
229 #include <sys/ipc.h>
230 #include <sys/shm.h>
231 ]])
232    AS_IF([test "x$with_xshm" != "xno"],
233      [AC_CHECK_LIB([Xext], [XShmQueryVersion],
234        [with_xshm="yes"],
235        [AC_MSG_FAILURE([unable to find XShmQueryVersion in $XSHM_LIBS!
236 specify XSHM_LIBS or configure --without-xshm to disable the extension])],
237        ["$X_LIBS" "$X_PRE_LIBS" -lX11 "$X_EXTRA_LIBS" "$XSHM_LIBS"])
238    ])
239 ])
240 AM_CONDITIONAL([HAVE_XSHM], [test "x$with_xshm" = "xyes"])
241
242 AC_ARG_VAR([XV_LIBS], [linker flags for XVideo extension])
243 AS_IF([test "x$XV_LIBS" = "x"], [XV_LIBS="-lXv"])
244 AC_ARG_WITH([xv],
245   [AS_HELP_STRING([--without-xv],
246     [disable support for XVideo extension])],
247   [],
248   [with_xv="check"])
249
250 AS_IF([test "x$with_xv" != "xno"],
251   [AC_CHECK_HEADERS([X11/extensions/Xvlib.h],
252     [with_xv="yes"],
253     [AS_IF([test "x$with_xv" = "xcheck"],
254       [with_xv="no"],
255       [AC_MSG_FAILURE([test for XVideo extension failed!
256 install the XVideo extension, specify --x-includes or
257 configure --without-xv to disable the extension])])],
258     [[#include <X11/Xlib.h>
259 ]])
260    AS_IF([test "x$with_xv" != "xno"],
261      [AC_CHECK_LIB([Xv], [XvQueryExtension],
262        [with_xv="yes"],
263        [AC_MSG_FAILURE([unable to find XvQueryExtension in $XV_LIBS!
264 specify XV_LIBS or configure --without-xv to disable the extension])],
265        ["$X_LIBS" "$X_PRE_LIBS" -lX11 "$X_EXTRA_LIBS" "$XV_LIBS"])
266    ])
267 ])
268 AM_CONDITIONAL([HAVE_XV], [test "x$with_xv" = "xyes"])
269
270 dnl libjpeg
271 AC_ARG_WITH([jpeg],
272   [AS_HELP_STRING([--without-jpeg],
273     [disable support for JPEG image conversions])],
274   [],
275   [with_jpeg="check"])
276
277 have_jpeg="maybe"
278 AS_IF([test "x$with_jpeg" != "xno"],
279   [AC_CHECK_HEADERS([jpeglib.h], [], [have_jpeg="no"])
280    AC_CHECK_HEADER([jerror.h], [], [have_jpeg="no"])
281    AC_CHECK_LIB([jpeg], [jpeg_read_header], [], [have_jpeg="no"])
282    AS_IF([test "x$have_jpeg" != "xno"],
283      [with_jpeg="yes"],
284      [test "x$with_jpeg" = "xyes"],
285      [AC_MSG_FAILURE([unable to find libjpeg! ensure CFLAGS/LDFLAGS are
286 set appropriately or configure --without-jpeg])],
287      [with_jpeg="no"])
288 ])
289 AM_CONDITIONAL([HAVE_JPEG], [test "x$with_jpeg" = "xyes"])
290
291 dnl ImageMagick or GraphicsMagick
292 dnl disable both if IM is explicitly disabled to preserve old behavior
293
294 AC_ARG_WITH([imagemagick],
295   [AS_HELP_STRING([--without-imagemagick],
296     [disable support for scanning images with ImageMagick])],
297   [],
298   [with_imagemagick="check"])
299
300 AC_ARG_WITH([graphicsmagick],
301   [AS_HELP_STRING([--with-graphicsmagick],
302     [use GraphicsMagick alternative to ImageMagick])],
303   [],
304   [with_graphicsmagick="check"])
305
306 magick="UnknownMagick"
307 have_IM="maybe"
308 AS_IF([test "x$with_imagemagick" = "xno"], [],
309       [test "x$with_imagemagick" = "xyes" || \
310        test "x$with_graphicsmagick" != "xyes"],
311   [looked_for="ImageMagick >= 6.2.6"
312    PKG_CHECK_MODULES([MAGICK], [MagickWand >= 6.2.6],
313      [MAGICK_VERSION=`$PKG_CONFIG MagickWand --modversion`],
314      [dnl
315 dnl Wand is deprecated in favor of MagickWand,
316 dnl but the latter doesn't exist in older verisons (bug #2848437)
317       saved_error=$MAGICK_PKG_ERRORS
318       PKG_CHECK_MODULES([MAGICK], [Wand >= 6.2.6],
319         [MAGICK_VERSION=`$PKG_CONFIG Wand --modversion`],
320         [have_IM="no"])])
321    AS_IF([test "x$have_IM" != "xno"],
322      [magick="ImageMagick"
323       AC_MSG_NOTICE([trying ImageMagick version $MAGICK_VERSION])
324 dnl double check ImageMagick install (bug #2582232)
325       CPPFLAGS_save="$CPPFLAGS"
326       CPPFLAGS="$CPPFLAGS $MAGICK_CFLAGS"
327       AC_CHECK_HEADER([wand/MagickWand.h],
328         [have_IM="yes"],
329         [have_IM="broken"])
330       CPPFLAGS="$CPPFLAGS_save"])])
331
332 have_GM="maybe"
333 AS_IF([test "x$have_IM" = "xyes"], [],
334       [test "x$with_graphicsmagick" = "xno"], [],
335       [test "x$with_graphicsmagick" = "xyes" || \
336        test "x$with_imagemagick" = "xcheck"],
337   [AS_IF([test "x$looked_for" = "x"],
338      [looked_for="GraphicsMagick"],
339      [looked_for="$looked_for or GraphicsMagick"])
340    PKG_CHECK_MODULES([MAGICK], [GraphicsMagickWand],
341      [have_GM="yes"
342       magick="GraphicsMagick"
343       MAGICK_VERSION=`$PKG_CONFIG GraphicsMagickWand --modversion`],
344      [have_GM="no"
345       AS_IF([test "x$saved_error" = "x"],
346         [saved_error=$MAGICK_PKG_ERRORS])])])
347
348 dnl now that we have collected all the info abt what Magick is available
349 dnl let the user know what we will or can't do
350 AS_IF([test "x$have_IM" = "xbroken" && test "x$have_GM" = "xyes"],
351   [AC_MSG_WARN([Your ImageMagick install is broken, using GraphicsMagick instead])])
352
353 AS_IF([test "x$have_IM" = "xyes" || test "x$have_GM" = "xyes"],
354   [AC_MSG_NOTICE([using $magick version $MAGICK_VERSION])],
355   [test "x$with_imagemagick" = "xno" && \
356    test "x$with_graphicsmagick" != "xyes"],
357   [AC_MSG_NOTICE([image scanning disabled -- zbarimg will *not* be built])],
358   [test "x$have_IM" = "xbroken"],
359   [AC_MSG_FAILURE([$magick package found but wand/MagickWand.h not installed?!
360 this is a problem with your $magick install, please try again after
361 resolving the inconsistency or installing GraphicsMagick alternative...])],
362   [AC_MSG_FAILURE([dnl
363 Unable to find $looked_for:
364
365 $saved_error
366
367 * Ensure that you installed any "development" packages for ImageMagick or
368   GraphicsMagick.
369 * Consider adjusting the PKG_CONFIG_PATH environment variable if you
370   installed software in a non-standard prefix.
371 * You may set the environment variables MAGICK_CFLAGS and MAGICK_LIBS
372   to avoid the need to call pkg-config.
373   See the pkg-config man page for more details.
374 * To avoid using ImageMagick or GraphicsMagick altogether you may add the
375   --without-imagemagick flag to the configure command; the zbarimg program
376   will *not* be built.
377 ])])
378
379 AS_IF([test "x$have_IM" = "xyes"],
380   [AC_DEFINE([HAVE_IMAGEMAGICK], [1], [Define to 1 to use ImageMagick])],
381   [test "x$have_GM" = "xyes"],
382   [AC_DEFINE([HAVE_GRAPHICSMAGICK], [1], [Define to 1 to use GraphicsMagick])])
383 AM_CONDITIONAL([HAVE_MAGICK],
384   [test "x$have_IM" = "xyes" || test "x$have_GM" = "xyes"])
385
386 dnl Mozilla NPAPI
387 AC_ARG_WITH([npapi],
388   [AS_HELP_STRING([--with-npapi],
389     [enable support for Firefox/Mozilla/OpenOffice plugin])],
390   [],
391   [with_npapi="no"])
392
393 AS_IF([test "x$with_npapi" != "xno"],
394   [PKG_CHECK_MODULES([NPAPI], [firefox-plugin])
395    NPAPI_VERSION=`$PKG_CONFIG firefox-plugin --modversion`
396    AC_MSG_NOTICE([using firefox-plugin version $NPAPI_VERSION])])
397
398 AM_CONDITIONAL([HAVE_NPAPI], [test "x$with_npapi" = "xyes"])
399
400 dnl GTK
401 AC_ARG_WITH([gtk],
402   [AS_HELP_STRING([--without-gtk],
403     [disable support for GTK+ widget])],
404   [],
405   [with_gtk="yes"])
406
407 AC_ARG_VAR([GLIB_GENMARSHAL], [full path to glib-genmarshal])
408
409 AS_IF([test "x$with_gtk" != "xno"],
410   [PKG_CHECK_MODULES([GTK], [gtk+-2.0 gthread-2.0])
411    GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal`
412    GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
413    AC_MSG_NOTICE([using GTK+ version $GTK_VERSION])
414    GTHREAD_VERSION=`$PKG_CONFIG gthread-2.0 --modversion`
415    AC_MSG_NOTICE([using gthread-2.0 version $GTHREAD_VERSION])])
416
417 AM_CONDITIONAL([HAVE_GTK], [test "x$with_gtk" = "xyes"])
418
419 dnl PyGTK
420 AC_ARG_WITH([python],
421   [AS_HELP_STRING([--without-python],
422     [disable support for Python bindings])],
423   [],
424   [with_python="yes"])
425
426 AC_ARG_VAR([PYTHON_CONFIG], [full path to python-config program])
427 AC_ARG_VAR([PYTHON_CFLAGS], [compiler flags for building python extensions])
428 AC_ARG_VAR([PYTHON_LIBS], [linker flags for building python extensions])
429
430 AC_ARG_VAR([PYGTK_H2DEF], [full path to PyGTK h2def.py module])
431 AC_ARG_VAR([PYGTK_CODEGEN], [full path to pygtk-codegen program])
432 AC_ARG_VAR([PYGTK_DEFS], [directory where PyGTK definitions may be found])
433
434 AS_IF([test "x$with_python" != "xno"],
435   [AM_PATH_PYTHON(2.3.5)
436    AS_IF([test "x$PYTHON_CFLAGS" != "x"],
437      [],
438      [test "x$PYTHON_CONFIG" != "x" && test -x "$PYTHON_CONFIG"],
439      [PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`],
440      [test -x "$PYTHON-config"],
441      [PYTHON_CFLAGS=`$PYTHON-config --cflags`],
442      [PYTHON_CFLAGS=`$PYTHON -c 'import distutils.sysconfig as s; print " ".join(s.get_config_vars("CFLAGS")) + " -I"+s.get_python_inc() + " -I"+s.get_python_inc(plat_specific=True)'`])
443
444 dnl check that #include <Python.h> compiles (bug #3092663)
445    CPPFLAGS_save="$CPPFLAGS"
446    CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
447    AC_CHECK_HEADER([Python.h], [], [AC_MSG_ERROR([dnl
448 Python module enabled, but unable to compile Python.h.
449 Install the development package for python-$am_cv_python_version, or configure
450 --without-python to disable the python bindings.dnl
451 ])])
452    CPPFLAGS="$CPPFLAGS_save"
453
454    AS_IF([test "x$with_gtk" = "xyes"],
455      [PKG_CHECK_MODULES([PYGTK], [pygtk-2.0])
456       AC_CHECK_PROGS([PYGTK_CODEGEN], [pygtk-codegen-2.0 pygtk-codegen], [:])
457       AS_IF([test "x$PYGTK_H2DEF" = "x"],
458         [PYGTK_H2DEF=`$PKG_CONFIG pygtk-2.0 --variable=codegendir`/h2def.py
459          AS_IF([test -f "$PYGTK_H2DEF"], [], [PYGTK_H2DEF=":"])])
460       AS_IF([test "x$PYGTK_DEFS" = "x"],
461         [PYGTK_DEFS=`$PKG_CONFIG pygtk-2.0 --variable=defsdir`])
462    ])
463 ])
464
465 AM_CONDITIONAL([HAVE_PYTHON], [test "x$with_python" = "xyes"])
466
467 dnl Qt
468 AC_ARG_WITH([qt],
469   [AS_HELP_STRING([--without-qt],
470     [disable support for Qt4 widget])],
471   [],
472   [with_qt="yes"])
473
474 AC_ARG_VAR([MOC], [full path to Qt moc program])
475
476 AS_IF([test "x$with_qt" != "xno"],
477   [PKG_CHECK_MODULES([QT], [QtCore >= 4 QtGui >= 4])
478    MOC=`$PKG_CONFIG QtGui --variable=moc_location`
479    AC_MSG_NOTICE([using moc from $MOC])
480    QT_VERSION=`$PKG_CONFIG QtGui --modversion`
481    AC_MSG_NOTICE([using Qt version $QT_VERSION])])
482
483 AM_CONDITIONAL([HAVE_QT], [test "x$with_qt" = "xyes"])
484
485 dnl Java
486 AC_ARG_WITH([java],
487   [AS_HELP_STRING([--without-java],
488     [disable support for Java interface])],
489   [],
490   [with_java="check"])
491
492 AC_ARG_VAR([JAVA_CFLAGS], [compiler flags for building JNI extensions])
493 AS_IF([test "x$JAVA_CFLAGS" = "x" && test "x$JAVA_HOME" != "x"],
494   [JAVA_CFLAGS="-I$JAVA_HOME/include"])
495
496 AS_IF([test "x$with_java" != "xno"],
497   [CPPFLAGS_save="$CPPFLAGS"
498    CPPFLAGS="$CPPFLAGS $JAVA_CFLAGS"
499    AC_CHECK_HEADER([jni.h], [], [have_java="no"])
500    CPPFLAGS="$CPPFLAGS_save"
501    AS_IF([test "x$have_java" != "xno"],
502      [with_java="yes"],
503      [test "x$with_java" = "xyes"],
504      [AC_MSG_FAILURE([unable to find Java JNI! ensure CFLAGS are set
505 appropriately or configure --without-java])],
506      [with_java="no"])
507 ])
508 AM_CONDITIONAL([HAVE_JAVA], [test "x$with_java" = "xyes"])
509
510
511 dnl header files
512
513 dnl FIXME switches for shm, mmap
514 AC_HEADER_ASSERT
515 AC_CHECK_HEADERS([errno.h fcntl.h features.h inttypes.h stdlib.h string.h \
516   unistd.h sys/types.h sys/stat.h sys/ioctl.h sys/time.h sys/times.h \
517   sys/ipc.h sys/shm.h sys/mman.h])
518
519 dnl types
520
521 AC_TYPE_INT32_T
522 AC_TYPE_UINT32_T
523 AC_TYPE_UINT8_T
524 AC_TYPE_UINTPTR_T
525
526 dnl compile characteristics
527
528 AC_C_CONST
529 AC_C_INLINE
530
531 dnl functions
532
533 AC_FUNC_MMAP
534 AC_CHECK_FUNCS([memset atexit setenv])
535
536 dnl output generation
537
538 dnl avoid doc rebuilds unless revision info changes
539 AC_CONFIG_COMMANDS([doc/version.xml],
540   [AS_IF([test -f doc/version.xml && \
541           ! echo $VERSION | diff doc/version.xml - >/dev/null 2>&1 || \
542           ! echo $VERSION | diff $srcdir/doc/version.xml - >/dev/null 2>&1 ],
543     [echo "writing new doc/version.xml" ; echo $VERSION > doc/version.xml ])],
544   [VERSION="$VERSION"]
545 )
546 AC_CONFIG_COMMANDS([doc/reldate.xml],
547   [AS_IF([test -f doc/reldate.xml && \
548           ! echo $RELDATE | diff doc/reldate.xml - >/dev/null 2>&1 || \
549           ! echo $RELDATE | diff $srcdir/doc/reldate.xml - >/dev/null 2>&1 ],
550     [echo "writing new doc/reldate.xml" ; echo $RELDATE > doc/reldate.xml ])],
551   [RELDATE="$RELDATE"]
552 )
553
554 AC_CONFIG_FILES([
555 Makefile
556 zbar.pc
557 zbar-gtk.pc
558 zbar-qt.pc
559 ])
560 AC_OUTPUT
561
562 dnl summary log
563
564 echo ""
565 echo "please verify that the detected configuration matches your expectations:"
566 echo "------------------------------------------------------------------------"
567 echo "X                 --with-x=$have_x"
568 echo "pthreads          --enable-pthread=$enable_pthread"
569 echo "v4l               --enable-video=$enable_video"
570 AS_IF([test "x$enable_video" != "xyes"],
571   [echo "        => zbarcam video scanner will *NOT* be built"])
572 echo "jpeg              --with-jpeg=$with_jpeg"
573 AS_IF([test "x$with_jpeg" != "xyes"],
574   [echo "        => JPEG image conversions will *NOT* be supported"])
575 AS_IF([test "x$have_GM" = "xyes"],
576   [echo "GraphicsMagick    --with-graphicsmagick=yes"],
577   [echo "ImageMagick       --with-imagemagick=$with_imagemagick"])
578 AS_IF([test "x$have_IM" != "xyes" && test "x$have_GM" != "xyes"],
579   [echo "        => the zbarimg file scanner will *NOT* be built"])
580 echo "Python            --with-python=$with_python"
581 echo "GTK+              --with-gtk=$with_gtk"
582 AS_IF([test "x$with_gtk" != "xyes"],
583   [echo "        => the GTK+ widget will *NOT* be built"],
584   [AS_IF([test "x$with_python" != "xyes"],
585      [echo "        => the PyGTK widget wrapper will *NOT* be built"])])
586 echo "Qt4               --with-qt=$with_qt"
587 AS_IF([test "x$with_qt" != "xyes"],
588   [echo "        => the Qt4 widget will *NOT* be built"])
589 echo "Java              --with-java=$with_java"
590 AS_IF([test "x$with_java" != "xyes"],
591   [echo "        => the Java interface will *NOT* be built"])
592 #echo "NPAPI Plugin     --with-npapi=$with_npapi"
593 #AS_IF([test "x$with_mozilla" != "xyes"],
594 #  [echo "       => the Mozilla/Firefox/OpenOffice plugin will *NOT* be built"])
595 echo ""