<commit_before>dnl SOX_PATH_SAMPLERATE
dnl Based off of shout.m4 from xiph package.
dnl <EMAIL> 1-3-2007
dnl
dnl Original Authors:
dnl <NAME> <<EMAIL>> 08-06-2001
dnl Rewritten for libshout 2
dnl <NAME> <<EMAIL>> 20030612
dnl
# SOX_PATH_SAMPLERATE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
# Test for libsamplerate, and define SAMPLERATE_CFLAGS and SAMPLERATE_LIBS
AC_DEFUN([SOX_PATH_SAMPLERATE],
[dnl
# Step 1: Use pkg-config if available
m4_ifdef([PKG_CHECK_MODULES],
  [# PKG_CHECK_MODULES available
  PKG_CHECK_MODULES(SAMPLERATE, samplerate, have_samplerate="maybe",
                    have_samplerate="no")],
  [# PKG_CHECK_MODULES is unavailable, search for pkg-config program
  AC_PATH_PROG([PKGCONFIG], [pkg-config], [none])
  if test "$PKGCONFIG" != "none" && `$PKGCONFIG --exists samplerate`
  then
    SAMPLERATE_CFLAGS=`$PKGCONFIG --cflags samplerate`
    SAMPLERATE_LIBS=`$PKGCONFIG --libs samplerate`
    have_samplerate="maybe"
  else
    if test "$PKGCONFIG" != "none"
    then
      AC_MSG_NOTICE([$PKGCONFIG couldn't find libsamplerate. Try adjusting PKG_CONFIG_PATH.])
    fi
    # libsamplerate doesn't have samplerate-config but other
    # packages do and so keep around as an example.
    # Step 2: try samplerate-config
    #AC_PATH_PROG([SAMPLERATECONFIG], [samplerate-config], [none])
    #if test "$SAMPLERATECONFIG" != "none" && test `$SAMPLERATECONFIG --package` = "libsamplerate"
    #then
    #  SAMPLERATE_CFLAGS=`$SAMPLERATECONFIG --cflags`
    #  SAMPLERATE_LIBS=`$SAMPLERATECONFIG --libs`
    #  have_samplerate="maybe"
    #fi
  fi
  ])

m4_ifndef([PKG_CHECK_MODULES],
  [# PKG_CHECK_MODULES not available
  # Best guess is that samplerate only needs to link against itself
  SAMPLERATE_LIBS="-lsamplerate"
  ])

# Now try actually using libsamplerate
if test "$have_samplerate" != "no"
then
  ac_save_CFLAGS="$CFLAGS"
  ac_save_LIBS="$LIBS"
  CFLAGS="$CFLAGS $SAMPLERATE_CFLAGS"
  LIBS="$LIBS $SAMPLERATE_LIBS"
  dnl Must hardcode samplerate library if we can not get it from pkg-config
  AC_CHECK_HEADER([samplerate.h], [
    AC_DEFINE([HAVE_SAMPLERATE_H], 1, [Define if you have <samplerate.h>])
    AC_CHECK_FUNC([src_new], [
      ifelse([$1], , :, [$1])
      have_samplerate="yes"
    ])
  ])
  CFLAGS="$ac_save_CFLAGS"
  LIBS="$ac_save_LIBS"
fi

if test "$have_samplerate" != "yes"
then
  ifelse([$2], , :, [$2])
fi
])dnl SOX_PATH_SAMPLERATE
<commit_msg>Sanitize logic in this macro.  Allow to detect libsamplerate on platforms that have pkg-config but no samplerate.pc file.<commit_after>dnl SOX_PATH_SAMPLERATE
dnl Based off of shout.m4 from xiph package.
dnl <EMAIL> 1-3-2007
dnl
dnl Original Authors:
dnl <NAME> <<EMAIL>> 08-06-2001
dnl Rewritten for libshout 2
dnl <NAME> <<EMAIL>> 20030612
dnl
# SOX_PATH_SAMPLERATE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
# Test for libsamplerate, and define SAMPLERATE_CFLAGS and SAMPLERATE_LIBS
AC_DEFUN([SOX_PATH_SAMPLERATE],
[dnl
# Step 1: Use PKG_CHECK_MODULES if available
m4_ifdef([PKG_CHECK_MODULES],
  [# PKG_CHECK_MODULES available
  PKG_CHECK_MODULES(SAMPLERATE, samplerate, have_samplerate="maybe",
                    have_samplerate="no")],
  [# Step 2: Use pkg-config manually if available
  AC_PATH_PROG([PKGCONFIG], [pkg-config], [none])
  if test "$PKGCONFIG" != "none" && `$PKGCONFIG --exists samplerate`
  then
    SAMPLERATE_CFLAGS=`$PKGCONFIG --cflags samplerate`
    SAMPLERATE_LIBS=`$PKGCONFIG --libs samplerate`
    have_samplerate="maybe"
  else
    have_samplerate="no"
  fi])

# Step 3: Even if pkg-config says its not installed, user may have
# manually installed libraries with no pkg-config support
if test "$have_samplerate" = "no"
then
  # Some packages distribute a <package>-config which we could check
  # for but libsamplerate doesn't have that.  We could use AC_PATH_PROG() 
  # similar to above for finding pkg-config.

  # As a last resort, just hope that header and library can
  # be found in default paths and that it doesn't need
  # to link against any other libraries. 
  SAMPLERATE_LIBS="-lsamplerate"
  have_samplerate="maybe"
fi

# Even if pkg-config or similar told us how to find the library,
# do a safety check.
if test "$have_samplerate" != "no"
then
  ac_save_CFLAGS="$CFLAGS"
  ac_save_LIBS="$LIBS"
  CFLAGS="$CFLAGS $SAMPLERATE_CFLAGS"
  LIBS="$LIBS $SAMPLERATE_LIBS"
  AC_CHECK_HEADER([samplerate.h], [
    AC_DEFINE([HAVE_SAMPLERATE_H], 1, [Define if you have <samplerate.h>])
    AC_CHECK_FUNC([src_new], [
      ifelse([$1], , :, [$1])
      have_samplerate="yes"
    ])
  ])
  CFLAGS="$ac_save_CFLAGS"
  LIBS="$ac_save_LIBS"
fi

if test "$have_samplerate" != "yes"
then
  ifelse([$2], , :, [$2])
fi
])dnl SOX_PATH_SAMPLERATE

{'fraction_non_alphanumeric': 0.11759675005345306, 'fraction_numerical': 0.014111610006414367, 'mean_word_length': 4.484173505275498, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '4898210', 'n_tokens_mistral': 1852, 'n_tokens_neox': 1771, 'n_words': 435}