]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - configure
0739a3b77a355c1710c7e2619fcd86dbecd00586
[user/henk/code/inspircd.git] / configure
1 #!/usr/bin/perl
2 # InspIRCd Configuration Script
3 #
4 # Copyright 2003 The ChatSpike Development Team
5 # <brain@chatspike.net>
6 # <Craig@chatspike.net>
7 #
8 # [14:21] Brain: <matrix impression> i know perl-fu!
9 #
10 # $Id$
11 #
12 ########################################
13
14 chomp($topdir = `pwd`);
15 $this = resolve_directory($topdir);                                             # PWD, Regardless.
16 @modlist = ();                                                                  # Declare for Module List..
17 %config = ();                                                                   # Initiate Configuration Hash..
18 $config{ME}                 = resolve_directory($topdir);                       # Present Working Directory
19 $config{CONFIG_DIR}         = resolve_directory($config{ME}."/conf");           # Configuration Directory
20 $config{MODULE_DIR}         = resolve_directory($config{ME}."/modules");        # Modules Directory
21 $config{BINARY_DIR}         = resolve_directory($config{ME}."/bin");            # Binary Directory
22 $config{LIBRARY_DIR}        = resolve_directory($config{ME}."/lib");            # Library Directory
23 $config{OPTIMITEMP}         = "0";                                              # Default Optimisation Value
24 $config{OPTIMISATI}         = "-g";                                             # Optimisation Flag
25 $config{NICK_LENGT}         = "31";                                             # Default Nick Length
26 $config{CHAN_LENGT}         = "64";                                             # Default Channel Name Length
27 $config{MAX_CHANNE}         = "20";                                             # Default Max. Channels per user..
28 $config{MAXI_MODES}         = "20";                                             # Default Max. Number of Modes set at once.
29 $config{HAS_STRLCPY}        = "false";                                          # strlcpy Check.
30 $config{USE_KQUEUE}         = "y";                                              # kqueue enabled
31 $config{USE_EPOLL}          = "y";                                              # epoll enabled
32 $config{STATIC_LINK}        = "no";                                             # are doing static modules?
33 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`);                           # FD Limit
34 chomp($config{GCCVER}       = `gcc -dumpversion | cut -c 1`);                   # Major GCC Version
35 chomp($config{GCC34}        = `gcc -dumpversion | cut -c 3`);                   # Minor GCC Version
36 chomp($config{OSNAME}       = `/bin/uname`);                                    # Operating System Name
37 $config{CC}                 = "g++";                                            # C++ compiler
38 $config{MAKEORDER}          = "ircd mods config bininst";                       # build order
39 $config{STATICLIBS}         = "";                                               # library archive path
40 $config{MAX_IDENT}          = "12";                                             # max ident size
41 $config{MAX_QUIT}           = "255";                                            # max quit message size
42 $config{MAX_TOPIC}          = "307";                                            # max topic size
43 $config{MAX_KICK}           = "255";                                            # max kick message size
44 $config{MAX_GECOS}          = "128";                                            # max GECOS size
45 $config{MAX_AWAY}           = "200";                                            # max AWAY size
46
47 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
48   chomp($config{OSNAME} = `/usr/bin/uname`);
49   if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
50         $config{OSNAME} = "Unknown";
51   }
52 }
53
54 if (!$config{MAX_CLIENT_T}) { 
55   $config{MAX_CLIENT_T} = 1024;                                 # Set a reasonable 'Default'
56   $fd_scan_fail = "true";                                       # Used Later
57 }
58
59 # Get and Set some important vars..
60 getmodules();
61
62 my $arg = $ARGV[0];                                             # Do Some Argument Checks..
63 if ($arg eq "-clean") { `rm -rf .config.cache`; }               # Remove the config.cache file.
64
65 if ($arg eq "-update") {
66   # Does the cache file exist?
67   if (!getcache()) {
68     # No, No it doesn't.. *BASH*
69     print "You have not run ./configure before. Please do this before trying to run the update script.\n";
70     exit 0;
71   } else {
72     # We've Loaded the cache file and all our variables..
73     print "Updating Files..\n";
74     getosflags();
75     $has_epoll = $config{HAS_EPOLL};
76     $has_kqueue = $config{HAS_KQUEUE};
77     writefiles();
78     print "Complete.\n";
79     exit;
80   }
81 }
82
83 print "Checking for cache from previous configure...\n";
84 getcache();
85 print "Checking operating system version...\n";
86 getosflags();
87
88 if (!$config{MAX_CLIENT}) { 
89   # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
90   # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
91   # higher than the found value" :))
92   $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
93 }
94
95 printf "Checking if strlcpy exists... ";
96 # Perform the strlcpy() test..
97 $config{HAS_STRLCPY} = "false";
98 my $fail = 0;
99 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
100 if (!$fail)
101 {
102         while (chomp($line = <STRLCPY>))
103         {
104                 # try and find the delcaration of:
105                 # size_t strlcpy(...)
106                 if ($line =~ /size_t(\0x9|\s)+strlcpy/)
107                 {
108                         $config{HAS_STRLCPY} = "true";
109                 }
110         }
111         close(STRLCPY);
112 }
113 print "yes\n" if $config{HAS_STRLCPY} eq "true";
114 print "no\n" if $config{HAS_STRLCPY} eq "false";
115
116 printf "Checking if kqueue exists... ";
117 $has_kqueue = 0;
118 $fail = 0;
119 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
120 if (!$fail)
121 {
122         while (chomp($line = <KQUEUE>))
123         {
124                 # try and find the delcaration of:
125                 # int kqueue(void);
126                 if ($line =~ /int(\0x9|\s)+kqueue/)
127                 {
128                         $has_kqueue = 1;
129                 }
130         }
131         close(KQUEUE);
132 }
133 print "yes\n" if $has_kqueue == 1;
134 print "no\n" if $has_kqueue == 0;
135
136 printf "Checking if epoll exists... ";
137 $has_epoll = 0;
138 $fail = 0;
139 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
140 if (!$fail)
141 {
142         while (chomp($line = <EPOLL>))
143         {
144                 # try and find the declaration of:
145                 # extern int epoll_create (int __size) __THROW;
146                 if (($line =~ /int(\0x9|\s)+epoll_create(\0x9|\s)+\(/) || ($line =~ /int(\0x9|\s)+epoll_create\(/))
147                 {
148                         $has_epoll = 1;
149                 }
150         }
151         close(EPOLL);
152 }
153 print "yes\n" if $has_epoll == 1;
154 print "no\n" if $has_epoll == 0;
155
156 if ($config{OSNAME} =~ /CYGWIN/) {
157         $config{HAS_STRLCPY} = "true";
158 }
159
160 $config{HAS_EPOLL} = $has_epoll;
161 $config{HAS_KQUEUE} = $has_kqueue; 
162
163 ################################################################################
164 #                          BEGIN INTERACTIVE PART                              #
165 ################################################################################
166
167 # Clear the Screen..
168 system("clear");
169 # Display Splash Logo..
170 show_splash();
171 chomp($wholeos = `uname -mnr`);
172
173 # Display Introduction Message..
174 print "
175 Welcome to the InspIRCd Configuration program!
176
177 *** If you are unsure of any of these values, leave it blank for    ***
178 *** standard settings that will work, and your server will run      ***
179 *** using them. If you are running this server as part of a         ***
180 *** larger network, you must consult with your network admins       ***
181 *** for the proper values to use, or server links will be unstable! ***
182
183 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
184 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
185 dir, otherwise you won't have a config file!
186
187 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos), fdmax: $config{MAX_CLIENT_T}\n\n";
188
189 $config{CHANGE_COMPILER} = "n";
190 print "I have detected the following compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.$config{GCC34}\033[0m)\n";
191
192 if ($config{GCCVER} < 3)
193 {
194         print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
195 should NOT be used. You should probably specify a newer compiler.\n";
196 }
197 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
198 if ($config{CHANGE_COMPILER} =~ /y/i)
199 {
200     print "What command do you want to use to invoke your compiler?\n";
201     print "[\033[1;32m$config{CC}\033[0m] -> ";
202     chomp($config{CC} = <STDIN>);
203     if ($config{CC} eq "") { $config{CC} = "g++"; }
204     chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
205     if ($foo ne "") {
206             chomp($config{GCCVER}       = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change
207             chomp($config{GCC34}        = `$config{CC} -dumpversion | cut -c 3`); # the compiler path
208             print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.$config{GCC34}\033[0m)\n";
209     }
210     else
211     {
212             print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
213     }
214 }
215
216 print "\n";
217
218 # Directory Settings..
219 dir_check("are the configuration files", "CONFIG_DIR");
220 dir_check("are the modules to be compiled to", "MODULE_DIR");
221 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
222 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
223
224 if ($has_kqueue) {
225         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?");
226         print "\n";
227 }
228 if ($has_epoll) {
229         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?");
230         print "\n";
231 }
232 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
233 if (!$chose_hiperf)
234 {
235         print "No high-performance socket engines are available, or you chose\n";
236         print "not to enable one. Defaulting to select() engine.\n\n";
237 }
238
239 print "\nThe following questions will ask you for various figures relating\n";
240 print "To your IRCd install. Please note that these should usually be left\n";
241 print "as defaults unless you have a real reason to change them. If they\n";
242 print "changed, then the values must be identical on all servers on your\n";
243 print "network, or malfunctions and/or crashes may occur, with the exception\n";
244 print "of the 'maximum number of clients' setting which may be different on\n";
245 print "different servers on the network.\n\n";
246
247 # File Descriptor Settings..
248 my $continue = 0;
249 while (!$continue) {
250   print "Maximum number of clients at any one time ($config{MAX_CLIENT_T})\n";
251   print "[\033[1;32m$config{MAX_CLIENT}\033[0m] -> ";
252   chomp($var = <STDIN>);
253   if ($var eq "") { $var = $config{MAX_CLIENT}; }
254   if ($var =~ /^\d+$/) {
255     if (($var > $config{MAX_CLIENT_T}) && ($fd_scan_failed ne true)) {
256       # Client has entered a larger number than the 'discovered' value
257       # Confirm.
258       print "WARNING: Our scans have indicated that you are attempting
259 to use more sockets than there are avaliable. Are you sure
260 you wish to do this? It may cause the IRCd to malfunction [y/n]
261 [\033[1;32mn\033[0m] -> $c";
262       chomp($tmp = <STDIN>);
263       if ($tmp ne "y") {
264         print "Please enter the correct value.\n\n";
265         next;
266       }
267     }
268   } else {
269     print "You must enter a number in this field. Please try again.\n\n";
270     next;
271   }
272   # If we get here, we should be good to go.
273   $config{MAX_CLIENT} = $var;
274   $continue = 1;
275   print "\n";
276 }
277
278 my $continue = 0;
279 while (!$continue) {
280   print "What is the maximum length of nicknames?\n";
281   print "[\033[1;32m$config{NICK_LENGT}\033[0m] -> ";
282   chomp($var = <STDIN>);
283   if ($var eq "") { $var = $config{NICK_LENGT}; }
284   if ($var =~ /^\d+$/) {
285     # We don't care what the number is, set it and be on our way.
286     $config{NICK_LENGT} = $var;
287     $continue = 1;
288     print "\n";
289   } else {
290     print "You must enter a number in this field. Please try again.\n\n";
291   }
292 }
293
294 $continue = 0;
295 while (!$continue) {
296   print "What is the maximum length of channel names?\n";
297   print "[\033[1;32m$config{CHAN_LENGT}\033[0m] -> ";
298   chomp($var = <STDIN>);
299   if ($var eq "") { $var = $config{CHAN_LENGT}; }
300   if ($var =~ /^\d+$/) {
301     # We don't care what the number is, set it and be on our way.
302     $config{CHAN_LENGT} = $var;
303     $continue = 1;
304     print "\n";
305   } else {
306     print "You must enter a number in this field. Please try again.\n\n";
307   }
308 }
309
310 $continue = 0;
311 while (!$continue) {
312   print "What is the maximum number of channels a user may join at any one time?\n";
313   print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
314   chomp($var = <STDIN>);
315   if ($var eq "") { $var = $config{MAX_CHANNE}; }
316   if ($var =~ /^\d+$/) {
317     # We don't care what the number is, set it and be on our way.
318     $config{MAX_CHANNE} = $var;
319     $continue = 1;
320     print "\n";
321   } else {
322     print "You must enter a number in this field. Please try again.\n\n";
323   }
324 }
325
326 $continue = 0;
327 while (!$continue) {
328   print "What is the maximum number of mode changes in one line?\n";
329   print "[\033[1;32m$config{MAXI_MODES}\033[0m] -> ";
330   chomp($var = <STDIN>);
331   if ($var eq "") { $var = $config{MAXI_MODES}; }
332   if ($var =~ /^\d+$/) {
333     # We don't care what the number is, set it and be on our way.
334     $config{MAXI_MODES} = $var;
335     $continue = 1;
336     print "\n";
337   } else {
338     print "You must enter a number in this field. Please try again.\n\n";
339   }
340 }
341
342 $continue = 0;
343 while (!$continue) {
344   print "What is the maximum length of an ident (username)?\n";
345   print "[\033[1;32m$config{MAX_IDENT}\033[0m] -> ";
346   chomp($var = <STDIN>);
347   if ($var eq "") { $var = $config{MAX_IDENT}; }
348   if ($var =~ /^\d+$/) {
349     # We don't care what the number is, set it and be on our way.
350     $config{MAX_IDENT} = $var;
351     $continue = 1;
352     print "\n";
353   } else {
354     print "You must enter a number in this field. Please try again.\n\n";
355   }
356 }
357
358 $continue = 0;
359 while (!$continue) {
360   print "What is the maximum length of a quit message?\n";
361   print "[\033[1;32m$config{MAX_QUIT}\033[0m] -> ";
362   chomp($var = <STDIN>);
363   if ($var eq "") { $var = $config{MAX_QUIT}; }
364   if ($var =~ /^\d+$/) {
365     # We don't care what the number is, set it and be on our way.
366     $config{MAX_QUIT} = $var;
367     $continue = 1;
368     print "\n";
369   } else {
370     print "You must enter a number in this field. Please try again.\n\n";
371   }
372 }
373
374 $continue = 0;
375 while (!$continue) {
376   print "What is the maximum length of a channel topic?\n";
377   print "[\033[1;32m$config{MAX_TOPIC}\033[0m] -> ";
378   chomp($var = <STDIN>);
379   if ($var eq "") { $var = $config{MAX_TOPIC}; }
380   if ($var =~ /^\d+$/) {
381     # We don't care what the number is, set it and be on our way.
382     $config{MAX_TOPIC} = $var;
383     $continue = 1;
384     print "\n";
385   } else {
386     print "You must enter a number in this field. Please try again.\n\n";
387   }
388 }
389
390 $continue = 0;
391 while (!$continue) {
392   print "What is the maximum length of a kick message?\n";
393   print "[\033[1;32m$config{MAX_KICK}\033[0m] -> ";
394   chomp($var = <STDIN>);
395   if ($var eq "") { $var = $config{MAX_KICK}; }
396   if ($var =~ /^\d+$/) {
397     # We don't care what the number is, set it and be on our way.
398     $config{MAX_KICK} = $var;
399     $continue = 1;
400     print "\n";
401   } else {
402     print "You must enter a number in this field. Please try again.\n\n";
403   }
404 }
405
406 $continue = 0;
407 while (!$continue) {
408   print "What is the maximum length of a GECOS (real name) field?\n";
409   print "[\033[1;32m$config{MAX_GECOS}\033[0m] -> ";
410   chomp($var = <STDIN>);
411   if ($var eq "") { $var = $config{MAX_GECOS}; }
412   if ($var =~ /^\d+$/) {
413     # We don't care what the number is, set it and be on our way.
414     $config{MAX_GECOS} = $var;
415     $continue = 1;
416     print "\n";
417   } else {
418     print "You must enter a number in this field. Please try again.\n\n";
419   }
420 }
421
422 $continue = 0;
423 while (!$continue) {
424   print "What is the maximum length of an away message?\n";
425   print "[\033[1;32m$config{MAX_AWAY}\033[0m] -> ";
426   chomp($var = <STDIN>);
427   if ($var eq "") { $var = $config{MAX_AWAY}; }
428   if ($var =~ /^\d+$/) {
429     # We don't care what the number is, set it and be on our way.
430     $config{MAX_AWAY} = $var;
431     $continue = 1;
432     print "\n";
433   } else {
434     print "You must enter a number in this field. Please try again.\n\n";
435   }
436 }
437
438 # Code Optimisation
439 print "Enter the Level Of Binary optimisation. This is a number between 0 and 3.
440 The InspIRCd Team will NOT support any bug reports above 0. Also note,
441 the IRCd behaviour will be different depending on this value. Please
442 read the documentation for more information.
443
444 The higher the number, the more optimised your binary will be. This
445 value will default to 0 if you either don't enter a number, or enter
446 a value outside the range.
447
448 As always, if you are unsure, just press enter and accept the default.\n\n";
449 print "[\033[1;32m$config{OPTIMITEMP}\033[0m] -> ";
450 chomp($var = <STDIN>);
451 if ($var eq "") {
452   $var = $config{OPTIMITEMP};
453 }
454
455 if ($var eq "1") {
456   $config{OPTIMITEMP} = 1;
457   $config{OPTIMISATI} = "-O";
458 } elsif ($var eq "2") {
459   $config{OPTIMITEMP} = 2;
460   $config{OPTIMISATI} = "-O2";
461 } elsif ($var eq "3") {
462   $config{OPTIMITEMP} = 3;
463   $config{OPTIMISATI} = "-O3";
464 } else {
465   $config{OPTIMITEMP} = 0;
466   $config{OPTIMISATI} = "-g";
467 }
468
469 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
470 print "\033[0mConfig path:\033[1;32m\t\t\t$config{CONFIG_DIR}\n";
471 print "\033[0mModule path:\033[1;32m\t\t\t$config{MODULE_DIR}\n";
472 print "\033[0mMax connections:\033[1;32m\t\t$config{MAX_CLIENT}\n";
473 print "\033[0mMax User Channels:\033[1;32m\t\t$config{MAX_CHANNE}\n";
474 print "\033[0mMax nickname length:\033[1;32m\t\t$config{NICK_LENGT}\n";
475 print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
476 print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
477 print "\033[0mMax ident length:\033[1;32m\t\t$config{MAX_IDENT}\n";
478 print "\033[0mMax quit length:\033[1;32m\t\t$config{MAX_QUIT}\n";
479 print "\033[0mMax topic length:\033[1;32m\t\t$config{MAX_TOPIC}\n";
480 print "\033[0mMax kick length:\033[1;32m\t\t$config{MAX_KICK}\n";
481 print "\033[0mMax name length:\033[1;32m\t\t$config{MAX_GECOS}\n";
482 print "\033[0mMax away length:\033[1;32m\t\t$config{MAX_AWAY}\n";
483 print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
484 print "\033[0mOptimatizaton Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
485 print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n";
486 print "\033[0mStatic modules:\033[1;32m\t\t\t$config{STATIC_LINK}\033[0m\n\n";
487
488 makecache();
489 writefiles();
490
491 print "\n\n";
492 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
493 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
494 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
495         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";
496 }
497 if ($config{OSNAME} =~ /CYGWIN/) {
498         print <<FOO;
499 \033[1;32mWARNING!\033[0m CYGWIN does not properly support shared modules,
500 so modules will be compiled statically into the core of the ircd. The modules
501 will act like they are being loaded from disk and being unloaded from RAM,
502 however they are in fact being enabled and disabled similar to features in
503 other ircds.
504 FOO
505 }
506
507 if ($config{GCCVER} < "3") {
508         print <<FOO2;
509 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
510 GCC 2.x series compilers only had partial (read as broken) C++ support, and
511 your compile will most likely fail horribly! If you have any problems, do NOT
512 report them to the bugtracker or forums without first upgrading your compiler
513 to a newer 3.x or 4.x (or whatever is available currently) version.
514 FOO2
515 }
516
517 ################################################################################
518 #                              HELPER FUNCTIONS                                #
519 ################################################################################
520 sub getcache {
521   # Retrieves the .config.cache file, and loads values into the main config hash.
522   open(CACHE, ".config.cache") or return undef;
523   while (<CACHE>) {
524     chomp;
525
526     # Ignore Blank lines, and comments..
527     next if /^\s*$/;
528     next if /^\s*#/;
529
530     my ($key, $value) = split("=", $_);
531     $value =~ /^\"(.*)\"$/;
532     # Do something with data here!
533     $config{$key} = $1;
534   }
535   close(CONFIG);
536   return "true";
537 }
538
539 sub makecache {
540   # Dump the contents of %config
541   print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
542   open(FILEHANDLE, ">.config.cache");
543   foreach $key (keys %config)
544   {
545     print FILEHANDLE "$key=\"$config{$key}\"\n";
546   }
547   close(FILEHANDLE);
548 }
549
550 sub dir_check {
551   my ($desc, $hash_key) = @_;
552   my $complete = 0;
553   while (!$complete) {
554     print "In what directory $desc?\n";
555     print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
556     chomp($var = <STDIN>);
557     if ($var eq "") { $var = $config{$hash_key}; }
558     if ($var =~ /^\~\/(.+)$/) {
559         # Convert it to a full path..
560         $var = resolve_directory($ENV{HOME} . "/" . $1);
561     }
562     if (substr($var,0,1) ne "/")
563     {
564         # Assume relative Path was given.. fill in the rest.
565         $var = $this . "/$var";
566     }
567     $var = resolve_directory($var); 
568     if (! -e $var) {
569       print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
570       chomp($tmp = <STDIN>);
571       if (($tmp eq "") || ($tmp =~ /^y/i)) {
572         # Attempt to Create the Dir..
573         $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
574         if ($chk != 0) {
575           print "Unable to create directory. ($var)\n\n";
576           # Restart Loop..
577           next;
578         }
579       } else {
580         # They said they don't want to create, and we can't install there.
581         print "\n\n";
582         next;
583       }
584     } else {
585       if (!is_dir($var)) {
586         # Target exists, but is not a directory.
587         print "File $var exists, but is not a directory.\n\n";
588         next;
589       }
590     }
591     # Either Dir Exists, or was created fine.
592     $config{$hash_key} = $var;
593     $complete = 1;
594     print "\n";
595   }
596 }
597
598 sub getosflags {
599   if ($config{OSNAME} =~ /BSD$/) {
600     $config{LDLIBS} = "-Ldl";
601     $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
602     $config{MAKEPROG} = "gmake";
603     if ($config{OSNAME} eq "OpenBSD") {
604         chomp($foo = `eg++ -dumpversion | cut -c 1`);
605         # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
606         # if theyre not running this, configure lets the build continue but they probably wont manage to
607         # compile as this standard version is 2.95.3!
608         if ($foo ne "") {
609                 $config{CC} = "eg++";
610                 chomp($config{GCCVER}       = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
611                 chomp($config{GCC34}        = `eg++ -dumpversion | cut -c 3`); # the compiler path
612         }
613     }
614   } else {
615     $config{LDLIBS} = "-ldl";
616     $config{FLAGS}  = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
617     $config{MAKEPROG} = "make";
618     if ($config{OSNAME} =~ /CYGWIN/) {
619        $config{FLAGS}  = "-frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
620        $config{LDLIBS} = "";
621        $config{MAKEPROG} = "/usr/bin/make";
622        $config{MAKEORDER} = "mods ircd config bininst";
623        $config{STATICLIBS} = "modules/mods.a";
624        $config{STATIC_LINK} = "yes";
625     }
626   }
627   if ($config{OSNAME} =~ /SunOS/) {
628     # solaris/sunos needs these
629     # socket = bsd sockets api
630     # nsl = dns stuff
631     # rt = POSIX realtime extensions
632     # resolv = inet_aton only (why isnt this in nsl?!)
633     $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
634   }
635 }
636
637 sub is_dir {
638   my ($path) = @_;
639   if (chdir($path)) {
640     chdir($this);
641     return 1;
642   } else {
643     # Just in case..
644     chdir($this);
645     return 0;
646   }
647 }
648
649 sub getmodules {
650   my $i = 0;
651   opendir(DIRHANDLE, "src/modules");
652   foreach $name (sort readdir(DIRHANDLE)) {
653     if ($name =~ /^m_(.+)\.cpp$/)
654     {
655       $mod = $1;
656       if ($mod !~ /_static$/) {
657               $modlist[$i++] = $mod;
658       }
659     }
660   }
661   closedir(DIRHANDLE);
662 }
663
664 sub writefiles {
665
666   print "Writing \033[1;32minspircd_config.h\033[0m\n";
667   # First File.. inspircd_config.h
668   chomp(my $incos = `uname -n -s -r`);
669   chomp(my $version = `sh ./src/version.sh`);
670   open(FILEHANDLE, ">include/inspircd_config.h");
671   my $NL = $config{NICK_LENGT}+1;
672   my $CL = $config{CHAN_LENGT}+1;
673   print FILEHANDLE <<EOF;
674 /* Auto generated by configure, do not modify! */
675 #ifndef __CONFIGURATION_AUTO__
676 #define __CONFIGURATION_AUTO__
677
678 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
679 #define MOD_PATH "$config{MODULE_DIR}"
680 #define VERSION "$version"
681 #define MAXCLIENTS $config{MAX_CLIENT}
682 #define NICKMAX $NL
683 #define CHANMAX $CL
684 #define MAXCHANS $config{MAX_CHANNE}
685 #define MAXMODES $config{MAXI_MODES}
686 #define IDENTMAX $config{MAX_IDENT}
687 #define MAXQUIT $config{MAX_QUIT}
688 #define MAXTOPIC $config{MAX_TOPIC}
689 #define MAXKICK $config{MAX_KICK}
690 #define MAXGECOS $config{MAX_GECOS}
691 #define MAXAWAY $config{MAX_AWAY}
692 #define OPTIMISATION $config{OPTIMITEMP}
693 #define SYSTEM "$incos"
694 #define MAXBUF 514
695 EOF
696
697   if ($config{OSNAME} =~ /SunOS/) {
698     print FILEHANDLE "#define IS_SOLARIS\n";
699   }
700   if ($config{OSNAME} =~ /CYGWIN/) {
701     print FILEHANDLE "#define IS_CYGWIN\n";
702     print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE    1024\n#endif\n";
703   }
704   if ($config{STATIC_LINK} eq "yes") {
705     print FILEHANDLE "#define STATIC_LINK\n";
706   }
707   if ($config{GCCVER} > 3) {
708     print FILEHANDLE "#define GCC3\n";
709     print FILEHANDLE "#define GCC34\n";
710   }
711   else
712   {
713     if ($config{GCCVER} == 3) {
714       print FILEHANDLE "#define GCC3\n";
715       if ($config{GCC34} > 3) {
716         print FILEHANDLE "#define GCC34\n";
717       }
718     }
719   }
720   if ($config{HAS_STRLCPY} eq "true") {
721     print FILEHANDLE "#define HAS_STRLCPY\n";
722   }
723   my $use_hiperf = 0;
724   if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
725     print FILEHANDLE "#define USE_KQUEUE\n";
726     $use_hiperf = 1;
727   }
728   if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
729     print FILEHANDLE "#define USE_EPOLL\n";
730     $use_hiperf = 1;
731   }
732   # user didn't choose either epoll or select for their OS.
733   # default them to USE_SELECT (ewwy puke puke)
734   if (!$use_hiperf) {
735     print FILEHANDLE "#define USE_SELECT\n";
736   }
737   print FILEHANDLE "\n#endif\n";
738   close(FILEHANDLE);
739
740   # Create a Modules List..
741   my $modules = "";
742   foreach $i (@modlist)
743   {
744     if ($config{OSNAME} =~ /CYGWIN/) {
745         $modules .= "m_".$i.".o ";
746     }
747     else {
748         $modules .= "m_".$i.".so ";
749     }
750   }
751   chomp($modules);   # Remove Redundant whitespace..
752
753
754   # Write all .in files.
755   my $tmp = "";
756   my $file = "";
757   my $exe = "inspircd";
758
759   if ($config{OSNAME} =~ /CYGWIN/) {
760     $exe = "inspircd.exe";
761   }
762
763   opendir(DIRHANDLE, $this);
764   foreach $name (sort readdir(DIRHANDLE)) {
765     if ($name =~ /^\.(.+)\.inc$/)
766     {
767       $file = $1;
768       # All .name.inc files need parsing!
769       $tmp = "";
770       open(FILEHANDLE, ".$file.inc");
771       while (<FILEHANDLE>) {
772         $tmp .= $_;
773       }
774       close(FILEHANDLE);
775
776       $tmp =~ s/\@CC\@/$config{CC}/;
777       $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
778       $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
779       $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
780       $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
781       $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
782       $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
783       $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
784       $tmp =~ s/\@MODULES\@/$modules/;
785       $tmp =~ s/\@EXECUTABLE\@/$exe/;
786       $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
787       $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
788
789       print "Writing \033[1;32m$file\033[0m\n";
790       open(FILEHANDLE, ">$file");
791       print FILEHANDLE $tmp;
792     }
793   }
794   closedir(DIRHANDLE);
795
796   # Make inspircd executable!
797   chmod 0744, 'inspircd';
798
799   if ($config{OSNAME} =~ /CYGWIN/) {
800         print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
801         write_static_makefile();
802   }
803   else {
804         print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
805         write_dynamic_makefile();
806   }
807
808
809   # Modules Makefile..
810   print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
811   open(FILEHANDLE, ">src/modules/Makefile");
812   print FILEHANDLE <<EOF;
813 # (C) ChatSpike development team
814 # Makefile by <Craig\@ChatSpike.net>
815 # Many Thanks to Andrew Church <achurch\@achurch.org>
816 #    for assisting with making this work right.
817 #
818 # Automatically Generated by ./configure to add a modules
819 # please run ./configure --update
820
821 all: \$(MODULES)
822
823 EOF
824
825   # Create a Modules List..
826   my $modules = "";
827   my $flags = "";
828   if ($config{OSNAME} =~ /CYGWIN/) {
829      open(MODLIST,">include/modlist.h");
830      print MODLIST <<HEADER;
831 // Generated automatically by configure. DO NOT EDIT!
832
833 #ifndef __SYMBOLS__H_CONFIGURED__
834 #define __SYMBOLS__H_CONFIGURED__
835
836 HEADER
837      foreach $i (@modlist) {
838         if ($i !~ /_static$/) {
839                 print MODLIST "extern \"C\" void * $i\_init (void);\n";
840         }
841      }
842      print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
843   }
844   foreach $i (@modlist)
845   {
846     if ($i !~ /_static$/) {
847      $flags = getcompilerflags("src/modules/m_".$i.".cpp");
848      if ($config{OSNAME} =~ /CYGWIN/) {
849         print FILEHANDLE <<EOCHEESE;
850 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/servers.h ../../include/base.h
851         \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
852         mv m_$i\_static.o ../m_$i.o
853
854 EOCHEESE
855         print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
856         open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
857         open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
858         while (chomp($a = <MODULE>)) { 
859                 $a =~ s/init_module/$i\_init/g;
860                 $a =~ s/Srv/$i\Srv/g;
861                 print MUNGED "$a\n";
862         }
863         close(MODULE);
864         close(MUNGED);
865         print MODLIST <<EOENT;
866 {"m_$i.so",\&$i\_init},
867 EOENT
868         print "done\n";
869      }
870      else {
871          print FILEHANDLE <<EOCHEESE;
872 m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/servers.h ../../include/base.h
873         \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i.cpp
874         \$(CC) \$(FLAGS) -shared $flags -o m_$i.so m_$i.o
875         @-rm -f \$(MODPATH)/m_$i.so
876         cp m_$i.so \$(MODPATH)/
877         chmod 0700 \$(MODPATH)/m_$i.so
878
879 EOCHEESE
880       }
881    }
882   }
883   if ($config{OSNAME} =~ /CYGWIN/) {
884      print MODLIST "{0}};\n\n#endif\n";
885      close(MODLIST);
886   }
887 }
888
889 sub getcompilerflags {
890   my ($file) = @_;
891   open(FLAGS, $file);
892   while (<FLAGS>) {
893     if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
894       close(FLAGS);
895       return $1;
896     }
897   }
898   close(FLAGS);
899   return undef;
900 }
901
902 sub show_splash {
903   print "'\033[1;33m####\033[0m:'\033[1;33m##\033[0m::: \033[1;33m##\033[0m::'\033[1;33m######\033[0m::'\033[1;33m########\033[0m::'\033[1;33m####\033[0m:'\033[1;33m########\033[0m:::'\033[1;33m######\033[0m::'\033[1;33m########\033[0m::\n";
904   print ". \033[1;33m##\033[0m:: \033[1;33m###\033[0m:: \033[1;33m##\033[0m:'\033[1;33m##\033[0m... \033[1;33m##\033[0m: \033[1;33m##\033[0m.... \033[1;33m##\033[0m:. \033[1;33m##\033[0m:: \033[1;33m##\033[0m.... \033[1;33m##\033[0m:'\033[1;33m##\033[0m... \033[1;33m##\033[0m: \033[1;33m##\033[0m.... \033[1;33m##\033[0m:\n";
905   print ": \033[1;33m##\033[0m:: \033[1;33m####\033[0m: \033[1;33m##\033[0m: \033[1;33m##\033[0m:::..:: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:: \033[1;33m##\033[0m:: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m: \033[1;33m##\033[0m:::..:: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:\n";
906   print ": \033[1;33m##\033[0m:: \033[1;33m##\033[0m \033[1;33m##\033[0m \033[1;33m##\033[0m:. \033[1;33m######\033[0m:: \033[1;33m########\033[0m::: \033[1;33m##\033[0m:: \033[1;33m########\033[0m:: \033[1;33m##\033[0m::::::: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:\n";
907   print ": \033[1;33m##\033[0m:: \033[1;33m##\033[0m. \033[1;33m####\033[0m::..... \033[1;33m##\033[0m: \033[1;33m##\033[0m.....:::: \033[1;33m##\033[0m:: \033[1;33m##\033[0m.. \033[1;33m##\033[0m::: \033[1;33m##\033[0m::::::: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:\n";
908   print ": \033[1;33m##\033[0m:: \033[1;33m##\033[0m:. \033[1;33m###\033[0m:'\033[1;33m##\033[0m::: \033[1;33m##\033[0m: \033[1;33m##\033[0m::::::::: \033[1;33m##\033[0m:: \033[1;33m##\033[0m::. \033[1;33m##\033[0m:: \033[1;33m##\033[0m::: \033[1;33m##\033[0m: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:\n";
909   print "'\033[1;33m####\033[0m: \033[1;33m##\033[0m::. \033[1;33m##\033[0m:. \033[1;33m######\033[0m:: \033[1;33m##\033[0m::::::::'\033[1;33m####\033[0m: \033[1;33m##\033[0m:::. \033[1;33m##\033[0m:. \033[1;33m######\033[0m:: \033[1;33m########\033[0m::\n";
910   print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
911 }
912
913 sub resolve_directory {
914         use File::Spec;
915         return File::Spec->rel2abs($_[0]);
916 }
917
918 sub yesno {
919         my ($flag,$prompt) = @_;
920         print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
921         chomp($tmp = <STDIN>);
922         if ($tmp eq "") { $tmp = $config{$flag} }
923
924         if (($tmp eq "") || ($tmp =~ /^y/i)) {
925                 $config{$flag} = "y";
926         } else {
927                 $config{$flag} = "n";
928         }
929         return;
930 }
931
932
933 sub write_static_makefile {
934         open(FH,">src/Makefile") or die("Could not write src/Makefile!");
935         print FH <<EOM;
936 # Insp Makefile :p
937 #
938 # (C) ChatSpike development team
939 # Makefile by <Craig\@ChatSpike.net>
940 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
941 #
942
943 CC = im a cheezeball
944
945 CXXFLAGS = -I../include \${FLAGS}
946
947 all: hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_util.o inspircd_io.o connection.o message.o commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o servers.o helperfuncs.o \$(MODULES) inspircd.exe
948
949 inspircd.exe: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h
950         \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_util.o inspircd_io.o connection.o message.o commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o servers.o helperfuncs.o hashcomp.o \$(MODULES)
951
952 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
953         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
954
955 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
956         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
957
958 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
959         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
960
961 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
962         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
963
964 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
965         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
966
967 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
968         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
969
970 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
971         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
972
973 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
974         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
975
976 inspircd_util.o: inspircd_util.cpp ../include/base.h ../include/inspircd_util.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
977         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_util.cpp
978
979 inspircd_io.o: inspircd_io.cpp ../include/base.h ../include/inspircd_io.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
980         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
981
982 connection.o: connection.cpp ../include/base.h ../include/connection.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
983         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c connection.cpp
984
985 message.o: message.cpp ../include/base.h ../include/message.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
986         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
987
988 commands.o: commands.cpp ../include/base.h ../include/commands.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
989         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
990
991 dnsqueue.o: dnsqueue.cpp ../include/base.h ../include/dnsqueue.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
992         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
993
994 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
995         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
996
997 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/connection.h
998         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
999
1000 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
1001         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1002
1003 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
1004         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1005
1006 servers.o: servers.cpp ../include/base.h ../include/servers.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/connection.h
1007         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c servers.cpp
1008
1009
1010 EOM
1011 close(FH);
1012 }
1013
1014 sub write_dynamic_makefile {
1015         open(FH,">src/Makefile") or die("Could not write src/Makefile");
1016         print FH <<EOM;
1017 # Insp Makefile :p
1018 #
1019 # (C) ChatSpike development team
1020 # Makefile by <Craig\@ChatSpike.net>
1021 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1022 #
1023
1024 CC = im a cheezeball
1025
1026 CXXFLAGS = -I../include \${FLAGS}
1027
1028 all: libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDutil.so libIRCDio.so libIRCDconnection.so libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDservers.so libIRCDhelper.so inspircd
1029
1030 inspircd: inspircd.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/channels.h ../include/globals.h ../include/inspircd_config.h
1031         \$(CC) -I../include \$(FLAGS) -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDutil.so libIRCDio.so libIRCDconnection.so libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDservers.so libIRCDhelper.so libIRCDhash.so
1032
1033 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1034         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1035         \$(CC) -shared -o libIRCDhash.so hashcomp.o
1036
1037 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1038         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1039         \$(CC) -shared -o libIRCDhelper.so helperfuncs.o
1040
1041 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1042         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1043         \$(CC) -shared -o libIRCDchannels.so channels.o
1044
1045 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
1046         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1047         \$(CC) -shared -o libIRCDmode.so mode.o
1048
1049 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
1050         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1051         \$(CC) -shared -o libIRCDxline.so xline.o
1052
1053 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
1054         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1055         \$(CC) -shared -o libIRCDstring.so inspstring.o
1056
1057 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
1058         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1059         \$(CC) -shared -o libIRCDasyncdns.so dns.o
1060
1061 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1062         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1063         \$(CC) -shared -o libIRCDbase.so base.o
1064
1065 libIRCDutil.so: inspircd_util.cpp ../include/base.h ../include/inspircd_util.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1066         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_util.cpp
1067         \$(CC) -shared -o libIRCDutil.so inspircd_util.o
1068
1069 libIRCDio.so: inspircd_io.cpp ../include/base.h ../include/inspircd_io.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1070         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1071         \$(CC) -shared -o libIRCDio.so inspircd_io.o
1072
1073 libIRCDconnection.so: connection.cpp ../include/base.h ../include/connection.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1074         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c connection.cpp
1075         \$(CC) -shared -o libIRCDconnection.so connection.o
1076
1077 libIRCDmessage.so: message.cpp ../include/base.h ../include/message.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1078         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1079         \$(CC) -shared -o libIRCDmessage.so message.o
1080
1081 libIRCDcommands.so: commands.cpp ../include/base.h ../include/commands.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1082         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1083         \$(CC) -shared -o libIRCDcommands.so commands.o
1084
1085 libIRCDdnsqueue.so: dnsqueue.cpp ../include/base.h ../include/dnsqueue.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1086         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1087         \$(CC) -shared -o libIRCDdnsqueue.so dnsqueue.o
1088
1089 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
1090         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1091         \$(CC) -shared -o libIRCDdynamic.so dynamic.o
1092
1093 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/connection.h
1094         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1095         \$(CC) -shared -o libIRCDusers.so users.o
1096
1097 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
1098         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1099         \$(CC) -shared -o libIRCDmodules.so modules.o
1100
1101 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
1102         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1103         \$(CC) -shared -o libIRCDwildcard.so wildcard.o
1104
1105 libIRCDservers.so: servers.cpp ../include/base.h ../include/servers.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/connection.h
1106         \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c servers.cpp
1107         \$(CC) -shared -o libIRCDservers.so servers.o
1108
1109 EOM
1110 close(FH);
1111 }