X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=configure;h=11c146085a5691652fde8e9d9acffbbff5e390c0;hb=0f781e55b0bccde1e0aade19065d9ef10a05682a;hp=827e41bfaab3bb8472178b8529807a79bd0b2492;hpb=91e310a8605a993c9a32aeead21b4de548d82f00;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/configure b/configure index 827e41bfa..11c146085 100755 --- a/configure +++ b/configure @@ -7,80 +7,78 @@ # # $Id$ # -# Some shell code based on the configure script of IRC Services. -# IRC Services is copyright (c) 1996-2002 Andrew Church. -# E-mail: -# -# ######################################## -# echo -e "\033[1;37mtest\033[0;37m" - echo "Configuring default values..." -mkdir fdscount -echo "#include " >> fdscount/fdcounter.c -echo "#include " >> 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` +GCCVER=`gcc -dumpversion | cut -c 1` CONFIG_DIR=$ME/conf MODULE_DIR=$ME/modules -MAX_CLIENT=`fdscount/fdcounter` +BINARY_DIR=$ME/bin +OPTIMITEMP=0 +OPTIMISATI="-g" +MAX_CLIENT_T=`ulimit -n` NICK_LENGT=32 CHAN_LENGT=64 MAX_CHANNE=20 MAXI_MODES=20 +OSNAME=`(uname -s) 2>/dev/null` || OSNAME="unknown" -rm -rf fdscount - -if [ "$PERL" = "" ] ; then - echo "You require perl to run this program." - exit +if [ -z $MAX_CLIENT_T ] ; then + MAX_CLIENT_T=1024 + SCAN_FAILED=1 fi + if [ "$1" = "-clean" -o "$2" = "-clean" ] ; then - CLEAN="1" + `rm -rf .config.cache` fi -if [ -e "config.cache" -a -z "$CLEAN" ] ; then - . config.cache +if [ -e ".config.cache" -a -z "$CLEAN" ] ; then + . .config.cache fi -OSNAME=`(uname -s) 2>/dev/null` || OSNAME="unknown" +if [ "$1" = "-update" -o "$2" = "-update" ] ; then + # They wanna update their Makefile.. good for 'em + # Make sure .config.cache exists + if [ ! -e ".config.cache" ] ; then + echo "You have not run ./configure before. Please do this before trying to run the update script." + exit 0 + fi + # Right, load the cache values + . .config.cache + # Check for modules + + case "$OSNAME" in + (FreeBSD) + LDLIBS="-Ldl" + FLAGS="-fPIC -frtti $OPTIMISATI" + MAKEPROG="gmake" + ;; + (*) + LDLIBS="-ldl" + FLAGS="-fPIC -frtti $OPTIMISATI" + MAKEPROG="make" + ;; + esac + + MODULES="" + for module in src/modules/*.cpp ; do + mod=`echo $module | sed 's/.cpp/.so/' | sed 's/src\/modules\///'` + MODULES="$MODULES $mod" + done + + # Write the new makefile. + . .Makefile.inc + echo "Complete." + exit 1; +fi + + +if [ -z $MAX_CLIENT ] ; then + MAX_CLIENT=$MAX_CLIENT_T +fi c="" @@ -121,7 +119,7 @@ echo -e "Press \033[1;37m\033[0;37m to accept the default for any option 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 -e "Your operating system is: \033[1;37m$OSNAME\033[0;37m (`uname -mnr`), fdmax: $MAX_CLIENT_T" echo "" ############################################################################# @@ -194,60 +192,193 @@ echo "" 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 + ok=0 + asked=1 + echo "In what directory is the IRCd binary to be placed?" + while [ $ok -eq 0 ] ; do + echo -e $n "[\033[1;32m$BINARY_DIR\033[0;37m] -> $c" + if read INPUT ; then : ; else echo "" ; exit 1 ; fi + if [ ! "$INPUT" ] ; then + INPUT=$BINARY_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 + BINARY_DIR=$INPUT echo "" ############################################################################### +# Craigs Version 3 With slightly less Cheeze :p + +cheeze=0 +echo -e "Maximum number of clients at any one time (\033[1;32m1-$MAX_CLIENT_T\033[0;37m)?" +while [ "$cheeze" -eq "0" ] ; do + echo -e $n "[\033[1;32m$MAX_CLIENT\033[0;37m] -> $c" + read cc + + if [ -z "$cc" ] ; then + cc=$MAX_CLIENT + fi + + case "$cc" in + [0-9]*) + if [ "$cc" -gt "$MAX_CLIENT_T" -a -z "$SCAN_FAILED" ] ; then + echo -e "WARNING: Our scans have indicated that you are attempting" + echo -e "to use more sockets than there are avaliable. Are you sure" + echo -e "you wish to do this? It may cause the IRCd to malfunction [y/n]" + echo -e $n "[\033[1;32mn\033[0;37m] -> $c" + read YN + if [ "$YN" = "y" ] ; then + MAX_CLIENT=$cc + cheeze=1 + else + echo "" + echo -e "Please enter the correct value (\033[1;32m1-$MAX_CLIENT_T\033[0;37m)" + fi + else + echo $SCAN_FAILED + cheeze=1 + MAX_CLIENT=$cc + fi + ;; + *) + echo "" + echo "You must enter a number in this field. Please try again." + ;; + esac +done +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 "" + 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" + 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 "" + +############################################################################### +# Code Optimisation? + + cheeze=0 + echo -e "Enter the Level Of Binary optimisation. This is a number between 0 and 3 (inclusive)" + echo -e "The InspIRCd Team will _NOT_ support any bug reports above 0." + echo -e "Also note, the IRCd behaviour will be different depending on this value." + echo -e "Please read the documentation for more information." + echo -e "" + echo -e "The Higher the number, the more optimised your binary will be. This value will default to 0" + echo -e "If you either a) Dont enter a number, or b) Enter a value outside the range." + echo -e $n "[\033[1;32m$OPTIMITEMP\033[0;37m] -> $c" read cc - if [ "$cc" ] ; then - MAXI_MODES=$cc + if [ -z "$cc" ] ; then + cc=$OPTIMITEMP fi - echo "" + case "$cc" in + (1) + OPTIMITEMP=1 + OPTIMISATI="-O" + ;; + (2) + OPTIMITEMP=2 + OPTIMISATI="-O2" + ;; + (3) + OPTIMITEMP=3 + OPTIMISATI="-O3" + ;; + (*) + OPTIMITEMP=0 + OPTIMISATI="-g" + ;; + esac + echo "" ############################################################################### @@ -261,25 +392,32 @@ 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;37mGCC Version Found:\033[1;32m\t\t$GCCVER" +echo -e "\033[0;37mOptimation Flag:\033[1;32m\t\t$OPTIMISATI" echo -e "\033[0;37m" echo "Writing cache file for future ./configures ..." -if [ -e "config.cache" ] ; then - rm config.cache +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 "CONFIG_DIR=\"$CONFIG_DIR\"" >> .config.cache +echo "MODULE_DIR=\"$MODULE_DIR\"" >> .config.cache +echo "BINARY_DIR=\"$BINARY_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 "OPTIMITEMP=\"$OPTIMITEMP\"" >> .config.cache +echo "OPTIMISATI=\"$OPTIMISATI\"" >> .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 +if [ "$GCCVER" -eq "3" ] ; then +echo "#define GCC3" >>include/inspircd_config.h +fi 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 @@ -290,26 +428,43 @@ 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 OPTIMISATION $OPTIMITEMP" >>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 "" +echo "Preparing Variables for the Makefile" -if exists "Makefile.$OSNAME" ; then - echo "Operating system supported." -else - echo "Your operating system, \"$OSNAME\", is not supported!" - exit +if [ "$CONFIG_DIR" != "$ME/conf" ] ; then + COPY_CONF=1 fi + +case "$OSNAME" in + (FreeBSD) + LDLIBS="-Ldl" + FLAGS="-fPIC -frtti $OPTIMISATI" + MAKEPROG="gmake" + ;; + (*) + LDLIBS="-ldl" + FLAGS="-fPIC -frtti $OPTIMISATI" + MAKEPROG="make" + ;; +esac + +MODULES="" +for module in src/modules/*.cpp ; do + mod=`echo $module | sed 's/.cpp/.so/' | sed 's/src\/modules\///'` + MODULES="$MODULES $mod" +done + +echo -e "Writing \033[1;37m$OSNAME\033[0;37m makefile" echo "" -cp -f Makefile.$OSNAME Makefile -cp -f src/Makefile.$OSNAME src/Makefile -cp -f src/modules/Makefile.$OSNAME src/modules/Makefile +. .Makefile.inc + +echo "" echo "" echo "Do you want to compile the IRCd binaries?" @@ -320,7 +475,7 @@ if [ "$YN" != "n" ] ; then echo -e "\033[1;32mCompiling...\033[0;37m" echo "" cd $ME - make + $MAKEPROG echo "" echo "Done!" echo ""