echo " rm -f *.o core" >> fdscount/Makefile
cd fdscount
-make
+make >> /dev/null
cd ..
ME=`pwd`
-PERL=`which perl`
CONFIG_DIR=$ME/conf
MODULE_DIR=$ME/modules
MAX_CLIENT=`fdscount/fdcounter`
rm -rf fdscount
-if [ "$PERL" = "" ] ; then
- echo "You require perl to run this program."
- exit;
+if [ -z $MAX_CLIENT ] ; then
+ MAX_CLIENT=1024
+ SCAN_FAILED=1
fi
+if [ "$1" = "-clean" -o "$2" = "-clean" ] ; then
+ `rm -rf config.cache`
+fi
+
+if [ -e "config.cache" -a -z "$CLEAN" ] ; then
+ . config.cache
+fi
+
+OSNAME=`(uname -s) 2>/dev/null` || OSNAME="unknown"
-OSNAME=`(uname -s) 2>/dev/null` || OSNAME="unknown"
c=""
n=""
###############################################################################
+# Craigs Version 2 With Extra Cheeze :p
+ cheeze=0
echo -e "Maximum number of clients at any one time (\033[1;32m1-$MAX_CLIENT\033[0;37m)?"
- echo -e $n "[\033[1;32m$MAX_CLIENT\033[0;37m] -> $c"
- read cc
- if [ "$cc" ] ; then
- if [ "$cc" > "$MAX_CLIENT" ] ; then
- echo -e "Number entered was above the maximum allowed by your OS."
- echo -e "Max clients was set to the highest possible value, \033[1;32m$MAX_CLIENT\033[0;37m"
+ while [ "$cheeze" -eq "0" ] ; do
+ echo -e $n "[\033[1;32m$MAX_CLIENT\033[0;37m] -> $c"
+ read cc
+ if [ "$cc" ] ; then
+ case "$cc" in
+ [0-9]*)
+ if [ "$cc" > "$MAX_CLIENT" ] ; then
+ ASK=1
+ else
+ MAX_CLIENT=$cc
+ fi
+ cheeze=1
+ ;;
+ *)
+ echo ""
+ echo "You Must Enter a Number in this field. Please Try Again."
+ cheeze=0
+ ;;
+ esac
else
- MAX_CLIENT=$cc
+ cheeze=1
fi
- fi
- echo ""
-
-###############################################################################
-
- echo "What is the Maximum length of nicknames?"
- echo -e $n "[\033[1;32m$NICK_LENGT\033[0;37m] -> $c"
- read cc
- if [ "$cc" ] ; then
- NICK_LENGT=$cc
- fi
- echo ""
+ if [ "$cheeze" -eq "1" ] ; then
+ if [ -z "$SCAN_FAILED" ] ; then
+ if [ "$ASK" -eq "1" ] ; then
+ echo "WARNING: Our scans have indicated that you are"
+ echo " Attempting to use more sockets than"
+ echo " there are avaliable, do you wish to"
+ echo " do this? [y/n]"
+ echo -e $n "[\033[1;32mn\033[0;37m] $c"
+ read YN
+ if [ "$YN" == "y" ] ; then
+ MAX_CLIENT=$cc
+ else
+ cheeze=0
+ echo ""
+ echo "Please Enter the Correct number of sockets:"
+ fi
+ fi
+ fi
+ fi
+ done
+ echo ""
###############################################################################
- echo "What is the Maximum length of channel names?"
- echo -e $n "[\033[1;32m$CHAN_LENGT\033[0;37m] -> $c"
- read cc
- if [ "$cc" ] ; then
- CHAN_LENGT=$cc
- fi
- echo ""
+ cheeze=0
+ echo -e "What is the Maximum length of nicknames?"
+ while [ "$cheeze" -eq "0" ] ; do
+ echo -e $n "[\033[1;32m$NICK_LENGT\033[0;37m] -> $c"
+ read cc
+ if [ "$cc" ] ; then
+ case "$cc" in
+ [0-9]*)
+ NICK_LENGT=$cc
+ cheeze=1
+ ;;
+ *)
+ echo ""
+ echo "You Must Enter a Number in this field. Please Try Again."
+ cheeze=0
+ ;;
+ esac
+ else
+ cheeze=1
+ fi
+ done
+ echo ""
###############################################################################
- echo "What is the Maximum Number of channels a user may Join?"
- echo -e $n "[\033[1;32m$MAX_CHANNE\033[0;37m] -> $c"
- read cc
- if [ "$cc" ] ; then
- MAX_CHANNE_LENGT=$cc
- fi
- echo ""
+ cheeze=0
+ echo -e "What is the Maximum length of channel names?"
+ while [ "$cheeze" -eq "0" ] ; do
+ echo -e $n "[\033[1;32m$MAX_CHANNE\033[0;37m] -> $c"
+ read cc
+ if [ "$cc" ] ; then
+ case "$cc" in
+ [0-9]*)
+ MAX_CHANNE=$cc
+ cheeze=1
+ ;;
+ *)
+ echo ""
+ echo "You Must Enter a Number in this field. Please Try Again."
+ cheeze=0
+ ;;
+ esac
+ else
+ cheeze=1
+ fi
+ done
+ echo ""
###############################################################################
- echo "What is the Maximum number of mode changes in one line?"
- echo -e $n "[\033[1;32m$MAXI_MODES\033[0;37m] -> $c"
- read cc
- if [ "$cc" ] ; then
- MAXI_MODES=$cc
- fi
- echo ""
+ cheeze=0
+ echo -e "What is the Maximum number of mode changes in one line?"
+ while [ "$cheeze" -eq "0" ] ; do
+ echo -e $n "[\033[1;32m$MAXI_MODES\033[0;37m] -> $c"
+ read cc
+ if [ "$cc" ] ; then
+ case "$cc" in
+ [0-9]*)
+ MAXI_MODES=$cc
+ cheeze=1
+ ;;
+ *)
+ echo ""
+ echo "You Must Enter a Number in this field. Please Try Again."
+ cheeze=0
+ ;;
+ esac
+ else
+ cheeze=1
+ fi
+ done
+ echo ""
###############################################################################
echo -e "\033[0;37mMax channel length:\033[1;32m\t\t$CHAN_LENGT"
echo -e "\033[0;37mMax mode length:\033[1;32m\t\t$MAXI_MODES"
echo -e "\033[0;37m"
-echo "Writing inspircd_config.h ..."
-
-
-echo "/* Auto generated by configure, do not modify! */" >inspircd_config.h
-echo "" >>inspircd_config.h
-echo "#define SYSLOG_FACILITY LOG_DAEMON" >>inspircd_config.h
-echo "#define SYSLOG_LEVEL LOG_NOTICE" >>inspircd_config.h
-echo "#define CONFIG_FILE \"$CONFIG_DIR/inspircd.conf\"" >>inspircd_config.h
-echo "#define MOD_PATH \"$MODULE_DIR\"" >>inspircd_config.h
-echo "#define VERSION \"`sh ./version.sh`\"" >>inspircd_config.h
-echo "#define MAXCLIENTS $MAX_CLIENT" >>inspircd_config.h
-echo "#define NICKMAX $NICK_LENGT" >>inspircd_config.h
-echo "#define CHANMAX $CHAN_LENGT" >>inspircd_config.h
-echo "#define MAXCHANS $MAX_CHANNE" >>inspircd_config.h
-echo "#define MAXMODES $MAXI_MODES" >>inspircd_config.h
-echo "#define SYSTEM \"`uname -n -s -r`\"" >>inspircd_config.h
-echo "#define MAXBUF 514">>inspircd_config.h
-echo "$MODULE_DIR">.modpath
-
-touch inspircd_config.h
-rm -rf *.o core $MOD_PATH/*.so
-echo ""
-echo -e "\033[1;32mDetecting modules...\033[0;37m"
-MODLINE=""
-for module in m_*.cpp ; do
- mod=`perl -e '$a='$module';print substr($a,0,length($a)-3)'`
- dmod=`perl -e '$a="'$mod'";while (length($a)<30) { $a = "$a ";}; print $a;'`
- desc=`perl -e 'open (F, "<'$module'");local($/)=undef;$blah=<F>;$blah=~/\$ModDesc(.*)\*\//;print substr($1,13,length($1));close F;'`
- echo -e "Found \033[1;32m$dmod\033[0;37m$desc"
- MODLINE="$mod.so $MODLINE"
-done
-echo ""
-echo -e "Module list: \033[1;32m$MODLINE\033[0;37m"
-echo ""
+echo "Writing cache file for future ./configures ..."
+if [ -e "config.cache" ] ; then
+ rm config.cache
+fi
+echo "CONFIG_DIR=\"$CONFIG_DIR\"" >> config.cache
+echo "MODULE_DIR=\"$MODULE_DIR\"" >> config.cache
+echo "MAX_CLIENT=\"$MAX_CLIENT\"" >> config.cache
+echo "MAX_CHANNE=\"$MAX_CHANNE\"" >> config.cache
+echo "NICK_LENGT=\"$NICK_LENGT\"" >> config.cache
+echo "MAXI_MODES=\"$MAXI_MODES\"" >> config.cache
+
+
+
+echo "Writing include/inspircd_config.h ..."
+
+echo "/* Auto generated by configure, do not modify! */" >include/inspircd_config.h
+echo "" >>include/inspircd_config.h
+echo "#define SYSLOG_FACILITY LOG_DAEMON" >>include/inspircd_config.h
+echo "#define SYSLOG_LEVEL LOG_NOTICE" >>include/inspircd_config.h
+echo "#define CONFIG_FILE \"$CONFIG_DIR/inspircd.conf\"" >>include/inspircd_config.h
+echo "#define MOD_PATH \"$MODULE_DIR\"" >>include/inspircd_config.h
+echo "#define VERSION \"`sh ./src/version.sh`\"" >>include/inspircd_config.h
+echo "#define MAXCLIENTS $MAX_CLIENT" >>include/inspircd_config.h
+echo "#define NICKMAX $NICK_LENGT" >>include/inspircd_config.h
+echo "#define CHANMAX $CHAN_LENGT" >>include/inspircd_config.h
+echo "#define MAXCHANS $MAX_CHANNE" >>include/inspircd_config.h
+echo "#define MAXMODES $MAXI_MODES" >>include/inspircd_config.h
+echo "#define SYSTEM \"`uname -n -s -r`\"" >>include/inspircd_config.h
+echo "#define MAXBUF 514">>include/inspircd_config.h
+
+touch include/inspircd_config.h
+echo -e "Writing \033[1;37m$OSNAME\033[0;37m makefile"
+echo ""
+if exists "Makefile.$OSNAME" ; then
+ echo "Operating system supported."
+else
+ echo "Your operating system, \"$OSNAME\", is not supported!"
+ exit
+fi
-echo -e "Writing \033[1;37m$OSNAME\033[0;37m makefile"
+echo ""
cp -f Makefile.$OSNAME Makefile
-cp -f src/Makefile.$OSNAME src/Makefile.$OSNAME
-cp -f src/modules/Makefile.$OSNAME src/modules/Makefile.$OSNAME
+cp -f src/Makefile.$OSNAME src/Makefile
+cp -f src/modules/Makefile.$OSNAME src/modules/Makefile
echo ""
echo "Do you want to compile the IRCd binaries?"