<commit_before>dnl config.m4 for extension hoedown

dnl Check PHP version:
AC_MSG_CHECKING(PHP version)
if test ! -z "$phpincludedir"; then
    PHP_VERSION=`grep 'PHP_VERSION ' $phpincludedir/main/php_version.h | sed -e 's/.*"\([[0-9\.]]*\)".*/\1/g' 2>/dev/null`
elif test ! -z "$PHP_CONFIG"; then
    PHP_VERSION=`$PHP_CONFIG --version 2>/dev/null`
fi

if test x"$PHP_VERSION" = "x"; then
    AC_MSG_WARN([none])
else
    PHP_MAJOR_VERSION=`echo $PHP_VERSION | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/g' 2>/dev/null`
    PHP_MINOR_VERSION=`echo $PHP_VERSION | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/g' 2>/dev/null`
    PHP_RELEASE_VERSION=`echo $PHP_VERSION | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/g' 2>/dev/null`
    AC_MSG_RESULT([$PHP_VERSION])
fi

if test $PHP_MAJOR_VERSION -lt 5; then
   AC_MSG_ERROR([need at least PHP 5.4 or newer])
fi

if test $PHP_MAJOR_VERSION -eq 5 -a $PHP_MINOR_VERSION -lt 4; then
    AC_MSG_ERROR([need at least PHP 5.4 or newer])
fi

dnl Hoedown Extension
PHP_ARG_ENABLE(hoedown, whether to enable hoedown support,
[  --enable-hoedown      Enable hoedown support])

if test "$PHP_HOEDOWN" != "no"; then

    dnl check HOEDOWN_VERSION_EXTRAS
    AC_TRY_LINK(
        [
            #include "hoedown/src/version.h"
        ],[
            int extras = HOEDOWN_VERSION_EXTRAS;
        ],[
            AC_MSG_RESULT(yes)
        ],[
            AC_MSG_RESULT([error])
            AC_MSG_ERROR([wrong hoedown lib extras version not found])
        ])

    dnl Source hoedown
    HOEDOWN_SOURCE="hoedown/src/autolink.c hoedown/src/escape.c hoedown/src/html_smartypants.c hoedown/src/buffer.c hoedown/src/html.c hoedown/src/stack.c hoedown/src/document.c hoedown/src/html_blocks.c hoedown/src/hash.c hoedown/src/version.c"

    dnl PHP Extension
    PHP_NEW_EXTENSION(hoedown, hoedown.c $HOEDOWN_SOURCE, $ext_shared)
fi<commit_msg>Fixed build PHP 5.3: config.m4<commit_after>dnl config.m4 for extension hoedown

dnl Check PHP version:
AC_MSG_CHECKING(PHP version)
if test ! -z "$phpincludedir"; then
    PHP_VERSION=`grep 'PHP_VERSION ' $phpincludedir/main/php_version.h | sed -e 's/.*"\([[0-9\.]]*\)".*/\1/g' 2>/dev/null`
elif test ! -z "$PHP_CONFIG"; then
    PHP_VERSION=`$PHP_CONFIG --version 2>/dev/null`
fi

if test x"$PHP_VERSION" = "x"; then
    AC_MSG_WARN([none])
else
    PHP_MAJOR_VERSION=`echo $PHP_VERSION | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/g' 2>/dev/null`
    PHP_MINOR_VERSION=`echo $PHP_VERSION | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/g' 2>/dev/null`
    PHP_RELEASE_VERSION=`echo $PHP_VERSION | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/g' 2>/dev/null`
    AC_MSG_RESULT([$PHP_VERSION])
fi

if test $PHP_MAJOR_VERSION -lt 5; then
   AC_MSG_ERROR([need at least PHP 5.3 or newer])
fi

if test $PHP_MAJOR_VERSION -eq 5 -a $PHP_MINOR_VERSION -lt 3; then
    AC_MSG_ERROR([need at least PHP 5.3 or newer])
fi

dnl Hoedown Extension
PHP_ARG_ENABLE(hoedown, whether to enable hoedown support,
[  --enable-hoedown      Enable hoedown support])

if test "$PHP_HOEDOWN" != "no"; then

    dnl check HOEDOWN_VERSION_EXTRAS
    AC_TRY_LINK(
        [
            #include "hoedown/src/version.h"
        ],[
            int extras = HOEDOWN_VERSION_EXTRAS;
        ],[
            AC_MSG_RESULT(yes)
        ],[
            AC_MSG_RESULT([error])
            AC_MSG_ERROR([wrong hoedown lib extras version not found])
        ])

    dnl Source hoedown
    HOEDOWN_SOURCE="hoedown/src/autolink.c hoedown/src/escape.c hoedown/src/html_smartypants.c hoedown/src/buffer.c hoedown/src/html.c hoedown/src/stack.c hoedown/src/document.c hoedown/src/html_blocks.c hoedown/src/hash.c hoedown/src/version.c"

    dnl PHP Extension
    PHP_NEW_EXTENSION(hoedown, hoedown.c $HOEDOWN_SOURCE, $ext_shared)
fi
{'fraction_non_alphanumeric': 0.17913950456323338, 'fraction_numerical': 0.020078226857887876, 'mean_word_length': 3.0765143464399576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6011118', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1534, 'n_words': 299}