1PHP_ARG_WITH(facedetect, for facedetect support, [  --with-facedetect     Enable facedetect support])
2
3if test "$PHP_FACEDETECT" != "no"; then
4  PHP_REQUIRE_CXX()
5  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
6  AC_MSG_CHECKING(for opencv)
7  if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists opencv; then
8    CV_INCLUDE=`$PKG_CONFIG opencv --variable=includedir_new`
9    CV_LIBRARY=`$PKG_CONFIG opencv --libs`
10    CV_VERSION=`$PKG_CONFIG opencv --modversion`
11    if $PKG_CONFIG opencv --atleast-version=3.0.0 ; then
12      AC_MSG_RESULT($CV_VERSION)
13    else
14      AC_MSG_ERROR(opencv version is too old.)
15    fi
16    PHP_EVAL_LIBLINE($CV_LIBRARY, FACEDETECT_SHARED_LIBADD)
17    PHP_ADD_INCLUDE($CV_INCLUDE)
18  else
19    if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists opencv4; then
20      CV_INCLUDE=`$PKG_CONFIG opencv4 --variable=includedir`
21      CV_LIBRARY=`$PKG_CONFIG opencv4 --libs`
22      CV_VERSION=`$PKG_CONFIG opencv4 --modversion`
23      if $PKG_CONFIG opencv4 --atleast-version=3.0.0 ; then
24        AC_MSG_RESULT($CV_VERSION)
25      else
26        AC_MSG_ERROR(opencv version is too old)
27      fi
28      PHP_EVAL_LIBLINE($CV_LIBRARY, FACEDETECT_SHARED_LIBADD)
29      PHP_ADD_INCLUDE($CV_INCLUDE)
30    else
31      AC_MSG_ERROR(Please reinstall opencv)
32    fi
33  fi
34
35  PHP_SUBST(FACEDETECT_SHARED_LIBADD)
36  AC_DEFINE(HAVE_FACEDETECT, 1, [ ])
37  PHP_NEW_EXTENSION(facedetect, facedetect.cc, $ext_shared)
38fi
39