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