]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - configure
Added -Wswitch -Wchar-subscripts -Wparentheses - more stable and more pedantic settin...
[user/henk/code/inspircd.git] / configure
1 #!/bin/sh
2 # InspIRCd Configuration Script
3 #
4 # Copyright 2003 The ChatSpike Development Team
5 # <brain@chatspike.net>
6 # <Craig@chatspike.net>
7 #
8 # $Id$
9 #
10 #
11 ########################################
12
13 echo "Configuring default values..."
14
15 ME=`pwd`
16 GCCVER=`gcc -dumpversion | cut -c 1`
17 GCC34=`gcc -dumpversion | cut -c 3`
18 CONFIG_DIR=$ME/conf
19 MODULE_DIR=$ME/modules
20 BINARY_DIR=$ME/bin
21 INSTALL=`which install`
22 OPTIMITEMP=0
23 OPTIMISATI="-g"
24 MAX_CLIENT_T=`ulimit -n`
25 NICK_LENGT=32
26 CHAN_LENGT=64
27 MAX_CHANNE=20
28 MAXI_MODES=20
29 HAS_STRLCPY=0
30 OSNAME=`(uname -s) 2>/dev/null` || OSNAME="unknown"
31
32 if [ -z $MAX_CLIENT_T ] ; then
33         MAX_CLIENT_T=1024
34         SCAN_FAILED=1
35 fi
36
37
38 if [ "$1" = "-clean" -o "$2" = "-clean" ] ; then
39   `rm -rf .config.cache`
40 fi
41
42 if [ -e ".config.cache" -a -z "$CLEAN" ] ; then
43     . .config.cache 
44 fi
45
46 if [ "$1" = "-update" -o "$2" = "-update" ] ; then
47    # They wanna update their Makefile.. good for 'em
48    # Make sure .config.cache exists
49    if [ ! -e ".config.cache" ] ; then
50      echo "You have not run ./configure before. Please do this before trying to run the update script."
51      exit 0
52    fi
53    # Right, load the cache values
54    . .config.cache
55    # Check for modules
56
57    case "$OSNAME" in
58            FreeBSD)
59                    LDLIBS="-Ldl"
60                    FLAGS="-fPIC -frtti $OPTIMISATI -Wcomment -Wformat -Wunused -Wshadow -Werror -Wswitch -Wchar-subscripts -Wparentheses"
61                    MAKEPROG="gmake"
62                    ;;
63            *)
64                    LDLIBS="-ldl"
65                    FLAGS="-fPIC -frtti $OPTIMISATI -Wcomment -Wformat -Wunused -Wshadow -Werror -Wswitch -Wchar-subscripts -Wparentheses"
66                    MAKEPROG="make"
67                    ;;
68    esac
69
70    MODULES=""
71    for module in src/modules/*.cpp ; do
72            mod=`echo $module | sed 's/.cpp/.so/' | sed 's/src\/modules\///'`
73            MODULES="$MODULES $mod"
74    done
75
76    # Write the new makefile.
77    for file in Makefile; do
78           echo -e "\033[0mWriting \033[1;32m$file\033[0m"
79           rm -f $file
80           sed -e "
81                   s%@MAKEPROG@%$MAKEPROG%g
82                   s%@FLAGS@%$FLAGS%g
83                   s%@LDLIBS@%$LDLIBS%g
84                   s%@CONFIG_DIR@%$CONFIG_DIR%g
85                   s%@MODULE_DIR@%$MODULE_DIR%g
86                   s%@BINARY_DIR@%$BINARY_DIR%g
87                   s%@MODULES@%$MODULES%g
88           " .${file}.inc >> $file
89    done
90    echo -e "\033[0mWriting \033[1;32msrc/modules/Makefile\033[0m"
91    rm -f src/modules/Makefile
92
93    # Generate the Header..
94
95    echo "# (C) ChatSpike development team" >> src/modules/Makefile
96    echo "# Makefile by <Craig@ChatSpike.net>" >> src/modules/Makefile
97    echo "# Many Thanks to Andrew Church <achurch@achurch.org>" >> src/modules/Makefile
98    echo "#    for assisting with making this work right." >> src/modules/Makefile
99    echo "#" >> src/modules/Makefile
100    echo "# Automatically Generated by ./configure to add a module" >> src/modules/Makefile
101    echo "# please run ./configure --update" >> src/modules/Makefile
102    echo "" >> src/modules/Makefile
103    echo "all: \$(MODULES)" >> src/modules/Makefile
104    echo "" >> src/modules/Makefile
105
106
107    for module in src/modules/*.cpp ; do
108         flags=`grep '$CompileFlags: ' $module | sed 's/\/\* $CompileFlags://' | sed 's/\*\///'`
109         mod=`echo $module | sed 's/.cpp/.so/' | sed 's/src\/modules\///'`
110         mod2=`echo $module | sed 's/src\/modules\///'`
111         echo "$mod: $mod2 ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/servers.h ../../include/base.h" >> src/modules/Makefile
112         echo "  \$(CC) -I../../include \$(FLAGS) -shared$flags -o $mod $mod2" >> src/modules/Makefile
113         echo "  @cp $mod \$(MODPATH)/" >> src/modules/Makefile
114         echo "" >> src/modules/Makefile
115    done
116
117
118    echo "Complete."
119    exit 1; 
120 fi
121
122
123 if [ -z $MAX_CLIENT ] ; then
124         MAX_CLIENT=$MAX_CLIENT_T
125 fi
126
127
128 c=""
129 n=""
130 if [ "`eval echo -e -n 'a'`" = "-n a" ] ; then
131         c="\c"
132 else
133         n="-n"
134 fi
135
136 exists () { # because some shells don't have test -e
137     if [ -f $1 -o -d $1 -o -p $1 -o -c $1 -o -b $1 ] ; then
138         return 0
139     else
140         return 1
141     fi
142 }
143
144 echo "#include <string.h>">.test.cpp
145 echo "#include <stdio.h>">>.test.cpp
146 echo "int main() { char a[10]; char b[10]; strlcpy(a,b,10); printf(\"%d\\n\",9); }" >>.test.cpp
147 g++ -o .test .test.cpp 2>&1
148 if [ -e ".test" ] ; then
149         HAS_STRLCPY=1
150 fi 
151 rm -f .test.cpp .test
152
153 clear
154 echo -e "'\033[1;33m####\033[0m:'\033[1;33m##\033[0m::: \033[1;33m##\033[0m::'\033[1;33m######\033[0m::'\033[1;33m########\033[0m::'\033[1;33m####\033[0m:'\033[1;33m########\033[0m:::'\033[1;33m######\033[0m::'\033[1;33m########\033[0m::"
155 echo -e ". \033[1;33m##\033[0m:: \033[1;33m###\033[0m:: \033[1;33m##\033[0m:'\033[1;33m##\033[0m... \033[1;33m##\033[0m: \033[1;33m##\033[0m.... \033[1;33m##\033[0m:. \033[1;33m##\033[0m:: \033[1;33m##\033[0m.... \033[1;33m##\033[0m:'\033[1;33m##\033[0m... \033[1;33m##\033[0m: \033[1;33m##\033[0m.... \033[1;33m##\033[0m:"
156 echo -e ": \033[1;33m##\033[0m:: \033[1;33m####\033[0m: \033[1;33m##\033[0m: \033[1;33m##\033[0m:::..:: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:: \033[1;33m##\033[0m:: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m: \033[1;33m##\033[0m:::..:: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:"
157 echo -e ": \033[1;33m##\033[0m:: \033[1;33m##\033[0m \033[1;33m##\033[0m \033[1;33m##\033[0m:. \033[1;33m######\033[0m:: \033[1;33m########\033[0m::: \033[1;33m##\033[0m:: \033[1;33m########\033[0m:: \033[1;33m##\033[0m::::::: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:"
158 echo -e ": \033[1;33m##\033[0m:: \033[1;33m##\033[0m. \033[1;33m####\033[0m::..... \033[1;33m##\033[0m: \033[1;33m##\033[0m.....:::: \033[1;33m##\033[0m:: \033[1;33m##\033[0m.. \033[1;33m##\033[0m::: \033[1;33m##\033[0m::::::: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:"
159 echo -e ": \033[1;33m##\033[0m:: \033[1;33m##\033[0m:. \033[1;33m###\033[0m:'\033[1;33m##\033[0m::: \033[1;33m##\033[0m: \033[1;33m##\033[0m::::::::: \033[1;33m##\033[0m:: \033[1;33m##\033[0m::. \033[1;33m##\033[0m:: \033[1;33m##\033[0m::: \033[1;33m##\033[0m: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:"
160 echo -e "'\033[1;33m####\033[0m: \033[1;33m##\033[0m::. \033[1;33m##\033[0m:. \033[1;33m######\033[0m:: \033[1;33m##\033[0m::::::::'\033[1;33m####\033[0m: \033[1;33m##\033[0m:::. \033[1;33m##\033[0m:. \033[1;33m######\033[0m:: \033[1;33m########\033[0m::"
161 echo -e "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::"
162 echo ""
163 echo "Welcome to the InspIRCd Configuration program!"
164 echo ""
165 echo "*** If you are unsure of any of these values, leave it blank for    ***"
166 echo "*** standard settings that will work, and your server will run      ***"
167 echo "*** using them. If you are running this server as part of a         ***"
168 echo "*** larger network, you must consult with your network admins       ***"
169 echo "*** for the proper values to use, or server links will be unstable! ***"
170 echo ""
171 echo -e "Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter"
172 echo -e "a new value. Please note: You will \033[1mHAVE\033[0m to read the docs"
173 echo -e "dir, otherwise you won't have a config file!"
174 echo ""
175 echo -e "Your operating system is: \033[1;32m$OSNAME\033[0m (`uname -mnr`), fdmax: $MAX_CLIENT_T"
176 echo ""
177
178 #############################################################################
179
180     ok=0
181     asked=1
182     echo "In what directory are the configuration files?"
183     while [ $ok -eq 0 ] ; do
184         echo -e $n "[\033[1;32m$CONFIG_DIR\033[0m] -> $c"
185         if read INPUT ; then : ; else echo "" ; exit 1 ; fi
186         if [ ! "$INPUT" ] ; then
187             INPUT=$CONFIG_DIR
188             default=1
189         fi
190         if echo "$INPUT" | grep -q \[\'\"\\\] ; then
191             echo 'Please use a pathname without the characters: '\'' " \'
192         elif [ ! "$NO_DIR_CHECK" -a ! -d "$INPUT" ] ; then
193             if exists "$INPUT" ; then
194                 echo "$INPUT exists, but is not a directory!"
195             else
196                 echo "$INPUT does not exist.  Create it?"
197                 echo -e $n "[\033[1;32my\033[0m] $c"
198                 read YN
199                 if [ "$YN" != "n" ] ; then
200                     if mkdir -p "$INPUT" ; then
201                         ok=1
202                     fi
203                 fi
204             fi
205             else
206             ok=1
207         fi
208     done
209     CONFIG_DIR=$INPUT
210     echo ""
211
212
213 ##############################################################################
214
215     ok=0
216     asked=1
217     echo "In What directory are the modules to be compiled to?"
218     while [ $ok -eq 0 ] ; do
219         echo -e $n "[\033[1;32m$MODULE_DIR\033[0m] -> $c"
220         if read INPUT ; then : ; else echo "" ; exit 1 ; fi
221         if [ ! "$INPUT" ] ; then
222             INPUT=$MODULE_DIR
223             default=1
224         fi
225         if echo "$INPUT" | grep -q \[\'\"\\\] ; then
226             echo 'Please use a pathname without the characters: '\'' " \'
227         elif [ ! "$NO_DIR_CHECK" -a ! -d "$INPUT" ] ; then
228             if exists "$INPUT" ; then
229                 echo "$INPUT exists, but is not a directory!"
230             else
231                 echo "$INPUT does not exist.  Create it?"
232                 echo -e $n "[\033[1;32my\033[0m] $c"
233                 read YN
234                 if [ "$YN" != "n" ] ; then
235                     if mkdir -p "$INPUT" ; then
236                         ok=1
237                     fi
238                 fi
239             fi
240             else
241             ok=1
242         fi
243     done
244     MODULE_DIR=$INPUT
245     echo ""
246
247
248 ##############################################################################
249
250     ok=0
251     asked=1
252     echo "In what directory is the IRCd binary to be placed?"
253     while [ $ok -eq 0 ] ; do
254         echo -e $n "[\033[1;32m$BINARY_DIR\033[0m] -> $c"
255         if read INPUT ; then : ; else echo "" ; exit 1 ; fi
256         if [ ! "$INPUT" ] ; then
257             INPUT=$BINARY_DIR
258             default=1
259         fi
260         if echo "$INPUT" | grep -q \[\'\"\\\] ; then
261             echo 'Please use a pathname without the characters: '\'' " \'
262         elif [ ! "$NO_DIR_CHECK" -a ! -d "$INPUT" ] ; then
263             if exists "$INPUT" ; then
264                 echo "$INPUT exists, but is not a directory!"
265             else
266                 echo "$INPUT does not exist.  Create it?"
267                 echo -e $n "[\033[1;32my\033[0m] $c"
268                 read YN
269                 if [ "$YN" != "n" ] ; then
270                     if mkdir -p "$INPUT" ; then
271                         ok=1
272                     fi
273                 fi
274             fi
275             else
276             ok=1
277         fi
278     done
279     BINARY_DIR=$INPUT
280     echo ""
281
282 ###############################################################################
283 # Craigs Version 3 With slightly less Cheeze :p
284
285 cheeze=0
286 echo -e "Maximum number of clients at any one time (\033[1;32m1-$MAX_CLIENT_T\033[0m)?"
287 while [ "$cheeze" -eq "0" ] ; do
288         echo -e $n "[\033[1;32m$MAX_CLIENT\033[0m] -> $c"
289         read cc
290
291         if [ -z "$cc" ] ; then
292                 cc=$MAX_CLIENT
293         fi
294
295         case "$cc" in 
296                 [0-9]*)
297                         if [ "$cc" -gt "$MAX_CLIENT_T" -a -z "$SCAN_FAILED" ] ; then
298                                 echo -e "WARNING: Our scans have indicated that you are attempting"
299                                 echo -e "to use more sockets than there are avaliable. Are you sure"
300                                 echo -e "you wish to do this? It may cause the IRCd to malfunction [y/n]"
301                                 echo -e $n "[\033[1;32mn\033[0m] -> $c"
302                                 read YN
303                                 if [ "$YN" = "y" ] ; then
304                                         MAX_CLIENT=$cc
305                                         cheeze=1
306                                 else
307                                         echo ""
308                                         echo -e "Please enter the correct value (\033[1;32m1-$MAX_CLIENT_T\033[0m)"
309                                 fi
310                         else
311                                 echo $SCAN_FAILED
312                                 cheeze=1
313                                 MAX_CLIENT=$cc
314                         fi
315                         ;;
316                 *)
317                         echo ""
318                         echo "You must enter a number in this field. Please try again."
319                         ;;
320         esac
321 done
322 echo ""
323
324
325 ###############################################################################
326
327   cheeze=0
328   echo -e "What is the Maximum length of nicknames?"
329   while [ "$cheeze" -eq "0" ] ; do
330         echo -e $n "[\033[1;32m$NICK_LENGT\033[0m] -> $c"
331         read cc
332         if [ "$cc" ] ; then
333                 case "$cc" in
334                         [0-9]*)
335                         NICK_LENGT=$cc
336                         cheeze=1
337                         ;;
338                         *)
339                         echo ""
340                         echo "You Must Enter a Number in this field. Please Try Again."
341                         cheeze=0
342                         ;;
343                 esac
344         else
345                 cheeze=1
346         fi
347   done
348   echo ""
349
350 ###############################################################################
351
352   cheeze=0
353   echo -e "What is the Maximum length of channel names?"
354   while [ "$cheeze" -eq "0" ] ; do
355         echo -e $n "[\033[1;32m$MAX_CHANNE\033[0m] -> $c"
356         read cc
357         if [ "$cc" ] ; then
358                 case "$cc" in
359                         [0-9]*)
360                         MAX_CHANNE=$cc
361                         cheeze=1
362                         ;;
363                         *)
364                         echo ""
365                         echo "You Must Enter a Number in this field. Please Try Again."
366                         cheeze=0
367                         ;;
368                 esac
369         else
370                 cheeze=1
371         fi
372   done
373   echo ""
374
375 ###############################################################################
376
377   cheeze=0
378   echo -e "What is the Maximum number of mode changes in one line?"
379   while [ "$cheeze" -eq "0" ] ; do
380         echo -e $n "[\033[1;32m$MAXI_MODES\033[0m] -> $c"
381         read cc
382         if [ "$cc" ] ; then
383                 case "$cc" in
384                         [0-9]*)
385                         MAXI_MODES=$cc
386                         cheeze=1
387                         ;;
388                         *)
389                         echo ""
390                         echo "You Must Enter a Number in this field. Please Try Again."
391                         cheeze=0
392                         ;;
393                 esac
394         else
395                 cheeze=1
396         fi
397   done
398   echo ""
399
400 ###############################################################################
401 # Code Optimisation?
402
403   cheeze=0
404   echo -e "Enter the Level Of Binary optimisation. This is a number between 0 and 3 (inclusive)"
405   echo -e "The InspIRCd Team will _NOT_ support any bug reports above 0."
406   echo -e "Also note, the IRCd behaviour will be different depending on this value."
407   echo -e "Please read the documentation for more information."
408   echo -e ""
409   echo -e "The Higher the number, the more optimised your binary will be. This value will default to 0"
410   echo -e "If you either a) Dont enter a number, or b) Enter a value outside the range."
411   echo -e $n "[\033[1;32m$OPTIMITEMP\033[0m] -> $c"
412   read cc
413   if [ -z "$cc" ] ; then
414         cc=$OPTIMITEMP
415   fi
416   case "$cc" in
417         1)
418                 OPTIMITEMP=1
419                 OPTIMISATI="-O"
420                 ;;
421         2)
422                 OPTIMITEMP=2
423                 OPTIMISATI="-O2"
424                 ;;
425         3)
426                 OPTIMITEMP=3
427                 OPTIMISATI="-O3"
428                 ;;
429         *)
430                 OPTIMITEMP=0
431                 OPTIMISATI="-g"
432                 ;;
433   esac
434   echo ""
435
436 ###############################################################################
437
438
439 echo -e "\033[1;32mPre-build configuration is complete!\033[0m"
440 echo ""
441 echo -e "\033[0mConfig path:\033[1;32m\t\t\t$CONFIG_DIR"
442 echo -e "\033[0mModule path:\033[1;32m\t\t\t$MODULE_DIR"
443 echo -e "\033[0mMax connections:\033[1;32m\t\t$MAX_CLIENT"
444 echo -e "\033[0mMax User Channels\033[1;32m\t\t$MAX_CHANNE"
445 echo -e "\033[0mMax nickname length:\033[1;32m\t\t$NICK_LENGT"
446 echo -e "\033[0mMax channel length:\033[1;32m\t\t$CHAN_LENGT"
447 echo -e "\033[0mMax mode length:\033[1;32m\t\t$MAXI_MODES"
448 echo -e "\033[0mGCC Version Found:\033[1;32m\t\t$GCCVER.$GCC34"
449 echo -e "\033[0mOptimatizaton Flag:\033[1;32m\t\t$OPTIMISATI"
450 echo -e "\033[0m"
451
452 echo "Writing cache file for future ./configures ..."
453
454 COPY_CONF=0
455 if [ "$CONFIG_DIR" != "$ME/conf" ] ; then
456     COPY_CONF=1
457 fi
458
459
460 if [ -e ".config.cache" ] ; then
461         rm .config.cache
462 fi
463 echo "CONFIG_DIR=\"$CONFIG_DIR\"" >> .config.cache
464 echo "MODULE_DIR=\"$MODULE_DIR\"" >> .config.cache
465 echo "BINARY_DIR=\"$BINARY_DIR\"" >> .config.cache
466 echo "MAX_CLIENT=\"$MAX_CLIENT\"" >> .config.cache
467 echo "MAX_CHANNE=\"$MAX_CHANNE\"" >> .config.cache
468 echo "NICK_LENGT=\"$NICK_LENGT\"" >> .config.cache
469 echo "MAXI_MODES=\"$MAXI_MODES\"" >> .config.cache 
470 echo "OPTIMITEMP=\"$OPTIMITEMP\"" >> .config.cache
471 echo "OPTIMISATI=\"$OPTIMISATI\"" >> .config.cache
472 echo "GCC34=\"$GCC34\"" >> .config.cache
473 echo "HAS_STRLCPY=\"$HAS_STRLCPY\"" >> .config.cache
474 echo "COPY_CONF=\"$COPY_CONF\"" >> .config.cache
475
476 echo -e "Writing \033[1;32minspircd_config.h"
477
478 echo "/* Auto generated by configure, do not modify! */" >include/inspircd_config.h
479 echo "" >>include/inspircd_config.h
480 if [ "$GCCVER" -eq "3" ] ; then
481 echo "#define GCC3" >>include/inspircd_config.h
482         if [ "$GCC34" -gt "3" ] ; then
483                 echo "#define GCC34" >>include/inspircd_config.h
484         fi
485 fi
486 if [ "$HAS_STRLCPY" -eq "1" ] ; then
487         echo "#define HAS_STRLCPY" >>include/inspircd_config.h
488 fi
489 echo "#define SYSLOG_FACILITY LOG_DAEMON" >>include/inspircd_config.h
490 echo "#define SYSLOG_LEVEL LOG_NOTICE" >>include/inspircd_config.h
491 echo "#define CONFIG_FILE \"$CONFIG_DIR/inspircd.conf\"" >>include/inspircd_config.h
492 echo "#define MOD_PATH \"$MODULE_DIR\"" >>include/inspircd_config.h
493 echo "#define VERSION \"`sh ./src/version.sh`\"" >>include/inspircd_config.h
494 echo "#define MAXCLIENTS $MAX_CLIENT" >>include/inspircd_config.h
495 echo "#define NICKMAX $NICK_LENGT" >>include/inspircd_config.h
496 echo "#define CHANMAX $CHAN_LENGT" >>include/inspircd_config.h
497 echo "#define MAXCHANS $MAX_CHANNE" >>include/inspircd_config.h
498 echo "#define MAXMODES $MAXI_MODES" >>include/inspircd_config.h
499 echo "#define OPTIMISATION $OPTIMITEMP" >>include/inspircd_config.h
500 echo "#define SYSTEM \"`uname -n -s -r`\"" >>include/inspircd_config.h
501 echo "#define MAXBUF 514">>include/inspircd_config.h
502 touch include/inspircd_config.h
503
504 case "$OSNAME" in
505         FreeBSD)
506                 LDLIBS="-Ldl"
507                 FLAGS="-fPIC -frtti $OPTIMISATI"
508                 MAKEPROG="gmake"
509                 ;;
510         *)
511                 LDLIBS="-ldl"
512                 FLAGS="-fPIC -frtti $OPTIMISATI"
513                 MAKEPROG="make"
514                 ;;
515 esac
516
517 MODULES=""
518 for module in src/modules/*.cpp ; do
519         mod=`echo $module | sed 's/.cpp/.so/' | sed 's/src\/modules\///'`
520         MODULES="$MODULES $mod" 
521 done
522
523 for file in Makefile inspircd; do
524         echo -e "\033[0mWriting \033[1;32m$file\033[0m"
525         rm -f $file
526         sed -e "
527                 s%@MAKEPROG@%$MAKEPROG%g
528                 s%@FLAGS@%$FLAGS%g
529                 s%@LDLIBS@%$LDLIBS%g
530                 s%@CONFIG_DIR@%$CONFIG_DIR%g
531                 s%@MODULE_DIR@%$MODULE_DIR%g
532                 s%@BINARY_DIR@%$BINARY_DIR%g
533                 s%@MODULES@%$MODULES%g
534         " .${file}.inc >> $file
535 done
536 `chmod 700 inspircd`
537
538 echo -e "\033[0mWriting \033[1;32msrc/modules/Makefile\033[0m"
539 rm -f src/modules/Makefile
540
541 # Generate the Header..
542
543 echo "# (C) ChatSpike development team" >> src/modules/Makefile
544 echo "# Makefile by <Craig@ChatSpike.net>" >> src/modules/Makefile
545 echo "# Many Thanks to Andrew Church <achurch@achurch.org>" >> src/modules/Makefile
546 echo "#    for assisting with making this work right." >> src/modules/Makefile
547 echo "#" >> src/modules/Makefile
548 echo "# Automatically Generated by ./configure to add a module" >> src/modules/Makefile
549 echo "# please run ./configure --update" >> src/modules/Makefile
550 echo "" >> src/modules/Makefile
551 echo "all: \$(MODULES)" >> src/modules/Makefile
552 echo "" >> src/modules/Makefile
553
554 for module in src/modules/*.cpp ; do
555      flags=`grep '$CompileFlags: ' $module | sed 's/\/\* $CompileFlags://' | sed 's/\*\///'`
556      mod=`echo $module | sed 's/.cpp/.so/' | sed 's/src\/modules\///'`
557      mod2=`echo $module | sed 's/src\/modules\///'`
558      echo "$mod: $mod2 ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/servers.h ../../include/base.h" >> src/modules/Makefile
559      echo "     \$(CC) -I../../include \$(FLAGS) -shared$flags -o $mod $mod2" >> src/modules/Makefile
560      echo "     @cp $mod \$(MODPATH)/" >> src/modules/Makefile
561      echo "" >> src/modules/Makefile
562 done
563
564
565 echo ""
566
567 echo ""
568 echo "Do you want to compile the IRCd binaries?"
569 echo -e $n "[\033[1;32my\033[0m] $c"
570 read YN
571 if [ "$YN" != "n" ] ; then
572         echo ""
573         echo -e "\033[1;32mCompiling...\033[0m"
574         echo ""
575         cd $ME
576         $MAKEPROG
577         echo ""
578         echo "Done!"
579 else
580         echo ""
581         echo -e "To build your server with these settings, please type '\033[1;32m$MAKEPROG\033[0m' now."
582 fi
583
584
585 echo ""
586 echo -e "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***"
587 echo ""