forked from mchehab/zbar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
934 lines (802 loc) · 33.1 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
changecom()dnl
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT([zbar], [0.23.92], [[email protected]])
m4_ifndef([AC_LANG_DEFINES_PROVIDED],
[m4_define([AC_LANG_DEFINES_PROVIDED])])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AM_INIT_AUTOMAKE([1.13 -Werror foreign subdir-objects std-options dist-bzip2])
m4_pattern_allow([AM_PROG_AR])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_SRCDIR(zbar/scanner.c)
LT_PREREQ([2.2])
LT_INIT([dlopen win32-dll])
LT_LANG([Windows Resource])
AM_SILENT_RULES([yes])
dnl update these just before each release (along w/package version above)
dnl LIB_VERSION update instructions copied from libtool docs:
dnl library version follows the form current:revision:age
dnl - If the library source code has changed at all since the last update,
dnl then increment revision (c:r:a becomes c:r+1:a).
dnl - If any interfaces have been added, removed, or changed,
dnl increment current, and set revision to 0.
dnl - If any interfaces have been added since the last public release,
dnl then increment age.
dnl - If any interfaces have been removed since the last public release,
dnl then set age to 0.
AC_SUBST([LIB_VERSION], [3:0:3])
AC_SUBST([RELDATE], [2017-04-11])
dnl widget libraries use their own versioning.
dnl NB pygtk wrapper is *unversioned*
AC_SUBST([ZGTK_LIB_VERSION], [0:2:0])
AC_SUBST([ZQT_LIB_VERSION], [1:2:1])
AC_DEFINE_UNQUOTED([ZBAR_VERSION_MAJOR],
[[`echo "$PACKAGE_VERSION" | sed -e 's/\..*$//'`]],
[Program major version (before the '.') as a number])
AC_DEFINE_UNQUOTED([ZBAR_VERSION_MINOR],
[[`echo "$PACKAGE_VERSION" | sed -e 's/^[^\.]*\.\([^\.]*\).*/\1/'`]],
[Program minor version (after '.') as a number])
AC_DEFINE_UNQUOTED([ZBAR_VERSION_PATCH],
[[`echo "$PACKAGE_VERSION" | sed -e 's/^[^\.]*\.[^\.]*\.*//' | sed s,^$,0,`]],
[Program patch version (after the second '.') as a number])
cur=`echo "$LIB_VERSION" | sed -e 's/:.*$//'`
age=`echo "$LIB_VERSION" | sed -e 's/^.*://'`
AC_DEFINE_UNQUOTED([LIB_VERSION_MAJOR], [[$(( $cur - $age ))]],
[Library major version])
AC_DEFINE_UNQUOTED([LIB_VERSION_MINOR], [[$age]],
[Library minor version])
AC_DEFINE_UNQUOTED([LIB_VERSION_REVISION],
[[`echo "$LIB_VERSION" | sed -e 's/^[^:]*:\([^:]*\):.*$/\1/'`]],
[Library revision])
AM_CPPFLAGS="-I\$(top_srcdir)/include"
AM_CFLAGS="-Wall -Wno-parentheses"
AM_CXXFLAGS="$AM_CFLAGS"
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
dnl windows build
AC_CANONICAL_HOST
case $host_os in
*cygwin* | *mingw* | *uwin* | *djgpp* | *ems* )
win32="yes"
with_dbus="no"
AC_DEFINE([_WIN32_WINNT], [0x0500], [Minimum Windows API version])
AC_FUNC_ALLOCA
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FSEEKO
AC_CHECK_HEADERS([arpa/inet.h malloc.h mntent.h netdb.h netinet/in.h shadow.h sys/file.h sys/mount.h sys/param.h sys/socket.h sys/statfs.h sys/statvfs.h sys/vfs.h unistd.h values.h])
;;
* )
win32="no"
;;
esac
AM_CONDITIONAL([WIN32], [test "x$win32" = "xyes"])
dnl programs
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CC_STDC
PKG_PROG_PKG_CONFIG
dnl symbologies
AC_ARG_ENABLE([codes],
[AS_HELP_STRING([--enable-codes=SYMS],
[select symbologies to compile [default=ean,databar,code128,code93,code39,codabar,i25,qrcode,sqcode]])],
[],
[enable_codes="ean,databar,code128,code93,code39,codabar,i25,qrcode,sqcode"])
AC_DEFUN([AC_DEFINE_SUBST],
[AC_DEFINE($1,$2,$3)
AC_SUBST($1,$2)])
AC_DEFUN([ZBAR_CHK_CODE], [
AC_MSG_CHECKING([whether to build $2])
enable_$1="no"
AH_TEMPLATE([ENABLE_]translit($1, a-z, A-Z),
[whether to build support for $2])
AS_CASE([$enable_codes],
[*$1* | *all*],
[enable_$1="yes"
enabled_codes="$enabled_codes $1"
AC_DEFINE_SUBST([ENABLE_]translit($1, a-z, A-Z), [1])
], [
disabled_codes="$disabled_codes $1"
AC_DEFINE_SUBST([ENABLE_]translit($1, a-z, A-Z), [0])
])
AM_CONDITIONAL([ENABLE_]translit($1, a-z, A-Z),
[test "x$enable_$1" = "xyes"])
AC_MSG_RESULT([$enable_$1])
])dnl
ZBAR_CHK_CODE([ean], [EAN symbologies])
ZBAR_CHK_CODE([databar], [DataBar symbology])
ZBAR_CHK_CODE([code128], [Code 128 symbology])
ZBAR_CHK_CODE([code93], [Code 93 symbology])
ZBAR_CHK_CODE([code39], [Code 39 symbology])
ZBAR_CHK_CODE([codabar], [Codabar symbology])
ZBAR_CHK_CODE([i25], [Interleaved 2 of 5 symbology])
ZBAR_CHK_CODE([qrcode], [QR Code])
ZBAR_CHK_CODE([sqcode], [SQ Code])
ZBAR_CHK_CODE([pdf417], [PDF417 symbology (incomplete)])
dnl libraries
AC_SEARCH_LIBS([clock_gettime], [rt pthread])
AM_ICONV()
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.20)
AM_GNU_GETTEXT_REQUIRE_VERSION(0.18)
AM_CONDITIONAL([USE_NLS], [test "x${USE_NLS}" = "xyes"])
dnl libraries linkage
AC_ARG_ENABLE([static_qt],
[AS_HELP_STRING([--enable-static-qt],
[Produce a static library for libzbarcam-qt])])
AS_IF([test x$enable_static_qt = xyes], [AC_SUBST([LIBQT_EXTRA_LDFLAGS], ["-static"])])
dnl poll support
AC_CHECK_HEADERS([poll.h], [have_poll="yes"], [have_poll="no"])
AM_CONDITIONAL([HAVE_POLL], [test "x$have_poll" = "xyes"])
dnl pthreads
dnl FIXME this doesn't port well, integrate something like this:
dnl http://autoconf-archive.cryp.to/acx_pthread.html
AC_ARG_ENABLE([pthread],
[AS_HELP_STRING([--disable-pthread],
[omit support for threaded applications])],
[],
[AS_IF([test "x$win32" = "xno"],
[enable_pthread="yes"],
[enable_pthread="no"
])])
AS_IF([test "x$enable_pthread" != "xno"],
[AC_CHECK_HEADERS([pthread.h], [],
[AC_MSG_FAILURE([test for pthread support failed!
configure --disable-pthread to skip threaded support.])])
AC_CHECK_LIB([pthread], [pthread_create], [],
[AC_MSG_FAILURE([unable to link against -lpthread, although you
appear to have pthread.h? set LDFLAGS and/or LIBS to help the linker,
or configure --disable-pthread to skip threaded support.])])
AC_DEFINE([__USE_UNIX98], [1], [used only for pthread debug attributes])
])
dnl doc
AC_ARG_ENABLE([doc],
[AS_HELP_STRING([--disable-doc],
[disable building docs])],
[],
[enable_doc="yes"])
AS_IF([test "x$enable_doc" != "xno"],
[AC_ARG_VAR([XMLTO], [location of xmlto, used for optional documentation generation])
AC_ARG_VAR([XMLTOFLAGS], [additional arguments for xmlto])
AC_CHECK_PROGS([XMLTO], [xmlto])])
AS_IF([test "x$XMLTO" = "x"], enable_doc="no")
AM_CONDITIONAL([HAVE_DOC], [test "x$enable_doc" != "xno"])
dnl video
AC_ARG_ENABLE([video],
[AS_HELP_STRING([--disable-video],
[exclude video scanner features])],
[],
[enable_video="yes"])
dnl video, directshow
AC_ARG_WITH([directshow],
[AS_HELP_STRING([--with-directshow],
[compile directshow driver on windows instead of vfw,
available only when video support is enabled])],
[],
[with_directshow="no"])
have_v4l1="no"
have_v4l2="no"
have_libv4l="no"
AS_IF([test "x$enable_video" = "xno"],
[],
[test "x$win32" = "xno"],
[AC_CHECK_HEADERS([linux/videodev.h], [have_v4l1="yes"])
AC_CHECK_HEADERS([linux/videodev2.h], [have_v4l2="yes"])
AC_CHECK_HEADERS([libv4l2.h], [have_libv4l="yes"])
AS_IF([test "x$have_v4l2" = "xno" && test "x$have_v4l1" = "xno"],
[AC_MSG_FAILURE([test for video support failed!
rebuild your kernel to include video4linux support or
configure --disable-video to skip building video support.])],
[AS_IF([test "x$have_v4l2" = "xno"],
[AC_MSG_WARN([v4l2 API not detected, upgrade your kernel!])])]
)],
[AS_IF([test "x$with_directshow" != "xno"],
[with_video="directshow"],
[AC_CHECK_HEADERS([vfw.h], [with_video="vfw"],
[AC_MSG_FAILURE([test for VfW video support failed!
configure --disable-video to skip building video support.])],[#include <windows.h>])])])
AS_IF([test "x$have_libv4l" = "xyes"],
[PKG_CHECK_MODULES([V4L2], [libv4l2], [],
[AC_MSG_FAILURE([unable to find libv4l2.so])])],
[AC_MSG_WARN([libv4l not detected. Install it to support more cameras!])])
AM_CONDITIONAL([HAVE_VIDEO], [test "x$enable_video" != "xno"])
AM_CONDITIONAL([HAVE_V4L1], [test "x$have_v4l1" != "xno"])
AM_CONDITIONAL([HAVE_V4L2], [test "x$have_v4l2" != "xno"])
AM_CONDITIONAL([HAVE_LIBV4L], [test "x$have_libv4l" != "xno"])
AM_CONDITIONAL([WITH_DIRECTSHOW], [test "x$with_directshow" != "xno"])
dnl X
AC_ARG_VAR([XSHM_LIBS], [linker flags for X shared memory extension])
AS_IF([test "x$win32" != "xno"],
[have_x="no"],
[AC_PATH_XTRA
AH_BOTTOM([#ifndef X_DISPLAY_MISSING
# define HAVE_X
#endif
])])
AM_CONDITIONAL([HAVE_X], [test "x$have_x" = "xyes"])
AS_IF([test "x$XSHM_LIBS" = "x"], [XSHM_LIBS="-lXext"])
AC_ARG_WITH([xshm],
[AS_HELP_STRING([--without-xshm],
[disable support for X shared memory extension])],
[],
[with_xshm="check"])
AS_IF([test "x$with_xshm" != "xno"],
[AC_CHECK_HEADERS([X11/extensions/XShm.h],
[with_xshm="yes"],
[AS_IF([test "x$with_xshm" = "xcheck"],
[with_xshm="no"],
[AC_MSG_FAILURE([test for X shared memory extension failed!
install the X shared memory extension, specify --x-includes or
configure --without-xshm to disable the extension])])],
[[#include <X11/Xlib.h>
#include <sys/ipc.h>
#include <sys/shm.h>
]])
AS_IF([test "x$with_xshm" != "xno"],
[AC_CHECK_LIB([Xext], [XShmQueryVersion],
[with_xshm="yes"],
[AC_MSG_FAILURE([unable to find XShmQueryVersion in $XSHM_LIBS!
specify XSHM_LIBS or configure --without-xshm to disable the extension])],
["$X_LIBS" "$X_PRE_LIBS" -lX11 "$X_EXTRA_LIBS" "$XSHM_LIBS"])
])
])
AM_CONDITIONAL([HAVE_XSHM], [test "x$with_xshm" = "xyes"])
AC_ARG_VAR([XV_LIBS], [linker flags for XVideo extension])
AS_IF([test "x$XV_LIBS" = "x"], [XV_LIBS="-lXv"])
AC_ARG_WITH([xv],
[AS_HELP_STRING([--without-xv],
[disable support for XVideo extension])],
[],
[with_xv="check"])
AS_IF([test "x$with_xv" != "xno"],
[AC_CHECK_HEADERS([X11/extensions/Xvlib.h],
[with_xv="yes"],
[AS_IF([test "x$with_xv" = "xcheck"],
[with_xv="no"],
[AC_MSG_FAILURE([test for XVideo extension failed!
install the XVideo extension, specify --x-includes or
configure --without-xv to disable the extension])])],
[[#include <X11/Xlib.h>
]])
AS_IF([test "x$with_xv" != "xno"],
[AC_CHECK_LIB([Xv], [XvQueryExtension],
[with_xv="yes"],
[AC_MSG_FAILURE([unable to find XvQueryExtension in $XV_LIBS!
specify XV_LIBS or configure --without-xv to disable the extension])],
["$X_LIBS" "$X_PRE_LIBS" -lX11 "$X_EXTRA_LIBS" "$XV_LIBS"])
])
])
AM_CONDITIONAL([HAVE_XV], [test "x$with_xv" = "xyes"])
dnl dbus
AC_ARG_WITH([dbus],
[AS_HELP_STRING([--without-dbus],
[disable support for dbus])],
[],
[with_dbus="check"])
AS_IF([test "x$with_dbus" != "xno"],
[PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, have_dbus="yes", have_dbus="no")
AS_IF([test "x$have_dbus$with_dbus" = "xnoyes"],
[AC_MSG_FAILURE([DBus development libraries not found])],
[with_dbus="$have_dbus"])
])
AM_CONDITIONAL([HAVE_DBUS], [test "x$with_dbus" = "xyes"])
AS_IF([test "x$with_dbus" = "xyes"],
[CPPFLAGS="$CPPFLAGS $DBUS_CFLAGS"
AC_ARG_VAR([DBUS_LIBS], [linker flags for building dbus])
AC_DEFINE([HAVE_DBUS], [1], [Define to 1 to use dbus])
AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
[path to D-Bus config directory]),
[path_dbusconf=$withval],
[path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
AS_IF([test -z "$path_dbusconf"],
DBUS_CONFDIR="$sysconfdir/dbus-1/system.d",
DBUS_CONFDIR="$path_dbusconf/dbus-1/system.d")
AC_SUBST(DBUS_CONFDIR)
])
dnl libjpeg
AC_ARG_WITH([jpeg],
[AS_HELP_STRING([--without-jpeg],
[disable support for JPEG image conversions])],
[],
[with_jpeg="check"])
have_jpeg="maybe"
AS_IF([test "x$with_jpeg" != "xno"],
[AC_CHECK_HEADERS([jpeglib.h jerror.h], [], [have_jpeg="no"])
AC_CHECK_LIB([jpeg], [jpeg_read_header], [], [have_jpeg="no"])
AS_IF([test "x$have_jpeg" != "xno"],
[with_jpeg="yes"],
[test "x$with_jpeg" = "xyes"],
[AC_MSG_FAILURE([unable to find libjpeg! ensure CFLAGS/LDFLAGS are
set appropriately or configure --without-jpeg])],
[with_jpeg="no"])
])
AM_CONDITIONAL([HAVE_JPEG], [test "x$with_jpeg" = "xyes"])
dnl ImageMagick or GraphicsMagick
dnl disable both if IM is explicitly disabled to preserve old behavior
AC_ARG_WITH([imagemagick],
[AS_HELP_STRING([--without-imagemagick],
[disable support for scanning images with ImageMagick])],
[],
[with_imagemagick="check"])
AC_ARG_WITH([graphicsmagick],
[AS_HELP_STRING([--with-graphicsmagick],
[use GraphicsMagick alternative to ImageMagick])],
[],
[with_graphicsmagick="check"])
magick="UnknownMagick"
have_IM="maybe"
AS_IF([test "x$with_imagemagick" = "xno"], [],
[test "x$with_imagemagick" = "xyes" || \
test "x$with_graphicsmagick" != "xyes"],
[looked_for="ImageMagick >= 6.2.6"
PKG_CHECK_MODULES([MAGICK], [MagickWand >= 6.2.6],
[MAGICK_VERSION=`$PKG_CONFIG MagickWand --modversion`],
[dnl
dnl Wand is deprecated in favor of MagickWand,
dnl but the latter doesn't exist in older versions (bug #2848437)
saved_error=$MAGICK_PKG_ERRORS
PKG_CHECK_MODULES([MAGICK], [Wand >= 6.2.6],
[MAGICK_VERSION=`$PKG_CONFIG Wand --modversion`],
[have_IM="no"])])
AS_IF([test "x$have_IM" != "xno"],
[magick="ImageMagick"
AC_MSG_NOTICE([trying ImageMagick version $MAGICK_VERSION])
dnl double check ImageMagick install (bug #2582232)
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $MAGICK_CFLAGS"
AC_CHECK_HEADERS([wand/MagickWand.h],
[
have_IM="yes"
with_imagemagick="yes"
],
[have_IM="broken"])
dnl check for ImageMagick 7, see https://imagemagick.org/script/porting.php#headers
AS_IF([test "x$have_IM" = "xbroken"], [
AC_CHECK_HEADERS([MagickWand/MagickWand.h],
[
have_IM="yes"
have_IM7="yes"
with_imagemagick="yes"
],
[have_IM="broken"])
])
CPPFLAGS="$CPPFLAGS_save"])])
have_GM="maybe"
AS_IF([test "x$have_IM" = "xyes"], [],
[test "x$with_graphicsmagick" = "xno"], [],
[test "x$with_graphicsmagick" = "xyes" || \
test "x$with_imagemagick" = "xcheck"],
[AS_IF([test "x$looked_for" = "x"],
[looked_for="GraphicsMagick"],
[looked_for="$looked_for or GraphicsMagick"])
PKG_CHECK_MODULES([GM], [GraphicsMagickWand],
[have_GM="yes"
with_imagemagick="no"
magick="GraphicsMagick"
MAGICK_CFLAGS="$MAGICK_CFLAGS $GM_CFLAGS"
MAGICK_LIBS="$MAGICK_LIBS $GM_LIBS"
MAGICK_VERSION=`$PKG_CONFIG GraphicsMagickWand --modversion`],
[have_GM="no"
AS_IF([test "x$saved_error" = "x"],
[saved_error=$MAGICK_PKG_ERRORS])])])
dnl now that we have collected all the info abt what Magick is available
dnl let the user know what we will or can't do
AS_IF([test "x$have_IM" = "xbroken" && test "x$have_GM" = "xyes"],
[
with_imagemagick="no"
AC_MSG_WARN([Your ImageMagick install is broken, using GraphicsMagick instead])
])
AS_IF([test "x$have_IM" = "xyes" || test "x$have_GM" = "xyes"],
[AC_MSG_NOTICE([using $magick version $MAGICK_VERSION])],
[test "x$with_imagemagick" = "xno" && \
test "x$with_graphicsmagick" != "xyes"],
[AC_MSG_NOTICE([image scanning disabled -- zbarimg will *not* be built])],
[test "x$have_IM" = "xbroken"],
[AC_MSG_FAILURE([$magick package found but wand/MagickWand.h not installed?!
this is a problem with your $magick install, please try again after
resolving the inconsistency or installing GraphicsMagick alternative...])],
[test "x$with_graphicsmagick" = "xcheck"],
[AC_MSG_NOTICE([ImageMagick/GraphicsMagick not detected. Several features will be disabled])
with_imagemagick="no"],
[AC_MSG_FAILURE([dnl
Unable to find $looked_for:
$saved_error
* Ensure that you installed any "development" packages for ImageMagick or
GraphicsMagick.
* Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
* You may set the environment variables MAGICK_CFLAGS and MAGICK_LIBS
to avoid the need to call pkg-config.
See the pkg-config man page for more details.
* To avoid using ImageMagick or GraphicsMagick altogether you may add the
--without-imagemagick flag to the configure command; the zbarimg program
will *not* be built.
])])
AS_IF([test "x$have_IM" = "xyes"],
[AC_DEFINE([HAVE_IMAGEMAGICK], [1], [Define to 1 to use ImageMagick])],
[test "x$have_GM" = "xyes"],
[AC_DEFINE([HAVE_GRAPHICSMAGICK], [1], [Define to 1 to use GraphicsMagick])])
AS_IF([test "x$have_IM7" = "xyes"],
[AC_DEFINE([HAVE_IMAGEMAGICK7], [1], [Define to 1 to use ImageMagick 7])])
AM_CONDITIONAL([HAVE_MAGICK],
[test "x$have_IM" = "xyes" || test "x$have_GM" = "xyes"])
dnl Mozilla NPAPI
AC_ARG_WITH([npapi],
[AS_HELP_STRING([--with-npapi],
[enable support for Firefox/Mozilla/OpenOffice plugin])],
[],
[with_npapi="no"])
AS_IF([test "x$with_npapi" != "xno"],
[PKG_CHECK_MODULES([NPAPI], [firefox-plugin])
NPAPI_VERSION=`$PKG_CONFIG firefox-plugin --modversion`
AC_MSG_NOTICE([using firefox-plugin version $NPAPI_VERSION])])
AM_CONDITIONAL([HAVE_NPAPI], [test "x$with_npapi" = "xyes"])
dnl GTK
dnl For now, defaults to GTK version 3
AC_ARG_WITH([gtk],
[AS_HELP_STRING([--with-gtk],
[Specify support for GTK. Valid values are: no, auto, gtk2, gtk3 (default is auto)])],
[AS_IF([test "x$with_gtk" != "xno" && test "x$with_gtk" != "xauto" &&
test "x$with_gtk" != "xgtk2" && test "x$with_gtk" != "xgtk3"],
[echo "Invalid value for --with-gtk. Falling back to 'no'"
with_gtk="no"])],
[with_gtk="auto"])
AC_ARG_VAR([GLIB_GENMARSHAL], [full path to glib-genmarshal])
AC_ARG_VAR([GTK_VERSION_MAJOR])
AS_IF([test "x$with_gtk" = "xgtk3" || test "x$with_gtk" = "xauto"],
[PKG_CHECK_MODULES([GTK3], [gtk+-3.0],
[GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal`
GTK_VERSION=`$PKG_CONFIG gtk+-3.0 --modversion`
AC_MSG_NOTICE([using GTK+ version $GTK_VERSION])
GTK_VERSION_MAJOR=3.0
with_gtk="gtk3"
GTK_CFLAGS=$GTK3_CFLAGS
GTK_LIBS=$GTK3_LIBS
],[libgtk3=false])
])
AS_IF([test "x$with_gtk" = "xgtk2" || test "x$with_gtk" = "xauto"],
[PKG_CHECK_MODULES([GTK2], [gtk+-2.0],
[GLIB_GENMARSHAL=`$PKG_CONFIG glib-2.0 --variable=glib_genmarshal`
GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
AC_MSG_NOTICE([using GTK+ version $GTK_VERSION])
GTK_VERSION_MAJOR=2.0
with_gtk="gtk2"
GTK_CFLAGS=$GTK2_CFLAGS
GTK_LIBS=$GTK2_LIBS
],[libgtk2=false])
])
dnl GTK not found
AS_IF([test "x$with_gtk" = "xauto"], [with_gtk="no"])
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)
AM_CONDITIONAL([HAVE_GTK], [test "x$with_gtk" != "xno"])
AC_ARG_WITH([gir],
[AS_HELP_STRING([--with-gir], [enable support for GObject Introspection])],
[],
[with_gir="yes"])
dnl Python
dnl For now, keep python2 as default
dnl If both PYTHON and --with-python=foo are defined, PYTHON takes precedence
AC_ARG_WITH([python],
[AS_HELP_STRING([--with-python],
[Specify support for Python. Valid values are: no, auto, python2, python3
(default is auto).
Please notice that PYTHON var, if especified, takes precedence.])],
[AS_IF([test "x$with_python" != "xno" && test "x$with_python" != "xauto" &&
test "x$with_python" != "xpython2" && test "x$with_python" != "xpython3"],
[echo "Invalid value for --with-python. Falling back to 'no'"
with_python="xno"])],
[with_python="auto"])
AC_ARG_VAR([PYTHON_CONFIG], [full path to python-config program])
AC_ARG_VAR([PYTHON_CFLAGS], [compiler flags for building python extensions])
AC_ARG_VAR([PYTHON_LDFLAGS], [linker flags for building python extensions])
AC_ARG_VAR([PYGTK_H2DEF], [full path to PyGTK h2def.py module (python2 only)])
AC_ARG_VAR([PYGTK_CODEGEN], [full path to pygtk-codegen program (python2 only)])
AC_ARG_VAR([PYGTK_DEFS], [directory where PyGTK definitions may be found (python2 only)])
AS_IF([test -z "$PYTHON"],
[AS_IF([test "x$with_python" = "xauto"],
[AC_PATH_PROGS([PYTHON], [python3 python2 python], [:], [$PATH])],
[AS_IF([test "x$with_python" = "xpython3"],
[AC_PATH_PROGS([PYTHON], [python3 python], [:], [$PATH])],
[AS_IF([test "x$with_python" = "xpython2"],
[AC_PATH_PROGS([PYTHON], [python2 python], [:], [$PATH])],
[with_python="no"])
])
]
)],
[with_python="auto"]
)
AS_IF([test "x$with_python" != "xno"],
[AM_PATH_PYTHON([2.7.0])])
AS_IF([test "x$PYTHON_VERSION" != "x" && test "x$with_python" != "xno"],
[PYTHON_VERSION_MAJOR="`echo $PYTHON_VERSION | cut -d'.' -f 1`"
AS_IF([test "x$PYTHON_CFLAGS" != "x"],
[],
[test "x$PYTHON_CONFIG" != "x" && test -x "$PYTHON_CONFIG"],
[PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`],
[test -x "$PYTHON-config"],
[PYTHON_CFLAGS=`$PYTHON-config --cflags`],
[PYTHON_CFLAGS=`$PYTHON -c 'import distutils.sysconfig as s, sys; sys.stdout.write(" ".join(s.get_config_vars("CFLAGS")) + " -I"+s.get_python_inc() + " -I"+s.get_python_inc(plat_specific=True))'`])
AS_IF([test "x$PYTHON_LDFLAGS" != "x"],
[],
[test "x$PYTHON_CONFIG" != "x" && test -x "$PYTHON_CONFIG"],
[PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`],
[test -x "$PYTHON-config"],
[PYTHON_LDFLAGS=`$PYTHON-config --ldflags`],
[PYTHON_LDFLAGS=`$PYTHON -c 'import distutils.sysconfig as s, sys; sys.stdout.write(" ".join(s.get_config_vars("LDFLAGS")) + " -I"+s.get_python_inc() + " -I"+s.get_python_inc(plat_specific=True))'`])
dnl check that #include <Python.h> compiles (bug #3092663)
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
AS_IF([test "x$win32" = "xyes"], PYTHON_LDFLAGS="$PYTHON_LDFLAGS -no-undefined")
AC_CHECK_HEADERS([Python.h], [],
[AS_IF([test "x$with_python" = "xauto"],with_python="no",
[AC_MSG_ERROR([dnl
Python module enabled, but unable to compile Python.h.
Install the development package for python-$am_cv_python_version, or configure
--without-python to disable the python bindings.dnl
])])])
CPPFLAGS="$CPPFLAGS_save"
dnl PyGTK
dnl disable pygtk when we're on Python 3
AS_IF([test "x$with_gtk" != "xno"],
[AS_IF([test "x$PYTHON_VERSION_MAJOR" = "x2"],
[PKG_CHECK_MODULES([PYGTK], [pygtk-2.0], [with_pygtk2="yes"], [with_pygtk2="no"])
AC_CHECK_PROGS([PYGTK_CODEGEN], [pygobject-codegen-2.0 pygtk-codegen-2.0 pygtk-codegen], [:])
AS_IF([test "x$PYGTK_H2DEF" = "x"],
[PYGTK_H2DEF=`$PKG_CONFIG pygtk-2.0 --variable=codegendir`/h2def.py
AS_IF([test -f "$PYGTK_H2DEF"], [], [PYGTK_H2DEF=":"])])
AS_IF([test "x$PYGTK_DEFS" = "x"],
[PYGTK_DEFS=`$PKG_CONFIG pygtk-2.0 --variable=defsdir`])
])
])
], [with_python="no"])
AS_IF([test "x$PYTHON_VERSION_MAJOR" != "x2"], [with_pygtk2="no"])
AM_CONDITIONAL([HAVE_PYTHON], [test "x$with_python" != "xno"])
AM_CONDITIONAL([HAVE_PYGTK2], [test "x$with_pygtk2" != "xno"])
dnl GObject Introspection (GIR)
AS_IF([test "x$with_gir" = "xyes" && test "x$with_gtk" != "xno"],
[m4_ifdef([GOBJECT_INTROSPECTION_CHECK],
[GOBJECT_INTROSPECTION_CHECK([0.6.7])
AS_IF([test "x$found_introspection" = "xyes"],
[INTROSPECTION_TYPELIBDIR=`$PKG_CONFIG --variable=typelibdir --define-variable="libdir=${libdir}" gobject-introspection-1.0`
INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir --define-variable="datadir=${datadir}" gobject-introspection-1.0`
AC_SUBST(INTROSPECTION_TYPELIBDIR)
AC_SUBST(INTROSPECTION_GIRDIR)])])
])
AS_IF([test "x$found_introspection" != "xyes"], [with_gir="no"])
AM_CONDITIONAL([HAVE_INTROSPECTION], [test "x$with_gir" = "xyes"])
dnl Qt
AC_ARG_WITH([qt],
[AS_HELP_STRING([--without-qt],
[disable support for Qt widget])],
[],
[with_qt="yes"])
dnl Qt5
AC_ARG_WITH([qt5],
[AS_HELP_STRING([--without-qt5],
[disable support for Qt5 widget. if --with-qt, it will seek only for Qt4])],
[],
[with_qt5="yes"])
AC_ARG_VAR([MOC], [full path to Qt moc program])
AS_IF([test "x$have_x" = "xyes"],
[qt_extra="Qt5X11Extras >= 5.0"],
[qt_extra=""])
AS_IF([test "x$with_qt" != "xno"],
[PKG_CHECK_MODULES([QT],
[Qt5Core >= 5 Qt5Gui >= 5 Qt5Widgets >= 5.0 $qt_extra],,
[with_qt5="no"
PKG_CHECK_MODULES([QT],
[QtCore >= 4 QtGui >= 4],,
[with_qt="no"])])])
AS_IF([test "x$with_qt" != "xno"],
[AS_IF([test "x$with_qt5" != "xno"],
[AC_CHECK_PROGS(MOC, [moc-qt5 moc])
AC_MSG_NOTICE([using moc from $MOC])
QT_VERSION=`$PKG_CONFIG Qt5Gui --modversion`
CPPFLAGS="$CPPFLAGS $QT_CPPFLAGS"
dnl -fPIC has no effect on Windows and breaks windres
AS_IF([test "x$win32" = "xno"], [CPPFLAGS="$CPPFLAGS -fPIC"])
AC_MSG_NOTICE([using Qt version $QT_VERSION])
qt_pkgconfig_file="zbar-qt5.pc"
],
[MOC=`$PKG_CONFIG QtGui --variable=moc_location`
AC_MSG_NOTICE([using moc from $MOC])
QT_VERSION=`$PKG_CONFIG QtGui --modversion`
AC_MSG_NOTICE([using Qt version $QT_VERSION])
qt_pkgconfig_file="zbar-qt.pc"
])])
AM_CONDITIONAL([HAVE_QT], [test "x$with_qt" = "xyes"])
AM_COND_IF([HAVE_QT],
[AC_CONFIG_FILES([zbar-qt.pc:"${qt_pkgconfig_file}.in"])]
)
dnl Java
have_java="maybe"
AC_ARG_VAR([JAVA_HOME], [root location of JDK])
AC_ARG_VAR([JAVAC], [location of Java language compiler])
AC_ARG_VAR([JAVAH], [location of Java header generator])
dnl If $JAVA_HOME not defined, try to autodetect it
AS_IF([test -z "$JAVA_HOME"],
[AC_PATH_PROGS([JAVAC], [javac jikes ecj gcj], [:], [$PATH])
AS_IF([test ! -z "$JAVAC"],
[JAVA_HOME=$( readlink -f ${JAVAC} | rev | cut -d/ -f3- | rev )])])
dnl If $JAVA_HOME is defined, set JAVA_PATH and JAVAC
AS_IF([test ! -z "$JAVA_HOME"],
[JAVA_PATH="$JAVA_HOME/bin$PATH_SEPARATOR$PATH"
AS_IF([test -z "$JAVAC"],
[AC_PATH_PROGS([JAVAC], [javac jikes ecj gcj], [:], [$JAVA_PATH])])])
AC_ARG_WITH([java],
[AS_HELP_STRING([--without-java],
[disable support for Java interface])],
[],
[with_java="check"])
JAVAC=$(echo $JAVAC |sed 's/ecj/ecj -1.5/')
dnl Javah was obsoleted on Java 8 and removed on Java 11. So, we need to
dnl look strictly at the $JAVA_HOME in order to avoid mixing different versions
AS_IF([test -z "$JAVAH"],
[AC_PATH_PROGS([JAVAH], [javah], [], [$JAVA_HOME/bin])])
AM_CONDITIONAL([HAVE_JAVAH], [test "x$JAVAH" != "x"])
AC_ARG_VAR([JAR], [location of Java archive tool])
AC_PATH_PROGS([JAR], [jar], [:], [$JAVA_PATH])
AS_IF([test "x$JAR" = "x:"], [have_java="no"])
AC_ARG_VAR([JAVA], [location of Java application launcher])
AC_PATH_PROGS([JAVA], [java], [/bin/false], [$JAVA_PATH])
AC_ARG_VAR([CLASSPATH], [Java class path (include JUnit to run java tests)])
AS_IF([test "x$CLASSPATH" = "x"], [CLASSPATH="."])
dnl Search for Java unit test library
AS_IF([test -z "$JUNIT_HOME"],
[JUNIT_HOME="/usr/share/java"])
AS_IF([test -f "$JUNIT_HOME/junit4.jar"],
[JUNIT="$JUNIT_HOME/junit4.jar"],
[AS_IF([test -f "$JUNIT_HOME/junit.jar"],
[JUNIT="$JUNIT_HOME/junit.jar"])])
AS_IF([test "x$JUNIT" != "x"],
[AS_IF([test -f "/usr/share/java/hamcrest/all.jar"],
[CLASSPATH="$JUNIT:/usr/share/java/hamcrest/all.jar:$CLASSPATH"
AC_SUBST(CLASSPATH)
with_java_unit="yes"])],
[AS_IF([test -f "/usr/share/java/hamcrest-all.jar"],
[CLASSPATH="$JUNIT:/usr/share/java/hamcrest-all.jar:$CLASSPATH"
AC_SUBST(CLASSPATH)
with_java_unit="yes"])])
AM_CONDITIONAL([HAVE_JAVA_UNIT], [test "x$with_java_unit" = "xyes"])
AC_ARG_VAR([JAVA_CFLAGS], [compiler flags for building JNI extensions])
AS_IF([test "x$JAVA_CFLAGS" = "x" && test "x$JAVA_HOME" != "x"],
[JAVA_CFLAGS="-I$JAVA_HOME/include"])
AS_IF([test -d "$JAVA_HOME/include/linux"],
[JAVA_CFLAGS="$JAVA_CFLAGS -I$JAVA_HOME/include/linux"])
AS_IF([test "x$with_java" != "xno"],
[CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $JAVA_CFLAGS"
AC_CHECK_HEADERS([jni.h], [], [have_java="no"])
CPPFLAGS="$CPPFLAGS_save"
AS_IF([test "x$have_java" != "xno"],
[with_java="yes"],
[test "x$with_java" = "xyes"],
[AC_MSG_FAILURE([unable to find Java JNI! ensure CFLAGS are set appropriately or configure --without-java])],
[with_java="no"])
])
AM_CONDITIONAL([HAVE_JAVA], [test "x$with_java" = "xyes"])
dnl header files
dnl FIXME switches for shm, mmap
AC_HEADER_ASSERT
AC_CHECK_HEADERS([errno.h fcntl.h features.h inttypes.h float.h limits.h \
locale.h stddef.h stdlib.h string.h unistd.h sys/types.h sys/stat.h \
sys/ioctl.h sys/time.h sys/times.h sys/ipc.h sys/shm.h sys/mman.h])
AC_HEADER_MAJOR
AC_CHECK_HEADER_STDBOOL
dnl types
AC_TYPE_INT32_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AC_TYPE_UINTPTR_T
AC_TYPE_UID_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_MEMBERS([struct stat.st_rdev])
dnl compile characteristics
AC_C_CONST
AC_C_INLINE
dnl functions
AC_FUNC_MMAP
AC_CHECK_FUNCS([alarm clock_gettime floor getcwd gettimeofday localeconv memchr memmove memset modf munmap pow select setenv sqrt strcasecmp strchr strdup strerror strrchr strstr strtol strtoul malloc realloc])
dnl output generation
dnl avoid doc rebuilds unless revision info changes
AC_CONFIG_COMMANDS([doc/version.xml],
[AS_IF([test -f doc/version.xml && \
! echo $VERSION | diff doc/version.xml - >/dev/null 2>&1 || \
! echo $VERSION | diff $srcdir/doc/version.xml - >/dev/null 2>&1 ],
[echo "writing new doc/version.xml" ; echo $VERSION > $srcdir/doc/version.xml ])],
[VERSION="$VERSION"]
)
AC_CONFIG_COMMANDS([doc/reldate.xml],
[AS_IF([test -f doc/reldate.xml && \
! echo $RELDATE | diff doc/reldate.xml - >/dev/null 2>&1 || \
! echo $RELDATE | diff $srcdir/doc/reldate.xml - >/dev/null 2>&1 ],
[echo "writing new doc/reldate.xml" ; echo $RELDATE > $srcdir/doc/reldate.xml ])],
[RELDATE="$RELDATE"]
)
echo "Generating config files"
AC_CONFIG_FILES([
Makefile
gtk/Makefile
java/Makefile
po/Makefile.in
zbar/Makefile
zbar.pc
zbar-gtk.pc
doc/doxygen.conf])
AC_CONFIG_FILES([test/test_examples.sh],[chmod 755 test/test_examples.sh])
AC_CONFIG_FILES([test/check_dbus.sh],[chmod 755 test/check_dbus.sh])
AC_OUTPUT
dnl summary log
echo ""
echo "please verify that the detected configuration matches your expectations:"
echo "------------------------------------------------------------------------"
AS_IF([test "x$USE_NLS" = "xyes"],
[echo "gettext $USE_NLS"]
)
AS_IF([test "x$win32" != "xno"],
[AS_IF([test "x$with_directshow" != "xno"],
[echo "DirectShow driver --with-directshow=$with_directshow"],
[echo "VfW driver --with-directshow=$with_directshow"]
)],
[echo "X --with-x=$have_x"]
)
AS_IF([test "x$with_python" != "xno"], pyver="\tpython${PYTHON_VERSION}")
AS_IF([test "x$with_gtk" != "xno"], gtkver="\tGtk${GTK_VERSION}")
AS_IF([test "x$with_qt" != "xno"], qtver="\tQt${QT_VERSION}")
echo "pthreads --enable-pthread=$enable_pthread"
echo "doc --enable-doc=$enable_doc"
echo "v4l --enable-video=$enable_video"
echo "jpeg --with-jpeg=$with_jpeg"
echo -e "Python --with-python=$with_python $pyver"
echo -e "GTK --with-gtk=$with_gtk $gtkver"
echo "GObject introspection --with-gir=$with_gir"
echo -e "Qt --with-qt=$with_qt $qtver"
echo "Java --with-java=$with_java"
AS_IF([test "x$win32" = "xno"],
[echo "Dbus --with-dbus=$with_dbus"])
AS_IF([test "x$have_GM" = "xyes"],
[echo "GraphicsMagick --with-graphicsmagick=yes"],
[echo "ImageMagick --with-imagemagick=$with_imagemagick"])
echo "Enabled codes: $enabled_codes"
echo "Disabled codes: $disabled_codes"
AS_IF([test "x$with_java" = "xyes"],
[echo "JAVA_HOME $JAVA_HOME"])
dnl Display "warnings" about disabled and experimental features
echo ""
AS_IF([test "x$enable_video" != "xyes"],
[echo " => zbarcam video scanner will *NOT* be built"])
AS_IF([test "x$have_libv4l" != "xyes"],
[echo " => libv4l will *NOT* be used"])
AS_IF([test "x$with_jpeg" != "xyes"],
[echo " => JPEG image conversions will *NOT* be supported"])
AS_IF([test "x$have_IM" != "xyes" && test "x$have_GM" != "xyes"],
[echo " => the zbarimg file scanner will *NOT* be built"])
AS_IF([test "x$have_GM" = "xyes"],
[echo " => ImageMagick is preferred, as GraphicsMagick doesn't support https"])
AS_IF([test "x$with_gtk" = "xno"],
[echo " => GTK support will *NOT* be built"])
AS_IF([test "x$with_pygtk2" != "xyes" && test "xPYTHON_VERSION_MAJOR" = "x2"],
[echo " => the Python 2 GTK widget wrapper will *NOT* be built"])
AS_IF([test "x$with_qt" != "xyes"],
[echo " => the Qt widget will *NOT* be built"])
AS_IF([test "x$with_qt" = "xyes" && test "x$enable_static_qt" = "xyes" ],
[echo " => Building a static Qt library"])
AS_IF([test "x$with_java" != "xyes"],
[echo " => the Java interface will *NOT* be built"])
AS_IF([test "x$with_java_unit" != "xyes"],
[echo " => the Java unit test will *NOT* be enabled"])
dnl echo "NPAPI Plugin --with-npapi=$with_npapi"
dnl AS_IF([test "x$with_mozilla" != "xyes"],
dnl [echo " => the Mozilla/Firefox/OpenOffice plugin will *NOT* be built"])
AS_IF([test "x$enable_pdf417" = "xyes"],
[echo " => the pdf417 code support is incomplete!"])