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