-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1165 lines (1003 loc) · 39.6 KB
/
configure.in
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
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Process this file with autoconf to produce a configure script.
# Set various version strings
m4_define([opencv_major_version], [2])
m4_define([opencv_minor_version], [0])
m4_define([opencv_subminor_version], [0])
m4_define([opencv_version], [opencv_major_version.opencv_minor_version.opencv_subminor_version])
# Before making a release, the LT_VERSION string should be modified.
# See: http://www.gnu.org/software/libtool/manual.html#Versioning
#
# The string is of the form Current:Revision:Age.
#
# The following lines are taken from the GNU Libtool Manual:
# Here are a set of rules to help you update your library version information:
#
# Start with version information of 0:0:0 for each libtool library.
# Update the version information only immediately before a public release of your software.
# More frequent updates are unnecessary, and only guarantee that the current interface number
# gets larger faster.
#
# 1) If the library source code has changed at all since the last update,
# then increment revision (c:r:a becomes c:r+1:a).
# 2) If any interfaces have been added, removed, or changed since the last update,
# increment current, and set revision to 0.
# 3) If any interfaces have been added since the last public release, then increment age.
# 4) If any interfaces have been removed since the last public release, then set age to 0.
#
# Never try to set the interface numbers so that they correspond to the release number of your package.
# This is an abuse that only fosters misunderstanding of the purpose of library versions. Instead,
# use the -release flag (see Release numbers), but be warned that every release of your package will
# not be binary compatible with any other release.
m4_define([opencv_lt_version], [4:0:0])
# init autotools
# we need autoconf >= 2.62 beause of several macros in there
AC_PREREQ(2.63)
AC_INIT([opencv],[opencv_version],[opencvlibrary-devel@lists.sourceforge.net])
AC_CONFIG_SRCDIR([opencv.pc.in])
AC_CONFIG_AUX_DIR([autotools])
AC_CONFIG_MACRO_DIR([autotools/aclocal])
# put CVS revision of this configure.in into the resulting configure script
AC_REVISION($Revision: 1.60 $)
# Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
# setup automake - we need >= 1.6 because of python and aclocal support
# we updated to 1.9 because of cross-platform issues
AC_CONFIG_HEADERS([cvconfig.h])
AM_INIT_AUTOMAKE([1.9])
AC_PROG_MAKE_SET
# use ugly maintainer-mode flag to help CVS users that do not want to
# help developing OpenCV but just need to compile the latest version
# AM_MAINTAINER_MODE
# substitute versionnumbers
AC_SUBST(MMAJOR, [opencv_major_version])
AC_SUBST(MMINOR, [opencv_minor_version])
AC_SUBST(MSUBMINOR, [opencv_subminor_version])
AC_SUBST(VERSION, [opencv_version])
AC_SUBST(LT_VERSION, [opencv_lt_version])
# disable building static libraries,
# allow Cygwin to build DLLs
AC_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
# Do compilation tests using CXX and CXXCPP and use extension .C for test programs.
# Use compilation flags: CPPFLAGS with CXXCPP, and both CPPFLAGS and CXXFLAGS with CXX.
AC_LANG(C++)
# checks for programs.
AC_PROG_CXXCPP
AC_PROG_CXX
AC_PROG_LIBTOOL
######################################################################
# the following interpret 'with' and 'enable' switches.
# some of these switches trigger checks that can be found further
# below in this configure script
# does the user want aggressive optimization?
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],[build debug version without optimization [no]])],
[enable_debug=$enableval],
[enable_debug=no])
# does the user want to have automatic guess of suitable optimization options
AC_ARG_ENABLE([optimization],
[AS_HELP_STRING([--enable-optimization],[automatic guess of suitable optimization options [yes]])],
[enable_optimization=$enableval],
[enable_optimization=yes])
# does the user want to have SSE / SSE2 / SSE3 specified?
AC_ARG_ENABLE([sse],
[AS_HELP_STRING([--enable-sse],[enable SSE(2) intrinsics [automatic]])],
[enable_sse=$enableval],
[enable_sse=auto])
# does the user want to build demo applications?
AC_ARG_ENABLE([apps],
[AS_HELP_STRING([--enable-apps],[build demo applications [yes]])],
[enable_apps=$enableval],
[enable_apps="yes"])
AM_CONDITIONAL([BUILD_APPS], [test x"$enable_apps" = x"yes"])
# the following checks reflect the dependencies of OpenCV on other
# libraries that do the actual work for video I/O or windowing
# subsystem. On some platforms there are ambiguities that a user
# can influence. There is also additional logic to be found in code
# later code lines that tries to do sensible decisions on what to use
# does the user want to compile python modules as well?
AC_ARG_WITH([native-lapack],
[AS_HELP_STRING([--with-native-lapack],[use platform native BLAS and LAPACK [no]])],
[with_native_lapack=$withval],
[with_native_lapack=no])
# compile and link against OpenMP
# because of this: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28482
# we disable OpenMP by default. But one may enable it explicitly with --with-openmp
#AC_ARG_WITH([openmp],
# [AS_HELP_STRING([--with-openmp],[use OpenMP threading [no]])],
# [with_openmp=$withval],
# [with_openmp=no])
# does the user want to compile python modules as well?
AC_ARG_WITH([swig],
[AS_HELP_STRING([--with-swig],[use swig wrapper generator [no]])],
[with_swig=$withval],
[with_swig=no])
# does the user want to compile python modules as well?
AC_ARG_WITH([python],
[AS_HELP_STRING([--with-python],[use python for wrapping [yes]])],
[with_python=$withval],
[with_python=yes])
# does the user want to compile octave modules as well?
AC_ARG_WITH([octave],
[AS_HELP_STRING([--with-octave],[use octave for wrapping [no]])],
[with_octave=$withval],
[with_octave=no])
# does the user want OpenCV to use xine video libraries?
AC_ARG_WITH([xine],
[AS_HELP_STRING([--with-xine],[use xine libraries (see LICENSE) [no]])],
[with_xine=$withval],
[with_xine=no])
# does the user want OpenCV to use the gstreamer multimedia framework?
AC_ARG_WITH([gstreamer],
[AS_HELP_STRING([--with-gstreamer],[use gstreamer multimedia framework (see LICENSE) [no]])],
[with_gstreamer=$withval],
[with_gstreamer=no])
# does the user want OpenCV to use ffmpeg video libraries?
AC_ARG_WITH([ffmpeg],
[AS_HELP_STRING([--with-ffmpeg],[use ffmpeg libraries (see LICENSE) [automatic]])],
[with_ffmpeg=$withval],
[with_ffmpeg=auto])
# does the user want OpenCV to use libraw1394/libdc1394 for video input?
AC_ARG_WITH([1394libs],
[AS_HELP_STRING([--with-1394libs],[use libraw1394/libdc1394 [automatic]])],
[with_1394libs=$withval],
[with_1394libs=auto])
# does the user want OpenCV to use the video4linux kernel module?
AC_ARG_WITH([v4l],
[AS_HELP_STRING([--with-v4l],[use video4linux [automatic]])],
[with_v4l=$withval],
[with_v4l=auto])
# does the user want OpenCV to use the unicap library?
AC_ARG_WITH([unicap],
[AS_HELP_STRING([--with-unicap],[use unicap (see LICENSE) [no]])],
[with_unicap=$withval],
[with_unicap=no])
# does the user want OpenCV to use image libraries from OS X 10.4?
AC_ARG_WITH([imageio],
[AS_HELP_STRING([--with-imageio],[use ImageIO libraries [automatic]])],
[with_imageio=$withval],
[with_imageio=yes])
# does the user want OpenCV to use QuickTime video libraries?
AC_ARG_WITH([quicktime],
[AS_HELP_STRING([--with-quicktime],[use QuickTime libraries [automatic]])],
[with_quicktime=$withval],
[with_quicktime=yes])
# does the user want OpenCV to use the Carbon GUI of Mac OS X?
AC_ARG_WITH([carbon],
[AS_HELP_STRING([--with-carbon],[use Carbon windows [automatic]])],
[with_carbon=$withval],
[with_carbon=yes])
# does the user want OpenCV to use GTK+ 2.0 for the GUI?
AC_ARG_WITH([gtk],
[AS_HELP_STRING([--with-gtk],[use gtk+ 2.0 windows [automatic]])],
[with_gtk=$withval],
[with_gtk=auto])
# does the user want OpenCV to use gthread for GTK+ threaded HighGUI?
AC_ARG_WITH([gthread],
[AS_HELP_STRING([--with-gthread],[use gthread in addition to gtk+ [automatic]])],
[with_gthread=$withval],
[with_gthread=auto])
######################################################################
# Compiler options
# OpenMP support
# macro calls AC_SUBST(OPENMP_CXXFLAGS)
# and brings its own enable/disable switch ("--disable-openmp")
AC_OPENMP
# SSE/SSE2/SSE3 support
if test x"$enable_sse" = "xauto"; then
# This macro calls:
# AC_SUBST(SIMD_FLAGS)
# And defines:
# HAVE_MMX / HAVE_SSE / HAVE_SSE2 / HAVE_SSE3 / HAVE_SSSE3
AX_EXT
else
if test x"$enable_sse" = "xyes"; then
AC_DEFINE(HAVE_MMX,,[Support mmx instructions])
AC_DEFINE(HAVE_SSE,,[Support SSE (Streaming SIMD Extensions) instructions])
AC_DEFINE(HAVE_SSE2,,[Support SSE2 (Streaming SIMD Extensions 2) instructions])
#AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions])
#AC_DEFINE(HAVE_SSSE3,,[Support SSSE3 (Supplemental Streaming SIMD Extensions 3) instructions])
SIMD_FLAGS=" -mmmx -msse -msse2"
AC_SUBST(SIMD_FLAGS)
fi
fi
## check whether to include debugging compiler flags
AC_MSG_CHECKING([whether to build debug version])
DEBUG_CPPFLAGS=""
DEBUG_CXXFLAGS=""
if test x"$enable_debug" = "xyes"; then
AC_MSG_RESULT([yes])
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
DEBUG_CXXFLAGS="-ggdb"
fi
DEBUG_CPPFLAGS="-DDEBUG -D_DEBUG"
else
AC_MSG_RESULT([no])
fi
AC_SUBST(DEBUG_CPPFLAGS)
AC_SUBST(DEBUG_CXXFLAGS)
## see if the user wants aggressive optimizations of the code
AC_MSG_CHECKING([whether to enable aggressive optimization flags])
OPTIMIZATION_CPPFLAGS=""
OPTIMIZATION_CXXFLAGS=""
FLOAT_STORE_CFLAGS=""
if test x"$enable_optimization" = "xyes"; then
AC_MSG_RESULT([yes])
# cure annoying default arguments for CFLAGS and CXXFLAGS
# that autoconf automatically sets in GNU environments if
# no CFLAGS or CXXFLAGS were manually given
#
# this is a more or less a hack ...
if test x"$CFLAGS" = x"-g -O2" ; then
CFLAGS=""
fi
if test x"$CXXFLAGS" = x"-g -O2" ; then
CXXFLAGS=""
fi
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
# special flag for gcc to work around excess precision bug in cLapack
FLOAT_STORE_CFLAGS="-ffloat-store"
# Due to a misconception, until SVN revision r1713, the case statement
# used the value of '--target', not of '--host'
case $host in
i386-apple-*)
# all intel macs have at least prescott instruction set
OPTIMIZATION_CXXFLAGS="-fast -g"
;;
x86_64-apple-*)
# all 64bit intel macs have at least nocona instruction set
OPTIMIZATION_CXXFLAGS="-fast -g -march=nocona"
;;
i?86-*-*)
# okay, we use this default together with the specification of the target architecture
# let us just assume, a Pentium 4 would be the minimum platform for OpenCV,
# then SSE2 instruction set is available also
OPTIMIZATION_CXXFLAGS="-O3 -g -march=pentium4 -ffast-math -fomit-frame-pointer"
;;
amd64-*-* | x86_64-*-*)
OPTIMIZATION_CXXFLAGS="-O3 -g -march=x86-64 -ffast-math -fomit-frame-pointer"
;;
powerpc-apple-*)
# Mac OS X 10.4 runs on CPUs >= G4 only
OPTIMIZATION_CXXFLAGS="-O3 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -falign-loops=16 -falign-jumps=16 -falign-functions=16 -ffast-math -fstrict-aliasing -funroll-loops -ftree-loop-linear -ftree-loop-memset -mcpu=G4 -mpowerpc-gpopt -mtune=G5 -fsched-interblock -fgcse-sm -g"
;;
powerpc64-apple-*)
# There are no 64bit Macs with a CPU that's not a G5
OPTIMIZATION_CXXFLAGS="-O3 -falign-loops-max-skip=15 -falign-jumps-max-skip=15 -falign-loops=16 -falign-jumps=16 -falign-functions=16 -ffast-math -fstrict-aliasing -funroll-loops -ftree-loop-linear -ftree-loop-memset -mcpu=G5 -mpowerpc-gpopt -fsched-interblock -fgcse-sm -m64 -g"
;;
powerpc-*-*)
# generic PowerPCs don't have Apple's 'fast' or 'fastf' switch
OPTIMIZATION_CXXFLAGS="-O3 -g -mcpu=G3 -mtune=G4 -fomit-frame-pointer"
;;
*-*-*)
OPTIMIZATION_CXXFLAGS="-O2 -fomit-frame-pointer"
;;
esac
fi
OPTIMIZATION_CPPFLAGS="-DNDEBUG"
else
AC_MSG_RESULT([no])
fi
AC_SUBST(OPTIMIZATION_CPPFLAGS)
AC_SUBST(OPTIMIZATION_CXXFLAGS)
AC_SUBST(FLOAT_STORE_CFLAGS)
# basic libraries needed by OpenCV
AC_CHECK_LIB(m,pow)
AC_CHECK_LIB(dl,dlopen)
AC_CHECK_LIB(pthread,pthread_create)
AC_CHECK_LIB(z,gzputs)
# check endianness
AC_C_BIGENDIAN
# check for specific functions that might be missing from
# certain standard library implementations
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([assert.h])
AC_CHECK_FUNCS(lrint)
AC_SEARCH_LIBS([clock_gettime],[rt])
######################################################################
# BLAS and LAPACK
LAPACK_LIBS=""
have_native_lapack=no
if test x"$with_native_lapack" = "xyes"; then
# check for Accellerate framework on Mac OS X
#
# As of Mac OS X 10.5 blas and lapack exist as standard shared
# libraries, so this check could be replaced by separate checks for
# those two libraries as it may be helpful for Linux/Unix variants
# as well.
AC_CHECK_HEADER([vecLib/clapack.h],
[
AC_DEFINE(HAVE_VECLIB,,[BLAS and LAPACK from Accelerate/vecLib framework])
LAPACK_LIBS="-Xlinker -framework -Xlinker vecLib"
have_native_lapack=yes
],
[
have_native_lapack=no
])
fi
AC_SUBST(LAPACK_LIBS)
AM_CONDITIONAL([NATIVE_LAPACK], [test x"$have_native_lapack" = "xyes"])
######################################################################
# HighGUI dependencies for windowing system
# honor user selection,
# if no selection given check for Carbon first
CARBON_CFLAGS=""
CARBON_LIBS=""
if test x"$with_carbon" = "xyes"; then
# header presence and usability seem to be enough
AC_CHECK_HEADER([Carbon/Carbon.h],
[
AC_DEFINE(HAVE_CARBON,,[Carbon windowing environment])
CARBON_LIBS="-Xlinker -framework -Xlinker Carbon"
have_carbon=yes
],
[
have_carbon=no
with_carbon=no
])
# sanity checks
if test x"$have_carbon" = "xyes"; then
# if we asked for gtk, this is not ok
if test x"$with_gtk" = "xyes"; then
AC_MSG_ERROR([You cannot specify --with-carbon and --with-gtk at the same time])
fi
# don't check alternatives if carbon was found
if test x"$with_gtk" = "xauto"; then
with_gtk=no
fi
fi
else
have_carbon=no
if test ! x"$with_carbon" = "xno"; then
AC_MSG_WARN([unexpected arguments for option --with-carbon, continuing assuming 'no'])
fi
fi
AC_SUBST(CARBON_CFLAGS)
AC_SUBST(CARBON_LIBS)
AM_CONDITIONAL([BUILD_CARBON], [test x"$have_carbon" = "xyes"])
# use GTK+ 2.x (or later) for windowing
# if carbon not present or not wanted (--without-carbon)
GTK_CFLAGS=""
GTK_LIBS=""
GTHREAD_CFLAGS=""
GTHREAD_LIBS=""
if test x"$with_gtk" = "xno"; then
have_gtk=no
else
# check if ./configure arguments are valid
if test x"$with_gtk" = "xauto"; then
with_gtk=yes
fi
if test x"$with_gtk" = "xyes"; then
# pkg-config is needed for GTK+
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test x"$PKG_CONFIG" = x"no"; then
AC_MSG_WARN([You have to install pkg-config to compile OpenCV with GTK+])
else
PKG_CHECK_MODULES(GTK, "gtk+-2.0 gdk-pixbuf-2.0",
[
have_gtk=yes
AC_DEFINE(HAVE_GTK,,[GTK+ 2.x toolkit])
],
[ have_gtk=no ])
fi
else
# if we get here then --with-gtk was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-gtk, continuing assuming 'no'])
have_gtk=no
fi
fi
if test x"$with_gthread" = "xno"; then
have_gthread=no
else
if test x"$have_gtk" = "xyes"; then
if test x"$with_gthread" = "xauto"; then
with_gthread=yes
fi
if test x"$with_gthread" = "xyes"; then
PKG_CHECK_MODULES(GTHREAD, "gthread-2.0",
[
have_gthread=yes
AC_DEFINE(HAVE_GTHREAD,,[GTK+ 2.0 Thread support])
],
[ have_gthread=no ])
else
# if we get here then --with-gthread was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-gthread, continuing assuming 'no'])
have_gthread=no
fi
else
# if no gtk+ was detected, looking for gthread does not make any sense
have_gthread=no
fi
fi
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)
AM_CONDITIONAL([BUILD_GTK], [test x"$have_gtk" = "xyes"])
######################################################################
# HighGUI dependencies for video I/O
# if QuickTime is present, it will override everything else,
# (unless '--without-quicktime' was given)
if test x"$with_quicktime" = "xyes"; then
# check other ./configure flags
if test x"$with_ffmpeg" = "xyes"; then
AC_MSG_ERROR([You cannot specify --with-quicktime and --with-ffmpeg at the same time])
fi
if test x"$with_xine" = "xyes"; then
AC_MSG_ERROR([You cannot specify --with-quicktime and --with-xine at the same time])
fi
if test x"$with_1394libs" = "xyes"; then
AC_MSG_ERROR([You cannot specify --with-quicktime and --with-1394libs at the same time])
fi
if test x"$with_v4l" = "xyes"; then
AC_MSG_ERROR([You cannot specify --with-quicktime and --with-v4l at the same time])
fi
# header presence and usability seem to be enough
AC_CHECK_HEADER([QuickTime/QuickTime.h],
[
AC_DEFINE(HAVE_QUICKTIME,,[QuickTime video libraries])
have_quicktime=yes
],
[ have_quicktime=no ])
# specify quicktime libraries
if test x"$have_quicktime" = "xyes"; then
QUICKTIME_LIBS="-Xlinker -framework -Xlinker QuickTime -Xlinker -framework -Xlinker QuartzCore"
# don't check alternatives if quicktime was found
if test x"$with_ffmpeg" = "xauto"; then
with_ffmpeg=no
fi
if test x"$with_xine" = "xauto"; then
with_xine=no
fi
if test x"$with_1394libs" = "xauto"; then
with_1394libs=no
fi
if test x"$with_v4l" = "xauto"; then
with_v4l=no
fi
fi
else
# check if ./configure arguments are valid
have_quicktime=no
if test ! x"$with_quicktime" = "xno"; then
AC_MSG_WARN([unexpected arguments for option --with-quicktime, continuing assuming 'no'])
fi
fi
AC_SUBST(QUICKTIME_CFLAGS)
AC_SUBST(QUICKTIME_LIBS)
AM_CONDITIONAL([BUILD_QUICKTIME], [test x"$have_quicktime" = "xyes"])
# GStreamer seems to be a nice solution for both reading and writing
# and even supports some cameras
GSTREAMER_CFLAGS=""
GSTREAMER_LIBS=""
if test x"$with_gstreamer" = "xno"; then
have_gstreamer=no
else
if test x"$with_ffmpeg" = "xyes"; then
AC_MSG_ERROR([You cannot specify --with-gstreamer and --with-ffmpeg at the same time])
fi
# check if ./configure arguments are valid
if test x"$with_gstreamer" = "xauto"; then
with_gstreamer=yes
fi
if test x"$with_gstreamer" = "xyes"; then
# pkg-config is needed for GTK+
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test x"$PKG_CONFIG" == "xno"; then
AC_MSG_ERROR([You have to install pkg-config to compile OpenCV with GStreamer])
fi
PKG_CHECK_MODULES(GSTREAMER, "gstreamer-0.10",
[
have_gstreamer=yes
AC_DEFINE(HAVE_GSTREAMER,,[GStreamer multimedia framework])
],
[ have_gstreamer=no ])
if test x"$have_gstreamer" = "xyes"; then
GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstbase-0.10"
with_ffmpeg=no
fi
else
# if we get here then --with-gstreamer was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-gstreamer, continuing assuming 'no'])
have_gstreamer=no
fi
fi
AC_SUBST(GSTREAMER_CFLAGS)
AC_SUBST(GSTREAMER_LIBS)
AM_CONDITIONAL([BUILD_GSTREAMER], [test x"$have_gstreamer" = "xyes"])
# Check for the unicap library
UNICAP_PACKAGE_LIBS=""
UNICAP_PACKAGE_CFLAGS=""
UCIL_PACKAGE_LIBS=""
UCIL_PACKAGE_CFLAGS=""
if test x"$with_unicap" = "xno"; then
have_unicap=no
else
PKG_CHECK_MODULES(UNICAP_PACKAGE,libunicap)
PKG_CHECK_MODULES(UCIL_PACKAGE,libucil)
have_unicap=yes
AC_DEFINE(HAVE_UNICAP,,[Unicap video capture library])
fi
AM_CONDITIONAL([BUILD_UNICAP], [test x"$have_unicap" = "xyes"])
AC_SUBST(UNICAP_PACKAGE_LIBS)
AC_SUBST(UNICAP_PACKAGE_CFLAGS)
AC_SUBST(UCIL_PACKAGE_LIBS)
AC_SUBST(UCIL_PACKAGE_CFLAGS)
# prefer XINE over FFMPEG for video reading because it is quick, has a cleaner API
# and allows for easy seeking with some formats
if test x"$with_xine" = "xno"; then
have_xine=no
# XINE_LIBS=""
else
# check if ./configure arguments are valid
if test x"$with_xine" = "xauto"; then
with_xine=yes
fi
if test x"$with_xine" = "xyes"; then
AC_CHECK_HEADER(xine.h,
AC_CHECK_LIB(xine, xine_init,
[
have_xine=yes
AC_DEFINE(HAVE_XINE,,[Xine video library])
XINE_LIBS="-lxine"
],
[ have_xine=no ]),
[ have_xine=no ])
else
# if we get here then --with-xine was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-xine, continuing assuming 'no'])
have_xine=no
fi
fi
AC_SUBST(XINE_LIBS)
AM_CONDITIONAL([BUILD_XINE], [test x"$have_xine" = "xyes"])
# unfortunately, xine does not feature video writing,
# so we have to resort to FFMPEG here
if test x"$with_ffmpeg" = "xno"; then
have_ffmpeg=no
# FFMPEGLIBS=""
else
have_ffmpeg=no
have_avcodec=no
have_avformat=no
# check if ./configure arguments are valid
if test x"$with_ffmpeg" = "xauto"; then
with_ffmpeg=yes
fi
if test x"$with_ffmpeg" = "xyes"; then
AC_CHECK_HEADERS([ffmpeg/avcodec.h libavcodec/avcodec.h],[have_avcodec=yes])
AC_CHECK_HEADERS([ffmpeg/avformat.h libavformat/avformat.h],[have_avformat=yes])
if test x"$have_avcodec"x"$have_avformat" = "xyesxyes" ; then
AC_SEARCH_LIBS([avcodec_decode_video],[avcodec_pic avcodec],[
AC_SEARCH_LIBS([av_open_input_file], [avformat_pic avformat],[have_ffmpeg=yes],[],[-lavcodec])])
fi
if test x"$have_ffmpeg" = "xyes" ; then
# libswscale is not always necessary, but if it is there, we want to use it
AC_CHECK_HEADERS([ffmpeg/swscale.h libswscale/swscale.h],[
AC_CHECK_LIB([swscale],[sws_getContext],[FFMPEG_SWSCALE_LIBS="-lswscale"
AC_DEFINE(HAVE_FFMPEG_SWSCALE,,[FFMPEG helper library])])])
AC_DEFINE(HAVE_FFMPEG,,[FFMPEG video library])
FFMPEGLIBS="-lavcodec -lavformat $FFMPEG_SWSCALE_LIBS"
fi
else
# if we get here then --with-ffmpeg was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-ffmpeg, continuing assuming 'no'])
have_ffmpeg=no
fi
fi
AC_SUBST(FFMPEGLIBS)
AM_CONDITIONAL([BUILD_FFMPEG], [test x"$have_ffmpeg" = "xyes"])
# IEEE1394 / FireWire video video i/o with libdc1394, libraw1394
# (can be managed by QuickTime as well)
if test x"$with_1394libs" = "xno"; then
have_raw1394=no
have_dc1394=no
have_dc1394_2=no
# IEEE1394LIBS=""
else
# check if ./configure arguments are valid
if test x"$with_1394libs" = "xauto"; then
with_1394libs=yes
fi
if test x"$with_1394libs" = "xyes"; then
SAVELIBS="$LIBS"
have_raw1394=no
have_dc1394=no
have_dc1394_2=no
AC_CHECK_HEADER(libraw1394/raw1394.h,
AC_CHECK_LIB(raw1394, raw1394_new_handle,
[
have_raw1394=yes
LIBS="-lraw1394 $LIBS"
]))
if test x"$have_raw1394" = "xyes"; then
AC_CHECK_HEADER(dc1394/dc1394.h,
AC_CHECK_LIB(dc1394, dc1394_camera_enumerate,
[
have_dc1394_2=yes
AC_DEFINE(HAVE_DC1394_2,,[IEEE1394 capturing support])
IEEE1394LIBS="-lraw1394 -ldc1394"
]))
if test x"$have_dc1394_2" = "xno"; then
AC_CHECK_HEADER(libdc1394/dc1394_control.h,
AC_CHECK_LIB(dc1394_control, dc1394_camera_on,
[
have_dc1394=yes
AC_DEFINE(HAVE_DC1394,,[IEEE1394 capturing support])
AC_EGREP_HEADER(do_extra_buffering, libdc1394/dc1394_control.h,
[AC_DEFINE(HAVE_DC1394_095,,[libdc1394 0.9.4 or 0.9.5])])
IEEE1394LIBS="-lraw1394 -ldc1394_control"
]))
fi
fi
LIBS="$SAVELIBS"
else
# if we get here then --with-1394libs was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-1394libs, continuing assuming 'no'])
have_dc1394=no
fi
fi
AC_SUBST(IEEE1394LIBS)
AM_CONDITIONAL([BUILD_DC1394], [test x"$have_dc1394" = "xyes"])
AM_CONDITIONAL([BUILD_DC1394_2], [test x"$have_dc1394_2" = "xyes"])
# Video for Linux (V4L)
# we support version 1 and 2 currently
if test x"$with_v4l" = "xno"; then
have_v4l=no
have_v4l2=no
have_v4l1or2=no
else
# check if ./configure arguments are valid
if test x"$with_v4l" = "xauto"; then
with_v4l=yes
fi
if test x"$with_v4l" = "xyes"; then
AC_CHECK_HEADER([linux/videodev.h],
[
AC_DEFINE(HAVE_CAMV4L,,[V4L capturing support])
have_v4l=yes
have_v4l1or2=yes
],
[
have_v4l=no
have_v4l1or2=no
])
AC_CHECK_HEADER([linux/videodev2.h],
[
AC_DEFINE(HAVE_CAMV4L2,,[V4L2 capturing support])
have_v4l2=yes
have_v4l1or2=yes
],
[ have_v4l2=no ],
[[
#include <asm/types.h>
#include <sys/time.h>
]])
else
# if we get here then --with-v4l was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-v4l, continuing assuming 'no'])
have_v4l=no
have_v4l2=no
have_v4l1or2=no
fi
fi
AM_CONDITIONAL([BUILD_V4L], [test x"$have_v4l1or2" = "xyes"])
######################################################################
# HighGUI dependencies for image I/O
SAVELIBS="$LIBS"
IMAGELIBS=""
AC_SUBST(IMAGELIBS)
have_imageio=no
if test x"$with_imageio" = "xauto"; then
with_imageio=yes
fi
if test x"$with_imageio" = "xyes"; then
AC_CHECK_HEADER([ApplicationServices/ApplicationServices.h],
[
have_imageio=yes
AC_DEFINE(HAVE_IMAGEIO,,[Apple ImageIO Framework])
IMAGELIBS="$IMAGELIBS -framework ApplicationServices"
LIBS="$LIBS -framework ApplicationServices"
],
[ have_imageio=no ])
fi
AM_CONDITIONAL([BUILD_IMAGEIO], [test x"$have_imageio" = "xyes"])
have_jpeg=no
have_zlib=no
have_png=no
have_tiff=no
# there are problems with dependencies of ImageIO to libtiff, etc.
# that we avoid by not linking them ourselves
if test x"$have_imageio" = "xno" ; then
AC_CHECK_HEADER(jpeglib.h,
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
[
have_jpeg=yes
AC_DEFINE(HAVE_JPEG,,[IJG JPEG codec])
IMAGELIBS="$IMAGELIBS -ljpeg"
]))
AC_CHECK_HEADER(zlib.h,
AC_CHECK_LIB(z, gzopen,
[
have_zlib=yes
AC_DEFINE(HAVE_ZLIB,,[LZ77 compression/decompression library (used for PNG)])
IMAGELIBS="$IMAGELIBS -lz"
LIBS="$LIBS -lz"
]))
AC_CHECK_HEADER(png.h,
[
AC_DEFINE(HAVE_PNG_H,,[png.h needs to be included])
have_png=yes
])
AC_CHECK_HEADER([libpng/png.h],
[
AC_DEFINE(HAVE_LIBPNG_PNG_H,,[libpng/png.h needs to be included])
have_png=yes
])
if test x"$have_png" = "xyes"; then
AC_CHECK_LIB(png12, png_read_image,
[
have_png=yes
AC_DEFINE(HAVE_PNG,,[PNG codec])
IMAGELIBS="-lpng12 $IMAGELIBS"
LIBS="-lpng12 $LIBS"
AC_CHECK_FUNCS(png_get_valid png_set_tRNS_to_alpha)
],
[ have_png=no ])
fi
AC_CHECK_HEADER(tiff.h,
AC_CHECK_LIB(tiff, TIFFReadRGBAStrip,
[
have_tiff=yes
AC_DEFINE(HAVE_TIFF,,[TIFF codec])
IMAGELIBS="$IMAGELIBS -ltiff"
LIBS="$LIBS -ltiff"
]))
fi
have_jasper=no
AC_CHECK_HEADER(jasper/jasper.h,
AC_CHECK_LIB(jasper, jas_image_readcmpt,
[
have_jasper=yes
AC_DEFINE(HAVE_JASPER,,[JPEG-2000 codec])
IMAGELIBS="$IMAGELIBS -ljasper"
LIBS="$LIBS -ljasper"
]))
have_ilmimf=no
AC_CHECK_HEADER(ImfCRgbaFile.h,
AC_CHECK_LIB(IlmImf, ImfInputReadPixels,
[
have_ilmimf=yes
AC_DEFINE(HAVE_ILMIMF,,[OpenEXR codec])
IMAGELIBS="$IMAGELIBS -lIlmImf -lIex -lHalf"
LIBS="$LIBS -lIlmImf -lIex -lHalf"
],,
[ -lIex -lHalf ]))
# Restore original LIBS settings...
LIBS="$SAVELIBS"
AC_SUBST(IMAGELIBS)
######################################################################
# SWIG wrappers
# each language should have --with-LANGUAGE switch
# check for python
if test x"$with_python" = "xyes"; then
AC_MSG_NOTICE([Checking for necessary tools to build python wrappers])
# we need Python now
AM_PATH_PYTHON()
# get some info on how to compile and link python modules
AZ_PYTHON_CSPEC()
AZ_PYTHON_LSPEC()
# if not explicitly forbidden, check for swig also
if test x"$with_swig" = "xauto"; then
with_swig=yes
fi
### almost ok... just need to check if we have the Python headers ###
# first, save the CPPFLAGS
OLD_CPPFLAGS=$CPPFLAGS
# then add the PYTHON path founded previously
CPPFLAGS="$CPPFLAGS $PYTHON_CSPEC"
# now, we can check
AC_CHECK_HEADER(Python.h,
[have_python=yes],
[
AC_MSG_WARN([Python headers not found, disabling python wrappers])
have_python=no
])
# restore the old CPPFLAGS
CPPFLAGS=$OLD_CPPFLAGS
else
# check if ./configure arguments are valid
if test x"$with_python" = "xno"; then
have_python=no
else
# if we get here then --with-python was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-python, continuing assuming 'no'])
have_python=no
fi
fi
AM_CONDITIONAL([BUILD_PYTHON_WRAPPERS], [test x"$have_python" = "xyes"])
# check for octave
if test x"$with_octave" = "xyes"; then
AC_MSG_NOTICE([Checking for necessary tools to build octave wrappers])
# find octave and mkoctfile
AC_PATH_PROG(OCTAVE,octave)
AC_PATH_PROG(MKOCTFILE,mkoctfile)
if test -z "$OCTAVE"; then
AC_MSG_WARN([octave not found, disabling octave wrappers])
with_octave=no
fi
if test -z "$MKOCTFILE"; then
AC_MSG_WARN([mkoctfile not found, disabling octave wrappers])
with_octave=no
fi
OCTAVE_INCFLAGS=`$MKOCTFILE -p INCFLAGS`
AC_SUBST(OCTAVE_INCFLAGS,[$OCTAVE_INCFLAGS])
fi
if test x"$with_octave" = "xyes"; then
# check that octave version is at least 2.9.12
cat > conftest.m <<'EOF'
[[a,b,c]]=sscanf([[version()," "]],"%i.%i.%i","C");
exit(sum([[a,b,c]].*[[1e5,1e3,1]])<209012)
EOF
$OCTAVE --no-init-file conftest.m >& /dev/null || with_octave="no";
rm -f conftest.m
if test x"$with_octave" = "xno"; then
AC_MSG_WARN([Octave version < 2.9.12, disabling octave wrappers])
fi
fi
if test x"$with_octave" = "xyes"; then
# if not explicitly forbidden, check for swig also
if test x"$with_swig" = "xauto"; then
with_swig=yes
fi
# check that we have octave headers
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -x c++ $OCTAVE_INCFLAGS"
AC_CHECK_HEADER(octave/oct.h,
[have_octave=yes],
[
AC_MSG_WARN([Octave headers not found, disabling octave wrappers])
have_octave=no
])