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 chomp($config{HAS_OPENSSL} = `openssl version 2>/dev/null`); # Openssl version
26 $config{USE_GNUTLS} = "n"; # Use gnutls.
27 $config{USE_OPENSSL} = "n"; # Use openssl.
28 $config{OPTIMITEMP} = "0"; # Default Optimisation Value
29 $config{OPTIMISATI} = "-g"; # Optimisation Flag
30 $config{NICK_LENGT} = "31"; # Default Nick Length
31 $config{CHAN_LENGT} = "64"; # Default Channel Name Length
32 $config{MAX_CHANNE} = "20"; # Default Max. Channels per user
33 $config{MAX_OPERCH} = "60"; # Default Max. Channels per oper
34 $config{MAXI_MODES} = "20"; # Default Max. Number of Modes set at once.
35 $config{HAS_STRLCPY} = "false"; # strlcpy Check.
36 $config{USE_KQUEUE} = "y"; # kqueue enabled
37 $config{USE_EPOLL} = "y"; # epoll enabled
38 $config{THREADED_DNS} = "n"; # threaded dns (experimental)
39 $config{STATIC_LINK} = "no"; # are doing static modules?
40 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
41 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
42 chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version
43 chomp($config{GCC34} = `g++ -dumpversion | cut -c 3`); # Minor GCC Version
44 chomp($config{OSNAME} = `/bin/uname`); # Operating System Name
45 $config{CC} = "g++"; # C++ compiler
46 $config{MAKEORDER} = "ircd mods"; # build order
47 $config{STATICLIBS} = ""; # library archive path
48 $config{MAX_IDENT} = "12"; # max ident size
49 $config{MAX_QUIT} = "255"; # max quit message size
50 $config{MAX_TOPIC} = "307"; # max topic size
51 $config{MAX_KICK} = "255"; # max kick message size
52 $config{MAX_GECOS} = "128"; # max GECOS size
53 $config{MAX_AWAY} = "200"; # max AWAY size
57 $config{HAS_OPENSSL} =~ /OpenSSL (\S+) \d+ \S+ \d{4}/;
58 $config{HAS_OPENSSL} = $1;
60 # Minihack! Convert Cygwin to 'Cyg-Static' so i can
61 # Keep my dynamic module experiments here for later
64 if ($config{OSNAME} =~ /CYGWIN/) {
65 $config{OSNAME} = "CYG-STATIC";
68 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
69 chomp($config{OSNAME} = `/usr/bin/uname`);
70 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
71 $config{OSNAME} = "Unknown";
75 if (!$config{MAX_CLIENT_T}) {
76 $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
77 $fd_scan_fail = "true"; # Used Later
80 # Get and Set some important vars..
83 my $arg = $ARGV[0]; # Do Some Argument Checks..
84 if ($arg eq "-clean") {
85 system("rm -rf .config.cache");
86 } # Remove the config.cache file.
88 if ($arg eq "-update") {
89 # Does the cache file exist?
91 # No, No it doesn't.. *BASH*
92 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
95 # We've Loaded the cache file and all our variables..
96 print "Updating Files..\n";
98 $has_epoll = $config{HAS_EPOLL};
99 $has_kqueue = $config{HAS_KQUEUE};
106 if ($arg eq "-svnupdate") {
108 open(FH,"<.svn/entries") or $fail = 1;
110 print "This is not an SVN copy of InspIRCd.\n";
113 system("svn update");
114 system("perl configure -update");
115 if ($ARGV[1] eq "rebuild") {
116 system("make install");
121 if ($arg eq "-modupdate") {
122 # Does the cache file exist?
124 # No, No it doesn't.. *BASH*
125 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
128 # We've Loaded the cache file and all our variables..
129 print "Updating Files..\n";
131 $has_epoll = $config{HAS_EPOLL};
132 $has_kqueue = $config{HAS_KQUEUE};
133 if ($config{STATIC_LINK} eq "yes") {
134 write_static_modules_makefile();
136 write_dynamic_modules_makefile();
143 print "Checking for cache from previous configure...\n";
145 print "Checking operating system version...\n";
148 if (!$config{MAX_CLIENT}) {
149 # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
150 # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
151 # higher than the found value" :))
152 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
155 printf "Checking if strlcpy exists... ";
156 # Perform the strlcpy() test..
157 $config{HAS_STRLCPY} = "false";
159 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
161 while (chomp($line = <STRLCPY>)) {
162 # try and find the delcaration of:
163 # size_t strlcpy(...)
164 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
165 $config{HAS_STRLCPY} = "true";
170 print "yes\n" if $config{HAS_STRLCPY} eq "true";
171 print "no\n" if $config{HAS_STRLCPY} eq "false";
173 printf "Checking if kqueue exists... ";
176 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
178 while (chomp($line = <KQUEUE>)) {
179 # try and find the delcaration of:
181 if ($line =~ /int(\0x9|\s)+kqueue/) {
187 print "yes\n" if $has_kqueue == 1;
188 print "no\n" if $has_kqueue == 0;
190 printf "Checking if epoll exists... ";
193 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
199 my $kernel = `uname -r`;
201 if (($kernel =~ /2\.0/) || ($kernel =~ /2\.2/) || ($kernel =~ /2\.4/)) {
205 print "yes\n" if $has_epoll == 1;
206 print "no\n" if $has_epoll == 0;
208 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
209 $config{HAS_STRLCPY} = "true";
212 $config{HAS_EPOLL} = $has_epoll;
213 $config{HAS_KQUEUE} = $has_kqueue;
215 printf "Checking for libgnutls... ";
216 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
218 $config{HAS_GNUTLS} = "y";
221 $config{HAS_GNUTLS} = "n";
224 printf "Checking for openssl... ";
225 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
227 $config{HAS_OPENSSL} = "y";
230 $config{HAS_OPENSSL} = "n";
233 ################################################################################
234 # BEGIN INTERACTIVE PART #
235 ################################################################################
239 # Display Splash Logo..
241 chomp($wholeos = `uname -mnr`);
243 my $rev = getrevision();
244 # Display Introduction Message..
246 Welcome to the InspIRCd Configuration program!
248 *** If you are unsure of any of these values, leave it blank for ***
249 *** standard settings that will work, and your server will run ***
250 *** using them. If you are running this server as part of a ***
251 *** larger network, you must consult with your network admins ***
252 *** for the proper values to use, or server links will be unstable! ***
254 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
255 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
256 dir, otherwise you won't have a config file!
258 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos), fdmax: $config{MAX_CLIENT_T}
259 Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
261 print " (Non-SVN build)";
265 $config{CHANGE_COMPILER} = "n";
266 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";
268 while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
269 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
270 should NOT be used. You should probably specify a newer compiler.\n\n";
271 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
272 if ($config{CHANGE_COMPILER} =~ /y/i) {
273 print "What command do you want to use to invoke your compiler?\n";
274 print "[\033[1;32m$config{CC}\033[0m] -> ";
275 chomp($config{CC} = <STDIN>);
276 if ($config{CC} eq "") {
279 chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
281 chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change
282 chomp($config{GCC34} = `$config{CC} -dumpversion | cut -c 3`); # the compiler path
283 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.$config{GCC34}\033[0m)\n";
284 if ($config{GCCVER} < 3) {
285 print "\033[1;32mGCC 2.x WILL NOT WORK!\033[0m. Let's try that again, shall we?\n";
289 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
296 # Directory Settings..
297 my $tmpbase = $config{BASE_DIR};
298 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
299 if ($tmpbase ne $config{BASE_DIR}) {
300 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
301 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
302 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
303 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
306 dir_check("are the configuration files", "CONFIG_DIR");
307 dir_check("are the modules to be compiled to", "MODULE_DIR");
308 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
309 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
312 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?");
316 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?");
319 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
320 if (!$chose_hiperf) {
321 print "No high-performance socket engines are available, or you chose\n";
322 print "not to enable one. Defaulting to select() engine.\n\n";
325 yesno(THREADED_DNS,"Would you like to enable the experimental multi-threaded DNS lookup?");
328 if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
329 print "I have detected both GnuTLS and OpenSSL on your system.\n";
330 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
331 print "instead, you should enable the OpenSSL module yourself\n";
332 print "by copying it from src/modules/extra to src/modules.\n\n";
335 if ($config{HAS_GNUTLS} eq "y") {
336 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
337 if ($config{USE_GNUTLS} eq "y") {
338 print "\nUsing GnuTLS SSL module.\n";
340 } elsif ($config{HAS_OPENSSL} eq "y") {
341 yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
342 if ($config{USE_OPENSSL} eq "y") {
343 print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
347 print "\nThe following questions will ask you for various figures relating\n";
348 print "To your IRCd install. Please note that these should usually be left\n";
349 print "as defaults unless you have a real reason to change them. If they\n";
350 print "changed, then the values must be identical on all servers on your\n";
351 print "network, or malfunctions and/or crashes may occur, with the exception\n";
352 print "of the 'maximum number of clients' setting which may be different on\n";
353 print "different servers on the network.\n\n";
355 # File Descriptor Settings..
358 print "Maximum number of clients at any one time ($config{MAX_CLIENT_T})\n";
359 print "[\033[1;32m$config{MAX_CLIENT}\033[0m] -> ";
360 chomp($var = <STDIN>);
362 $var = $config{MAX_CLIENT};
364 if ($var =~ /^\d+$/) {
365 if (($var > $config{MAX_CLIENT_T}) && ($fd_scan_failed ne true)) {
366 # Client has entered a larger number than the 'discovered' value
368 print "WARNING: Our scans have indicated that you are attempting
369 to use more sockets than there are avaliable. Are you sure
370 you wish to do this? It may cause the IRCd to malfunction [y/n]
371 [\033[1;32mn\033[0m] -> $c";
372 chomp($tmp = <STDIN>);
374 print "Please enter the correct value.\n\n";
379 print "You must enter a number in this field. Please try again.\n\n";
382 # If we get here, we should be good to go.
383 $config{MAX_CLIENT} = $var;
390 print "What is the maximum length of nicknames?\n";
391 print "[\033[1;32m$config{NICK_LENGT}\033[0m] -> ";
392 chomp($var = <STDIN>);
394 $var = $config{NICK_LENGT};
396 if ($var =~ /^\d+$/) {
397 # We don't care what the number is, set it and be on our way.
398 $config{NICK_LENGT} = $var;
402 print "You must enter a number in this field. Please try again.\n\n";
408 print "What is the maximum length of channel names?\n";
409 print "[\033[1;32m$config{CHAN_LENGT}\033[0m] -> ";
410 chomp($var = <STDIN>);
412 $var = $config{CHAN_LENGT};
414 if ($var =~ /^\d+$/) {
415 # We don't care what the number is, set it and be on our way.
416 $config{CHAN_LENGT} = $var;
420 print "You must enter a number in this field. Please try again.\n\n";
426 print "What is the maximum number of channels a normal user may join at any one time?\n";
427 print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
428 chomp($var = <STDIN>);
430 $var = $config{MAX_CHANNE};
432 if ($var =~ /^\d+$/) {
433 # We don't care what the number is, set it and be on our way.
434 $config{MAX_CHANNE} = $var;
438 print "You must enter a number in this field. Please try again.\n\n";
444 print "What is the maximum number of channels an oper may join at any one time?\n";
445 print "[\033[1;32m$config{MAX_OPERCH}\033[0m] -> ";
446 chomp($var = <STDIN>);
448 $var = $config{MAX_OPERCH};
450 if ($var =~ /^\d+$/) {
451 # We don't care what the number is, set it and be on our way.
452 $config{MAX_OPERCH} = $var;
460 print "What is the maximum number of mode changes in one line?\n";
461 print "[\033[1;32m$config{MAXI_MODES}\033[0m] -> ";
462 chomp($var = <STDIN>);
464 $var = $config{MAXI_MODES};
466 if ($var =~ /^\d+$/) {
467 # We don't care what the number is, set it and be on our way.
468 $config{MAXI_MODES} = $var;
472 print "You must enter a number in this field. Please try again.\n\n";
478 print "What is the maximum length of an ident (username)?\n";
479 print "[\033[1;32m$config{MAX_IDENT}\033[0m] -> ";
480 chomp($var = <STDIN>);
482 $var = $config{MAX_IDENT};
484 if ($var =~ /^\d+$/) {
485 # We don't care what the number is, set it and be on our way.
486 $config{MAX_IDENT} = $var;
490 print "You must enter a number in this field. Please try again.\n\n";
496 print "What is the maximum length of a quit message?\n";
497 print "[\033[1;32m$config{MAX_QUIT}\033[0m] -> ";
498 chomp($var = <STDIN>);
500 $var = $config{MAX_QUIT};
502 if ($var =~ /^\d+$/) {
503 # We don't care what the number is, set it and be on our way.
504 $config{MAX_QUIT} = $var;
508 print "You must enter a number in this field. Please try again.\n\n";
514 print "What is the maximum length of a channel topic?\n";
515 print "[\033[1;32m$config{MAX_TOPIC}\033[0m] -> ";
516 chomp($var = <STDIN>);
518 $var = $config{MAX_TOPIC};
520 if ($var =~ /^\d+$/) {
521 # We don't care what the number is, set it and be on our way.
522 $config{MAX_TOPIC} = $var;
526 print "You must enter a number in this field. Please try again.\n\n";
532 print "What is the maximum length of a kick message?\n";
533 print "[\033[1;32m$config{MAX_KICK}\033[0m] -> ";
534 chomp($var = <STDIN>);
536 $var = $config{MAX_KICK};
538 if ($var =~ /^\d+$/) {
539 # We don't care what the number is, set it and be on our way.
540 $config{MAX_KICK} = $var;
544 print "You must enter a number in this field. Please try again.\n\n";
550 print "What is the maximum length of a GECOS (real name) field?\n";
551 print "[\033[1;32m$config{MAX_GECOS}\033[0m] -> ";
552 chomp($var = <STDIN>);
554 $var = $config{MAX_GECOS};
556 if ($var =~ /^\d+$/) {
557 # We don't care what the number is, set it and be on our way.
558 $config{MAX_GECOS} = $var;
562 print "You must enter a number in this field. Please try again.\n\n";
568 print "What is the maximum length of an away message?\n";
569 print "[\033[1;32m$config{MAX_AWAY}\033[0m] -> ";
570 chomp($var = <STDIN>);
572 $var = $config{MAX_AWAY};
574 if ($var =~ /^\d+$/) {
575 # We don't care what the number is, set it and be on our way.
576 $config{MAX_AWAY} = $var;
580 print "You must enter a number in this field. Please try again.\n\n";
585 print "Enter the Level Of Binary optimisation. This is a number between 0 and 3.
586 The InspIRCd Team will NOT support any bug reports above 0. Also note,
587 the IRCd behaviour will be different depending on this value. Please
588 read the documentation for more information.
590 The higher the number, the more optimised your binary will be. This
591 value will default to 0 if you either don't enter a number, or enter
592 a value outside the range.
594 As always, if you are unsure, just press enter and accept the default.\n\n";
595 print "[\033[1;32m$config{OPTIMITEMP}\033[0m] -> ";
596 chomp($var = <STDIN>);
598 $var = $config{OPTIMITEMP};
602 $config{OPTIMITEMP} = 1;
603 $config{OPTIMISATI} = "-O";
604 } elsif ($var eq "2") {
605 $config{OPTIMITEMP} = 2;
606 $config{OPTIMISATI} = "-O2";
607 } elsif ($var eq "3") {
608 $config{OPTIMITEMP} = 3;
609 $config{OPTIMISATI} = "-O3";
611 $config{OPTIMITEMP} = 0;
612 $config{OPTIMISATI} = "-g";
615 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
616 print "\033[0mBase install path:\033[1;32m\t\t$config{BASE_DIR}\n";
617 print "\033[0mConfig path:\033[1;32m\t\t\t$config{CONFIG_DIR}\n";
618 print "\033[0mModule path:\033[1;32m\t\t\t$config{MODULE_DIR}\n";
619 print "\033[0mLibrary path:\033[1;32m\t\t\t$config{LIBRARY_DIR}\n";
620 print "\033[0mMax connections:\033[1;32m\t\t$config{MAX_CLIENT}\n";
621 print "\033[0mMax User Channels:\033[1;32m\t\t$config{MAX_CHANNE}\n";
622 print "\033[0mMax Oper Channels:\033[1;32m\t\t$config{MAX_OPERCH}\n";
623 print "\033[0mMax nickname length:\033[1;32m\t\t$config{NICK_LENGT}\n";
624 print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
625 print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
626 print "\033[0mMax ident length:\033[1;32m\t\t$config{MAX_IDENT}\n";
627 print "\033[0mMax quit length:\033[1;32m\t\t$config{MAX_QUIT}\n";
628 print "\033[0mMax topic length:\033[1;32m\t\t$config{MAX_TOPIC}\n";
629 print "\033[0mMax kick length:\033[1;32m\t\t$config{MAX_KICK}\n";
630 print "\033[0mMax name length:\033[1;32m\t\t$config{MAX_GECOS}\n";
631 print "\033[0mMax away length:\033[1;32m\t\t$config{MAX_AWAY}\n";
632 print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
633 print "\033[0mOptimization Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
634 print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n";
635 print "\033[0mStatic modules:\033[1;32m\t\t\t$config{STATIC_LINK}\033[0m\n";
636 print "\033[0mMultithread DNS:\033[1;32m\t\t$config{THREADED_DNS}\033[0m\n";
637 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$config{USE_GNUTLS}\033[0m\n";
638 print "\033[0mOpenSSL Support:\033[1;32m\t\t$config{USE_OPENSSL}\033[0m\n\n";
640 if ($config{USE_GNUTLS} eq "y") {
642 open(TMP, "<src/modules/m_ssl_gnutls.cpp") or $failed = 1;
645 print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
646 chdir("src/modules");
647 system("ln -s extra/m_ssl_gnutls.cpp");
652 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
654 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
657 print "SSL Certificates Not found, Generating.. \n\n
658 *************************************************************
659 * Generating the Private Key may take some time, go grab a *
660 * Coffee. Even better, to generate some more entropy if it *
661 * is taking a while, open another console and type du / a *
662 * few times and get that HD going :) Then answer the *
663 * Questions which follow. If you are unsure, just hit enter *
664 *************************************************************\n\n";
665 system("certtool --generate-privkey --outfile key.pem");
666 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
667 print "\nCertificate generation complete, copying to config directory... ";
668 system("mv key.pem $config{CONFIG_DIR}/key.pem");
669 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
672 print "SSL Certificates found, skipping.\n\n"
674 } elsif ($config{USE_OPENSSL} eq "y") {
676 open(TMP, "<src/modules/m_ssl_openssl.cpp") or $failed = 1;
679 print "Symlinking src/modules/m_ssl_openssl.cpp from extra/\n";
680 chdir("src/modules");
681 system("ln -s extra/m_ssl_openssl.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 certificates may take some time, go grab a *
694 * coffee, or something. *
695 *************************************************************\n\n";
696 system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
697 system("openssl dhparam -out dhparams.pem 1024");
698 print "\nCertificate generation complete, copying to config directory... ";
699 system("mv key.pem $config{CONFIG_DIR}/key.pem");
700 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
701 system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
704 print "SSL Certificates found, skipping.\n\n"
707 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
708 print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
716 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
717 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
718 print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
719 print "load the required modules in your config. This configure process\n";
720 print "has just prepared these modules to be compiled for you, and has not\n";
721 print "configured them to be compiled into the core of the ircd.\n";
723 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
724 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
725 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";
728 if ($config{GCCVER} < "3") {
730 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
731 GCC 2.x series compilers only had partial (read as broken) C++ support, and
732 your compile will most likely fail horribly! If you have any problems, do NOT
733 report them to the bugtracker or forums without first upgrading your compiler
734 to a newer 3.x or 4.x (or whatever is available currently) version.
738 ################################################################################
740 ################################################################################
742 # Retrieves the .config.cache file, and loads values into the main config hash.
743 open(CACHE, ".config.cache") or return undef;
746 # Ignore Blank lines, and comments..
749 my ($key, $value) = split("=", $_);
750 $value =~ /^\"(.*)\"$/;
751 # Do something with data here!
759 # Dump the contents of %config
760 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
761 open(FILEHANDLE, ">.config.cache");
762 foreach $key (keys %config) {
763 print FILEHANDLE "$key=\"$config{$key}\"\n";
769 my ($desc, $hash_key) = @_;
772 print "In what directory $desc?\n";
773 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
774 chomp($var = <STDIN>);
776 $var = $config{$hash_key};
778 if ($var =~ /^\~\/(.+)$/) {
779 # Convert it to a full path..
780 $var = resolve_directory($ENV{HOME} . "/" . $1);
782 if (substr($var,0,1) ne "/")
784 # Assume relative Path was given.. fill in the rest.
785 $var = $this . "/$var";
787 $var = resolve_directory($var);
789 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
790 chomp($tmp = <STDIN>);
791 if (($tmp eq "") || ($tmp =~ /^y/i)) {
792 # Attempt to Create the Dir..
793 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
795 print "Unable to create directory. ($var)\n\n";
800 # They said they don't want to create, and we can't install there.
806 # Target exists, but is not a directory.
807 print "File $var exists, but is not a directory.\n\n";
811 # Either Dir Exists, or was created fine.
812 $config{$hash_key} = $var;
819 if ($config{OSNAME} =~ /BSD$/) {
820 $config{LDLIBS} = "-Ldl -lstdc++";
821 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
822 $config{MAKEPROG} = "gmake";
823 if ($config{OSNAME} eq "OpenBSD") {
824 chomp($foo = `eg++ -dumpversion | cut -c 1`);
825 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
826 # if theyre not running this, configure lets the build continue but they probably wont manage to
827 # compile as this standard version is 2.95.3!
829 $config{CC} = "eg++";
830 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
831 chomp($config{GCC34} = `eg++ -dumpversion | cut -c 3`); # the compiler path
835 $config{LDLIBS} = "-ldl -lstdc++";
836 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
837 $config{MAKEPROG} = "make";
838 if ($config{OSNAME} =~ /CYGWIN/) {
839 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
840 $config{LDLIBS} = "";
841 $config{MAKEPROG} = "/usr/bin/make";
842 $config{MAKEORDER} = "ircd mods";
843 } elsif ($config{OSNAME} eq "CYG-STATIC") {
844 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
845 $config{LDLIBS} = "";
846 $config{MAKEPROG} = "/usr/bin/make";
847 $config{MAKEORDER} = "mods ircd";
848 $config{STATICLIBS} = "modules/mods.a";
849 $config{STATIC_LINK} = "yes";
852 if ($config{OSNAME} =~ /SunOS/) {
853 # solaris/sunos needs these
854 # socket = bsd sockets api
856 # rt = POSIX realtime extensions
857 # resolv = inet_aton only (why isnt this in nsl?!)
858 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
876 opendir(DIRHANDLE, "src/modules");
877 foreach $name (sort readdir(DIRHANDLE)) {
878 if ($name =~ /^m_(.+)\.cpp$/)
881 if ($mod !~ /_static$/) {
882 $modlist[$i++] = $mod;
893 my $data = `svn info`;
899 $data =~ /Revision: (\d+)/;
901 if (!defined($rev)) {
908 print "Writing \033[1;32minspircd_config.h\033[0m\n";
909 # First File.. inspircd_config.h
910 chomp(my $incos = `uname -n -s -r`);
911 chomp(my $version = `sh ./src/version.sh`);
912 chomp(my $revision = getrevision());
913 $version = "$version(r$revision)";
914 chomp(my $revision2 = getrevision());
915 open(FILEHANDLE, ">include/inspircd_config.h");
916 my $NL = $config{NICK_LENGT}+1;
917 my $CL = $config{CHAN_LENGT}+1;
918 print FILEHANDLE <<EOF;
919 /* Auto generated by configure, do not modify! */
920 #ifndef __CONFIGURATION_AUTO__
921 #define __CONFIGURATION_AUTO__
923 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
924 #define MOD_PATH "$config{MODULE_DIR}"
925 #define VERSION "$version"
926 #define REVISION "$revision2"
927 #define MAXCLIENTS $config{MAX_CLIENT}
928 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
931 #define MAXCHANS $config{MAX_CHANNE}
932 #define OPERMAXCHANS $config{MAX_OPERCH}
933 #define MAXMODES $config{MAXI_MODES}
934 #define IDENTMAX $config{MAX_IDENT}
935 #define MAXQUIT $config{MAX_QUIT}
936 #define MAXTOPIC $config{MAX_TOPIC}
937 #define MAXKICK $config{MAX_KICK}
938 #define MAXGECOS $config{MAX_GECOS}
939 #define MAXAWAY $config{MAX_AWAY}
940 #define OPTIMISATION $config{OPTIMITEMP}
941 #define SYSTEM "$incos"
944 if ($config{OSNAME} =~ /SunOS/) {
945 print FILEHANDLE "#define IS_SOLARIS\n";
947 if ($config{OSNAME} =~ /CYGWIN/) {
948 print FILEHANDLE "#define IS_CYGWIN\n";
949 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
951 if ($config{OSNAME} eq "CYG-STATIC") {
952 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
955 if ($config{STATIC_LINK} eq "yes") {
956 print FILEHANDLE "#define STATIC_LINK\n";
958 if ($config{GCCVER} > 3) {
959 print FILEHANDLE "#define GCC3\n";
960 print FILEHANDLE "#define GCC34\n";
964 if ($config{GCCVER} == 3) {
965 print FILEHANDLE "#define GCC3\n";
966 if ($config{GCC34} > 3) {
967 print FILEHANDLE "#define GCC34\n";
971 if ($config{HAS_STRLCPY} eq "true") {
972 print FILEHANDLE "#define HAS_STRLCPY\n";
974 if ($config{THREADED_DNS} =~ /y/i) {
975 print FILEHANDLE "#define THREADED_DNS\n";
978 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
979 print FILEHANDLE "#define USE_KQUEUE\n";
982 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
983 print FILEHANDLE "#define USE_EPOLL\n";
986 # user didn't choose either epoll or select for their OS.
987 # default them to USE_SELECT (ewwy puke puke)
989 print FILEHANDLE "#define USE_SELECT\n";
991 print FILEHANDLE "\n#endif\n";
994 # Create a Modules List..
996 foreach $i (@modlist)
998 if ($config{STATIC_LINK} eq "yes") {
999 $modules .= "m_".$i.".o ";
1002 $modules .= "m_".$i.".so ";
1005 chomp($modules); # Remove Redundant whitespace..
1008 # Write all .in files.
1011 my $exe = "inspircd";
1013 if ($config{OSNAME} =~ /CYGWIN/) {
1014 $exe = "inspircd.exe";
1017 opendir(DIRHANDLE, $this);
1018 if ($config{THREADED_DNS} =~ /y/i) {
1019 $config{LDLIBS} = $config{LDLIBS} . " -pthread";
1021 foreach $name (sort readdir(DIRHANDLE)) {
1022 if ($name =~ /^\.(.+)\.inc$/) {
1024 # All .name.inc files need parsing!
1026 open(FILEHANDLE, ".$file.inc");
1027 while (<FILEHANDLE>) {
1032 $tmp =~ s/\@CC\@/$config{CC}/;
1033 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1034 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1035 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1036 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1037 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1038 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1039 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1040 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1041 $tmp =~ s/\@MODULES\@/$modules/;
1042 $tmp =~ s/\@EXECUTABLE\@/$exe/;
1043 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1044 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1046 print "Writing \033[1;32m$file\033[0m\n";
1047 open(FILEHANDLE, ">$file");
1048 print FILEHANDLE $tmp;
1051 closedir(DIRHANDLE);
1053 # Make inspircd executable!
1054 chmod 0744, 'inspircd';
1056 if ($config{STATIC_LINK} eq "yes") {
1057 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1058 write_static_makefile();
1059 write_static_modules_makefile();
1060 } elsif ($config{OSNAME} =~ /CYGWIN/) {
1061 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1062 write_static_makefile();
1063 write_dynamic_modules_makefile();
1065 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1066 write_dynamic_makefile();
1067 write_dynamic_modules_makefile();
1071 sub getcompilerflags {
1075 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
1084 sub getlinkerflags {
1088 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
1098 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";
1099 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";
1100 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";
1101 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";
1102 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";
1103 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";
1104 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";
1105 print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
1108 sub resolve_directory {
1110 return File::Spec->rel2abs($_[0]);
1114 my ($flag,$prompt) = @_;
1115 print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
1116 chomp($tmp = <STDIN>);
1117 if ($tmp eq "") { $tmp = $config{$flag} }
1119 if (($tmp eq "") || ($tmp =~ /^y/i)) {
1120 $config{$flag} = "y";
1122 $config{$flag} = "n";
1127 sub write_static_modules_makefile {
1128 # Modules Makefile..
1129 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1130 open(FILEHANDLE, ">src/modules/Makefile");
1133 # Module Makefile Header
1135 print FILEHANDLE <<EOF;
1136 # (C) ChatSpike development team
1137 # Makefile by <Craig\@ChatSpike.net>
1138 # Many Thanks to Andrew Church <achurch\@achurch.org>
1139 # for assisting with making this work right.
1141 # Automatically Generated by ./configure to add a modules
1142 # please run ./configure --update
1148 # End Module Makefile Header
1151 # Create a Modules List..
1156 open(MODLIST,">include/modlist.h");
1159 # Include File Header
1161 print MODLIST <<HEADER;
1162 // Generated automatically by configure. DO NOT EDIT!
1164 #ifndef __SYMBOLS__H_CONFIGURED__
1165 #define __SYMBOLS__H_CONFIGURED__
1169 # End Include File Header
1172 # Place Module List into Include
1173 foreach $i (@modlist) {
1174 if ($i !~ /_static$/) {
1175 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1178 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1183 foreach $i (@modlist)
1185 if ($i !~ /_static$/) {
1186 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1187 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1190 # Write Entry to the Makefile
1192 print FILEHANDLE <<EOCHEESE;
1193 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h
1194 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
1195 mv m_$i\_static.o ../m_$i.o
1199 # End Write Entry to the MakeFile
1201 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1202 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1203 open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
1204 while (chomp($a = <MODULE>)) {
1205 $a =~ s/init_module/$i\_init/g;
1206 print MUNGED "$a\n";
1210 print MODLIST <<EOENT;
1211 {"m_$i.so",\&$i\_init},
1216 print MODLIST "{0}};\n\n#endif\n";
1220 sub write_dynamic_modules_makefile {
1221 # Modules Makefile..
1222 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1223 open(FILEHANDLE, ">src/modules/Makefile");
1226 if ($config{OSNAME} =~ /CYGWIN/) {
1227 $extra = "../inspircd.dll.a";
1231 # Module Makefile Header
1233 print FILEHANDLE <<EOF;
1234 # (C) ChatSpike development team
1235 # Makefile by <Craig\@ChatSpike.net>
1236 # Many Thanks to Andrew Church <achurch\@achurch.org>
1237 # for assisting with making this work right.
1239 # Automatically Generated by ./configure to add a modules
1240 # please run ./configure -update or ./configure -modupdate
1246 # End Module Makefile Header
1249 # Create a Modules List..
1255 foreach $i (@modlist) {
1257 # Write Entry to the MakeFile
1259 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1260 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1261 print FILEHANDLE <<EOCHEESE;
1262 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
1263 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1264 \$(CC) \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1267 $crud = $crud . " install -v -m 0700 m_$i.so \$(MODPATH)\n";
1269 # End Write Entry to the MakeFile
1272 print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
1276 sub write_static_makefile {
1277 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1280 opendir(DIRHANDLE, "src");
1281 foreach $name (sort readdir(DIRHANDLE)) {
1282 if ($name =~ /^cmd_(.+)\.cpp$/) {
1283 $cmdlist[$i++] = $1;
1286 closedir(DIRHANDLE);
1289 foreach my $cmd (@cmdlist) {
1290 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1291 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1296 # (C) ChatSpike development team
1297 # Makefile by <Craig\@ChatSpike.net>
1298 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1301 CC = im a cheezeball
1303 CXXFLAGS = -I../include \${FLAGS}
1307 # This next section is for cygwin dynamic module builds.
1308 # Basically, what we do, is build the inspircd core as a library
1309 # then the main executable uses that. the library is capable of
1310 # loading / unloading the modules dynamically :)
1311 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1315 if ($config{OSNAME} =~ /CYGWIN/) {
1317 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 inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o inspircd.exe
1319 inspircd.exe: inspircd.dll.a
1322 inspircd.dll inspircd.dll.a: inspircd.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 hashcomp.o socket.o socketengine.o userprocess.o cull_list.o command_parse.o aes.o timer.o
1323 \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1327 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 inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o \$(MODULES) inspircd.exe
1329 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
1330 \$(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 timer.o \$(MODULES)
1336 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
1337 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1339 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
1340 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1342 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1343 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1345 socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1346 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1348 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1349 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1351 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1352 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1354 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1355 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1357 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
1358 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1360 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
1361 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1363 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
1364 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1366 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
1367 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1369 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1370 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1372 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
1373 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1375 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
1376 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1378 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
1379 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1381 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
1382 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1384 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
1385 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1387 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
1388 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1390 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
1391 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1393 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
1394 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1396 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1397 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1399 aes.o: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1400 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1402 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1403 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1406 foreach my $cmd (@cmdlist) {
1408 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
1409 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1415 sub write_dynamic_makefile {
1419 opendir(DIRHANDLE, "src");
1420 foreach $name (sort readdir(DIRHANDLE)) {
1421 if ($name =~ /^cmd_(.+)\.cpp$/) {
1422 $cmdlist[$i++] = $1;
1425 closedir(DIRHANDLE);
1429 foreach my $cmd (@cmdlist) {
1430 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1431 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1434 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1438 # (C) ChatSpike development team
1439 # Makefile by <Craig\@ChatSpike.net>
1440 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1443 CC = im a cheezeball
1445 CXXFLAGS = -I../include \${FLAGS}
1447 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 libIRCDio.so libIRCDmessage.so $cmdobjs libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so inspircd
1449 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
1450 \$(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 libIRCDtimer.so
1452 libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1453 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1454 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
1456 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
1457 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1458 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1460 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
1461 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1462 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1464 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1465 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1466 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1468 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1469 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1470 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1472 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1473 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1474 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1476 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1477 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1478 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1480 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
1481 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1482 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o
1484 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
1485 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1486 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1488 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
1489 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1490 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1492 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
1493 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1494 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1496 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1497 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1498 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1500 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
1501 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1502 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDio.so inspircd_io.o
1504 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
1505 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1506 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmessage.so message.o
1508 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
1509 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1510 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o $cmdobjs
1512 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
1513 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1514 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdnsqueue.so dnsqueue.o
1516 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
1517 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1518 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1520 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
1521 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1522 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1524 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
1525 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1526 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1528 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
1529 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1530 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1532 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1533 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1534 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1536 libIRCDaes.so: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1537 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1538 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDaes.so aes.o
1540 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1541 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1542 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1545 foreach my $cmd (@cmdlist) {
1547 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
1548 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp