2 # InspIRCd Configuration Script
4 # Copyright 2003 The ChatSpike Development Team
5 # <brain@chatspike.net>
6 # <Craig@chatspike.net>
8 # [14:21] Brain: <matrix impression> i know perl-fu!
12 ########################################
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{BASE_DIR} = $config{ME}; # Use CWD as 'Base' Directory.
20 $config{CONFIG_DIR} = resolve_directory($config{ME}."/conf"); # Configuration Directory
21 $config{MODULE_DIR} = resolve_directory($config{ME}."/modules"); # Modules Directory
22 $config{BINARY_DIR} = resolve_directory($config{ME}."/bin"); # Binary Directory
23 $config{LIBRARY_DIR} = resolve_directory($config{ME}."/lib"); # Library Directory
24 chomp($config{HAS_GNUTLS} = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
25 $config{USE_GNUTLS} = "n"; # Use.
26 $config{OPTIMITEMP} = "0"; # Default Optimisation Value
27 $config{OPTIMISATI} = "-g"; # Optimisation Flag
28 $config{NICK_LENGT} = "31"; # Default Nick Length
29 $config{CHAN_LENGT} = "64"; # Default Channel Name Length
30 $config{MAX_CHANNE} = "20"; # Default Max. Channels per user
31 $config{MAX_OPERCH} = "60"; # Default Max. Channels per oper
32 $config{MAXI_MODES} = "20"; # Default Max. Number of Modes set at once.
33 $config{HAS_STRLCPY} = "false"; # strlcpy Check.
34 $config{USE_KQUEUE} = "y"; # kqueue enabled
35 $config{USE_EPOLL} = "y"; # epoll enabled
36 $config{THREADED_DNS} = "n"; # threaded dns (experimental)
37 $config{STATIC_LINK} = "no"; # are doing static modules?
38 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
39 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
40 chomp($config{GCCVER} = `gcc -dumpversion | cut -c 1`); # Major GCC Version
41 chomp($config{GCC34} = `gcc -dumpversion | cut -c 3`); # Minor GCC Version
42 chomp($config{OSNAME} = `/bin/uname`); # Operating System Name
43 $config{CC} = "g++"; # C++ compiler
44 $config{MAKEORDER} = "ircd mods config bininst"; # build order
45 $config{STATICLIBS} = ""; # library archive path
46 $config{MAX_IDENT} = "12"; # max ident size
47 $config{MAX_QUIT} = "255"; # max quit message size
48 $config{MAX_TOPIC} = "307"; # max topic size
49 $config{MAX_KICK} = "255"; # max kick message size
50 $config{MAX_GECOS} = "128"; # max GECOS size
51 $config{MAX_AWAY} = "200"; # max AWAY size
53 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
54 chomp($config{OSNAME} = `/usr/bin/uname`);
55 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
56 $config{OSNAME} = "Unknown";
60 if (!$config{MAX_CLIENT_T}) {
61 $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
62 $fd_scan_fail = "true"; # Used Later
65 # Get and Set some important vars..
68 my $arg = $ARGV[0]; # Do Some Argument Checks..
69 if ($arg eq "-clean") { `rm -rf .config.cache`; } # Remove the config.cache file.
71 if ($arg eq "-update") {
72 # Does the cache file exist?
74 # No, No it doesn't.. *BASH*
75 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
78 # We've Loaded the cache file and all our variables..
79 print "Updating Files..\n";
81 $has_epoll = $config{HAS_EPOLL};
82 $has_kqueue = $config{HAS_KQUEUE};
89 if ($arg eq "-modupdate") {
90 # Does the cache file exist?
92 # No, No it doesn't.. *BASH*
93 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
96 # We've Loaded the cache file and all our variables..
97 print "Updating Files..\n";
99 $has_epoll = $config{HAS_EPOLL};
100 $has_kqueue = $config{HAS_KQUEUE};
101 if ($config{OSNAME} =~ /CYGWIN/) {
102 write_static_modules_makefile();
104 write_dynamic_modules_makefile();
111 print "Checking for cache from previous configure...\n";
113 print "Checking operating system version...\n";
116 if (!$config{MAX_CLIENT}) {
117 # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
118 # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
119 # higher than the found value" :))
120 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
123 printf "Checking if strlcpy exists... ";
124 # Perform the strlcpy() test..
125 $config{HAS_STRLCPY} = "false";
127 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
130 while (chomp($line = <STRLCPY>))
132 # try and find the delcaration of:
133 # size_t strlcpy(...)
134 if ($line =~ /size_t(\0x9|\s)+strlcpy/)
136 $config{HAS_STRLCPY} = "true";
141 print "yes\n" if $config{HAS_STRLCPY} eq "true";
142 print "no\n" if $config{HAS_STRLCPY} eq "false";
144 printf "Checking if kqueue exists... ";
147 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
150 while (chomp($line = <KQUEUE>))
152 # try and find the delcaration of:
154 if ($line =~ /int(\0x9|\s)+kqueue/)
161 print "yes\n" if $has_kqueue == 1;
162 print "no\n" if $has_kqueue == 0;
164 printf "Checking if epoll exists... ";
167 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
170 while (chomp($line = <EPOLL>))
172 # try and find the declaration of:
173 # extern int epoll_create (int __size) __THROW;
174 if (($line =~ /int(\0x9|\s)+epoll_create(\0x9|\s)+\(/) || ($line =~ /int(\0x9|\s)+epoll_create\(/))
182 my $kernel = `uname -r`;
184 if (($kernel =~ /2\.0/) || ($kernel =~ /2\.2/) || ($kernel =~ /2\.4/)) {
188 print "yes\n" if $has_epoll == 1;
189 print "no\n" if $has_epoll == 0;
191 if ($config{OSNAME} =~ /CYGWIN/) {
192 $config{HAS_STRLCPY} = "true";
195 $config{HAS_EPOLL} = $has_epoll;
196 $config{HAS_KQUEUE} = $has_kqueue;
198 printf "Checking for libgnutls... ";
199 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
201 $config{HAS_GNUTLS} = "y";
204 $config{HAS_GNUTLS} = "n";
207 ################################################################################
208 # BEGIN INTERACTIVE PART #
209 ################################################################################
213 # Display Splash Logo..
215 chomp($wholeos = `uname -mnr`);
217 # Display Introduction Message..
219 Welcome to the InspIRCd Configuration program!
221 *** If you are unsure of any of these values, leave it blank for ***
222 *** standard settings that will work, and your server will run ***
223 *** using them. If you are running this server as part of a ***
224 *** larger network, you must consult with your network admins ***
225 *** for the proper values to use, or server links will be unstable! ***
227 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
228 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
229 dir, otherwise you won't have a config file!
231 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos), fdmax: $config{MAX_CLIENT_T}\n\n";
233 $config{CHANGE_COMPILER} = "n";
234 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";
236 if ($config{GCCVER} < 3)
238 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
239 should NOT be used. You should probably specify a newer compiler.\n";
241 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
242 if ($config{CHANGE_COMPILER} =~ /y/i)
244 print "What command do you want to use to invoke your compiler?\n";
245 print "[\033[1;32m$config{CC}\033[0m] -> ";
246 chomp($config{CC} = <STDIN>);
247 if ($config{CC} eq "") { $config{CC} = "g++"; }
248 chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
250 chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change
251 chomp($config{GCC34} = `$config{CC} -dumpversion | cut -c 3`); # the compiler path
252 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.$config{GCC34}\033[0m)\n";
256 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
262 # Directory Settings..
263 my $tmpbase = $config{BASE_DIR};
264 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
265 if ($tmpbase ne $config{BASE_DIR}) {
266 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
267 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
268 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
269 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
272 dir_check("are the configuration files", "CONFIG_DIR");
273 dir_check("are the modules to be compiled to", "MODULE_DIR");
274 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
275 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
278 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?");
282 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?");
285 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
288 print "No high-performance socket engines are available, or you chose\n";
289 print "not to enable one. Defaulting to select() engine.\n\n";
292 yesno(THREADED_DNS,"Would you like to enable the experimental multi-threaded DNS lookup?");
295 if ($config{HAS_GNUTLS} eq "y") {
296 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
299 print "\nThe following questions will ask you for various figures relating\n";
300 print "To your IRCd install. Please note that these should usually be left\n";
301 print "as defaults unless you have a real reason to change them. If they\n";
302 print "changed, then the values must be identical on all servers on your\n";
303 print "network, or malfunctions and/or crashes may occur, with the exception\n";
304 print "of the 'maximum number of clients' setting which may be different on\n";
305 print "different servers on the network.\n\n";
307 # File Descriptor Settings..
310 print "Maximum number of clients at any one time ($config{MAX_CLIENT_T})\n";
311 print "[\033[1;32m$config{MAX_CLIENT}\033[0m] -> ";
312 chomp($var = <STDIN>);
313 if ($var eq "") { $var = $config{MAX_CLIENT}; }
314 if ($var =~ /^\d+$/) {
315 if (($var > $config{MAX_CLIENT_T}) && ($fd_scan_failed ne true)) {
316 # Client has entered a larger number than the 'discovered' value
318 print "WARNING: Our scans have indicated that you are attempting
319 to use more sockets than there are avaliable. Are you sure
320 you wish to do this? It may cause the IRCd to malfunction [y/n]
321 [\033[1;32mn\033[0m] -> $c";
322 chomp($tmp = <STDIN>);
324 print "Please enter the correct value.\n\n";
329 print "You must enter a number in this field. Please try again.\n\n";
332 # If we get here, we should be good to go.
333 $config{MAX_CLIENT} = $var;
340 print "What is the maximum length of nicknames?\n";
341 print "[\033[1;32m$config{NICK_LENGT}\033[0m] -> ";
342 chomp($var = <STDIN>);
343 if ($var eq "") { $var = $config{NICK_LENGT}; }
344 if ($var =~ /^\d+$/) {
345 # We don't care what the number is, set it and be on our way.
346 $config{NICK_LENGT} = $var;
350 print "You must enter a number in this field. Please try again.\n\n";
356 print "What is the maximum length of channel names?\n";
357 print "[\033[1;32m$config{CHAN_LENGT}\033[0m] -> ";
358 chomp($var = <STDIN>);
359 if ($var eq "") { $var = $config{CHAN_LENGT}; }
360 if ($var =~ /^\d+$/) {
361 # We don't care what the number is, set it and be on our way.
362 $config{CHAN_LENGT} = $var;
366 print "You must enter a number in this field. Please try again.\n\n";
372 print "What is the maximum number of channels a normal user may join at any one time?\n";
373 print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
374 chomp($var = <STDIN>);
375 if ($var eq "") { $var = $config{MAX_CHANNE}; }
376 if ($var =~ /^\d+$/) {
377 # We don't care what the number is, set it and be on our way.
378 $config{MAX_CHANNE} = $var;
382 print "You must enter a number in this field. Please try again.\n\n";
388 print "What is the maximum number of channels an oper may join at any one time?\n";
389 print "[\033[1;32m$config{MAX_OPERCH}\033[0m] -> ";
390 chomp($var = <STDIN>);
391 if ($var eq "") { $var = $config{MAX_OPERCH}; }
392 if ($var =~ /^\d+$/) {
393 # We don't care what the number is, set it and be on our way.
394 $config{MAX_OPERCH} = $var;
402 print "What is the maximum number of mode changes in one line?\n";
403 print "[\033[1;32m$config{MAXI_MODES}\033[0m] -> ";
404 chomp($var = <STDIN>);
405 if ($var eq "") { $var = $config{MAXI_MODES}; }
406 if ($var =~ /^\d+$/) {
407 # We don't care what the number is, set it and be on our way.
408 $config{MAXI_MODES} = $var;
412 print "You must enter a number in this field. Please try again.\n\n";
418 print "What is the maximum length of an ident (username)?\n";
419 print "[\033[1;32m$config{MAX_IDENT}\033[0m] -> ";
420 chomp($var = <STDIN>);
421 if ($var eq "") { $var = $config{MAX_IDENT}; }
422 if ($var =~ /^\d+$/) {
423 # We don't care what the number is, set it and be on our way.
424 $config{MAX_IDENT} = $var;
428 print "You must enter a number in this field. Please try again.\n\n";
434 print "What is the maximum length of a quit message?\n";
435 print "[\033[1;32m$config{MAX_QUIT}\033[0m] -> ";
436 chomp($var = <STDIN>);
437 if ($var eq "") { $var = $config{MAX_QUIT}; }
438 if ($var =~ /^\d+$/) {
439 # We don't care what the number is, set it and be on our way.
440 $config{MAX_QUIT} = $var;
444 print "You must enter a number in this field. Please try again.\n\n";
450 print "What is the maximum length of a channel topic?\n";
451 print "[\033[1;32m$config{MAX_TOPIC}\033[0m] -> ";
452 chomp($var = <STDIN>);
453 if ($var eq "") { $var = $config{MAX_TOPIC}; }
454 if ($var =~ /^\d+$/) {
455 # We don't care what the number is, set it and be on our way.
456 $config{MAX_TOPIC} = $var;
460 print "You must enter a number in this field. Please try again.\n\n";
466 print "What is the maximum length of a kick message?\n";
467 print "[\033[1;32m$config{MAX_KICK}\033[0m] -> ";
468 chomp($var = <STDIN>);
469 if ($var eq "") { $var = $config{MAX_KICK}; }
470 if ($var =~ /^\d+$/) {
471 # We don't care what the number is, set it and be on our way.
472 $config{MAX_KICK} = $var;
476 print "You must enter a number in this field. Please try again.\n\n";
482 print "What is the maximum length of a GECOS (real name) field?\n";
483 print "[\033[1;32m$config{MAX_GECOS}\033[0m] -> ";
484 chomp($var = <STDIN>);
485 if ($var eq "") { $var = $config{MAX_GECOS}; }
486 if ($var =~ /^\d+$/) {
487 # We don't care what the number is, set it and be on our way.
488 $config{MAX_GECOS} = $var;
492 print "You must enter a number in this field. Please try again.\n\n";
498 print "What is the maximum length of an away message?\n";
499 print "[\033[1;32m$config{MAX_AWAY}\033[0m] -> ";
500 chomp($var = <STDIN>);
501 if ($var eq "") { $var = $config{MAX_AWAY}; }
502 if ($var =~ /^\d+$/) {
503 # We don't care what the number is, set it and be on our way.
504 $config{MAX_AWAY} = $var;
508 print "You must enter a number in this field. Please try again.\n\n";
513 print "Enter the Level Of Binary optimisation. This is a number between 0 and 3.
514 The InspIRCd Team will NOT support any bug reports above 0. Also note,
515 the IRCd behaviour will be different depending on this value. Please
516 read the documentation for more information.
518 The higher the number, the more optimised your binary will be. This
519 value will default to 0 if you either don't enter a number, or enter
520 a value outside the range.
522 As always, if you are unsure, just press enter and accept the default.\n\n";
523 print "[\033[1;32m$config{OPTIMITEMP}\033[0m] -> ";
524 chomp($var = <STDIN>);
526 $var = $config{OPTIMITEMP};
530 $config{OPTIMITEMP} = 1;
531 $config{OPTIMISATI} = "-O";
532 } elsif ($var eq "2") {
533 $config{OPTIMITEMP} = 2;
534 $config{OPTIMISATI} = "-O2";
535 } elsif ($var eq "3") {
536 $config{OPTIMITEMP} = 3;
537 $config{OPTIMISATI} = "-O3";
539 $config{OPTIMITEMP} = 0;
540 $config{OPTIMISATI} = "-g";
543 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
544 print "\033[0mBase install path:\033[1;32m\t\t$config{BASE_DIR}\n";
545 print "\033[0mConfig path:\033[1;32m\t\t\t$config{CONFIG_DIR}\n";
546 print "\033[0mModule path:\033[1;32m\t\t\t$config{MODULE_DIR}\n";
547 print "\033[0mLibrary path:\033[1;32m\t\t\t$config{LIBRARY_DIR}\n";
548 print "\033[0mMax connections:\033[1;32m\t\t$config{MAX_CLIENT}\n";
549 print "\033[0mMax User Channels:\033[1;32m\t\t$config{MAX_CHANNE}\n";
550 print "\033[0mMax Oper Channels:\033[1;32m\t\t$config{MAX_OPERCH}\n";
551 print "\033[0mMax nickname length:\033[1;32m\t\t$config{NICK_LENGT}\n";
552 print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
553 print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
554 print "\033[0mMax ident length:\033[1;32m\t\t$config{MAX_IDENT}\n";
555 print "\033[0mMax quit length:\033[1;32m\t\t$config{MAX_QUIT}\n";
556 print "\033[0mMax topic length:\033[1;32m\t\t$config{MAX_TOPIC}\n";
557 print "\033[0mMax kick length:\033[1;32m\t\t$config{MAX_KICK}\n";
558 print "\033[0mMax name length:\033[1;32m\t\t$config{MAX_GECOS}\n";
559 print "\033[0mMax away length:\033[1;32m\t\t$config{MAX_AWAY}\n";
560 print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
561 print "\033[0mOptimatizaton Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
562 print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n";
563 print "\033[0mStatic modules:\033[1;32m\t\t\t$config{STATIC_LINK}\033[0m\n";
564 print "\033[0mMultithread DNS:\033[1;32m\t\t$config{THREADED_DNS}\033[0m\n\n";
566 if ($config{USE_GNUTLS} eq "y") {
567 `cp src/modules/extra/m_ssl_gnutls.cpp src/modules/m_ssl_gnutls.cpp`;
569 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
571 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
574 print "SSL Certificates Not found, Generating.. \n\n
575 *************************************************************
576 * Generating the Private Key may take some time, go grab a *
577 * Coffee. Even better, to generate some more entropy if it *
578 * is taking a while, open another console and type du / a *
579 * few times and get that HD going :) Then answer the *
580 * Questions which follow. If you are unsure, just hit enter *
581 *************************************************************\n\n";
582 system("certtool --generate-privkey --outfile key.pem");
583 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
584 print "\nCertificate generation complete, copying to config directory... ";
585 `mv key.pem $config{CONFIG_DIR}/key.pem`;
586 `mv cert.pem $config{CONFIG_DIR}/cert.pem`;
589 print "SSL Certificates found, skipping."
597 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
598 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
599 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
600 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";
602 if ($config{OSNAME} =~ /CYGWIN/) {
604 \033[1;32mWARNING!\033[0m CYGWIN does not properly support shared modules,
605 so modules will be compiled statically into the core of the ircd. The modules
606 will act like they are being loaded from disk and being unloaded from RAM,
607 however they are in fact being enabled and disabled similar to features in
612 if ($config{GCCVER} < "3") {
614 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
615 GCC 2.x series compilers only had partial (read as broken) C++ support, and
616 your compile will most likely fail horribly! If you have any problems, do NOT
617 report them to the bugtracker or forums without first upgrading your compiler
618 to a newer 3.x or 4.x (or whatever is available currently) version.
622 ################################################################################
624 ################################################################################
626 # Retrieves the .config.cache file, and loads values into the main config hash.
627 open(CACHE, ".config.cache") or return undef;
631 # Ignore Blank lines, and comments..
635 my ($key, $value) = split("=", $_);
636 $value =~ /^\"(.*)\"$/;
637 # Do something with data here!
645 # Dump the contents of %config
646 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
647 open(FILEHANDLE, ">.config.cache");
648 foreach $key (keys %config)
650 print FILEHANDLE "$key=\"$config{$key}\"\n";
656 my ($desc, $hash_key) = @_;
659 print "In what directory $desc?\n";
660 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
661 chomp($var = <STDIN>);
662 if ($var eq "") { $var = $config{$hash_key}; }
663 if ($var =~ /^\~\/(.+)$/) {
664 # Convert it to a full path..
665 $var = resolve_directory($ENV{HOME} . "/" . $1);
667 if (substr($var,0,1) ne "/")
669 # Assume relative Path was given.. fill in the rest.
670 $var = $this . "/$var";
672 $var = resolve_directory($var);
674 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
675 chomp($tmp = <STDIN>);
676 if (($tmp eq "") || ($tmp =~ /^y/i)) {
677 # Attempt to Create the Dir..
678 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
680 print "Unable to create directory. ($var)\n\n";
685 # They said they don't want to create, and we can't install there.
691 # Target exists, but is not a directory.
692 print "File $var exists, but is not a directory.\n\n";
696 # Either Dir Exists, or was created fine.
697 $config{$hash_key} = $var;
704 if ($config{OSNAME} =~ /BSD$/) {
705 $config{LDLIBS} = "-Ldl -lstdc++";
706 $config{FLAGS} = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
707 $config{MAKEPROG} = "gmake";
708 if ($config{OSNAME} eq "OpenBSD") {
709 chomp($foo = `eg++ -dumpversion | cut -c 1`);
710 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
711 # if theyre not running this, configure lets the build continue but they probably wont manage to
712 # compile as this standard version is 2.95.3!
714 $config{CC} = "eg++";
715 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
716 chomp($config{GCC34} = `eg++ -dumpversion | cut -c 3`); # the compiler path
720 $config{LDLIBS} = "-ldl -lstdc++";
721 $config{FLAGS} = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
722 $config{MAKEPROG} = "make";
723 if ($config{OSNAME} =~ /CYGWIN/) {
724 $config{FLAGS} = "-frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
725 $config{LDLIBS} = "";
726 $config{MAKEPROG} = "/usr/bin/make";
727 $config{MAKEORDER} = "mods ircd config bininst";
728 $config{STATICLIBS} = "modules/mods.a";
729 $config{STATIC_LINK} = "yes";
732 if ($config{OSNAME} =~ /SunOS/) {
733 # solaris/sunos needs these
734 # socket = bsd sockets api
736 # rt = POSIX realtime extensions
737 # resolv = inet_aton only (why isnt this in nsl?!)
738 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
756 opendir(DIRHANDLE, "src/modules");
757 foreach $name (sort readdir(DIRHANDLE)) {
758 if ($name =~ /^m_(.+)\.cpp$/)
761 if ($mod !~ /_static$/) {
762 $modlist[$i++] = $mod;
771 print "Writing \033[1;32minspircd_config.h\033[0m\n";
772 # First File.. inspircd_config.h
773 chomp(my $incos = `uname -n -s -r`);
774 chomp(my $version = `sh ./src/version.sh`);
775 open(FILEHANDLE, ">include/inspircd_config.h");
776 my $NL = $config{NICK_LENGT}+1;
777 my $CL = $config{CHAN_LENGT}+1;
778 print FILEHANDLE <<EOF;
779 /* Auto generated by configure, do not modify! */
780 #ifndef __CONFIGURATION_AUTO__
781 #define __CONFIGURATION_AUTO__
783 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
784 #define MOD_PATH "$config{MODULE_DIR}"
785 #define VERSION "$version"
786 #define MAXCLIENTS $config{MAX_CLIENT}
787 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
790 #define MAXCHANS $config{MAX_CHANNE}
791 #define OPERMAXCHANS $config{MAX_OPERCH}
792 #define MAXMODES $config{MAXI_MODES}
793 #define IDENTMAX $config{MAX_IDENT}
794 #define MAXQUIT $config{MAX_QUIT}
795 #define MAXTOPIC $config{MAX_TOPIC}
796 #define MAXKICK $config{MAX_KICK}
797 #define MAXGECOS $config{MAX_GECOS}
798 #define MAXAWAY $config{MAX_AWAY}
799 #define OPTIMISATION $config{OPTIMITEMP}
800 #define SYSTEM "$incos"
804 if ($config{OSNAME} =~ /SunOS/) {
805 print FILEHANDLE "#define IS_SOLARIS\n";
807 if ($config{OSNAME} =~ /CYGWIN/) {
808 print FILEHANDLE "#define IS_CYGWIN\n";
809 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
811 if ($config{STATIC_LINK} eq "yes") {
812 print FILEHANDLE "#define STATIC_LINK\n";
814 if ($config{GCCVER} > 3) {
815 print FILEHANDLE "#define GCC3\n";
816 print FILEHANDLE "#define GCC34\n";
820 if ($config{GCCVER} == 3) {
821 print FILEHANDLE "#define GCC3\n";
822 if ($config{GCC34} > 3) {
823 print FILEHANDLE "#define GCC34\n";
827 if ($config{HAS_STRLCPY} eq "true") {
828 print FILEHANDLE "#define HAS_STRLCPY\n";
830 if ($config{THREADED_DNS} =~ /y/i) {
831 print FILEHANDLE "#define THREADED_DNS\n";
834 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
835 print FILEHANDLE "#define USE_KQUEUE\n";
838 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
839 print FILEHANDLE "#define USE_EPOLL\n";
842 # user didn't choose either epoll or select for their OS.
843 # default them to USE_SELECT (ewwy puke puke)
845 print FILEHANDLE "#define USE_SELECT\n";
847 print FILEHANDLE "\n#endif\n";
850 # Create a Modules List..
852 foreach $i (@modlist)
854 if ($config{OSNAME} =~ /CYGWIN/) {
855 $modules .= "m_".$i.".o ";
858 $modules .= "m_".$i.".so ";
861 chomp($modules); # Remove Redundant whitespace..
864 # Write all .in files.
867 my $exe = "inspircd";
869 if ($config{OSNAME} =~ /CYGWIN/) {
870 $exe = "inspircd.exe";
873 opendir(DIRHANDLE, $this);
874 if ($config{THREADED_DNS} =~ /y/i) {
875 $config{LDLIBS} = $config{LDLIBS} . " -pthread";
877 foreach $name (sort readdir(DIRHANDLE)) {
878 if ($name =~ /^\.(.+)\.inc$/)
881 # All .name.inc files need parsing!
883 open(FILEHANDLE, ".$file.inc");
884 while (<FILEHANDLE>) {
889 $tmp =~ s/\@CC\@/$config{CC}/;
890 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
891 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
892 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
893 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
894 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
895 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
896 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
897 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
898 $tmp =~ s/\@MODULES\@/$modules/;
899 $tmp =~ s/\@EXECUTABLE\@/$exe/;
900 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
901 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
903 print "Writing \033[1;32m$file\033[0m\n";
904 open(FILEHANDLE, ">$file");
905 print FILEHANDLE $tmp;
910 # Make inspircd executable!
911 chmod 0744, 'inspircd';
913 if ($config{OSNAME} =~ /CYGWIN/) {
914 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
915 write_static_makefile();
916 write_static_modules_makefile();
919 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
920 write_dynamic_makefile();
921 write_dynamic_modules_makefile();
925 sub getcompilerflags {
929 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
942 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
952 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";
953 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";
954 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";
955 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";
956 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";
957 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";
958 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";
959 print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
962 sub resolve_directory {
964 return File::Spec->rel2abs($_[0]);
968 my ($flag,$prompt) = @_;
969 print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
970 chomp($tmp = <STDIN>);
971 if ($tmp eq "") { $tmp = $config{$flag} }
973 if (($tmp eq "") || ($tmp =~ /^y/i)) {
974 $config{$flag} = "y";
976 $config{$flag} = "n";
981 sub write_static_modules_makefile {
983 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
984 open(FILEHANDLE, ">src/modules/Makefile");
987 # Module Makefile Header
989 print FILEHANDLE <<EOF;
990 # (C) ChatSpike development team
991 # Makefile by <Craig\@ChatSpike.net>
992 # Many Thanks to Andrew Church <achurch\@achurch.org>
993 # for assisting with making this work right.
995 # Automatically Generated by ./configure to add a modules
996 # please run ./configure --update
1002 # End Module Makefile Header
1005 # Create a Modules List..
1010 open(MODLIST,">include/modlist.h");
1013 # Include File Header
1015 print MODLIST <<HEADER;
1016 // Generated automatically by configure. DO NOT EDIT!
1018 #ifndef __SYMBOLS__H_CONFIGURED__
1019 #define __SYMBOLS__H_CONFIGURED__
1023 # End Include File Header
1026 # Place Module List into Include
1027 foreach $i (@modlist) {
1028 if ($i !~ /_static$/) {
1029 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1032 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1037 foreach $i (@modlist)
1039 if ($i !~ /_static$/) {
1040 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1041 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1043 print FILEHANDLE <<EOCHEESE;
1045 # Write Entry to the MakeFile
1047 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h
1048 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
1049 mv m_$i\_static.o ../m_$i.o
1053 # End Write Entry to the MakeFile
1055 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1056 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1057 open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
1058 while (chomp($a = <MODULE>)) {
1059 $a =~ s/init_module/$i\_init/g;
1060 $a =~ s/Srv/$i\Srv/g;
1061 print MUNGED "$a\n";
1065 print MODLIST <<EOENT;
1066 {"m_$i.so",\&$i\_init},
1071 print MODLIST "{0}};\n\n#endif\n";
1075 sub write_dynamic_modules_makefile {
1076 # Modules Makefile..
1077 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1078 open(FILEHANDLE, ">src/modules/Makefile");
1081 # Module Makefile Header
1083 print FILEHANDLE <<EOF;
1084 # (C) ChatSpike development team
1085 # Makefile by <Craig\@ChatSpike.net>
1086 # Many Thanks to Andrew Church <achurch\@achurch.org>
1087 # for assisting with making this work right.
1089 # Automatically Generated by ./configure to add a modules
1090 # please run ./configure --update
1096 # End Module Makefile Header
1099 # Create a Modules List..
1104 foreach $i (@modlist) {
1106 # Write Entry to the MakeFile
1108 print FILEHANDLE <<EOCHEESE;
1109 m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/inspircd_io.h
1110 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1111 \$(CC) \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o
1112 \@-rm -f \$(MODPATH)/m_$i.so
1113 install -v -m 0700 m_$i.so \$(MODPATH)
1117 # End Write Entry to the MakeFile
1123 sub write_static_makefile {
1124 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1127 opendir(DIRHANDLE, "src");
1128 foreach $name (sort readdir(DIRHANDLE)) {
1129 if ($name =~ /^cmd_(.+)\.cpp$/) {
1130 $cmdlist[$i++] = $1;
1133 closedir(DIRHANDLE);
1136 foreach my $cmd (@cmdlist) {
1137 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1138 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1143 # (C) ChatSpike development team
1144 # Makefile by <Craig\@ChatSpike.net>
1145 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1148 CC = im a cheezeball
1150 CXXFLAGS = -I../include \${FLAGS}
1152 all: aes.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o \$(MODULES) inspircd.exe
1154 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
1155 \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o hashcomp.o socket.o socketengine.o userprocess.o cull_list.o command_parse.o aes.o \$(MODULES)
1157 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
1158 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1160 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
1161 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1163 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1164 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1166 socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1167 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1169 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1170 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1172 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1173 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1175 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1176 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1178 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
1179 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1181 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
1182 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1184 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
1185 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1187 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
1188 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1190 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1191 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1193 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
1194 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1196 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
1197 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1199 commands.o: commands.cpp ../include/base.h ../include/commands.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h $srcobjs
1200 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1202 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
1203 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1205 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
1206 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1208 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
1209 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1211 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
1212 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1214 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
1215 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1217 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1218 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1220 aes.o: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1221 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1224 foreach my $cmd (@cmdlist) {
1226 cmd_$cmd.o: cmd_$cmd.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/cmd_$cmd.h
1227 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1233 sub write_dynamic_makefile {
1237 opendir(DIRHANDLE, "src");
1238 foreach $name (sort readdir(DIRHANDLE)) {
1239 if ($name =~ /^cmd_(.+)\.cpp$/) {
1240 $cmdlist[$i++] = $1;
1243 closedir(DIRHANDLE);
1247 foreach my $cmd (@cmdlist) {
1248 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1249 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1252 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1256 # (C) ChatSpike development team
1257 # Makefile by <Craig\@ChatSpike.net>
1258 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1261 CC = im a cheezeball
1263 CXXFLAGS = -I../include \${FLAGS}
1265 all: libIRCDaes.so libIRCDcull_list.so libIRCDuserprocess.so libIRCDsocketengine.so libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDio.so libIRCDmessage.so $cmdobjs libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so inspircd
1267 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
1268 \$(CC) -I../include -Wl,--rpath -Wl,$config{LIBRARY_DIR} \$(FLAGS) -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDio.so libIRCDmessage.so libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDhash.so libIRCDsocket.so libIRCDsocketengine.so libIRCDuserprocess.so libIRCDcull_list.so libIRCDcommand_parse.so libIRCDaes.so
1270 libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1271 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1272 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
1274 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
1275 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1276 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1278 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
1279 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1280 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1282 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1283 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1284 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1286 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1287 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1288 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1290 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1291 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1292 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1294 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1295 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1296 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1298 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
1299 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1300 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o
1302 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
1303 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1304 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1306 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
1307 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1308 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1310 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
1311 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1312 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1314 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1315 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1316 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1318 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
1319 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1320 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDio.so inspircd_io.o
1322 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
1323 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1324 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmessage.so message.o
1326 libIRCDcommands.so: commands.cpp ../include/base.h ../include/commands.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h $srcobjs
1327 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1328 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o $cmdobjs
1330 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
1331 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1332 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdnsqueue.so dnsqueue.o
1334 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
1335 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1336 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1338 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
1339 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1340 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1342 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
1343 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1344 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1346 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
1347 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1348 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1350 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1351 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1352 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1354 libIRCDaes.so: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1355 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1356 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDaes.so aes.o
1359 foreach my $cmd (@cmdlist) {
1361 cmd_$cmd.o: cmd_$cmd.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/cmd_$cmd.h
1362 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp