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