<commit_before>builtin(include,tcl.m4)

dnl This macro checks if the user specified a dports tree
dnl explicitly. If not, search for it

# OD_PATH_DPORTSDIR(DEFAULT_DPORTSDIR)
#---------------------------------------
 AC_DEFUN([OD_PATH_DPORTSDIR],[
 	dnl For ease of reading, run after gcc has been found/configured
 	AC_REQUIRE([AC_PROG_CC])

 	AC_ARG_WITH(dports-dir, [AC_HELP_STRING([--with-dports-dir=DIR], [Specify alternate dports directory])], [ dportsdir="$withval" ] )


 	AC_MSG_CHECKING([for dports tree])
 	if test "x$dportsdir" != "x" ; then
 	  if test -d "$dportsdir" -a -e "$dportsdir/PortIndex" ; then
 		:
 	  else
 		AC_MSG_ERROR([$dportsdir not a valid dports tree])
 	  fi
 	else
 		dnl If the user didn't give a path, look for default
 		if test "x$1" != "x" ; then
 		  if test -d "$1" -a -e "$1/PortIndex" ; then
 			dportsdir=$1
 		  fi
 		fi
 	fi

 	if test "x$dportsdir" != "x" ; then
 		AC_MSG_RESULT($dportsdir)
 		DPORTSDIR="$dportsdir"
 		AC_SUBST(DPORTSDIR)
 	else
 		AC_MSG_WARN([No dports tree found])
 	fi

         ])


# OD_PATH_PORTCONFIGDIR(PREFIX)
#---------------------------------------
AC_DEFUN([OD_PATH_PORTCONFIGDIR],[
	dnl if the user actually specified --prefix, shift
	dnl portconfigdir to $prefix/etc/ports
	dnl 	AC_REQUIRE([OD_PATH_DPORTSDIR])
	
        AC_MSG_CHECKING([for ports config directory])

	if test "$1" != "NONE" ; then
		dnl user gave --prefix
		portconfigdir='${sysconfdir}/ports'
	else
	   case $host_os in
	   darwin*)
		portconfigdir='/private/etc/ports'
		;;
	   *)
		portconfigdir='/etc/ports'
		;;
	   esac
	fi


	AC_MSG_RESULT([$portconfigdir])
	PORTCONFIGDIR="$portconfigdir"
        AC_SUBST(PORTCONFIGDIR)

	])

# OD_CHECK_INSTALLUSER
#-------------------------------------------------
AC_DEFUN([OD_CHECK_INSTALLUSER],[
	dnl if with user specifies --with-install-user,
	dnl use it. otherwise default to platform defaults
        AC_REQUIRE([OD_PATH_PORTCONFIGDIR])

	AC_ARG_WITH(install-user, [AC_HELP_STRING([--with-install-user=USER], [Specify user ownership of installed files])], [ DSTUSR=$withval ] )
	
	AC_MSG_CHECKING([for install user])
	if test "x$DSTUSR" = "x" ; then
	   DSTUSR=root
	fi

	AC_MSG_RESULT([$DSTUSR])
	AC_SUBST(DSTUSR)
])

# OD_CHECK_INSTALLGROUP
#-------------------------------------------------
AC_DEFUN([OD_CHECK_INSTALLGROUP],[
	dnl if with user specifies --with-install-group,
	dnl use it. otherwise default to platform defaults
        AC_REQUIRE([OD_CHECK_INSTALLUSER])

	AC_ARG_WITH(install-group, [AC_HELP_STRING([--with-install-group=GROUP], [Specify group ownership of installed files])], [ DSTGRP=$withval ] )

	AC_MSG_CHECKING([for install group])
	if test "x$DSTGRP" = "x" ; then
	   
	   case $host_os in
	   darwin*)
		DSTGRP="admin"
		;;
	   *)
		DSTGRP="wheel"
		;;
	   esac
	fi

	AC_MSG_RESULT([$DSTGRP])
	AC_SUBST(DSTGRP)
])

