<commit_before>PHP_ARG_WITH(facedetect, for facedetect support, [  --with-facedetect     Enable facedetect support])

if test "$PHP_FACEDETECT" != "no"; then
  SEARCH_PATH="/usr/local /usr /opt/local"
  SEARCH_FOR="/include/opencv2/core/core_c.h"

  if test -r $PHP_FACEDETECT/$SEARCH_FOR; then
    FACEDETECT_DIR=$PHP_FACEDETECT
  else
    AC_MSG_CHECKING([for facedetect in default path])
    for i in $SEARCH_PATH ; do
      if test -r $i/$SEARCH_FOR; then
        FACEDETECT_DIR=$i
        AC_MSG_RESULT(found in $i)
	break
      fi
    done
  fi

  if test -z "$FACEDETECT_DIR"; then
    AC_MSG_RESULT([not found])
    AC_MSG_ERROR([Please reinstall the OpenCV distribution])
  fi

  PHP_ADD_INCLUDE($FACEDETECT_DIR/include)

  AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv2/core/core_c.h], [], AC_MSG_ERROR('opencv/core/core_c.h' header not found))
  AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv2/imgproc/imgproc_c.h], [], AC_MSG_ERROR('opencv/imgproc/imgproc_c.h' header not found))
  AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv2/photo/photo_c.h], [], AC_MSG_ERROR('opencv/photo/photo_c.h' header not found))
  AC_CHECK_HEADER([$FACEDETECT_DIR/include/opencv2/objdetect/objdetect_c.h], [], AC_MSG_ERROR('opencv/objdetect/objdetect_c.h' header not found))

  PHP_CHECK_LIBRARY(opencv_core, cvLoad,
  [
    PHP_ADD_LIBRARY_WITH_PATH(opencv_core, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD)
    PHP_CHECK_LIBRARY(opencv_objdetect, cvHaarDetectObjects,
    [
      PHP_ADD_LIBRARY_WITH_PATH(opencv_objdetect, $FACEDETECT_DIR/lib, FACEDETECT_SHARED_LIBADD)
      AC_DEFINE(HAVE_FACEDETECT, 1, [ ])
    ],[
      AC_MSG_ERROR([Wrong OpenCV version or OpenCV not found]) 
      ],[
    ])
  ],[
    AC_MSG_ERROR([wrong OpenCV version or OpenCV not found])
  ],[
  ])

  PHP_SUBST(FACEDETECT_SHARED_LIBADD)
  AC_DEFINE(HAVE_FACEDETECT, 1, [ ])
  PHP_NEW_EXTENSION(facedetect, facedetect.c, $ext_shared)
fi
<commit_msg>retrieve opencv build options from pkg_config<commit_after>PHP_ARG_WITH(facedetect, for facedetect support, [  --with-facedetect     Enable facedetect support])

if test "$PHP_FACEDETECT" != "no"; then
  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  AC_MSG_CHECKING(for opencv)
  if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists opencv; then
    CV_INCLUDE=`$PKG_CONFIG opencv --variable=includedir_new`
    CV_LIBRARY=`$PKG_CONFIG opencv --libs`
    CV_VERSION=`$PKG_CONFIG opencv --modversion`
    if $PKG_CONFIG opencv --atleast-version=2.2.0 ; then
      AC_MSG_RESULT($CV_VERSION)
    else
      AC_MSG_ERROR(opencv version is too old)
    fi
    PHP_EVAL_LIBLINE($CV_LIBRARY, FACEDETECT_SHARED_LIBADD)
    PHP_ADD_INCLUDE($CV_INCLUDE)
  else
    AC_MSG_ERROR(Please reinstall opencv)
  fi

  PHP_SUBST(FACEDETECT_SHARED_LIBADD)
  AC_DEFINE(HAVE_FACEDETECT, 1, [ ])
  PHP_NEW_EXTENSION(facedetect, facedetect.c, $ext_shared)
fi

{'fraction_non_alphanumeric': 0.11052815669814621, 'fraction_numerical': 0.0038474991255683807, 'mean_word_length': 4.6521739130434785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '278859', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1132, 'n_words': 182}