🢀 unrealircd :: c9ce310


commit c9ce310d289ed777d08aac9888194eca48aeaa0e
Author: acidvegas <acid.vegas@acid.vegas>
Date:   Thu Jun 6 23:34:18 2019 -0400

    Initial commit

diff --git a/.CHANGES.NEW b/.CHANGES.NEW
new file mode 100644
index 0000000..3f5a6b7
--- /dev/null
+++ b/.CHANGES.NEW
@@ -0,0 +1,20 @@
+
+ _   _                      _ ___________  _____     _
+| | | |                    | |_   _| ___ \/  __ \   | |
+| | | |_ __  _ __ ___  __ _| | | | | |_/ /| /  \/ __| |
+| | | | '_ \| '__/ _ \/  _ | | | | |    / | |    /  _ |
+| |_| | | | | | |  __/ (_| | |_| |_| |\ \ | \__/\ (_| |
+ \___/|_| |_|_|  \___|\__,_|_|\___/\_| \_| \____/\__,_|
+
+                               Configuration Program
+                                for UnrealIRCd 4.2.3
+                                    
+This program will help you to compile your IRC server, and ask you
+questions regarding the compile-time settings of it during the process. 
+regarding the setup of it, during the process.
+
+A short installation guide is available online at:
+https://www.unrealircd.org/docs/Installing_from_source
+
+Full documentation is available at:
+https://www.unrealircd.org/docs/UnrealIRCd_4_documentation
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..dbd5ebe
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,73 @@
+# Ignore configure step
+aclocal.m4
+autom4te.cache
+config.log
+conftest.*
+extras/pcre2*
+extras/c-ares*
+extras/regexp*
+config.status
+extras/tre*
+extras/ircdcron/ircd.cron
+extras/ircdcron/ircdchk
+src/modules/snomasks/Makefile
+src/modules/chanmodes/Makefile
+src/modules/extbans/Makefile
+src/modules/usermodes/Makefile
+src/modules/Makefile
+src/modules/third/Makefile
+/Makefile
+/src/Makefile
+/unrealircd
+include/setup.h
+
+# Ignore tags file
+tags
+
+# Ignore editor files
+*\#*
+*~
+
+# Ignore SSL Stuff
+server.cert.pem
+server.key.pem
+server.req.pem
+ssl.rnd
+
+# Ignores for platform stuff
+.DS_Store
+
+# Ignores for build artifacts
+*.so
+*.o
+*.dSYM
+*.dylib
+src/ircd
+src/version.c
+src/include
+
+# Ignores for mac stuff
+## Various settings
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata
+
+## Other
+*.xccheckout
+*.moved-aside
+*.xcuserstate
+*.xcscmblueprint
+
+## Obj-C/Swift specific
+*.hmap
+*.ipa
+
+src/macosx/build/
+DerivedData
+src/macosx/pods/
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..3cda009
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "extras/tests/ircfly"]
+	path = extras/tests/ircfly
+	url = https://github.com/unrealircd/ircfly.git
+[submodule "extras/tests/functional-tests"]
+	path = extras/tests/functional-tests
+	url = https://github.com/unrealircd/unrealircd-tests.git
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..5860f17
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,28 @@
+language: c
+os: linux
+dist: xenial
+compiler:
+  - clang
+  - gcc
+script: extras/build-tests/nix/build $BUILDCONFIG
+env:
+  - BUILDCONFIG=""
+  - BUILDCONFIG="system-cares"
+  - BUILDCONFIG="system-cares system-curl"
+  - BUILDCONFIG="local-curl"
+matrix:
+  include:
+  - os: osx
+    env: BUILDCONFIG=""
+  - os: osx
+    env: BUILDCONFIG="system-cares"
+  - os: osx
+    env: BUILDCONFIG="system-cares system-curl"
+  - os: osx
+    env: BUILDCONFIG="local-curl"
+  - env: BUILDCONFIG="libressl-27"
+  - env: BUILDCONFIG="libressl-28"
+  - env: BUILDCONFIG="libressl-29"
+  - env: BUILDCONFIG="openssl-102"
+  - env: BUILDCONFIG="openssl-110"
+  - env: BUILDCONFIG="openssl-111"
diff --git a/Config b/Config
new file mode 100755
index 0000000..f92901a
--- /dev/null
+++ b/Config
@@ -0,0 +1,934 @@
+#!/bin/sh
+#
+# Config script for UnrealIRCd
+# (C) 2001-2019 The UnrealIRCd Team
+#
+# This configure script is free software; the UnrealIRCd Team gives 
+# unlimited permission to copy, distribute and modify as long as the
+# copyright headers stay intact
+#
+#
+# Rewritten completely to be an interface to autoconf by codemastr
+# This was inspired by the config by Michael Graff (explorer@flame.org)
+# but was written from scratch
+
+# In order to be faster than the old Config, this assumes that all information
+# in the cache file is valid and therefore doesn't check it, so if you messed with
+# default values thats your problem :P
+
+# some bits edited by baafie on March 17 2004, every change marked.
+
+
+RUN_CONFIGURE () {
+ARG=" "
+
+if [ -z "$BINDIR" -o -z "$DATADIR" -o -z "$CONFDIR" -o -z "$MODULESDIR" -o -z "$LOGDIR" -o -z "$CACHEDIR" -o -z "$DOCDIR" -o -z "$TMPDIR" -o -z "$LIBDIR" ]; then
+	echo "Sorry './Config -quick' cannot be used because your 'config.settings'"
+	echo "file either does not exist or is from an old UnrealIRCd version"
+	echo "(older than version 4.0.8)."
+	echo ""
+	echo "Please run './Config' without -quick and answer all questions."
+	echo ""
+	exit
+fi
+
+
+mkdir -p $TMPDIR
+
+# Do this even if we're not in advanced mode
+if [ "$SHOWLISTMODES" = "1" ] ; then
+	ARG="$ARG--with-showlistmodes "
+fi
+if [ "$ADVANCED" = "1" ] ; then
+if [ "$TOPICNICKISNUH" = "1" ] ; then
+	ARG="$ARG--with-topicisnuhost "
+fi
+if [ "$SHUNNOTICES" = "1" ] ; then
+	ARG="$ARG--with-shunnotices "
+fi
+if [ "$NOOPEROVERRIDE" = "1" ] ; then
+	ARG="$ARG--with-no-operoverride "
+fi
+if [ "$DISABLEUSERMOD" = "1" ] ; then
+	ARG="$ARG--with-disableusermod "
+fi
+if [ "$OPEROVERRIDEVERIFY" = "1" ] ; then
+	ARG="$ARG--with-operoverride-verify "
+fi
+if [ "$DISABLEEXTBANSTACKING" = "1" ]; then
+	ARG="$ARG--with-disable-extendedban-stacking ";
+fi
+fi
+if test x"$SSLDIR" = "x" ; then
+ARG="$ARG--enable-ssl "
+else
+ARG="$ARG--enable-ssl=$SSLDIR "
+fi
+if [ "$REMOTEINC" = "1" ] ; then
+ARG="$ARG--enable-libcurl=$CURLDIR "
+fi
+if [ "$PREFIXAQ" != "1" ]; then
+ARG="$ARG--disable-prefixaq "
+fi
+if [ "$MAXCONNECTIONS_REQUEST" != "auto" ]; then
+	ARG="$ARG--with-maxconnections=$MAXCONNECTIONS_REQUEST "
+fi
+
+ARG="$ARG--with-bindir=$BINDIR "
+ARG="$ARG--with-datadir=$DATADIR "
+ARG="$ARG--with-pidfile=$DATADIR/unrealircd.pid "
+ARG="$ARG--with-confdir=$CONFDIR "
+ARG="$ARG--with-modulesdir=$MODULESDIR "
+ARG="$ARG--with-logdir=$LOGDIR "
+ARG="$ARG--with-cachedir=$CACHEDIR "
+ARG="$ARG--with-docdir=$DOCDIR "
+ARG="$ARG--with-tmpdir=$TMPDIR "
+ARG="$ARG--with-privatelibdir=$LIBDIR "
+ARG="$ARG--with-scriptdir=$BASEPATH "
+ARG="$ARG--with-nick-history=$NICKNAMEHISTORYLENGTH "
+ARG="$ARG--with-sendq=$MAXSENDQLENGTH "
+ARG="$ARG--with-permissions=$DEFPERM "
+ARG="$ARG--enable-dynamic-linking "
+ARG="$ARG $EXTRAPARA "
+CONF="./configure $ARG"
+# remove possibly old instances of curl in ~/unrealircd/lib/
+rm -f $LIBDIR/*curl* 1>/dev/null 2>&1
+# Ensure we install curl even if someone does ./Config -quick...
+if [ "x$CURLDIR" = "x$UNREALCWD/extras/curl" ]; then
+	INSTALLCURL=1
+fi
+if [ "x$INSTALLCURL" = "x1" ]; then
+	extras/curlinstall "$LIBDIR" || exit 1
+fi
+echo $CONF
+$CONF || exit 1
+cd "$UNREALCWD"
+if [  "$QUICK" != "1" ] ; then
+if [ ! -f $CONFDIR/ssl/server.cert.pem ]; then
+export OPENSSLPATH
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$GENCERTIFICATE" = "1" ] ; then
+	TEST="Yes"
+    else
+	TEST="No"
+    fi
+    echo ""
+    echo "Do you want to generate an SSL certificate for the IRCd?"
+    echo "Only answer No if you already have one."
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	cc=$TEST
+    fi
+    case "$cc" in
+	[Yy]*)
+	    GENCERTIFICATE="1"
+	    ;;
+	[Nn]*)
+	    GENCERTIFICATE=""
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter either Yes or No"
+	    TEST=""
+	    ;;
+    esac
+done
+if [ "$GENCERTIFICATE" = 1 ]; then
+	make pem
+	echo "Certificate created successfully."
+	sleep 1
+else
+	echo "Ok, not generating SSL certificate. Make sure that the certificate and key"
+	echo "are installed in conf/ssl/server.crt.pem and conf/ssl/server.key.pem prior to starting the IRCd."
+fi
+else
+echo "SSL certificate exists in $CONFDIR/ssl/server.cert.pem, no need to regenerate."
+fi
+fi
+}
+
+RUN_ADVANCED () {
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$SHOWLISTMODES" = "1" ] ; then
+	TEST="Yes"
+    else
+	TEST="No"
+    fi
+    echo ""
+    echo "Do you want to show the modes a channel has set in the /list output?"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	cc=$TEST
+    fi
+    case "$cc" in
+	[Yy]*)
+	    SHOWLISTMODES="1"
+	    ;;
+	[Nn]*)
+	    SHOWLISTMODES=""
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter either Yes or No"
+	    TEST=""
+	    ;;
+    esac
+done
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$TOPICNICKISNUH" = "1" ] ; then
+	TEST="Yes"
+    else
+	TEST="No"
+    fi
+    echo ""
+    echo "Do you want the /topic command to show the nick!user@host of the person"
+    echo "who set the topic, rather than just the nickname?"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	cc=$TEST
+    fi
+    case "$cc" in
+	[Yy]*)
+	    TOPICNICKISNUH="1"
+	    ;;
+	[Nn]*)
+	    TOPICNICKISNUH=""
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter either Yes or No"
+	    TEST=""
+	    ;;
+    esac
+done
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$SHUNNOTICES" = "1" ] ; then
+	TEST="Yes"
+    else
+	TEST="No"
+    fi
+    echo ""
+    echo "Should UnrealIRCd notify a user when they are no longer shunned?"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	cc=$TEST
+    fi
+    case "$cc" in
+	[Yy]*)
+	    SHUNNOTICES="1"
+	    ;;
+	[Nn]*)
+	    SHUNNOTICES=""
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter either Yes or No"
+	    TEST=""
+	    ;;
+    esac
+done
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$NOOPEROVERRIDE" = "1" ] ; then
+	TEST="Yes"
+    else
+	TEST="No"
+    fi
+    echo ""
+    echo "Do you want to disable oper override?"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	cc=$TEST
+    fi
+    case "$cc" in
+	[Yy]*)
+	    NOOPEROVERRIDE="1"
+	    ;;
+	[Nn]*)
+	    NOOPEROVERRIDE=""
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter either Yes or No"
+	    TEST=""
+	    ;;
+    esac
+done
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$DISABLEUSERMOD" = "1" ] ; then
+	TEST="Yes"
+    else
+	TEST="No"
+    fi
+    echo ""
+    echo "Do you want to disable /sethost, /setident, /chgname,"
+    echo "/chghost, and /chgident?"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	cc=$TEST
+    fi
+    case "$cc" in
+	[Yy]*)
+	    DISABLEUSERMOD="1"
+	    ;;
+	[Nn]*)
+	    DISABLEUSERMOD=""
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter either Yes or No"
+	    TEST=""
+	    ;;
+    esac
+done
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$OPEROVERRIDEVERIFY" = "1" ] ; then
+	TEST="Yes"
+    else
+	TEST="No"
+    fi
+    echo ""
+    echo "Do you want to require opers to /invite themselves into a +s or +p channel?"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	cc=$TEST
+    fi
+    case "$cc" in
+	[Yy]*)
+	    OPEROVERRIDEVERIFY="1"
+	    ;;
+	[Nn]*)
+	    OPEROVERRIDEVERIFY=""
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter either Yes or No"
+	    TEST=""
+	    ;;
+    esac
+done
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$DISABLEEXTBANSTACKING" = "1" ] ; then
+        TEST="Yes"
+    else
+        TEST="No"
+    fi
+    echo ""
+    echo "Do you want to disable extended ban stacking (~q:~c:#test, etc) support?"
+    echo $n "[$TEST] -> $c"
+        read cc
+    if [ -z "$cc" ] ; then
+        cc=$TEST
+    fi
+    case "$cc" in
+        [Yy]*)
+            DISABLEEXTBANSTACKING="1"
+            ;;
+        [Nn]*)
+            DISABLEEXTBANSTACKING="0"
+            ;;
+        *)
+            echo ""
+            echo "You must enter either Yes or No"
+            TEST=""
+            ;;
+    esac
+done
+
+}
+c=""
+n=""
+UNREALCWD="`pwd`"
+BASEPATH="$HOME/unrealircd"
+DEFPERM="0600"
+SSLDIR=""
+NICKNAMEHISTORYLENGTH="100"
+MAXSENDQLENGTH="3000000"
+MAXCONNECTIONS_REQUEST="auto"
+REMOTEINC="1"
+CURLDIR=""
+PREFIXAQ="0"
+SHOWLISTMODES="0"
+TOPICNICKISNUH=""
+SHUNNOTICES=""
+NOOPEROVERRIDE=""
+DISABLEUSERMOD=""
+OPEROVERRIDEVERIFY=""
+DISABLEEXTBANSTACKING=""
+GENCERTIFICATE=""
+EXTRAPARA=""
+if [ "`eval echo -n 'a'`" = "-n a" ] ; then
+        c="\c"
+else
+        n="-n"
+fi
+
+
+#parse arguments
+NOCACHE=""
+IMPORTEDSETTINGS=""
+NOINTRO=""
+QUICK=""
+CLEAN=""
+ADVANCED=""
+while [ $# -ge 1 ] ; do
+	if [ $1 = "--help" ] ; then
+		echo "Config utility for UnrealIRCd"
+		echo "-----------------------------"
+		echo "Syntax: ./Config [options]"
+		echo "-nocache     Ignore settings saved in config.settings"
+		echo "-nointro     Skip intro (release notes, etc)"
+		echo "-quick       Skip questions, go straight to configure"
+		echo "-advanced    Include additional advanced questions"
+		echo "-clean       Clean ./configure cache"
+		exit 0
+	elif [ $1 = "-nocache" ] ; then
+		NOCACHE="1"
+	elif [ $1 = "-nointro" ] ; then
+		NOINTRO="1"
+	elif [ $1 = "-quick" -o $1 = "-q" ] ; then
+		QUICK="1"
+		echo "running quick config"
+		if [ -f "config.settings" ] ; then
+			. ./config.settings
+		fi
+		RUN_CONFIGURE
+		cd "$UNREALCWD"
+		exit 0
+	elif [ $1 = "-clean" -o $1 = "-C" ] ; then
+		CLEAN="1"
+	elif [ $1 = "-advanced" ] ; then
+		PREADVANCED="1"
+	fi
+	shift 1
+done
+
+if [ "$PREADVANCED" = "1" ] ; then
+	ADVANCED="1"
+elif [ "$ADVANCED" = "1" ]; then
+	ADVANCED=""
+fi
+
+if [ -n "$CLEAN" ] ; then
+	rm -f config.cache
+fi
+
+clear
+
+    if [ -f ".CHANGES.NEW" -a -z "$NOINTRO" ] ; then
+        more .CHANGES.NEW
+        echo $n "[Enter to continue]"
+        read cc
+        clear
+    fi
+    if [ -f "doc/RELEASE-NOTES" -a -z "$NOINTRO" ] ; then
+        more doc/RELEASE-NOTES
+        echo $n "[Enter to continue]"
+        read cc
+        clear
+    fi
+
+echo "We will now ask you a number of questions."
+echo "You can just press ENTER to accept the defaults!"
+echo ""
+
+if [ -z "$NOCACHE" ] ; then
+	# This needs to be updated each release so auto-upgrading works for settings, modules, etc!!:
+	UNREALRELEASES="unrealircd-4.2.3-rc1 unrealircd-4.2.2 unrealircd-4.2.2-rc2 unrealircd-4.2.2-rc1 unrealircd-4.2.1.1 unrealircd-4.2.1 unrealircd-4.2.1-rc1 unrealircd-4.2.0 unrealircd-4.0.19-rc2 unrealircd-4.0.19-rc1 unrealircd-4.0.18 unrealircd-4.0.18-rc2 unrealircd-4.0.18-rc1 unrealircd-4.0.17 unrealircd-4.0.17-rc1 unrealircd-4.0.16.1 unrealircd-4.0.16 unrealircd-4.0.15 unrealircd-4.0.14 unrealircd-4.0.14-rc1 unrealircd-4.0.13 unrealircd-4.0.13-rc1 unrealircd-4.0.12.1 unrealircd-4.0.12"
+	if [ -f "config.settings" ]; then
+		. ./config.settings
+	else
+		# Try to load a previous config.settings
+		for x in $UNREALRELEASES
+		do
+			if [ -f ../$x/config.settings ]; then
+				IMPORTEDSETTINGS="../$x"
+				break
+			fi
+		done
+		echo "If you have previously installed UnrealIRCd on this shell then you can specify a"
+		echo "directory here so I can import the build settings and third party modules"
+		echo "to make your life a little easier."
+		if [ ! -z "$IMPORTEDSETTINGS" ]; then
+			echo "Found previous installation in: $IMPORTEDSETTINGS."
+			echo "You can enter a different path or type 'none' if you don't want to use it."
+			echo "Just press Enter to accept the default settings."
+		else
+			echo "If you install UnrealIRCd for the first time on this shell, then just hit Enter";
+		fi
+
+		TEST="$IMPORTEDSETTINGS"
+		echo $n "[$TEST] -> $c"
+		read cc
+		if [ -z "$cc" ]; then
+			IMPORTEDSETTINGS="$TEST"
+		else
+			IMPORTEDSETTINGS="$cc"
+		fi
+		if [ "$IMPORTEDSETTINGS" = "none" ]; then
+			IMPORTEDSETTINGS=""
+		fi
+		if [ "$IMPORTEDSETTINGS" != "" ]; then
+			if [ ! -f $IMPORTEDSETTINGS/config.settings ]; then
+				echo "Directory $IMPORTEDSETTINGS does not exist or does not contain a config.settings file"
+				exit
+			fi
+			# Actually load the settings
+			. $IMPORTEDSETTINGS/config.settings
+			# Copy over 3rd party modules (also deals with 0 file cases, hence the silly looking code)
+			for f in $IMPORTEDSETTINGS/src/modules/third/*.c
+			do
+				[ -e "$f" ] && cp $f src/modules/third/
+			done
+		fi
+	fi
+	# If we just imported settings and the curl dir is set to
+	# something like /home/xxx/unrealircd-4.x.y/extras/curl/
+	# (what we call 'local-curl') then remove this setting as
+	# it would refer to the old UnrealIRCd installation.
+	if [ ! -z "$IMPORTEDSETTINGS" ]; then
+		if echo "$CURLDIR"|grep -qi unrealircd; then
+			CURLDIR=""
+		fi
+	fi
+fi
+
+TEST="$BASEPATH"
+echo ""
+echo "In what directory do you want to install UnrealIRCd?"
+echo "(Note: UnrealIRCd 4 will need to be installed somewhere."
+echo " If this directory does not exist it will be created.)"
+echo $n "[$TEST] -> $c"
+read cc
+if [ -z "$cc" ] ; then
+   BASEPATH=$TEST
+else
+   BASEPATH=`eval echo $cc` # modified
+fi
+if [ "$BASEPATH" = "$UNREALCWD" ]; then
+	echo ""
+	echo "ERROR: The installation directory cannot be the same as the directory"
+	echo "       containing the source code ($UNREALCWD)."
+	echo " HINT: Usually the directory containing the source is $HOME/unrealircd-4.x.y"
+	echo "       and the installation directory you would need to enter is $HOME/unrealircd"
+	exit 1
+fi
+
+# TODO: For -advanced we could prompt the user.
+BINDIR="$BASEPATH/bin"
+DATADIR="$BASEPATH/data"
+CONFDIR="$BASEPATH/conf"
+MODULESDIR="$BASEPATH/modules"
+LOGDIR="$BASEPATH/logs"
+CACHEDIR="$BASEPATH/cache"
+DOCDIR="$BASEPATH/doc"
+TMPDIR="$BASEPATH/tmp"
+LIBDIR="$BASEPATH/lib"
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    TEST="$DEFPERM"
+    echo ""
+    echo "What should the default permissions for your configuration files be? (Set this to 0 to disable)"
+    echo "It is strongly recommended that you use 0600 to prevent unwanted reading of the file"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	DEFPERM=$TEST
+	break
+    fi
+    case "$cc" in
+	[0-9]*)
+	    DEFPERM="$cc"
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter a number"
+	    TEST=""
+	    ;;
+    esac
+
+done
+
+
+
+
+echo ""
+echo "If you want, you can manually enter the path to OpenSSL/LibreSSL here."
+echo "In most cases you can leave this blank and it will be detected automatically."
+
+if [ -z "$SSLDIR" ]; then
+	uname|grep -q Darwin
+	if [ "$?" = 0 ]; then
+		echo "Looks like you're on a Mac - El Capitan and higher require"
+		echo "a 3rd party OpenSSL installation. We recommend using homebrew"
+		echo "to install OpenSSL, but you may install it any other way as well."
+		echo "We are selecting the default homebrew OpenSSL path - but you can"
+		echo "change it to another path if you have installed OpenSSL another way"
+		SSLDIR="/usr/local/opt/openssl/"
+	fi
+fi
+
+TEST="$SSLDIR"
+echo $n "[$TEST] -> $c"
+    read cc
+if [ -z "$cc" ] ; then
+    SSLDIR="$TEST"
+else 
+    SSLDIR=`eval echo $cc` # modified
+fi
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$REMOTEINC" = "1" ] ; then
+	TEST="Yes"
+    else
+	TEST="No"
+    fi
+    echo ""
+    echo "Do you want to enable remote includes?"
+    echo "This allows stuff like this in your configuration file:"
+    echo "include \"http://www.somesite.org/files/opers.conf\";"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	cc=$TEST
+    fi
+    case "$cc" in
+	[Yy]*)
+	    REMOTEINC="1"
+	    ;;
+	[Nn]*)
+	    REMOTEINC=""
+	    CURLDIR=""
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter either Yes or No"
+	    TEST=""
+	    ;;
+    esac
+done
+
+if [ "$REMOTEINC" = "1" ] ; then
+	if [ ! -d "$CURLDIR" ]; then
+		# Reset any previous CURLDIR if it doesn't exist (anymore)
+		CURLDIR=""
+	fi
+
+	INSTALLCURL="0"
+	SUGGESTCURLDIR=""
+
+	if [ -d "/usr/local/include/curl" ]; then
+		SUGGESTCURLDIR="/usr/local"
+	fi
+	if [ -d "/usr/include/curl" ]; then
+		SUGGESTCURLDIR="/usr"
+	fi
+	# This one also works for /usr/include/x86_64-linux-gnu and friends:
+	if [ -f "/usr/bin/curl-config" ]; then
+		SUGGESTCURLDIR="/usr"
+	fi
+
+	GOTASYNC=0
+	if [ "x$SUGGESTCURLDIR" != "x" ]; then
+		# Check if it's of any use: a curl without async dns (cares) hangs the entire ircd..
+		# normally this is done in ./configure but now we're forced to do it also here..
+		if "$SUGGESTCURLDIR"/bin/curl-config --features | grep -q -e AsynchDNS; then
+			GOTASYNC="1"
+		fi
+		if [ "$GOTASYNC" != "1" ]; then
+			SUGGESTCURLDIRBAD="$CURLDIR"
+			SUGGESTCURLDIR=""
+		fi
+	fi
+
+	if [ "x$CURLDIR" = "x$HOME/curl" ]; then
+		if [ "x$SUGGESTCURLDIR" != "x" ]; then
+			# I guess some people will complain about this, but if system wide cURL is available
+			# and many people have old defaults then this is much preferred:
+			echo ""
+			echo "WARNING: Your previous (potentially old) setting is to use cURL from $HOME/curl."
+			echo "However, your operating system also provides a working cURL."
+			echo "I am therefore changing the setting to: $SUGGESTCURLDIR"
+			CURLDIR="$SUGGESTCURLDIR"
+		else
+			echo ""
+			echo "WARNING: We no longer use $HOME/curl nowadays."
+			echo "Use the automatic download and install feature below."
+			CURLDIR=""
+		fi
+	fi
+
+	if [ "x$CURLDIR" = "x" ]; then
+		CURLDIR="$SUGGESTCURLDIR"
+		# NOTE: CURLDIR may still be empty after this
+
+		# System curl has no asyncdns, so install our own.
+		if [ "$GOTASYNC" != "1" ]; then
+			CURLDIR=""
+		fi
+
+		# Need to output it here, as the HOME check from above may cause this to be no longer relevant.
+		if [ "x$CURLDIR" = "x" -a "x$SUGGESTCURLDIRBAD" != "x" ]; then
+			echo "Curl library was found in $SUGGESTCURLDIRBAD, but it does not support Asynchronous DNS (not compiled with c-ares)"
+			echo "so it's of no use to us as it would stall the IRCd on REHASH."
+		fi
+	fi
+
+	# Final check
+	if [ "x$CURLDIR" != "x" ]; then
+		"$CURLDIR/bin/curl-config" --features 2>/dev/null | grep -q -e AsynchDNS
+		if [ "$?" != 0 ]; then
+			echo "Curl from $CURLDIR seems unusable ($CURLDIR/bin/curl-config does not exist)"
+			CURLDIR=""
+		fi
+	fi
+
+        if [ "x$CURLDIR" = "x" ]; then
+        	# Still empty?
+        	TEST=""
+                while [ -z "$TEST" ] ; do
+                    TEST="Yes"
+                    echo ""
+        	    echo "Do you want me to automatically download and install curl for you?"
+                    echo $n "[$TEST] -> $c"
+                        read cc
+                    if [ -z "$cc" ] ; then
+                        cc=$TEST
+                    fi
+                    case "$cc" in
+                        [Yy]*)
+                            INSTALLCURL="1"
+                            CURLDIR="$UNREALCWD/extras/curl"
+                            ;;
+                        [Nn]*)
+                            INSTALLCURL="0"
+                            ;;
+                        *)
+                            echo ""
+                            echo "You must enter either Yes or No"
+                            TEST=""
+                            ;;
+                    esac
+                done
+        fi
+
+	if [ "$INSTALLCURL" != "1" ]; then
+	  TEST=""
+          while [ -z "$TEST" ] ; do
+                  TEST="$CURLDIR"
+                  echo ""
+                  echo "Specify the directory you installed libcurl to"
+                  echo $n "[$TEST] -> $c"
+                  read cc
+                  if [ -z "$cc" ] ; then
+                      cc=$TEST
+                  else
+                      TEST=$cc
+                      CURLDIR=`eval echo $cc` # modified
+                  fi
+          done
+        fi
+fi
+
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    if [ "$PREFIXAQ" = "1" ] ; then
+	TEST="Yes"
+    else
+	TEST="No"
+    fi
+    echo ""
+    echo "Do you want to enable prefixes for chanadmin and chanowner?"
+    echo "This will give +a the & prefix and ~ for +q (just like +o is @)"
+    echo "Supported by the major clients (mIRC, xchat, epic, eggdrop, Klient,"
+    echo "PJIRC, irssi, CGI:IRC, etc.)"
+    echo "This feature should be enabled/disabled network-wide."
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	cc=$TEST
+    fi
+    case "$cc" in
+	[Yy]*)
+	    PREFIXAQ="1"
+	    ;;
+	[Nn]*)
+	    PREFIXAQ=""
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter either Yes or No"
+	    TEST=""
+	    ;;
+    esac
+done
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    TEST="$NICKNAMEHISTORYLENGTH"
+    echo ""
+    echo "How far back do you want to keep the nickname history?"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	NICKNAMEHISTORYLENGTH=$TEST
+	break
+    fi
+    case "$cc" in
+	[1-9]*)
+	    NICKNAMEHISTORYLENGTH="$cc"
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter a number"
+	    TEST=""
+	    ;;
+    esac
+done
+
+TEST=""
+while [ -z "$TEST" ] ; do
+    TEST="$MAXSENDQLENGTH"
+    echo ""
+    echo "What is the maximum sendq length you wish to have?"
+    echo $n "[$TEST] -> $c"
+	read cc
+    if [ -z "$cc" ] ; then
+	MAXSENDQLENGTH=$TEST
+	break
+    fi
+    case "$cc" in
+	[1-9][0-9][0-9][0-9]*)
+	    MAXSENDQLENGTH="$cc"
+	    ;;
+	*)
+	    echo ""
+	    echo "You must enter a number greater than or equal to 1000"
+	    TEST=""
+	    ;;
+    esac
+done
+
+echo ""
+TEST=""