2 # InspIRCd Configuration Script
4 # Copyright 2003 The ChatSpike Development Team
5 # <brain@chatspike.net>
6 # <Craig@chatspike.net>
8 # [14:21] Brain: <matrix impression> i know perl-fu!
12 ########################################
14 chomp($topdir = `pwd`);
15 $this = resolve_directory($topdir); # PWD, Regardless.
16 @modlist = (); # Declare for Module List..
17 %config = (); # Initiate Configuration Hash..
18 $config{ME} = resolve_directory($topdir); # Present Working Directory
19 $config{BASE_DIR} = $config{ME}; # Use CWD as 'Base' Directory.
20 $config{CONFIG_DIR} = resolve_directory($config{ME}."/conf"); # Configuration Directory
21 $config{MODULE_DIR} = resolve_directory($config{ME}."/modules"); # Modules Directory
22 $config{BINARY_DIR} = resolve_directory($config{ME}."/bin"); # Binary Directory
23 $config{LIBRARY_DIR} = resolve_directory($config{ME}."/lib"); # Library Directory
24 chomp($config{HAS_GNUTLS} = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
25 chomp($config{HAS_OPENSSL} = `openssl version 2>/dev/null`); # Openssl version
26 $config{USE_GNUTLS} = "n"; # Use gnutls.
27 $config{USE_OPENSSL} = "n"; # Use openssl.
28 $config{OPTIMITEMP} = "0"; # Default Optimisation Value
29 $config{OPTIMISATI} = "-g"; # Optimisation Flag
30 $config{NICK_LENGT} = "31"; # Default Nick Length
31 $config{CHAN_LENGT} = "64"; # Default Channel Name Length
32 $config{MAX_CHANNE} = "20"; # Default Max. Channels per user
33 $config{MAX_OPERCH} = "60"; # Default Max. Channels per oper
34 $config{MAXI_MODES} = "20"; # Default Max. Number of Modes set at once.
35 $config{HAS_STRLCPY} = "false"; # strlcpy Check.
36 $config{USE_KQUEUE} = "y"; # kqueue enabled
37 $config{USE_EPOLL} = "y"; # epoll enabled
38 $config{THREADED_DNS} = "n"; # threaded dns (experimental)
39 $config{STATIC_LINK} = "no"; # are doing static modules?
40 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
41 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
42 chomp($config{GCCVER} = `gcc -dumpversion | cut -c 1`); # Major GCC Version
43 chomp($config{GCC34} = `gcc -dumpversion | cut -c 3`); # Minor GCC Version
44 chomp($config{OSNAME} = `/bin/uname`); # Operating System Name
45 $config{CC} = "g++"; # C++ compiler
46 $config{MAKEORDER} = "ircd mods config bininst"; # build order
47 $config{STATICLIBS} = ""; # library archive path
48 $config{MAX_IDENT} = "12"; # max ident size
49 $config{MAX_QUIT} = "255"; # max quit message size
50 $config{MAX_TOPIC} = "307"; # max topic size
51 $config{MAX_KICK} = "255"; # max kick message size
52 $config{MAX_GECOS} = "128"; # max GECOS size
53 $config{MAX_AWAY} = "200"; # max AWAY size
55 $config{HAS_OPENSSL} =~ /OpenSSL (\S+) \d+ \S+ \d{4}/;
56 $config{HAS_OPENSSL} = $1;
58 # Minihack! Convert Cygwin to 'Cyg-Static' so i can
59 # Keep my dynamic module experiments here for later
62 if ($config{OSNAME} =~ /CYGWIN/) {
63 $config{OSNAME} = "CYG-STATIC";
66 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")) {
67 chomp($config{OSNAME} = `/usr/bin/uname`);
68 if ((!$config{OSNAME}) || ($config{OSNAME} eq "")){
69 $config{OSNAME} = "Unknown";
73 if (!$config{MAX_CLIENT_T}) {
74 $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
75 $fd_scan_fail = "true"; # Used Later
78 # Get and Set some important vars..
81 my $arg = $ARGV[0]; # Do Some Argument Checks..
82 if ($arg eq "-clean") {
83 system("rm -rf .config.cache");
84 } # Remove the config.cache file.
86 if ($arg eq "-update") {
87 # Does the cache file exist?
89 # No, No it doesn't.. *BASH*
90 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
93 # We've Loaded the cache file and all our variables..
94 print "Updating Files..\n";
96 $has_epoll = $config{HAS_EPOLL};
97 $has_kqueue = $config{HAS_KQUEUE};
104 if ($arg eq "-modupdate") {
105 # Does the cache file exist?
107 # No, No it doesn't.. *BASH*
108 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
111 # We've Loaded the cache file and all our variables..
112 print "Updating Files..\n";
114 $has_epoll = $config{HAS_EPOLL};
115 $has_kqueue = $config{HAS_KQUEUE};
116 if ($config{STATIC_LINK} eq "yes") {
117 write_static_modules_makefile();
119 write_dynamic_modules_makefile();
126 print "Checking for cache from previous configure...\n";
128 print "Checking operating system version...\n";
131 if (!$config{MAX_CLIENT}) {
132 # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
133 # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
134 # higher than the found value" :))
135 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
138 printf "Checking if strlcpy exists... ";
139 # Perform the strlcpy() test..
140 $config{HAS_STRLCPY} = "false";
142 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
144 while (chomp($line = <STRLCPY>)) {
145 # try and find the delcaration of:
146 # size_t strlcpy(...)
147 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
148 $config{HAS_STRLCPY} = "true";
153 print "yes\n" if $config{HAS_STRLCPY} eq "true";
154 print "no\n" if $config{HAS_STRLCPY} eq "false";
156 printf "Checking if kqueue exists... ";
159 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
161 while (chomp($line = <KQUEUE>)) {
162 # try and find the delcaration of:
164 if ($line =~ /int(\0x9|\s)+kqueue/) {
170 print "yes\n" if $has_kqueue == 1;
171 print "no\n" if $has_kqueue == 0;
173 printf "Checking if epoll exists... ";
176 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
178 while (chomp($line = <EPOLL>)) {
179 # try and find the declaration of:
180 # extern int epoll_create (int __size) __THROW;
181 if (($line =~ /int(\0x9|\s)+epoll_create(\0x9|\s)+\(/) || ($line =~ /int(\0x9|\s)+epoll_create\(/)) {
188 my $kernel = `uname -r`;
190 if (($kernel =~ /2\.0/) || ($kernel =~ /2\.2/) || ($kernel =~ /2\.4/)) {
194 print "yes\n" if $has_epoll == 1;
195 print "no\n" if $has_epoll == 0;
197 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
198 $config{HAS_STRLCPY} = "true";
201 $config{HAS_EPOLL} = $has_epoll;
202 $config{HAS_KQUEUE} = $has_kqueue;
204 printf "Checking for libgnutls... ";
205 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
207 $config{HAS_GNUTLS} = "y";
210 $config{HAS_GNUTLS} = "n";
213 printf "Checking for openssl... ";
214 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
216 $config{HAS_OPENSSL} = "y";
219 $config{HAS_OPENSSL} = "n";
222 ################################################################################
223 # BEGIN INTERACTIVE PART #
224 ################################################################################
228 # Display Splash Logo..
230 chomp($wholeos = `uname -mnr`);
232 # Display Introduction Message..
234 Welcome to the InspIRCd Configuration program!
236 *** If you are unsure of any of these values, leave it blank for ***
237 *** standard settings that will work, and your server will run ***
238 *** using them. If you are running this server as part of a ***
239 *** larger network, you must consult with your network admins ***
240 *** for the proper values to use, or server links will be unstable! ***
242 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
243 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
244 dir, otherwise you won't have a config file!
246 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos), fdmax: $config{MAX_CLIENT_T}\n\n";
248 $config{CHANGE_COMPILER} = "n";
249 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";
251 if ($config{GCCVER} < 3) {
252 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
253 should NOT be used. You should probably specify a newer compiler.\n";
255 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
256 if ($config{CHANGE_COMPILER} =~ /y/i) {
257 print "What command do you want to use to invoke your compiler?\n";
258 print "[\033[1;32m$config{CC}\033[0m] -> ";
259 chomp($config{CC} = <STDIN>);
260 if ($config{CC} eq "") {
263 chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
265 chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change
266 chomp($config{GCC34} = `$config{CC} -dumpversion | cut -c 3`); # the compiler path
267 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.$config{GCC34}\033[0m)\n";
270 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
276 # Directory Settings..
277 my $tmpbase = $config{BASE_DIR};
278 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
279 if ($tmpbase ne $config{BASE_DIR}) {
280 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
281 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
282 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
283 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
286 dir_check("are the configuration files", "CONFIG_DIR");
287 dir_check("are the modules to be compiled to", "MODULE_DIR");
288 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
289 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
292 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?");
296 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?");
299 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
300 if (!$chose_hiperf) {
301 print "No high-performance socket engines are available, or you chose\n";
302 print "not to enable one. Defaulting to select() engine.\n\n";
305 yesno(THREADED_DNS,"Would you like to enable the experimental multi-threaded DNS lookup?");
308 if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
309 print "I have detected both GnuTLS and OpenSSL on your system.\n";
310 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
311 print "instead, you should enable the OpenSSL module yourself\n";
312 print "by copying it from src/modules/extra to src/modules.\n\n";
315 if ($config{HAS_GNUTLS} eq "y") {
316 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
317 if ($config{USE_GNUTLS} eq "y") {
318 print "\nUsing GnuTLS SSL module.\n";
320 } elsif ($config{HAS_OPENSSL} eq "y") {
321 yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
322 if ($config{USE_OPENSSL} eq "y") {
323 print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
327 print "\nThe following questions will ask you for various figures relating\n";
328 print "To your IRCd install. Please note that these should usually be left\n";
329 print "as defaults unless you have a real reason to change them. If they\n";
330 print "changed, then the values must be identical on all servers on your\n";
331 print "network, or malfunctions and/or crashes may occur, with the exception\n";
332 print "of the 'maximum number of clients' setting which may be different on\n";
333 print "different servers on the network.\n\n";
335 # File Descriptor Settings..
338 print "Maximum number of clients at any one time ($config{MAX_CLIENT_T})\n";
339 print "[\033[1;32m$config{MAX_CLIENT}\033[0m] -> ";
340 chomp($var = <STDIN>);
342 $var = $config{MAX_CLIENT};
344 if ($var =~ /^\d+$/) {
345 if (($var > $config{MAX_CLIENT_T}) && ($fd_scan_failed ne true)) {
346 # Client has entered a larger number than the 'discovered' value
348 print "WARNING: Our scans have indicated that you are attempting
349 to use more sockets than there are avaliable. Are you sure
350 you wish to do this? It may cause the IRCd to malfunction [y/n]
351 [\033[1;32mn\033[0m] -> $c";
352 chomp($tmp = <STDIN>);
354 print "Please enter the correct value.\n\n";
359 print "You must enter a number in this field. Please try again.\n\n";
362 # If we get here, we should be good to go.
363 $config{MAX_CLIENT} = $var;
370 print "What is the maximum length of nicknames?\n";
371 print "[\033[1;32m$config{NICK_LENGT}\033[0m] -> ";
372 chomp($var = <STDIN>);
374 $var = $config{NICK_LENGT};
376 if ($var =~ /^\d+$/) {
377 # We don't care what the number is, set it and be on our way.
378 $config{NICK_LENGT} = $var;
382 print "You must enter a number in this field. Please try again.\n\n";
388 print "What is the maximum length of channel names?\n";
389 print "[\033[1;32m$config{CHAN_LENGT}\033[0m] -> ";
390 chomp($var = <STDIN>);
392 $var = $config{CHAN_LENGT};
394 if ($var =~ /^\d+$/) {
395 # We don't care what the number is, set it and be on our way.
396 $config{CHAN_LENGT} = $var;
400 print "You must enter a number in this field. Please try again.\n\n";
406 print "What is the maximum number of channels a normal user may join at any one time?\n";
407 print "[\033[1;32m$config{MAX_CHANNE}\033[0m] -> ";
408 chomp($var = <STDIN>);
410 $var = $config{MAX_CHANNE};
412 if ($var =~ /^\d+$/) {
413 # We don't care what the number is, set it and be on our way.
414 $config{MAX_CHANNE} = $var;
418 print "You must enter a number in this field. Please try again.\n\n";
424 print "What is the maximum number of channels an oper may join at any one time?\n";
425 print "[\033[1;32m$config{MAX_OPERCH}\033[0m] -> ";
426 chomp($var = <STDIN>);
428 $var = $config{MAX_OPERCH};
430 if ($var =~ /^\d+$/) {
431 # We don't care what the number is, set it and be on our way.
432 $config{MAX_OPERCH} = $var;
440 print "What is the maximum number of mode changes in one line?\n";
441 print "[\033[1;32m$config{MAXI_MODES}\033[0m] -> ";
442 chomp($var = <STDIN>);
444 $var = $config{MAXI_MODES};
446 if ($var =~ /^\d+$/) {
447 # We don't care what the number is, set it and be on our way.
448 $config{MAXI_MODES} = $var;
452 print "You must enter a number in this field. Please try again.\n\n";
458 print "What is the maximum length of an ident (username)?\n";
459 print "[\033[1;32m$config{MAX_IDENT}\033[0m] -> ";
460 chomp($var = <STDIN>);
462 $var = $config{MAX_IDENT};
464 if ($var =~ /^\d+$/) {
465 # We don't care what the number is, set it and be on our way.
466 $config{MAX_IDENT} = $var;
470 print "You must enter a number in this field. Please try again.\n\n";
476 print "What is the maximum length of a quit message?\n";
477 print "[\033[1;32m$config{MAX_QUIT}\033[0m] -> ";
478 chomp($var = <STDIN>);
480 $var = $config{MAX_QUIT};
482 if ($var =~ /^\d+$/) {
483 # We don't care what the number is, set it and be on our way.
484 $config{MAX_QUIT} = $var;
488 print "You must enter a number in this field. Please try again.\n\n";
494 print "What is the maximum length of a channel topic?\n";
495 print "[\033[1;32m$config{MAX_TOPIC}\033[0m] -> ";
496 chomp($var = <STDIN>);
498 $var = $config{MAX_TOPIC};
500 if ($var =~ /^\d+$/) {
501 # We don't care what the number is, set it and be on our way.
502 $config{MAX_TOPIC} = $var;
506 print "You must enter a number in this field. Please try again.\n\n";
512 print "What is the maximum length of a kick message?\n";
513 print "[\033[1;32m$config{MAX_KICK}\033[0m] -> ";
514 chomp($var = <STDIN>);
516 $var = $config{MAX_KICK};
518 if ($var =~ /^\d+$/) {
519 # We don't care what the number is, set it and be on our way.
520 $config{MAX_KICK} = $var;
524 print "You must enter a number in this field. Please try again.\n\n";
530 print "What is the maximum length of a GECOS (real name) field?\n";
531 print "[\033[1;32m$config{MAX_GECOS}\033[0m] -> ";
532 chomp($var = <STDIN>);
534 $var = $config{MAX_GECOS};
536 if ($var =~ /^\d+$/) {
537 # We don't care what the number is, set it and be on our way.
538 $config{MAX_GECOS} = $var;
542 print "You must enter a number in this field. Please try again.\n\n";
548 print "What is the maximum length of an away message?\n";
549 print "[\033[1;32m$config{MAX_AWAY}\033[0m] -> ";
550 chomp($var = <STDIN>);
552 $var = $config{MAX_AWAY};
554 if ($var =~ /^\d+$/) {
555 # We don't care what the number is, set it and be on our way.
556 $config{MAX_AWAY} = $var;
560 print "You must enter a number in this field. Please try again.\n\n";
565 print "Enter the Level Of Binary optimisation. This is a number between 0 and 3.
566 The InspIRCd Team will NOT support any bug reports above 0. Also note,
567 the IRCd behaviour will be different depending on this value. Please
568 read the documentation for more information.
570 The higher the number, the more optimised your binary will be. This
571 value will default to 0 if you either don't enter a number, or enter
572 a value outside the range.
574 As always, if you are unsure, just press enter and accept the default.\n\n";
575 print "[\033[1;32m$config{OPTIMITEMP}\033[0m] -> ";
576 chomp($var = <STDIN>);
578 $var = $config{OPTIMITEMP};
582 $config{OPTIMITEMP} = 1;
583 $config{OPTIMISATI} = "-O";
584 } elsif ($var eq "2") {
585 $config{OPTIMITEMP} = 2;
586 $config{OPTIMISATI} = "-O2";
587 } elsif ($var eq "3") {
588 $config{OPTIMITEMP} = 3;
589 $config{OPTIMISATI} = "-O3";
591 $config{OPTIMITEMP} = 0;
592 $config{OPTIMISATI} = "-g";
595 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
596 print "\033[0mBase install path:\033[1;32m\t\t$config{BASE_DIR}\n";
597 print "\033[0mConfig path:\033[1;32m\t\t\t$config{CONFIG_DIR}\n";
598 print "\033[0mModule path:\033[1;32m\t\t\t$config{MODULE_DIR}\n";
599 print "\033[0mLibrary path:\033[1;32m\t\t\t$config{LIBRARY_DIR}\n";
600 print "\033[0mMax connections:\033[1;32m\t\t$config{MAX_CLIENT}\n";
601 print "\033[0mMax User Channels:\033[1;32m\t\t$config{MAX_CHANNE}\n";
602 print "\033[0mMax Oper Channels:\033[1;32m\t\t$config{MAX_OPERCH}\n";
603 print "\033[0mMax nickname length:\033[1;32m\t\t$config{NICK_LENGT}\n";
604 print "\033[0mMax channel length:\033[1;32m\t\t$config{CHAN_LENGT}\n";
605 print "\033[0mMax mode length:\033[1;32m\t\t$config{MAXI_MODES}\n";
606 print "\033[0mMax ident length:\033[1;32m\t\t$config{MAX_IDENT}\n";
607 print "\033[0mMax quit length:\033[1;32m\t\t$config{MAX_QUIT}\n";
608 print "\033[0mMax topic length:\033[1;32m\t\t$config{MAX_TOPIC}\n";
609 print "\033[0mMax kick length:\033[1;32m\t\t$config{MAX_KICK}\n";
610 print "\033[0mMax name length:\033[1;32m\t\t$config{MAX_GECOS}\n";
611 print "\033[0mMax away length:\033[1;32m\t\t$config{MAX_AWAY}\n";
612 print "\033[0mGCC Version Found:\033[1;32m\t\t$config{GCCVER}.$config{GCC34}\n";
613 print "\033[0mOptimization Flag:\033[1;32m\t\t$config{OPTIMISATI}\033[0m\n";
614 print "\033[0mCompiler program:\033[1;32m\t\t$config{CC}\033[0m\n";
615 print "\033[0mStatic modules:\033[1;32m\t\t\t$config{STATIC_LINK}\033[0m\n";
616 print "\033[0mMultithread DNS:\033[1;32m\t\t$config{THREADED_DNS}\033[0m\n";
617 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$config{USE_GNUTLS}\033[0m\n";
618 print "\033[0mOpenSSL Support:\033[1;32m\t\t$config{USE_OPENSSL}\033[0m\n\n";
620 if ($config{USE_GNUTLS} eq "y") {
621 system("cd src/modules");
622 system("ln -s extra/m_ssl_gnutls.cpp");
626 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
628 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
631 print "SSL Certificates Not found, Generating.. \n\n
632 *************************************************************
633 * Generating the Private Key may take some time, go grab a *
634 * Coffee. Even better, to generate some more entropy if it *
635 * is taking a while, open another console and type du / a *
636 * few times and get that HD going :) Then answer the *
637 * Questions which follow. If you are unsure, just hit enter *
638 *************************************************************\n\n";
639 system("certtool --generate-privkey --outfile key.pem");
640 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
641 print "\nCertificate generation complete, copying to config directory... ";
642 system("mv key.pem $config{CONFIG_DIR}/key.pem");
643 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
646 print "SSL Certificates found, skipping.\n\n"
648 } elsif ($config{USE_OPENSSL} eq "y") {
649 system("cd src/modules");
650 system("ln -s extra/m_ssl_openssl.cpp");
654 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
656 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
659 print "SSL Certificates Not found, Generating.. \n\n
660 *************************************************************
661 * Generating the certificates may take some time, go grab a *
662 * coffee, or something. *
663 *************************************************************\n\n";
664 system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
665 system("openssl dhparam -out dhparams.pem 1024");
666 print "\nCertificate generation complete, copying to config directory... ";
667 system("mv key.pem $config{CONFIG_DIR}/key.pem");
668 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
669 system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
672 print "SSL Certificates found, skipping.\n\n"
675 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
676 print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
684 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
685 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
686 print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
687 print "load the required modules in your config. This configure process\n";
688 print "has just prepared these modules to be compiled for you, and has not\n";
689 print "configured them to be compiled into the core of the ircd.\n";
691 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
692 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
693 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";
696 if ($config{GCCVER} < "3") {
698 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
699 GCC 2.x series compilers only had partial (read as broken) C++ support, and
700 your compile will most likely fail horribly! If you have any problems, do NOT
701 report them to the bugtracker or forums without first upgrading your compiler
702 to a newer 3.x or 4.x (or whatever is available currently) version.
706 ################################################################################
708 ################################################################################
710 # Retrieves the .config.cache file, and loads values into the main config hash.
711 open(CACHE, ".config.cache") or return undef;
714 # Ignore Blank lines, and comments..
717 my ($key, $value) = split("=", $_);
718 $value =~ /^\"(.*)\"$/;
719 # Do something with data here!
727 # Dump the contents of %config
728 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
729 open(FILEHANDLE, ">.config.cache");
730 foreach $key (keys %config) {
731 print FILEHANDLE "$key=\"$config{$key}\"\n";
737 my ($desc, $hash_key) = @_;
740 print "In what directory $desc?\n";
741 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
742 chomp($var = <STDIN>);
744 $var = $config{$hash_key};
746 if ($var =~ /^\~\/(.+)$/) {
747 # Convert it to a full path..
748 $var = resolve_directory($ENV{HOME} . "/" . $1);
750 if (substr($var,0,1) ne "/")
752 # Assume relative Path was given.. fill in the rest.
753 $var = $this . "/$var";
755 $var = resolve_directory($var);
757 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
758 chomp($tmp = <STDIN>);
759 if (($tmp eq "") || ($tmp =~ /^y/i)) {
760 # Attempt to Create the Dir..
761 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
763 print "Unable to create directory. ($var)\n\n";
768 # They said they don't want to create, and we can't install there.
774 # Target exists, but is not a directory.
775 print "File $var exists, but is not a directory.\n\n";
779 # Either Dir Exists, or was created fine.
780 $config{$hash_key} = $var;
787 if ($config{OSNAME} =~ /BSD$/) {
788 $config{LDLIBS} = "-Ldl -lstdc++";
789 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
790 $config{MAKEPROG} = "gmake";
791 if ($config{OSNAME} eq "OpenBSD") {
792 chomp($foo = `eg++ -dumpversion | cut -c 1`);
793 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
794 # if theyre not running this, configure lets the build continue but they probably wont manage to
795 # compile as this standard version is 2.95.3!
797 $config{CC} = "eg++";
798 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change
799 chomp($config{GCC34} = `eg++ -dumpversion | cut -c 3`); # the compiler path
803 $config{LDLIBS} = "-ldl -lstdc++";
804 $config{FLAGS} = "-fPIC -frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
805 $config{MAKEPROG} = "make";
806 if ($config{OSNAME} =~ /CYGWIN/) {
807 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
808 $config{LDLIBS} = "";
809 $config{MAKEPROG} = "/usr/bin/make";
810 $config{MAKEORDER} = "ircd mods config bininst";
811 } elsif ($config{OSNAME} eq "CYG-STATIC") {
812 $config{FLAGS} = "-frtti -Wall -Woverloaded-virtual $config{OPTIMISATI}";
813 $config{LDLIBS} = "";
814 $config{MAKEPROG} = "/usr/bin/make";
815 $config{MAKEORDER} = "mods ircd config bininst";
816 $config{STATICLIBS} = "modules/mods.a";
817 $config{STATIC_LINK} = "yes";
820 if ($config{OSNAME} =~ /SunOS/) {
821 # solaris/sunos needs these
822 # socket = bsd sockets api
824 # rt = POSIX realtime extensions
825 # resolv = inet_aton only (why isnt this in nsl?!)
826 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
844 opendir(DIRHANDLE, "src/modules");
845 foreach $name (sort readdir(DIRHANDLE)) {
846 if ($name =~ /^m_(.+)\.cpp$/)
849 if ($mod !~ /_static$/) {
850 $modlist[$i++] = $mod;
859 print "Writing \033[1;32minspircd_config.h\033[0m\n";
860 # First File.. inspircd_config.h
861 chomp(my $incos = `uname -n -s -r`);
862 chomp(my $version = `sh ./src/version.sh`);
863 open(FILEHANDLE, ">include/inspircd_config.h");
864 my $NL = $config{NICK_LENGT}+1;
865 my $CL = $config{CHAN_LENGT}+1;
866 print FILEHANDLE <<EOF;
867 /* Auto generated by configure, do not modify! */
868 #ifndef __CONFIGURATION_AUTO__
869 #define __CONFIGURATION_AUTO__
871 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
872 #define MOD_PATH "$config{MODULE_DIR}"
873 #define VERSION "$version"
874 #define MAXCLIENTS $config{MAX_CLIENT}
875 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
878 #define MAXCHANS $config{MAX_CHANNE}
879 #define OPERMAXCHANS $config{MAX_OPERCH}
880 #define MAXMODES $config{MAXI_MODES}
881 #define IDENTMAX $config{MAX_IDENT}
882 #define MAXQUIT $config{MAX_QUIT}
883 #define MAXTOPIC $config{MAX_TOPIC}
884 #define MAXKICK $config{MAX_KICK}
885 #define MAXGECOS $config{MAX_GECOS}
886 #define MAXAWAY $config{MAX_AWAY}
887 #define OPTIMISATION $config{OPTIMITEMP}
888 #define SYSTEM "$incos"
891 if ($config{OSNAME} =~ /SunOS/) {
892 print FILEHANDLE "#define IS_SOLARIS\n";
894 if ($config{OSNAME} =~ /CYGWIN/) {
895 print FILEHANDLE "#define IS_CYGWIN\n";
896 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
898 if ($config{OSNAME} eq "CYG-STATIC") {
899 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
902 if ($config{STATIC_LINK} eq "yes") {
903 print FILEHANDLE "#define STATIC_LINK\n";
905 if ($config{GCCVER} > 3) {
906 print FILEHANDLE "#define GCC3\n";
907 print FILEHANDLE "#define GCC34\n";
911 if ($config{GCCVER} == 3) {
912 print FILEHANDLE "#define GCC3\n";
913 if ($config{GCC34} > 3) {
914 print FILEHANDLE "#define GCC34\n";
918 if ($config{HAS_STRLCPY} eq "true") {
919 print FILEHANDLE "#define HAS_STRLCPY\n";
921 if ($config{THREADED_DNS} =~ /y/i) {
922 print FILEHANDLE "#define THREADED_DNS\n";
925 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
926 print FILEHANDLE "#define USE_KQUEUE\n";
929 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
930 print FILEHANDLE "#define USE_EPOLL\n";
933 # user didn't choose either epoll or select for their OS.
934 # default them to USE_SELECT (ewwy puke puke)
936 print FILEHANDLE "#define USE_SELECT\n";
938 print FILEHANDLE "\n#endif\n";
941 # Create a Modules List..
943 foreach $i (@modlist)
945 if ($config{STATIC_LINK} eq "yes") {
946 $modules .= "m_".$i.".o ";
949 $modules .= "m_".$i.".so ";
952 chomp($modules); # Remove Redundant whitespace..
955 # Write all .in files.
958 my $exe = "inspircd";
960 if ($config{OSNAME} =~ /CYGWIN/) {
961 $exe = "inspircd.exe";
964 opendir(DIRHANDLE, $this);
965 if ($config{THREADED_DNS} =~ /y/i) {
966 $config{LDLIBS} = $config{LDLIBS} . " -pthread";
968 foreach $name (sort readdir(DIRHANDLE)) {
969 if ($name =~ /^\.(.+)\.inc$/) {
971 # All .name.inc files need parsing!
973 open(FILEHANDLE, ".$file.inc");
974 while (<FILEHANDLE>) {
979 $tmp =~ s/\@CC\@/$config{CC}/;
980 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
981 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
982 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
983 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
984 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
985 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
986 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
987 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
988 $tmp =~ s/\@MODULES\@/$modules/;
989 $tmp =~ s/\@EXECUTABLE\@/$exe/;
990 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
991 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
993 print "Writing \033[1;32m$file\033[0m\n";
994 open(FILEHANDLE, ">$file");
995 print FILEHANDLE $tmp;
1000 # Make inspircd executable!
1001 chmod 0744, 'inspircd';
1003 if ($config{STATIC_LINK} eq "yes") {
1004 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1005 write_static_makefile();
1006 write_static_modules_makefile();
1007 } elsif ($config{OSNAME} =~ /CYGWIN/) {
1008 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1009 write_static_makefile();
1010 write_dynamic_modules_makefile();
1012 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1013 write_dynamic_makefile();
1014 write_dynamic_modules_makefile();
1018 sub getcompilerflags {
1022 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
1031 sub getlinkerflags {
1035 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
1045 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";
1046 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";
1047 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";
1048 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";
1049 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";
1050 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";
1051 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";
1052 print "\033[0m\033[0m....::..::::..:::......:::..:::::::::....::..:::::..:::......:::........:::\n\n";
1055 sub resolve_directory {
1057 return File::Spec->rel2abs($_[0]);
1061 my ($flag,$prompt) = @_;
1062 print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
1063 chomp($tmp = <STDIN>);
1064 if ($tmp eq "") { $tmp = $config{$flag} }
1066 if (($tmp eq "") || ($tmp =~ /^y/i)) {
1067 $config{$flag} = "y";
1069 $config{$flag} = "n";
1074 sub write_static_modules_makefile {
1075 # Modules Makefile..
1076 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1077 open(FILEHANDLE, ">src/modules/Makefile");
1080 # Module Makefile Header
1082 print FILEHANDLE <<EOF;
1083 # (C) ChatSpike development team
1084 # Makefile by <Craig\@ChatSpike.net>
1085 # Many Thanks to Andrew Church <achurch\@achurch.org>
1086 # for assisting with making this work right.
1088 # Automatically Generated by ./configure to add a modules
1089 # please run ./configure --update
1095 # End Module Makefile Header
1098 # Create a Modules List..
1103 open(MODLIST,">include/modlist.h");
1106 # Include File Header
1108 print MODLIST <<HEADER;
1109 // Generated automatically by configure. DO NOT EDIT!
1111 #ifndef __SYMBOLS__H_CONFIGURED__
1112 #define __SYMBOLS__H_CONFIGURED__
1116 # End Include File Header
1119 # Place Module List into Include
1120 foreach $i (@modlist) {
1121 if ($i !~ /_static$/) {
1122 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1125 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1130 foreach $i (@modlist)
1132 if ($i !~ /_static$/) {
1133 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1134 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1137 # Write Entry to the Makefile
1139 print FILEHANDLE <<EOCHEESE;
1140 m_$i.o: m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h
1141 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c m_$i\_static.cpp
1142 mv m_$i\_static.o ../m_$i.o
1146 # End Write Entry to the MakeFile
1148 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1149 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1150 open(MUNGED,">src/modules/m_".$i."_static.cpp") or die("Could not create m_".$i."_static.cpp");
1151 while (chomp($a = <MODULE>)) {
1152 $a =~ s/init_module/$i\_init/g;
1153 $a =~ s/Srv/$i\Srv/g;
1154 print MUNGED "$a\n";
1158 print MODLIST <<EOENT;
1159 {"m_$i.so",\&$i\_init},
1164 print MODLIST "{0}};\n\n#endif\n";
1168 sub write_dynamic_modules_makefile {
1169 # Modules Makefile..
1170 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1171 open(FILEHANDLE, ">src/modules/Makefile");
1174 if ($config{OSNAME} =~ /CYGWIN/) {
1175 $extra = "../inspircd.dll.a";
1179 # Module Makefile Header
1181 print FILEHANDLE <<EOF;
1182 # (C) ChatSpike development team
1183 # Makefile by <Craig\@ChatSpike.net>
1184 # Many Thanks to Andrew Church <achurch\@achurch.org>
1185 # for assisting with making this work right.
1187 # Automatically Generated by ./configure to add a modules
1188 # please run ./configure -update or ./configure -modupdate
1194 # End Module Makefile Header
1197 # Create a Modules List..
1202 foreach $i (@modlist) {
1204 # Write Entry to the MakeFile
1206 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1207 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1208 print FILEHANDLE <<EOCHEESE;
1209 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
1210 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1211 \$(CC) \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1212 \@-rm -f \$(MODPATH)/m_$i.so
1213 install -v -m 0700 m_$i.so \$(MODPATH)
1217 # End Write Entry to the MakeFile
1223 sub write_static_makefile {
1224 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1227 opendir(DIRHANDLE, "src");
1228 foreach $name (sort readdir(DIRHANDLE)) {
1229 if ($name =~ /^cmd_(.+)\.cpp$/) {
1230 $cmdlist[$i++] = $1;
1233 closedir(DIRHANDLE);
1236 foreach my $cmd (@cmdlist) {
1237 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1238 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1243 # (C) ChatSpike development team
1244 # Makefile by <Craig\@ChatSpike.net>
1245 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1248 CC = im a cheezeball
1250 CXXFLAGS = -I../include \${FLAGS}
1254 # This next section is for cygwin dynamic module builds.
1255 # Basically, what we do, is build the inspircd core as a library
1256 # then the main executable uses that. the library is capable of
1257 # loading / unloading the modules dynamically :)
1258 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1262 if ($config{OSNAME} =~ /CYGWIN/) {
1264 all: aes.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o inspircd.exe
1266 inspircd.exe: inspircd.dll.a
1269 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
1270 \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1274 all: aes.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o \$(MODULES) inspircd.exe
1276 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
1277 \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspircd_io.o message.o $cmdobjs commands.o dnsqueue.o dynamic.o users.o modules.o wildcard.o helperfuncs.o hashcomp.o socket.o socketengine.o userprocess.o cull_list.o command_parse.o aes.o \$(MODULES)
1283 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
1284 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1286 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
1287 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1289 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1290 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1292 socketengine.o: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1293 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1295 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1296 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1298 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1299 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1301 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1302 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1304 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
1305 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1307 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
1308 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1310 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
1311 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1313 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
1314 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1316 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1317 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1319 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
1320 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1322 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
1323 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1325 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
1326 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1328 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
1329 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1331 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
1332 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1334 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
1335 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1337 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
1338 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1340 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
1341 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1343 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1344 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1346 aes.o: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1347 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1350 foreach my $cmd (@cmdlist) {
1352 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
1353 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1359 sub write_dynamic_makefile {
1363 opendir(DIRHANDLE, "src");
1364 foreach $name (sort readdir(DIRHANDLE)) {
1365 if ($name =~ /^cmd_(.+)\.cpp$/) {
1366 $cmdlist[$i++] = $1;
1369 closedir(DIRHANDLE);
1373 foreach my $cmd (@cmdlist) {
1374 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1375 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1378 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1382 # (C) ChatSpike development team
1383 # Makefile by <Craig\@ChatSpike.net>
1384 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1387 CC = im a cheezeball
1389 CXXFLAGS = -I../include \${FLAGS}
1391 all: libIRCDaes.so libIRCDcull_list.so libIRCDuserprocess.so libIRCDsocketengine.so libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDio.so libIRCDmessage.so $cmdobjs libIRCDcommands.so libIRCDdnsqueue.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so inspircd
1393 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
1394 \$(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
1396 libIRCDsocketengine.so: socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1397 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp
1398 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o
1400 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
1401 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1402 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1404 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
1405 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1406 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1408 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1409 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1410 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1412 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1413 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1414 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1416 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/helperfuncs.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1417 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1418 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1420 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1421 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1422 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1424 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
1425 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1426 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o
1428 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
1429 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1430 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1432 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
1433 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1434 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1436 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
1437 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1438 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1440 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1441 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1442 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1444 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
1445 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspircd_io.cpp
1446 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDio.so inspircd_io.o
1448 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
1449 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c message.cpp
1450 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmessage.so message.o
1452 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
1453 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1454 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o $cmdobjs
1456 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
1457 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dnsqueue.cpp
1458 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdnsqueue.so dnsqueue.o
1460 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
1461 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1462 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1464 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
1465 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1466 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1468 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
1469 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1470 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1472 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
1473 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1474 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1476 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1477 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1478 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1480 libIRCDaes.so: aes.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1481 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c aes.cpp
1482 \$(CC) -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDaes.so aes.o
1485 foreach my $cmd (@cmdlist) {
1487 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
1488 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp