]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - configure
Add support for solaris 10 IO Completion Ports, contributed by nenolod
[user/henk/code/inspircd.git] / configure
1 #!/usr/bin/perl
2
3 # InspIRCd Configuration Script
4 #
5 # Copyright 2002-2007 The ChatSpike Development Team
6 # <brain@chatspike.net>
7 # <Craig@chatspike.net>
8 #
9 # Licensed under GPL, please see the COPYING file
10 # for more information
11 #
12 # [14:21] Brain: <matrix impression> i know perl-fu!
13 #
14 # $Id$
15 #
16 ########################################
17
18
19 require 5.6.0;
20 use Socket;
21 use Cwd;
22 use Getopt::Long;
23
24 # Utility functions for our buildsystem
25 use make::utilities;
26 use make::configure;
27
28 GetOptions (
29         'enable-gnutls' => \$opt_use_gnutls,
30         'rebuild' => \$opt_rebuild,
31         'enable-openssl' => \$opt_use_openssl,
32         'disable-interactive' => \$opt_nointeractive,
33         'with-nick-length=i' => \$opt_nick_length,
34         'with-channel-length=i' => \$opt_chan_length,
35         'with-max-clients=i' => \$opt_maxclients,
36         'enable-ports' => \$opt_ports,
37         'enable-epoll' => \$opt_epoll,
38         'enable-kqueue' => \$opt_kqueue,
39         'disable-ports' => \$opt_noports,
40         'disable-epoll' => \$opt_noepoll,
41         'disable-kqueue' => \$opt_nokqueue,
42         'enable-ipv6' => \$opt_ipv6,
43         'enable-remote-ipv6' => \$opt_ipv6links,
44         'disable-remote-ipv6' => \$opt_noipv6links,
45         'with-cc=s' => \$opt_cc,
46         'with-ident-length=i' => \$opt_ident,
47         'with-quit-length=i' => \$opt_quit,
48         'with-topic-length=i' => \$opt_topic,
49         'with-kick-length=i' => \$opt_kick,
50         'with-gecos-length=i' => \$opt_gecos,
51         'with-away-length=i' => \$opt_away,
52         'with-max-modes=i' => \$opt_modes,
53         'prefix=s' => \$opt_base_dir,
54         'config-dir=s' => \$opt_config_dir,
55         'module-dir=s' => \$opt_module_dir,
56         'binary-dir=s' => \$opt_binary_dir,
57         'library-dir=s' => \$opt_library_dir,
58         'disable-debuginfo' => sub { $opt_disable_debug = 1 },
59         'help'  => sub { showhelp(); },
60         'modupdate' => sub { modupdate(); },
61         'update' => sub { update(); },
62         'svnupdate' => sub { svnupdate(); },
63         'clean' => sub { clean(); },
64 );
65
66 my $non_interactive = (
67         (defined $opt_library_dir) ||
68         (defined $opt_base_dir) ||
69         (defined $opt_config_dir) ||
70         (defined $opt_module_dir) ||
71         (defined $opt_base_dir) ||
72         (defined $opt_binary_dir) ||
73         (defined $opt_nointeractive) ||
74         (defined $opt_away) ||
75         (defined $opt_gecos) ||
76         (defined $opt_kick) ||
77         (defined $opt_maxclients) ||
78         (defined $opt_modes) ||
79         (defined $opt_topic) ||
80         (defined $opt_quit) ||
81         (defined $opt_ident) ||
82         (defined $opt_cc) ||
83         (defined $opt_ipv6) ||
84         (defined $opt_ipv6links) ||
85         (defined $opt_noipv6links) ||
86         (defined $opt_kqueue) ||
87         (defined $opt_epoll) ||
88         (defined $opt_ports) ||
89         (defined $opt_maxchans) ||
90         (defined $opt_opermaxchans) ||
91         (defined $opt_chan_length) ||
92         (defined $opt_nick_length) ||
93         (defined $opt_use_openssl) ||
94         (defined $opt_nokqueue) ||
95         (defined $opt_noepoll) ||
96         (defined $opt_noports) ||
97         (defined $opt_use_gnutls)
98 );
99 my $interactive = !$non_interactive;
100
101
102 chomp($topdir = getcwd());
103 $this = resolve_directory($topdir);                                             # PWD, Regardless.
104 @modlist = ();                                                          # Declare for Module List..
105 %config = ();                                                           # Initiate Configuration Hash..
106 $config{ME}              = resolve_directory($topdir);                  # Present Working Directory
107
108 $config{BASE_DIR}          = $config{ME};
109
110 if (defined $opt_base_dir)
111 {
112         $config{BASE_DIR} = $opt_base_dir;
113 }
114
115 $config{CONFIG_DIR}      = resolve_directory($config{BASE_DIR}."/conf");                # Configuration Directory
116 $config{MODULE_DIR}      = resolve_directory($config{BASE_DIR}."/modules");             # Modules Directory
117 $config{BINARY_DIR}      = resolve_directory($config{BASE_DIR}."/bin");         # Binary Directory
118 $config{LIBRARY_DIR}    = resolve_directory($config{BASE_DIR}."/lib");          # Library Directory
119
120 if (defined $opt_config_dir)
121 {
122         $config{CONFIG_DIR} = $opt_config_dir;
123 }
124 if (defined $opt_module_dir)
125 {
126         $config{MODULE_DIR} = $opt_module_dir;
127 }
128 if (defined $opt_binary_dir)
129 {
130         $config{BINARY_DIR} = $opt_binary_dir;
131 }
132 if (defined $opt_library_dir)
133 {
134         $config{LIBRARY_DIR} = $opt_library_dir;
135 }
136 chomp($config{HAS_GNUTLS}   = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
137 chomp($config{HAS_OPENSSL}  = `pkg-config --modversion openssl 2>/dev/null`);                   # Openssl version
138 chomp($gnutls_ver = $config{HAS_GNUTLS});
139 chomp($openssl_ver = $config{HAS_OPENSSL});
140 $config{USE_GNUTLS}         = "n";
141 if (defined $opt_use_gnutls)
142 {
143         $config{USE_GNUTLS} = "y";                                              # Use gnutls.
144 }
145 $config{USE_OPENSSL}    = "n";                                          # Use openssl.
146 if (defined $opt_use_openssl)
147 {
148         $config{USE_OPENSSL} = "y";
149 }
150
151 # no, let's not change these.
152 $config{OPTIMITEMP}      = "0";                                 # Default Optimisation Value
153 if (!defined $opt_disable_debug)
154 {
155         $config{OPTIMISATI}      = "-g1";                               # Optimisation Flag
156 }
157 else
158 {
159         $config{OPTIMISATI}      = "-O2";                                       # DEBUGGING OFF!
160 }
161
162 $config{NICK_LENGT}      = "31";                                        # Default Nick Length
163 if (defined $opt_nick_length)
164 {
165         $config{NICK_LENGT} = $opt_nick_length;
166 }
167 $config{CHAN_LENGT}      = "64";                                        # Default Channel Name Length
168 if (defined $opt_chan_length)
169 {
170         $config{CHAN_LENGT} = $opt_chan_length;
171 }
172 $config{MAXI_MODES}      = "20";                                        # Default Max. Number of Modes set at once.
173 if (defined $opt_modes)
174 {
175         $config{MAXI_MODES} = $opt_modes;
176 }
177 $config{HAS_STRLCPY}    = "false";                                      # strlcpy Check.
178 $config{HAS_STDINT}      = "false";                                             # stdint.h check
179 $config{USE_KQUEUE}      = "y";                                         # kqueue enabled
180 if (defined $opt_kqueue)
181 {
182         $config{USE_KQUEUE} = "y";
183 }
184 if (defined $opt_nokqueue)
185 {
186         $config{USE_KQUEUE} = "n";
187 }
188 $config{USE_EPOLL}        = "y";                                                # epoll enabled
189 if (defined $opt_epoll)
190 {
191         $config{USE_EPOLL} = "y";
192 }
193 if (defined $opt_noepoll)
194 {
195         $config{USE_EPOLL} = "n";
196 }
197 $config{USE_PORTS}        = "y";                                                # epoll enabled
198 if (defined $opt_ports)
199 {
200         $config{USE_PORTS} = "y";
201 }
202 if (defined $opt_noports)
203 {
204         $config{USE_PORTS} = "n";
205 }
206 $config{IPV6}          = "n";                                           # IPv6 support (experimental)
207 if (defined $opt_ipv6)
208 {
209         $config{IPV6} = "y";
210 }
211 $config{SUPPORT_IP6LINKS}   = "y";                                              # IPv4 supporting IPv6 links (experimental)
212 if (defined $opt_ipv6links)
213 {
214         $config{SUPPORT_IP6LINKS} = "y";
215 }
216 if (defined $opt_noipv6links)
217 {
218         $config{SUPPORT_IP6LINKS} = "n";
219 }
220 $config{STATIC_LINK}        = "no";                                             # are doing static modules?
221 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`);                   # FD Limit
222 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`);                        # Hard FD Limit
223 chomp($config{GCCVER}       = `g++ -dumpversion | cut -c 1`);                   # Major GCC Version
224 $config{_SOMAXCONN} = SOMAXCONN;                                                # Max connections in accept queue
225 $config{OSNAME}             = $^O;                                      # Operating System Name
226 $config{IS_DARWIN}          = "NO";                                             # Is OSX?
227 if ($config{OSNAME} =~ /darwin/i)
228 {
229         $config{IS_DARWIN} = "YES";
230 }
231 $config{CC}                 = "g++";                                            # C++ compiler
232 if (defined $opt_cc)
233 {
234         $config{CC} = $opt_cc;
235 }
236 $exec = $config{CC} . " -dumpversion | cut -c 1";
237 chomp($config{GCCVER}       = `$exec`);                                         # Major GCC Version
238 $config{MAKEORDER}          = "ircd mods";                                      # build order
239 $config{STATICLIBS}      = "";                                          # library archive path
240 $config{MAX_IDENT}        = "12";                                               # max ident size
241 $config{MAX_QUIT}          = "255";                                             # max quit message size
242 $config{MAX_TOPIC}        = "307";                                              # max topic size
243 $config{MAX_KICK}          = "255";                                             # max kick message size
244 $config{MAX_GECOS}        = "128";                                              # max GECOS size
245 $config{MAX_AWAY}          = "200";                                             # max AWAY size
246 if (defined $opt_ident)
247 {
248         $config{MAX_IDENT} = $opt_ident;
249 }
250 if (defined $opt_quit)
251 {
252         $config{MAX_QUIT} = $opt_quit;
253 }
254 if (defined $opt_topic)
255 {
256         $config{MAX_TOPIC} = $opt_topic;
257 }
258 if (defined $opt_kick)
259 {
260         $config{MAX_KICK} = $opt_kick;
261 }
262 if (defined $opt_gecos)
263 {
264         $config{MAX_GECOS} = $opt_gecos;
265 }
266 if (defined $opt_away)
267 {
268         $config{MAX_AWAY} = $opt_away;
269 }
270
271 $config{HAS_OPENSSL} =~ /^([-[:digit:].]+)([a-z])?(\-[a-z][0-9])?$/;
272 $config{HAS_OPENSSL} = $1;
273
274 if ($config{GCCVER} eq "") {
275         print $config{CC} . " was not found! You require g++ (the GNU C++ compiler, part of GCC) to build InspIRCd!\n";
276         exit;
277 }
278
279 # Minihack! Convert Cygwin to 'Cyg-Static' so i can
280 # Keep my dynamic module experiments here for later
281 # consideration!
282
283 if ($config{OSNAME} =~ /CYGWIN/i)
284 {
285         $config{OSNAME} = "CYG-STATIC";
286 }
287
288 if (!$config{MAX_CLIENT_T}) { 
289         $config{MAX_CLIENT_T} = 1024;                            # Set a reasonable 'Default'
290         $fd_scan_fail = "true";                                # Used Later
291 }
292
293 # Get and Set some important vars..
294 getmodules();
295
296 sub clean
297 {
298         system("rm -rf .config.cache");
299 }
300
301 sub update
302 {
303         eval {
304                 chomp($topdir = getcwd());
305                 $this = resolve_directory($topdir);                                          # PWD, Regardless.
306                 getmodules();
307                 # Does the cache file exist?
308                 if (!getcache()) {
309                         # No, No it doesn't.. *BASH*
310                         print "You have not run ./configure before. Please do this before trying to run the update script.\n";
311                         exit 0;
312                 } else {
313                         # We've Loaded the cache file and all our variables..
314                         print "Updating Files..\n";
315                         getosflags();
316                         if ($opt_disable_debug == 1)
317                         {
318                                 print "Disabling debug information (-g).\n";
319                                 $config{OPTIMISATI} = "";
320                                 getosflags();
321                         }
322                         $has_epoll = $config{HAS_EPOLL};
323                         $has_ports = $config{HAS_PORTS};
324                         $has_kqueue = $config{HAS_KQUEUE};
325                         writefiles(1);
326                         makecache();
327                         print "Complete.\n";
328                         exit;
329                 }
330         };
331         if ($@)
332         {
333                 print "Configure update failed: $@\n";
334         }
335         exit;
336 }
337
338 sub modupdate
339 {
340         eval {
341                 chomp($topdir = getcwd());
342                 $this = resolve_directory($topdir);                                          # PWD, Regardless.
343                 getmodules();
344                 # Does the cache file exist?
345                 if (!getcache()) {
346                         # No, No it doesn't.. *BASH*
347                         print "You have not run ./configure before. Please do this before trying to run the update script.\n";
348                         exit 0;
349                 } else {
350                         # We've Loaded the cache file and all our variables..
351                         print "Updating Files..\n";
352                         getosflags();
353                         $has_epoll = $config{HAS_EPOLL};
354                         $has_ports = $config{HAS_PORTS};
355                         $has_kqueue = $config{HAS_KQUEUE};
356                         writefiles(0);
357                         makecache();
358                         print "Complete.\n";
359                         exit;
360                 }
361         };
362         if ($@)
363         {
364                 print "Module update failed: $@\n";
365         }
366         exit;
367 }
368
369
370
371 sub svnupdate
372 {
373         my $fail = 0;
374         open(FH,"<.svn/entries") or $fail = 1;
375         if ($fail) {
376                 print "This is not an SVN copy of InspIRCd.\n";
377                 exit;
378         }
379         else
380         {
381                 close(FH);
382         }
383         system("svn update");
384         system("perl configure -update");
385         if (defined $opt_rebuild) {
386                 system("make install");
387         }
388         exit;
389 }
390
391 print "Running non-interactive configure...\n" unless $interactive;
392 print "Checking for cache from previous configure... ";
393 print ((getcache() eq "true") ? "found\n" : "not found\n");
394 print "Checking operating system version... ";
395 print getosflags() . "\n";
396
397 if (defined $opt_maxclients)
398 {
399         $config{MAX_CLIENT} = $opt_maxclients;
400 }
401
402 if (!$config{MAX_CLIENT}) { 
403         # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
404         # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
405         # higher than the found value" :))
406         $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
407 }
408
409 printf "Checking if stdint.h exists... ";
410 $config{HAS_STDINT} = "true";
411 my $fail = 0;
412 open(STDINT, "</usr/include/stdint.h") or $config{HAS_STDINT} = "false";
413 if ($config{HAS_STDINT} eq "true") {
414         close(STDINT);
415 }
416 print "yes\n" if $config{HAS_STDINT} eq "true";
417 print "no\n" if $config{HAS_STDINT} eq "false";
418
419
420 printf "Checking if strlcpy exists... ";
421 # Perform the strlcpy() test..
422 $config{HAS_STRLCPY} = "false";
423 my $fail = 0;
424 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
425 if (!$fail) {
426         while (chomp($line = <STRLCPY>)) {
427                 # try and find the delcaration of:
428                 # size_t strlcpy(...)
429                 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
430                         $config{HAS_STRLCPY} = "true";
431                 }
432         }
433         close(STRLCPY);
434 }
435 print "yes\n" if $config{HAS_STRLCPY} eq "true";
436 print "no\n" if $config{HAS_STRLCPY} eq "false";
437
438
439 printf "Checking if kqueue exists... ";
440 $has_kqueue = 0;
441 $fail = 0;
442 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
443 if (!$fail) {
444         while (chomp($line = <KQUEUE>)) {
445                 # try and find the delcaration of:
446                 # int kqueue(void);
447                 if ($line =~ /int(\0x9|\s)+kqueue/) {
448                         $has_kqueue = 1;
449                 }
450         }
451         close(KQUEUE);
452 }
453 print "yes\n" if $has_kqueue == 1;
454 print "no\n" if $has_kqueue == 0;
455
456 printf "Checking if epoll exists... ";
457 $has_epoll = 0;
458 $fail = 0;
459 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
460 if (!$fail) {
461         $has_epoll = 1;
462         close(EPOLL);
463 }
464 if ($has_epoll) {
465         my $kernel = `uname -r`;
466         chomp($kernel);
467         if (($kernel =~ /^2\.0\./) || ($kernel =~ /^2\.2\./) || ($kernel =~ /^2\.4\./)) {
468                 $has_epoll = 0;
469         }
470 }
471 print "yes\n" if $has_epoll == 1;
472 print "no\n" if $has_epoll == 0;
473
474 printf "Checking if Solaris I/O completion ports are available... ";
475 $has_ports = 0;
476 my $system = `uname -s`;
477 chomp ($system);
478 $has_ports = 1 if ($system eq "SunOS");
479
480 if ($has_ports) {
481         my $kernel = `uname -r`;
482         chomp($kernel);
483         if (($kernel !~ /^5\.10/)) {
484                 $has_ports = 0;
485         }
486 }
487 print "yes\n" if $has_ports == 1;
488 print "no\n" if $has_ports == 0;
489
490 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
491         $config{HAS_STRLCPY} = "true";
492 }
493
494 $config{HAS_EPOLL} = $has_epoll;
495 $config{HAS_KQUEUE} = $has_kqueue; 
496
497 printf "Checking for libgnutls... ";
498 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
499         print "yes\n";
500         $config{HAS_GNUTLS} = "y";
501 } else {
502         print "no\n";
503         $config{HAS_GNUTLS} = "n";
504 }
505
506 printf "Checking for openssl... ";
507 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
508         print "yes\n";
509         $config{HAS_OPENSSL} = "y";
510 } else {
511         print "no\n";
512         $config{HAS_OPENSSL} = "n";
513 }
514
515 ################################################################################
516 #                         BEGIN INTERACTIVE PART                              #
517 ################################################################################
518
519 # Clear the Screen..
520 if ($interactive)
521 {
522         system("clear");
523         $wholeos = $^O;
524
525         my $rev = getrevision();
526         # Display Introduction Message..
527         print "
528 Welcome to the \033[1mInspIRCd\033[0m Configuration program! (\033[1minteractive mode\033[0m)
529 \033[1mPackage maintainers: Type ./configure --help for non-interactive help\033[0m
530
531 *** If you are unsure of any of these values, leave it blank for    ***
532 *** standard settings that will work, and your server will run      ***
533 *** using them. Please consult your IRC network admin if in doubt.  ***
534
535 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
536 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
537 dir, otherwise you won't have a config file!
538
539 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos)
540 Maximum file descriptors: \033[1;32m$config{MAX_CLIENT_T}\033[0m
541 Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
542         if ($rev eq "r0") {
543                 print " (Non-SVN build)";
544         }
545         print ".\n\n";
546
547         $config{CHANGE_COMPILER} = "n";
548         print "I have detected the following compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
549
550         while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
551                 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
552 should NOT be used. You should probably specify a newer compiler.\n\n";
553                 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
554                 if ($config{CHANGE_COMPILER} =~ /y/i) {
555                         print "What command do you want to use to invoke your compiler?\n";
556                         print "[\033[1;32m$config{CC}\033[0m] -> ";
557                         chomp($config{CC} = <STDIN>);
558                         if ($config{CC} eq "") {
559                                 $config{CC} = "g++";
560                         }
561                         chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
562                         if ($foo ne "") {
563                                 chomp($config{GCCVER}       = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change compilers
564                                 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
565                                 if ($config{GCCVER} < 3) {
566                                         print "\033[1;32mGCC 2.x WILL NOT WORK!\033[0m. Let's try that again, shall we?\n";
567                                 }
568                         }
569                         else {
570                                 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
571                         }
572                 }
573         }
574
575         print "\n";
576
577         # Directory Settings..
578         my $tmpbase = $config{BASE_DIR};
579         dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
580         if ($tmpbase ne $config{BASE_DIR}) {
581                 $config{CONFIG_DIR}      = resolve_directory($config{BASE_DIR}."/conf");           # Configuration Dir
582                 $config{MODULE_DIR}      = resolve_directory($config{BASE_DIR}."/modules");     # Modules Directory
583                 $config{BINARY_DIR}      = resolve_directory($config{BASE_DIR}."/bin");     # Binary Directory
584                 $config{LIBRARY_DIR}    = resolve_directory($config{BASE_DIR}."/lib");      # Library Directory
585         }
586
587         dir_check("are the configuration files", "CONFIG_DIR");
588         dir_check("are the modules to be compiled to", "MODULE_DIR");
589         dir_check("is the IRCd binary to be placed", "BINARY_DIR");
590         dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
591
592         if ($has_kqueue) {
593                 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?");
594                 print "\n";
595         }
596         if ($has_epoll) {
597                 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?");
598                 print "\n";
599         }
600         if ($has_ports) {
601                 yesno(USE_PORTS,"You are running Solaris 10.\nWould you like to enable I/O completion ports support?\nThis is likely to increase performance.\nIf you are unsure, answer yes.\n\nEnable support for I/O completion ports?");
602                 print "\n";
603         }
604         $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y") || ($config{USE_PORTS} eq "y"));
605         if (!$chose_hiperf) {
606                 print "No high-performance socket engines are available, or you chose\n";
607                 print "not to enable one. Defaulting to select() engine.\n\n";
608         }
609
610         yesno(IPV6,"Would you like to build InspIRCd with IPv6 support?");
611         print "\n";
612
613         if ($config{IPV6} eq "y") {
614                 print "You have chosen to build an \033[1;32mIPV6-enabled\033[0m server.\nTo accept IPV4 users, you can still use IPV4 addresses\nin your port bindings..\n\n";
615                 $config{SUPPORT_IP6LINKS} = "y";
616         } else {
617                 yesno(SUPPORT_IP6LINKS,"You have chosen to build an \033[1;32mIPV4-only\033[0m server.\nWould you like to enable support for linking to IPV6-enabled\nInspIRCd servers?\nIf you are using a recent operating\nsystem and are unsure, answer yes.\nIf you answer 'no' here, your InspIRCd server will be unable\nto parse IPV6 addresses (e.g. for CIDR bans)");
618                 print "\n";
619         }
620
621         if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
622                 print "I have detected both \033[1;32mGnuTLS\033[0m and \033[1;32mOpenSSL\033[0m on your system.\n";
623                 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
624                 print "instead, you should enable the OpenSSL module yourself\n";
625                 print "by copying it from src/modules/extra to src/modules.\n\n";
626                 print "Detected GnuTLS version: \033[1;32m" . $gnutls_ver . "\033[0m\n";
627                 print "Detected OpenSSL version: \033[1;32m" . $openssl_ver . "\033[0m\n\n";
628         }
629
630         if ($config{HAS_GNUTLS} eq "y") {
631                 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
632                 if ($config{USE_GNUTLS} eq "y") {
633                         print "\nUsing GnuTLS SSL module.\n";
634                 }
635         } elsif ($config{HAS_OPENSSL} eq "y") {
636                         yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
637         if ($config{USE_OPENSSL} eq "y") {
638                         print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
639                 }
640         }
641         else {
642                 print "\nCould not detect OpenSSL or GnuTLS. Make sure pkg-config is installed if\nyou intend to use OpenSSL, or that GnuTLS is in your path if you intend\nto use GnuTLS.\n\n";
643         }
644
645         print "\nThe following questions will ask you for various figures relating\n";
646         print "To your IRCd install. Please note that these should usually be left\n";
647         print "as defaults unless you have a real reason to change them. If they\n";
648         print "changed, then the values must be identical on all servers on your\n";
649         print "network, or malfunctions and/or crashes may occur, with the exception\n";
650         print "of the 'maximum number of clients' setting which may be different on\n";
651         print "different servers on the network.\n\n";
652
653         # File Descriptor Settings..
654         promptnumeric("number of clients at any one time", "MAX_CLIENT_T");
655         $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
656         $config{MAX_DESCRIPTORS} = $config{MAX_CLIENT_T};
657
658         promptnumeric("length of nicknames", "NICK_LENGT");
659         promptnumeric("length of channel names", "CHAN_LENGT");
660         promptnumeric("number of mode changes in one line", "MAXI_MODES");
661         promptnumeric("length of an ident (username)", "MAX_IDENT");
662         promptnumeric("length of a quit message", "MAX_QUIT");
663         promptnumeric("length of a channel topic", "MAX_TOPIC");
664         promptnumeric("length of a kick message", "MAX_KICK");
665         promptnumeric("length of a GECOS (real name)", "MAX_GECOS");
666         promptnumeric("length of an away message", "MAX_AWAY");
667 }
668
669 dumphash();
670
671 if (($config{USE_GNUTLS} eq "y") && ($config{HAS_GNUTLS} ne "y"))
672 {
673         print "Sorry, but i couldn't detect gnutls. Make sure gnutls-config is in your path.\n";
674         exit(0);
675 }
676 if (($config{USE_OPENSSL} eq "y") && ($config{HAS_OPENSSL} ne "y"))
677 {
678         print "Sorry, but i couldn't detect openssl. Make sure openssl is in your path.\n";
679         exit(0);
680 }
681
682 if ($config{USE_GNUTLS} eq "y") {
683         $failed = 0;
684         open(TMP, "<src/modules/m_ssl_gnutls.cpp") or $failed = 1;
685         close(TMP);
686         if ($failed) {
687                 print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
688                 chdir("src/modules");
689                 system("ln -s extra/m_ssl_gnutls.cpp");
690                 chdir("../..");
691         }
692         getmodules();
693         if ($interactive)
694         {
695                 $failed = 0;
696                 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
697                 close(TMP);
698                 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
699                 close(TMP);
700                 if ($failed) {
701                         print "SSL Certificates Not found, Generating.. \n\n
702 *************************************************************
703 * Generating the Private Key may take some time, go grab a  *
704 * Coffee. Even better, to generate some more entropy if it  *
705 * is taking a while, open another console and type du / a   *
706 * few times and get that HD going :) Then answer the    *
707 * Questions which follow. If you are unsure, just hit enter *
708 *************************************************************\n\n";
709                         system("certtool --generate-privkey --outfile key.pem");
710                         system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
711                         print "\nCertificate generation complete, copying to config directory... ";
712                         system("mv key.pem $config{CONFIG_DIR}/key.pem");
713                         system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
714                         print "Done.\n\n";
715                 } else {
716                         print "SSL Certificates found, skipping.\n\n"
717                 }
718         }
719         else
720         {
721                 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
722         }
723 } elsif ($config{USE_OPENSSL} eq "y") {
724         $failed = 0;
725         open(TMP, "<src/modules/m_ssl_openssl.cpp") or $failed = 1;
726         close(TMP);
727         if ($failed) {
728                 print "Symlinking src/modules/m_ssl_openssl.cpp from extra/\n";
729                 chdir("src/modules");
730                 system("ln -s extra/m_ssl_openssl.cpp");
731                 chdir("../..");
732         }
733         getmodules();
734         $failed = 0;
735         if ($interactive)
736         {
737                 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
738                 close(TMP);
739                 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
740                 close(TMP);
741                 if ($failed) {
742                         print "SSL Certificates Not found, Generating.. \n\n
743 *************************************************************
744 * Generating the certificates may take some time, go grab a *
745 * coffee, or something.                              *
746 *************************************************************\n\n";
747                         system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
748                         system("openssl dhparam -out dhparams.pem 1024");
749                         print "\nCertificate generation complete, copying to config directory... ";
750                         system("mv key.pem $config{CONFIG_DIR}/key.pem");
751                         system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
752                         system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
753                         print "Done.\n\n";
754                 } else {
755                         print "SSL Certificates found, skipping.\n\n"
756                 }
757         }
758         else
759         {
760                 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
761         }
762 }
763 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
764         print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
765 }
766
767 getosflags();
768 writefiles(1);
769 makecache();
770
771 print "\n\n";
772 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
773 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
774         print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
775         print "load the required modules in your config. This configure process\n";
776         print "has just prepared these modules to be compiled for you, and has not\n";
777         print "configured them to be compiled into the core of the ircd.\n";
778 }
779 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
780 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
781         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";
782 }
783
784 if ($config{GCCVER} < "3") {
785         print <<FOO2;
786 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
787 GCC 2.x series compilers only had partial (read as broken) C++ support, and
788 your compile will most likely fail horribly! If you have any problems, do NOT
789 report them to the bugtracker or forums without first upgrading your compiler
790 to a newer 3.x or 4.x (or whatever is available currently) version.
791 FOO2
792 }
793
794 ################################################################################
795 #                             HELPER FUNCTIONS                          #
796 ################################################################################
797 sub getcache {
798         # Retrieves the .config.cache file, and loads values into the main config hash.
799         open(CACHE, ".config.cache") or return undef;
800         while (<CACHE>) {
801                 chomp;
802                 # Ignore Blank lines, and comments..
803                 next if /^\s*$/;
804                 next if /^\s*#/;
805                 my ($key, $value) = split("=", $_, 2);
806                 $value =~ /^\"(.*)\"$/;
807                 # Do something with data here!
808                 $config{$key} = $1;
809         }
810         close(CONFIG);
811         return "true";
812 }
813
814 sub makecache {
815         # Dump the contents of %config
816         print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
817         open(FILEHANDLE, ">.config.cache");
818         foreach $key (keys %config) {
819                 print FILEHANDLE "$key=\"$config{$key}\"\n";
820         }
821         close(FILEHANDLE);
822 }
823
824 sub dir_check {
825         my ($desc, $hash_key) = @_;
826         my $complete = 0;
827         while (!$complete) {
828                 print "In what directory $desc?\n";
829                 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
830                 chomp($var = <STDIN>);
831                 if ($var eq "") {
832                         $var = $config{$hash_key};
833                 }
834                 if ($var =~ /^\~\/(.+)$/) {
835                         # Convert it to a full path..
836                         $var = resolve_directory($ENV{HOME} . "/" . $1);
837                 }
838                 elsif ((($config{OSNAME} =~ /MINGW32/i) and ($var !~ /^[A-Z]{1}:\\.*/)) and (substr($var,0,1) ne "/"))
839                 {
840                         # Assume relative Path was given.. fill in the rest.
841                         $var = $this . "/$var";
842                 }
843                 
844                 $var = resolve_directory($var); 
845                 if (! -e $var) {
846                         print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
847                         chomp($tmp = <STDIN>);
848                         if (($tmp eq "") || ($tmp =~ /^y/i)) {
849                                 # Attempt to Create the Dir..
850                                 
851                                 system("mkdir -p \"$var\" >> /dev/null 2>&1");
852                                 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
853                                 if ($chk != 0) {
854                                         print "Unable to create directory. ($var)\n\n";
855                                         # Restart Loop..
856                                         next;
857                                 }
858                         } else {
859                                 # They said they don't want to create, and we can't install there.
860                                 print "\n\n";
861                                 next;
862                         }
863                 } else {
864                         if (!is_dir($var)) {
865                                 # Target exists, but is not a directory.
866                                 print "File $var exists, but is not a directory.\n\n";
867                                 next;
868                         }
869                 }
870                 # Either Dir Exists, or was created fine.
871                 $config{$hash_key} = $var;
872                 $complete = 1;
873                 print "\n";
874         }
875 }
876
877 sub getosflags {
878
879         $config{LDLIBS} = "-lstdc++";
880         $config{FLAGS}  = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
881         $config{DEVELOPER} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -g";
882         $SHARED = "-Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared";
883         $config{MAKEPROG} = "make";
884
885         if ($config{OSNAME} =~ /darwin/i) {
886                 $config{FLAGS}  = "-DDARWIN -frtti -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
887                 $SHARED = "-bundle -twolevel_namespace -undefined dynamic_lookup";
888                 $config{LDLIBS} = "-ldl -lstdc++";
889         }
890
891         if ($config{OSNAME} =~ /OpenBSD/i) {
892                 $config{MAKEPROG} = "gmake";
893                 chomp($foo = `eg++ -dumpversion | cut -c 1`);
894                 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
895                 # if theyre not running this, configure lets the build continue but they probably wont manage to
896                 # compile as this standard version is 2.95.3!
897                 if ($foo ne "") {
898                         $config{CC} = "eg++";
899                         chomp($config{GCCVER}       = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
900                 }
901                 return "OpenBSD";
902         }
903
904         if ($config{OSNAME} =~ /Linux/i) {
905                 $config{LDLIBS} = "-ldl -lstdc++";
906                 $config{FLAGS}  = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
907                 $config{FLAGS}  .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
908                 $config{MAKEPROG} = "make";
909                 if ($config{OSNAME} =~ /CYGWIN/) {
910                         $config{FLAGS}  = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
911                         $config{LDLIBS} = "";
912                         $config{MAKEPROG} = "/usr/bin/make";
913                         $config{MAKEORDER} = "ircd mods";
914                         return "Cygwin";
915                 } elsif ($config{OSNAME} eq "CYG-STATIC") {
916                         $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
917                         $config{LDLIBS} = "";
918                         $config{MAKEPROG} = "/usr/bin/make";
919                         $config{MAKEORDER} = "mods ircd";
920                         $config{STATICLIBS} = "modules/mods.a";
921                         $config{STATIC_LINK} = "yes";
922                         return "Cygwin-Static";
923                 }
924                 $config{FLAGS}  .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
925         }
926         
927         if ($config{OSNAME} =~ /SunOS/i)
928         {
929                 # solaris/sunos needs these
930                 # socket = bsd sockets api
931                 # nsl = dns stuff
932                 # rt = POSIX realtime extensions
933                 # resolv = inet_aton only (why isnt this in nsl?!)
934                 $config{MAKEPROG} = "gmake";
935                 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
936                 return "Solaris";
937         }
938         
939         if($config{OSNAME} =~ /MINGW32/i)
940         {
941                 # All code is position-independent on windows
942                 $config{FLAGS} =~ s/-fPIC //;
943                 return "MinGW";
944         }
945
946         return $config{OSNAME};
947 }
948
949 sub writefiles {
950         my($writeheader) = @_;
951         # First File.. inspircd_config.h
952         chomp(my $incos = `uname -n -s -r`);
953         chomp($version = `sh src/version.sh`);
954         chomp(my $revision2 = getrevision());
955         if ($writeheader == 1)
956         {
957                 print "Writing \033[1;32minspircd_config.h\033[0m\n";
958                 open(FILEHANDLE, ">include/inspircd_config.h");
959                 my $NL = $config{NICK_LENGT}+1;
960                 my $CL = $config{CHAN_LENGT}+1;
961                 print FILEHANDLE <<EOF;
962 /* Auto generated by configure, do not modify! */
963 #ifndef __CONFIGURATION_AUTO__
964 #define __CONFIGURATION_AUTO__
965
966 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
967 #define MOD_PATH "$config{MODULE_DIR}"
968 #define VERSION "$version"
969 #define REVISION "$revision2"
970 #define MAXCLIENTS $config{MAX_CLIENT}
971 #define MAXCLIENTS_S "$config{MAX_CLIENT}"
972 #define SOMAXCONN_S "$config{_SOMAXCONN}"
973 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
974 #define NICKMAX $NL
975 #define CHANMAX $CL
976 #define MAXMODES $config{MAXI_MODES}
977 #define IDENTMAX $config{MAX_IDENT}
978 #define MAXQUIT $config{MAX_QUIT}
979 #define MAXTOPIC $config{MAX_TOPIC}
980 #define MAXKICK $config{MAX_KICK}
981 #define MAXGECOS $config{MAX_GECOS}
982 #define MAXAWAY $config{MAX_AWAY}
983 #define OPTIMISATION $config{OPTIMITEMP}
984 #define LIBRARYDIR "$config{LIBRARY_DIR}"
985 #define SYSTEM "$incos"
986 #define MAXBUF 514
987 EOF
988                 if ($config{OSNAME} =~ /SunOS/i) {
989                         print FILEHANDLE "#define IS_SOLARIS\n";
990                 }
991                 if ($config{OSNAME} =~ /CYGWIN/i) {
992                         print FILEHANDLE "#define IS_CYGWIN\n";
993                         print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE        1024\n#endif\n";
994                 }
995                 if ($config{OSNAME} =~ /MINGW32/i) {
996                         print FILEHANDLE "#define IS_MINGW\n";
997                 }
998                 if ($config{OSNAME} =~ /CYG-STATIC/i) {
999                         print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE    1024\n#endif\n";
1000                 }
1001                 if ($config{STATIC_LINK} eq "yes") {
1002                         print FILEHANDLE "#define STATIC_LINK\n";
1003                 }
1004                 if ($config{GCCVER} >= 3) {
1005                         print FILEHANDLE "#define GCC3\n";
1006                 }
1007                 if ($config{HAS_STRLCPY} eq "true") {
1008                         print FILEHANDLE "#define HAS_STRLCPY\n";
1009                 }
1010                 if ($config{HAS_STDINT} eq "true") {
1011                         print FILEHANDLE "#define HAS_STDINT\n";
1012                 }
1013                 if ($config{IPV6} =~ /y/i) {
1014                         print FILEHANDLE "#define IPV6\n";
1015                 }
1016                 if ($config{SUPPORT_IP6LINKS} =~ /y/i) {
1017                         print FILEHANDLE "#define SUPPORT_IP6LINKS\n";
1018                 }
1019                 my $use_hiperf = 0;
1020                 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1021                         print FILEHANDLE "#define USE_KQUEUE\n";
1022                         $se = "socketengine_kqueue";
1023                         $use_hiperf = 1;
1024                 }
1025                 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1026                         print FILEHANDLE "#define USE_EPOLL\n";
1027                         $se = "socketengine_epoll";
1028                         $use_hiperf = 1;
1029                 }
1030                 if (($has_ports) && ($config{USE_PORTS} eq "y")) {
1031                         print FILEHANDLE "#define USE_PORTS\n";
1032                         $se = "socketengine_ports";
1033                         $use_hiperf = 1;
1034                 }
1035                 # user didn't choose either epoll or select for their OS.
1036                 # default them to USE_SELECT (ewwy puke puke)
1037                 if (!$use_hiperf) {
1038                         print FILEHANDLE "#define USE_SELECT\n";
1039                         $se = "socketengine_select";
1040                 }
1041                 print FILEHANDLE "\n#endif\n";
1042                 close(FILEHANDLE);
1043         }
1044
1045         if ($writeheader)
1046         {
1047                 open(FILEHANDLE, ">include/inspircd_se_config.h");
1048                 print FILEHANDLE <<EOF;
1049 /* Auto generated by configure, do not modify or commit to svn! */
1050 #ifndef __CONFIGURATION_SOCKETENGINE__
1051 #define __CONFIGURATION_SOCKETENGINE__
1052
1053 #include "$se.h"
1054
1055 #endif
1056 EOF
1057                 close(FILEHANDLE);
1058         }
1059
1060
1061         # Create a Modules List..
1062         my $modules = "";
1063         foreach $i (@modlist)
1064         {
1065                 if ($config{STATIC_LINK} eq "yes") {
1066                         $modules .= "m_".$i.".o ";
1067                 }
1068                 else {
1069                         $modules .= "m_".$i.".so ";
1070                 }
1071         }
1072         chomp($modules);   # Remove Redundant whitespace..
1073
1074         opendir(DIRHANDLE, "src/modules");
1075         foreach $name (sort readdir(DIRHANDLE)) {
1076                 if ($name =~ /^m_(.+?)$/) {
1077                         if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1078                                 closedir(MDIRHANDLE);
1079                                 $modules .= "$name.so ";
1080                         }
1081                 }
1082         }
1083         closedir(DIRHANDLE);
1084
1085
1086         # Write all .in files.
1087         my $tmp = "";
1088         my $file = "";
1089         my $exe = "inspircd";
1090
1091         if ($config{OSNAME} =~ /CYGWIN/i) {
1092                 $exe = "inspircd.exe";
1093         }
1094
1095         opendir(DIRHANDLE, $this);
1096
1097         # Do this once here, and cache it in the .*.inc files,
1098         # rather than attempting to read src/version.sh from
1099         # compiled code -- we might not have the source to hand.
1100         # Fix for bug#177 by Brain.
1101
1102         chomp(my $version = `sh ./src/version.sh`);
1103         chomp(my $revision = getrevision());
1104         $version = "$version(r$revision)";
1105
1106         my $LIBEXT = "so";
1107         if ($config{IS_DARWIN} eq "YES")
1108         {
1109                 $LIBEXT = "dylib";
1110         }
1111         # We can actually parse any file starting with . and ending with .inc,
1112         # but right now we only parse .inspircd.inc to form './inspircd'
1113
1114         foreach $name (sort readdir(DIRHANDLE)) {
1115                 if ($name =~ /^\.(.+)\.inc$/) {
1116                         $file = $1;
1117                         # All .name.inc files need parsing!
1118                         $tmp = "";
1119                         open(FILEHANDLE, ".$file.inc");
1120                         while (<FILEHANDLE>) {
1121                                 $tmp .= $_;
1122                         }
1123                         close(FILEHANDLE);
1124
1125                         $tmp =~ s/\@CC\@/$config{CC}/;
1126                         $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1127                         $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1128                         $tmp =~ s/\@DEVELOPER\@/$config{DEVELOPER}/;
1129                         $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1130                         $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1131                         $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1132                         $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1133                         $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1134                         $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1135                         $tmp =~ s/\@LIBRARY_EXT\@/$LIBEXT/;
1136                         $tmp =~ s/\@MODULES\@/$modules/;
1137                         $tmp =~ s/\@EXECUTABLE\@/$exe/;
1138                         $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1139                         $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1140                         $tmp =~ s/\@VERSION\@/$version/;
1141
1142                         print "Writing \033[1;32m$file\033[0m\n";
1143                         open(FILEHANDLE, ">$file");
1144                         print FILEHANDLE $tmp;
1145                 }
1146         }
1147         closedir(DIRHANDLE);
1148
1149         # Make inspircd executable!
1150         chmod 0744, 'inspircd';
1151
1152         if ($config{STATIC_LINK} eq "yes") {
1153                 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1154                 write_static_makefile();
1155                 write_static_modules_makefile();
1156         } elsif ($config{OSNAME} =~ /CYGWIN/i) {
1157                 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1158                 write_static_makefile();
1159                 write_dynamic_modules_makefile();
1160         } else {
1161                 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1162                 write_dynamic_makefile();
1163                 write_dynamic_modules_makefile();
1164         }
1165 }
1166
1167 sub write_static_modules_makefile {
1168         # Modules Makefile..
1169         print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1170         open(FILEHANDLE, ">src/modules/Makefile");
1171
1172         ###
1173         # Module Makefile Header
1174         ###
1175         print FILEHANDLE <<EOF;
1176 # (C) ChatSpike development team
1177 # Makefile by <Craig\@ChatSpike.net>
1178 # Many Thanks to Andrew Church <achurch\@achurch.org>
1179 #    for assisting with making this work right.
1180 #
1181 # Automatically Generated by ./configure to add a modules
1182 # please run ./configure --update
1183
1184 all: \$(MODULES)
1185
1186 EOF
1187         ###
1188         # End Module Makefile Header
1189         ###
1190
1191         # Create a Modules List..
1192         my $modules = "";
1193         my $cmflags = "";
1194         my $liflags = "";
1195
1196         open(MODLIST,">include/modlist.h");
1197
1198         ###
1199         # Include File Header
1200         ###
1201         print MODLIST <<HEADER;
1202 // Generated automatically by configure. DO NOT EDIT!
1203
1204 #ifndef __SYMBOLS__H_CONFIGURED__
1205 #define __SYMBOLS__H_CONFIGURED__
1206
1207 HEADER
1208         ###
1209         # End Include File Header
1210         ###
1211
1212         # Place Module List into Include
1213         foreach $i (@modlist) {
1214                 if ($i !~ /_static$/) {
1215                         print MODLIST "extern \"C\" void * $i\_init (void);\n";
1216                 }
1217         }
1218         print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1219
1220         ###
1221         # Build Module Crap
1222         ###
1223         foreach $i (@modlist)
1224         {
1225                 if ($i !~ /_static$/) {
1226                         $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1227                         $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1228                         $deps = getdependencies("src/modules/m_".$i.".cpp");
1229
1230                         #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1231
1232                         ###
1233                         # Write Entry to the Makefile
1234                         ###
1235                         print FILEHANDLE <<EOCHEESE;
1236 m_$i.o: .m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h $deps
1237         \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c .m_$i\_static.cpp
1238         mv .m_$i\_static.o ../m_$i.o
1239
1240 EOCHEESE
1241                         ###
1242                         # End Write Entry to the MakeFile
1243                         ###
1244                         print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1245                         open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1246                         open(MUNGED,">src/modules/.m_".$i."_static.cpp") or die("Could not create .m_".$i."_static.cpp");
1247                         while (chomp($a = <MODULE>)) { 
1248                                 $a =~ s/init_module/$i\_init/g;
1249                                 print MUNGED "$a\n";
1250                         }
1251                         close(MODULE);
1252                         close(MUNGED);
1253                         print MODLIST <<EOENT;
1254 {"m_$i.so",\&$i\_init},
1255 EOENT
1256                         print "done\n";
1257                 }
1258         }
1259
1260         print MODLIST "{0}};\n\n#endif\n";
1261         close(MODLIST);
1262 }
1263
1264 sub write_dynamic_modules_makefile {
1265         # Modules Makefile..
1266         print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1267         open(FILEHANDLE, ">src/modules/Makefile");
1268         my $extra = "";
1269
1270         if ($config{OSNAME} =~ /CYGWIN/i) {
1271                 $extra = "../inspircd.dll.a";
1272         }
1273
1274 ###
1275 # Module Makefile Header
1276 ###
1277         print FILEHANDLE <<EOF;
1278 # (C) ChatSpike development team
1279 # Makefile by <Craig\@ChatSpike.net>
1280 # Many Thanks to Andrew Church <achurch\@achurch.org>
1281 #    for assisting with making this work right.
1282 #
1283 # Automatically Generated by ./configure to add a modules
1284 # please run ./configure -update or ./configure -modupdate
1285
1286 all: \$(MODULES)
1287
1288 EOF
1289         ###
1290         # End Module Makefile Header
1291         ###
1292
1293         # Create a Modules List..
1294         my $modules = "";
1295         my $cmflags = "";
1296         my $liflags = "";
1297         my $crud = "";
1298
1299         foreach $i (@modlist) {
1300                 ###
1301                 # Write Entry to the MakeFile
1302                 ###
1303                 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1304                 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1305                 $deps = getdependencies("src/modules/m_".$i.".cpp");
1306         
1307                 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1308         
1309                 print FILEHANDLE <<EOCHEESE;
1310 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/configreader.h $deps
1311         \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1312 EOCHEESE
1313
1314 if ($config{OSNAME} =~ /darwin/) {
1315                 print FILEHANDLE <<EOCHEESE;
1316         \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle $liflags -o m_$i.so m_$i.o $extra
1317
1318 EOCHEESE
1319 } else {
1320                 print FILEHANDLE <<EOCHEESE;
1321         \$(CC) -pipe \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1322
1323 EOCHEESE
1324 }
1325                 $crud = $crud . "       install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
1326 ###
1327                 # End Write Entry to the MakeFile
1328                 ###
1329         }
1330
1331         opendir(DIRHANDLE, "src/modules");
1332         foreach $name (sort readdir(DIRHANDLE)) {
1333                 if ($name =~ /^m_(.+?)$/) {
1334                         $crapola = "";
1335                         $crap3 = "";
1336                         # A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
1337                         if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1338                                 print "Composing Makefile rules for directory \033[1;32m$name\033[0m... ";
1339                                 my $i = 0;
1340                                 print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h"; 
1341                                 foreach $fname (sort readdir(MDIRHANDLE)) {
1342                                         if ($fname =~ /\.cpp$/) {
1343                                                 $cmflags = getcompilerflags("src/modules/$name/$fname");
1344                                                 $liflags = getlinkerflags("src/modules/$name/$fname");
1345                                                 $deps = getdependencies("src/modules/$name/$fname");
1346                                                 $oname = $fname;
1347                                                 $oname =~ s/\.cpp$/.o/g;
1348                                                 print FILEHANDLE " $name/$oname";
1349                                                 $crapola = $crapola .  "$name/$oname: $name/$fname ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps\n";
1350                                                 $crapola = $crapola .  "        \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $name/$oname -c $name/$fname\n\n";
1351                                                 $crap3 = $crap3 . " $name/$oname";
1352                                                 $i++;
1353                                         }
1354                                 }
1355                                 print "(\033[1;32m$i files found\033[0m)\n";
1356                                 if ($config{IS_DARWIN} eq "YES") {
1357                                         print FILEHANDLE "\n    \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle -o $name.so $crap3\n"; 
1358                                 } else {
1359                                         print FILEHANDLE "\n    \$(CC) -pipe \$(FLAGS) -shared $liflags -o $name.so $crap3\n";
1360                                 }
1361                                 print FILEHANDLE "\n$crapola\n";
1362                                 closedir(MDIRHANDLE);
1363                                 $crud = $crud . "       install -m \$(INSTMODE) $name.so \$(MODPATH)\n";
1364                         }
1365                 }
1366         }
1367         closedir(DIRHANDLE);
1368
1369         print FILEHANDLE "modinst:\n    \@echo \"Installing modules...\"\n" . $crud;
1370 }
1371
1372
1373 sub write_static_makefile {
1374         open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1375         my $i = 0;
1376         my @cmdlist = ();
1377         opendir(DIRHANDLE, "src");
1378         foreach $name (sort readdir(DIRHANDLE)) {
1379                 if ($name =~ /^cmd_(.+)\.cpp$/) {
1380                         $cmdlist[$i++] = $1;
1381                 }
1382         }
1383         closedir(DIRHANDLE);
1384         my $cmdobjs = "";
1385         my $srcobjs = "";
1386         foreach my $cmd (@cmdlist) {
1387                 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1388                 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1389         }
1390         print FH <<EOM;
1391 # Insp Makefile :p
1392 #
1393 # (C) ChatSpike development team
1394 # Makefile by <Craig\@ChatSpike.net>
1395 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1396 #
1397
1398 CC = im a cheezeball
1399
1400 CXXFLAGS = -I../include \${FLAGS}
1401 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1402 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1403
1404 EOM
1405
1406 $se = "socketengine_select";
1407 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1408         $se = "socketengine_kqueue";
1409 }       
1410 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1411         $se = "socketengine_epoll";
1412 }
1413 elsif (($has_ports) && ($config{USE_PORTS} eq "y")) {
1414         $se = "socketengine_ports";
1415 }
1416
1417         ###
1418         # This next section is for cygwin dynamic module builds.
1419         # Basically, what we do, is build the inspircd core as a library
1420         # then the main executable uses that. the library is capable of
1421         # loading / unloading the modules dynamically :)
1422         # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1423         # make this work :)
1424         ###
1425
1426         if ($config{OSNAME} =~ /CYGWIN/i) {
1427                 print FH <<EOM;
1428 all: timer.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 configreader.o inspsocket.o $cmdobjs commands.o dynamic.o users.o modules.o wildcard.o helperfuncs.o snomasks.o inspircd.exe
1429
1430 inspircd.exe: inspircd.dll.a
1431         \$(CC) -o \$@ \$^
1432
1433 inspircd.dll inspircd.dll.a: inspircd.o channels.o mode.o xline.o inspstring.o dns.o base.o configreader.o inspsocket.o $cmdobjs  commands.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 timer.o snomasks.o
1434         \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1435 EOM
1436         } else {
1437                 print FH <<EOM;
1438 all: timer.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 configreader.o inspsocket.o $cmdobjs commands.o dynamic.o users.o modules.o wildcard.o helperfuncs.o snomasks.o \$(MODULES) inspircd.exe
1439
1440 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
1441         \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspsocket.o configreader.o $cmdobjs commands.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 timer.o snomasks.o modes/modeclasses.a \$(MODULES)
1442 EOM
1443         }
1444
1445         print FH <<EOM;
1446
1447 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
1448         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1449
1450 snomasks.o: snomasks.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/channels.h
1451         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1452
1453 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
1454         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1455
1456 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1457         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1458
1459 socketengine.o: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1460         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1461
1462 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1463         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1464
1465 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1466         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1467
1468 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1469         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1470
1471 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 \$(RELCPPFILES) modes/modeclasses.a
1472         \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS)
1473         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1474
1475 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
1476         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1477
1478 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
1479         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1480
1481 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 ../include/timer.h
1482         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1483
1484 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1485         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1486
1487 configreader.o: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1488         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1489
1490 commands.o: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h $srcobjs
1491         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1492
1493 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
1494         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1495
1496 users.o: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1497         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1498
1499 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 ../include/timer.h
1500         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1501
1502 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
1503         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1504
1505 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1506         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1507         
1508 inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1509         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1510
1511 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1512         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1513
1514 EOM
1515         foreach my $cmd (@cmdlist) {
1516                 print FH <<ITEM;
1517 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/commands/cmd_$cmd.h
1518         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1519 ITEM
1520         }
1521         close(FH);
1522 }
1523
1524 sub write_dynamic_makefile {
1525
1526         my $i = 0;
1527         my @cmdlist = ();
1528         opendir(DIRHANDLE, "src");
1529         foreach $name (sort readdir(DIRHANDLE)) {
1530                 if ($name =~ /^cmd_(.+)\.cpp$/) {
1531                         $cmdlist[$i++] = $1;
1532                 }
1533         }
1534         closedir(DIRHANDLE);
1535
1536         my $cmdobjs = "";
1537         my $srcobjs = "";
1538         foreach my $cmd (@cmdlist) {
1539                 $cmdobjs = $cmdobjs . "cmd_$cmd.so ";
1540                 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1541         }
1542
1543         $se = "socketengine_select";
1544         if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1545                 $se = "socketengine_kqueue";
1546         }
1547         elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1548                 $se = "socketengine_epoll";
1549         }
1550         elsif (($has_ports) && ($config{USE_PORTS} eq "y")) {
1551                 $se = "socketengine_ports";
1552         }
1553
1554         open(FH,">src/Makefile") or die("Could not write src/Makefile");
1555         print FH <<EOM;
1556 # Insp Makefile :p
1557 #
1558 # (C) ChatSpike development team
1559 # Makefile by <Craig\@ChatSpike.net>
1560 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1561 #
1562
1563 CC = im a cheezeball
1564
1565 CXXFLAGS = -I../include \${FLAGS}
1566 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1567 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1568
1569 EOM
1570
1571 if ($config{IS_DARWIN} eq "YES") {
1572         print FH <<EOM;
1573 all: libIRCDtimer.dylib libIRCDcull_list.dylib libIRCDuserprocess.dylib libIRCDsocketengine.dylib libIRCDsocket.dylib libIRCDhash.dylib libIRCDchannels.dylib libIRCDmode.dylib libIRCDxline.dylib libIRCDstring.dylib libIRCDasyncdns.dylib libIRCDbase.dylib libIRCDconfigreader.dylib libIRCDinspsocket.dylib libIRCDcommands.dylib libIRCDdynamic.dylib libIRCDusers.dylib libIRCDmodules.dylib libIRCDwildcard.dylib libIRCDhelper.dylib libIRCDcommand_parse.dylib libIRCDsnomasks.dylib inspircd
1574
1575 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 $cmdobjs libIRCDtimer.dylib libIRCDcull_list.dylib libIRCDuserprocess.dylib libIRCDsocketengine.dylib libIRCDsocket.dylib libIRCDhash.dylib libIRCDchannels.dylib libIRCDmode.dylib libIRCDxline.dylib libIRCDstring.dylib libIRCDasyncdns.dylib libIRCDbase.dylib libIRCDconfigreader.dylib libIRCDinspsocket.dylib libIRCDsnomasks.dylib libIRCDcommands.dylib libIRCDdynamic.dylib libIRCDusers.dylib libIRCDmodules.dylib libIRCDwildcard.dylib libIRCDhelper.dylib libIRCDcommand_parse.dylib
1576         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd.cpp
1577         \$(CC) -pipe -dynamic -bind_at_load -L. -o inspircd \$(LDLIBS) inspircd.o libIRCDchannels.dylib libIRCDmode.dylib libIRCDxline.dylib libIRCDstring.dylib libIRCDasyncdns.dylib libIRCDbase.dylib libIRCDconfigreader.dylib libIRCDinspsocket.dylib libIRCDcommands.dylib libIRCDdynamic.dylib libIRCDusers.dylib libIRCDmodules.dylib libIRCDwildcard.dylib libIRCDhelper.dylib libIRCDhash.dylib libIRCDsocket.dylib libIRCDsocketengine.dylib libIRCDuserprocess.dylib libIRCDcull_list.dylib libIRCDcommand_parse.dylib libIRCDtimer.dylib libIRCDsnomasks.dylib
1578
1579 libIRCDsocketengine.dylib: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1580         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1581         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c $se.cpp
1582         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDsocketengine.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDsocketengine.dylib socketengine.o $se.o
1583
1584 libIRCDsnomasks.dylib: snomasks.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/channels.h
1585         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1586         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDsnomasks.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDsnomasks.dylib snomasks.o
1587
1588 libIRCDcommand_parse.dylib: command_parse.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1589         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1590         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDcommand_parse.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDcommand_parse.dylib command_parse.o
1591
1592 libIRCDcull_list.dylib: cull_list.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/users.h ../include/channels.h
1593         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1594         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDcull_list.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDcull_list.dylib cull_list.o
1595
1596 libIRCDuserprocess.dylib: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1597         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1598         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDuserprocess.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDuserprocess.dylib userprocess.o
1599
1600 libIRCDhash.dylib: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1601         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1602         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDhash.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDhash.dylib hashcomp.o
1603
1604 libIRCDhelper.dylib: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1605         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1606         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDhelper.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDhelper.dylib helperfuncs.o
1607
1608 libIRCDchannels.dylib: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1609         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1610         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDchannels.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDchannels.dylib channels.o
1611
1612 libIRCDmode.dylib: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES)
1613         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1614         \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1615         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDmode.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDmode.dylib mode.o modes/modeclasses.a
1616
1617 libIRCDxline.dylib: xline.cpp ../include/base.h ../include/xline.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1618         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1619         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDxline.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDxline.dylib xline.o
1620
1621 libIRCDstring.dylib: inspstring.cpp ../include/base.h ../include/inspstring.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1622         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1623         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDstring.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDstring.dylib inspstring.o
1624
1625 libIRCDasyncdns.dylib: dns.cpp ../include/base.h ../include/dns.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1626         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1627         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDasyncdns.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDasyncdns.dylib dns.o
1628
1629 libIRCDbase.dylib: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1630         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1631         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDbase.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDbase.dylib base.o
1632
1633 libIRCDconfigreader.dylib: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1634         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1635         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDconfigreader.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDconfigreader.dylib configreader.o
1636
1637 libIRCDcommands.dylib: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1638         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1639         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDcommands.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDcommands.dylib commands.o
1640
1641 libIRCDdynamic.dylib: dynamic.cpp ../include/base.h ../include/dynamic.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1642         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1643         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDdynamic.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDdynamic.dylib dynamic.o
1644
1645 libIRCDusers.dylib: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1646         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1647         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDusers.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDusers.dylib users.o
1648
1649 libIRCDmodules.dylib: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1650         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1651         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDmodules.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDmodules.dylib modules.o
1652
1653 libIRCDwildcard.dylib: wildcard.cpp ../include/base.h ../include/wildcard.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1654         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1655         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDwildcard.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDwildcard.dylib wildcard.o
1656
1657 libIRCDsocket.dylib: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1658         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1659         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDsocket.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDsocket.dylib socket.o
1660
1661 libIRCDinspsocket.dylib: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1662         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1663         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDinspsocket.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDinspsocket.dylib inspsocket.o
1664
1665 libIRCDtimer.dylib: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1666         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1667         \$(CC) -pipe -install_name $config{LIBRARY_DIR}/libIRCDtimer.dylib -dynamiclib -twolevel_namespace -undefined dynamic_lookup -o libIRCDtimer.dylib timer.o
1668
1669 EOM
1670
1671 } else {
1672
1673         print FH <<EOM;
1674 all: libIRCDtimer.so libIRCDcull_list.so libIRCDuserprocess.so libIRCDsocketengine.so libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDconfigreader.so libIRCDinspsocket.so $cmdobjs libIRCDcommands.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so libIRCDsnomasks.so inspircd
1675
1676 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 libIRCDtimer.so libIRCDcull_list.so libIRCDuserprocess.so libIRCDsocketengine.so libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDconfigreader.so libIRCDinspsocket.so $cmdobjs libIRCDsnomasks.so libIRCDcommands.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so
1677         \$(CC) -pipe -I../include $extra -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 libIRCDconfigreader.so libIRCDinspsocket.so libIRCDcommands.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 libIRCDtimer.so libIRCDsnomasks.so
1678
1679 libIRCDsocketengine.so: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1680         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1681         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o $se.o
1682
1683 libIRCDsnomasks.so: snomasks.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/channels.h
1684         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1685         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsnomasks.so snomasks.o
1686
1687 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
1688         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1689         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1690
1691 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
1692         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1693         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1694
1695 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1696         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1697         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1698
1699 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1700         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1701         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1702
1703 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1704         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1705         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1706
1707 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1708         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1709         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1710
1711 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 \$(RELCPPFILES)
1712         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1713         \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1714         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o modes/modeclasses.a
1715
1716 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 ../include/timer.h
1717         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1718         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1719
1720 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
1721         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1722         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1723
1724 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 ../include/timer.h
1725         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1726         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1727
1728 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1729         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1730         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1731
1732 libIRCDconfigreader.so: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1733         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1734         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDconfigreader.so configreader.o
1735
1736 libIRCDcommands.so: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1737         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1738         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o
1739
1740 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
1741         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1742         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1743
1744 libIRCDusers.so: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1745         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1746         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1747
1748 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 ../include/timer.h
1749         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1750         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1751
1752 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
1753         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1754         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1755
1756 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1757         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1758         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1759
1760 libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1761         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1762         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDinspsocket.so inspsocket.o
1763
1764 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1765         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1766         \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1767
1768 EOM
1769 }
1770         foreach my $cmd (@cmdlist) {
1771                 print FH <<ITEM;
1772 cmd_$cmd.so: 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/commands/cmd_$cmd.h
1773         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1774         \$(CC) -pipe $SHARED -o cmd_$cmd.so cmd_$cmd.o
1775
1776 ITEM
1777         }
1778         close(FH);
1779 }
1780