# OD_LIB_MD5
#---------------------------------------
# Check for an md5 implementation
AC_DEFUN([OD_LIB_MD5],[

	# Check for libmd, which is prefered
	AC_CHECK_LIB([md], [MD5Update],[
		AC_CHECK_HEADERS([md5.h], ,[
			AC_MSG_ERROR([libmd was found, but md5.h is missing.])])
		AC_DEFINE([HAVE_LIBMD], ,[Define if you have the `md' library (-lmd).])
		MD5_LIBS="-lmd"]
	)
	if test "x$MD5_LIBS" = "x" ; then
		# If libmd is not found, check for libcrypto from OpenSSL
		AC_CHECK_LIB([crypto], [MD5_Update],[
			AC_CHECK_HEADERS([openssl/md5.h],,[
				AC_MSG_ERROR([libcrypt was found, but header file openssl/md5.h is missing.])])
				AC_DEFINE([HAVE_LIBCRYPTO],,[Define if you have the `crypto' library (-lcrypto).])
			MD5_LIBS="-lcrypto"
		], [
			AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
		])
	fi
	if test "x$MD5_LIBS" = "x"; then
		AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
	fi
	AC_SUBST([MD5_LIBS])
])

dnl This macro checks for X11 presence. If the libraries are
dnl present, so must the headers be. If nothing is present,
dnl print a warning

# OD_CHECK_X11
# ---------------------
AC_DEFUN([OD_CHECK_X11], [

	# Check for libX11
	AC_CHECK_LIB([X11], [XOpenDisplay],[
			# found the library. check for header
			INCLUDES="-I/usr/X11R6/include $INCLUDES"
			AC_CHECK_HEADERS([X11/X.h], ,[
				case $host_os in
					darwin*)
						echo "***************************************************"
						if test -d /Library/Receipts/X11User.pkg ; then
							if test -d /Library/Receipts/X11SDK.pkg ; then
								cat <<EOF;
It appears that you are running Mac OS X and have both the X11 and X11SDK
packages installed. However, for some reason the headers in
/usr/X11R6/include are not accessible. Please correct this and
re-run ./configure
EOF
							else
								cat <<EOF;
It appears that you are running Mac OS X and have the X11 package
installed, but do *not* have the X11SDK package installed. You can
find this package on the Xcode Tools CD of you Mac OS X CD Installation
Set, or on the Restore CDs/DVDs that came with your computer. Please
install this package and re-run ./configure
EOF
							fi
						else
								cat <<EOF;
It appears that you are running Mac OS X and have installed X11
from a third party, without installing the associated X11 development
headers. Please correct this and re-run ./configure
EOF
						fi
						AC_MSG_ERROR([Inconsistent X11 installation])
						;;
					*)
						AC_MSG_ERROR([libX11 was found, but X.h is missing.])
						;;
				esac					<commit_msg>typo<commit_after>builtin(include,tcl.m4)

dnl This macro checks if the user specified a dports tree
dnl explicitly. If not, search for it

# OD_PATH_DPORTSDIR(DEFAULT_DPORTSDIR)
#---------------------------------------
 AC_DEFUN([OD_PATH_DPORTSDIR],[
 	dnl For ease of reading, run after gcc has been found/configured
 	AC_REQUIRE([AC_PROG_CC])

 	AC_ARG_WITH(dports-dir, [AC_HELP_STRING([--with-dports-dir=DIR], [Specify alternate dports directory])], [ dportsdir="$withval" ] )


 	AC_MSG_CHECKING([for dports tree])
 	if test "x$dportsdir" != "x" ; then
 	  if test -d "$dportsdir" -a -e "$dportsdir/PortIndex" ; then
 		:
 	  else
 		AC_MSG_ERROR([$dportsdir not a valid dports tree])
 	  fi
 	else
 		dnl If the user didn't give a path, look for default
 		if test "x$1" != "x" ; then
 		  if test -d "$1" -a -e "$1/PortIndex" ; then
 			dportsdir=$1
 		  fi
 		fi
 	fi

 	if test "x$dportsdir" != "x" ; then
 		AC_MSG_RESULT($dportsdir)
 		DPORTSDIR="$dportsdir"
 		AC_SUBST(DPORTSDIR)
 	else
 		AC_MSG_WARN([No dports tree found])
 	fi

         ])


# OD_PATH_PORTCONFIGDIR(PREFIX)
#---------------------------------------
AC_DEFUN([OD_PATH_PORTCONFIGDIR],[
	dnl if the user actually specified --prefix, shift
	dnl portconfigdir to $prefix/etc/ports
	dnl 	AC_REQUIRE([OD_PATH_DPORTSDIR])
	
        AC_MSG_CHECKING([for ports config directory])

	if test "$1" != "NONE" ; then
		dnl user gave --prefix
		portconfigdir='${sysconfdir}/ports'
	else
	   case $host_os in
	   darwin*)
		portconfigdir='/private/etc/ports'
		;;
	   *)
		portconfigdir='/etc/ports'
		;;
	   esac
	fi


	AC_MSG_RESULT([$portconfigdir])
	PORTCONFIGDIR="$portconfigdir"
        AC_SUBST(PORTCONFIGDIR)

	])

# OD_CHECK_INSTALLUSER
#-------------------------------------------------
AC_DEFUN([OD_CHECK_INSTALLUSER],[
	dnl if with user specifies --with-install-user,
	dnl use it. otherwise default to platform defaults
        AC_REQUIRE([OD_PATH_PORTCONFIGDIR])

	AC_ARG_WITH(install-user, [AC_HELP_STRING([--with-install-user=USER], [Specify user ownership of installed files])], [ DSTUSR=$withval ] )
	
	AC_MSG_CHECKING([for install user])
	if test "x$DSTUSR" = "x" ; then
	   DSTUSR=root
	fi

	AC_MSG_RESULT([$DSTUSR])
	AC_SUBST(DSTUSR)
])

# OD_CHECK_INSTALLGROUP
#-------------------------------------------------
AC_DEFUN([OD_CHECK_INSTALLGROUP],[
	dnl if with user specifies --with-install-group,
	dnl use it. otherwise default to platform defaults
        AC_REQUIRE([OD_CHECK_INSTALLUSER])

	AC_ARG_WITH(install-group, [AC_HELP_STRING([--with-install-group=GROUP], [Specify group ownership of installed files])], [ DSTGRP=$withval ] )

	AC_MSG_CHECKING([for install group])
	if test "x$DSTGRP" = "x" ; then
	   
	   case $host_os in
	   darwin*)
		DSTGRP="admin"
		;;
	   *)
		DSTGRP="wheel"
		;;
	   esac
	fi

	AC_MSG_RESULT([$DSTGRP])
	AC_SUBST(DSTGRP)
])

# OD_LIB_MD5
#---------------------------------------
# Check for an md5 implementation
AC_DEFUN([OD_LIB_MD5],[

	# Check for libmd, which is prefered
	AC_CHECK_LIB([md], [MD5Update],[
		AC_CHECK_HEADERS([md5.h], ,[
			AC_MSG_ERROR([libmd was found, but md5.h is missing.])])
		AC_DEFINE([HAVE_LIBMD], ,[Define if you have the `md' library (-lmd).])
		MD5_LIBS="-lmd"]
	)
	if test "x$MD5_LIBS" = "x" ; then
		# If libmd is not found, check for libcrypto from OpenSSL
		AC_CHECK_LIB([crypto], [MD5_Update],[
			AC_CHECK_HEADERS([openssl/md5.h],,[
				AC_MSG_ERROR([libcrypt was found, but header file openssl/md5.h is missing.])])
				AC_DEFINE([HAVE_LIBCRYPTO],,[Define if you have the `crypto' library (-lcrypto).])
			MD5_LIBS="-lcrypto"
		], [
			AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
		])
	fi
	if test "x$MD5_LIBS" = "x"; then
		AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
	fi
	AC_SUBST([MD5_LIBS])
])

dnl This macro checks for X11 presence. If the libraries are
dnl present, so must the headers be. If nothing is present,
dnl print a warning

# OD_CHECK_X11
# ---------------------
AC_DEFUN([OD_CHECK_X11], [

	# Check for libX11
	AC_CHECK_LIB([X11], [XOpenDisplay],[
			# found the library. check for header
			INCLUDES="-I/usr/X11R6/include $INCLUDES"
			AC_CHECK_HEADERS([X11/X.h], ,[
				case $host_os in
					darwin*)
						echo "***************************************************"
						if test -d /Library/Receipts/X11User.pkg ; then
							if test -d /Library/Receipts/X11SDK.pkg ; then
								cat <<EOF;
It appears that you are running Mac OS X and have both the X11 and X11SDK
packages installed. However, for some reason the headers in
/usr/X11R6/include are not accessible. Please correct this and
re-run ./configure
EOF
							else
								cat <<EOF;
It appears that you are running Mac OS X and have the X11 package
installed, but do *not* have the X11SDK package installed. You can
find this package on the Xcode Tools CD of your Mac OS X CD Installation
Set, or on the Restore CDs/DVDs that came with your computer. Please
install this package and re-run ./configure
EOF
							fi
						else
								cat <<EOF;
It appears that you are running Mac OS X and have installed X11
from a third party, without installing the associated X11 development
headers. Please correct this and re-run ./configure
EOF
						fi
						AC_MSG_ERROR([Inconsistent X11 installation])
						;;
					*)
						AC_MSG_ERROR([libX11 was found, but X.h is missing.])
						;;
				esac					
{'fraction_non_alphanumeric': 0.15831037649219468, 'fraction_numerical': 0.011019283746556474, 'mean_word_length': 3.0411873840445267, 'pattern_counts': {'":': 0, '<': 15, '<?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': '3156564', 'n_tokens_mistral': 4264, 'n_tokens_neox': 3740, 'n_words': 1072}