<commit_before>dnl @synopsis AC_PROG_SWIG([major.minor.micro])
dnl
dnl NOTICE: for new code, use http://www.gnu.org/s/autoconf-archive/ax_pkg_swig.html instead.
dnl
dnl This macro searches for a SWIG installation on your system. If
dnl found you should call SWIG via $(SWIG). You can use the optional
dnl first argument to check if the version of the available SWIG is
dnl greater than or equal to the value of the argument. It should have
dnl the format: N[.N[.N]] (N is a number between 0 and 999. Only the
dnl first N is mandatory.)
dnl
dnl If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks
dnl that the swig package is this version number or higher.
dnl
dnl In configure.in, use as:
dnl
dnl	     AC_PROG_SWIG(1.3.17)
dnl	     SWIG_ENABLE_CXX
dnl	     SWIG_MULTI_MODULE_SUPPORT
dnl	     SWIG_PYTHON
dnl
dnl @category InstalledPackages
dnl @author <NAME> <<EMAIL>>
dnl @author <NAME> <<EMAIL>>
dnl @author <NAME> <<EMAIL>>
dnl @author <NAME> <<EMAIL>>
dnl @version 2004-09-20
dnl
dnl Modified by <NAME> <<EMAIL>> on 2012-08-08
dnl @license GPLWithACException
dnl
dnl NOTICE: for new code, use http://www.gnu.org/s/autoconf-archive/ax_pkg_swig.html instead.

