]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - configure
Added a ton of missing prompts ;)
[user/henk/code/inspircd.git] / configure
1 #!/usr/bin/perl
2 # InspIRCd Configuration Script
3 #
4 # Copyright 2003 The ChatSpike Development Team
5 # <brain@chatspike.net>
6 # <Craig@chatspike.net>
7 #
8 # [14:21] Brain: <matrix impression> i know perl-fu!
9 #
10 # $Id$
11 #
12 ########################################
13
14 chomp($topdir = `pwd`);
15 $this = resolve_directory($topdir);                                             # PWD, Regardless.
16 @modlist = ();                                                                  # Declare for Module List..
17 %config = ();                                                                   # Initiate Configuration Hash..
18 $config{ME}                 = resolve_directory($topdir);                       # Present Working Directory
19 $config{CONFIG_DIR}         = resolve_directory($config{ME}."/conf");           # Configuration Directory
20 $config{MODULE_DIR}         = resolve_directory($config{ME}."/modules");        # Modules Directory
21 $config{BINARY_DIR}         = resolve_directory($config{ME}."/bin");            # Binary Directory
22 $config{LIBRARY_DIR}        = resolve_directory($config{ME}."/lib");            # Library Directory
23 $config{OPTIMITEMP}         = "0";                                              # Default Optimisation Value
24 $config{OPTIMISATI}         = "-g";                                             # Optimisation Flag
25 $config{NICK_LENGT}         = "31";                                             # Default Nick Length
26 $config{CHAN_LENGT}         = "64";                                             # Default Channel Name Length
27 $config{MAX_CHANNE}         = "20";                                             # Default Max. Channels per user..
28 $config{MAXI_MODES}         = "20";                                             # Default Max. Number of Modes set at once.
29 $config{HAS_STRLCPY}        = "false";                                          # strlcpy Check.
30 $config{USE_KQUEUE}         = "y";                                              # kqueue enabled
31 $config{USE_EPOLL}          = "y";                                              # epoll enabled
32 $config{STATIC_LINK}        = "no";                                             # are doing static modules?
33 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`);                           # FD Limit
34 chomp($config{GCCVER}       = `gcc -dumpversion | cut -c 1`);                   # Major GCC Version
35 chomp($config{GCC34}        = `gcc -dumpversion | cut -c 3`);                   # Minor GCC Version
36 chomp($config{OSNAME}       = `/bin/uname`);                                    # Operating System Name
37 $config{CC}                 = "g++";                                            # C++ compiler
38 $config{MAKEORDER}          = "ircd mods config bininst";                       # build order
39 $config{STATICLIBS}         = "";                                               # library archive path
40
41 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
42   chomp($config{OSNAME} = `/usr/bin/uname`);
43   if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
44         $config{OSNAME} = "Unknown";
45   }
46 }
47
48 if (!$config{MAX_CLIENT_T}) { 
49   $config{MAX_CLIENT_T} = 1024;                                 # Set a reasonable 'Default'
50   $fd_scan_fail = "true";                                       # Used Later
51 }
52
53 # Get and Set some important vars..
54 getmodules();
55
56 my $arg = $ARGV[0];                                             # Do Some Argument Checks..
57 if ($arg eq "-clean") { `rm -rf .config.cache`; }               # Remove the config.cache file.
58
59 if ($arg eq "-update") {
60   # Does the cache file exist?
61   if (!getcache()) {
62     # No, No it doesn't.. *BASH*
63     print "You have not run ./configure before. Please do this before trying to run the update script.\n";
64     exit 0;
65   } else {
66     # We've Loaded the cache file and all our variables..
67     print "Updating Files..\n";
68     getosflags();
69     $has_epoll = $config{HAS_EPOLL};
70     $has_kqueue = $config{HAS_KQUEUE};
71     writefiles();
72     print "Complete.\n";
73     exit;
74   }
75 }
76
77 print "Checking for cache from previous configure...\n";
78 getcache();
79 print "Checking operating system version...\n";
80 getosflags();
81
82 if (!$config{MAX_CLIENT}) { 
83   # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
84   # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
85   # higher than the found value" :))
86   $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
87 }
88
89 printf "Checking if strlcpy exists... ";
90 # Perform the strlcpy() test..
91 $config{HAS_STRLCPY} = "false";
92 my $fail = 0;
93 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
94 if (!$fail)
95 {
96         while (chomp($line = <STRLCPY>))
97         {
98                 # try and find the delcaration of:
99                 # size_t strlcpy(...)
100                 if ($line =~ /size_t(\0x9|\s)+strlcpy/)
101                 {
102                         $config{HAS_STRLCPY} = "true";
103                 }
104         }
105         close(STRLCPY);
106 }
107 print "yes\n" if $config{HAS_STRLCPY} eq "true";
108 print "no\n" if $config{HAS_STRLCPY} eq "false";
109
110 printf "Checking if kqueue exists... ";
111 $has_kqueue = 0;
112 $fail = 0;
113 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
114 if (!$fail)
115 {
116         while (chomp($line = <KQUEUE>))
117         {
118                 # try and find the delcaration of:
119                 # int kqueue(void);
120                 if ($line =~ /int(\0x9|\s)+kqueue/)
121                 {
122                         $has_kqueue = 1;
123                 }
124         }
125         close(KQUEUE);
126 }
127 print "yes\n" if $has_kqueue == 1;
128 print "no\n" if $has_kqueue == 0;
129
130 printf "Checking if epoll exists... ";
131 $has_epoll = 0;
132 $fail = 0;
133 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
134 if (!$fail)
135 {
136         while (chomp($line = <EPOLL>))
137         {
138                 # try and find the declaration of:
139                 # extern int epoll_create (int __size) __THROW;
140                 if (($line =~ /int(\0x9|\s)+epoll_create(\0x9|\s)+\(/) || ($line =~ /int(\0x9|\s)+epoll_create\(/))
141                 {
142                         $has_epoll = 1;
143                 }
144         }
145         close(EPOLL);
146 }
147 print "yes\n" if $has_epoll == 1;
148 print "no\n" if $has_epoll == 0;
149
150 if ($config{OSNAME} =~ /CYGWIN/) {
151         $config{HAS_STRLCPY} = "true";
152 }
153
154 $config{HAS_EPOLL} = $has_epoll;
155 $config{HAS_KQUEUE} = $has_kqueue; 
156
157 ################################################################################
158 #                          BEGIN INTERACTIVE PART                              #
159 ################################################################################
160
161 # Clear the Screen..
162 system("clear");
163 # Display Splash Logo..
164 show_splash();
165 chomp($wholeos = `uname -mnr`);
166
167 # Display Introduction Message..
168 print "
169 Welcome to the InspIRCd Configuration program!
170
171 *** If you are unsure of any of these values, leave it blank for    ***
172 *** standard settings that will work, and your server will run      ***
173 *** using them. If you are running this server as part of a         ***
174 *** larger network, you must consult with your network admins       ***
175 *** for the proper values to use, or server links will be unstable! ***
176
177 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
178 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
179 dir, otherwise you won't have a config file!
180
181 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos), fdmax: $config{MAX_CLIENT_T}\n\n";
182
183 # Directory Settings..
184 dir_check("are the configuration files", "CONFIG_DIR");
185 dir_check("are the modules to be compiled to", "MODULE_DIR");
186 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
187 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
188
189 if ($has_kqueue) {
190         yesno(USE_KQUEUE,"You are running a BSD operating system, and kqueue\nwas detected. Would you like to enable kqueue support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable kqueue?");
191 }
192 if ($has_epoll) {
193         yesno(USE_EPOLL,"You are running a Linux 2.6+ operating system, and epoll\nwas detected. Would you like to enable epoll support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable epoll?");
194 }
195 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
196 if (!$chose_hiperf)
197 {
198         print "No high-performance socket engines are available, or you chose\n";
199         print "not to enable one. Defaulting to select() engine.\n\n";
200 }
201
202 # File Descriptor Settings..
203 my $continue = 0;
204 while (!$continue) {
205   print "Maximum number of clients at any one time ($config{MAX_CLIENT_T})\n";
206   print "[\033[1;32m$config{MAX_CLIENT}\033[0m] -> ";
207   chomp($var = <STDIN>);
208   if ($var eq "") { $var = $config{MAX_CLIENT}; }
209   if ($var =~ /^\d+$/) {
210     if (($var > $config{MAX_CLIENT_T}) && ($fd_scan_failed ne true)) {
211       # Client has entered a larger number than the 'discovered' value
212       # Confirm.
213       print "WARNING: Our scans have indicated that you are attempting
214 to use more sockets than there are avaliable. Are you sure
215 you wish to do this? It may cause the IRCd to malfunction [y/n]
216 [\033[1;32mn\033[0m] -> $c";
217       chomp($tmp = <STDIN>);
218       if ($tmp ne "y") {
219         print "Please enter the correct value.\n\n";
220         next;
221       }
222     }
223   } else {
224     print "You must enter a number in this field. Please try again.\n\n";
225     next;
226   }
227   # If we get here, we should be good to go.
228   $config{MAX_CLIENT} = $var;
229   $continue = 1;
230   print "\n";
231 }
232
233 my $continue = 0;
234 while (!$continue) {
235   print "What is the maximum length of nicknames?\n";
236   print "[\033[1;32m$config{NICK_LENGT}\033[0m] -> ";
237   chomp($var = <STDIN>);
238   if ($var eq "") { $var = $config{NICK_LENGT}; }
239   if ($var =~ /^\d+$/) {
240     # We don't care what the number is, set it and be on our way.
241     $config{NICK_LENGT} = $var;
242     $continue = 1;
243     print "\n";
244   } else {
245     print "You must enter a number in this field. Please try again.\n\n";
246   }
247 }
248
249 my $continue = 0;
250 while (!$continue) {
251   print "What is the maximum length of channel names?\n";
252   print "[\033[1;32m$config{CHAN_LENGT}\033[0m] -> ";
253   chomp($var = <STDIN>);
254   if ($var eq "") { $var = $config{CHAN_LENGT}; }
255   if ($var =~ /^\d+$/) {
256     # We don't care what the number is, set it and be on our way.
257     $config{CHAN_LENGT} = $var;
258     $continue = 1;
259     print "\n";
260   } else {
261     print "You must enter a number in this field. Please try again.\n\n";
262   }
263 }
264
265 my $continue = 0;
266 while (!$continue) {
267   print "What is the maximum number of channels a user may join at any one time?\n";
268   print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
269   chomp($var = <STDIN>);
270   if ($var eq "") { $var = $config{MAX_CHANNE}; }
271   if ($var =~ /^\d+$/) {
272     # We don't care what the number is, set it and be on our way.
273     $config{MAX_CHANNE} = $var;
274     $continue = 1;
275     print "\n";
276   } else {
277     print "You must enter a number in this field. Please try again.\n\n";
278   }
279 }
280
281
282 my $continue = 0;
283 while (!$continue) {
284   print "What is the maximum number of mode changes in one line?\n";
285   print "[\033[1;32m$config{MAXI_MODES}\033[0m] -> ";
286   chomp($var = <STDIN>);
287   if ($var eq "") { $var = $config{MAXI_MODES}; }
288   if ($var =~ /^\d+$/) {
289     # We don't care what the number is, set it and be on our way.
290     $config{MAXI_MODES} = $var;
291     $continue = 1;
292     print "\n";
293   } else {
294     print "You must enter a number in this field. Please try again.\n\n";
295   }
296 }
297
298 # Code Optimisation
299 print "Enter the Level Of Binary optimisation. This is a number between 0 and 3 (inclusive)
300 The InspIRCd Team will _NOT_ support any bug reports above 0.
301 Also note, the IRCd behaviour will be different depending on this value.
302 Please read the documentation for more information.
303
304 The Higher the number, the more optimised your binary will be. This value will default to 0
305 If you either a) Dont enter a number, or b) Enter a value outside the range.\n";
306 print "[\033[1;32m$config{OPTIMITEMP}\033[0m] -> ";
307 chomp($var = <STDIN>);
308 if ($var eq "") {
309   $var = $config{OPTIMITEMP};
310 }
311
312 if ($var eq "1") {
313   $config{OPTIMITEMP} = 1;
314   $config{OPTIMISATI} = "-O";
315 } elsif ($var eq "2") {
316   $config{OPTIMITEMP} = 2;
317   $config{OPTIMISATI} = "-O2";
318 } elsif ($var eq "3") {
319   $config{OPTIMITEMP} = 3;
320   $config{OPTIMISATI} = "-O3";
321 } else {
322   $config{OPTIMITEMP} = 0;
323   $config{OPTIMISATI} = "-g";
324 }
325
326 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
327 print "\033[0mConfig path:\033[1;32m\t\t\t$config{CONFIG_DIR}\n";
328 print "\033[0mModule path:\033[1;32m\t\t\t$config{MODULE_DIR}\n";
329 print "\033[0mMax connections:\033[1;32m\t\t$config{MAX_CLIENT}\n";
330 print "\033[0mMax User Channels\033[1;32m\t\t$config{MAX_CHANNE}\n";
331 print "\033[0mMax nickname length:\033[1;32m\t\t$config{NICK_LENGT}\n";
332 print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
333 print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
334 print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
335 print "\033[0mOptimatizaton Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
336 print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n";
337 print "\033[0mStatic modules:\033[1;32m\t\t\t$config{STATIC_LINK}\033[0m\n\n";
338
339 makecache();
340 writefiles();
341
342 print "\n\n";
343 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
344 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
345 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
346         print "\033[1;32mWARNING!\033[0m You are running OpenBSD but you are using the base gcc package\nrather than eg++. This compile will most likely fail, but i'm letting you\ngo ahead with it anyway, just in case i'm wrong :-)\n";
347 }
348 if ($config{OSNAME} =~ /CYGWIN/) {
349         print <<FOO;
350 \033[1;32mWARNING!\033[0m CYGWIN does not properly support shared modules,
351 so modules will be compiled statically into the core of the ircd. The modules
352 will act like they are being loaded from disk and being unloaded from RAM,
353 however they are in fact being enabled and disabled similar to features in
354 other ircds.
355 FOO
356 }
357
358 ################################################################################
359 #                              HELPER FUNCTIONS                                #
360 ################################################################################
361 sub getcache {
362   # Retrieves the .config.cache file, and loads values into the main config hash.
363   open(CACHE, ".config.cache") or return undef;
364   while (<CACHE>) {
365     chomp;
366
367     # Ignore Blank lines, and comments..
368     next if /^\s*$/;
369     next if /^\s*#/;
370
371     my ($key, $value) = split("=", $_);
372     $value =~ /^\"(.*)\"$/;
373     # Do something with data here!
374     $config{$key} = $1;
375   }
376   close(CONFIG);
377   return "true";
378 }
379
380 sub makecache {
381   # Dump the contents of %config
382   print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
383   open(FILEHANDLE, ">.config.cache");
384   foreach $key (keys %config)
385   {
386     print FILEHANDLE "$key=\"$config{$key}\"\n";
387   }
388   close(FILEHANDLE);
389 }
390
391 sub dir_check {
392   my ($desc, $hash_key) = @_;
393   my $complete = 0;
394   while (!$complete) {
395     print "In what directory $desc?\n";
396     print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
397     chomp($var = <STDIN>);
398     if ($var eq "") { $var = $config{$hash_key}; }
399     if ($var =~ /^\~\/(.+)$/) {
400         # Convert it to a full path..
401         $var = resolve_directory($ENV{HOME} . "/" . $1);
402     }
403     if (substr($var,0,1) ne "/")
404     {
405         # Assume relative Path was given.. fill in the rest.
406         $var = $this . "/$var";
407     }
408     $var = resolve_directory($var); 
409     if (! -e $var) {
410       print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
411       chomp($tmp = <STDIN>);
412       if (($tmp eq "") || ($tmp =~ /^y/i)) {
413         # Attempt to Create the Dir..
414         $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
415         if ($chk != 0) {
416           print "Unable to create directory. ($var)\n\n";
417           # Restart Loop..
418           next;
419         }
420       } else {
421         # They said they don't want to create, and we can't install there.
422         print "\n\n";
423         next;
424       }
425     } else {
426       if (!is_dir($var)) {
427         # Target exists, but is not a directory.
428         print "File $var exists, but is not a directory.\n\n";
429         next;
430       }
431     }
432     # Either Dir Exists, or was created fine.
433     $config{$hash_key} = $var;
434     $complete = 1;
435     print "\n";
436   }
437 }
438
439 sub getosflags {
440   if ($config{OSNAME} =~ /BSD$/) {
441     $config{LDLIBS} = "-Ldl";
442     $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Woverloaded-virtual $config{OPTIMISATI}";
443     $config{MAKEPROG} = "gmake";
444     if ($config{OSNAME} eq "OpenBSD") {
445         chomp($foo = `eg++ -dumpversion | cut -c 1`);
446         # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
447         # if theyre not running this, configure lets the build continue but they probably wont manage to
448         # compile as this standard version is 2.95.3!
449         if ($foo ne "") {
450                 $config{CC} = "eg++";
451                 chomp($config{GCCVER}       = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
452                 chomp($config{GCC34}        = `eg++ -dumpversion | cut -c 3`); # the compiler path
453         }
454     }
455   } else {
456     $config{LDLIBS} = "-ldl";
457     $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Woverloaded-virtual $config{OPTIMISATI}";
458     $config{MAKEPROG} = "make";
459     if ($config{OSNAME} =~ /CYGWIN/) {
460        $config{FLAGS}  = "-frtti $OPTIMISATI -Woverloaded-virtual $config{OPTIMISATI}";
461        $config{LDLIBS} = "";
462        $config{MAKEPROG} = "/usr/bin/make";
463        $config{MAKEORDER} = "mods ircd config bininst";
464        $config{STATICLIBS} = "modules/mods.a";
465        $config{STATIC_LINK} = "yes";
466     }
467   }
468   if ($config{OSNAME} =~ /SunOS/) {
469     # solaris/sunos needs these
470     # socket = bsd sockets api
471     # nsl = dns stuff
472     # rt = POSIX realtime extensions
473     # resolv = inet_aton only (why isnt this in nsl?!)
474     $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
475   }
476 }
477
478 sub is_dir {
479   my ($path) = @_;
480   if (chdir($path)) {
481     chdir($this);
482     return 1;
483   } else {
484     # Just in case..
485     chdir($this);
486     return 0;
487   }
488 }
489
490 sub getmodules {
491   my $i = 0;
492   opendir(DIRHANDLE, "src/modules");
493   foreach $name (sort readdir(DIRHANDLE)) {
494     if ($name =~ /^m_(.+)\.cpp$/)
495     {
496       $mod = $1;
497       if ($mod !~ /_static$/) {
498               $modlist[$i++] = $mod;
499       }
500     }
501   }
502   closedir(DIRHANDLE);
503 }
504
505 sub writefiles {
506
507   print "Writing \033[1;32minspircd_config.h\033[0m\n";
508   # First File.. inspircd_config.h
509   chomp(my $incos = `uname -n -s -r`);
510   chomp(my $version = `sh ./src/version.sh`);
511   open(FILEHANDLE, ">include/inspircd_config.h");
512   my $NL = $config{NICK_LENGT}+1;
513   my $CL = $config{CHAN_LENGT}+1;
514   print FILEHANDLE <<EOF;
515 /* Auto generated by configure, do not modify! */
516 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
517 #define MOD_PATH "$config{MODULE_DIR}"
518 #define VERSION "$version"
519 #define MAXCLIENTS $config{MAX_CLIENT}
520 #define NICKMAX $NL
521 #define CHANMAX $CL
522 #define MAXCHANS $config{MAX_CHANNE}
523 #define MAXMODES $config{MAXI_MODES}
524 #define OPTIMISATION $config{OPTIMITEMP}
525 #define SYSTEM "$incos"
526 #define MAXBUF 514
527 EOF
528
529   if ($config{OSNAME} =~ /SunOS/) {
530     print FILEHANDLE "#define IS_SOLARIS\n";
531   }
532   if ($config{OSNAME} =~ /CYGWIN/) {
533     print FILEHANDLE "#define IS_CYGWIN\n";
534   }
535   if ($config{STATIC_LINK} eq "yes") {
536     print FILEHANDLE "#define STATIC_LINK\n";
537   }
538   if ($config{GCCVER} > 3) {
539     print FILEHANDLE "#define GCC3\n";
540     print FILEHANDLE "#define GCC34\n";
541   }
542   else
543   {
544     if ($config{GCCVER} == 3) {
545       print FILEHANDLE "#define GCC3\n";
546       if ($config{GCC34} > 3) {
547         print FILEHANDLE "#define GCC34\n";
548       }
549     }
550   }
551   if ($config{HAS_STRLCPY} eq "true") {
552     print FILEHANDLE "#define HAS_STRLCPY\n";
553   }
554   my $use_hiperf = 0;
555   if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
556     print FILEHANDLE "#define USE_KQUEUE\n";
557     $use_hiperf = 1;
558   }
559   if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
560     print FILEHANDLE "#define USE_EPOLL\n";
561     $use_hiperf = 1;
562   }
563   # user didn't choose either epoll or select for their OS.
564   # default them to USE_SELECT (ewwy puke puke)
565   if (!$use_hiperf) {
566     print FILEHANDLE "#define USE_SELECT\n";
567   }
568   close(FILEHANDLE);
569
570   # Create a Modules List..
571   my $modules = "";
572   foreach $i (@modlist)
573   {
574     if ($config{OSNAME} =~ /CYGWIN/) {
575         $modules .= "m_".$i.".o ";
576     }
577     else {
578         $modules .= "m_".$i.".so ";
579     }
580   }
581   chomp($modules);   # Remove Redundant whitespace..
582
583
584   # Write all .in files.
585   my $tmp = "";
586   my $file = "";
587   my $exe = "inspircd";
588
589   if ($config{OSNAME} =~ /CYGWIN/) {
590     $exe = "inspircd.exe";
591   }
592
593   opendir(DIRHANDLE, $this);
594   foreach $name (sort readdir(DIRHANDLE)) {
595     if ($name =~ /^\.(.+)\.inc$/)
596     {
597       $file = $1;
598       # All .name.inc files need parsing!
599       $tmp = "";
600       open(FILEHANDLE, ".$file.inc");
601       while (<FILEHANDLE>) {
602         $tmp .= $_;
603       }
604       close(FILEHANDLE);
605
606       $tmp =~ s/\@CC\@/$config{CC}/;
607       $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
608       $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
609       $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
610       $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
611       $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
612       $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
613       $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
614       $tmp =~ s/\@MODULES\@/$modules/;
615       $tmp =~ s/\@EXECUTABLE\@/$exe/;
616       $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
617       $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
618
619       print "Writing \033[1;32m$file\033[0m\n";
620       open(FILEHANDLE, ">$file");
621       print FILEHANDLE $tmp;
622     }
623   }
624   closedir(DIRHANDLE);
625
626   # Make inspircd executable!
627   chmod 0744, 'inspircd';
628
629   if ($config{OSNAME} =~ /CYGWIN/) {
630         print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
631         write_static_makefile();
632   }
633   else {
634         print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
635         write_dynamic_makefile();
636   }
637
638
639   # Modules Makefile..
640   print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
641   open(FILEHANDLE, ">src/modules/Makefile");
642   print FILEHANDLE <<EOF;
643 # (C) ChatSpike development team
644 # Makefile by <Craig\@ChatSpike.net>
645 # Many Thanks to Andrew Church <achurch\@achurch.org>
646 #    for assisting with making this work right.
647 #
648 # Automatically Generated by ./configure to add a modules
649 # please run ./configure --update
650
651 all: \$(MODULES)
652
653 EOF
654
655   # Create a Modules List..
656   my $modules = "";
657   my $flags = "";
658   if ($config{OSNAME} =~ /CYGWIN/) {
659      open(MODLIST,">include/modlist.h");
660      print MODLIST <<HEADER;
661 // Generated automatically by configure. DO NOT EDIT!
662
663 #ifndef __SYMBOLS__H_CONFIGURED__
664 #define __SYMBOLS__H_CONFIGURED__
665
666 HEADER
667      foreach $i (@modlist) {
668         if ($i !~ /_static$/) {
669                 print MODLIST "extern \"C\" void * $i\_init (void);\n";
670         }
671      }
672      print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
673   }
674   foreach $i (@modlist)
675   {
676     if ($i !~ /_static$/) {
677      $flags = getcompilerflags("src/modules/m_".$i.".cpp");
678      if ($config{OSNAME} =~ /CYGWIN/) {
679         print FILEHANDLE <<EOCHEESE;
680 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/servers.h ../../include/base.h
681         \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
682         mv m_$i\_static.o ../m_$i.o
683
684 EOCHEESE
685         print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
686         open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
687         open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
688         while (chomp($a = <MODULE>)) { 
689                 $a =~ s/init_module/$i\_init/g;
690                 $a =~ s/Srv/$i\Srv/g;
691                 print MUNGED "$a\n";
692         }
693         close(MODULE);
694         close(MUNGED);
695         print MODLIST <<EOENT;
696 {"m_$i.so",\&$i\_init},
697 EOENT
698         print "done\n";
699      }
700      else {
701          print FILEHANDLE <<EOCHEESE;
702 m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/servers.h ../../include/base.h
703         \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i.cpp
704         \$(CC) \$(FLAGS) -shared $flags -o m_$i.so m_$i.o
705         @-rm -f \$(MODPATH)/m_$i.so
706         cp m_$i.so \$(MODPATH)/
707         chmod 0700 \$(MODPATH)/m_$i.so
708
709 EOCHEESE
710       }
711    }
712   }
713   if ($config{OSNAME} =~ /CYGWIN/) {
714      print MODLIST "{0}};\n\n#endif\n";
715      close(MODLIST);
716   }
717 }
718
719 sub getcompilerflags {
720   my ($file) = @_;
721   open(FLAGS, $file);
722   while (<FLAGS>) {
723     if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
724       close(FLAGS);
725       return $1;
726     }
727   }
728   close(FLAGS);
729   return undef;
730 }
731
732 sub show_splash {
733   print "'\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::\n";
734   print ". \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:\n";
735   print ": \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:\n";
736   print ": \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:\n";
737   print ": \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:\n";
738   print ": \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:\n";
739   print "'\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::\n";
740   print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
741 }
742
743 sub resolve_directory {
744         use File::Spec;
745         return File::Spec->rel2abs($_[0]);
746 }
747
748 sub yesno {
749         my ($flag,$prompt) = @_;
750         print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
751         chomp($tmp = <STDIN>);
752         if ($tmp eq "") { $tmp = $config{$flag} }
753
754         if (($tmp eq "") || ($tmp =~ /^y/i)) {
755                 $config{$flag} = "y";
756         } else {
757                 $config{$flag} = "n";
758         }
759         return;
760 }
761
762
763 sub write_static_makefile {
764         open(FH,">src/Makefile") or die("Could not write src/Makefile!");
765         print FH <<EOM;
766 # Insp Makefile :p
767 #
768 # (C) ChatSpike development team
769 # Makefile by <Craig\@ChatSpike.net>
770 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
771 #
772
773 CC = im a cheezeball
774
775 CXXFLAGS = -I../include \${FLAGS}
776
777 all: hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_util.o inspircd_io.o connection.o message.o commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o servers.o helperfuncs.o \$(MODULES) inspircd.exe
778
779 inspircd.exe: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h
780         \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_util.o inspircd_io.o connection.o message.o commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o servers.o helperfuncs.o hashcomp.o \$(MODULES)
781
782 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
783         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
784
785 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
786         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
787
788 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
789         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
790
791 mode.o: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
792         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
793
794 xline.o: xline.cpp ../include/base.h ../include/xline.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
795         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
796
797 inspstring.o: inspstring.cpp ../include/base.h ../include/inspstring.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
798         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
799
800 dns.o: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
801         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
802
803 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
804         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
805
806 inspircd_util.o: inspircd_util.cpp ../include/base.h ../include/inspircd_util.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
807         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_util.cpp
808
809 inspircd_io.o: inspircd_io.cpp ../include/base.h ../include/inspircd_io.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
810         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
811
812 connection.o: connection.cpp ../include/base.h ../include/connection.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
813         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c connection.cpp
814
815 message.o: message.cpp ../include/base.h ../include/message.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
816         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
817
818 commands.o: commands.cpp ../include/base.h ../include/commands.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
819         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
820
821 dnsqueue.o: dnsqueue.cpp ../include/base.h ../include/dnsqueue.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
822         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
823
824 dynamic.o: dynamic.cpp ../include/base.h ../include/dynamic.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
825         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
826
827 users.o: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/connection.h
828         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
829
830 modules.o: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
831         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
832
833 wildcard.o: wildcard.cpp ../include/base.h ../include/wildcard.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
834         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
835
836 servers.o: servers.cpp ../include/base.h ../include/servers.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/connection.h
837         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c servers.cpp
838
839
840 EOM
841 close(FH);
842 }
843
844 sub write_dynamic_makefile {
845         open(FH,">src/Makefile") or die("Could not write src/Makefile");
846         print FH <<EOM;
847 # Insp Makefile :p
848 #
849 # (C) ChatSpike development team
850 # Makefile by <Craig\@ChatSpike.net>
851 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
852 #
853
854 CC = im a cheezeball
855
856 CXXFLAGS = -I../include \${FLAGS}
857
858 all: libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDutil.so libIRCDio.so libIRCDconnection.so libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDservers.so libIRCDhelper.so inspircd
859
860 inspircd: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h
861         \$(CC) -I../include \$(FLAGS) -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDutil.so libIRCDio.so libIRCDconnection.so libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDservers.so libIRCDhelper.so libIRCDhash.so
862
863 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
864         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
865         \$(CC) -shared -o libIRCDhash.so hashcomp.o
866
867 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
868         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
869         \$(CC) -shared -o libIRCDhelper.so helperfuncs.o
870
871 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
872         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
873         \$(CC) -shared -o libIRCDchannels.so channels.o
874
875 libIRCDmode.so: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
876         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
877         \$(CC) -shared -o libIRCDmode.so mode.o
878
879 libIRCDxline.so: xline.cpp ../include/base.h ../include/xline.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
880         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
881         \$(CC) -shared -o libIRCDxline.so xline.o
882
883 libIRCDstring.so: inspstring.cpp ../include/base.h ../include/inspstring.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
884         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
885         \$(CC) -shared -o libIRCDstring.so inspstring.o
886
887 libIRCDasyncdns.so: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
888         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
889         \$(CC) -shared -o libIRCDasyncdns.so dns.o
890
891 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
892         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
893         \$(CC) -shared -o libIRCDbase.so base.o
894
895 libIRCDutil.so: inspircd_util.cpp ../include/base.h ../include/inspircd_util.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
896         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_util.cpp
897         \$(CC) -shared -o libIRCDutil.so inspircd_util.o
898
899 libIRCDio.so: inspircd_io.cpp ../include/base.h ../include/inspircd_io.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
900         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
901         \$(CC) -shared -o libIRCDio.so inspircd_io.o
902
903 libIRCDconnection.so: connection.cpp ../include/base.h ../include/connection.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
904         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c connection.cpp
905         \$(CC) -shared -o libIRCDconnection.so connection.o
906
907 libIRCDmessage.so: message.cpp ../include/base.h ../include/message.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
908         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
909         \$(CC) -shared -o libIRCDmessage.so message.o
910
911 libIRCDcommands.so: commands.cpp ../include/base.h ../include/commands.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
912         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
913         \$(CC) -shared -o libIRCDcommands.so commands.o
914
915 libIRCDdnsqueue.so: dnsqueue.cpp ../include/base.h ../include/dnsqueue.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
916         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
917         \$(CC) -shared -o libIRCDdnsqueue.so dnsqueue.o
918
919 libIRCDdynamic.so: dynamic.cpp ../include/base.h ../include/dynamic.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
920         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
921         \$(CC) -shared -o libIRCDdynamic.so dynamic.o
922
923 libIRCDusers.so: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/connection.h
924         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
925         \$(CC) -shared -o libIRCDusers.so users.o
926
927 libIRCDmodules.so: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
928         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
929         \$(CC) -shared -o libIRCDmodules.so modules.o
930
931 libIRCDwildcard.so: wildcard.cpp ../include/base.h ../include/wildcard.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
932         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
933         \$(CC) -shared -o libIRCDwildcard.so wildcard.o
934
935 libIRCDservers.so: servers.cpp ../include/base.h ../include/servers.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/connection.h
936         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c servers.cpp
937         \$(CC) -shared -o libIRCDservers.so servers.o
938
939 EOM
940 close(FH);
941 }