1 # Process this file with autoconf to produce a configure script.
3 # Set various version strings
4 m4_define([opencv_major_version], [2])
5 m4_define([opencv_minor_version], [0])
6 m4_define([opencv_subminor_version], [0])
7 m4_define([opencv_version], [opencv_major_version.opencv_minor_version.opencv_subminor_version])
9 # Before making a release, the LT_VERSION string should be modified.
10 # See: http://www.gnu.org/software/libtool/manual.html#Versioning
12 # The string is of the form Current:Revision:Age.
14 # The following lines are taken from the GNU Libtool Manual:
15 # Here are a set of rules to help you update your library version information:
17 # Start with version information of 0:0:0 for each libtool library.
18 # Update the version information only immediately before a public release of your software.
19 # More frequent updates are unnecessary, and only guarantee that the current interface number
22 # 1) If the library source code has changed at all since the last update,
23 # then increment revision (c:r:a becomes c:r+1:a).
24 # 2) If any interfaces have been added, removed, or changed since the last update,
25 # increment current, and set revision to 0.
26 # 3) If any interfaces have been added since the last public release, then increment age.
27 # 4) If any interfaces have been removed since the last public release, then set age to 0.
29 # Never try to set the interface numbers so that they correspond to the release number of your package.
30 # This is an abuse that only fosters misunderstanding of the purpose of library versions. Instead,
31 # use the -release flag (see Release numbers), but be warned that every release of your package will
32 # not be binary compatible with any other release.
33 m4_define([opencv_lt_version], [4:0:0])
36 # we need autoconf >= 2.62 beause of several macros in there
38 AC_INIT([opencv],[opencv_version],[opencvlibrary-devel@lists.sourceforge.net])
39 AC_CONFIG_SRCDIR([opencv.pc.in])
40 AC_CONFIG_AUX_DIR([autotools])
41 AC_CONFIG_MACRO_DIR([autotools/aclocal])
43 # put CVS revision of this configure.in into the resulting configure script
44 AC_REVISION($Revision: 1.60 $)
46 # Detect the canonical host and target build environment
50 # setup automake - we need >= 1.6 because of python and aclocal support
51 # we updated to 1.9 because of cross-platform issues
52 AC_CONFIG_HEADERS([cvconfig.h])
53 AM_INIT_AUTOMAKE([1.9])
56 # use ugly maintainer-mode flag to help CVS users that do not want to
57 # help developing OpenCV but just need to compile the latest version
60 # substitute versionnumbers
61 AC_SUBST(MMAJOR, [opencv_major_version])
62 AC_SUBST(MMINOR, [opencv_minor_version])
63 AC_SUBST(MSUBMINOR, [opencv_subminor_version])
64 AC_SUBST(VERSION, [opencv_version])
65 AC_SUBST(LT_VERSION, [opencv_lt_version])
67 # disable building static libraries,
68 # allow Cygwin to build DLLs
72 # Do compilation tests using CXX and CXXCPP and use extension .C for test programs.
73 # Use compilation flags: CPPFLAGS with CXXCPP, and both CPPFLAGS and CXXFLAGS with CXX.
76 # checks for programs.
82 ######################################################################
83 # the following interpret 'with' and 'enable' switches.
84 # some of these switches trigger checks that can be found further
85 # below in this configure script
87 # does the user want aggressive optimization?
88 AC_ARG_ENABLE([debug],
89 [AS_HELP_STRING([--enable-debug],[build debug version without optimization [no]])],
90 [enable_debug=$enableval],
93 # does the user want to have automatic guess of suitable optimization options
94 AC_ARG_ENABLE([optimization],
95 [AS_HELP_STRING([--enable-optimization],[automatic guess of suitable optimization options [yes]])],
96 [enable_optimization=$enableval],
97 [enable_optimization=yes])
99 # does the user want to have SSE / SSE2 / SSE3 specified?
101 [AS_HELP_STRING([--enable-sse],[enable SSE(2) intrinsics [automatic]])],
102 [enable_sse=$enableval],
105 # does the user want to build demo applications?
106 AC_ARG_ENABLE([apps],
107 [AS_HELP_STRING([--enable-apps],[build demo applications [yes]])],
108 [enable_apps=$enableval],
110 AM_CONDITIONAL([BUILD_APPS], [test x"$enable_apps" = x"yes"])
113 # the following checks reflect the dependencies of OpenCV on other
114 # libraries that do the actual work for video I/O or windowing
115 # subsystem. On some platforms there are ambiguities that a user
116 # can influence. There is also additional logic to be found in code
117 # later code lines that tries to do sensible decisions on what to use
119 # does the user want to compile python modules as well?
120 AC_ARG_WITH([native-lapack],
121 [AS_HELP_STRING([--with-native-lapack],[use platform native BLAS and LAPACK [no]])],
122 [with_native_lapack=$withval],
123 [with_native_lapack=no])
125 # compile and link against OpenMP
126 # because of this: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28482
127 # we disable OpenMP by default. But one may enable it explicitly with --with-openmp
128 #AC_ARG_WITH([openmp],
129 # [AS_HELP_STRING([--with-openmp],[use OpenMP threading [no]])],
130 # [with_openmp=$withval],
133 # does the user want to compile python modules as well?
135 [AS_HELP_STRING([--with-swig],[use swig wrapper generator [no]])],
136 [with_swig=$withval],
139 # does the user want to compile python modules as well?
140 AC_ARG_WITH([python],
141 [AS_HELP_STRING([--with-python],[use python for wrapping [yes]])],
142 [with_python=$withval],
145 # does the user want to compile octave modules as well?
146 AC_ARG_WITH([octave],
147 [AS_HELP_STRING([--with-octave],[use octave for wrapping [no]])],
148 [with_octave=$withval],
151 # does the user want OpenCV to use xine video libraries?
153 [AS_HELP_STRING([--with-xine],[use xine libraries (see LICENSE) [no]])],
154 [with_xine=$withval],
157 # does the user want OpenCV to use the gstreamer multimedia framework?
158 AC_ARG_WITH([gstreamer],
159 [AS_HELP_STRING([--with-gstreamer],[use gstreamer multimedia framework (see LICENSE) [no]])],
160 [with_gstreamer=$withval],
163 # does the user want OpenCV to use ffmpeg video libraries?
164 AC_ARG_WITH([ffmpeg],
165 [AS_HELP_STRING([--with-ffmpeg],[use ffmpeg libraries (see LICENSE) [automatic]])],
166 [with_ffmpeg=$withval],
169 # does the user want OpenCV to use libraw1394/libdc1394 for video input?
170 AC_ARG_WITH([1394libs],
171 [AS_HELP_STRING([--with-1394libs],[use libraw1394/libdc1394 [automatic]])],
172 [with_1394libs=$withval],
173 [with_1394libs=auto])
175 # does the user want OpenCV to use the video4linux kernel module?
177 [AS_HELP_STRING([--with-v4l],[use video4linux [automatic]])],
181 # does the user want OpenCV to use the unicap library?
182 AC_ARG_WITH([unicap],
183 [AS_HELP_STRING([--with-unicap],[use unicap (see LICENSE) [no]])],
184 [with_unicap=$withval],
187 # does the user want OpenCV to use image libraries from OS X 10.4?
188 AC_ARG_WITH([imageio],
189 [AS_HELP_STRING([--with-imageio],[use ImageIO libraries [automatic]])],
190 [with_imageio=$withval],
193 # does the user want OpenCV to use QuickTime video libraries?
194 AC_ARG_WITH([quicktime],
195 [AS_HELP_STRING([--with-quicktime],[use QuickTime libraries [automatic]])],
196 [with_quicktime=$withval],
197 [with_quicktime=yes])
199 # does the user want OpenCV to use the Carbon GUI of Mac OS X?
200 AC_ARG_WITH([carbon],
201 [AS_HELP_STRING([--with-carbon],[use Carbon windows [automatic]])],
202 [with_carbon=$withval],
205 # does the user want OpenCV to use GTK+ 2.0 for the GUI?
207 [AS_HELP_STRING([--with-gtk],[use gtk+ 2.0 windows [automatic]])],
211 # does the user want OpenCV to use gthread for GTK+ threaded HighGUI?
212 AC_ARG_WITH([gthread],
213 [AS_HELP_STRING([--with-gthread],[use gthread in addition to gtk+ [automatic]])],
214 [with_gthread=$withval],
218 ######################################################################
222 # macro calls AC_SUBST(OPENMP_CXXFLAGS)
223 # and brings its own enable/disable switch ("--disable-openmp")
226 # SSE/SSE2/SSE3 support
227 if test x"$enable_sse" = "xauto"; then
229 # AC_SUBST(SIMD_FLAGS)
231 # HAVE_MMX / HAVE_SSE / HAVE_SSE2 / HAVE_SSE3 / HAVE_SSSE3
234 if test x"$enable_sse" = "xyes"; then
235 AC_DEFINE(HAVE_MMX,,[Support mmx instructions])
236 AC_DEFINE(HAVE_SSE,,[Support SSE (Streaming SIMD Extensions) instructions])
237 AC_DEFINE(HAVE_SSE2,,[Support SSE2 (Streaming SIMD Extensions 2) instructions])
238 #AC_DEFINE(HAVE_SSE3,,[Support SSE3 (Streaming SIMD Extensions 3) instructions])
239 #AC_DEFINE(HAVE_SSSE3,,[Support SSSE3 (Supplemental Streaming SIMD Extensions 3) instructions])
241 SIMD_FLAGS=" -mmmx -msse -msse2"
247 ## check whether to include debugging compiler flags
248 AC_MSG_CHECKING([whether to build debug version])
251 if test x"$enable_debug" = "xyes"; then
254 if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
255 DEBUG_CXXFLAGS="-ggdb"
258 DEBUG_CPPFLAGS="-DDEBUG -D_DEBUG"
262 AC_SUBST(DEBUG_CPPFLAGS)
263 AC_SUBST(DEBUG_CXXFLAGS)
266 ## see if the user wants aggressive optimizations of the code
267 AC_MSG_CHECKING([whether to enable aggressive optimization flags])
268 OPTIMIZATION_CPPFLAGS=""
269 OPTIMIZATION_CXXFLAGS=""
270 FLOAT_STORE_CFLAGS=""
271 if test x"$enable_optimization" = "xyes"; then
274 # cure annoying default arguments for CFLAGS and CXXFLAGS
275 # that autoconf automatically sets in GNU environments if
276 # no CFLAGS or CXXFLAGS were manually given
278 # this is a more or less a hack ...
279 if test x"$CFLAGS" = x"-g -O2" ; then
282 if test x"$CXXFLAGS" = x"-g -O2" ; then
286 if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
288 # special flag for gcc to work around excess precision bug in cLapack
289 FLOAT_STORE_CFLAGS="-ffloat-store"
291 # Due to a misconception, until SVN revision r1713, the case statement
292 # used the value of '--target', not of '--host'
295 # all intel macs have at least prescott instruction set
296 OPTIMIZATION_CXXFLAGS="-fast -g"
299 # all 64bit intel macs have at least nocona instruction set
300 OPTIMIZATION_CXXFLAGS="-fast -g -march=nocona"
303 # okay, we use this default together with the specification of the target architecture
304 # let us just assume, a Pentium 4 would be the minimum platform for OpenCV,
305 # then SSE2 instruction set is available also
306 OPTIMIZATION_CXXFLAGS="-O3 -g -march=pentium4 -ffast-math -fomit-frame-pointer"
308 amd64-*-* | x86_64-*-*)
309 OPTIMIZATION_CXXFLAGS="-O3 -g -march=x86-64 -ffast-math -fomit-frame-pointer"
312 # Mac OS X 10.4 runs on CPUs >= G4 only
313 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"
316 # There are no 64bit Macs with a CPU that's not a G5
317 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"
320 # generic PowerPCs don't have Apple's 'fast' or 'fastf' switch
321 OPTIMIZATION_CXXFLAGS="-O3 -g -mcpu=G3 -mtune=G4 -fomit-frame-pointer"
324 OPTIMIZATION_CXXFLAGS="-O2 -fomit-frame-pointer"
329 OPTIMIZATION_CPPFLAGS="-DNDEBUG"
333 AC_SUBST(OPTIMIZATION_CPPFLAGS)
334 AC_SUBST(OPTIMIZATION_CXXFLAGS)
335 AC_SUBST(FLOAT_STORE_CFLAGS)
337 # basic libraries needed by OpenCV
339 AC_CHECK_LIB(dl,dlopen)
340 AC_CHECK_LIB(pthread,pthread_create)
341 AC_CHECK_LIB(z,gzputs)
346 # check for specific functions that might be missing from
347 # certain standard library implementations
349 AC_CHECK_HEADERS([malloc.h])
350 AC_CHECK_HEADERS([assert.h])
351 AC_CHECK_FUNCS(lrint)
352 AC_SEARCH_LIBS([clock_gettime],[rt])
354 ######################################################################
358 have_native_lapack=no
359 if test x"$with_native_lapack" = "xyes"; then
360 # check for Accellerate framework on Mac OS X
362 # As of Mac OS X 10.5 blas and lapack exist as standard shared
363 # libraries, so this check could be replaced by separate checks for
364 # those two libraries as it may be helpful for Linux/Unix variants
366 AC_CHECK_HEADER([vecLib/clapack.h],
368 AC_DEFINE(HAVE_VECLIB,,[BLAS and LAPACK from Accelerate/vecLib framework])
369 LAPACK_LIBS="-Xlinker -framework -Xlinker vecLib"
370 have_native_lapack=yes
373 have_native_lapack=no
377 AC_SUBST(LAPACK_LIBS)
378 AM_CONDITIONAL([NATIVE_LAPACK], [test x"$have_native_lapack" = "xyes"])
381 ######################################################################
382 # HighGUI dependencies for windowing system
384 # honor user selection,
385 # if no selection given check for Carbon first
388 if test x"$with_carbon" = "xyes"; then
390 # header presence and usability seem to be enough
391 AC_CHECK_HEADER([Carbon/Carbon.h],
393 AC_DEFINE(HAVE_CARBON,,[Carbon windowing environment])
394 CARBON_LIBS="-Xlinker -framework -Xlinker Carbon"
403 if test x"$have_carbon" = "xyes"; then
405 # if we asked for gtk, this is not ok
406 if test x"$with_gtk" = "xyes"; then
407 AC_MSG_ERROR([You cannot specify --with-carbon and --with-gtk at the same time])
410 # don't check alternatives if carbon was found
411 if test x"$with_gtk" = "xauto"; then
417 if test ! x"$with_carbon" = "xno"; then
418 AC_MSG_WARN([unexpected arguments for option --with-carbon, continuing assuming 'no'])
421 AC_SUBST(CARBON_CFLAGS)
422 AC_SUBST(CARBON_LIBS)
423 AM_CONDITIONAL([BUILD_CARBON], [test x"$have_carbon" = "xyes"])
425 # use GTK+ 2.x (or later) for windowing
426 # if carbon not present or not wanted (--without-carbon)
431 if test x"$with_gtk" = "xno"; then
435 # check if ./configure arguments are valid
436 if test x"$with_gtk" = "xauto"; then
439 if test x"$with_gtk" = "xyes"; then
441 # pkg-config is needed for GTK+
442 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
443 if test x"$PKG_CONFIG" = x"no"; then
444 AC_MSG_WARN([You have to install pkg-config to compile OpenCV with GTK+])
446 PKG_CHECK_MODULES(GTK, "gtk+-2.0 gdk-pixbuf-2.0",
449 AC_DEFINE(HAVE_GTK,,[GTK+ 2.x toolkit])
454 # if we get here then --with-gtk was not called with 'yes','no' or 'auto'
455 AC_MSG_WARN([unexpected arguments for option --with-gtk, continuing assuming 'no'])
459 if test x"$with_gthread" = "xno"; then
462 if test x"$have_gtk" = "xyes"; then
463 if test x"$with_gthread" = "xauto"; then
467 if test x"$with_gthread" = "xyes"; then
468 PKG_CHECK_MODULES(GTHREAD, "gthread-2.0",
471 AC_DEFINE(HAVE_GTHREAD,,[GTK+ 2.0 Thread support])
475 # if we get here then --with-gthread was not called with 'yes','no' or 'auto'
476 AC_MSG_WARN([unexpected arguments for option --with-gthread, continuing assuming 'no'])
480 # if no gtk+ was detected, looking for gthread does not make any sense
486 AC_SUBST(GTHREAD_CFLAGS)
487 AC_SUBST(GTHREAD_LIBS)
488 AM_CONDITIONAL([BUILD_GTK], [test x"$have_gtk" = "xyes"])
491 ######################################################################
492 # HighGUI dependencies for video I/O
494 # if QuickTime is present, it will override everything else,
495 # (unless '--without-quicktime' was given)
496 if test x"$with_quicktime" = "xyes"; then
498 # check other ./configure flags
499 if test x"$with_ffmpeg" = "xyes"; then
500 AC_MSG_ERROR([You cannot specify --with-quicktime and --with-ffmpeg at the same time])
502 if test x"$with_xine" = "xyes"; then
503 AC_MSG_ERROR([You cannot specify --with-quicktime and --with-xine at the same time])
505 if test x"$with_1394libs" = "xyes"; then
506 AC_MSG_ERROR([You cannot specify --with-quicktime and --with-1394libs at the same time])
508 if test x"$with_v4l" = "xyes"; then
509 AC_MSG_ERROR([You cannot specify --with-quicktime and --with-v4l at the same time])
512 # header presence and usability seem to be enough
513 AC_CHECK_HEADER([QuickTime/QuickTime.h],
515 AC_DEFINE(HAVE_QUICKTIME,,[QuickTime video libraries])
518 [ have_quicktime=no ])
520 # specify quicktime libraries
521 if test x"$have_quicktime" = "xyes"; then
522 QUICKTIME_LIBS="-Xlinker -framework -Xlinker QuickTime -Xlinker -framework -Xlinker QuartzCore"
524 # don't check alternatives if quicktime was found
525 if test x"$with_ffmpeg" = "xauto"; then
528 if test x"$with_xine" = "xauto"; then
531 if test x"$with_1394libs" = "xauto"; then
534 if test x"$with_v4l" = "xauto"; then
539 # check if ./configure arguments are valid
541 if test ! x"$with_quicktime" = "xno"; then
542 AC_MSG_WARN([unexpected arguments for option --with-quicktime, continuing assuming 'no'])
545 AC_SUBST(QUICKTIME_CFLAGS)
546 AC_SUBST(QUICKTIME_LIBS)
547 AM_CONDITIONAL([BUILD_QUICKTIME], [test x"$have_quicktime" = "xyes"])
549 # GStreamer seems to be a nice solution for both reading and writing
550 # and even supports some cameras
553 if test x"$with_gstreamer" = "xno"; then
557 if test x"$with_ffmpeg" = "xyes"; then
558 AC_MSG_ERROR([You cannot specify --with-gstreamer and --with-ffmpeg at the same time])
561 # check if ./configure arguments are valid
562 if test x"$with_gstreamer" = "xauto"; then
565 if test x"$with_gstreamer" = "xyes"; then
567 # pkg-config is needed for GTK+
568 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
569 if test x"$PKG_CONFIG" == "xno"; then
570 AC_MSG_ERROR([You have to install pkg-config to compile OpenCV with GStreamer])
573 PKG_CHECK_MODULES(GSTREAMER, "gstreamer-0.10",
576 AC_DEFINE(HAVE_GSTREAMER,,[GStreamer multimedia framework])
578 [ have_gstreamer=no ])
580 if test x"$have_gstreamer" = "xyes"; then
581 GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstbase-0.10"
585 # if we get here then --with-gstreamer was not called with 'yes','no' or 'auto'
586 AC_MSG_WARN([unexpected arguments for option --with-gstreamer, continuing assuming 'no'])
590 AC_SUBST(GSTREAMER_CFLAGS)
591 AC_SUBST(GSTREAMER_LIBS)
592 AM_CONDITIONAL([BUILD_GSTREAMER], [test x"$have_gstreamer" = "xyes"])
594 # Check for the unicap library
595 UNICAP_PACKAGE_LIBS=""
596 UNICAP_PACKAGE_CFLAGS=""
598 UCIL_PACKAGE_CFLAGS=""
599 if test x"$with_unicap" = "xno"; then
602 PKG_CHECK_MODULES(UNICAP_PACKAGE,libunicap)
603 PKG_CHECK_MODULES(UCIL_PACKAGE,libucil)
605 AC_DEFINE(HAVE_UNICAP,,[Unicap video capture library])
607 AM_CONDITIONAL([BUILD_UNICAP], [test x"$have_unicap" = "xyes"])
608 AC_SUBST(UNICAP_PACKAGE_LIBS)
609 AC_SUBST(UNICAP_PACKAGE_CFLAGS)
610 AC_SUBST(UCIL_PACKAGE_LIBS)
611 AC_SUBST(UCIL_PACKAGE_CFLAGS)
613 # prefer XINE over FFMPEG for video reading because it is quick, has a cleaner API
614 # and allows for easy seeking with some formats
615 if test x"$with_xine" = "xno"; then
620 # check if ./configure arguments are valid
621 if test x"$with_xine" = "xauto"; then
624 if test x"$with_xine" = "xyes"; then
625 AC_CHECK_HEADER(xine.h,
626 AC_CHECK_LIB(xine, xine_init,
629 AC_DEFINE(HAVE_XINE,,[Xine video library])
635 # if we get here then --with-xine was not called with 'yes','no' or 'auto'
636 AC_MSG_WARN([unexpected arguments for option --with-xine, continuing assuming 'no'])
641 AM_CONDITIONAL([BUILD_XINE], [test x"$have_xine" = "xyes"])
643 # unfortunately, xine does not feature video writing,
644 # so we have to resort to FFMPEG here
645 if test x"$with_ffmpeg" = "xno"; then
654 # check if ./configure arguments are valid
655 if test x"$with_ffmpeg" = "xauto"; then
659 if test x"$with_ffmpeg" = "xyes"; then
660 AC_CHECK_HEADERS([ffmpeg/avcodec.h libavcodec/avcodec.h],[have_avcodec=yes])
661 AC_CHECK_HEADERS([ffmpeg/avformat.h libavformat/avformat.h],[have_avformat=yes])
663 if test x"$have_avcodec"x"$have_avformat" = "xyesxyes" ; then
664 AC_SEARCH_LIBS([avcodec_decode_video],[avcodec_pic avcodec],[
665 AC_SEARCH_LIBS([av_open_input_file], [avformat_pic avformat],[have_ffmpeg=yes],[],[-lavcodec])])
668 if test x"$have_ffmpeg" = "xyes" ; then
669 # libswscale is not always necessary, but if it is there, we want to use it
670 AC_CHECK_HEADERS([ffmpeg/swscale.h libswscale/swscale.h],[
671 AC_CHECK_LIB([swscale],[sws_getContext],[FFMPEG_SWSCALE_LIBS="-lswscale"
672 AC_DEFINE(HAVE_FFMPEG_SWSCALE,,[FFMPEG helper library])])])
674 AC_DEFINE(HAVE_FFMPEG,,[FFMPEG video library])
675 FFMPEGLIBS="-lavcodec -lavformat $FFMPEG_SWSCALE_LIBS"
678 # if we get here then --with-ffmpeg was not called with 'yes','no' or 'auto'
679 AC_MSG_WARN([unexpected arguments for option --with-ffmpeg, continuing assuming 'no'])
684 AM_CONDITIONAL([BUILD_FFMPEG], [test x"$have_ffmpeg" = "xyes"])
686 # IEEE1394 / FireWire video video i/o with libdc1394, libraw1394
687 # (can be managed by QuickTime as well)
688 if test x"$with_1394libs" = "xno"; then
695 # check if ./configure arguments are valid
696 if test x"$with_1394libs" = "xauto"; then
699 if test x"$with_1394libs" = "xyes"; then
706 AC_CHECK_HEADER(libraw1394/raw1394.h,
707 AC_CHECK_LIB(raw1394, raw1394_new_handle,
710 LIBS="-lraw1394 $LIBS"
713 if test x"$have_raw1394" = "xyes"; then
714 AC_CHECK_HEADER(dc1394/dc1394.h,
715 AC_CHECK_LIB(dc1394, dc1394_camera_enumerate,
718 AC_DEFINE(HAVE_DC1394_2,,[IEEE1394 capturing support])
719 IEEE1394LIBS="-lraw1394 -ldc1394"
722 if test x"$have_dc1394_2" = "xno"; then
723 AC_CHECK_HEADER(libdc1394/dc1394_control.h,
724 AC_CHECK_LIB(dc1394_control, dc1394_camera_on,
727 AC_DEFINE(HAVE_DC1394,,[IEEE1394 capturing support])
728 AC_EGREP_HEADER(do_extra_buffering, libdc1394/dc1394_control.h,
729 [AC_DEFINE(HAVE_DC1394_095,,[libdc1394 0.9.4 or 0.9.5])])
730 IEEE1394LIBS="-lraw1394 -ldc1394_control"
737 # if we get here then --with-1394libs was not called with 'yes','no' or 'auto'
738 AC_MSG_WARN([unexpected arguments for option --with-1394libs, continuing assuming 'no'])
742 AC_SUBST(IEEE1394LIBS)
743 AM_CONDITIONAL([BUILD_DC1394], [test x"$have_dc1394" = "xyes"])
744 AM_CONDITIONAL([BUILD_DC1394_2], [test x"$have_dc1394_2" = "xyes"])
746 # Video for Linux (V4L)
747 # we support version 1 and 2 currently
748 if test x"$with_v4l" = "xno"; then
753 # check if ./configure arguments are valid
754 if test x"$with_v4l" = "xauto"; then
757 if test x"$with_v4l" = "xyes"; then
758 AC_CHECK_HEADER([linux/videodev.h],
760 AC_DEFINE(HAVE_CAMV4L,,[V4L capturing support])
768 AC_CHECK_HEADER([linux/videodev2.h],
770 AC_DEFINE(HAVE_CAMV4L2,,[V4L2 capturing support])
776 #include <asm/types.h>
777 #include <sys/time.h>
780 # if we get here then --with-v4l was not called with 'yes','no' or 'auto'
781 AC_MSG_WARN([unexpected arguments for option --with-v4l, continuing assuming 'no'])
788 AM_CONDITIONAL([BUILD_V4L], [test x"$have_v4l1or2" = "xyes"])
791 ######################################################################
792 # HighGUI dependencies for image I/O
800 if test x"$with_imageio" = "xauto"; then
803 if test x"$with_imageio" = "xyes"; then
804 AC_CHECK_HEADER([ApplicationServices/ApplicationServices.h],
807 AC_DEFINE(HAVE_IMAGEIO,,[Apple ImageIO Framework])
808 IMAGELIBS="$IMAGELIBS -framework ApplicationServices"
809 LIBS="$LIBS -framework ApplicationServices"
813 AM_CONDITIONAL([BUILD_IMAGEIO], [test x"$have_imageio" = "xyes"])
821 # there are problems with dependencies of ImageIO to libtiff, etc.
822 # that we avoid by not linking them ourselves
823 if test x"$have_imageio" = "xno" ; then
825 AC_CHECK_HEADER(jpeglib.h,
826 AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
829 AC_DEFINE(HAVE_JPEG,,[IJG JPEG codec])
830 IMAGELIBS="$IMAGELIBS -ljpeg"
833 AC_CHECK_HEADER(zlib.h,
834 AC_CHECK_LIB(z, gzopen,
837 AC_DEFINE(HAVE_ZLIB,,[LZ77 compression/decompression library (used for PNG)])
838 IMAGELIBS="$IMAGELIBS -lz"
842 AC_CHECK_HEADER(png.h,
844 AC_DEFINE(HAVE_PNG_H,,[png.h needs to be included])
847 AC_CHECK_HEADER([libpng/png.h],
849 AC_DEFINE(HAVE_LIBPNG_PNG_H,,[libpng/png.h needs to be included])
853 if test x"$have_png" = "xyes"; then
854 AC_CHECK_LIB(png12, png_read_image,
857 AC_DEFINE(HAVE_PNG,,[PNG codec])
858 IMAGELIBS="-lpng12 $IMAGELIBS"
860 AC_CHECK_FUNCS(png_get_valid png_set_tRNS_to_alpha)
865 AC_CHECK_HEADER(tiff.h,
866 AC_CHECK_LIB(tiff, TIFFReadRGBAStrip,
869 AC_DEFINE(HAVE_TIFF,,[TIFF codec])
870 IMAGELIBS="$IMAGELIBS -ltiff"
876 AC_CHECK_HEADER(jasper/jasper.h,
877 AC_CHECK_LIB(jasper, jas_image_readcmpt,
880 AC_DEFINE(HAVE_JASPER,,[JPEG-2000 codec])
881 IMAGELIBS="$IMAGELIBS -ljasper"
882 LIBS="$LIBS -ljasper"
886 AC_CHECK_HEADER(ImfCRgbaFile.h,
887 AC_CHECK_LIB(IlmImf, ImfInputReadPixels,
890 AC_DEFINE(HAVE_ILMIMF,,[OpenEXR codec])
891 IMAGELIBS="$IMAGELIBS -lIlmImf -lIex -lHalf"
892 LIBS="$LIBS -lIlmImf -lIex -lHalf"
896 # Restore original LIBS settings...
901 ######################################################################
904 # each language should have --with-LANGUAGE switch
907 if test x"$with_python" = "xyes"; then
908 AC_MSG_NOTICE([Checking for necessary tools to build python wrappers])
913 # get some info on how to compile and link python modules
917 # if not explicitly forbidden, check for swig also
918 if test x"$with_swig" = "xauto"; then
922 ### almost ok... just need to check if we have the Python headers ###
924 # first, save the CPPFLAGS
925 OLD_CPPFLAGS=$CPPFLAGS
927 # then add the PYTHON path founded previously
928 CPPFLAGS="$CPPFLAGS $PYTHON_CSPEC"
931 AC_CHECK_HEADER(Python.h,
934 AC_MSG_WARN([Python headers not found, disabling python wrappers])
938 # restore the old CPPFLAGS
939 CPPFLAGS=$OLD_CPPFLAGS
942 # check if ./configure arguments are valid
943 if test x"$with_python" = "xno"; then
946 # if we get here then --with-python was not called with 'yes','no' or 'auto'
947 AC_MSG_WARN([unexpected arguments for option --with-python, continuing assuming 'no'])
951 AM_CONDITIONAL([BUILD_PYTHON_WRAPPERS], [test x"$have_python" = "xyes"])
954 if test x"$with_octave" = "xyes"; then
955 AC_MSG_NOTICE([Checking for necessary tools to build octave wrappers])
957 # find octave and mkoctfile
958 AC_PATH_PROG(OCTAVE,octave)
959 AC_PATH_PROG(MKOCTFILE,mkoctfile)
961 if test -z "$OCTAVE"; then
962 AC_MSG_WARN([octave not found, disabling octave wrappers])
965 if test -z "$MKOCTFILE"; then
966 AC_MSG_WARN([mkoctfile not found, disabling octave wrappers])
969 OCTAVE_INCFLAGS=`$MKOCTFILE -p INCFLAGS`
970 AC_SUBST(OCTAVE_INCFLAGS,[$OCTAVE_INCFLAGS])
972 if test x"$with_octave" = "xyes"; then
973 # check that octave version is at least 2.9.12
974 cat > conftest.m <<'EOF'
975 [[a,b,c]]=sscanf([[version()," "]],"%i.%i.%i","C");
976 exit(sum([[a,b,c]].*[[1e5,1e3,1]])<209012)
978 $OCTAVE --no-init-file conftest.m >& /dev/null || with_octave="no";
981 if test x"$with_octave" = "xno"; then
982 AC_MSG_WARN([Octave version < 2.9.12, disabling octave wrappers])
985 if test x"$with_octave" = "xyes"; then
986 # if not explicitly forbidden, check for swig also
987 if test x"$with_swig" = "xauto"; then
991 # check that we have octave headers
992 OLD_CPPFLAGS=$CPPFLAGS
993 CPPFLAGS="$CPPFLAGS -x c++ $OCTAVE_INCFLAGS"
994 AC_CHECK_HEADER(octave/oct.h,
997 AC_MSG_WARN([Octave headers not found, disabling octave wrappers])
1001 # restore the old CPPFLAGS
1002 CPPFLAGS=$OLD_CPPFLAGS
1005 AC_MSG_CHECKING([for Octave arch])
1006 OCTAVE_ARCH=`$OCTAVE -q --eval 'strcat(octave_config_info("canonical_host_type"), "-", octave_config_info("api_version"))'|sed -e 's/ans = //'`
1007 AC_MSG_RESULT([$OCTAVE_ARCH])
1008 AC_SUBST(OCTAVE_ARCH,[$OCTAVE_ARCH])
1011 # check if ./configure arguments are valid
1012 if test x"$with_octave" = "xno"; then
1015 # if we get here then --with-octave was not called with 'yes','no' or 'auto'
1016 AC_MSG_WARN([unexpected arguments for option --with-octave, continuing assuming 'no'])
1020 AM_CONDITIONAL([BUILD_OCTAVE_WRAPPERS], [test x"$have_octave" = "xyes"])
1022 # check for swig itself
1024 if test x"$with_swig" = "xyes"; then
1025 AC_MSG_NOTICE([Checking for SWIG])
1027 # Python 2.5 requires SWIG >= 1.3.30
1028 AM_PYTHON_CHECK_VERSION( [2.5], have_python25=yes, have_python25=no )
1029 if test x"$have_python25" = "xyes" ; then
1030 AC_PATH_SWIG([1.3.30])
1032 AC_PATH_SWIG([1.2.24])
1036 if test -n "$SWIG"; then
1038 SWIG_MULTI_MODULE_SUPPORT()
1040 # if octave wrappers are enabled, check that swig supports octave
1041 if test x"$with_octave" = "xyes"; then
1042 AC_MSG_CHECKING([if SWIG supports Octave])
1043 cat > conftest.i <<EOF
1046 $SWIG -c++ -octave conftest.i || AC_MSG_ERROR(SWIG doesn't support Octave modules)
1047 AC_MSG_RESULT([yes])
1050 # specify the flags for swig
1051 AC_SUBST([SWIG_OCTAVE_OPT], "-octave")
1055 # check for swig python library
1059 if test x"$have_python25" = "xyes"; then
1060 AC_MSG_WARN([Python Version >= 2.5 requires SWIG >= 1.3.30])
1065 if test x"$with_swig" = "xno"; then
1068 if test x"$with_swig" = "xauto"; then
1069 # no (python) wrapper will be generated
1070 # we don't need to check for SWIG
1073 # if we get here then --with-swig was not called with 'yes','no' or 'auto'
1074 AC_MSG_WARN([unexpected arguments for option --with-swig, continuing assuming 'no'])
1079 AM_CONDITIONAL([UPDATE_SWIG_WRAPPERS], [test x"$have_swig" = "xyes"])
1083 AC_CONFIG_FILES([Makefile
1092 interfaces/swig/Makefile
1093 interfaces/swig/filtered/Makefile
1094 interfaces/swig/general/Makefile
1095 interfaces/swig/python/Makefile
1096 interfaces/swig/octave/Makefile
1105 General configuration ================================================
1109 CPPFLAGS: ${CPPFLAGS}
1110 CXXFLAGS: ${CXXFLAGS}
1113 Install path: ${prefix}
1115 Debug flags ${DEBUG_CPPFLAGS} ${DEBUG_CXXFLAGS}
1116 Optimization flags ${OPTIMIZATION_CPPFLAGS} ${OPTIMIZATION_CXXFLAGS}
1117 MMX/SSE/SSE2/SSE3: ${SIMD_FLAGS}
1118 OpenMP support: ${OPENMP_CXXFLAGS}
1119 External BLAS & LAPACK: ${have_native_lapack}
1121 HighGUI configuration ================================================
1123 Windowing system --------------
1124 Use Carbon / Mac OS X: ${have_carbon}
1125 Use gtk+ 2.x: ${have_gtk}
1126 Use gthread: ${have_gthread}
1128 Image I/O ---------------------
1129 Use ImageIO / Mac OS X: ${have_imageio}
1130 Use libjpeg: ${have_jpeg}
1131 Use zlib: ${have_zlib}
1132 Use libpng: ${have_png}
1133 Use libtiff: ${have_tiff}
1134 Use libjasper: ${have_jasper}
1135 Use libIlmImf/OpenEXR: ${have_ilmimf}
1137 Video I/O ---------------------
1138 Use QuickTime / Mac OS X: ${have_quicktime}
1139 Use xine: ${have_xine}
1140 Use gstreamer: ${have_gstreamer}
1141 Use ffmpeg: ${have_ffmpeg}
1142 Use dc1394 & raw1394: ${have_dc1394}
1143 Use dc1394_v2 & raw1394: ${have_dc1394_2}
1144 Use v4l: ${have_v4l}
1145 Use v4l2: ${have_v4l2}
1146 Use unicap: ${have_unicap}
1148 Wrappers for other languages =========================================
1151 Python ${have_python}
1152 Octave ${have_octave}
1154 Additional build settings ============================================
1156 Build demo apps ${enable_apps}
1161 if test x"$have_xine" = "xyes"; then
1163 ATTENTION: highgui will be built with xine support,
1164 thus it will be a subject to GNU Public License])