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{USE_KQUEUE} = "y"; # kqueue enabled
38 $config{USE_EPOLL} = "y"; # epoll enabled
39 $config{THREADED_DNS} = "n"; # threaded dns (experimental)
40 $config{IPV6} = "n"; # IPv6 support (experimental)
41 $config{STATIC_LINK} = "no"; # are doing static modules?
42 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
43 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
44 chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version
45 chomp($config{GCC34} = `g++ -dumpversion | cut -c 3`); # Minor GCC Version
46 chomp($config{OSNAME} = `/bin/uname`); # Operating System Name
47 $config{CC} = "g++"; # C++ compiler
48 $config{MAKEORDER} = "ircd mods"; # build order
49 $config{STATICLIBS} = ""; # library archive path
50 $config{MAX_IDENT} = "12"; # max ident size
51 $config{MAX_QUIT} = "255"; # max quit message size
52 $config{MAX_TOPIC} = "307"; # max topic size
53 $config{MAX_KICK} = "255"; # max kick message size
54 $config{MAX_GECOS} = "128"; # max GECOS size
55 $config{MAX_AWAY} = "200"; # max AWAY size
59 $config{HAS_OPENSSL} =~ /OpenSSL (\S+) \d+ \S+ \d{4}/;
60 $config{HAS_OPENSSL} = $1;
62 # Minihack! Convert Cygwin to 'Cyg-Static' so i can
63 # Keep my dynamic module experiments here for later
66 if ($config{OSNAME} =~ /CYGWIN/) {
67 $config{OSNAME} = "CYG-STATIC";
70 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
71 chomp($config{OSNAME} = `/usr/bin/uname`);
72 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
73 $config{OSNAME} = "Unknown";
77 if (!$config{MAX_CLIENT_T}) {
78 $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
79 $fd_scan_fail = "true"; # Used Later
82 # Get and Set some important vars..
85 my $arg = $ARGV[0]; # Do Some Argument Checks..
86 if ($arg eq "-clean") {
87 system("rm -rf .config.cache");
88 } # Remove the config.cache file.
90 if ($arg eq "-update") {
91 # Does the cache file exist?
93 # No, No it doesn't.. *BASH*
94 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
97 # We've Loaded the cache file and all our variables..
98 print "Updating Files..\n";
100 $has_epoll = $config{HAS_EPOLL};
101 $has_kqueue = $config{HAS_KQUEUE};
108 if ($arg eq "-svnupdate") {
110 open(FH,"<.svn/entries") or $fail = 1;
112 print "This is not an SVN copy of InspIRCd.\n";
115 system("svn update");
116 system("perl configure -update");
117 if ($ARGV[1] eq "rebuild") {
118 system("make install");
123 if ($arg eq "-modupdate") {
124 # Does the cache file exist?
126 # No, No it doesn't.. *BASH*
127 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
130 # We've Loaded the cache file and all our variables..
131 print "Updating Files..\n";
133 $has_epoll = $config{HAS_EPOLL};
134 $has_kqueue = $config{HAS_KQUEUE};
135 if ($config{STATIC_LINK} eq "yes") {
136 write_static_modules_makefile();
138 write_dynamic_modules_makefile();
145 print "Checking for cache from previous configure...\n";
147 print "Checking operating system version...\n";
150 if (!$config{MAX_CLIENT}) {
151 # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
152 # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
153 # higher than the found value" :))
154 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
157 printf "Checking if strlcpy exists... ";
158 # Perform the strlcpy() test..
159 $config{HAS_STRLCPY} = "false";
161 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
163 while (chomp($line = <STRLCPY>)) {
164 # try and find the delcaration of:
165 # size_t strlcpy(...)
166 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
167 $config{HAS_STRLCPY} = "true";
172 print "yes\n" if $config{HAS_STRLCPY} eq "true";
173 print "no\n" if $config{HAS_STRLCPY} eq "false";
175 printf "Checking if kqueue exists... ";
178 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
180 while (chomp($line = <KQUEUE>)) {
181 # try and find the delcaration of:
183 if ($line =~ /int(\0x9|\s)+kqueue/) {
189 print "yes\n" if $has_kqueue == 1;
190 print "no\n" if $has_kqueue == 0;
192 printf "Checking if epoll exists... ";
195 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
201 my $kernel = `uname -r`;
203 if (($kernel =~ /2\.0/) || ($kernel =~ /2\.2/) || ($kernel =~ /2\.4/)) {
207 print "yes\n" if $has_epoll == 1;
208 print "no\n" if $has_epoll == 0;
210 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
211 $config{HAS_STRLCPY} = "true";
214 $config{HAS_EPOLL} = $has_epoll;
215 $config{HAS_KQUEUE} = $has_kqueue;
217 printf "Checking for libgnutls... ";
218 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
220 $config{HAS_GNUTLS} = "y";
223 $config{HAS_GNUTLS} = "n";
226 printf "Checking for openssl... ";
227 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
229 $config{HAS_OPENSSL} = "y";
232 $config{HAS_OPENSSL} = "n";
235 ################################################################################
236 # BEGIN INTERACTIVE PART #
237 ################################################################################
241 # Display Splash Logo..
243 chomp($wholeos = `uname -mnr`);
245 my $rev = getrevision();
246 # Display Introduction Message..
248 Welcome to the InspIRCd Configuration program!
250 *** If you are unsure of any of these values, leave it blank for ***
251 *** standard settings that will work, and your server will run ***
252 *** using them. If you are running this server as part of a ***
253 *** larger network, you must consult with your network admins ***
254 *** for the proper values to use, or server links will be unstable! ***
256 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
257 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
258 dir, otherwise you won't have a config file!
260 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos), fdmax: $config{MAX_CLIENT_T}
261 Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
263 print " (Non-SVN build)";
267 $config{CHANGE_COMPILER} = "n";
268 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";
270 while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
271 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
272 should NOT be used. You should probably specify a newer compiler.\n\n";
273 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
274 if ($config{CHANGE_COMPILER} =~ /y/i) {
275 print "What command do you want to use to invoke your compiler?\n";
276 print "[\033[1;32m$config{CC}\033[0m] -> ";
277 chomp($config{CC} = <STDIN>);
278 if ($config{CC} eq "") {
281 chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
283 chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change
284 chomp($config{GCC34} = `$config{CC} -dumpversion | cut -c 3`); # the compiler path
285 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.$config{GCC34}\033[0m)\n";
286 if ($config{GCCVER} < 3) {
287 print "\033[1;32mGCC 2.x WILL NOT WORK!\033[0m. Let's try that again, shall we?\n";
291 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
298 # Directory Settings..
299 my $tmpbase = $config{BASE_DIR};
300 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
301 if ($tmpbase ne $config{BASE_DIR}) {
302 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
303 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
304 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
305 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
308 dir_check("are the configuration files", "CONFIG_DIR");
309 dir_check("are the modules to be compiled to", "MODULE_DIR");
310 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
311 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
314 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?");
318 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?");
321 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
322 if (!$chose_hiperf) {
323 print "No high-performance socket engines are available, or you chose\n";
324 print "not to enable one. Defaulting to select() engine.\n\n";
327 yesno(THREADED_DNS,"Would you like to enable the experimental multi-threaded DNS lookup?");
330 yesno(IPV6,"Would you like to enable IPv6 support?");
333 if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
334 print "I have detected both GnuTLS and OpenSSL on your system.\n";
335 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
336 print "instead, you should enable the OpenSSL module yourself\n";
337 print "by copying it from src/modules/extra to src/modules.\n\n";
340 if ($config{HAS_GNUTLS} eq "y") {
341 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
342 if ($config{USE_GNUTLS} eq "y") {
343 print "\nUsing GnuTLS SSL module.\n";
345 } elsif ($config{HAS_OPENSSL} eq "y") {
346 yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
347 if ($config{USE_OPENSSL} eq "y") {
348 print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
352 print "\nThe following questions will ask you for various figures relating\n";
353 print "To your IRCd install. Please note that these should usually be left\n";
354 print "as defaults unless you have a real reason to change them. If they\n";
355 print "changed, then the values must be identical on all servers on your\n";
356 print "network, or malfunctions and/or crashes may occur, with the exception\n";
357 print "of the 'maximum number of clients' setting which may be different on\n";
358 print "different servers on the network.\n\n";
360 # File Descriptor Settings..
363 print "Maximum number of clients at any one time ($config{MAX_CLIENT_T})\n";
364 print "[\033[1;32m$config{MAX_CLIENT}\033[0m] -> ";
365 chomp($var = <STDIN>);
367 $var = $config{MAX_CLIENT};
369 if ($var =~ /^\d+$/) {
370 if (($var > $config{MAX_CLIENT_T}) && ($fd_scan_failed ne true)) {
371 # Client has entered a larger number than the 'discovered' value
373 print "WARNING: Our scans have indicated that you are attempting
374 to use more sockets than there are avaliable. Are you sure
375 you wish to do this? It may cause the IRCd to malfunction [y/n]
376 [\033[1;32mn\033[0m] -> $c";
377 chomp($tmp = <STDIN>);
379 print "Please enter the correct value.\n\n";
384 print "You must enter a number in this field. Please try again.\n\n";
387 # If we get here, we should be good to go.
388 $config{MAX_CLIENT} = $var;
395 print "What is the maximum length of nicknames?\n";
396 print "[\033[1;32m$config{NICK_LENGT}\033[0m] -> ";
397 chomp($var = <STDIN>);
399 $var = $config{NICK_LENGT};
401 if ($var =~ /^\d+$/) {
402 # We don't care what the number is, set it and be on our way.
403 $config{NICK_LENGT} = $var;
407 print "You must enter a number in this field. Please try again.\n\n";
413 print "What is the maximum length of channel names?\n";
414 print "[\033[1;32m$config{CHAN_LENGT}\033[0m] -> ";
415 chomp($var = <STDIN>);
417 $var = $config{CHAN_LENGT};
419 if ($var =~ /^\d+$/) {
420 # We don't care what the number is, set it and be on our way.
421 $config{CHAN_LENGT} = $var;
425 print "You must enter a number in this field. Please try again.\n\n";
431 print "What is the maximum number of channels a normal user may join at any one time?\n";
432 print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
433 chomp($var = <STDIN>);
435 $var = $config{MAX_CHANNE};
437 if ($var =~ /^\d+$/) {
438 # We don't care what the number is, set it and be on our way.
439 $config{MAX_CHANNE} = $var;
443 print "You must enter a number in this field. Please try again.\n\n";
449 print "What is the maximum number of channels an oper may join at any one time?\n";
450 print "[\033[1;32m$config{MAX_OPERCH}\033[0m] -> ";
451 chomp($var = <STDIN>);
453 $var = $config{MAX_OPERCH};
455 if ($var =~ /^\d+$/) {
456 # We don't care what the number is, set it and be on our way.
457 $config{MAX_OPERCH} = $var;
465 print "What is the maximum number of mode changes in one line?\n";
466 print "[\033[1;32m$config{MAXI_MODES}\033[0m] -> ";
467 chomp($var = <STDIN>);
469 $var = $config{MAXI_MODES};
471 if ($var =~ /^\d+$/) {
472 # We don't care what the number is, set it and be on our way.
473 $config{MAXI_MODES} = $var;
477 print "You must enter a number in this field. Please try again.\n\n";
483 print "What is the maximum length of an ident (username)?\n";
484 print "[\033[1;32m$config{MAX_IDENT}\033[0m] -> ";
485 chomp($var = <STDIN>);
487 $var = $config{MAX_IDENT};
489 if ($var =~ /^\d+$/) {
490 # We don't care what the number is, set it and be on our way.
491 $config{MAX_IDENT} = $var;
495 print "You must enter a number in this field. Please try again.\n\n";
501 print "What is the maximum length of a quit message?\n";
502 print "[\033[1;32m$config{MAX_QUIT}\033[0m] -> ";
503 chomp($var = <STDIN>);
505 $var = $config{MAX_QUIT};
507 if ($var =~ /^\d+$/) {
508 # We don't care what the number is, set it and be on our way.
509 $config{MAX_QUIT} = $var;
513 print "You must enter a number in this field. Please try again.\n\n";
519 print "What is the maximum length of a channel topic?\n";
520 print "[\033[1;32m$config{MAX_TOPIC}\033[0m] -> ";
521 chomp($var = <STDIN>);
523 $var = $config{MAX_TOPIC};
525 if ($var =~ /^\d+$/) {
526 # We don't care what the number is, set it and be on our way.
527 $config{MAX_TOPIC} = $var;
531 print "You must enter a number in this field. Please try again.\n\n";
537 print "What is the maximum length of a kick message?\n";
538 print "[\033[1;32m$config{MAX_KICK}\033[0m] -> ";
539 chomp($var = <STDIN>);
541 $var = $config{MAX_KICK};
543 if ($var =~ /^\d+$/) {
544 # We don't care what the number is, set it and be on our way.
545 $config{MAX_KICK} = $var;
549 print "You must enter a number in this field. Please try again.\n\n";
555 print "What is the maximum length of a GECOS (real name) field?\n";
556 print "[\033[1;32m$config{MAX_GECOS}\033[0m] -> ";
557 chomp($var = <STDIN>);
559 $var = $config{MAX_GECOS};
561 if ($var =~ /^\d+$/) {
562 # We don't care what the number is, set it and be on our way.
563 $config{MAX_GECOS} = $var;
567 print "You must enter a number in this field. Please try again.\n\n";
573 print "What is the maximum length of an away message?\n";
574 print "[\033[1;32m$config{MAX_AWAY}\033[0m] -> ";
575 chomp($var = <STDIN>);
577 $var = $config{MAX_AWAY};
579 if ($var =~ /^\d+$/) {
580 # We don't care what the number is, set it and be on our way.
581 $config{MAX_AWAY} = $var;
585 print "You must enter a number in this field. Please try again.\n\n";
590 print "Enter the Level Of Binary optimisation. This is a number between 0 and 3.
591 The InspIRCd Team will NOT support any bug reports above 0. Also note,
592 the IRCd behaviour will be different depending on this value. Please
593 read the documentation for more information.
595 The higher the number, the more optimised your binary will be. This
596 value will default to 0 if you either don't enter a number, or enter
597 a value outside the range.
599 As always, if you are unsure, just press enter and accept the default.\n\n";
600 print "[\033[1;32m$config{OPTIMITEMP}\033[0m] -> ";
601 chomp($var = <STDIN>);
603 $var = $config{OPTIMITEMP};
607 $config{OPTIMITEMP} = 1;
608 $config{OPTIMISATI} = "-O";
609 } elsif ($var eq "2") {
610 $config{OPTIMITEMP} = 2;
611 $config{OPTIMISATI} = "-O2";
612 } elsif ($var eq "3") {
613 $config{OPTIMITEMP} = 3;
614 $config{OPTIMISATI} = "-O3";
616 $config{OPTIMITEMP} = 0;
617 $config{OPTIMISATI} = "-g";
620 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
621 print "\033[0mBase install path:\033[1;32m\t\t$config{BASE_DIR}\n";
622 print "\033[0mConfig path:\033[1;32m\t\t\t$config{CONFIG_DIR}\n";
623 print "\033[0mModule path:\033[1;32m\t\t\t$config{MODULE_DIR}\n";
624 print "\033[0mLibrary path:\033[1;32m\t\t\t$config{LIBRARY_DIR}\n";
625 print "\033[0mMax connections:\033[1;32m\t\t$config{MAX_CLIENT}\n";
626 print "\033[0mMax User Channels:\033[1;32m\t\t$config{MAX_CHANNE}\n";
627 print "\033[0mMax Oper Channels:\033[1;32m\t\t$config{MAX_OPERCH}\n";
628 print "\033[0mMax nickname length:\033[1;32m\t\t$config{NICK_LENGT}\n";
629 print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
630 print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
631 print "\033[0mMax ident length:\033[1;32m\t\t$config{MAX_IDENT}\n";
632 print "\033[0mMax quit length:\033[1;32m\t\t$config{MAX_QUIT}\n";
633 print "\033[0mMax topic length:\033[1;32m\t\t$config{MAX_TOPIC}\n";
634 print "\033[0mMax kick length:\033[1;32m\t\t$config{MAX_KICK}\n";
635 print "\033[0mMax name length:\033[1;32m\t\t$config{MAX_GECOS}\n";
636 print "\033[0mMax away length:\033[1;32m\t\t$config{MAX_AWAY}\n";
637 print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
638 print "\033[0mOptimization Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
639 print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n";
640 print "\033[0mStatic modules:\033[1;32m\t\t\t$config{STATIC_LINK}\033[0m\n";
641 print "\033[0mMultithread DNS:\033[1;32m\t\t$config{THREADED_DNS}\033[0m\n";
642 print "\033[0mIPv6 Support:\033[1;32m\t\t\t$config{IPV6}\033[0m\n";
643 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$config{USE_GNUTLS}\033[0m\n";
644 print "\033[0mOpenSSL Support:\033[1;32m\t\t$config{USE_OPENSSL}\033[0m\n\n";
646 if ($config{USE_GNUTLS} eq "y") {
648 open(TMP, "<src/modules/m_ssl_gnutls.cpp") or $failed = 1;
651 print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
652 chdir("src/modules");
653 system("ln -s extra/m_ssl_gnutls.cpp");
658 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
660 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
663 print "SSL Certificates Not found, Generating.. \n\n
664 *************************************************************
665 * Generating the Private Key may take some time, go grab a *
666 * Coffee. Even better, to generate some more entropy if it *
667 * is taking a while, open another console and type du / a *
668 * few times and get that HD going :) Then answer the *
669 * Questions which follow. If you are unsure, just hit enter *
670 *************************************************************\n\n";
671 system("certtool --generate-privkey --outfile key.pem");
672 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
673 print "\nCertificate generation complete, copying to config directory... ";
674 system("mv key.pem $config{CONFIG_DIR}/key.pem");
675 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
678 print "SSL Certificates found, skipping.\n\n"
680 } elsif ($config{USE_OPENSSL} eq "y") {
682 open(TMP, "<src/modules/m_ssl_openssl.cpp") or $failed = 1;
685 print "Symlinking src/modules/m_ssl_openssl.cpp from extra/\n";
686 chdir("src/modules");
687 system("ln -s extra/m_ssl_openssl.cpp");
692 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
694 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
697 print "SSL Certificates Not found, Generating.. \n\n
698 *************************************************************
699 * Generating the certificates may take some time, go grab a *
700 * coffee, or something. *
701 *************************************************************\n\n";
702 system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
703 system("openssl dhparam -out dhparams.pem 1024");
704 print "\nCertificate generation complete, copying to config directory... ";
705 system("mv key.pem $config{CONFIG_DIR}/key.pem");
706 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
707 system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
710 print "SSL Certificates found, skipping.\n\n"
713 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
714 print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
722 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
723 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
724 print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
725 print "load the required modules in your config. This configure process\n";
726 print "has just prepared these modules to be compiled for you, and has not\n";
727 print "configured them to be compiled into the core of the ircd.\n";
729 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
730 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
731 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";
734 if ($config{GCCVER} < "3") {
736 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
737 GCC 2.x series compilers only had partial (read as broken) C++ support, and
738 your compile will most likely fail horribly! If you have any problems, do NOT
739 report them to the bugtracker or forums without first upgrading your compiler
740 to a newer 3.x or 4.x (or whatever is available currently) version.
744 ################################################################################
746 ################################################################################
748 # Retrieves the .config.cache file, and loads values into the main config hash.
749 open(CACHE, ".config.cache") or return undef;
752 # Ignore Blank lines, and comments..
755 my ($key, $value) = split("=", $_);
756 $value =~ /^\"(.*)\"$/;
757 # Do something with data here!
765 # Dump the contents of %config
766 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
767 open(FILEHANDLE, ">.config.cache");
768 foreach $key (keys %config) {
769 print FILEHANDLE "$key=\"$config{$key}\"\n";
775 my ($desc, $hash_key) = @_;
778 print "In what directory $desc?\n";
779 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
780 chomp($var = <STDIN>);
782 $var = $config{$hash_key};
784 if ($var =~ /^\~\/(.+)$/) {
785 # Convert it to a full path..
786 $var = resolve_directory($ENV{HOME} . "/" . $1);
788 if (substr($var,0,1) ne "/")
790 # Assume relative Path was given.. fill in the rest.
791 $var = $this . "/$var";
793 $var = resolve_directory($var);
795 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
796 chomp($tmp = <STDIN>);
797 if (($tmp eq "") || ($tmp =~ /^y/i)) {
798 # Attempt to Create the Dir..
799 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
801 print "Unable to create directory. ($var)\n\n";
806 # They said they don't want to create, and we can't install there.
812 # Target exists, but is not a directory.
813 print "File $var exists, but is not a directory.\n\n";
817 # Either Dir Exists, or was created fine.
818 $config{$hash_key} = $var;
825 if ($config{OSNAME} =~ /BSD$/) {
826 $config{LDLIBS} = "-Ldl -lstdc++";
827 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
828 $config{MAKEPROG} = "gmake";
829 if ($config{OSNAME} eq "OpenBSD") {
830 chomp($foo = `eg++ -dumpversion | cut -c 1`);
831 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
832 # if theyre not running this, configure lets the build continue but they probably wont manage to
833 # compile as this standard version is 2.95.3!
835 $config{CC} = "eg++";
836 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
837 chomp($config{GCC34} = `eg++ -dumpversion | cut -c 3`); # the compiler path
841 $config{LDLIBS} = "-ldl -lstdc++";
842 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
843 $config{MAKEPROG} = "make";
844 if ($config{OSNAME} =~ /CYGWIN/) {
845 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
846 $config{LDLIBS} = "";
847 $config{MAKEPROG} = "/usr/bin/make";
848 $config{MAKEORDER} = "ircd mods";
849 } elsif ($config{OSNAME} eq "CYG-STATIC") {
850 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
851 $config{LDLIBS} = "";
852 $config{MAKEPROG} = "/usr/bin/make";
853 $config{MAKEORDER} = "mods ircd";
854 $config{STATICLIBS} = "modules/mods.a";
855 $config{STATIC_LINK} = "yes";
858 if ($config{OSNAME} =~ /SunOS/) {
859 # solaris/sunos needs these
860 # socket = bsd sockets api
862 # rt = POSIX realtime extensions
863 # resolv = inet_aton only (why isnt this in nsl?!)
864 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
882 opendir(DIRHANDLE, "src/modules");
883 foreach $name (sort readdir(DIRHANDLE)) {
884 if ($name =~ /^m_(.+)\.cpp$/)
887 if ($mod !~ /_static$/) {
888 $modlist[$i++] = $mod;
899 my $data = `svn info`;
905 $data =~ /Revision: (\d+)/;
907 if (!defined($rev)) {
914 print "Writing \033[1;32minspircd_config.h\033[0m\n";
915 # First File.. inspircd_config.h
916 chomp(my $incos = `uname -n -s -r`);
917 chomp(my $version = `sh ./src/version.sh`);
918 chomp(my $revision = getrevision());
919 $version = "$version(r$revision)";
920 chomp(my $revision2 = getrevision());
921 open(FILEHANDLE, ">include/inspircd_config.h");
922 my $NL = $config{NICK_LENGT}+1;
923 my $CL = $config{CHAN_LENGT}+1;
924 print FILEHANDLE <<EOF;
925 /* Auto generated by configure, do not modify! */
926 #ifndef __CONFIGURATION_AUTO__
927 #define __CONFIGURATION_AUTO__
929 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
930 #define MOD_PATH "$config{MODULE_DIR}"
931 #define VERSION "$version"
932 #define REVISION "$revision2"
933 #define MAXCLIENTS $config{MAX_CLIENT}
934 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
937 #define MAXCHANS $config{MAX_CHANNE}
938 #define OPERMAXCHANS $config{MAX_OPERCH}
939 #define MAXMODES $config{MAXI_MODES}
940 #define IDENTMAX $config{MAX_IDENT}
941 #define MAXQUIT $config{MAX_QUIT}
942 #define MAXTOPIC $config{MAX_TOPIC}
943 #define MAXKICK $config{MAX_KICK}
944 #define MAXGECOS $config{MAX_GECOS}
945 #define MAXAWAY $config{MAX_AWAY}
946 #define OPTIMISATION $config{OPTIMITEMP}
947 #define SYSTEM "$incos"
950 if ($config{OSNAME} =~ /SunOS/) {
951 print FILEHANDLE "#define IS_SOLARIS\n";
953 if ($config{OSNAME} =~ /CYGWIN/) {
954 print FILEHANDLE "#define IS_CYGWIN\n";
955 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
957 if ($config{OSNAME} eq "CYG-STATIC") {
958 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
961 if ($config{STATIC_LINK} eq "yes") {
962 print FILEHANDLE "#define STATIC_LINK\n";
964 if ($config{GCCVER} > 3) {
965 print FILEHANDLE "#define GCC3\n";
966 print FILEHANDLE "#define GCC34\n";
970 if ($config{GCCVER} == 3) {
971 print FILEHANDLE "#define GCC3\n";
972 if ($config{GCC34} > 3) {
973 print FILEHANDLE "#define GCC34\n";
977 if ($config{HAS_STRLCPY} eq "true") {
978 print FILEHANDLE "#define HAS_STRLCPY\n";
980 if ($config{THREADED_DNS} =~ /y/i) {
981 print FILEHANDLE "#define THREADED_DNS\n";
983 if ($config{IPV6} =~/y/i) {
984 print FILEHANDLE "#define IPV6\n";
987 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
988 print FILEHANDLE "#define USE_KQUEUE\n";
991 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
992 print FILEHANDLE "#define USE_EPOLL\n";
995 # user didn't choose either epoll or select for their OS.
996 # default them to USE_SELECT (ewwy puke puke)
998 print FILEHANDLE "#define USE_SELECT\n";
1000 print FILEHANDLE "\n#endif\n";
1003 # Create a Modules List..
1005 foreach $i (@modlist)
1007 if ($config{STATIC_LINK} eq "yes") {
1008 $modules .= "m_".$i.".o ";
1011 $modules .= "m_".$i.".so ";
1014 chomp($modules); # Remove Redundant whitespace..
1017 # Write all .in files.
1020 my $exe = "inspircd";
1022 if ($config{OSNAME} =~ /CYGWIN/) {
1023 $exe = "inspircd.exe";
1026 opendir(DIRHANDLE, $this);
1027 if ($config{THREADED_DNS} =~ /y/i) {
1028 $config{LDLIBS} = $config{LDLIBS} . " -pthread";
1030 foreach $name (sort readdir(DIRHANDLE)) {
1031 if ($name =~ /^\.(.+)\.inc$/) {
1033 # All .name.inc files need parsing!
1035 open(FILEHANDLE, ".$file.inc");
1036 while (<FILEHANDLE>) {
1041 $tmp =~ s/\@CC\@/$config{CC}/;
1042 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1043 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1044 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1045 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1046 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1047 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1048 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1049 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1050 $tmp =~ s/\@MODULES\@/$modules/;
1051 $tmp =~ s/\@EXECUTABLE\@/$exe/;
1052 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1053 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1055 print "Writing \033[1;32m$file\033[0m\n";
1056 open(FILEHANDLE, ">$file");
1057 print FILEHANDLE $tmp;
1060 closedir(DIRHANDLE);
1062 # Make inspircd executable!
1063 chmod 0744, 'inspircd';
1065 if ($config{STATIC_LINK} eq "yes") {
1066 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1067 write_static_makefile();
1068 write_static_modules_makefile();
1069 } elsif ($config{OSNAME} =~ /CYGWIN/) {
1070 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1071 write_static_makefile();
1072 write_dynamic_modules_makefile();
1074 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1075 write_dynamic_makefile();
1076 write_dynamic_modules_makefile();
1080 sub getcompilerflags {
1084 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
1093 sub getlinkerflags {
1097 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
1107 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";
1108 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";
1109 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";
1110 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";
1111 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";
1112 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";
1113 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";
1114 print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
1117 sub resolve_directory {
1119 return File::Spec->rel2abs($_[0]);
1123 my ($flag,$prompt) = @_;
1124 print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
1125 chomp($tmp = <STDIN>);
1126 if ($tmp eq "") { $tmp = $config{$flag} }
1128 if (($tmp eq "") || ($tmp =~ /^y/i)) {
1129 $config{$flag} = "y";
1131 $config{$flag} = "n";
1136 sub write_static_modules_makefile {
1137 # Modules Makefile..
1138 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1139 open(FILEHANDLE, ">src/modules/Makefile");
1142 # Module Makefile Header
1144 print FILEHANDLE <<EOF;
1145 # (C) ChatSpike development team
1146 # Makefile by <Craig\@ChatSpike.net>
1147 # Many Thanks to Andrew Church <achurch\@achurch.org>
1148 # for assisting with making this work right.
1150 # Automatically Generated by ./configure to add a modules
1151 # please run ./configure --update
1157 # End Module Makefile Header
1160 # Create a Modules List..
1165 open(MODLIST,">include/modlist.h");
1168 # Include File Header
1170 print MODLIST <<HEADER;
1171 // Generated automatically by configure. DO NOT EDIT!
1173 #ifndef __SYMBOLS__H_CONFIGURED__
1174 #define __SYMBOLS__H_CONFIGURED__
1178 # End Include File Header
1181 # Place Module List into Include
1182 foreach $i (@modlist) {
1183 if ($i !~ /_static$/) {
1184 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1187 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1192 foreach $i (@modlist)
1194 if ($i !~ /_static$/) {
1195 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1196 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1199 # Write Entry to the Makefile
1201 print FILEHANDLE <<EOCHEESE;
1202 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h
1203 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
1204 mv m_$i\_static.o ../m_$i.o
1208 # End Write Entry to the MakeFile
1210 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1211 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1212 open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
1213 while (chomp($a = <MODULE>)) {
1214 $a =~ s/init_module/$i\_init/g;
1215 print MUNGED "$a\n";
1219 print MODLIST <<EOENT;
1220 {"m_$i.so",\&$i\_init},
1225 print MODLIST "{0}};\n\n#endif\n";
1229 sub write_dynamic_modules_makefile {
1230 # Modules Makefile..
1231 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1232 open(FILEHANDLE, ">src/modules/Makefile");
1235 if ($config{OSNAME} =~ /CYGWIN/) {
1236 $extra = "../inspircd.dll.a";
1240 # Module Makefile Header
1242 print FILEHANDLE <<EOF;
1243 # (C) ChatSpike development team
1244 # Makefile by <Craig\@ChatSpike.net>
1245 # Many Thanks to Andrew Church <achurch\@achurch.org>
1246 # for assisting with making this work right.
1248 # Automatically Generated by ./configure to add a modules
1249 # please run ./configure -update or ./configure -modupdate
1255 # End Module Makefile Header
1258 # Create a Modules List..
1264 foreach $i (@modlist) {
1266 # Write Entry to the MakeFile
1268 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1269 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1270 print FILEHANDLE <<EOCHEESE;
1271 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
1272 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1273 \$(CC) \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1276 $crud = $crud . " \@install -v -m 0700 m_$i.so \$(MODPATH)\n";
1278 # End Write Entry to the MakeFile
1281 print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
1285 sub write_static_makefile {
1286 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1289 opendir(DIRHANDLE, "src");
1290 foreach $name (sort readdir(DIRHANDLE)) {
1291 if ($name =~ /^cmd_(.+)\.cpp$/) {
1292 $cmdlist[$i++] = $1;
1295 closedir(DIRHANDLE);
1298 foreach my $cmd (@cmdlist) {
1299 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1300 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1305 # (C) ChatSpike development team
1306 # Makefile by <Craig\@ChatSpike.net>
1307 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1310 CC = im a cheezeball
1312 CXXFLAGS = -I../include \${FLAGS}
1316 # This next section is for cygwin dynamic module builds.
1317 # Basically, what we do, is build the inspircd core as a library
1318 # then the main executable uses that. the library is capable of
1319 # loading / unloading the modules dynamically :)
1320 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1324 if ($config{OSNAME} =~ /CYGWIN/) {
1326 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
1328 inspircd.exe: inspircd.dll.a
1331 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
1332 \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1336 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
1338 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
1339 \$(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 \$(MODULES)
1345 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
1346 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1348 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
1349 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1351 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1352 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1354 socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1355 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1357 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1358 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1360 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1361 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1363 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1364 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1366 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
1367 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1369 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
1370 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1372 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
1373 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1375 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
1376 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1378 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1379 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1381 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
1382 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1384 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
1385 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1387 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
1388 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1390 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
1391 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1393 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
1394 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1396 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
1397 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1399 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
1400 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1402 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
1403 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1405 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1406 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1408 inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1409 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1411 aes.o: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1412 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1414 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1415 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1418 foreach my $cmd (@cmdlist) {
1420 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
1421 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1427 sub write_dynamic_makefile {
1431 opendir(DIRHANDLE, "src");
1432 foreach $name (sort readdir(DIRHANDLE)) {
1433 if ($name =~ /^cmd_(.+)\.cpp$/) {
1434 $cmdlist[$i++] = $1;
1437 closedir(DIRHANDLE);
1441 foreach my $cmd (@cmdlist) {
1442 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1443 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1446 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1450 # (C) ChatSpike development team
1451 # Makefile by <Craig\@ChatSpike.net>
1452 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1455 CC = im a cheezeball
1457 CXXFLAGS = -I../include \${FLAGS}
1459 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
1461 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
1462 \$(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 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
1464 libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1465 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1466 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
1468 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
1469 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1470 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1472 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
1473 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1474 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1476 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1477 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1478 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1480 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1481 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1482 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1484 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1485 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1486 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1488 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1489 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1490 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1492 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
1493 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1494 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o
1496 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
1497 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1498 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1500 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
1501 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1502 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1504 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
1505 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1506 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1508 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1509 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1510 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1512 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
1513 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1514 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDconfigreader.so configreader.o
1516 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
1517 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1518 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmessage.so message.o
1520 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
1521 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1522 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o $cmdobjs
1524 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
1525 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1526 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdnsqueue.so dnsqueue.o
1528 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
1529 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1530 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1532 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
1533 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1534 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1536 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
1537 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1538 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1540 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
1541 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1542 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1544 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1545 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1546 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1548 libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1549 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1550 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDinspsocket.so inspsocket.o
1552 libIRCDaes.so: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1553 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1554 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDaes.so aes.o
1556 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1557 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1558 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1561 foreach my $cmd (@cmdlist) {
1563 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
1564 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp