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