AC_DEFUN([AC_PROG_SWIG],[
	SWIG_ERROR=""

	if test -n "$1"; then
		# Calculate the required version number components
		[required=$1]
		[required_major=`echo $required | sed 's/[^0-9].*//'`]
		if test -z "$required_major" ; then
			[required_major=0]
		fi
		[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
		[required_minor=`echo $required | sed 's/[^0-9].*//'`]
		if test -z "$required_minor" ; then
			[required_minor=0]
		fi
		[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
		[required_patch=`echo $required | sed 's/[^0-9].*//'`]
		if test -z "$required_patch" ; then
			[required_patch=0]
		fi
	fi

	# for "python 3 abc set" and "PyInt_FromSize_t in python3" checks

	cat <<-END > conftest-python.i
		%module conftest;
		%include <pyabc.i>
		%include <std_set.i>
		%template(SInt) std::set<int>;
	END

	# check if perl has std::...::size_type defined. Don't add new tests to this .i; it'll break this test due to check for "NewPointerObj(("

	cat <<-END > conftest-perl.i
		%module conftest;
		%include <std_vector.i>
		%include <std_list.i>
		%include <std_deque.i>
		%template() std::vector<int>;
		%template() std::list<int>;
		%template() std::deque<int>;
		std::vector<int>::size_type checkVector();
		std::list<int>::size_type checkList();
		std::deque<int>::size_type checkDeque();
	END
	SWIG_installed_versions=""
	AC_CACHE_CHECK([for SWIG >= $1], [znc_cv_path_SWIG], [
		AC_PATH_PROGS_FEATURE_CHECK([SWIG], [swig swig2.0], [
			echo trying $ac_path_SWIG >&AS_MESSAGE_LOG_FD
			$ac_path_SWIG -version >&AS_MESSAGE_LOG_FD
			[swig_version=`$ac_path_SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
			if test -n "$swig_version"; then
				swig_right_version=1

				SWIG_installed_versions="$SWIG_installed_versions $swig_version "

				if test -n "$required"; then
					# Calculate the available version number components
					[available=$swig_version]

					[available_major=`echo $available | sed 's/[^0-9].*//'`]
					if test -z "$available_major" ; then
						[available_major=0]
					fi
					[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
					[available_minor=`echo $available | sed 's/[^0-9].*//'`]
					if test -z "$available_minor" ; then
						[available_minor=0]
					fi
					[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
					[available_patch=`echo $available | sed 's/[^0-9].*//'`]
					if test -z "$available_patch" ; then
						[available_patch=0]
					fi

					if test $available_major -lt $required_major; then
						swig_right_version=0
					elif test $available_major -eq $required_major; then
						if test $available_minor -lt $required_minor; then
							swig_right_version=0
						elif test $available_minor -eq $required_minor; then
							if test $available_patch -lt $required_patch; then
								swig_right_version=0
							fi
						fi
					fi
				fi
				
				if test $swig_right_version -eq 1; then
					# "python 3 abc set", "PyInt_FromSize_t in python3" and "perl size_type" checks
					echo "checking behavior of this SWIG" >&AS_MESSAGE_LOG_FD

					$ac_path_SWIG -python -py3 -c++ -shadow conftest-python.i >&AS_MESSAGE_LOG_FD && \
						echo "python wrapper created" >&AS_MESSAGE_LOG_FD && \
						echo "testing std::set... ">&AS_MESSAGE_LOG_FD && \
						grep SInt_discard conftest.py >& /dev/null && \
						echo "std::set works" >&AS_MESSAGE_LOG_FD && \
						echo "testing PyInt_FromSize_t..." >&AS_MESSAGE_LOG_FD && \
						grep '#define PyInt_FromSize_t' conftest-python_wrap.cxx >& /dev/null && \
						echo "PyInt_FromSize_t is defined" >&AS_MESSAGE_LOG_FD && \
					$ac_path_SWIG -perl -c++ -shadow conftest-perl.i >&AS_MESSAGE_LOG_FD && \
						echo "perl wrapper created" >&AS_MESSAGE_LOG_FD && \
						echo "testing size_type..." >&AS_MESSAGE_LOG_FD && \
						test 0 -eq `grep -c 'NewPointerObj((' conftest-perl_wrap.cxx` && \
						echo "size_type work" >&AS_MESSAGE_LOG_FD && \
					znc_cv_path_SWIG=$ac_path_SWIG \
						ac_path_SWIG_found=:
					if test "x$ac_path_SWIG_found" != "x:"; then
						echo "fail" >&AS_MESSAGE_LOG_FD<commit_msg>Fix ./configure not to fail on non-bash<commit_after>dnl @synopsis AC_PROG_SWIG([major.minor.micro])
dnl
dnl NOTICE: for new code, use http://www.gnu.org/s/autoconf-archive/ax_pkg_swig.html instead.
dnl
dnl This macro searches for a SWIG installation on your system. If
dnl found you should call SWIG via $(SWIG). You can use the optional
dnl first argument to check if the version of the available SWIG is
dnl greater than or equal to the value of the argument. It should have
dnl the format: N[.N[.N]] (N is a number between 0 and 999. Only the
dnl first N is mandatory.)
dnl
dnl If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks
dnl that the swig package is this version number or higher.
dnl
dnl In configure.in, use as:
dnl
dnl	     AC_PROG_SWIG(1.3.17)
dnl	     SWIG_ENABLE_CXX
dnl	     SWIG_MULTI_MODULE_SUPPORT
dnl	     SWIG_PYTHON
dnl
dnl @category InstalledPackages
dnl @author <NAME> <<EMAIL>>
dnl @author <NAME> <<EMAIL>>
dnl @author <NAME> <<EMAIL>>
dnl @author <NAME> <<EMAIL>>
dnl @version 2004-09-20
dnl
dnl Modified by <NAME> <<EMAIL>> on 2012-08-08
dnl @license GPLWithACException
dnl
dnl NOTICE: for new code, use http://www.gnu.org/s/autoconf-archive/ax_pkg_swig.html instead.

AC_DEFUN([AC_PROG_SWIG],[
	SWIG_ERROR=""

	if test -n "$1"; then
		# Calculate the required version number components
		[required=$1]
		[required_major=`echo $required | sed 's/[^0-9].*//'`]
		if test -z "$required_major" ; then
			[required_major=0]
		fi
		[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
		[required_minor=`echo $required | sed 's/[^0-9].*//'`]
		if test -z "$required_minor" ; then
			[required_minor=0]
		fi
		[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
		[required_patch=`echo $required | sed 's/[^0-9].*//'`]
		if test -z "$required_patch" ; then
			[required_patch=0]
		fi
	fi

	# for "python 3 abc set" and "PyInt_FromSize_t in python3" checks

	cat <<-END > conftest-python.i
		%module conftest;
		%include <pyabc.i>
		%include <std_set.i>
		%template(SInt) std::set<int>;
	END

	# check if perl has std::...::size_type defined. Don't add new tests to this .i; it'll break this test due to check for "NewPointerObj(("

	cat <<-END > conftest-perl.i
		%module conftest;
		%include <std_vector.i>
		%include <std_list.i>
		%include <std_deque.i>
		%template() std::vector<int>;
		%template() std::list<int>;
		%template() std::deque<int>;
		std::vector<int>::size_type checkVector();
		std::list<int>::size_type checkList();
		std::deque<int>::size_type checkDeque();
	END
	SWIG_installed_versions=""
	AC_CACHE_CHECK([for SWIG >= $1], [znc_cv_path_SWIG], [
		AC_PATH_PROGS_FEATURE_CHECK([SWIG], [swig swig2.0], [
			echo trying $ac_path_SWIG >&AS_MESSAGE_LOG_FD
			$ac_path_SWIG -version >&AS_MESSAGE_LOG_FD
			[swig_version=`$ac_path_SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
			if test -n "$swig_version"; then
				swig_right_version=1

				SWIG_installed_versions="$SWIG_installed_versions $swig_version "

				if test -n "$required"; then
					# Calculate the available version number components
					[available=$swig_version]

					[available_major=`echo $available | sed 's/[^0-9].*//'`]
					if test -z "$available_major" ; then
						[available_major=0]
					fi
					[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
					[available_minor=`echo $available | sed 's/[^0-9].*//'`]
					if test -z "$available_minor" ; then
						[available_minor=0]
					fi
					[available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
					[available_patch=`echo $available | sed 's/[^0-9].*//'`]
					if test -z "$available_patch" ; then
						[available_patch=0]
					fi

					if test $available_major -lt $required_major; then
						swig_right_version=0
					elif test $available_major -eq $required_major; then
						if test $available_minor -lt $required_minor; then
							swig_right_version=0
						elif test $available_minor -eq $required_minor; then
							if test $available_patch -lt $required_patch; then
								swig_right_version=0
							fi
						fi
					fi
				fi
				
				if test $swig_right_version -eq 1; then
					# "python 3 abc set", "PyInt_FromSize_t in python3" and "perl size_type" checks
					echo "checking behavior of this SWIG" >&AS_MESSAGE_LOG_FD

					$ac_path_SWIG -python -py3 -c++ -shadow conftest-python.i >&AS_MESSAGE_LOG_FD && \
						echo "python wrapper created" >&AS_MESSAGE_LOG_FD && \
						echo "testing std::set... ">&AS_MESSAGE_LOG_FD && \
						grep SInt_discard conftest.py > /dev/null 2>&1 && \
						echo "std::set works" >&AS_MESSAGE_LOG_FD && \
						echo "testing PyInt_FromSize_t..." >&AS_MESSAGE_LOG_FD && \
						grep '#define PyInt_FromSize_t' conftest-python_wrap.cxx > /dev/null 2>&1 && \
						echo "PyInt_FromSize_t is defined" >&AS_MESSAGE_LOG_FD && \
					$ac_path_SWIG -perl -c++ -shadow conftest-perl.i >&AS_MESSAGE_LOG_FD && \
						echo "perl wrapper created" >&AS_MESSAGE_LOG_FD && \
						echo "testing size_type..." >&AS_MESSAGE_LOG_FD && \
						test 0 -eq `grep -c 'NewPointerObj((' conftest-perl_wrap.cxx` && \
						echo "size_type work" >&AS_MESSAGE_LOG_FD && \
					znc_cv_path_SWIG=$ac_path_SWIG \
						ac_path_SWIG_found=:
					if test "x$ac_path_SWIG_found" != "x:"; then
						echo "fail" >&AS_MESSAGE_LOG_FD
{'fraction_non_alphanumeric': 0.14595567342299678, 'fraction_numerical': 0.017995832544042432, 'mean_word_length': 3.5395528804815135, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '6672526', 'n_tokens_mistral': 4693, 'n_tokens_neox': 3963, 'n_words': 1023}