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{STATIC_LINK} = "no"; # are doing static modules?
41 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
42 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
43 chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version
44 chomp($config{GCC34} = `g++ -dumpversion | cut -c 3`); # Minor GCC Version
45 chomp($config{OSNAME} = `/bin/uname`); # Operating System Name
46 $config{CC} = "g++"; # C++ compiler
47 $config{MAKEORDER} = "ircd mods"; # build order
48 $config{STATICLIBS} = ""; # library archive path
49 $config{MAX_IDENT} = "12"; # max ident size
50 $config{MAX_QUIT} = "255"; # max quit message size
51 $config{MAX_TOPIC} = "307"; # max topic size
52 $config{MAX_KICK} = "255"; # max kick message size
53 $config{MAX_GECOS} = "128"; # max GECOS size
54 $config{MAX_AWAY} = "200"; # max AWAY size
58 $config{HAS_OPENSSL} =~ /OpenSSL (\S+) \d+ \S+ \d{4}/;
59 $config{HAS_OPENSSL} = $1;
61 # Minihack! Convert Cygwin to 'Cyg-Static' so i can
62 # Keep my dynamic module experiments here for later
65 if ($config{OSNAME} =~ /CYGWIN/) {
66 $config{OSNAME} = "CYG-STATIC";
69 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
70 chomp($config{OSNAME} = `/usr/bin/uname`);
71 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
72 $config{OSNAME} = "Unknown";
76 if (!$config{MAX_CLIENT_T}) {
77 $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
78 $fd_scan_fail = "true"; # Used Later
81 # Get and Set some important vars..
84 my $arg = $ARGV[0]; # Do Some Argument Checks..
85 if ($arg eq "-clean") {
86 system("rm -rf .config.cache");
87 } # Remove the config.cache file.
89 if ($arg eq "-update") {
90 # Does the cache file exist?
92 # No, No it doesn't.. *BASH*
93 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
96 # We've Loaded the cache file and all our variables..
97 print "Updating Files..\n";
99 $has_epoll = $config{HAS_EPOLL};
100 $has_kqueue = $config{HAS_KQUEUE};
107 if ($arg eq "-svnupdate") {
109 open(FH,"<.svn/entries") or $fail = 1;
111 print "This is not an SVN copy of InspIRCd.\n";
114 system("svn update");
115 system("perl configure -update");
116 if ($ARGV[1] eq "rebuild") {
117 system("make install");
122 if ($arg eq "-modupdate") {
123 # Does the cache file exist?
125 # No, No it doesn't.. *BASH*
126 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
129 # We've Loaded the cache file and all our variables..
130 print "Updating Files..\n";
132 $has_epoll = $config{HAS_EPOLL};
133 $has_kqueue = $config{HAS_KQUEUE};
134 if ($config{STATIC_LINK} eq "yes") {
135 write_static_modules_makefile();
137 write_dynamic_modules_makefile();
144 print "Checking for cache from previous configure...\n";
146 print "Checking operating system version...\n";
149 if (!$config{MAX_CLIENT}) {
150 # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
151 # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
152 # higher than the found value" :))
153 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
156 printf "Checking if strlcpy exists... ";
157 # Perform the strlcpy() test..
158 $config{HAS_STRLCPY} = "false";
160 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
162 while (chomp($line = <STRLCPY>)) {
163 # try and find the delcaration of:
164 # size_t strlcpy(...)
165 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
166 $config{HAS_STRLCPY} = "true";
171 print "yes\n" if $config{HAS_STRLCPY} eq "true";
172 print "no\n" if $config{HAS_STRLCPY} eq "false";
174 printf "Checking if kqueue exists... ";
177 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
179 while (chomp($line = <KQUEUE>)) {
180 # try and find the delcaration of:
182 if ($line =~ /int(\0x9|\s)+kqueue/) {
188 print "yes\n" if $has_kqueue == 1;
189 print "no\n" if $has_kqueue == 0;
191 printf "Checking if epoll exists... ";
194 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
200 my $kernel = `uname -r`;
202 if (($kernel =~ /2\.0/) || ($kernel =~ /2\.2/) || ($kernel =~ /2\.4/)) {
206 print "yes\n" if $has_epoll == 1;
207 print "no\n" if $has_epoll == 0;
209 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
210 $config{HAS_STRLCPY} = "true";
213 $config{HAS_EPOLL} = $has_epoll;
214 $config{HAS_KQUEUE} = $has_kqueue;
216 printf "Checking for libgnutls... ";
217 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
219 $config{HAS_GNUTLS} = "y";
222 $config{HAS_GNUTLS} = "n";
225 printf "Checking for openssl... ";
226 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
228 $config{HAS_OPENSSL} = "y";
231 $config{HAS_OPENSSL} = "n";
234 ################################################################################
235 # BEGIN INTERACTIVE PART #
236 ################################################################################
240 # Display Splash Logo..
242 chomp($wholeos = `uname -mnr`);
244 my $rev = getrevision();
245 # Display Introduction Message..
247 Welcome to the InspIRCd Configuration program!
249 *** If you are unsure of any of these values, leave it blank for ***
250 *** standard settings that will work, and your server will run ***
251 *** using them. If you are running this server as part of a ***
252 *** larger network, you must consult with your network admins ***
253 *** for the proper values to use, or server links will be unstable! ***
255 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
256 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
257 dir, otherwise you won't have a config file!
259 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos), fdmax: $config{MAX_CLIENT_T}
260 Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
262 print " (Non-SVN build)";
266 $config{CHANGE_COMPILER} = "n";
267 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";
269 while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
270 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
271 should NOT be used. You should probably specify a newer compiler.\n\n";
272 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
273 if ($config{CHANGE_COMPILER} =~ /y/i) {
274 print "What command do you want to use to invoke your compiler?\n";
275 print "[\033[1;32m$config{CC}\033[0m] -> ";
276 chomp($config{CC} = <STDIN>);
277 if ($config{CC} eq "") {
280 chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
282 chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change
283 chomp($config{GCC34} = `$config{CC} -dumpversion | cut -c 3`); # the compiler path
284 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.$config{GCC34}\033[0m)\n";
285 if ($config{GCCVER} < 3) {
286 print "\033[1;32mGCC 2.x WILL NOT WORK!\033[0m. Let's try that again, shall we?\n";
290 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
297 # Directory Settings..
298 my $tmpbase = $config{BASE_DIR};
299 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
300 if ($tmpbase ne $config{BASE_DIR}) {
301 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
302 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
303 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
304 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
307 dir_check("are the configuration files", "CONFIG_DIR");
308 dir_check("are the modules to be compiled to", "MODULE_DIR");
309 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
310 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
313 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?");
317 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?");
320 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
321 if (!$chose_hiperf) {
322 print "No high-performance socket engines are available, or you chose\n";
323 print "not to enable one. Defaulting to select() engine.\n\n";
326 yesno(THREADED_DNS,"Would you like to enable the experimental multi-threaded DNS lookup?");
329 if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
330 print "I have detected both GnuTLS and OpenSSL on your system.\n";
331 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
332 print "instead, you should enable the OpenSSL module yourself\n";
333 print "by copying it from src/modules/extra to src/modules.\n\n";
336 if ($config{HAS_GNUTLS} eq "y") {
337 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
338 if ($config{USE_GNUTLS} eq "y") {
339 print "\nUsing GnuTLS SSL module.\n";
341 } elsif ($config{HAS_OPENSSL} eq "y") {
342 yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
343 if ($config{USE_OPENSSL} eq "y") {
344 print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
348 print "\nThe following questions will ask you for various figures relating\n";
349 print "To your IRCd install. Please note that these should usually be left\n";
350 print "as defaults unless you have a real reason to change them. If they\n";
351 print "changed, then the values must be identical on all servers on your\n";
352 print "network, or malfunctions and/or crashes may occur, with the exception\n";
353 print "of the 'maximum number of clients' setting which may be different on\n";
354 print "different servers on the network.\n\n";
356 # File Descriptor Settings..
359 print "Maximum number of clients at any one time ($config{MAX_CLIENT_T})\n";
360 print "[\033[1;32m$config{MAX_CLIENT}\033[0m] -> ";
361 chomp($var = <STDIN>);
363 $var = $config{MAX_CLIENT};
365 if ($var =~ /^\d+$/) {
366 if (($var > $config{MAX_CLIENT_T}) && ($fd_scan_failed ne true)) {
367 # Client has entered a larger number than the 'discovered' value
369 print "WARNING: Our scans have indicated that you are attempting
370 to use more sockets than there are avaliable. Are you sure
371 you wish to do this? It may cause the IRCd to malfunction [y/n]
372 [\033[1;32mn\033[0m] -> $c";
373 chomp($tmp = <STDIN>);
375 print "Please enter the correct value.\n\n";
380 print "You must enter a number in this field. Please try again.\n\n";
383 # If we get here, we should be good to go.
384 $config{MAX_CLIENT} = $var;
391 print "What is the maximum length of nicknames?\n";
392 print "[\033[1;32m$config{NICK_LENGT}\033[0m] -> ";
393 chomp($var = <STDIN>);
395 $var = $config{NICK_LENGT};
397 if ($var =~ /^\d+$/) {
398 # We don't care what the number is, set it and be on our way.
399 $config{NICK_LENGT} = $var;
403 print "You must enter a number in this field. Please try again.\n\n";
409 print "What is the maximum length of channel names?\n";
410 print "[\033[1;32m$config{CHAN_LENGT}\033[0m] -> ";
411 chomp($var = <STDIN>);
413 $var = $config{CHAN_LENGT};
415 if ($var =~ /^\d+$/) {
416 # We don't care what the number is, set it and be on our way.
417 $config{CHAN_LENGT} = $var;
421 print "You must enter a number in this field. Please try again.\n\n";
427 print "What is the maximum number of channels a normal user may join at any one time?\n";
428 print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
429 chomp($var = <STDIN>);
431 $var = $config{MAX_CHANNE};
433 if ($var =~ /^\d+$/) {
434 # We don't care what the number is, set it and be on our way.
435 $config{MAX_CHANNE} = $var;
439 print "You must enter a number in this field. Please try again.\n\n";
445 print "What is the maximum number of channels an oper may join at any one time?\n";
446 print "[\033[1;32m$config{MAX_OPERCH}\033[0m] -> ";
447 chomp($var = <STDIN>);
449 $var = $config{MAX_OPERCH};
451 if ($var =~ /^\d+$/) {
452 # We don't care what the number is, set it and be on our way.
453 $config{MAX_OPERCH} = $var;
461 print "What is the maximum number of mode changes in one line?\n";
462 print "[\033[1;32m$config{MAXI_MODES}\033[0m] -> ";
463 chomp($var = <STDIN>);
465 $var = $config{MAXI_MODES};
467 if ($var =~ /^\d+$/) {
468 # We don't care what the number is, set it and be on our way.
469 $config{MAXI_MODES} = $var;
473 print "You must enter a number in this field. Please try again.\n\n";
479 print "What is the maximum length of an ident (username)?\n";
480 print "[\033[1;32m$config{MAX_IDENT}\033[0m] -> ";
481 chomp($var = <STDIN>);
483 $var = $config{MAX_IDENT};
485 if ($var =~ /^\d+$/) {
486 # We don't care what the number is, set it and be on our way.
487 $config{MAX_IDENT} = $var;
491 print "You must enter a number in this field. Please try again.\n\n";
497 print "What is the maximum length of a quit message?\n";
498 print "[\033[1;32m$config{MAX_QUIT}\033[0m] -> ";
499 chomp($var = <STDIN>);
501 $var = $config{MAX_QUIT};
503 if ($var =~ /^\d+$/) {
504 # We don't care what the number is, set it and be on our way.
505 $config{MAX_QUIT} = $var;
509 print "You must enter a number in this field. Please try again.\n\n";
515 print "What is the maximum length of a channel topic?\n";
516 print "[\033[1;32m$config{MAX_TOPIC}\033[0m] -> ";
517 chomp($var = <STDIN>);
519 $var = $config{MAX_TOPIC};
521 if ($var =~ /^\d+$/) {
522 # We don't care what the number is, set it and be on our way.
523 $config{MAX_TOPIC} = $var;
527 print "You must enter a number in this field. Please try again.\n\n";
533 print "What is the maximum length of a kick message?\n";
534 print "[\033[1;32m$config{MAX_KICK}\033[0m] -> ";
535 chomp($var = <STDIN>);
537 $var = $config{MAX_KICK};
539 if ($var =~ /^\d+$/) {
540 # We don't care what the number is, set it and be on our way.
541 $config{MAX_KICK} = $var;
545 print "You must enter a number in this field. Please try again.\n\n";
551 print "What is the maximum length of a GECOS (real name) field?\n";
552 print "[\033[1;32m$config{MAX_GECOS}\033[0m] -> ";
553 chomp($var = <STDIN>);
555 $var = $config{MAX_GECOS};
557 if ($var =~ /^\d+$/) {
558 # We don't care what the number is, set it and be on our way.
559 $config{MAX_GECOS} = $var;
563 print "You must enter a number in this field. Please try again.\n\n";
569 print "What is the maximum length of an away message?\n";
570 print "[\033[1;32m$config{MAX_AWAY}\033[0m] -> ";
571 chomp($var = <STDIN>);
573 $var = $config{MAX_AWAY};
575 if ($var =~ /^\d+$/) {
576 # We don't care what the number is, set it and be on our way.
577 $config{MAX_AWAY} = $var;
581 print "You must enter a number in this field. Please try again.\n\n";
586 print "Enter the Level Of Binary optimisation. This is a number between 0 and 3.
587 The InspIRCd Team will NOT support any bug reports above 0. Also note,
588 the IRCd behaviour will be different depending on this value. Please
589 read the documentation for more information.
591 The higher the number, the more optimised your binary will be. This
592 value will default to 0 if you either don't enter a number, or enter
593 a value outside the range.
595 As always, if you are unsure, just press enter and accept the default.\n\n";
596 print "[\033[1;32m$config{OPTIMITEMP}\033[0m] -> ";
597 chomp($var = <STDIN>);
599 $var = $config{OPTIMITEMP};
603 $config{OPTIMITEMP} = 1;
604 $config{OPTIMISATI} = "-O";
605 } elsif ($var eq "2") {
606 $config{OPTIMITEMP} = 2;
607 $config{OPTIMISATI} = "-O2";
608 } elsif ($var eq "3") {
609 $config{OPTIMITEMP} = 3;
610 $config{OPTIMISATI} = "-O3";
612 $config{OPTIMITEMP} = 0;
613 $config{OPTIMISATI} = "-g";
616 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
617 print "\033[0mBase install path:\033[1;32m\t\t$config{BASE_DIR}\n";
618 print "\033[0mConfig path:\033[1;32m\t\t\t$config{CONFIG_DIR}\n";
619 print "\033[0mModule path:\033[1;32m\t\t\t$config{MODULE_DIR}\n";
620 print "\033[0mLibrary path:\033[1;32m\t\t\t$config{LIBRARY_DIR}\n";
621 print "\033[0mMax connections:\033[1;32m\t\t$config{MAX_CLIENT}\n";
622 print "\033[0mMax User Channels:\033[1;32m\t\t$config{MAX_CHANNE}\n";
623 print "\033[0mMax Oper Channels:\033[1;32m\t\t$config{MAX_OPERCH}\n";
624 print "\033[0mMax nickname length:\033[1;32m\t\t$config{NICK_LENGT}\n";
625 print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
626 print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
627 print "\033[0mMax ident length:\033[1;32m\t\t$config{MAX_IDENT}\n";
628 print "\033[0mMax quit length:\033[1;32m\t\t$config{MAX_QUIT}\n";
629 print "\033[0mMax topic length:\033[1;32m\t\t$config{MAX_TOPIC}\n";
630 print "\033[0mMax kick length:\033[1;32m\t\t$config{MAX_KICK}\n";
631 print "\033[0mMax name length:\033[1;32m\t\t$config{MAX_GECOS}\n";
632 print "\033[0mMax away length:\033[1;32m\t\t$config{MAX_AWAY}\n";
633 print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
634 print "\033[0mOptimization Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
635 print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n";
636 print "\033[0mStatic modules:\033[1;32m\t\t\t$config{STATIC_LINK}\033[0m\n";
637 print "\033[0mMultithread DNS:\033[1;32m\t\t$config{THREADED_DNS}\033[0m\n";
638 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$config{USE_GNUTLS}\033[0m\n";
639 print "\033[0mOpenSSL Support:\033[1;32m\t\t$config{USE_OPENSSL}\033[0m\n\n";
641 if ($config{USE_GNUTLS} eq "y") {
643 open(TMP, "<src/modules/m_ssl_gnutls.cpp") or $failed = 1;
646 print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
647 chdir("src/modules");
648 system("ln -s extra/m_ssl_gnutls.cpp");
653 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
655 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
658 print "SSL Certificates Not found, Generating.. \n\n
659 *************************************************************
660 * Generating the Private Key may take some time, go grab a *
661 * Coffee. Even better, to generate some more entropy if it *
662 * is taking a while, open another console and type du / a *
663 * few times and get that HD going :) Then answer the *
664 * Questions which follow. If you are unsure, just hit enter *
665 *************************************************************\n\n";
666 system("certtool --generate-privkey --outfile key.pem");
667 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
668 print "\nCertificate generation complete, copying to config directory... ";
669 system("mv key.pem $config{CONFIG_DIR}/key.pem");
670 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
673 print "SSL Certificates found, skipping.\n\n"
675 } elsif ($config{USE_OPENSSL} eq "y") {
677 open(TMP, "<src/modules/m_ssl_openssl.cpp") or $failed = 1;
680 print "Symlinking src/modules/m_ssl_openssl.cpp from extra/\n";
681 chdir("src/modules");
682 system("ln -s extra/m_ssl_openssl.cpp");
687 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
689 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
692 print "SSL Certificates Not found, Generating.. \n\n
693 *************************************************************
694 * Generating the certificates may take some time, go grab a *
695 * coffee, or something. *
696 *************************************************************\n\n";
697 system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
698 system("openssl dhparam -out dhparams.pem 1024");
699 print "\nCertificate generation complete, copying to config directory... ";
700 system("mv key.pem $config{CONFIG_DIR}/key.pem");
701 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
702 system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
705 print "SSL Certificates found, skipping.\n\n"
708 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
709 print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
717 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
718 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
719 print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
720 print "load the required modules in your config. This configure process\n";
721 print "has just prepared these modules to be compiled for you, and has not\n";
722 print "configured them to be compiled into the core of the ircd.\n";
724 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
725 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
726 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";
729 if ($config{GCCVER} < "3") {
731 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
732 GCC 2.x series compilers only had partial (read as broken) C++ support, and
733 your compile will most likely fail horribly! If you have any problems, do NOT
734 report them to the bugtracker or forums without first upgrading your compiler
735 to a newer 3.x or 4.x (or whatever is available currently) version.
739 ################################################################################
741 ################################################################################
743 # Retrieves the .config.cache file, and loads values into the main config hash.
744 open(CACHE, ".config.cache") or return undef;
747 # Ignore Blank lines, and comments..
750 my ($key, $value) = split("=", $_);
751 $value =~ /^\"(.*)\"$/;
752 # Do something with data here!
760 # Dump the contents of %config
761 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
762 open(FILEHANDLE, ">.config.cache");
763 foreach $key (keys %config) {
764 print FILEHANDLE "$key=\"$config{$key}\"\n";
770 my ($desc, $hash_key) = @_;
773 print "In what directory $desc?\n";
774 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
775 chomp($var = <STDIN>);
777 $var = $config{$hash_key};
779 if ($var =~ /^\~\/(.+)$/) {
780 # Convert it to a full path..
781 $var = resolve_directory($ENV{HOME} . "/" . $1);
783 if (substr($var,0,1) ne "/")
785 # Assume relative Path was given.. fill in the rest.
786 $var = $this . "/$var";
788 $var = resolve_directory($var);
790 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
791 chomp($tmp = <STDIN>);
792 if (($tmp eq "") || ($tmp =~ /^y/i)) {
793 # Attempt to Create the Dir..
794 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
796 print "Unable to create directory. ($var)\n\n";
801 # They said they don't want to create, and we can't install there.
807 # Target exists, but is not a directory.
808 print "File $var exists, but is not a directory.\n\n";
812 # Either Dir Exists, or was created fine.
813 $config{$hash_key} = $var;
820 if ($config{OSNAME} =~ /BSD$/) {
821 $config{LDLIBS} = "-Ldl -lstdc++";
822 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
823 $config{MAKEPROG} = "gmake";
824 if ($config{OSNAME} eq "OpenBSD") {
825 chomp($foo = `eg++ -dumpversion | cut -c 1`);
826 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
827 # if theyre not running this, configure lets the build continue but they probably wont manage to
828 # compile as this standard version is 2.95.3!
830 $config{CC} = "eg++";
831 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
832 chomp($config{GCC34} = `eg++ -dumpversion | cut -c 3`); # the compiler path
836 $config{LDLIBS} = "-ldl -lstdc++";
837 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
838 $config{MAKEPROG} = "make";
839 if ($config{OSNAME} =~ /CYGWIN/) {
840 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
841 $config{LDLIBS} = "";
842 $config{MAKEPROG} = "/usr/bin/make";
843 $config{MAKEORDER} = "ircd mods";
844 } elsif ($config{OSNAME} eq "CYG-STATIC") {
845 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
846 $config{LDLIBS} = "";
847 $config{MAKEPROG} = "/usr/bin/make";
848 $config{MAKEORDER} = "mods ircd";
849 $config{STATICLIBS} = "modules/mods.a";
850 $config{STATIC_LINK} = "yes";
853 if ($config{OSNAME} =~ /SunOS/) {
854 # solaris/sunos needs these
855 # socket = bsd sockets api
857 # rt = POSIX realtime extensions
858 # resolv = inet_aton only (why isnt this in nsl?!)
859 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
877 opendir(DIRHANDLE, "src/modules");
878 foreach $name (sort readdir(DIRHANDLE)) {
879 if ($name =~ /^m_(.+)\.cpp$/)
882 if ($mod !~ /_static$/) {
883 $modlist[$i++] = $mod;
894 my $data = `svn info`;
900 $data =~ /Revision: (\d+)/;
902 if (!defined($rev)) {
909 print "Writing \033[1;32minspircd_config.h\033[0m\n";
910 # First File.. inspircd_config.h
911 chomp(my $incos = `uname -n -s -r`);
912 chomp(my $version = `sh ./src/version.sh`);
913 chomp(my $revision = getrevision());
914 $version = "$version(r$revision)";
915 chomp(my $revision2 = getrevision());
916 open(FILEHANDLE, ">include/inspircd_config.h");
917 my $NL = $config{NICK_LENGT}+1;
918 my $CL = $config{CHAN_LENGT}+1;
919 print FILEHANDLE <<EOF;
920 /* Auto generated by configure, do not modify! */
921 #ifndef __CONFIGURATION_AUTO__
922 #define __CONFIGURATION_AUTO__
924 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
925 #define MOD_PATH "$config{MODULE_DIR}"
926 #define VERSION "$version"
927 #define REVISION "$revision2"
928 #define MAXCLIENTS $config{MAX_CLIENT}
929 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
932 #define MAXCHANS $config{MAX_CHANNE}
933 #define OPERMAXCHANS $config{MAX_OPERCH}
934 #define MAXMODES $config{MAXI_MODES}
935 #define IDENTMAX $config{MAX_IDENT}
936 #define MAXQUIT $config{MAX_QUIT}
937 #define MAXTOPIC $config{MAX_TOPIC}
938 #define MAXKICK $config{MAX_KICK}
939 #define MAXGECOS $config{MAX_GECOS}
940 #define MAXAWAY $config{MAX_AWAY}
941 #define OPTIMISATION $config{OPTIMITEMP}
942 #define SYSTEM "$incos"
945 if ($config{OSNAME} =~ /SunOS/) {
946 print FILEHANDLE "#define IS_SOLARIS\n";
948 if ($config{OSNAME} =~ /CYGWIN/) {
949 print FILEHANDLE "#define IS_CYGWIN\n";
950 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
952 if ($config{OSNAME} eq "CYG-STATIC") {
953 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
956 if ($config{STATIC_LINK} eq "yes") {
957 print FILEHANDLE "#define STATIC_LINK\n";
959 if ($config{GCCVER} > 3) {
960 print FILEHANDLE "#define GCC3\n";
961 print FILEHANDLE "#define GCC34\n";
965 if ($config{GCCVER} == 3) {
966 print FILEHANDLE "#define GCC3\n";
967 if ($config{GCC34} > 3) {
968 print FILEHANDLE "#define GCC34\n";
972 if ($config{HAS_STRLCPY} eq "true") {
973 print FILEHANDLE "#define HAS_STRLCPY\n";
975 if ($config{THREADED_DNS} =~ /y/i) {
976 print FILEHANDLE "#define THREADED_DNS\n";
979 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
980 print FILEHANDLE "#define USE_KQUEUE\n";
983 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
984 print FILEHANDLE "#define USE_EPOLL\n";
987 # user didn't choose either epoll or select for their OS.
988 # default them to USE_SELECT (ewwy puke puke)
990 print FILEHANDLE "#define USE_SELECT\n";
992 print FILEHANDLE "\n#endif\n";
995 # Create a Modules List..
997 foreach $i (@modlist)
999 if ($config{STATIC_LINK} eq "yes") {
1000 $modules .= "m_".$i.".o ";
1003 $modules .= "m_".$i.".so ";
1006 chomp($modules); # Remove Redundant whitespace..
1009 # Write all .in files.
1012 my $exe = "inspircd";
1014 if ($config{OSNAME} =~ /CYGWIN/) {
1015 $exe = "inspircd.exe";
1018 opendir(DIRHANDLE, $this);
1019 if ($config{THREADED_DNS} =~ /y/i) {
1020 $config{LDLIBS} = $config{LDLIBS} . " -pthread";
1022 foreach $name (sort readdir(DIRHANDLE)) {
1023 if ($name =~ /^\.(.+)\.inc$/) {
1025 # All .name.inc files need parsing!
1027 open(FILEHANDLE, ".$file.inc");
1028 while (<FILEHANDLE>) {
1033 $tmp =~ s/\@CC\@/$config{CC}/;
1034 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1035 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1036 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1037 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1038 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1039 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1040 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1041 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1042 $tmp =~ s/\@MODULES\@/$modules/;
1043 $tmp =~ s/\@EXECUTABLE\@/$exe/;
1044 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1045 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1047 print "Writing \033[1;32m$file\033[0m\n";
1048 open(FILEHANDLE, ">$file");
1049 print FILEHANDLE $tmp;
1052 closedir(DIRHANDLE);
1054 # Make inspircd executable!
1055 chmod 0744, 'inspircd';
1057 if ($config{STATIC_LINK} eq "yes") {
1058 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1059 write_static_makefile();
1060 write_static_modules_makefile();
1061 } elsif ($config{OSNAME} =~ /CYGWIN/) {
1062 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1063 write_static_makefile();
1064 write_dynamic_modules_makefile();
1066 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1067 write_dynamic_makefile();
1068 write_dynamic_modules_makefile();
1072 sub getcompilerflags {
1076 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
1085 sub getlinkerflags {
1089 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
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::\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: \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:::: \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:\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::: \033[1;33m##\033[0m: \033[1;33m##\033[0m:::: \033[1;33m##\033[0m:\n";
1105 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";
1106 print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
1109 sub resolve_directory {
1111 return File::Spec->rel2abs($_[0]);
1115 my ($flag,$prompt) = @_;
1116 print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
1117 chomp($tmp = <STDIN>);
1118 if ($tmp eq "") { $tmp = $config{$flag} }
1120 if (($tmp eq "") || ($tmp =~ /^y/i)) {
1121 $config{$flag} = "y";
1123 $config{$flag} = "n";
1128 sub write_static_modules_makefile {
1129 # Modules Makefile..
1130 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1131 open(FILEHANDLE, ">src/modules/Makefile");
1134 # Module Makefile Header
1136 print FILEHANDLE <<EOF;
1137 # (C) ChatSpike development team
1138 # Makefile by <Craig\@ChatSpike.net>
1139 # Many Thanks to Andrew Church <achurch\@achurch.org>
1140 # for assisting with making this work right.
1142 # Automatically Generated by ./configure to add a modules
1143 # please run ./configure --update
1149 # End Module Makefile Header
1152 # Create a Modules List..
1157 open(MODLIST,">include/modlist.h");
1160 # Include File Header
1162 print MODLIST <<HEADER;
1163 // Generated automatically by configure. DO NOT EDIT!
1165 #ifndef __SYMBOLS__H_CONFIGURED__
1166 #define __SYMBOLS__H_CONFIGURED__
1170 # End Include File Header
1173 # Place Module List into Include
1174 foreach $i (@modlist) {
1175 if ($i !~ /_static$/) {
1176 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1179 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1184 foreach $i (@modlist)
1186 if ($i !~ /_static$/) {
1187 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1188 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1191 # Write Entry to the Makefile
1193 print FILEHANDLE <<EOCHEESE;
1194 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h
1195 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
1196 mv m_$i\_static.o ../m_$i.o
1200 # End Write Entry to the MakeFile
1202 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1203 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1204 open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
1205 while (chomp($a = <MODULE>)) {
1206 $a =~ s/init_module/$i\_init/g;
1207 print MUNGED "$a\n";
1211 print MODLIST <<EOENT;
1212 {"m_$i.so",\&$i\_init},
1217 print MODLIST "{0}};\n\n#endif\n";
1221 sub write_dynamic_modules_makefile {
1222 # Modules Makefile..
1223 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1224 open(FILEHANDLE, ">src/modules/Makefile");
1227 if ($config{OSNAME} =~ /CYGWIN/) {
1228 $extra = "../inspircd.dll.a";
1232 # Module Makefile Header
1234 print FILEHANDLE <<EOF;
1235 # (C) ChatSpike development team
1236 # Makefile by <Craig\@ChatSpike.net>
1237 # Many Thanks to Andrew Church <achurch\@achurch.org>
1238 # for assisting with making this work right.
1240 # Automatically Generated by ./configure to add a modules
1241 # please run ./configure -update or ./configure -modupdate
1247 # End Module Makefile Header
1250 # Create a Modules List..
1256 foreach $i (@modlist) {
1258 # Write Entry to the MakeFile
1260 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1261 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1262 print FILEHANDLE <<EOCHEESE;
1263 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
1264 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1265 \$(CC) \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1268 $crud = $crud . " \@install -v -m 0700 m_$i.so \$(MODPATH)\n";
1270 # End Write Entry to the MakeFile
1273 print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
1277 sub write_static_makefile {
1278 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1281 opendir(DIRHANDLE, "src");
1282 foreach $name (sort readdir(DIRHANDLE)) {
1283 if ($name =~ /^cmd_(.+)\.cpp$/) {
1284 $cmdlist[$i++] = $1;
1287 closedir(DIRHANDLE);
1290 foreach my $cmd (@cmdlist) {
1291 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1292 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1297 # (C) ChatSpike development team
1298 # Makefile by <Craig\@ChatSpike.net>
1299 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1302 CC = im a cheezeball
1304 CXXFLAGS = -I../include \${FLAGS}
1308 # This next section is for cygwin dynamic module builds.
1309 # Basically, what we do, is build the inspircd core as a library
1310 # then the main executable uses that. the library is capable of
1311 # loading / unloading the modules dynamically :)
1312 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1316 if ($config{OSNAME} =~ /CYGWIN/) {
1318 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
1320 inspircd.exe: inspircd.dll.a
1323 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
1324 \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1328 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
1330 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
1331 \$(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)
1337 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
1338 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1340 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
1341 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1343 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1344 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1346 socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1347 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1349 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1350 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1352 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1353 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1355 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1356 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1358 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
1359 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1361 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
1362 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1364 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
1365 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1367 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
1368 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1370 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1371 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1373 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
1374 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1376 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
1377 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1379 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
1380 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1382 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
1383 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1385 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
1386 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1388 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
1389 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1391 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
1392 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1394 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
1395 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1397 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1398 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1400 aes.o: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1401 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1403 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1404 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1407 foreach my $cmd (@cmdlist) {
1409 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
1410 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1416 sub write_dynamic_makefile {
1420 opendir(DIRHANDLE, "src");
1421 foreach $name (sort readdir(DIRHANDLE)) {
1422 if ($name =~ /^cmd_(.+)\.cpp$/) {
1423 $cmdlist[$i++] = $1;
1426 closedir(DIRHANDLE);
1430 foreach my $cmd (@cmdlist) {
1431 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1432 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1435 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1439 # (C) ChatSpike development team
1440 # Makefile by <Craig\@ChatSpike.net>
1441 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1444 CC = im a cheezeball
1446 CXXFLAGS = -I../include \${FLAGS}
1448 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
1450 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
1451 \$(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
1453 libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1454 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1455 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
1457 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
1458 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1459 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1461 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
1462 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1463 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1465 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1466 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1467 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1469 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1470 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1471 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1473 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1474 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1475 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1477 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1478 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1479 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1481 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
1482 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1483 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o
1485 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
1486 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1487 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1489 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
1490 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1491 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1493 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
1494 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1495 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1497 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1498 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1499 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1501 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
1502 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1503 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDio.so inspircd_io.o
1505 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
1506 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1507 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmessage.so message.o
1509 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
1510 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1511 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o $cmdobjs
1513 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
1514 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1515 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdnsqueue.so dnsqueue.o
1517 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
1518 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1519 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1521 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
1522 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1523 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1525 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
1526 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1527 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1529 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
1530 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1531 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1533 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1534 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1535 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1537 libIRCDaes.so: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1538 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1539 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDaes.so aes.o
1541 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1542 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1543 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1546 foreach my $cmd (@cmdlist) {
1548 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
1549 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp