# Process this file with autoconf to produce a configure script.
# Set various version strings
m4_define([opencv_major_version], [1])
m4_define([opencv_minor_version], [1])
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], [2:0:0])
# init autotools
AC_PREREQ(2.60)
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 'gly 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
# checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LIBTOOL
# AC_SUBST(LD)
# AC_SUBST(CXXLD)
######################################################################
# 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]])],
[debug=$enableval],
[debug=no])
# 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([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])
######################################################################
# getting the code to compile
# cure annoying default arguments for CFLAGS and CXXFLAGS
# that autoconf automatically sets in GNU environments if
# no CFLAGS or CXXFLAGS were manually given
if test x"$CFLAGS" = "x-g -O2" ; then
CFLAGS=""
fi
if test x"$CXXFLAGS" = "x-g -O2" ; then
CXXFLAGS=""
fi
# set the default c++ flags for all the compilations
# we don't append CXXFLAGS, because it's done at compile time
# see http://www.gnu.org/software/libtool/manual/automake/Flag-Variables-Ordering.html
# for more information
DEFAULT_CXXFLAGS=""
######################################################################
# SSE2 support
AC_ARG_ENABLE([sse2],
[AS_HELP_STRING([--enable-sse2],[enable SSE2 intrinsics [yes]])],
[sse2=$enableval],
[sse2=yes])
if test x"$sse2" = "xyes"; then
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
case $target in
i*86-apple-* | i686-*-* | amd64-*-* | x86_64-*-*)
DEFAULT_CXXFLAGS=" -msse2 $DEFAULT_CXXFLAGS"
;;
*-*-*)
;;
esac
fi
fi
######################################################################
# OpenMP support
AC_MSG_CHECKING(for OpenMP support)
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <omp.h>
void f(int* a, int* b, int n) {
int i;
#pragma parallel for
for(i = 0; i < n; i++)
a[i] += b[i];
}
]])],
[have_openmp=yes],
[have_openmp=no])
# 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 --enable-openmp=yes
have_openmp=no
AC_MSG_RESULT($have_openmp)
AC_ARG_ENABLE([openmp],
[AS_HELP_STRING([--enable-openmp],[enable OpenMP threading [automatic]])],
[openmp=$enableval],
[openmp=$have_openmp])
if test x"$openmp" = "xyes"; then
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
DEFAULT_CXXFLAGS=" -fopenmp $DEFAULT_CXXFLAGS"
AC_CHECK_LIB(gomp,omp_get_num_threads)
fi
fi
# see if the user wants aggressive optimizations of the code,
# check whether to include debugging code
AC_MSG_CHECKING([whether to build debug version (no optimization)])
if test x"$debug" = "xyes"; then
AC_MSG_RESULT([yes])
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
CPPFLAGS="-DDEBUG -D_DEBUG $CPPFLAGS"
DEFAULT_CXXFLAGS="-ggdb -O0 $DEFAULT_CXXFLAGS"
fi
else
AC_MSG_RESULT([no])
AC_MSG_NOTICE( TARGET=$target )
case $target in
i*86-apple-*)
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
# apples g++ fails with '-march=i686' and there are no apple machines older than prescott/core anyway
DEFAULT_CXXFLAGS="-g -march=prescott -ffast-math -fomit-frame-pointer $DEFAULT_CXXFLAGS"
fi
;;
i686-*-*)
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
# default to i686/pentiumpro -- people can override this
DEFAULT_CXXFLAGS="-g -march=i686 -ffast-math -fomit-frame-pointer $DEFAULT_CXXFLAGS"
fi
;;
amd64-*-* | x86_64-*-*)
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
# default to i686/pentiumpro -- people can override this
DEFAULT_CXXFLAGS="-g $DEFAULT_CXXFLAGS"
fi
;;
powerpc-*-*)
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
# default to G3 processors -- people can override this
DEFAULT_CXXFLAGS="-g -mcpu=G3 -mtune=G5 -fomit-frame-pointer $DEFAULT_CXXFLAGS"
fi
;;
*-*-*)
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
DEFAULT_CXXFLAGS="-fomit-frame-pointer $DEFAULT_CXXFLAGS"
fi
;;
esac
CPPFLAGS="-DNDEBUG $CPPFLAGS"
DEFAULT_CXXFLAGS="-O3 $DEFAULT_CXXFLAGS"
fi
if test x"$ac_cv_c_compiler_gnu" = "xyes"; then
PY_CXXFLAGS="-Wall -pipe $DEFAULT_CXXFLAGS"
OCT_CXXFLAGS="-fno-strict-aliasing -Wall -Wno-uninitialized -pipe $DEFAULT_CXXFLAGS"
DEF_CXXFLAGS="-Wall -fno-rtti -pipe $DEFAULT_CXXFLAGS"
else
PY_CXXFLAGS="$DEFAULT_CXXFLAGS"
OCT_CXXFLAGS="$DEFAULT_CXXFLAGS"
DEF_CXXFLAGS="$DEFAULT_CXXFLAGS"
fi
AC_SUBST(PY_CXXFLAGS)
AC_SUBST(OCT_CXXFLAGS)
AC_SUBST(DEF_CXXFLAGS)
# add libm because it is used by several libraries and OpenCV itself
AC_CHECK_LIB(m,pow)
AC_CHECK_LIB(dl,dlopen)
AC_CHECK_LIB(pthread,pthread_create)
# 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)
######################################################################
# 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" == "xno"; then
AC_MSG_ERROR([You have to install pkg-config to compile OpenCV with GTK+])
fi
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 ])
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
# 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_HEADER(ffmpeg/avcodec.h,
AC_SEARCH_LIBS([avcodec_decode_video],[avcodec_pic avcodec], [
AC_SEARCH_LIBS([av_open_input_file], [avformat_pic avformat],
[
have_ffmpeg=yes
AC_DEFINE(HAVE_FFMPEG,,[FFMpeg video library])
FFMPEGLIBS="-lavcodec -lavformat"
],
[ have_ffmpeg=no ],
[-lavcodec])
],
[ have_ffmpeg=no ]),
[ have_ffmpeg=no ])
AC_CHECK_HEADER([ffmpeg/swscale.h],
AC_CHECK_LIB(swscale,sws_getContext,
[
AC_DEFINE(HAVE_FFMPEG_SWSCALE,,[ffmpeg's libswscale])
FFMPEG_SWSCALE_LIBS="-lswscale"
]))
FFMPEGLIBS="$FFMPEGLIBS $FFMPEG_SWSCALE_LIBS"
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
# 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
AC_CHECK_HEADER(libraw1394/raw1394.h,
AC_CHECK_LIB(raw1394, raw1394_new_handle,
[
have_raw1394=yes
LIBS="-lm -lraw1394 $LIBS"
]))
if test x"$have_raw1394" = "xyes"; 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="-lm -lraw1394 -ldc1394_control"
]))
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"])
# 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>
]])
PKG_CHECK_MODULES(LIBV4L, libv4l1 libv4l2)
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 -lm"
LIBS="$LIBS -lz -lm"
]))
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
])
# restore the old CPPFLAGS
CPPFLAGS=$OLD_CPPFLAGS
# find Octave arch
AC_MSG_CHECKING([for Octave arch])
OCTAVE_ARCH=`$OCTAVE -q --eval 'strcat(octave_config_info("canonical_host_type"), "-", octave_config_info("api_version"))'|sed -e 's/ans = //'`
AC_MSG_RESULT([$OCTAVE_ARCH])
AC_SUBST(OCTAVE_ARCH,[$OCTAVE_ARCH])
else
# check if ./configure arguments are valid
if test x"$with_octave" = "xno"; then
have_octave=no
else
# if we get here then --with-octave was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-octave, continuing assuming 'no'])
have_octave=no
fi
fi
AM_CONDITIONAL([BUILD_OCTAVE_WRAPPERS], [test x"$have_octave" = "xyes"])
# check for swig itself
SWIG=""
if test x"$with_swig" = "xyes"; then
AC_MSG_NOTICE([Checking for SWIG])
# Python 2.5 requires SWIG >= 1.3.30
AM_PYTHON_CHECK_VERSION( [2.5], have_python25=yes, have_python25=no )
if test x"$have_python25" = "xyes" ; then
AC_PATH_SWIG([1.3.30])
else
AC_PATH_SWIG([1.2.24])
fi
if test -n "$SWIG"; then
SWIG_ENABLE_CXX()
SWIG_MULTI_MODULE_SUPPORT()
# if octave wrappers are enabled, check that swig supports octave
if test x"$with_octave" = "xyes"; then
AC_MSG_CHECKING([if SWIG supports Octave])
cat > conftest.i <<EOF
%module conftest
EOF
$SWIG -c++ -octave conftest.i || AC_MSG_ERROR(SWIG doesn't support Octave modules)
AC_MSG_RESULT([yes])
rm -f conftest.*
# specify the flags for swig
AC_SUBST([SWIG_OCTAVE_OPT], "-octave")
fi
# check for swig python library
SWIG_PYTHON()
have_swig=yes
else
if test x"$have_python25" = "xyes"; then
AC_MSG_WARN([Python Version >= 2.5 requires SWIG >= 1.3.30])
fi
have_swig=no
fi
else
if test x"$with_swig" = "xno"; then
have_swig=no
else
if test x"$with_swig" = "xauto"; then
# no (python) wrapper will be generated
# we don't need to check for SWIG
have_swig=no
else
# if we get here then --with-swig was not called with 'yes','no' or 'auto'
AC_MSG_WARN([unexpected arguments for option --with-swig, continuing assuming 'no'])
have_swig=no
fi
fi
fi
AM_CONDITIONAL([UPDATE_SWIG_WRAPPERS], [test x"$have_swig" = "xyes"])
######################################################################
# Parallelization
#
#CXXOPENMP="no"
#
#AC_ARG_WITH(openmp, dnl
# [--with-openmp=COMPILER use OpenMP supporting compiler [default=no] ],
# [CXXOPENMP="$withval"],[CXXOPENMP="no"])
#if test "$CXXOPENMP" = "no"; then
# CXXOPENMP="$CXX"
#fi
#
#AC_SUBST(CXXOPENMP)
AC_SUBST(DEBUG)
AC_CONFIG_FILES([Makefile
opencv.pc
opencv.spec
docs/Makefile
data/Makefile
cxcore/Makefile
cxcore/include/Makefile
cxcore/src/Makefile
cv/Makefile
cv/include/Makefile
cv/src/Makefile
cvaux/Makefile
cvaux/include/Makefile
cvaux/src/Makefile
ml/Makefile
ml/include/Makefile
ml/src/Makefile
otherlibs/Makefile
otherlibs/highgui/Makefile
apps/Makefile
apps/haartraining/Makefile
apps/haartraining/include/Makefile
apps/haartraining/src/Makefile
interfaces/Makefile
interfaces/swig/Makefile
interfaces/swig/filtered/Makefile
interfaces/swig/general/Makefile
interfaces/swig/python/Makefile
interfaces/swig/octave/Makefile
tests/Makefile
tests/python/Makefile
tests/octave/Makefile
tests/cv/Makefile
tests/cv/src/Makefile
tests/cxts/Makefile
tests/cxcore/Makefile
tests/cxcore/src/Makefile
utils/Makefile
samples/Makefile
samples/c/Makefile
samples/python/Makefile
samples/octave/Makefile
])
AC_OUTPUT
AC_MSG_RESULT([
General configuration ================================================
Compiler: ${CXX}
CXXFLAGS: ${CXXFLAGS}
DEF_CXXFLAGS: ${DEF_CXXFLAGS}
PY_CXXFLAGS: ${PY_CXXFLAGS}
OCT_CXXFLAGS: ${OCT_CXXFLAGS}
Install path: ${prefix}
HighGUI configuration ================================================
Windowing system --------------
Use Carbon / Mac OS X: ${have_carbon}
Use gtk+ 2.x: ${have_gtk}
Use gthread: ${have_gthread}
Image I/O ---------------------
Use ImageIO / Mac OS X: ${have_imageio}
Use libjpeg: ${have_jpeg}
Use zlib: ${have_zlib}
Use libpng: ${have_png}
Use libtiff: ${have_tiff}
Use libjasper: ${have_jasper}
Use libIlmImf: ${have_ilmimf}
Video I/O ---------------------
Use QuickTime / Mac OS X: ${have_quicktime}
Use xine: ${have_xine}
Use gstreamer: ${have_gstreamer}
Use ffmpeg: ${have_ffmpeg}
Use dc1394 & raw1394: ${have_dc1394}
Use v4l: ${have_v4l}
Use v4l2: ${have_v4l2}
Use unicap: ${have_unicap}
Wrappers for other languages =========================================
SWIG ${SWIG}
Python ${have_python}
Octave ${have_octave}
Additional build settings ============================================
Build demo apps ${enable_apps}
Now run make ...
])
if test x"$have_xine" = "xyes"; then
AC_MSG_NOTICE([
ATTENTION: highgui will be built with xine support,
thus it will be a subject to GNU Public License])
fi