+# check for octave
+if test x"$with_octave" = "xyes"; then
+ { echo "$as_me:$LINENO: Checking for necessary tools to build octave wrappers" >&5
+echo "$as_me: Checking for necessary tools to build octave wrappers" >&6;}
+
+ # find octave and mkoctfile
+ # Extract the first word of "octave", so it can be a program name with args.
+set dummy octave; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_OCTAVE+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $OCTAVE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_OCTAVE="$OCTAVE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_OCTAVE="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+OCTAVE=$ac_cv_path_OCTAVE
+if test -n "$OCTAVE"; then
+ { echo "$as_me:$LINENO: result: $OCTAVE" >&5
+echo "${ECHO_T}$OCTAVE" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ # Extract the first word of "mkoctfile", so it can be a program name with args.
+set dummy mkoctfile; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_MKOCTFILE+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MKOCTFILE in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MKOCTFILE="$MKOCTFILE" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_MKOCTFILE="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+MKOCTFILE=$ac_cv_path_MKOCTFILE
+if test -n "$MKOCTFILE"; then
+ { echo "$as_me:$LINENO: result: $MKOCTFILE" >&5
+echo "${ECHO_T}$MKOCTFILE" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+
+ if test -z "$OCTAVE"; then
+ { echo "$as_me:$LINENO: WARNING: octave not found, disabling octave wrappers" >&5
+echo "$as_me: WARNING: octave not found, disabling octave wrappers" >&2;}
+ with_octave=no
+ fi
+ if test -z "$MKOCTFILE"; then
+ { echo "$as_me:$LINENO: WARNING: mkoctfile not found, disabling octave wrappers" >&5
+echo "$as_me: WARNING: mkoctfile not found, disabling octave wrappers" >&2;}
+ with_octave=no
+ fi
+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
+ { echo "$as_me:$LINENO: WARNING: Octave version < 2.9.12, disabling octave wrappers" >&5
+echo "$as_me: WARNING: Octave version < 2.9.12, disabling octave wrappers" >&2;}
+ 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++"
+ if test "${ac_cv_header_octave_oct_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for octave/oct.h" >&5
+echo $ECHO_N "checking for octave/oct.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_octave_oct_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_octave_oct_h" >&5
+echo "${ECHO_T}$ac_cv_header_octave_oct_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking octave/oct.h usability" >&5
+echo $ECHO_N "checking octave/oct.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <octave/oct.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking octave/oct.h presence" >&5
+echo $ECHO_N "checking octave/oct.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <octave/oct.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: octave/oct.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: octave/oct.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: octave/oct.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: octave/oct.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: octave/oct.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: octave/oct.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: octave/oct.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: octave/oct.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: octave/oct.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: octave/oct.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: octave/oct.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: octave/oct.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: octave/oct.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: octave/oct.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: octave/oct.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: octave/oct.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## -------------------------------------------------------- ##
+## Report this to opencvlibrary-devel@lists.sourceforge.net ##
+## -------------------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for octave/oct.h" >&5
+echo $ECHO_N "checking for octave/oct.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_octave_oct_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_octave_oct_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_octave_oct_h" >&5
+echo "${ECHO_T}$ac_cv_header_octave_oct_h" >&6; }
+
+fi
+if test $ac_cv_header_octave_oct_h = yes; then
+ have_octave=yes
+else
+
+ { echo "$as_me:$LINENO: WARNING: Octave headers not found, disabling octave wrappers" >&5
+echo "$as_me: WARNING: Octave headers not found, disabling octave wrappers" >&2;}
+ have_octave=no
+
+fi
+
+
+
+ # restore the old CPPFLAGS
+ CPPFLAGS=$OLD_CPPFLAGS
+
+ # find Octave arch
+ { echo "$as_me:$LINENO: checking for Octave arch" >&5
+echo $ECHO_N "checking for Octave arch... $ECHO_C" >&6; }
+ OCTAVE_ARCH=`$OCTAVE -q --eval 'strcat(octave_config_info("canonical_host_type"), "-", octave_config_info("api_version"))'|sed -e 's/ans = //'`
+ { echo "$as_me:$LINENO: result: $OCTAVE_ARCH" >&5
+echo "${ECHO_T}$OCTAVE_ARCH" >&6; }
+ 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'
+ { echo "$as_me:$LINENO: WARNING: unexpected arguments for option --with-octave, continuing assuming 'no'" >&5
+echo "$as_me: WARNING: unexpected arguments for option --with-octave, continuing assuming 'no'" >&2;}
+ have_octave=no
+ fi
+fi
+ if test x"$have_octave" = "xyes"; then
+ BUILD_OCTAVE_WRAPPERS_TRUE=
+ BUILD_OCTAVE_WRAPPERS_FALSE='#'
+else
+ BUILD_OCTAVE_WRAPPERS_TRUE='#'
+ BUILD_OCTAVE_WRAPPERS_FALSE=
+fi
+
+