<commit_before>dnl
dnl SC acinclude.m4 - custom macros
dnl

dnl Documentation for macro names: brackets indicate optional arguments

dnl SC_ARG_ENABLE_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --enable/disable-NAME using shell variable PREFIX_ENABLE_TOKEN
dnl If enabled, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is disabled
dnl
AC_DEFUN([SC_ARG_ENABLE_PREFIX],
[
AC_ARG_ENABLE([$1], [AS_HELP_STRING([--enable-$1], [$2])],
              [$4_ENABLE_$3="$enableval"], [$4_ENABLE_$3="no"])
if test "$$4_ENABLE_$3" != "no" ; then
  AC_DEFINE([$3], 1, [$2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_ENABLE_$3" != "no"])
])
AC_DEFUN([SC_ARG_ENABLE], [SC_ARG_ENABLE_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_DISABLE_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --enable/disable-NAME using shell variable PREFIX_ENABLE_TOKEN
dnl If enabled, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is enabled
dnl
AC_DEFUN([SC_ARG_DISABLE_PREFIX],
[
AC_ARG_ENABLE([$1], [AS_HELP_STRING([--disable-$1], [$2])],
              [$4_ENABLE_$3="$enableval"], [$4_ENABLE_$3="yes"])
if test "$$4_ENABLE_$3" != "no" ; then
  AC_DEFINE([$3], 1, [Undefine if: $2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_ENABLE_$3" != "no"])
])
AC_DEFUN([SC_ARG_DISABLE], [SC_ARG_DISABLE_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_WITH_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --with/without-NAME using shell variable PREFIX_WITH_TOKEN
dnl If with, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is without
dnl
AC_DEFUN([SC_ARG_WITH_PREFIX],
[
AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])],
            [$4_WITH_$3="$withval"], [$4_WITH_$3="no"])
if test "$$4_WITH_$3" != "no" ; then
  AC_DEFINE([$3], 1, [$2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_WITH_$3" != "no"])
])
AC_DEFUN([SC_ARG_WITH], [SC_ARG_WITH_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_WITHOUT_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --with/without-NAME using shell variable PREFIX_WITH_TOKEN
dnl If with, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is with
dnl
AC_DEFUN([SC_ARG_WITHOUT_PREFIX],
[
AC_ARG_WITH([$1], [AS_HELP_STRING([--without-$1], [$2])],
            [$4_WITH_$3="$withval"], [$4_WITH_$3="yes"])
if test "$$4_WITH_$3" != "no" ; then
  AC_DEFINE([$3], 1, [Undefine if: $2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_WITH_$3" != "no"])
])
AC_DEFUN([SC_ARG_WITHOUT], [SC_ARG_WITHOUT_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_WITH_YES_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --with/without-NAME using shell variable PREFIX_WITH_TOKEN
dnl If with = yes, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is no
dnl
AC_DEFUN([SC_ARG_WITH_YES_PREFIX],
[
AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])],
            [$4_WITH_$3="$withval"], [$4_WITH_$3="no"])
if test "$$4_WITH_$3" = "yes" ; then
  AC_DEFINE([$3], 1, [$2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_WITH_$3" = "yes"])
])
AC_DEFUN([SC_ARG_WITH_YES],
         [SC_ARG_WITH_YES_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_WITHOUT_YES_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --with/without-NAME using shell variable PREFIX_WITH_TOKEN
dnl If with = yes, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is yes
dnl
AC_DEFUN([SC_ARG_WITHOUT_YES_PREFIX],
[
AC_ARG_WITH([$1], [AS_HELP_STRING([--without-$1], [$2])],
            [$4_WITH_$3="$withval"], [$4_WITH_$3="yes"])
if test "$$4_WITH_$3" = "yes" ; then
  AC_DEFINE([$3], 1, [Undefine if: $2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_WITH_$3" = "yes"])
])
AC_DEFUN([SC_ARG_WITHOUT_YES],
         [SC_ARG_WITHOUT_YES_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_REQUIRE_LIB(LIBRARY, FUNCTION)
dnl Check for FUNCTION in LIBRARY, exit with error if not found
dnl
AC_DEFUN([SC_REQUIRE_LIB],
    [AC_CHECK_LIB([$1], [$2], ,
      [AC_MSG_ERROR([Could not find function $2 in library $1])])])

dnl SC_REQUIRE_LIB_SEARCH(LIBRARY LIST, FUNCTION)
dnl Check for FUNCTION in any of LIBRARY LIST, exit with error if not found
dnl
AC_DEFUN([SC_REQUIRE_LIB_SEARCH],
    [AC_SEARCH_LIBS([$2], [$1], ,
      [AC_MSG_ERROR([Could not find function $2 in any of $1])])])
<commit_msg>Enable configure option override by environment variable.<commit_after>dnl
dnl SC acinclude.m4 - custom macros
dnl

dnl Documentation for macro names: brackets indicate optional arguments

dnl SC_ARG_ENABLE_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --enable/disable-NAME using shell variable PREFIX_ENABLE_TOKEN
dnl If shell variable is set beforehand it overrides the option
dnl If enabled, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is disabled
dnl
AC_DEFUN([SC_ARG_ENABLE_PREFIX],
[
AC_ARG_ENABLE([$1], [AS_HELP_STRING([--enable-$1], [$2])],, [enableval="no"])
if test -z "$$4_ENABLE_$3" ; then
  $4_ENABLE_$3="$enableval"
else
  echo "Option override $4_ENABLE_$3=$$4_ENABLE_$3"
fi
if test "$$4_ENABLE_$3" != "no" ; then
  AC_DEFINE([$3], 1, [$2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_ENABLE_$3" != "no"])
])
AC_DEFUN([SC_ARG_ENABLE], [SC_ARG_ENABLE_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_DISABLE_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --enable/disable-NAME using shell variable PREFIX_ENABLE_TOKEN
dnl If shell variable is set beforehand it overrides the option
dnl If enabled, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is enabled
dnl
AC_DEFUN([SC_ARG_DISABLE_PREFIX],
[
AC_ARG_ENABLE([$1], [AS_HELP_STRING([--disable-$1], [$2])],, [enableval="yes"])
if test -z "$$4_ENABLE_$3" ; then
  $4_ENABLE_$3="$enableval"
else
  echo "Option override $4_ENABLE_$3=$$4_ENABLE_$3"
fi
if test "$$4_ENABLE_$3" != "no" ; then
  AC_DEFINE([$3], 1, [Undefine if: $2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_ENABLE_$3" != "no"])
])
AC_DEFUN([SC_ARG_DISABLE], [SC_ARG_DISABLE_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_WITH_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --with/without-NAME using shell variable PREFIX_WITH_TOKEN
dnl If shell variable is set beforehand it overrides the option
dnl If with, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is without
dnl
AC_DEFUN([SC_ARG_WITH_PREFIX],
[
AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])],, [withval="no"])
if test -z "$$4_WITH_$3" ; then
  $4_WITH_$3="$withval"
else
  echo "Option override $4_WITH_$3=$$4_WITH_$3"
fi
if test "$$4_WITH_$3" != "no" ; then
  AC_DEFINE([$3], 1, [$2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_WITH_$3" != "no"])
])
AC_DEFUN([SC_ARG_WITH], [SC_ARG_WITH_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_WITHOUT_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --with/without-NAME using shell variable PREFIX_WITH_TOKEN
dnl If shell variable is set beforehand it overrides the option
dnl If with, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is with
dnl
AC_DEFUN([SC_ARG_WITHOUT_PREFIX],
[
AC_ARG_WITH([$1], [AS_HELP_STRING([--without-$1], [$2])],, [withval="yes"])
if test -z "$$4_WITH_$3" ; then
  $4_WITH_$3="$withval"
else
  echo "Option override $4_WITH_$3=$$4_WITH_$3"
fi
if test "$$4_WITH_$3" != "no" ; then
  AC_DEFINE([$3], 1, [Undefine if: $2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_WITH_$3" != "no"])
])
AC_DEFUN([SC_ARG_WITHOUT], [SC_ARG_WITHOUT_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_WITH_YES_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --with/without-NAME using shell variable PREFIX_WITH_TOKEN
dnl If shell variable is set beforehand it overrides the option
dnl If with = yes, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is no
dnl
AC_DEFUN([SC_ARG_WITH_YES_PREFIX],
[
AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])],, [withval="no"])
if test -z "$$4_WITH_$3" ; then
  $4_WITH_$3="$withval"
else
  echo "Option override $4_WITH_$3=$$4_WITH_$3"
fi
if test "$$4_WITH_$3" = "yes" ; then
  AC_DEFINE([$3], 1, [$2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_WITH_$3" = "yes"])
])
AC_DEFUN([SC_ARG_WITH_YES],
         [SC_ARG_WITH_YES_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_ARG_WITHOUT_YES_PREFIX(NAME, COMMENT, TOKEN, PREFIX)
dnl Check for --with/without-NAME using shell variable PREFIX_WITH_TOKEN
dnl If shell variable is set beforehand it overrides the option
dnl If with = yes, define TOKEN to 1 and set conditional PREFIX_TOKEN
dnl Default is yes
dnl
AC_DEFUN([SC_ARG_WITHOUT_YES_PREFIX],
[
AC_ARG_WITH([$1], [AS_HELP_STRING([--without-$1], [$2])],, [withval="yes"])
if test -z "$$4_WITH_$3" ; then
  $4_WITH_$3="$withval"
else
  echo "Option override $4_WITH_$3=$$4_WITH_$3"
fi
if test "$$4_WITH_$3" = "yes" ; then
  AC_DEFINE([$3], 1, [Undefine if: $2])
fi
AM_CONDITIONAL([$4_$3], [test "$$4_WITH_$3" = "yes"])
])
AC_DEFUN([SC_ARG_WITHOUT_YES],
         [SC_ARG_WITHOUT_YES_PREFIX([$1], [$2], [$3], [SC])])

dnl SC_REQUIRE_LIB(LIBRARY, FUNCTION)
dnl Check for FUNCTION in LIBRARY, exit with error if not found
dnl
AC_DEFUN([SC_REQUIRE_LIB],
    [AC_CHECK_LIB([$1], [$2], ,
      [AC_MSG_ERROR([Could not find function $2 in library $1])])])

dnl SC_REQUIRE_LIB_SEARCH(LIBRARY LIST, FUNCTION)
dnl Check for FUNCTION in any of LIBRARY LIST, exit with error if not found
dnl
AC_DEFUN([SC_REQUIRE_LIB_SEARCH],
    [AC_SEARCH_LIBS([$2], [$1], ,
      [AC_MSG_ERROR([Could not find function $2 in any of $1])])])

{'fraction_non_alphanumeric': 0.17158671586715868, 'fraction_numerical': 0.030605600173648797, 'mean_word_length': 5.928571428571429, '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': '7420047', 'n_tokens_mistral': 3917, 'n_tokens_neox': 3732, 'n_words': 940}