summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2003-01-23 19:45:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2003-01-23 19:45:57 +0000
commit73b9d0c5cb02f0ea8350de28bc3687e0af70ea0f (patch)
treea5845579b1363762650f0e45c62a13890e1efa43 /configure
Initial revision
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@132 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure333
1 files changed, 333 insertions, 0 deletions
diff --git a/configure b/configure
new file mode 100755
index 000000000..d3e63a19e
--- /dev/null
+++ b/configure
@@ -0,0 +1,333 @@
+#!/bin/sh
+# InspIRCd Configuration Script
+#
+# Copyright 2003 The ChatSpike Development Team
+# <brain@chatspike.net>
+# <Craig@chatspike.net>
+#
+# $Id$
+#
+# Some shell code based on the configure script of IRC Services.
+# IRC Services is copyright (c) 1996-2002 Andrew Church.
+# E-mail: <achurch@achurch.org>
+#
+#
+########################################
+
+# echo -e "\033[1;37mtest\033[0;37m"
+
+echo "Configuring default values..."
+mkdir fdscount
+echo "#include <sys/types.h>" >> fdscount/fdcounter.c
+echo "#include <sys/socket.h>" >> fdscount/fdcounter.c
+echo "main()" >> fdscount/fdcounter.c
+echo "{" >> fdscount/fdcounter.c
+echo " int i;" >> fdscount/fdcounter.c
+echo " int s;" >> fdscount/fdcounter.c
+echo "" >> fdscount/fdcounter.c
+echo " for (i = 1; i <= 10000; i++)" >> fdscount/fdcounter.c
+echo " {" >> fdscount/fdcounter.c
+echo " s = socket(AF_INET, SOCK_STREAM, 0);" >> fdscount/fdcounter.c
+echo " if (s < 0)" >> fdscount/fdcounter.c
+echo " {" >> fdscount/fdcounter.c
+echo " printf(\"%i\", i + 2);" >> fdscount/fdcounter.c
+echo " exit(-1);" >> fdscount/fdcounter.c
+echo " }" >> fdscount/fdcounter.c
+echo " }" >> fdscount/fdcounter.c
+echo "}" >> fdscount/fdcounter.c
+
+echo "PROGS = fdcounter" >> fdscount/Makefile
+echo "OBJS = fdcounter.o" >> fdscount/Makefile
+echo "" >> fdscount/Makefile
+echo "CC = gcc" >> fdscount/Makefile
+echo "CXXFLAGS = -fPIC -frtti -O" >> fdscount/Makefile
+echo "" >> fdscount/Makefile
+echo "all : \$(PROGS)" >> fdscount/Makefile
+echo "" >> fdscount/Makefile
+echo "\$(PROGS): \$(OBJS)" >> fdscount/Makefile
+echo " \$(CXX) -rdynamic \$^ -o \$@" >> fdscount/Makefile
+echo "" >> fdscount/Makefile
+echo ".PHONY: clean" >> fdscount/Makefile
+echo "clean:" >> fdscount/Makefile
+echo " rm -f *.o core" >> fdscount/Makefile
+
+cd fdscount
+make
+cd ..
+
+ME=`pwd`
+PERL=`which perl`
+CONFIG_DIR=$ME/conf
+MODULE_DIR=$ME/modules
+MAX_CLIENT=`fdscount/fdcounter`
+NICK_LENGT=32
+CHAN_LENGT=64
+MAX_CHANNE=20
+MAXI_MODES=20
+
+rm -rf fdscount
+
+if [ "$PERL" = "" ] ; then
+ echo "You require perl to run this program."
+ exit;
+fi
+
+
+OSNAME=`(uname -s) 2>/dev/null` || OSNAME="unknown"
+
+c=""
+n=""
+if [ "`eval echo -n 'a'`" = "-n a" ] ; then
+ c="\c"
+else
+ n="-n"
+fi
+
+exists () { # because some shells don't have test -e
+ if [ -f $1 -o -d $1 -o -p $1 -o -c $1 -o -b $1 ] ; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+clear
+echo -e "'\033[1;33m####\033[0;37m:'\033[1;33m##\033[0;37m::: \033[1;33m##\033[0;37m::'\033[1;33m######\033[0;37m::'\033[1;33m########\033[0;37m::'\033[1;33m####\033[0;37m:'\033[1;33m########\033[0;37m:::'\033[1;33m######\033[0;37m::'\033[1;33m########\033[0;37m::"
+echo -e ". \033[1;33m##\033[0;37m:: \033[1;33m###\033[0;37m:: \033[1;33m##\033[0;37m:'\033[1;33m##\033[0;37m... \033[1;33m##\033[0;37m: \033[1;33m##\033[0;37m.... \033[1;33m##\033[0;37m:. \033[1;33m##\033[0;37m:: \033[1;33m##\033[0;37m.... \033[1;33m##\033[0;37m:'\033[1;33m##\033[0;37m... \033[1;33m##\033[0;37m: \033[1;33m##\033[0;37m.... \033[1;33m##\033[0;37m:"
+echo -e ": \033[1;33m##\033[0;37m:: \033[1;33m####\033[0;37m: \033[1;33m##\033[0;37m: \033[1;33m##\033[0;37m:::..:: \033[1;33m##\033[0;37m:::: \033[1;33m##\033[0;37m:: \033[1;33m##\033[0;37m:: \033[1;33m##\033[0;37m:::: \033[1;33m##\033[0;37m: \033[1;33m##\033[0;37m:::..:: \033[1;33m##\033[0;37m:::: \033[1;33m##\033[0;37m:"
+echo -e ": \033[1;33m##\033[0;37m:: \033[1;33m##\033[0;37m \033[1;33m##\033[0;37m \033[1;33m##\033[0;37m:. \033[1;33m######\033[0;37m:: \033[1;33m########\033[0;37m::: \033[1;33m##\033[0;37m:: \033[1;33m########\033[0;37m:: \033[1;33m##\033[0;37m::::::: \033[1;33m##\033[0;37m:::: \033[1;33m##\033[0;37m:"
+echo -e ": \033[1;33m##\033[0;37m:: \033[1;33m##\033[0;37m. \033[1;33m####\033[0;37m::..... \033[1;33m##\033[0;37m: \033[1;33m##\033[0;37m.....:::: \033[1;33m##\033[0;37m:: \033[1;33m##\033[0;37m.. \033[1;33m##\033[0;37m::: \033[1;33m##\033[0;37m::::::: \033[1;33m##\033[0;37m:::: \033[1;33m##\033[0;37m:"
+echo -e ": \033[1;33m##\033[0;37m:: \033[1;33m##\033[0;37m:. \033[1;33m###\033[0;37m:'\033[1;33m##\033[0;37m::: \033[1;33m##\033[0;37m: \033[1;33m##\033[0;37m::::::::: \033[1;33m##\033[0;37m:: \033[1;33m##\033[0;37m::. \033[1;33m##\033[0;37m:: \033[1;33m##\033[0;37m::: \033[1;33m##\033[0;37m: \033[1;33m##\033[0;37m:::: \033[1;33m##\033[0;37m:"
+echo -e "'\033[1;33m####\033[0;37m: \033[1;33m##\033[0;37m::. \033[1;33m##\033[0;37m:. \033[1;33m######\033[0;37m:: \033[1;33m##\033[0;37m::::::::'\033[1;33m####\033[0;37m: \033[1;33m##\033[0;37m:::. \033[1;33m##\033[0;37m:. \033[1;33m######\033[0;37m:: \033[1;33m########\033[0;37m::"
+echo -e "\033[0;37m\033[0;37m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::"
+echo ""
+echo -e "\033[1;37mWelcome to the InspIRCd Configuration program!"
+echo ""
+echo "*** If you are unsure of any of these values, leave it blank for ***"
+echo "*** standard settings that will work, and your server will run ***"
+echo "*** using them. If you are running this server as part of a ***"
+echo "*** larger network, you must consult with your network admins ***"
+echo "*** for the proper values to use, or server links will be unstable! ***"
+echo -e "\033[0;37m"
+echo -e "Press \033[1;37m<RETURN>\033[0;37m to accept the default for any option, or enter"
+echo -e "a new value. Please note: You will \033[1;37mHAVE\033[0;37m to read the docs"
+echo -e "dir, otherwise you won't have a config file!"
+echo ""
+echo -e "Your operating system is: \033[1;37m$OSNAME\033[0;37m (`uname -mnr`), fdmax: $MAX_CLIENT"
+echo ""
+
+#############################################################################
+
+ ok=0
+ asked=1
+ echo "In what directory are the configuration files?"
+ while [ $ok -eq 0 ] ; do
+ echo -e $n "[\033[1;32m$CONFIG_DIR\033[0;37m] -> $c"
+ if read INPUT ; then : ; else echo "" ; exit 1 ; fi
+ if [ ! "$INPUT" ] ; then
+ INPUT=$CONFIG_DIR
+ default=1
+ fi
+ if echo "$INPUT" | grep -q \[\'\"\\\] ; then
+ echo 'Please use a pathname without the characters: '\'' " \'
+ elif [ ! "$NO_DIR_CHECK" -a ! -d "$INPUT" ] ; then
+ if exists "$INPUT" ; then
+ echo "$INPUT exists, but is not a directory!"
+ else
+ echo "$INPUT does not exist. Create it?"
+ echo -e $n "[\033[1;32my\033[0;37m] $c"
+ read YN
+ if [ "$YN" != "n" ] ; then
+ if mkdir -p "$INPUT" ; then
+ ok=1
+ fi
+ fi
+ fi
+ else
+ ok=1
+ fi
+ done
+ CONFIG_DIR=$INPUT
+ echo ""
+
+
+##############################################################################
+
+ ok=0
+ asked=1
+ echo "In What directory are the modules to be compiled to?"
+ while [ $ok -eq 0 ] ; do
+ echo -e $n "[\033[1;32m$MODULE_DIR\033[0;37m] -> $c"
+ if read INPUT ; then : ; else echo "" ; exit 1 ; fi
+ if [ ! "$INPUT" ] ; then
+ INPUT=$MODULE_DIR
+ default=1
+ fi
+ if echo "$INPUT" | grep -q \[\'\"\\\] ; then
+ echo 'Please use a pathname without the characters: '\'' " \'
+ elif [ ! "$NO_DIR_CHECK" -a ! -d "$INPUT" ] ; then
+ if exists "$INPUT" ; then
+ echo "$INPUT exists, but is not a directory!"
+ else
+ echo "$INPUT does not exist. Create it?"
+ echo -e $n "[\033[1;32my\033[0;37m] $c"
+ read YN
+ if [ "$YN" != "n" ] ; then
+ if mkdir -p "$INPUT" ; then
+ ok=1
+ fi
+ fi
+ fi
+ else
+ ok=1
+ fi
+ done
+ MODULE_DIR=$INPUT
+ echo ""
+
+
+###############################################################################
+
+ 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"
+ else
+ MAX_CLIENT=$cc
+ 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 ""
+
+###############################################################################
+
+ 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 ""
+
+###############################################################################
+
+ 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 ""
+
+###############################################################################
+
+ 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 ""
+
+###############################################################################
+
+
+echo -e "\033[1;32mPre-build configuration is complete!\033[0;37m"
+echo ""
+echo -e "\033[0;37mConfig path:\033[1;32m\t\t\t$CONFIG_DIR"
+echo -e "\033[0;37mModule path:\033[1;32m\t\t\t$MODULE_DIR"
+echo -e "\033[0;37mMax connections:\033[1;32m\t\t$MAX_CLIENT"
+echo -e "\033[0;37mMax User Channels\033[1;32m\t\t$MAX_CHANNE"
+echo -e "\033[0;37mMax nickname length:\033[1;32m\t\t$NICK_LENGT"
+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 -e "Writing \033[1;37m${OSNAME}\033[0;37m makefile"
+
+cp -f Makefile.${OSNAME} Makefile
+
+echo ""
+echo "Do you want to compile the IRCd binaries?"
+echo -e $n "[\033[1;32my\033[0;37m] $c"
+read YN
+if [ "$YN" != "n" ] ; then
+ echo ""
+ echo -e "\033[1;32mCompiling...\033[0;37m"
+ echo ""
+ cd $ME
+ make
+ echo ""
+ echo "Done!"
+ echo ""
+else
+ echo ""
+ echo "Done!"
+ echo ""
+ echo -e "To build your server with these settings, please type '\033[1;32mmake\033[0;37m' now."
+ echo ""
+ echo -e "*** \033[1;32mRemember to edit your configuration files!!!\033[0;37m ***"
+ echo ""
+fi
+
+
+echo ""
+echo "Do you want to run the config file maker?"
+echo -e $n "[\033[1;32my\033[0;37m] $c"
+read YN
+if [ "$YN" != "n" ] ; then
+ sh makeconf
+fi
+
+echo -e "*** \033[1;32mRemember to edit your configuration files!!!\033[0;37m ***"
+echo ""
+