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