]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - configure
OpenSSL detection and cert generation in ./configure
[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$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 if ($config{OSNAME} =~ /CYGWIN/) {
665         print <<FOO;
666 \033[1;32mWARNING!\033[0m CYGWIN does not properly support shared modules,
667 so modules will be compiled statically into the core of the ircd. The modules
668 will act like they are being loaded from disk and being unloaded from RAM,
669 however they are in fact being enabled and disabled similar to features in
670 other ircds.
671 FOO
672 }
673
674 if ($config{GCCVER} < "3") {
675         print <<FOO2;
676 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
677 GCC 2.x series compilers only had partial (read as broken) C++ support, and
678 your compile will most likely fail horribly! If you have any problems, do NOT
679 report them to the bugtracker or forums without first upgrading your compiler
680 to a newer 3.x or 4.x (or whatever is available currently) version.
681 FOO2
682 }
683
684 ################################################################################
685 #                              HELPER FUNCTIONS                                #
686 ################################################################################
687 sub getcache {
688   # Retrieves the .config.cache file, and loads values into the main config hash.
689   open(CACHE, ".config.cache") or return undef;
690   while (<CACHE>) {
691     chomp;
692
693     # Ignore Blank lines, and comments..
694     next if /^\s*$/;
695     next if /^\s*#/;
696
697     my ($key, $value) = split("=", $_);
698     $value =~ /^\"(.*)\"$/;
699     # Do something with data here!
700     $config{$key} = $1;
701   }
702   close(CONFIG);
703   return "true";
704 }
705
706 sub makecache {
707   # Dump the contents of %config
708   print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
709   open(FILEHANDLE, ">.config.cache");
710   foreach $key (keys %config)
711   {
712     print FILEHANDLE "$key=\"$config{$key}\"\n";
713   }
714   close(FILEHANDLE);
715 }
716
717 sub dir_check {
718   my ($desc, $hash_key) = @_;
719   my $complete = 0;
720   while (!$complete) {
721     print "In what directory $desc?\n";
722     print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
723     chomp($var = <STDIN>);
724     if ($var eq "") { $var = $config{$hash_key}; }
725     if ($var =~ /^\~\/(.+)$/) {
726         # Convert it to a full path..
727         $var = resolve_directory($ENV{HOME} . "/" . $1);
728     }
729     if (substr($var,0,1) ne "/")
730     {
731         # Assume relative Path was given.. fill in the rest.
732         $var = $this . "/$var";
733     }
734     $var = resolve_directory($var); 
735     if (! -e $var) {
736       print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
737       chomp($tmp = <STDIN>);
738       if (($tmp eq "") || ($tmp =~ /^y/i)) {
739         # Attempt to Create the Dir..
740         $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
741         if ($chk != 0) {
742           print "Unable to create directory. ($var)\n\n";
743           # Restart Loop..
744           next;
745         }
746       } else {
747         # They said they don't want to create, and we can't install there.
748         print "\n\n";
749         next;
750       }
751     } else {
752       if (!is_dir($var)) {
753         # Target exists, but is not a directory.
754         print "File $var exists, but is not a directory.\n\n";
755         next;
756       }
757     }
758     # Either Dir Exists, or was created fine.
759     $config{$hash_key} = $var;
760     $complete = 1;
761     print "\n";
762   }
763 }
764
765 sub getosflags {
766   if ($config{OSNAME} =~ /BSD$/) {
767     $config{LDLIBS} = "-Ldl -lstdc++";
768     $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
769     $config{MAKEPROG} = "gmake";
770     if ($config{OSNAME} eq "OpenBSD") {
771         chomp($foo = `eg++ -dumpversion | cut -c 1`);
772         # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
773         # if theyre not running this, configure lets the build continue but they probably wont manage to
774         # compile as this standard version is 2.95.3!
775         if ($foo ne "") {
776                 $config{CC} = "eg++";
777                 chomp($config{GCCVER}       = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
778                 chomp($config{GCC34}        = `eg++ -dumpversion | cut -c 3`); # the compiler path
779         }
780     }
781   } else {
782     $config{LDLIBS} = "-ldl -lstdc++";
783     $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
784     $config{MAKEPROG} = "make";
785     if ($config{OSNAME} =~ /CYGWIN/) {
786        $config{FLAGS}  = "-frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
787        $config{LDLIBS} = "";
788        $config{MAKEPROG} = "/usr/bin/make";
789        $config{MAKEORDER} = "mods ircd config bininst";
790        $config{STATICLIBS} = "modules/mods.a";
791        $config{STATIC_LINK} = "yes";
792     }
793   }
794   if ($config{OSNAME} =~ /SunOS/) {
795     # solaris/sunos needs these
796     # socket = bsd sockets api
797     # nsl = dns stuff
798     # rt = POSIX realtime extensions
799     # resolv = inet_aton only (why isnt this in nsl?!)
800     $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
801   }
802 }
803
804 sub is_dir {
805   my ($path) = @_;
806   if (chdir($path)) {
807     chdir($this);
808     return 1;
809   } else {
810     # Just in case..
811     chdir($this);
812     return 0;
813   }
814 }
815
816 sub getmodules {
817   my $i = 0;
818   opendir(DIRHANDLE, "src/modules");
819   foreach $name (sort readdir(DIRHANDLE)) {
820     if ($name =~ /^m_(.+)\.cpp$/)
821     {
822       $mod = $1;
823       if ($mod !~ /_static$/) {
824               $modlist[$i++] = $mod;
825       }
826     }
827   }
828   closedir(DIRHANDLE);
829 }
830
831 sub writefiles {
832
833   print "Writing \033[1;32minspircd_config.h\033[0m\n";
834   # First File.. inspircd_config.h
835   chomp(my $incos = `uname -n -s -r`);
836   chomp(my $version = `sh ./src/version.sh`);
837   open(FILEHANDLE, ">include/inspircd_config.h");
838   my $NL = $config{NICK_LENGT}+1;
839   my $CL = $config{CHAN_LENGT}+1;
840   print FILEHANDLE <<EOF;
841 /* Auto generated by configure, do not modify! */
842 #ifndef __CONFIGURATION_AUTO__
843 #define __CONFIGURATION_AUTO__
844
845 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
846 #define MOD_PATH "$config{MODULE_DIR}"
847 #define VERSION "$version"
848 #define MAXCLIENTS $config{MAX_CLIENT}
849 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
850 #define NICKMAX $NL
851 #define CHANMAX $CL
852 #define MAXCHANS $config{MAX_CHANNE}
853 #define OPERMAXCHANS $config{MAX_OPERCH}
854 #define MAXMODES $config{MAXI_MODES}
855 #define IDENTMAX $config{MAX_IDENT}
856 #define MAXQUIT $config{MAX_QUIT}
857 #define MAXTOPIC $config{MAX_TOPIC}
858 #define MAXKICK $config{MAX_KICK}
859 #define MAXGECOS $config{MAX_GECOS}
860 #define MAXAWAY $config{MAX_AWAY}
861 #define OPTIMISATION $config{OPTIMITEMP}
862 #define SYSTEM "$incos"
863 #define MAXBUF 514
864 EOF
865
866   if ($config{OSNAME} =~ /SunOS/) {
867     print FILEHANDLE "#define IS_SOLARIS\n";
868   }
869   if ($config{OSNAME} =~ /CYGWIN/) {
870     print FILEHANDLE "#define IS_CYGWIN\n";
871     print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE    1024\n#endif\n";
872   }
873   if ($config{STATIC_LINK} eq "yes") {
874     print FILEHANDLE "#define STATIC_LINK\n";
875   }
876   if ($config{GCCVER} > 3) {
877     print FILEHANDLE "#define GCC3\n";
878     print FILEHANDLE "#define GCC34\n";
879   }
880   else
881   {
882     if ($config{GCCVER} == 3) {
883       print FILEHANDLE "#define GCC3\n";
884       if ($config{GCC34} > 3) {
885         print FILEHANDLE "#define GCC34\n";
886       }
887     }
888   }
889   if ($config{HAS_STRLCPY} eq "true") {
890     print FILEHANDLE "#define HAS_STRLCPY\n";
891   }
892   if ($config{THREADED_DNS} =~ /y/i) {
893     print FILEHANDLE "#define THREADED_DNS\n";
894   }
895   my $use_hiperf = 0;
896   if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
897     print FILEHANDLE "#define USE_KQUEUE\n";
898     $use_hiperf = 1;
899   }
900   if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
901     print FILEHANDLE "#define USE_EPOLL\n";
902     $use_hiperf = 1;
903   }
904   # user didn't choose either epoll or select for their OS.
905   # default them to USE_SELECT (ewwy puke puke)
906   if (!$use_hiperf) {
907     print FILEHANDLE "#define USE_SELECT\n";
908   }
909   print FILEHANDLE "\n#endif\n";
910   close(FILEHANDLE);
911
912   # Create a Modules List..
913   my $modules = "";
914   foreach $i (@modlist)
915   {
916     if ($config{OSNAME} =~ /CYGWIN/) {
917         $modules .= "m_".$i.".o ";
918     }
919     else {
920         $modules .= "m_".$i.".so ";
921     }
922   }
923   chomp($modules);   # Remove Redundant whitespace..
924
925
926   # Write all .in files.
927   my $tmp = "";
928   my $file = "";
929   my $exe = "inspircd";
930
931   if ($config{OSNAME} =~ /CYGWIN/) {
932     $exe = "inspircd.exe";
933   }
934
935   opendir(DIRHANDLE, $this);
936   if ($config{THREADED_DNS} =~ /y/i) {
937     $config{LDLIBS} = $config{LDLIBS} . " -pthread";
938   }
939   foreach $name (sort readdir(DIRHANDLE)) {
940     if ($name =~ /^\.(.+)\.inc$/)
941     {
942       $file = $1;
943       # All .name.inc files need parsing!
944       $tmp = "";
945       open(FILEHANDLE, ".$file.inc");
946       while (<FILEHANDLE>) {
947         $tmp .= $_;
948       }
949       close(FILEHANDLE);
950
951       $tmp =~ s/\@CC\@/$config{CC}/;
952       $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
953       $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
954       $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
955       $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
956       $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
957       $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
958       $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
959       $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
960       $tmp =~ s/\@MODULES\@/$modules/;
961       $tmp =~ s/\@EXECUTABLE\@/$exe/;
962       $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
963       $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
964
965       print "Writing \033[1;32m$file\033[0m\n";
966       open(FILEHANDLE, ">$file");
967       print FILEHANDLE $tmp;
968     }
969   }
970   closedir(DIRHANDLE);
971
972   # Make inspircd executable!
973   chmod 0744, 'inspircd';
974
975   if ($config{OSNAME} =~ /CYGWIN/) {
976         print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
977         write_static_makefile();
978         write_static_modules_makefile();
979   }
980   else {
981         print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
982         write_dynamic_makefile();
983         write_dynamic_modules_makefile();
984   }
985 }
986
987 sub getcompilerflags {
988   my ($file) = @_;
989   open(FLAGS, $file);
990   while (<FLAGS>) {
991     if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
992       close(FLAGS);
993       return $1;
994     }
995   }
996   close(FLAGS);
997   return undef;
998 }
999
1000 sub getlinkerflags {
1001   my ($file) = @_;
1002   open(FLAGS, $file);
1003   while (<FLAGS>) {
1004     if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
1005       close(FLAGS);
1006       return $1;
1007     }
1008   }
1009   close(FLAGS);
1010   return undef;
1011 }
1012
1013 sub show_splash {
1014   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";
1015   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";
1016   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";
1017   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";
1018   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";
1019   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";
1020   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";
1021   print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
1022 }
1023
1024 sub resolve_directory {
1025         use File::Spec;
1026         return File::Spec->rel2abs($_[0]);
1027 }
1028
1029 sub yesno {
1030         my ($flag,$prompt) = @_;
1031         print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
1032         chomp($tmp = <STDIN>);
1033         if ($tmp eq "") { $tmp = $config{$flag} }
1034
1035         if (($tmp eq "") || ($tmp =~ /^y/i)) {
1036                 $config{$flag} = "y";
1037         } else {
1038                 $config{$flag} = "n";
1039         }
1040         return;
1041 }
1042
1043 sub write_static_modules_makefile {
1044   # Modules Makefile..
1045   print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1046   open(FILEHANDLE, ">src/modules/Makefile");
1047
1048 ###
1049 # Module Makefile Header
1050 ###
1051   print FILEHANDLE <<EOF;
1052 # (C) ChatSpike development team
1053 # Makefile by <Craig\@ChatSpike.net>
1054 # Many Thanks to Andrew Church <achurch\@achurch.org>
1055 #    for assisting with making this work right.
1056 #
1057 # Automatically Generated by ./configure to add a modules
1058 # please run ./configure --update
1059
1060 all: \$(MODULES)
1061
1062 EOF
1063 ###
1064 # End Module Makefile Header
1065 ###
1066
1067 # Create a Modules List..
1068 my $modules = "";
1069 my $cmflags = "";
1070 my $liflags = "";
1071
1072 open(MODLIST,">include/modlist.h");
1073
1074 ###
1075 # Include File Header
1076 ###
1077 print MODLIST <<HEADER;
1078 // Generated automatically by configure. DO NOT EDIT!
1079
1080 #ifndef __SYMBOLS__H_CONFIGURED__
1081 #define __SYMBOLS__H_CONFIGURED__
1082
1083 HEADER
1084 ###
1085 # End Include File Header
1086 ###
1087
1088 # Place Module List into Include
1089 foreach $i (@modlist) {
1090         if ($i !~ /_static$/) {
1091                 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1092         }
1093 }
1094 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1095
1096 ###
1097 # Build Module Crap
1098 ###
1099 foreach $i (@modlist)
1100 {
1101         if ($i !~ /_static$/) {
1102                 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1103                 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1104
1105                 print FILEHANDLE <<EOCHEESE;
1106                 ###
1107                 # Write Entry to the MakeFile
1108                 ###
1109 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h
1110         \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
1111         mv m_$i\_static.o ../m_$i.o
1112
1113 EOCHEESE
1114                 ###
1115                 # End Write Entry to the MakeFile
1116                 ###
1117                 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1118                 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1119                 open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
1120                 while (chomp($a = <MODULE>)) { 
1121                         $a =~ s/init_module/$i\_init/g;
1122                         $a =~ s/Srv/$i\Srv/g;
1123                         print MUNGED "$a\n";
1124                 }
1125                 close(MODULE);
1126                 close(MUNGED);
1127                 print MODLIST <<EOENT;
1128 {"m_$i.so",\&$i\_init},
1129 EOENT
1130                 print "done\n";
1131         }
1132 }
1133 print MODLIST "{0}};\n\n#endif\n";
1134 close(MODLIST);
1135 }
1136
1137 sub write_dynamic_modules_makefile {
1138   # Modules Makefile..
1139   print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1140   open(FILEHANDLE, ">src/modules/Makefile");
1141
1142 ###
1143 # Module Makefile Header
1144 ###
1145   print FILEHANDLE <<EOF;
1146 # (C) ChatSpike development team
1147 # Makefile by <Craig\@ChatSpike.net>
1148 # Many Thanks to Andrew Church <achurch\@achurch.org>
1149 #    for assisting with making this work right.
1150 #
1151 # Automatically Generated by ./configure to add a modules
1152 # please run ./configure -update or ./configure -modupdate
1153
1154 all: \$(MODULES)
1155
1156 EOF
1157 ###
1158 # End Module Makefile Header
1159 ###
1160
1161 # Create a Modules List..
1162 my $modules = "";
1163 my $cmflags = "";
1164 my $liflags = "";
1165
1166 foreach $i (@modlist) {
1167         ###
1168         # Write Entry to the MakeFile
1169         ###
1170         $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1171         $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1172         print FILEHANDLE <<EOCHEESE;
1173 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
1174         \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1175         \$(CC) \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o
1176         \@-rm -f \$(MODPATH)/m_$i.so
1177         install -v -m 0700 m_$i.so \$(MODPATH)
1178
1179 EOCHEESE
1180         ###
1181         # End Write Entry to the MakeFile
1182         ###
1183 }
1184 }
1185
1186
1187 sub write_static_makefile {
1188         open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1189         my $i = 0;
1190         my @cmdlist = ();
1191         opendir(DIRHANDLE, "src");
1192         foreach $name (sort readdir(DIRHANDLE)) {
1193                 if ($name =~ /^cmd_(.+)\.cpp$/) {
1194                         $cmdlist[$i++] = $1;
1195                 }
1196         }
1197         closedir(DIRHANDLE);
1198         my $cmdobjs = "";
1199         my $srcobjs = "";
1200         foreach my $cmd (@cmdlist) {
1201                 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1202                 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1203         }
1204         print FH <<EOM;
1205 # Insp Makefile :p
1206 #
1207 # (C) ChatSpike development team
1208 # Makefile by <Craig\@ChatSpike.net>
1209 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1210 #
1211
1212 CC = im a cheezeball
1213
1214 CXXFLAGS = -I../include \${FLAGS}
1215
1216 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
1217
1218 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
1219         \$(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)
1220
1221 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
1222         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1223
1224 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
1225         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1226
1227 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1228         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1229
1230 socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1231         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1232
1233 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1234         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1235
1236 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1237         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1238
1239 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1240         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1241
1242 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
1243         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1244
1245 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
1246         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1247
1248 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
1249         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1250
1251 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
1252         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1253
1254 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1255         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1256
1257 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
1258         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1259
1260 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
1261         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1262
1263 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
1264         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1265
1266 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
1267         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1268
1269 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
1270         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1271
1272 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
1273         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1274
1275 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
1276         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1277
1278 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
1279         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1280
1281 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1282         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1283
1284 aes.o: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1285         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1286
1287 EOM
1288         foreach my $cmd (@cmdlist) {
1289                 print FH <<ITEM;
1290 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
1291         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1292 ITEM
1293         }
1294 close(FH);
1295 }
1296
1297 sub write_dynamic_makefile {
1298
1299         my $i = 0;
1300         my @cmdlist = ();
1301         opendir(DIRHANDLE, "src");
1302         foreach $name (sort readdir(DIRHANDLE)) {
1303                 if ($name =~ /^cmd_(.+)\.cpp$/) {
1304                         $cmdlist[$i++] = $1;
1305                 }
1306         }
1307         closedir(DIRHANDLE);
1308
1309         my $cmdobjs = "";
1310         my $srcobjs = "";
1311         foreach my $cmd (@cmdlist) {
1312                 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1313                 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1314         }
1315
1316         open(FH,">src/Makefile") or die("Could not write src/Makefile");
1317         print FH <<EOM;
1318 # Insp Makefile :p
1319 #
1320 # (C) ChatSpike development team
1321 # Makefile by <Craig\@ChatSpike.net>
1322 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1323 #
1324
1325 CC = im a cheezeball
1326
1327 CXXFLAGS = -I../include \${FLAGS}
1328
1329 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
1330
1331 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
1332         \$(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
1333
1334 libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1335         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1336         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
1337
1338 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
1339         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1340         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1341
1342 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
1343         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1344         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1345
1346 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1347         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1348         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1349
1350 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1351         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1352         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1353
1354 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1355         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1356         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1357
1358 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1359         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1360         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1361
1362 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
1363         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1364         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o
1365
1366 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
1367         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1368         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1369
1370 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
1371         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1372         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1373
1374 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
1375         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1376         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1377
1378 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1379         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1380         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1381
1382 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
1383         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1384         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDio.so inspircd_io.o
1385
1386 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
1387         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1388         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmessage.so message.o
1389
1390 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
1391         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1392         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o $cmdobjs
1393
1394 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
1395         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1396         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdnsqueue.so dnsqueue.o
1397
1398 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
1399         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1400         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1401
1402 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
1403         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1404         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1405
1406 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
1407         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1408         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1409
1410 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
1411         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1412         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1413
1414 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1415         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1416         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1417
1418 libIRCDaes.so: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1419         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1420         \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDaes.so aes.o
1421
1422 EOM
1423         foreach my $cmd (@cmdlist) {
1424                 print FH <<ITEM;
1425 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
1426         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1427
1428 ITEM
1429         }
1430         close(FH);
1431 }