]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - configure
cf5c0fb194efc6d3b972acc14dc43dfa11a95e0c
[user/henk/code/inspircd.git] / configure
1 #!/usr/bin/perl
2
3 # InspIRCd Configuration Script
4 #
5 # Copyright 2003 The ChatSpike Development Team
6 # <brain@chatspike.net>
7 # <Craig@chatspike.net>
8 #
9 # [14:21] Brain: <matrix impression> i know perl-fu!
10 #
11 # $Id$
12 #
13 ########################################
14
15 chomp($topdir = `pwd`);
16 $this = resolve_directory($topdir);                                             # PWD, Regardless.
17 @modlist = ();                                                                  # Declare for Module List..
18 %config = ();                                                                   # Initiate Configuration Hash..
19 $config{ME}                 = resolve_directory($topdir);                       # Present Working Directory
20 $config{BASE_DIR}           = $config{ME};                                      # Use CWD as 'Base' Directory.
21 $config{CONFIG_DIR}         = resolve_directory($config{ME}."/conf");           # Configuration Directory
22 $config{MODULE_DIR}         = resolve_directory($config{ME}."/modules");        # Modules Directory
23 $config{BINARY_DIR}         = resolve_directory($config{ME}."/bin");            # Binary Directory
24 $config{LIBRARY_DIR}        = resolve_directory($config{ME}."/lib");            # Library Directory
25 chomp($config{HAS_GNUTLS}   = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
26 chomp($config{HAS_OPENSSL}  = `openssl version 2>/dev/null`);                   # Openssl version
27 $config{USE_GNUTLS}         = "n";                                              # Use gnutls.
28 $config{USE_OPENSSL}        = "n";                                              # Use openssl.
29 $config{OPTIMITEMP}         = "0";                                              # Default Optimisation Value
30 $config{OPTIMISATI}         = "-g";                                             # Optimisation Flag
31 $config{NICK_LENGT}         = "31";                                             # Default Nick Length
32 $config{CHAN_LENGT}         = "64";                                             # Default Channel Name Length
33 $config{MAX_CHANNE}         = "20";                                             # Default Max. Channels per user
34 $config{MAX_OPERCH}         = "60";                                             # Default Max. Channels per oper
35 $config{MAXI_MODES}         = "20";                                             # Default Max. Number of Modes set at once.
36 $config{HAS_STRLCPY}        = "false";                                          # strlcpy Check.
37 $config{USE_KQUEUE}         = "y";                                              # kqueue enabled
38 $config{USE_EPOLL}          = "y";                                              # epoll enabled
39 $config{THREADED_DNS}       = "n";                                              # threaded dns (experimental)
40 $config{STATIC_LINK}        = "no";                                             # are doing static modules?
41 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`);                           # FD Limit
42 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`);                        # Hard FD Limit
43 chomp($config{GCCVER}       = `gcc -dumpversion | cut -c 1`);                   # Major GCC Version
44 chomp($config{GCC34}        = `gcc -dumpversion | cut -c 3`);                   # Minor GCC Version
45 chomp($config{OSNAME}       = `/bin/uname`);                                    # Operating System Name
46 $config{CC}                 = "g++";                                            # C++ compiler
47 $config{MAKEORDER}          = "ircd mods config bininst";                       # build order
48 $config{STATICLIBS}         = "";                                               # library archive path
49 $config{MAX_IDENT}          = "12";                                             # max ident size
50 $config{MAX_QUIT}           = "255";                                            # max quit message size
51 $config{MAX_TOPIC}          = "307";                                            # max topic size
52 $config{MAX_KICK}           = "255";                                            # max kick message size
53 $config{MAX_GECOS}          = "128";                                            # max GECOS size
54 $config{MAX_AWAY}           = "200";                                            # max AWAY size
55
56 $config{HAS_OPENSSL} =~ /OpenSSL (\S+) \d+ \S+ \d{4}/;
57 $config{HAS_OPENSSL} = $1;
58
59 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
60   chomp($config{OSNAME} = `/usr/bin/uname`);
61   if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
62         $config{OSNAME} = "Unknown";
63   }
64 }
65
66 if (!$config{MAX_CLIENT_T}) { 
67   $config{MAX_CLIENT_T} = 1024;                                 # Set a reasonable 'Default'
68   $fd_scan_fail = "true";                                       # Used Later
69 }
70
71 # Get and Set some important vars..
72 getmodules();
73
74 my $arg = $ARGV[0];                                             # Do Some Argument Checks..
75 if ($arg eq "-clean") { `rm -rf .config.cache`; }               # Remove the config.cache file.
76
77 if ($arg eq "-update") {
78   # Does the cache file exist?
79   if (!getcache()) {
80     # No, No it doesn't.. *BASH*
81     print "You have not run ./configure before. Please do this before trying to run the update script.\n";
82     exit 0;
83   } else {
84     # We've Loaded the cache file and all our variables..
85     print "Updating Files..\n";
86     getosflags();
87     $has_epoll = $config{HAS_EPOLL};
88     $has_kqueue = $config{HAS_KQUEUE};
89     writefiles();
90     print "Complete.\n";
91     exit;
92   }
93 }
94
95 if ($arg eq "-modupdate") {
96   # Does the cache file exist?
97   if (!getcache()) {
98     # No, No it doesn't.. *BASH*
99     print "You have not run ./configure before. Please do this before trying to run the update script.\n";
100     exit 0;
101   } else {
102     # We've Loaded the cache file and all our variables..
103     print "Updating Files..\n";
104     getosflags();
105     $has_epoll = $config{HAS_EPOLL};
106     $has_kqueue = $config{HAS_KQUEUE};
107     if ($config{OSNAME} =~ /CYGWIN/) {
108       write_static_modules_makefile();
109     } else {
110       write_dynamic_modules_makefile();
111     }
112     print "Complete.\n";
113     exit;
114   }
115 }
116
117 print "Checking for cache from previous configure...\n";
118 getcache();
119 print "Checking operating system version...\n";
120 getosflags();
121
122 if (!$config{MAX_CLIENT}) { 
123   # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
124   # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
125   # higher than the found value" :))
126   $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
127 }
128
129 printf "Checking if strlcpy exists... ";
130 # Perform the strlcpy() test..
131 $config{HAS_STRLCPY} = "false";
132 my $fail = 0;
133 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
134 if (!$fail)
135 {
136         while (chomp($line = <STRLCPY>))
137         {
138                 # try and find the delcaration of:
139                 # size_t strlcpy(...)
140                 if ($line =~ /size_t(\0x9|\s)+strlcpy/)
141                 {
142                         $config{HAS_STRLCPY} = "true";
143                 }
144         }
145         close(STRLCPY);
146 }
147 print "yes\n" if $config{HAS_STRLCPY} eq "true";
148 print "no\n" if $config{HAS_STRLCPY} eq "false";
149
150 printf "Checking if kqueue exists... ";
151 $has_kqueue = 0;
152 $fail = 0;
153 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
154 if (!$fail)
155 {
156         while (chomp($line = <KQUEUE>))
157         {
158                 # try and find the delcaration of:
159                 # int kqueue(void);
160                 if ($line =~ /int(\0x9|\s)+kqueue/)
161                 {
162                         $has_kqueue = 1;
163                 }
164         }
165         close(KQUEUE);
166 }
167 print "yes\n" if $has_kqueue == 1;
168 print "no\n" if $has_kqueue == 0;
169
170 printf "Checking if epoll exists... ";
171 $has_epoll = 0;
172 $fail = 0;
173 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
174 if (!$fail)
175 {
176         while (chomp($line = <EPOLL>))
177         {
178                 # try and find the declaration of:
179                 # extern int epoll_create (int __size) __THROW;
180                 if (($line =~ /int(\0x9|\s)+epoll_create(\0x9|\s)+\(/) || ($line =~ /int(\0x9|\s)+epoll_create\(/))
181                 {
182                         $has_epoll = 1;
183                 }
184         }
185         close(EPOLL);
186 }
187 if ($has_epoll) {
188         my $kernel = `uname -r`;
189         chomp($kernel);
190         if (($kernel =~ /2\.0/) || ($kernel =~ /2\.2/) || ($kernel =~ /2\.4/)) {
191                 $has_epoll = 0;
192         }
193 }
194 print "yes\n" if $has_epoll == 1;
195 print "no\n" if $has_epoll == 0;
196
197 if ($config{OSNAME} =~ /CYGWIN/) {
198         $config{HAS_STRLCPY} = "true";
199 }
200
201 $config{HAS_EPOLL} = $has_epoll;
202 $config{HAS_KQUEUE} = $has_kqueue; 
203
204 printf "Checking for libgnutls... ";
205 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
206         print "yes\n";
207         $config{HAS_GNUTLS} = "y";
208 } else {
209         print "no\n";
210         $config{HAS_GNUTLS} = "n";
211 }
212
213 printf "Checking for openssl... ";
214 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
215         print "yes\n";
216         $config{HAS_OPENSSL} = "y";
217 } else {
218         print "no\n";
219         $config{HAS_OPENSSL} = "n";
220 }
221
222 ################################################################################
223 #                          BEGIN INTERACTIVE PART                              #
224 ################################################################################
225
226 # Clear the Screen..
227 system("clear");
228 # Display Splash Logo..
229 show_splash();
230 chomp($wholeos = `uname -mnr`);
231
232 # Display Introduction Message..
233 print "
234 Welcome to the InspIRCd Configuration program!
235
236 *** If you are unsure of any of these values, leave it blank for    ***
237 *** standard settings that will work, and your server will run      ***
238 *** using them. If you are running this server as part of a         ***
239 *** larger network, you must consult with your network admins       ***
240 *** for the proper values to use, or server links will be unstable! ***
241
242 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
243 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
244 dir, otherwise you won't have a config file!
245
246 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos), fdmax: $config{MAX_CLIENT_T}\n\n";
247
248 $config{CHANGE_COMPILER} = "n";
249 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";
250
251 if ($config{GCCVER} < 3)
252 {
253         print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
254 should NOT be used. You should probably specify a newer compiler.\n";
255 }
256 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
257 if ($config{CHANGE_COMPILER} =~ /y/i)
258 {
259     print "What command do you want to use to invoke your compiler?\n";
260     print "[\033[1;32m$config{CC}\033[0m] -> ";
261     chomp($config{CC} = <STDIN>);
262     if ($config{CC} eq "") { $config{CC} = "g++"; }
263     chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
264     if ($foo ne "") {
265             chomp($config{GCCVER}       = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change
266             chomp($config{GCC34}        = `$config{CC} -dumpversion | cut -c 3`); # the compiler path
267             print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.$config{GCC34}\033[0m)\n";
268     }
269     else
270     {
271             print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
272     }
273 }
274
275 print "\n";
276
277 # Directory Settings..
278 my $tmpbase = $config{BASE_DIR};
279 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
280 if ($tmpbase ne $config{BASE_DIR}) {
281         $config{CONFIG_DIR}         = resolve_directory($config{BASE_DIR}."/conf");           # Configuration Directory
282         $config{MODULE_DIR}         = resolve_directory($config{BASE_DIR}."/modules");        # Modules Directory
283         $config{BINARY_DIR}         = resolve_directory($config{BASE_DIR}."/bin");            # Binary Directory
284         $config{LIBRARY_DIR}        = resolve_directory($config{BASE_DIR}."/lib");            # Library Directory
285 }
286
287 dir_check("are the configuration files", "CONFIG_DIR");
288 dir_check("are the modules to be compiled to", "MODULE_DIR");
289 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
290 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
291
292 if ($has_kqueue) {
293         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?");
294         print "\n";
295 }
296 if ($has_epoll) {
297         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?");
298         print "\n";
299 }
300 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
301 if (!$chose_hiperf)
302 {
303         print "No high-performance socket engines are available, or you chose\n";
304         print "not to enable one. Defaulting to select() engine.\n\n";
305 }
306
307 yesno(THREADED_DNS,"Would you like to enable the experimental multi-threaded DNS lookup?");
308 print "\n";
309
310 if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
311         print "I have detected both GnuTLS and OpenSSL on your system.\n";
312         print "I will default to GnuTLS. If you wish to use OpenSSL\n";
313         print "instead, you should enable the OpenSSL module yourself\n";
314         print "by copying it from src/modules/extra to src/modules.\n\n";
315 }
316
317 if ($config{HAS_GNUTLS} eq "y") {
318         yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
319         print "\nUsing GnuTLS SSL module.\n";
320 } elsif ($config{HAS_OPENSSL} eq "y") {
321         yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
322         print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
323 }
324
325 print "\nThe following questions will ask you for various figures relating\n";
326 print "To your IRCd install. Please note that these should usually be left\n";
327 print "as defaults unless you have a real reason to change them. If they\n";
328 print "changed, then the values must be identical on all servers on your\n";
329 print "network, or malfunctions and/or crashes may occur, with the exception\n";
330 print "of the 'maximum number of clients' setting which may be different on\n";
331 print "different servers on the network.\n\n";
332
333 # File Descriptor Settings..
334 my $continue = 0;
335 while (!$continue) {
336   print "Maximum number of clients at any one time ($config{MAX_CLIENT_T})\n";
337   print "[\033[1;32m$config{MAX_CLIENT}\033[0m] -> ";
338   chomp($var = <STDIN>);
339   if ($var eq "") { $var = $config{MAX_CLIENT}; }
340   if ($var =~ /^\d+$/) {
341     if (($var > $config{MAX_CLIENT_T}) && ($fd_scan_failed ne true)) {
342       # Client has entered a larger number than the 'discovered' value
343       # Confirm.
344       print "WARNING: Our scans have indicated that you are attempting
345 to use more sockets than there are avaliable. Are you sure
346 you wish to do this? It may cause the IRCd to malfunction [y/n]
347 [\033[1;32mn\033[0m] -> $c";
348       chomp($tmp = <STDIN>);
349       if ($tmp ne "y") {
350         print "Please enter the correct value.\n\n";
351         next;
352       }
353     }
354   } else {
355     print "You must enter a number in this field. Please try again.\n\n";
356     next;
357   }
358   # If we get here, we should be good to go.
359   $config{MAX_CLIENT} = $var;
360   $continue = 1;
361   print "\n";
362 }
363
364 my $continue = 0;
365 while (!$continue) {
366   print "What is the maximum length of nicknames?\n";
367   print "[\033[1;32m$config{NICK_LENGT}\033[0m] -> ";
368   chomp($var = <STDIN>);
369   if ($var eq "") { $var = $config{NICK_LENGT}; }
370   if ($var =~ /^\d+$/) {
371     # We don't care what the number is, set it and be on our way.
372     $config{NICK_LENGT} = $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 channel names?\n";
383   print "[\033[1;32m$config{CHAN_LENGT}\033[0m] -> ";
384   chomp($var = <STDIN>);
385   if ($var eq "") { $var = $config{CHAN_LENGT}; }
386   if ($var =~ /^\d+$/) {
387     # We don't care what the number is, set it and be on our way.
388     $config{CHAN_LENGT} = $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 number of channels a normal user may join at any one time?\n";
399   print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
400   chomp($var = <STDIN>);
401   if ($var eq "") { $var = $config{MAX_CHANNE}; }
402   if ($var =~ /^\d+$/) {
403     # We don't care what the number is, set it and be on our way.
404     $config{MAX_CHANNE} = $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 number of channels an oper may join at any one time?\n";
415   print "[\033[1;32m$config{MAX_OPERCH}\033[0m] -> ";
416   chomp($var = <STDIN>);
417   if ($var eq "") { $var = $config{MAX_OPERCH}; }
418   if ($var =~ /^\d+$/) {
419     # We don't care what the number is, set it and be on our way.
420     $config{MAX_OPERCH} = $var;
421     $continue = 1;
422     print "\n";
423  }
424 }
425
426 $continue = 0;
427 while (!$continue) {
428   print "What is the maximum number of mode changes in one line?\n";
429   print "[\033[1;32m$config{MAXI_MODES}\033[0m] -> ";
430   chomp($var = <STDIN>);
431   if ($var eq "") { $var = $config{MAXI_MODES}; }
432   if ($var =~ /^\d+$/) {
433     # We don't care what the number is, set it and be on our way.
434     $config{MAXI_MODES} = $var;
435     $continue = 1;
436     print "\n";
437   } else {
438     print "You must enter a number in this field. Please try again.\n\n";
439   }
440 }
441
442 $continue = 0;
443 while (!$continue) {
444   print "What is the maximum length of an ident (username)?\n";
445   print "[\033[1;32m$config{MAX_IDENT}\033[0m] -> ";
446   chomp($var = <STDIN>);
447   if ($var eq "") { $var = $config{MAX_IDENT}; }
448   if ($var =~ /^\d+$/) {
449     # We don't care what the number is, set it and be on our way.
450     $config{MAX_IDENT} = $var;
451     $continue = 1;
452     print "\n";
453   } else {
454     print "You must enter a number in this field. Please try again.\n\n";
455   }
456 }
457
458 $continue = 0;
459 while (!$continue) {
460   print "What is the maximum length of a quit message?\n";
461   print "[\033[1;32m$config{MAX_QUIT}\033[0m] -> ";
462   chomp($var = <STDIN>);
463   if ($var eq "") { $var = $config{MAX_QUIT}; }
464   if ($var =~ /^\d+$/) {
465     # We don't care what the number is, set it and be on our way.
466     $config{MAX_QUIT} = $var;
467     $continue = 1;
468     print "\n";
469   } else {
470     print "You must enter a number in this field. Please try again.\n\n";
471   }
472 }
473
474 $continue = 0;
475 while (!$continue) {
476   print "What is the maximum length of a channel topic?\n";
477   print "[\033[1;32m$config{MAX_TOPIC}\033[0m] -> ";
478   chomp($var = <STDIN>);
479   if ($var eq "") { $var = $config{MAX_TOPIC}; }
480   if ($var =~ /^\d+$/) {
481     # We don't care what the number is, set it and be on our way.
482     $config{MAX_TOPIC} = $var;
483     $continue = 1;
484     print "\n";
485   } else {
486     print "You must enter a number in this field. Please try again.\n\n";
487   }
488 }
489
490 $continue = 0;
491 while (!$continue) {
492   print "What is the maximum length of a kick message?\n";
493   print "[\033[1;32m$config{MAX_KICK}\033[0m] -> ";
494   chomp($var = <STDIN>);
495   if ($var eq "") { $var = $config{MAX_KICK}; }
496   if ($var =~ /^\d+$/) {
497     # We don't care what the number is, set it and be on our way.
498     $config{MAX_KICK} = $var;
499     $continue = 1;
500     print "\n";
501   } else {
502     print "You must enter a number in this field. Please try again.\n\n";
503   }
504 }
505
506 $continue = 0;
507 while (!$continue) {
508   print "What is the maximum length of a GECOS (real name) field?\n";
509   print "[\033[1;32m$config{MAX_GECOS}\033[0m] -> ";
510   chomp($var = <STDIN>);
511   if ($var eq "") { $var = $config{MAX_GECOS}; }
512   if ($var =~ /^\d+$/) {
513     # We don't care what the number is, set it and be on our way.
514     $config{MAX_GECOS} = $var;
515     $continue = 1;
516     print "\n";
517   } else {
518     print "You must enter a number in this field. Please try again.\n\n";
519   }
520 }
521
522 $continue = 0;
523 while (!$continue) {
524   print "What is the maximum length of an away message?\n";
525   print "[\033[1;32m$config{MAX_AWAY}\033[0m] -> ";
526   chomp($var = <STDIN>);
527   if ($var eq "") { $var = $config{MAX_AWAY}; }
528   if ($var =~ /^\d+$/) {
529     # We don't care what the number is, set it and be on our way.
530     $config{MAX_AWAY} = $var;
531     $continue = 1;
532     print "\n";
533   } else {
534     print "You must enter a number in this field. Please try again.\n\n";
535   }
536 }
537
538 # Code Optimisation
539 print "Enter the Level Of Binary optimisation. This is a number between 0 and 3.
540 The InspIRCd Team will NOT support any bug reports above 0. Also note,
541 the IRCd behaviour will be different depending on this value. Please
542 read the documentation for more information.
543
544 The higher the number, the more optimised your binary will be. This
545 value will default to 0 if you either don't enter a number, or enter
546 a value outside the range.
547
548 As always, if you are unsure, just press enter and accept the default.\n\n";
549 print "[\033[1;32m$config{OPTIMITEMP}\033[0m] -> ";
550 chomp($var = <STDIN>);
551 if ($var eq "") {
552   $var = $config{OPTIMITEMP};
553 }
554
555 if ($var eq "1") {
556   $config{OPTIMITEMP} = 1;
557   $config{OPTIMISATI} = "-O";
558 } elsif ($var eq "2") {
559   $config{OPTIMITEMP} = 2;
560   $config{OPTIMISATI} = "-O2";
561 } elsif ($var eq "3") {
562   $config{OPTIMITEMP} = 3;
563   $config{OPTIMISATI} = "-O3";
564 } else {
565   $config{OPTIMITEMP} = 0;
566   $config{OPTIMISATI} = "-g";
567 }
568
569 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
570 print "\033[0mBase install path:\033[1;32m\t\t$config{BASE_DIR}\n";
571 print "\033[0mConfig path:\033[1;32m\t\t\t$config{CONFIG_DIR}\n";
572 print "\033[0mModule path:\033[1;32m\t\t\t$config{MODULE_DIR}\n";
573 print "\033[0mLibrary path:\033[1;32m\t\t\t$config{LIBRARY_DIR}\n";
574 print "\033[0mMax connections:\033[1;32m\t\t$config{MAX_CLIENT}\n";
575 print "\033[0mMax User Channels:\033[1;32m\t\t$config{MAX_CHANNE}\n";
576 print "\033[0mMax Oper Channels:\033[1;32m\t\t$config{MAX_OPERCH}\n";
577 print "\033[0mMax nickname length:\033[1;32m\t\t$config{NICK_LENGT}\n";
578 print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
579 print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
580 print "\033[0mMax ident length:\033[1;32m\t\t$config{MAX_IDENT}\n";
581 print "\033[0mMax quit length:\033[1;32m\t\t$config{MAX_QUIT}\n";
582 print "\033[0mMax topic length:\033[1;32m\t\t$config{MAX_TOPIC}\n";
583 print "\033[0mMax kick length:\033[1;32m\t\t$config{MAX_KICK}\n";
584 print "\033[0mMax name length:\033[1;32m\t\t$config{MAX_GECOS}\n";
585 print "\033[0mMax away length:\033[1;32m\t\t$config{MAX_AWAY}\n";
586 print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
587 print "\033[0mOptimatizaton Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
588 print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n";
589 print "\033[0mStatic modules:\033[1;32m\t\t\t$config{STATIC_LINK}\033[0m\n";
590 print "\033[0mMultithread DNS:\033[1;32m\t\t$config{THREADED_DNS}\033[0m\n";
591 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$config{USE_GNUTLS}\033[0m\n";
592 print "\033[0mOpenSSL Support:\033[1;32m\t\t$config{USE_OPENSSL}\033[0m\n\n";
593
594 if ($config{USE_GNUTLS} eq "y") {
595         system("cp src/modules/extra/m_ssl_gnutls.cpp src/modules/m_ssl_gnutls.cpp");
596         getmodules();
597         $failed = 0;
598         open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
599         close(TMP);
600         open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
601         close(TMP);
602         if ($failed) {
603                 print "SSL Certificates Not found, Generating.. \n\n
604 *************************************************************
605 * Generating the Private Key may take some time, go grab a  *
606 * Coffee. Even better, to generate some more entropy if it  *
607 * is taking a while, open another console and type du / a   *
608 * few times and get that HD going :) Then answer the        *
609 * Questions which follow. If you are unsure, just hit enter *
610 *************************************************************\n\n";
611                 system("certtool --generate-privkey --outfile key.pem");
612                 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
613                 print "\nCertificate generation complete, copying to config directory... ";
614                 system("mv key.pem $config{CONFIG_DIR}/key.pem");
615                 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
616                 print "Done.\n\n";
617         } else {
618                 print "SSL Certificates found, skipping.\n\n"
619         }       
620 } elsif ($config{USE_OPENSSL} eq "y") {
621         system("cp src/modules/extra/m_ssl_openssl.cpp src/modules/m_ssl_openssl.cpp");
622         getmodules();
623         $failed = 0;
624         open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
625         close(TMP);
626         open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
627         close(TMP);
628         if ($failed) {
629                 print "SSL Certificates Not found, Generating.. \n\n
630 *************************************************************
631 * Generating the certificates may take some time, go grab a *
632 * coffee, or something.                                     *
633 *************************************************************\n\n";
634                 system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
635                 system("openssl dhparam -out dhparams.pem 1024");
636                 print "\nCertificate generation complete, copying to config directory... ";
637                 system("mv key.pem $config{CONFIG_DIR}/key.pem");
638                 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
639                 system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
640                 print "Done.\n\n";
641         } else {
642                 print "SSL Certificates found, skipping.\n\n"
643         }
644 }
645 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
646         print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
647 }
648
649 makecache();
650 writefiles();
651
652 print "\n\n";
653 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
654 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
655         print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
656         print "load the required modules in your config. This configure process\n";
657         print "has just prepared these modules to be compiled for you, and has not\n";
658         print "configured them to be compiled into the core of the ircd.\n";
659 }
660 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
661 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
662         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";
663 }
664
665 if ($config{GCCVER} < "3") {
666         print <<FOO2;
667 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
668 GCC 2.x series compilers only had partial (read as broken) C++ support, and
669 your compile will most likely fail horribly! If you have any problems, do NOT
670 report them to the bugtracker or forums without first upgrading your compiler
671 to a newer 3.x or 4.x (or whatever is available currently) version.
672 FOO2
673 }
674
675 ################################################################################
676 #                              HELPER FUNCTIONS                                #
677 ################################################################################
678 sub getcache {
679   # Retrieves the .config.cache file, and loads values into the main config hash.
680   open(CACHE, ".config.cache") or return undef;
681   while (<CACHE>) {
682     chomp;
683
684     # Ignore Blank lines, and comments..
685     next if /^\s*$/;
686     next if /^\s*#/;
687
688     my ($key, $value) = split("=", $_);
689     $value =~ /^\"(.*)\"$/;
690     # Do something with data here!
691     $config{$key} = $1;
692   }
693   close(CONFIG);
694   return "true";
695 }
696
697 sub makecache {
698   # Dump the contents of %config
699   print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
700   open(FILEHANDLE, ">.config.cache");
701   foreach $key (keys %config)
702   {
703     print FILEHANDLE "$key=\"$config{$key}\"\n";
704   }
705   close(FILEHANDLE);
706 }
707
708 sub dir_check {
709   my ($desc, $hash_key) = @_;
710   my $complete = 0;
711   while (!$complete) {
712     print "In what directory $desc?\n";
713     print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
714     chomp($var = <STDIN>);
715     if ($var eq "") { $var = $config{$hash_key}; }
716     if ($var =~ /^\~\/(.+)$/) {
717         # Convert it to a full path..
718         $var = resolve_directory($ENV{HOME} . "/" . $1);
719     }
720     if (substr($var,0,1) ne "/")
721     {
722         # Assume relative Path was given.. fill in the rest.
723         $var = $this . "/$var";
724     }
725     $var = resolve_directory($var); 
726     if (! -e $var) {
727       print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
728       chomp($tmp = <STDIN>);
729       if (($tmp eq "") || ($tmp =~ /^y/i)) {
730         # Attempt to Create the Dir..
731         $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
732         if ($chk != 0) {
733           print "Unable to create directory. ($var)\n\n";
734           # Restart Loop..
735           next;
736         }
737       } else {
738         # They said they don't want to create, and we can't install there.
739         print "\n\n";
740         next;
741       }
742     } else {
743       if (!is_dir($var)) {
744         # Target exists, but is not a directory.
745         print "File $var exists, but is not a directory.\n\n";
746         next;
747       }
748     }
749     # Either Dir Exists, or was created fine.
750     $config{$hash_key} = $var;
751     $complete = 1;
752     print "\n";
753   }
754 }
755
756 sub getosflags {
757   if ($config{OSNAME} =~ /BSD$/) {
758     $config{LDLIBS} = "-Ldl -lstdc++";
759     $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
760     $config{MAKEPROG} = "gmake";
761     if ($config{OSNAME} eq "OpenBSD") {
762         chomp($foo = `eg++ -dumpversion | cut -c 1`);
763         # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
764         # if theyre not running this, configure lets the build continue but they probably wont manage to
765         # compile as this standard version is 2.95.3!
766         if ($foo ne "") {
767                 $config{CC} = "eg++";
768                 chomp($config{GCCVER}       = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
769                 chomp($config{GCC34}        = `eg++ -dumpversion | cut -c 3`); # the compiler path
770         }
771     }
772   } else {
773     $config{LDLIBS} = "-ldl -lstdc++";
774     $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
775     $config{MAKEPROG} = "make";
776     if ($config{OSNAME} =~ /CYGWIN/) {
777        $config{FLAGS}  = "-frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
778        $config{LDLIBS} = "";
779        $config{MAKEPROG} = "/usr/bin/make";
780        $config{MAKEORDER} = "ircd mods config bininst";
781     }
782   }
783   if ($config{OSNAME} =~ /SunOS/) {
784     # solaris/sunos needs these
785     # socket = bsd sockets api
786     # nsl = dns stuff
787     # rt = POSIX realtime extensions
788     # resolv = inet_aton only (why isnt this in nsl?!)
789     $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
790   }
791 }
792
793 sub is_dir {
794   my ($path) = @_;
795   if (chdir($path)) {
796     chdir($this);
797     return 1;
798   } else {
799     # Just in case..
800     chdir($this);
801     return 0;
802   }
803 }
804
805 sub getmodules {
806   my $i = 0;
807   opendir(DIRHANDLE, "src/modules");
808   foreach $name (sort readdir(DIRHANDLE)) {
809     if ($name =~ /^m_(.+)\.cpp$/)
810     {
811       $mod = $1;
812       if ($mod !~ /_static$/) {
813               $modlist[$i++] = $mod;
814       }
815     }
816   }
817   closedir(DIRHANDLE);
818 }
819
820 sub writefiles {
821
822   print "Writing \033[1;32minspircd_config.h\033[0m\n";
823   # First File.. inspircd_config.h
824   chomp(my $incos = `uname -n -s -r`);
825   chomp(my $version = `sh ./src/version.sh`);
826   open(FILEHANDLE, ">include/inspircd_config.h");
827   my $NL = $config{NICK_LENGT}+1;
828   my $CL = $config{CHAN_LENGT}+1;
829   print FILEHANDLE <<EOF;
830 /* Auto generated by configure, do not modify! */
831 #ifndef __CONFIGURATION_AUTO__
832 #define __CONFIGURATION_AUTO__
833
834 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
835 #define MOD_PATH "$config{MODULE_DIR}"
836 #define VERSION "$version"
837 #define MAXCLIENTS $config{MAX_CLIENT}
838 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
839 #define NICKMAX $NL
840 #define CHANMAX $CL
841 #define MAXCHANS $config{MAX_CHANNE}
842 #define OPERMAXCHANS $config{MAX_OPERCH}
843 #define MAXMODES $config{MAXI_MODES}
844 #define IDENTMAX $config{MAX_IDENT}
845 #define MAXQUIT $config{MAX_QUIT}
846 #define MAXTOPIC $config{MAX_TOPIC}
847 #define MAXKICK $config{MAX_KICK}
848 #define MAXGECOS $config{MAX_GECOS}
849 #define MAXAWAY $config{MAX_AWAY}
850 #define OPTIMISATION $config{OPTIMITEMP}
851 #define SYSTEM "$incos"
852 #define MAXBUF 514
853 EOF
854
855   if ($config{OSNAME} =~ /SunOS/) {
856     print FILEHANDLE "#define IS_SOLARIS\n";
857   }
858   if ($config{OSNAME} =~ /CYGWIN/) {
859     print FILEHANDLE "#define IS_CYGWIN\n";
860     print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE    1024\n#endif\n";
861   }
862   if ($config{STATIC_LINK} eq "yes") {
863     print FILEHANDLE "#define STATIC_LINK\n";
864   }
865   if ($config{GCCVER} > 3) {
866     print FILEHANDLE "#define GCC3\n";
867     print FILEHANDLE "#define GCC34\n";
868   }
869   else
870   {
871     if ($config{GCCVER} == 3) {
872       print FILEHANDLE "#define GCC3\n";
873       if ($config{GCC34} > 3) {
874         print FILEHANDLE "#define GCC34\n";
875       }
876     }
877   }
878   if ($config{HAS_STRLCPY} eq "true") {
879     print FILEHANDLE "#define HAS_STRLCPY\n";
880   }
881   if ($config{THREADED_DNS} =~ /y/i) {
882     print FILEHANDLE "#define THREADED_DNS\n";
883   }
884   my $use_hiperf = 0;
885   if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
886     print FILEHANDLE "#define USE_KQUEUE\n";
887     $use_hiperf = 1;
888   }
889   if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
890     print FILEHANDLE "#define USE_EPOLL\n";
891     $use_hiperf = 1;
892   }
893   # user didn't choose either epoll or select for their OS.
894   # default them to USE_SELECT (ewwy puke puke)
895   if (!$use_hiperf) {
896     print FILEHANDLE "#define USE_SELECT\n";
897   }
898   print FILEHANDLE "\n#endif\n";
899   close(FILEHANDLE);
900
901   # Create a Modules List..
902   my $modules = "";
903   foreach $i (@modlist)
904   {
905     if ($config{STATIC_LINK} eq "yes") {
906         $modules .= "m_".$i.".o ";
907     }
908     else {
909         $modules .= "m_".$i.".so ";
910     }
911   }
912   chomp($modules);   # Remove Redundant whitespace..
913
914
915   # Write all .in files.
916   my $tmp = "";
917   my $file = "";
918   my $exe = "inspircd";
919
920   if ($config{OSNAME} =~ /CYGWIN/) {
921     $exe = "inspircd.exe";
922   }
923
924   opendir(DIRHANDLE, $this);
925   if ($config{THREADED_DNS} =~ /y/i) {
926     $config{LDLIBS} = $config{LDLIBS} . " -pthread";
927   }
928   foreach $name (sort readdir(DIRHANDLE)) {
929     if ($name =~ /^\.(.+)\.inc$/)
930     {
931       $file = $1;
932       # All .name.inc files need parsing!
933       $tmp = "";
934       open(FILEHANDLE, ".$file.inc");
935       while (<FILEHANDLE>) {
936         $tmp .= $_;
937       }
938       close(FILEHANDLE);
939
940       $tmp =~ s/\@CC\@/$config{CC}/;
941       $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
942       $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
943       $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
944       $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
945       $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
946       $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
947       $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
948       $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
949       $tmp =~ s/\@MODULES\@/$modules/;
950       $tmp =~ s/\@EXECUTABLE\@/$exe/;
951       $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
952       $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
953
954       print "Writing \033[1;32m$file\033[0m\n";
955       open(FILEHANDLE, ">$file");
956       print FILEHANDLE $tmp;
957     }
958   }
959   closedir(DIRHANDLE);
960
961   # Make inspircd executable!
962   chmod 0744, 'inspircd';
963
964   if ($config{STATIC_LINK} eq "yes") {
965         print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
966         write_static_makefile();
967         write_static_modules_makefile();
968   } elsif ($config{OSNAME} =~ /CYGWIN/) {
969         print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
970         write_static_makefile();
971         write_dynamic_modules_makefile();
972   } else {
973         print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
974         write_dynamic_makefile();
975         write_dynamic_modules_makefile();
976   }
977 }
978
979 sub getcompilerflags {
980   my ($file) = @_;
981   open(FLAGS, $file);
982   while (<FLAGS>) {
983     if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
984       close(FLAGS);
985       return $1;
986     }
987   }
988   close(FLAGS);
989   return undef;
990 }
991
992 sub getlinkerflags {
993   my ($file) = @_;
994   open(FLAGS, $file);
995   while (<FLAGS>) {
996     if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
997       close(FLAGS);
998       return $1;
999     }
1000   }
1001   close(FLAGS);
1002   return undef;
1003 }
1004
1005 sub show_splash {
1006   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";
1007   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";
1008   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";
1009   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";
1010   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";
1011   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";
1012   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";
1013   print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
1014 }
1015
1016 sub resolve_directory {
1017         use File::Spec;
1018         return File::Spec->rel2abs($_[0]);
1019 }
1020
1021 sub yesno {
1022         my ($flag,$prompt) = @_;
1023         print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
1024         chomp($tmp = <STDIN>);
1025         if ($tmp eq "") { $tmp = $config{$flag} }
1026
1027         if (($tmp eq "") || ($tmp =~ /^y/i)) {
1028                 $config{$flag} = "y";
1029         } else {
1030                 $config{$flag} = "n";
1031         }
1032         return;
1033 }
1034
1035 sub write_static_modules_makefile {
1036   # Modules Makefile..
1037   print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1038   open(FILEHANDLE, ">src/modules/Makefile");
1039
1040 ###
1041 # Module Makefile Header
1042 ###
1043   print FILEHANDLE <<EOF;
1044 # (C) ChatSpike development team
1045 # Makefile by <Craig\@ChatSpike.net>
1046 # Many Thanks to Andrew Church <achurch\@achurch.org>
1047 #    for assisting with making this work right.
1048 #
1049 # Automatically Generated by ./configure to add a modules
1050 # please run ./configure --update
1051
1052 all: \$(MODULES)
1053
1054 EOF
1055 ###
1056 # End Module Makefile Header
1057 ###
1058
1059 # Create a Modules List..
1060 my $modules = "";
1061 my $cmflags = "";
1062 my $liflags = "";
1063
1064 open(MODLIST,">include/modlist.h");
1065
1066 ###
1067 # Include File Header
1068 ###
1069 print MODLIST <<HEADER;
1070 // Generated automatically by configure. DO NOT EDIT!
1071
1072 #ifndef __SYMBOLS__H_CONFIGURED__
1073 #define __SYMBOLS__H_CONFIGURED__
1074
1075 HEADER
1076 ###
1077 # End Include File Header
1078 ###
1079
1080 # Place Module List into Include
1081 foreach $i (@modlist) {
1082         if ($i !~ /_static$/) {
1083                 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1084         }
1085 }
1086 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1087
1088 ###
1089 # Build Module Crap
1090 ###
1091 foreach $i (@modlist)
1092 {
1093         if ($i !~ /_static$/) {
1094                 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1095                 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1096
1097                 print FILEHANDLE <<EOCHEESE;
1098                 ###
1099                 # Write Entry to the MakeFile
1100                 ###
1101 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h
1102         \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
1103         mv m_$i\_static.o ../m_$i.o
1104
1105 EOCHEESE
1106                 ###
1107                 # End Write Entry to the MakeFile
1108                 ###
1109                 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1110                 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1111                 open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
1112                 while (chomp($a = <MODULE>)) { 
1113                         $a =~ s/init_module/$i\_init/g;
1114                         $a =~ s/Srv/$i\Srv/g;
1115                         print MUNGED "$a\n";
1116                 }
1117                 close(MODULE);
1118                 close(MUNGED);
1119                 print MODLIST <<EOENT;
1120 {"m_$i.so",\&$i\_init},
1121 EOENT
1122                 print "done\n";
1123         }
1124 }
1125 print MODLIST "{0}};\n\n#endif\n";
1126 close(MODLIST);
1127 }
1128
1129 sub write_dynamic_modules_makefile {
1130   # Modules Makefile..
1131   print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1132   open(FILEHANDLE, ">src/modules/Makefile");
1133   my $extra = "";
1134
1135   if ($config{OSNAME} =~ /CYGWIN/) {
1136         $extra = "../inspircd.dll.a";
1137   }
1138
1139 ###
1140 # Module Makefile Header
1141 ###
1142   print FILEHANDLE <<EOF;
1143 # (C) ChatSpike development team
1144 # Makefile by <Craig\@ChatSpike.net>
1145 # Many Thanks to Andrew Church <achurch\@achurch.org>
1146 #    for assisting with making this work right.
1147 #
1148 # Automatically Generated by ./configure to add a modules
1149 # please run ./configure -update or ./configure -modupdate
1150
1151 all: \$(MODULES)
1152
1153 EOF
1154 ###
1155 # End Module Makefile Header
1156 ###
1157
1158 # Create a Modules List..
1159 my $modules = "";
1160 my $cmflags = "";
1161 my $liflags = "";
1162
1163 foreach $i (@modlist) {
1164         ###
1165         # Write Entry to the MakeFile
1166         ###
1167         $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1168         $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1169         print FILEHANDLE <<EOCHEESE;
1170 m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/inspircd_io.h
1171         \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1172         \$(CC) \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1173         \@-rm -f \$(MODPATH)/m_$i.so
1174         install -v -m 0700 m_$i.so \$(MODPATH)
1175
1176 EOCHEESE
1177         ###
1178         # End Write Entry to the MakeFile
1179         ###
1180 }
1181 }
1182
1183
1184 sub write_static_makefile {
1185         open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1186         my $i = 0;
1187         my @cmdlist = ();
1188         opendir(DIRHANDLE, "src");
1189         foreach $name (sort readdir(DIRHANDLE)) {
1190                 if ($name =~ /^cmd_(.+)\.cpp$/) {
1191                         $cmdlist[$i++] = $1;
1192                 }
1193         }
1194         closedir(DIRHANDLE);
1195         my $cmdobjs = "";
1196         my $srcobjs = "";
1197         foreach my $cmd (@cmdlist) {
1198                 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1199                 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1200         }
1201         print FH <<EOM;
1202 # Insp Makefile :p
1203 #
1204 # (C) ChatSpike development team
1205 # Makefile by <Craig\@ChatSpike.net>
1206 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1207 #
1208
1209 CC = im a cheezeball
1210
1211 CXXFLAGS = -I../include \${FLAGS}
1212
1213 EOM
1214 ###
1215 # This next section is for cygwin dynamic module builds.
1216 # Basically, what we do, is build the inspircd core as a library
1217 # then the main executable uses that. the library is capable of
1218 # loading / unloading the modules dynamically :)
1219 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1220 # make this work :)
1221 ###
1222
1223 if ($config{OSNAME} =~ /CYGWIN/) {
1224         print FH <<EOM;
1225 all: aes.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o inspircd.exe
1226
1227 inspircd.exe: inspircd.dll.a
1228         \$(CC) -o \$@ \$^
1229
1230 inspircd.dll inspircd.dll.a: inspircd.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_io.o message.o $cmdobjs  commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o hashcomp.o socket.o socketengine.o userprocess.o cull_list.o command_parse.o aes.o
1231         \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1232 EOM
1233 } else {
1234         print FH <<EOM;
1235 all: aes.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o \$(MODULES) inspircd.exe
1236
1237 inspircd.exe: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h ../include/base.h
1238         \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o hashcomp.o socket.o socketengine.o userprocess.o cull_list.o command_parse.o aes.o \$(MODULES)
1239 EOM
1240 }
1241
1242 print FH <<EOM;
1243
1244 cull_list.o: cull_list.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/users.h ../include/channels.h
1245         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1246
1247 command_parse.o: command_parse.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1248         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1249
1250 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1251         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1252
1253 socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1254         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1255
1256 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1257         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1258
1259 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1260         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1261
1262 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1263         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1264
1265 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
1266         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1267
1268 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
1269         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1270
1271 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
1272         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1273
1274 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
1275         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1276
1277 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1278         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1279
1280 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
1281         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1282
1283 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
1284         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1285
1286 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 $srcobjs
1287         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1288
1289 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
1290         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1291
1292 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
1293         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1294
1295 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
1296         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1297
1298 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
1299         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1300
1301 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
1302         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1303
1304 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1305         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1306
1307 aes.o: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1308         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1309
1310 EOM
1311         foreach my $cmd (@cmdlist) {
1312                 print FH <<ITEM;
1313 cmd_$cmd.o: cmd_$cmd.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/cmd_$cmd.h
1314         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1315 ITEM
1316         }
1317 close(FH);
1318 }
1319
1320 sub write_dynamic_makefile {
1321
1322         my $i = 0;
1323         my @cmdlist = ();
1324         opendir(DIRHANDLE, "src");
1325         foreach $name (sort readdir(DIRHANDLE)) {
1326                 if ($name =~ /^cmd_(.+)\.cpp$/) {
1327                         $cmdlist[$i++] = $1;
1328                 }
1329         }
1330         closedir(DIRHANDLE);
1331
1332         my $cmdobjs = "";
1333         my $srcobjs = "";
1334         foreach my $cmd (@cmdlist) {
1335                 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1336                 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1337         }
1338
1339         open(FH,">src/Makefile") or die("Could not write src/Makefile");
1340         print FH <<EOM;
1341 # Insp Makefile :p
1342 #
1343 # (C) ChatSpike development team
1344 # Makefile by <Craig\@ChatSpike.net>
1345 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1346 #
1347
1348 CC = im a cheezeball
1349
1350 CXXFLAGS = -I../include \${FLAGS}
1351
1352 all: libIRCDaes.so libIRCDcull_list.so libIRCDuserprocess.so libIRCDsocketengine.so libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDio.so libIRCDmessage.so $cmdobjs libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so inspircd
1353
1354 inspircd: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h ../include/socket.h
1355         \$(CC) -I../include -Wl,--rpath -Wl,$config{LIBRARY_DIR} \$(FLAGS) -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDio.so libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDhash.so libIRCDsocket.so libIRCDsocketengine.so libIRCDuserprocess.so libIRCDcull_list.so libIRCDcommand_parse.so libIRCDaes.so
1356
1357 libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1358         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1359         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
1360
1361 libIRCDcommand_parse.so: command_parse.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1362         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1363         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1364
1365 libIRCDcull_list.so: cull_list.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/users.h ../include/channels.h
1366         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1367         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1368
1369 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1370         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1371         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1372
1373 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1374         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1375         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1376
1377 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1378         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1379         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1380
1381 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1382         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1383         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1384
1385 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
1386         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1387         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o
1388
1389 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
1390         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1391         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1392
1393 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
1394         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1395         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1396
1397 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
1398         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1399         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1400
1401 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1402         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1403         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1404
1405 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
1406         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1407         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDio.so inspircd_io.o
1408
1409 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
1410         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1411         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmessage.so message.o
1412
1413 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 $srcobjs
1414         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1415         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o $cmdobjs
1416
1417 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
1418         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1419         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdnsqueue.so dnsqueue.o
1420
1421 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
1422         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1423         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1424
1425 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
1426         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1427         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1428
1429 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
1430         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1431         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1432
1433 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
1434         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1435         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1436
1437 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1438         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1439         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1440
1441 libIRCDaes.so: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1442         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1443         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDaes.so aes.o
1444
1445 EOM
1446         foreach my $cmd (@cmdlist) {
1447                 print FH <<ITEM;
1448 cmd_$cmd.o: cmd_$cmd.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/cmd_$cmd.h
1449         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1450
1451 ITEM
1452         }
1453         close(FH);
1454 }