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 = $onfig{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 system("cp src/modules/extra/m_ssl_gnutls.cpp src/modules/m_ssl_gnutls.cpp");
570 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
572 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
575 print "SSL Certificates Not found, Generating.. \n\n
576 *************************************************************
577 * Generating the Private Key may take some time, go grab a *
578 * Coffee. Even better, to generate some more entropy if it *
579 * is taking a while, open another console and type du / a *
580 * few times and get that HD going :) Then answer the *
581 * Questions which follow. If you are unsure, just hit enter *
582 *************************************************************\n\n";
583 system("certtool --generate-privkey --outfile key.pem");
584 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
585 print "\nCertificate generation complete, copying to config directory... ";
586 system("mv key.pem $config{CONFIG_DIR}/key.pem");
587 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
590 print "SSL Certificates found, skipping."
598 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
599 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
600 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
601 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";
603 if ($config{OSNAME} =~ /CYGWIN/) {
605 \033[1;32mWARNING!\033[0m CYGWIN does not properly support shared modules,
606 so modules will be compiled statically into the core of the ircd. The modules
607 will act like they are being loaded from disk and being unloaded from RAM,
608 however they are in fact being enabled and disabled similar to features in
613 if ($config{GCCVER} < "3") {
615 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
616 GCC 2.x series compilers only had partial (read as broken) C++ support, and
617 your compile will most likely fail horribly! If you have any problems, do NOT
618 report them to the bugtracker or forums without first upgrading your compiler
619 to a newer 3.x or 4.x (or whatever is available currently) version.
623 ################################################################################
625 ################################################################################
627 # Retrieves the .config.cache file, and loads values into the main config hash.
628 open(CACHE, ".config.cache") or return undef;
632 # Ignore Blank lines, and comments..
636 my ($key, $value) = split("=", $_);
637 $value =~ /^\"(.*)\"$/;
638 # Do something with data here!
646 # Dump the contents of %config
647 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
648 open(FILEHANDLE, ">.config.cache");
649 foreach $key (keys %config)
651 print FILEHANDLE "$key=\"$config{$key}\"\n";
657 my ($desc, $hash_key) = @_;
660 print "In what directory $desc?\n";
661 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
662 chomp($var = <STDIN>);
663 if ($var eq "") { $var = $config{$hash_key}; }
664 if ($var =~ /^\~\/(.+)$/) {
665 # Convert it to a full path..
666 $var = resolve_directory($ENV{HOME} . "/" . $1);
668 if (substr($var,0,1) ne "/")
670 # Assume relative Path was given.. fill in the rest.
671 $var = $this . "/$var";
673 $var = resolve_directory($var);
675 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
676 chomp($tmp = <STDIN>);
677 if (($tmp eq "") || ($tmp =~ /^y/i)) {
678 # Attempt to Create the Dir..
679 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
681 print "Unable to create directory. ($var)\n\n";
686 # They said they don't want to create, and we can't install there.
692 # Target exists, but is not a directory.
693 print "File $var exists, but is not a directory.\n\n";
697 # Either Dir Exists, or was created fine.
698 $config{$hash_key} = $var;
705 if ($config{OSNAME} =~ /BSD$/) {
706 $config{LDLIBS} = "-Ldl -lstdc++";
707 $config{FLAGS} = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
708 $config{MAKEPROG} = "gmake";
709 if ($config{OSNAME} eq "OpenBSD") {
710 chomp($foo = `eg++ -dumpversion | cut -c 1`);
711 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
712 # if theyre not running this, configure lets the build continue but they probably wont manage to
713 # compile as this standard version is 2.95.3!
715 $config{CC} = "eg++";
716 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
717 chomp($config{GCC34} = `eg++ -dumpversion | cut -c 3`); # the compiler path
721 $config{LDLIBS} = "-ldl -lstdc++";
722 $config{FLAGS} = "-fPIC -frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
723 $config{MAKEPROG} = "make";
724 if ($config{OSNAME} =~ /CYGWIN/) {
725 $config{FLAGS} = "-frtti $OPTIMISATI -Wall -Woverloaded-virtual $config{OPTIMISATI}";
726 $config{LDLIBS} = "";
727 $config{MAKEPROG} = "/usr/bin/make";
728 $config{MAKEORDER} = "mods ircd config bininst";
729 $config{STATICLIBS} = "modules/mods.a";
730 $config{STATIC_LINK} = "yes";
733 if ($config{OSNAME} =~ /SunOS/) {
734 # solaris/sunos needs these
735 # socket = bsd sockets api
737 # rt = POSIX realtime extensions
738 # resolv = inet_aton only (why isnt this in nsl?!)
739 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
757 opendir(DIRHANDLE, "src/modules");
758 foreach $name (sort readdir(DIRHANDLE)) {
759 if ($name =~ /^m_(.+)\.cpp$/)
762 if ($mod !~ /_static$/) {
763 $modlist[$i++] = $mod;
772 print "Writing \033[1;32minspircd_config.h\033[0m\n";
773 # First File.. inspircd_config.h
774 chomp(my $incos = `uname -n -s -r`);
775 chomp(my $version = `sh ./src/version.sh`);
776 open(FILEHANDLE, ">include/inspircd_config.h");
777 my $NL = $config{NICK_LENGT}+1;
778 my $CL = $config{CHAN_LENGT}+1;
779 print FILEHANDLE <<EOF;
780 /* Auto generated by configure, do not modify! */
781 #ifndef __CONFIGURATION_AUTO__
782 #define __CONFIGURATION_AUTO__
784 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
785 #define MOD_PATH "$config{MODULE_DIR}"
786 #define VERSION "$version"
787 #define MAXCLIENTS $config{MAX_CLIENT}
788 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
791 #define MAXCHANS $config{MAX_CHANNE}
792 #define OPERMAXCHANS $config{MAX_OPERCH}
793 #define MAXMODES $config{MAXI_MODES}
794 #define IDENTMAX $config{MAX_IDENT}
795 #define MAXQUIT $config{MAX_QUIT}
796 #define MAXTOPIC $config{MAX_TOPIC}
797 #define MAXKICK $config{MAX_KICK}
798 #define MAXGECOS $config{MAX_GECOS}
799 #define MAXAWAY $config{MAX_AWAY}
800 #define OPTIMISATION $config{OPTIMITEMP}
801 #define SYSTEM "$incos"
805 if ($config{OSNAME} =~ /SunOS/) {
806 print FILEHANDLE "#define IS_SOLARIS\n";
808 if ($config{OSNAME} =~ /CYGWIN/) {
809 print FILEHANDLE "#define IS_CYGWIN\n";
810 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
812 if ($config{STATIC_LINK} eq "yes") {
813 print FILEHANDLE "#define STATIC_LINK\n";
815 if ($config{GCCVER} > 3) {
816 print FILEHANDLE "#define GCC3\n";
817 print FILEHANDLE "#define GCC34\n";
821 if ($config{GCCVER} == 3) {
822 print FILEHANDLE "#define GCC3\n";
823 if ($config{GCC34} > 3) {
824 print FILEHANDLE "#define GCC34\n";
828 if ($config{HAS_STRLCPY} eq "true") {
829 print FILEHANDLE "#define HAS_STRLCPY\n";
831 if ($config{THREADED_DNS} =~ /y/i) {
832 print FILEHANDLE "#define THREADED_DNS\n";
835 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
836 print FILEHANDLE "#define USE_KQUEUE\n";
839 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
840 print FILEHANDLE "#define USE_EPOLL\n";
843 # user didn't choose either epoll or select for their OS.
844 # default them to USE_SELECT (ewwy puke puke)
846 print FILEHANDLE "#define USE_SELECT\n";
848 print FILEHANDLE "\n#endif\n";
851 # Create a Modules List..
853 foreach $i (@modlist)
855 if ($config{OSNAME} =~ /CYGWIN/) {
856 $modules .= "m_".$i.".o ";
859 $modules .= "m_".$i.".so ";
862 chomp($modules); # Remove Redundant whitespace..
865 # Write all .in files.
868 my $exe = "inspircd";
870 if ($config{OSNAME} =~ /CYGWIN/) {
871 $exe = "inspircd.exe";
874 opendir(DIRHANDLE, $this);
875 if ($config{THREADED_DNS} =~ /y/i) {
876 $config{LDLIBS} = $config{LDLIBS} . " -pthread";
878 foreach $name (sort readdir(DIRHANDLE)) {
879 if ($name =~ /^\.(.+)\.inc$/)
882 # All .name.inc files need parsing!
884 open(FILEHANDLE, ".$file.inc");
885 while (<FILEHANDLE>) {
890 $tmp =~ s/\@CC\@/$config{CC}/;
891 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
892 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
893 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
894 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
895 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
896 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
897 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
898 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
899 $tmp =~ s/\@MODULES\@/$modules/;
900 $tmp =~ s/\@EXECUTABLE\@/$exe/;
901 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
902 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
904 print "Writing \033[1;32m$file\033[0m\n";
905 open(FILEHANDLE, ">$file");
906 print FILEHANDLE $tmp;
911 # Make inspircd executable!
912 chmod 0744, 'inspircd';
914 if ($config{OSNAME} =~ /CYGWIN/) {
915 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
916 write_static_makefile();
917 write_static_modules_makefile();
920 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
921 write_dynamic_makefile();
922 write_dynamic_modules_makefile();
926 sub getcompilerflags {
930 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
943 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
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::\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: \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:::: \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:\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::: \033[1;33m##\033[0m: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:\n";
959 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";
960 print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
963 sub resolve_directory {
965 return File::Spec->rel2abs($_[0]);
969 my ($flag,$prompt) = @_;
970 print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
971 chomp($tmp = <STDIN>);
972 if ($tmp eq "") { $tmp = $config{$flag} }
974 if (($tmp eq "") || ($tmp =~ /^y/i)) {
975 $config{$flag} = "y";
977 $config{$flag} = "n";
982 sub write_static_modules_makefile {
984 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
985 open(FILEHANDLE, ">src/modules/Makefile");
988 # Module Makefile Header
990 print FILEHANDLE <<EOF;
991 # (C) ChatSpike development team
992 # Makefile by <Craig\@ChatSpike.net>
993 # Many Thanks to Andrew Church <achurch\@achurch.org>
994 # for assisting with making this work right.
996 # Automatically Generated by ./configure to add a modules
997 # please run ./configure --update
1003 # End Module Makefile Header
1006 # Create a Modules List..
1011 open(MODLIST,">include/modlist.h");
1014 # Include File Header
1016 print MODLIST <<HEADER;
1017 // Generated automatically by configure. DO NOT EDIT!
1019 #ifndef __SYMBOLS__H_CONFIGURED__
1020 #define __SYMBOLS__H_CONFIGURED__
1024 # End Include File Header
1027 # Place Module List into Include
1028 foreach $i (@modlist) {
1029 if ($i !~ /_static$/) {
1030 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1033 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1038 foreach $i (@modlist)
1040 if ($i !~ /_static$/) {
1041 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1042 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1044 print FILEHANDLE <<EOCHEESE;
1046 # Write Entry to the MakeFile
1048 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h
1049 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
1050 mv m_$i\_static.o ../m_$i.o
1054 # End Write Entry to the MakeFile
1056 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1057 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1058 open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
1059 while (chomp($a = <MODULE>)) {
1060 $a =~ s/init_module/$i\_init/g;
1061 $a =~ s/Srv/$i\Srv/g;
1062 print MUNGED "$a\n";
1066 print MODLIST <<EOENT;
1067 {"m_$i.so",\&$i\_init},
1072 print MODLIST "{0}};\n\n#endif\n";
1076 sub write_dynamic_modules_makefile {
1077 # Modules Makefile..
1078 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1079 open(FILEHANDLE, ">src/modules/Makefile");
1082 # Module Makefile Header
1084 print FILEHANDLE <<EOF;
1085 # (C) ChatSpike development team
1086 # Makefile by <Craig\@ChatSpike.net>
1087 # Many Thanks to Andrew Church <achurch\@achurch.org>
1088 # for assisting with making this work right.
1090 # Automatically Generated by ./configure to add a modules
1091 # please run ./configure -update or ./configure -modupdate
1097 # End Module Makefile Header
1100 # Create a Modules List..
1105 foreach $i (@modlist) {
1107 # Write Entry to the MakeFile
1109 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1110 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1111 print FILEHANDLE <<EOCHEESE;
1112 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
1113 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1114 \$(CC) \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o
1115 \@-rm -f \$(MODPATH)/m_$i.so
1116 install -v -m 0700 m_$i.so \$(MODPATH)
1120 # End Write Entry to the MakeFile
1126 sub write_static_makefile {
1127 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1130 opendir(DIRHANDLE, "src");
1131 foreach $name (sort readdir(DIRHANDLE)) {
1132 if ($name =~ /^cmd_(.+)\.cpp$/) {
1133 $cmdlist[$i++] = $1;
1136 closedir(DIRHANDLE);
1139 foreach my $cmd (@cmdlist) {
1140 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1141 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1146 # (C) ChatSpike development team
1147 # Makefile by <Craig\@ChatSpike.net>
1148 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1151 CC = im a cheezeball
1153 CXXFLAGS = -I../include \${FLAGS}
1155 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
1157 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
1158 \$(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)
1160 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
1161 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1163 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
1164 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1166 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1167 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1169 socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1170 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1172 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1173 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1175 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1176 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1178 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1179 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1181 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
1182 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1184 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
1185 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1187 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
1188 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1190 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
1191 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1193 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1194 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1196 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
1197 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1199 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
1200 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1202 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
1203 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1205 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
1206 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1208 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
1209 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1211 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
1212 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1214 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
1215 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1217 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
1218 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1220 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1221 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1223 aes.o: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1224 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1227 foreach my $cmd (@cmdlist) {
1229 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
1230 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1236 sub write_dynamic_makefile {
1240 opendir(DIRHANDLE, "src");
1241 foreach $name (sort readdir(DIRHANDLE)) {
1242 if ($name =~ /^cmd_(.+)\.cpp$/) {
1243 $cmdlist[$i++] = $1;
1246 closedir(DIRHANDLE);
1250 foreach my $cmd (@cmdlist) {
1251 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1252 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1255 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1259 # (C) ChatSpike development team
1260 # Makefile by <Craig\@ChatSpike.net>
1261 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1264 CC = im a cheezeball
1266 CXXFLAGS = -I../include \${FLAGS}
1268 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
1270 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
1271 \$(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
1273 libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1274 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1275 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
1277 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
1278 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1279 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1281 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
1282 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1283 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1285 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1286 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1287 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1289 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1290 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1291 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1293 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1294 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1295 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1297 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1298 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1299 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1301 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
1302 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1303 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o
1305 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
1306 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1307 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1309 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
1310 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1311 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1313 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
1314 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1315 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1317 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1318 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1319 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1321 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
1322 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1323 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDio.so inspircd_io.o
1325 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
1326 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1327 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmessage.so message.o
1329 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
1330 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1331 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o $cmdobjs
1333 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
1334 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1335 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdnsqueue.so dnsqueue.o
1337 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
1338 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1339 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1341 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
1342 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1343 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1345 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
1346 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1347 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1349 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
1350 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1351 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1353 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1354 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1355 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1357 libIRCDaes.so: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1358 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1359 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDaes.so aes.o
1362 foreach my $cmd (@cmdlist) {
1364 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
1365 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp