3 # InspIRCd Configuration Script
5 # Copyright 2003 The ChatSpike Development Team
6 # <brain@chatspike.net>
7 # <Craig@chatspike.net>
9 # [14:21] Brain: <matrix impression> i know perl-fu!
13 ########################################
15 chomp($topdir = `pwd`);
16 $this = resolve_directory($topdir); # PWD, Regardless.
17 @modlist = (); # Declare for Module List..
18 %config = (); # Initiate Configuration Hash..
19 $config{ME} = resolve_directory($topdir); # Present Working Directory
20 $config{BASE_DIR} = $config{ME}; # Use CWD as 'Base' Directory.
21 $config{CONFIG_DIR} = resolve_directory($config{ME}."/conf"); # Configuration Directory
22 $config{MODULE_DIR} = resolve_directory($config{ME}."/modules"); # Modules Directory
23 $config{BINARY_DIR} = resolve_directory($config{ME}."/bin"); # Binary Directory
24 $config{LIBRARY_DIR} = resolve_directory($config{ME}."/lib"); # Library Directory
25 chomp($config{HAS_GNUTLS} = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
26 chomp($config{HAS_OPENSSL} = `openssl version 2>/dev/null`); # Openssl version
27 $config{USE_GNUTLS} = "n"; # Use gnutls.
28 $config{USE_OPENSSL} = "n"; # Use openssl.
29 $config{OPTIMITEMP} = "0"; # Default Optimisation Value
30 $config{OPTIMISATI} = "-g"; # Optimisation Flag
31 $config{NICK_LENGT} = "31"; # Default Nick Length
32 $config{CHAN_LENGT} = "64"; # Default Channel Name Length
33 $config{MAX_CHANNE} = "20"; # Default Max. Channels per user
34 $config{MAX_OPERCH} = "60"; # Default Max. Channels per oper
35 $config{MAXI_MODES} = "20"; # Default Max. Number of Modes set at once.
36 $config{HAS_STRLCPY} = "false"; # strlcpy Check.
37 $config{HAS_EXECINFO} = "0"; # execinfo.h Check.
38 $config{USE_KQUEUE} = "y"; # kqueue enabled
39 $config{USE_EPOLL} = "y"; # epoll enabled
40 $config{THREADED_DNS} = "n"; # threaded dns (experimental)
41 $config{IPV6} = "n"; # IPv6 support (experimental)
42 $config{STATIC_LINK} = "no"; # are doing static modules?
43 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
44 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
45 chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version
46 chomp($config{GCC34} = `g++ -dumpversion | cut -c 3`); # Minor GCC Version
47 chomp($config{OSNAME} = `/bin/uname`); # Operating System Name
48 $config{CC} = "g++"; # C++ compiler
49 $config{MAKEORDER} = "ircd mods"; # build order
50 $config{STATICLIBS} = ""; # library archive path
51 $config{MAX_IDENT} = "12"; # max ident size
52 $config{MAX_QUIT} = "255"; # max quit message size
53 $config{MAX_TOPIC} = "307"; # max topic size
54 $config{MAX_KICK} = "255"; # max kick message size
55 $config{MAX_GECOS} = "128"; # max GECOS size
56 $config{MAX_AWAY} = "200"; # max AWAY size
60 $config{HAS_OPENSSL} =~ /OpenSSL (\S+) \d+ \S+ \d{4}/;
61 $config{HAS_OPENSSL} = $1;
63 if ($config{GCCVER} eq "") {
64 print "g++ was not found! You require g++ (the GNU C++ compiler, part of GCC) to build InspIRCd!\n";
68 # Minihack! Convert Cygwin to 'Cyg-Static' so i can
69 # Keep my dynamic module experiments here for later
72 if ($config{OSNAME} =~ /CYGWIN/) {
73 $config{OSNAME} = "CYG-STATIC";
76 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
77 chomp($config{OSNAME} = `/usr/bin/uname`);
78 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
79 $config{OSNAME} = "Unknown";
83 if (!$config{MAX_CLIENT_T}) {
84 $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
85 $fd_scan_fail = "true"; # Used Later
88 # Get and Set some important vars..
91 my $arg = $ARGV[0]; # Do Some Argument Checks..
92 if ($arg eq "-clean") {
93 system("rm -rf .config.cache");
94 } # Remove the config.cache file.
96 if ($arg eq "-update") {
97 # Does the cache file exist?
99 # No, No it doesn't.. *BASH*
100 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
103 # We've Loaded the cache file and all our variables..
104 print "Updating Files..\n";
106 $has_epoll = $config{HAS_EPOLL};
107 $has_kqueue = $config{HAS_KQUEUE};
114 if ($arg eq "-svnupdate") {
116 open(FH,"<.svn/entries") or $fail = 1;
118 print "This is not an SVN copy of InspIRCd.\n";
121 system("svn update");
122 system("perl configure -update");
123 if ($ARGV[1] eq "rebuild") {
124 system("make install");
129 if ($arg eq "-modupdate") {
130 # Does the cache file exist?
132 # No, No it doesn't.. *BASH*
133 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
136 # We've Loaded the cache file and all our variables..
137 print "Updating Files..\n";
139 $has_epoll = $config{HAS_EPOLL};
140 $has_kqueue = $config{HAS_KQUEUE};
141 if ($config{STATIC_LINK} eq "yes") {
142 write_static_modules_makefile();
144 write_dynamic_modules_makefile();
151 print "Checking for cache from previous configure...\n";
153 print "Checking operating system version...\n";
156 if (!$config{MAX_CLIENT}) {
157 # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
158 # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
159 # higher than the found value" :))
160 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
163 printf "Checking if strlcpy exists... ";
164 # Perform the strlcpy() test..
165 $config{HAS_STRLCPY} = "false";
167 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
169 while (chomp($line = <STRLCPY>)) {
170 # try and find the delcaration of:
171 # size_t strlcpy(...)
172 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
173 $config{HAS_STRLCPY} = "true";
178 print "yes\n" if $config{HAS_STRLCPY} eq "true";
179 print "no\n" if $config{HAS_STRLCPY} eq "false";
181 printf "Checking if execinfo.h exists... ";
182 $config{HAS_EXECINFO} = "0";
184 open(EXECINFO, "</usr/include/execinfo.h") or $fail = 1;
187 open(EXECINFO, "</usr/local/include/execinfo.h") or $fail = 1;
189 printf "/usr/local/include/execinfo.h\n";
190 $config{HAS_EXECINFO} = "1";
194 printf "Not found!\n";
198 printf "/usr/include/execinfo.h\n";
199 $config{HAS_EXECINFO} = "1";
203 printf "Checking if kqueue exists... ";
206 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
208 while (chomp($line = <KQUEUE>)) {
209 # try and find the delcaration of:
211 if ($line =~ /int(\0x9|\s)+kqueue/) {
217 print "yes\n" if $has_kqueue == 1;
218 print "no\n" if $has_kqueue == 0;
220 printf "Checking if epoll exists... ";
223 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
229 my $kernel = `uname -r`;
231 if (($kernel =~ /2\.0/) || ($kernel =~ /2\.2/) || ($kernel =~ /2\.4/)) {
235 print "yes\n" if $has_epoll == 1;
236 print "no\n" if $has_epoll == 0;
238 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
239 $config{HAS_STRLCPY} = "true";
242 $config{HAS_EPOLL} = $has_epoll;
243 $config{HAS_KQUEUE} = $has_kqueue;
245 printf "Checking for libgnutls... ";
246 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
248 $config{HAS_GNUTLS} = "y";
251 $config{HAS_GNUTLS} = "n";
254 printf "Checking for openssl... ";
255 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
257 $config{HAS_OPENSSL} = "y";
260 $config{HAS_OPENSSL} = "n";
263 ################################################################################
264 # BEGIN INTERACTIVE PART #
265 ################################################################################
269 # Display Splash Logo..
271 chomp($wholeos = `uname -mnr`);
273 my $rev = getrevision();
274 # Display Introduction Message..
276 Welcome to the InspIRCd Configuration program!
278 *** If you are unsure of any of these values, leave it blank for ***
279 *** standard settings that will work, and your server will run ***
280 *** using them. If you are running this server as part of a ***
281 *** larger network, you must consult with your network admins ***
282 *** for the proper values to use, or server links will be unstable! ***
284 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
285 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
286 dir, otherwise you won't have a config file!
288 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos), fdmax: $config{MAX_CLIENT_T}
289 Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
291 print " (Non-SVN build)";
295 $config{CHANGE_COMPILER} = "n";
296 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";
298 while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
299 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
300 should NOT be used. You should probably specify a newer compiler.\n\n";
301 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
302 if ($config{CHANGE_COMPILER} =~ /y/i) {
303 print "What command do you want to use to invoke your compiler?\n";
304 print "[\033[1;32m$config{CC}\033[0m] -> ";
305 chomp($config{CC} = <STDIN>);
306 if ($config{CC} eq "") {
309 chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
311 chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change
312 chomp($config{GCC34} = `$config{CC} -dumpversion | cut -c 3`); # the compiler path
313 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.$config{GCC34}\033[0m)\n";
314 if ($config{GCCVER} < 3) {
315 print "\033[1;32mGCC 2.x WILL NOT WORK!\033[0m. Let's try that again, shall we?\n";
319 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
326 # Directory Settings..
327 my $tmpbase = $config{BASE_DIR};
328 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
329 if ($tmpbase ne $config{BASE_DIR}) {
330 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
331 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
332 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
333 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
336 dir_check("are the configuration files", "CONFIG_DIR");
337 dir_check("are the modules to be compiled to", "MODULE_DIR");
338 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
339 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
342 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?");
346 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?");
349 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
350 if (!$chose_hiperf) {
351 print "No high-performance socket engines are available, or you chose\n";
352 print "not to enable one. Defaulting to select() engine.\n\n";
355 yesno(THREADED_DNS,"Would you like to enable the experimental multi-threaded DNS lookup?");
358 yesno(IPV6,"Would you like to enable IPv6 support?");
361 if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
362 print "I have detected both GnuTLS and OpenSSL on your system.\n";
363 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
364 print "instead, you should enable the OpenSSL module yourself\n";
365 print "by copying it from src/modules/extra to src/modules.\n\n";
368 if ($config{HAS_GNUTLS} eq "y") {
369 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
370 if ($config{USE_GNUTLS} eq "y") {
371 print "\nUsing GnuTLS SSL module.\n";
373 } elsif ($config{HAS_OPENSSL} eq "y") {
374 yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
375 if ($config{USE_OPENSSL} eq "y") {
376 print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
380 print "\nThe following questions will ask you for various figures relating\n";
381 print "To your IRCd install. Please note that these should usually be left\n";
382 print "as defaults unless you have a real reason to change them. If they\n";
383 print "changed, then the values must be identical on all servers on your\n";
384 print "network, or malfunctions and/or crashes may occur, with the exception\n";
385 print "of the 'maximum number of clients' setting which may be different on\n";
386 print "different servers on the network.\n\n";
388 # File Descriptor Settings..
391 print "Maximum number of clients at any one time ($config{MAX_CLIENT_T})\n";
392 print "[\033[1;32m$config{MAX_CLIENT}\033[0m] -> ";
393 chomp($var = <STDIN>);
395 $var = $config{MAX_CLIENT};
397 if ($var =~ /^\d+$/) {
398 if (($var > $config{MAX_CLIENT_T}) && ($fd_scan_failed ne true)) {
399 # Client has entered a larger number than the 'discovered' value
401 print "WARNING: Our scans have indicated that you are attempting
402 to use more sockets than there are avaliable. Are you sure
403 you wish to do this? It may cause the IRCd to malfunction [y/n]
404 [\033[1;32mn\033[0m] -> $c";
405 chomp($tmp = <STDIN>);
407 print "Please enter the correct value.\n\n";
412 print "You must enter a number in this field. Please try again.\n\n";
415 # If we get here, we should be good to go.
416 $config{MAX_CLIENT} = $var;
423 print "What is the maximum length of nicknames?\n";
424 print "[\033[1;32m$config{NICK_LENGT}\033[0m] -> ";
425 chomp($var = <STDIN>);
427 $var = $config{NICK_LENGT};
429 if ($var =~ /^\d+$/) {
430 # We don't care what the number is, set it and be on our way.
431 $config{NICK_LENGT} = $var;
435 print "You must enter a number in this field. Please try again.\n\n";
441 print "What is the maximum length of channel names?\n";
442 print "[\033[1;32m$config{CHAN_LENGT}\033[0m] -> ";
443 chomp($var = <STDIN>);
445 $var = $config{CHAN_LENGT};
447 if ($var =~ /^\d+$/) {
448 # We don't care what the number is, set it and be on our way.
449 $config{CHAN_LENGT} = $var;
453 print "You must enter a number in this field. Please try again.\n\n";
459 print "What is the maximum number of channels a normal user may join at any one time?\n";
460 print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
461 chomp($var = <STDIN>);
463 $var = $config{MAX_CHANNE};
465 if ($var =~ /^\d+$/) {
466 # We don't care what the number is, set it and be on our way.
467 $config{MAX_CHANNE} = $var;
471 print "You must enter a number in this field. Please try again.\n\n";
477 print "What is the maximum number of channels an oper may join at any one time?\n";
478 print "[\033[1;32m$config{MAX_OPERCH}\033[0m] -> ";
479 chomp($var = <STDIN>);
481 $var = $config{MAX_OPERCH};
483 if ($var =~ /^\d+$/) {
484 # We don't care what the number is, set it and be on our way.
485 $config{MAX_OPERCH} = $var;
493 print "What is the maximum number of mode changes in one line?\n";
494 print "[\033[1;32m$config{MAXI_MODES}\033[0m] -> ";
495 chomp($var = <STDIN>);
497 $var = $config{MAXI_MODES};
499 if ($var =~ /^\d+$/) {
500 # We don't care what the number is, set it and be on our way.
501 $config{MAXI_MODES} = $var;
505 print "You must enter a number in this field. Please try again.\n\n";
511 print "What is the maximum length of an ident (username)?\n";
512 print "[\033[1;32m$config{MAX_IDENT}\033[0m] -> ";
513 chomp($var = <STDIN>);
515 $var = $config{MAX_IDENT};
517 if ($var =~ /^\d+$/) {
518 # We don't care what the number is, set it and be on our way.
519 $config{MAX_IDENT} = $var;
523 print "You must enter a number in this field. Please try again.\n\n";
529 print "What is the maximum length of a quit message?\n";
530 print "[\033[1;32m$config{MAX_QUIT}\033[0m] -> ";
531 chomp($var = <STDIN>);
533 $var = $config{MAX_QUIT};
535 if ($var =~ /^\d+$/) {
536 # We don't care what the number is, set it and be on our way.
537 $config{MAX_QUIT} = $var;
541 print "You must enter a number in this field. Please try again.\n\n";
547 print "What is the maximum length of a channel topic?\n";
548 print "[\033[1;32m$config{MAX_TOPIC}\033[0m] -> ";
549 chomp($var = <STDIN>);
551 $var = $config{MAX_TOPIC};
553 if ($var =~ /^\d+$/) {
554 # We don't care what the number is, set it and be on our way.
555 $config{MAX_TOPIC} = $var;
559 print "You must enter a number in this field. Please try again.\n\n";
565 print "What is the maximum length of a kick message?\n";
566 print "[\033[1;32m$config{MAX_KICK}\033[0m] -> ";
567 chomp($var = <STDIN>);
569 $var = $config{MAX_KICK};
571 if ($var =~ /^\d+$/) {
572 # We don't care what the number is, set it and be on our way.
573 $config{MAX_KICK} = $var;
577 print "You must enter a number in this field. Please try again.\n\n";
583 print "What is the maximum length of a GECOS (real name) field?\n";
584 print "[\033[1;32m$config{MAX_GECOS}\033[0m] -> ";
585 chomp($var = <STDIN>);
587 $var = $config{MAX_GECOS};
589 if ($var =~ /^\d+$/) {
590 # We don't care what the number is, set it and be on our way.
591 $config{MAX_GECOS} = $var;
595 print "You must enter a number in this field. Please try again.\n\n";
601 print "What is the maximum length of an away message?\n";
602 print "[\033[1;32m$config{MAX_AWAY}\033[0m] -> ";
603 chomp($var = <STDIN>);
605 $var = $config{MAX_AWAY};
607 if ($var =~ /^\d+$/) {
608 # We don't care what the number is, set it and be on our way.
609 $config{MAX_AWAY} = $var;
613 print "You must enter a number in this field. Please try again.\n\n";
618 print "Enter the Level Of Binary optimisation. This is a number between 0 and 3.
619 The InspIRCd Team will NOT support any bug reports above 0. Also note,
620 the IRCd behaviour will be different depending on this value. Please
621 read the documentation for more information.
623 The higher the number, the more optimised your binary will be. This
624 value will default to 0 if you either don't enter a number, or enter
625 a value outside the range.
627 As always, if you are unsure, just press enter and accept the default.\n\n";
628 print "[\033[1;32m$config{OPTIMITEMP}\033[0m] -> ";
629 chomp($var = <STDIN>);
631 $var = $config{OPTIMITEMP};
635 $config{OPTIMITEMP} = 1;
636 $config{OPTIMISATI} = "-O";
637 } elsif ($var eq "2") {
638 $config{OPTIMITEMP} = 2;
639 $config{OPTIMISATI} = "-O2";
640 } elsif ($var eq "3") {
641 $config{OPTIMITEMP} = 3;
642 $config{OPTIMISATI} = "-O3";
644 $config{OPTIMITEMP} = 0;
645 $config{OPTIMISATI} = "-g";
648 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
649 print "\033[0mBase install path:\033[1;32m\t\t$config{BASE_DIR}\n";
650 print "\033[0mConfig path:\033[1;32m\t\t\t$config{CONFIG_DIR}\n";
651 print "\033[0mModule path:\033[1;32m\t\t\t$config{MODULE_DIR}\n";
652 print "\033[0mLibrary path:\033[1;32m\t\t\t$config{LIBRARY_DIR}\n";
653 print "\033[0mMax connections:\033[1;32m\t\t$config{MAX_CLIENT}\n";
654 print "\033[0mMax User Channels:\033[1;32m\t\t$config{MAX_CHANNE}\n";
655 print "\033[0mMax Oper Channels:\033[1;32m\t\t$config{MAX_OPERCH}\n";
656 print "\033[0mMax nickname length:\033[1;32m\t\t$config{NICK_LENGT}\n";
657 print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
658 print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
659 print "\033[0mMax ident length:\033[1;32m\t\t$config{MAX_IDENT}\n";
660 print "\033[0mMax quit length:\033[1;32m\t\t$config{MAX_QUIT}\n";
661 print "\033[0mMax topic length:\033[1;32m\t\t$config{MAX_TOPIC}\n";
662 print "\033[0mMax kick length:\033[1;32m\t\t$config{MAX_KICK}\n";
663 print "\033[0mMax name length:\033[1;32m\t\t$config{MAX_GECOS}\n";
664 print "\033[0mMax away length:\033[1;32m\t\t$config{MAX_AWAY}\n";
665 print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
666 print "\033[0mOptimization Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
667 print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n";
668 print "\033[0mStatic modules:\033[1;32m\t\t\t$config{STATIC_LINK}\033[0m\n";
669 print "\033[0mMultithread DNS:\033[1;32m\t\t$config{THREADED_DNS}\033[0m\n";
670 print "\033[0mIPv6 Support:\033[1;32m\t\t\t$config{IPV6}\033[0m\n";
671 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$config{USE_GNUTLS}\033[0m\n";
672 print "\033[0mOpenSSL Support:\033[1;32m\t\t$config{USE_OPENSSL}\033[0m\n\n";
674 if ($config{USE_GNUTLS} eq "y") {
676 open(TMP, "<src/modules/m_ssl_gnutls.cpp") or $failed = 1;
679 print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
680 chdir("src/modules");
681 system("ln -s extra/m_ssl_gnutls.cpp");
686 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
688 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
691 print "SSL Certificates Not found, Generating.. \n\n
692 *************************************************************
693 * Generating the Private Key may take some time, go grab a *
694 * Coffee. Even better, to generate some more entropy if it *
695 * is taking a while, open another console and type du / a *
696 * few times and get that HD going :) Then answer the *
697 * Questions which follow. If you are unsure, just hit enter *
698 *************************************************************\n\n";
699 system("certtool --generate-privkey --outfile key.pem");
700 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
701 print "\nCertificate generation complete, copying to config directory... ";
702 system("mv key.pem $config{CONFIG_DIR}/key.pem");
703 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
706 print "SSL Certificates found, skipping.\n\n"
708 } elsif ($config{USE_OPENSSL} eq "y") {
710 open(TMP, "<src/modules/m_ssl_openssl.cpp") or $failed = 1;
713 print "Symlinking src/modules/m_ssl_openssl.cpp from extra/\n";
714 chdir("src/modules");
715 system("ln -s extra/m_ssl_openssl.cpp");
720 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
722 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
725 print "SSL Certificates Not found, Generating.. \n\n
726 *************************************************************
727 * Generating the certificates may take some time, go grab a *
728 * coffee, or something. *
729 *************************************************************\n\n";
730 system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
731 system("openssl dhparam -out dhparams.pem 1024");
732 print "\nCertificate generation complete, copying to config directory... ";
733 system("mv key.pem $config{CONFIG_DIR}/key.pem");
734 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
735 system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
738 print "SSL Certificates found, skipping.\n\n"
741 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
742 print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
750 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
751 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
752 print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
753 print "load the required modules in your config. This configure process\n";
754 print "has just prepared these modules to be compiled for you, and has not\n";
755 print "configured them to be compiled into the core of the ircd.\n";
757 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
758 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
759 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";
762 if ($config{GCCVER} < "3") {
764 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
765 GCC 2.x series compilers only had partial (read as broken) C++ support, and
766 your compile will most likely fail horribly! If you have any problems, do NOT
767 report them to the bugtracker or forums without first upgrading your compiler
768 to a newer 3.x or 4.x (or whatever is available currently) version.
772 ################################################################################
774 ################################################################################
776 # Retrieves the .config.cache file, and loads values into the main config hash.
777 open(CACHE, ".config.cache") or return undef;
780 # Ignore Blank lines, and comments..
783 my ($key, $value) = split("=", $_);
784 $value =~ /^\"(.*)\"$/;
785 # Do something with data here!
793 # Dump the contents of %config
794 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
795 open(FILEHANDLE, ">.config.cache");
796 foreach $key (keys %config) {
797 print FILEHANDLE "$key=\"$config{$key}\"\n";
803 my ($desc, $hash_key) = @_;
806 print "In what directory $desc?\n";
807 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
808 chomp($var = <STDIN>);
810 $var = $config{$hash_key};
812 if ($var =~ /^\~\/(.+)$/) {
813 # Convert it to a full path..
814 $var = resolve_directory($ENV{HOME} . "/" . $1);
816 if (substr($var,0,1) ne "/")
818 # Assume relative Path was given.. fill in the rest.
819 $var = $this . "/$var";
821 $var = resolve_directory($var);
823 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
824 chomp($tmp = <STDIN>);
825 if (($tmp eq "") || ($tmp =~ /^y/i)) {
826 # Attempt to Create the Dir..
827 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
829 print "Unable to create directory. ($var)\n\n";
834 # They said they don't want to create, and we can't install there.
840 # Target exists, but is not a directory.
841 print "File $var exists, but is not a directory.\n\n";
845 # Either Dir Exists, or was created fine.
846 $config{$hash_key} = $var;
853 if ($config{OSNAME} =~ /BSD$/) {
854 $config{LDLIBS} = "-Ldl -lstdc++";
855 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
856 $config{MAKEPROG} = "gmake";
857 if ($config{OSNAME} eq "OpenBSD") {
858 chomp($foo = `eg++ -dumpversion | cut -c 1`);
859 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
860 # if theyre not running this, configure lets the build continue but they probably wont manage to
861 # compile as this standard version is 2.95.3!
863 $config{CC} = "eg++";
864 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
865 chomp($config{GCC34} = `eg++ -dumpversion | cut -c 3`); # the compiler path
869 $config{LDLIBS} = "-ldl -lstdc++";
870 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
871 $config{MAKEPROG} = "make";
872 if ($config{OSNAME} =~ /CYGWIN/) {
873 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
874 $config{LDLIBS} = "";
875 $config{MAKEPROG} = "/usr/bin/make";
876 $config{MAKEORDER} = "ircd mods";
877 } elsif ($config{OSNAME} eq "CYG-STATIC") {
878 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
879 $config{LDLIBS} = "";
880 $config{MAKEPROG} = "/usr/bin/make";
881 $config{MAKEORDER} = "mods ircd";
882 $config{STATICLIBS} = "modules/mods.a";
883 $config{STATIC_LINK} = "yes";
886 if ($config{OSNAME} =~ /SunOS/) {
887 # solaris/sunos needs these
888 # socket = bsd sockets api
890 # rt = POSIX realtime extensions
891 # resolv = inet_aton only (why isnt this in nsl?!)
892 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
910 opendir(DIRHANDLE, "src/modules");
911 foreach $name (sort readdir(DIRHANDLE)) {
912 if ($name =~ /^m_(.+)\.cpp$/)
915 if ($mod !~ /_static$/) {
916 $modlist[$i++] = $mod;
927 my $data = `svn info`;
933 $data =~ /Revision: (\d+)/;
935 if (!defined($rev)) {
942 print "Writing \033[1;32minspircd_config.h\033[0m\n";
943 # First File.. inspircd_config.h
944 chomp(my $incos = `uname -n -s -r`);
945 chomp(my $version = `sh ./src/version.sh`);
946 chomp(my $revision = getrevision());
947 $version = "$version(r$revision)";
948 chomp(my $revision2 = getrevision());
949 open(FILEHANDLE, ">include/inspircd_config.h");
950 my $NL = $config{NICK_LENGT}+1;
951 my $CL = $config{CHAN_LENGT}+1;
952 print FILEHANDLE <<EOF;
953 /* Auto generated by configure, do not modify! */
954 #ifndef __CONFIGURATION_AUTO__
955 #define __CONFIGURATION_AUTO__
957 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
958 #define MOD_PATH "$config{MODULE_DIR}"
959 #define VERSION "$version"
960 #define REVISION "$revision2"
961 #define MAXCLIENTS $config{MAX_CLIENT}
962 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
965 #define MAXCHANS $config{MAX_CHANNE}
966 #define OPERMAXCHANS $config{MAX_OPERCH}
967 #define MAXMODES $config{MAXI_MODES}
968 #define IDENTMAX $config{MAX_IDENT}
969 #define MAXQUIT $config{MAX_QUIT}
970 #define MAXTOPIC $config{MAX_TOPIC}
971 #define MAXKICK $config{MAX_KICK}
972 #define MAXGECOS $config{MAX_GECOS}
973 #define MAXAWAY $config{MAX_AWAY}
974 #define OPTIMISATION $config{OPTIMITEMP}
975 #define SYSTEM "$incos"
978 if ($config{OSNAME} =~ /SunOS/) {
979 print FILEHANDLE "#define IS_SOLARIS\n";
981 if ($config{OSNAME} =~ /CYGWIN/) {
982 print FILEHANDLE "#define IS_CYGWIN\n";
983 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
985 if ($config{OSNAME} eq "CYG-STATIC") {
986 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
988 if ($config{HAS_EXECINFO} eq "1") {
989 print FILEHANDLE "#define HAS_EXECINFO\n";
991 if ($config{STATIC_LINK} eq "yes") {
992 print FILEHANDLE "#define STATIC_LINK\n";
994 if ($config{GCCVER} > 3) {
995 print FILEHANDLE "#define GCC3\n";
996 print FILEHANDLE "#define GCC34\n";
1000 if ($config{GCCVER} == 3) {
1001 print FILEHANDLE "#define GCC3\n";
1002 if ($config{GCC34} > 3) {
1003 print FILEHANDLE "#define GCC34\n";
1007 if ($config{HAS_STRLCPY} eq "true") {
1008 print FILEHANDLE "#define HAS_STRLCPY\n";
1010 if ($config{THREADED_DNS} =~ /y/i) {
1011 print FILEHANDLE "#define THREADED_DNS\n";
1013 if ($config{IPV6} =~/y/i) {
1014 print FILEHANDLE "#define IPV6\n";
1017 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1018 print FILEHANDLE "#define USE_KQUEUE\n";
1021 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1022 print FILEHANDLE "#define USE_EPOLL\n";
1025 # user didn't choose either epoll or select for their OS.
1026 # default them to USE_SELECT (ewwy puke puke)
1028 print FILEHANDLE "#define USE_SELECT\n";
1030 print FILEHANDLE "\n#endif\n";
1033 # Create a Modules List..
1035 foreach $i (@modlist)
1037 if ($config{STATIC_LINK} eq "yes") {
1038 $modules .= "m_".$i.".o ";
1041 $modules .= "m_".$i.".so ";
1044 chomp($modules); # Remove Redundant whitespace..
1047 # Write all .in files.
1050 my $exe = "inspircd";
1052 if ($config{OSNAME} =~ /CYGWIN/) {
1053 $exe = "inspircd.exe";
1056 opendir(DIRHANDLE, $this);
1057 if ($config{THREADED_DNS} =~ /y/i) {
1058 $config{LDLIBS} = $config{LDLIBS} . " -pthread";
1060 foreach $name (sort readdir(DIRHANDLE)) {
1061 if ($name =~ /^\.(.+)\.inc$/) {
1063 # All .name.inc files need parsing!
1065 open(FILEHANDLE, ".$file.inc");
1066 while (<FILEHANDLE>) {
1071 $tmp =~ s/\@CC\@/$config{CC}/;
1072 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1073 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1074 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1075 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1076 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1077 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1078 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1079 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1080 $tmp =~ s/\@MODULES\@/$modules/;
1081 $tmp =~ s/\@EXECUTABLE\@/$exe/;
1082 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1083 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1085 print "Writing \033[1;32m$file\033[0m\n";
1086 open(FILEHANDLE, ">$file");
1087 print FILEHANDLE $tmp;
1090 closedir(DIRHANDLE);
1092 # Make inspircd executable!
1093 chmod 0744, 'inspircd';
1095 if ($config{STATIC_LINK} eq "yes") {
1096 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1097 write_static_makefile();
1098 write_static_modules_makefile();
1099 } elsif ($config{OSNAME} =~ /CYGWIN/) {
1100 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1101 write_static_makefile();
1102 write_dynamic_modules_makefile();
1104 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1105 write_dynamic_makefile();
1106 write_dynamic_modules_makefile();
1110 sub getcompilerflags {
1114 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
1123 sub getlinkerflags {
1127 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
1137 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";
1138 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";
1139 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";
1140 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";
1141 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";
1142 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";
1143 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";
1144 print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
1147 sub resolve_directory {
1149 return File::Spec->rel2abs($_[0]);
1153 my ($flag,$prompt) = @_;
1154 print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
1155 chomp($tmp = <STDIN>);
1156 if ($tmp eq "") { $tmp = $config{$flag} }
1158 if (($tmp eq "") || ($tmp =~ /^y/i)) {
1159 $config{$flag} = "y";
1161 $config{$flag} = "n";
1166 sub write_static_modules_makefile {
1167 # Modules Makefile..
1168 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1169 open(FILEHANDLE, ">src/modules/Makefile");
1172 # Module Makefile Header
1174 print FILEHANDLE <<EOF;
1175 # (C) ChatSpike development team
1176 # Makefile by <Craig\@ChatSpike.net>
1177 # Many Thanks to Andrew Church <achurch\@achurch.org>
1178 # for assisting with making this work right.
1180 # Automatically Generated by ./configure to add a modules
1181 # please run ./configure --update
1187 # End Module Makefile Header
1190 # Create a Modules List..
1195 open(MODLIST,">include/modlist.h");
1198 # Include File Header
1200 print MODLIST <<HEADER;
1201 // Generated automatically by configure. DO NOT EDIT!
1203 #ifndef __SYMBOLS__H_CONFIGURED__
1204 #define __SYMBOLS__H_CONFIGURED__
1208 # End Include File Header
1211 # Place Module List into Include
1212 foreach $i (@modlist) {
1213 if ($i !~ /_static$/) {
1214 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1217 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1222 foreach $i (@modlist)
1224 if ($i !~ /_static$/) {
1225 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1226 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1229 # Write Entry to the Makefile
1231 print FILEHANDLE <<EOCHEESE;
1232 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h
1233 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
1234 mv m_$i\_static.o ../m_$i.o
1238 # End Write Entry to the MakeFile
1240 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1241 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1242 open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
1243 while (chomp($a = <MODULE>)) {
1244 $a =~ s/init_module/$i\_init/g;
1245 print MUNGED "$a\n";
1249 print MODLIST <<EOENT;
1250 {"m_$i.so",\&$i\_init},
1255 print MODLIST "{0}};\n\n#endif\n";
1259 sub write_dynamic_modules_makefile {
1260 # Modules Makefile..
1261 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1262 open(FILEHANDLE, ">src/modules/Makefile");
1265 if ($config{OSNAME} =~ /CYGWIN/) {
1266 $extra = "../inspircd.dll.a";
1270 # Module Makefile Header
1272 print FILEHANDLE <<EOF;
1273 # (C) ChatSpike development team
1274 # Makefile by <Craig\@ChatSpike.net>
1275 # Many Thanks to Andrew Church <achurch\@achurch.org>
1276 # for assisting with making this work right.
1278 # Automatically Generated by ./configure to add a modules
1279 # please run ./configure -update or ./configure -modupdate
1285 # End Module Makefile Header
1288 # Create a Modules List..
1294 foreach $i (@modlist) {
1296 # Write Entry to the MakeFile
1298 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1299 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1300 print FILEHANDLE <<EOCHEESE;
1301 m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h
1302 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1303 \$(CC) \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1306 $crud = $crud . " \@install -v -m 0700 m_$i.so \$(MODPATH)\n";
1308 # End Write Entry to the MakeFile
1311 print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
1315 sub write_static_makefile {
1316 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1319 opendir(DIRHANDLE, "src");
1320 foreach $name (sort readdir(DIRHANDLE)) {
1321 if ($name =~ /^cmd_(.+)\.cpp$/) {
1322 $cmdlist[$i++] = $1;
1325 closedir(DIRHANDLE);
1328 foreach my $cmd (@cmdlist) {
1329 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1330 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1335 # (C) ChatSpike development team
1336 # Makefile by <Craig\@ChatSpike.net>
1337 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1340 CC = im a cheezeball
1342 CXXFLAGS = -I../include \${FLAGS}
1343 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1344 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1348 # This next section is for cygwin dynamic module builds.
1349 # Basically, what we do, is build the inspircd core as a library
1350 # then the main executable uses that. the library is capable of
1351 # loading / unloading the modules dynamically :)
1352 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1356 if ($config{OSNAME} =~ /CYGWIN/) {
1358 all: timer.o 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 configreader.o inspsocket.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o inspircd.exe
1360 inspircd.exe: inspircd.dll.a
1363 inspircd.dll inspircd.dll.a: inspircd.o channels.o mode.o xline.o inspstring.o dns.o base.o configreader.o inspsocket.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 timer.o
1364 \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1368 all: timer.o 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 configreader.o inspsocket.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o \$(MODULES) inspircd.exe
1370 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
1371 \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspsocket.o configreader.o 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 timer.o modes/modeclasses.a \$(MODULES)
1377 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
1378 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1380 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
1381 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1383 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1384 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1386 socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1387 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1389 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1390 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1392 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1393 \$(CC) -pipe -I/usr/local/include -L/usr/local/lib -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1395 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1396 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1398 mode.o: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES)
1399 \${MAKE} -C "modes" DIRNAME="src/modes" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1400 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1402 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
1403 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1405 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
1406 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1408 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
1409 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1411 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1412 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1414 configreader.o: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1415 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1417 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
1418 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1420 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
1421 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1423 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
1424 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1426 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
1427 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1429 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
1430 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1432 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
1433 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1435 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
1436 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1438 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1439 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1441 inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1442 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1444 aes.o: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1445 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1447 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1448 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1451 foreach my $cmd (@cmdlist) {
1453 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
1454 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1460 sub write_dynamic_makefile {
1464 opendir(DIRHANDLE, "src");
1465 foreach $name (sort readdir(DIRHANDLE)) {
1466 if ($name =~ /^cmd_(.+)\.cpp$/) {
1467 $cmdlist[$i++] = $1;
1470 closedir(DIRHANDLE);
1474 foreach my $cmd (@cmdlist) {
1475 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1476 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1479 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1483 # (C) ChatSpike development team
1484 # Makefile by <Craig\@ChatSpike.net>
1485 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1488 CC = im a cheezeball
1490 CXXFLAGS = -I../include \${FLAGS}
1491 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1492 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1494 all: libIRCDtimer.so 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 libIRCDconfigreader.so libIRCDinspsocket.so libIRCDmessage.so $cmdobjs libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so inspircd
1496 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
1497 \$(CC) -I../include -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath -Wl,$config{LIBRARY_DIR} \$(FLAGS) -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDconfigreader.so libIRCDinspsocket.so 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 libIRCDtimer.so
1499 libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1500 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1501 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
1503 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
1504 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1505 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1507 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
1508 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1509 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1511 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1512 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1513 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1515 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1516 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1517 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1519 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1520 \$(CC) -pipe -I/usr/local/include -L/usr/local/lib -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1521 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1523 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1524 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1525 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1527 libIRCDmode.so: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES)
1528 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1529 \${MAKE} -C "modes" DIRNAME="src/modes" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1530 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o modes/modeclasses.a
1532 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
1533 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1534 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1536 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
1537 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1538 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1540 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
1541 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1542 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1544 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1545 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1546 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1548 libIRCDconfigreader.so: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1549 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1550 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDconfigreader.so configreader.o
1552 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
1553 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1554 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmessage.so message.o
1556 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
1557 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1558 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o $cmdobjs
1560 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
1561 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1562 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdnsqueue.so dnsqueue.o
1564 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
1565 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1566 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1568 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
1569 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1570 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1572 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
1573 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1574 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1576 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
1577 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1578 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1580 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1581 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1582 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1584 libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1585 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1586 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDinspsocket.so inspsocket.o
1588 libIRCDaes.so: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1589 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1590 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDaes.so aes.o
1592 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1593 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1594 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1597 foreach my $cmd (@cmdlist) {
1599 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
1600 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp