<commit_before>dnl import the whole of SWIG-1.3.21/Tools/config/swig.m4
dnl subsequently AWI (with ideas from RL) fixed the case where find finds
dnl multiple files, and also removed some bashism's and extended sed
dnl constructs so now there is some hope these macros will work cross-platform.
dnl also, disabled SWIG when version check does not succeed
# Contributed by <NAME>

# SWIG_PROG([required-version = N[.N[.N]]])
#
# Checks for the SWIG program.  If found you can (and should) call
# SWIG via $(SWIG).  You can use the optional first argument to check
# if the version of the available SWIG is greater than or equal to the
# value of the argument.  It should have the format: N[.N[.N]] (N is a
# number between 0 and 999.  Only the first N is mandatory.)
AC_DEFUN([SWIG_PROG],[
	AC_PATH_PROG([SWIG],[swig])
	if test -z "$SWIG" ; then
		AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
		SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
	elif test -n "$1" ; then
		AC_MSG_CHECKING([for SWIG version])
		[swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
		AC_MSG_RESULT([$swig_version])
		if test -n "$swig_version" ; then
			# Calculate the required version number
			[swig_tmp=( `echo $1 | sed 's/[^0-9][^0-9]*/ /g'` )]
			[swig_required_version=$(( 1000000 * ${swig_tmp[0]:-0} + 1000 * ${swig_tmp[1]:-0} + ${swig_tmp[2]:-0} ))]

			# Calculate the available version number
			[swig_tmp=( `echo $swig_version | sed 's/[^0-9][^0-9]*/ /g'` )]
			[swig_tmp=$(( 1000000 * ${swig_tmp[0]:-0} + 1000 * ${swig_tmp[1]:-0} + ${swig_tmp[2]:-0} ))]

			if test $swig_required_version -gt $swig_tmp ; then
				AC_MSG_WARN([SWIG version >= $1 is required.  You have $swig_version.  You should look at http://www.swig.org])
				SWIG='echo "Error: SWIG version >= $1 is required.  You have '"$swig_version"'.  You should look at http://www.swig.org" ; false'
			else
				AC_MSG_NOTICE([SWIG executable is '$SWIG'])
				SWIG_RUNTIME_LIBS_DIR=`echo $SWIG | sed "s,/bin.*$,/lib,"`
				AC_MSG_NOTICE([SWIG runtime library directory is '$SWIG_RUNTIME_LIBS_DIR'])
			fi
		else
			AC_MSG_WARN([cannot determine SWIG version])
			SWIG='echo "Error: Cannot determine SWIG version.  You should look at http://www.swig.org" ; false'<commit_msg>Replace bashisms for calculating swig_required_version and swig_available_version.<commit_after>dnl import the whole of SWIG-1.3.21/Tools/config/swig.m4
dnl subsequently AWI (with ideas from RL) fixed the case where find finds
dnl multiple files, and also removed some bashism's and extended sed
dnl constructs so now there is some hope these macros will work cross-platform.
dnl also, disabled SWIG when version check does not succeed
# Contributed by <NAME>

# SWIG_PROG([required-version = N[.N[.N]]])
#
# Checks for the SWIG program.  If found you can (and should) call
# SWIG via $(SWIG).  You can use the optional first argument to check
# if the version of the available SWIG is greater than or equal to the
# value of the argument.  It should have the format: N[.N[.N]] (N is a
# number between 0 and 999.  Only the first N is mandatory.)
AC_DEFUN([SWIG_PROG],[
	AC_PATH_PROG([SWIG],[swig])
	if test -z "$SWIG" ; then
		AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
		SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
	elif test -n "$1" ; then
		AC_MSG_CHECKING([for SWIG version])
		[swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
		AC_MSG_RESULT([$swig_version])
		if test -n "$swig_version" ; then
			# Calculate the required version number
			[major=0`echo $1 | sed 's/\..*//'`]
			[minor=0`echo $1 | sed 's/[0-9]*\.//;s/\..*//'`]
			[patch=0`echo $1 | sed 's/[0-9]*\.[0-9]*\.//' | sed 's/[^0-9].*//'`]
			[swig_required_version=$(( 1000000 * $major  + 1000 * $minor + $patch ))]

			# Calculate the available version number
			[major=0`echo $swig_version | sed 's/\..*//'`]
			[minor=0`echo $swig_version | sed 's/[0-9]*\.//;s/\..*//'`]
			[patch=0`echo $swig_version | sed 's/[0-9]*\.[0-9]*\.//' | sed 's/[^0-9].*//'`]
			[swig_available_version=$(( 1000000 * $major  + 1000 * $minor + $patch ))]

			if test $swig_required_version -gt $swig_available_version ; then
				AC_MSG_WARN([SWIG version >= $1 is required.  You have $swig_version.  You should look at http://www.swig.org])
				SWIG='echo "Error: SWIG version >= $1 is required.  You have '"$swig_version"'.  You should look at http://www.swig.org" ; false'
			else
				AC_MSG_NOTICE([SWIG executable is '$SWIG'])
				SWIG_RUNTIME_LIBS_DIR=`echo $SWIG | sed "s,/bin.*$,/lib,"`
				AC_MSG_NOTICE([SWIG runtime library directory is '$SWIG_RUNTIME_LIBS_DIR'])
			fi
		else
			AC_MSG_WARN([cannot determine SWIG version])
			SWIG='echo "Error: Cannot determine SWIG version.  You should look at http://www.swig.org" ; false'
{'fraction_non_alphanumeric': 0.16331006979062812, 'fraction_numerical': 0.028713858424725822, 'mean_word_length': 3.795411089866157, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, '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': '1135578', 'n_tokens_mistral': 2048, 'n_tokens_neox': 1839, 'n_words': 567}