3 # InspIRCd Configuration Script
5 # Copyright 2002-2007 The ChatSpike Development Team
6 # <brain@chatspike.net>
7 # <Craig@chatspike.net>
9 # [14:21] Brain: <matrix impression> i know perl-fu!
13 ########################################
21 # Utility functions for our buildsystem
26 'enable-gnutls' => \$opt_use_gnutls,
27 'rebuild' => \$opt_rebuild,
28 'enable-openssl' => \$opt_use_openssl,
29 'disable-interactive' => \$opt_nointeractive,
30 'with-nick-length=i' => \$opt_nick_length,
31 'with-channel-length=i' => \$opt_chan_length,
32 'with-max-channels=i' => \$opt_maxchans,
33 'with-max-oper-channels=i' => \$opt_opermaxchans,
34 'with-max-clients=i' => \$opt_maxclients,
35 'enable-epoll' => \$opt_epoll,
36 'enable-kqueue' => \$opt_kqueue,
37 'disable-epoll' => \$opt_noepoll,
38 'disable-kqueue' => \$opt_nokqueue,
39 'enable-ipv6' => \$opt_ipv6,
40 'enable-remote-ipv6' => \$opt_ipv6links,
41 'disable-remote-ipv6' => \$opt_noipv6links,
42 'with-cc=s' => \$opt_cc,
43 'with-ident-length=i' => \$opt_ident,
44 'with-quit-length=i' => \$opt_quit,
45 'with-topic-length=i' => \$opt_topic,
46 'with-kick-length=i' => \$opt_kick,
47 'with-gecos-length=i' => \$opt_gecos,
48 'with-away-length=i' => \$opt_away,
49 'with-max-modes=i' => \$opt_modes,
50 'prefix=s' => \$opt_base_dir,
51 'config-dir=s' => \$opt_config_dir,
52 'module-dir=s' => \$opt_module_dir,
53 'binary-dir=s' => \$opt_binary_dir,
54 'library-dir=s' => \$opt_library_dir,
55 'disable-debuginfo' => sub { $opt_disable_debug = 1 },
56 'help' => sub { showhelp(); },
57 'modupdate' => sub { modupdate(); },
58 'update' => sub { update(); },
59 'svnupdate' => sub { svnupdate(); },
60 'clean' => sub { clean(); },
63 my $non_interactive = (
64 (defined $opt_library_dir) ||
65 (defined $opt_base_dir) ||
66 (defined $opt_config_dir) ||
67 (defined $opt_module_dir) ||
68 (defined $opt_base_dir) ||
69 (defined $opt_binary_dir) ||
70 (defined $opt_nointeractive) ||
71 (defined $opt_away) ||
72 (defined $opt_gecos) ||
73 (defined $opt_kick) ||
74 (defined $opt_maxclients) ||
75 (defined $opt_modes) ||
76 (defined $opt_topic) ||
77 (defined $opt_quit) ||
78 (defined $opt_ident) ||
80 (defined $opt_ipv6) ||
81 (defined $opt_ipv6links) ||
82 (defined $opt_noipv6links) ||
83 (defined $opt_kqueue) ||
84 (defined $opt_epoll) ||
85 (defined $opt_maxchans) ||
86 (defined $opt_opermaxchans) ||
87 (defined $opt_chan_length) ||
88 (defined $opt_nick_length) ||
89 (defined $opt_use_openssl) ||
90 (defined $opt_nokqueue) ||
91 (defined $opt_noepoll) ||
92 (defined $opt_use_gnutls)
94 my $interactive = !$non_interactive;
97 chomp($topdir = getcwd());
98 $this = resolve_directory($topdir); # PWD, Regardless.
99 @modlist = (); # Declare for Module List..
100 %config = (); # Initiate Configuration Hash..
101 $config{ME} = resolve_directory($topdir); # Present Working Directory
103 $config{BASE_DIR} = $config{ME};
105 if (defined $opt_base_dir)
107 $config{BASE_DIR} = $opt_base_dir;
110 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
111 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
112 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
113 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
115 if (defined $opt_config_dir)
117 $config{CONFIG_DIR} = $opt_config_dir;
119 if (defined $opt_module_dir)
121 $config{MODULE_DIR} = $opt_module_dir;
123 if (defined $opt_binary_dir)
125 $config{BINARY_DIR} = $opt_binary_dir;
127 if (defined $opt_library_dir)
129 $config{LIBRARY_DIR} = $opt_library_dir;
131 chomp($config{HAS_GNUTLS} = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
132 chomp($config{HAS_OPENSSL} = `openssl version 2>/dev/null`); # Openssl version
133 $config{USE_GNUTLS} = "n";
134 if (defined $opt_use_gnutls)
136 $config{USE_GNUTLS} = "y"; # Use gnutls.
138 $config{USE_OPENSSL} = "n"; # Use openssl.
139 if (defined $opt_use_openssl)
141 $config{USE_OPENSSL} = "y";
144 # no, let's not change these.
145 $config{OPTIMITEMP} = "0"; # Default Optimisation Value
146 if (!defined $opt_disable_debug)
148 $config{OPTIMISATI} = "-O2 -g1"; # Optimisation Flag
152 $config{OPTIMISATI} = "-O2"; # DEBUGGING OFF!
155 $config{NICK_LENGT} = "31"; # Default Nick Length
156 if (defined $opt_nick_length)
158 $config{NICK_LENGT} = $opt_nick_length;
160 $config{CHAN_LENGT} = "64"; # Default Channel Name Length
161 if (defined $opt_chan_length)
163 $config{CHAN_LENGT} = $opt_chan_length;
165 $config{MAX_CHANNE} = "20"; # Default Max. Channels per user
166 if (defined $opt_maxchans)
168 $config{MAX_CHANNE} = $opt_maxchans;
170 $config{MAX_OPERCH} = "60"; # Default Max. Channels per oper
171 if (defined $opt_opermaxchans)
173 $config{MAX_OPERCH} = $opt_opermaxchans;
175 $config{MAXI_MODES} = "20"; # Default Max. Number of Modes set at once.
176 if (defined $opt_modes)
178 $config{MAXI_MODES} = $opt_modes;
180 $config{HAS_STRLCPY} = "false"; # strlcpy Check.
181 $config{HAS_STDINT} = "false"; # stdint.h check
182 $config{USE_KQUEUE} = "y"; # kqueue enabled
183 if (defined $opt_kqueue)
185 $config{USE_KQUEUE} = "y";
187 if (defined $opt_nokqueue)
189 $config{USE_KQUEUE} = "n";
191 $config{USE_EPOLL} = "y"; # epoll enabled
192 if (defined $opt_epoll)
194 $config{USE_EPOLL} = "y";
196 if (defined $opt_noepoll)
198 $config{USE_EPOLL} = "n";
200 $config{IPV6} = "n"; # IPv6 support (experimental)
201 if (defined $opt_ipv6)
205 $config{SUPPORT_IP6LINKS} = "y"; # IPv4 supporting IPv6 links (experimental)
206 if (defined $opt_ipv6links)
208 $config{SUPPORT_IP6LINKS} = "y";
210 if (defined $opt_noipv6links)
212 $config{SUPPORT_IP6LINKS} = "n";
214 $config{STATIC_LINK} = "no"; # are doing static modules?
215 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
216 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
217 chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version
218 $config{_SOMAXCONN} = SOMAXCONN; # Max connections in accept queue
219 $config{OSNAME} = $^O; # Operating System Name
220 $config{CC} = "g++"; # C++ compiler
223 $config{CC} = $opt_cc;
225 $exec = $config{CC} . " -dumpversion | cut -c 1";
226 chomp($config{GCCVER} = `$exec`); # Major GCC Version
227 $config{MAKEORDER} = "ircd mods"; # build order
228 $config{STATICLIBS} = ""; # library archive path
229 $config{MAX_IDENT} = "12"; # max ident size
230 $config{MAX_QUIT} = "255"; # max quit message size
231 $config{MAX_TOPIC} = "307"; # max topic size
232 $config{MAX_KICK} = "255"; # max kick message size
233 $config{MAX_GECOS} = "128"; # max GECOS size
234 $config{MAX_AWAY} = "200"; # max AWAY size
235 if (defined $opt_ident)
237 $config{MAX_IDENT} = $opt_ident;
239 if (defined $opt_quit)
241 $config{MAX_QUIT} = $opt_quit;
243 if (defined $opt_topic)
245 $config{MAX_TOPIC} = $opt_topic;
247 if (defined $opt_kick)
249 $config{MAX_KICK} = $opt_kick;
251 if (defined $opt_gecos)
253 $config{MAX_GECOS} = $opt_gecos;
255 if (defined $opt_away)
257 $config{MAX_AWAY} = $opt_away;
260 $config{HAS_OPENSSL} =~ /OpenSSL ([-[:digit:].]+)([a-z])?(\-[a-z][0-9])? (\w{3}|[0-9]+) (\w{3}|[0-9]+) [0-9]{4}/;
261 $config{HAS_OPENSSL} = $1;
263 if ($config{GCCVER} eq "") {
264 print $config{CC} . " was not found! You require g++ (the GNU C++ compiler, part of GCC) to build InspIRCd!\n";
268 # Minihack! Convert Cygwin to 'Cyg-Static' so i can
269 # Keep my dynamic module experiments here for later
272 if ($config{OSNAME} =~ /CYGWIN/i)
274 $config{OSNAME} = "CYG-STATIC";
277 if (!$config{MAX_CLIENT_T}) {
278 $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
279 $fd_scan_fail = "true"; # Used Later
282 # Get and Set some important vars..
287 system("rm -rf .config.cache");
293 chomp($topdir = getcwd());
294 $this = resolve_directory($topdir); # PWD, Regardless.
296 # Does the cache file exist?
298 # No, No it doesn't.. *BASH*
299 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
302 # We've Loaded the cache file and all our variables..
303 print "Updating Files..\n";
305 if ($opt_disable_debug == 1)
307 print "Disabling debug information (-g).\n";
308 $config{OPTIMISATI} = "";
311 $has_epoll = $config{HAS_EPOLL};
312 $has_kqueue = $config{HAS_KQUEUE};
321 print "Configure update failed: $@\n";
329 chomp($topdir = getcwd());
330 $this = resolve_directory($topdir); # PWD, Regardless.
332 # Does the cache file exist?
334 # No, No it doesn't.. *BASH*
335 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
338 # We've Loaded the cache file and all our variables..
339 print "Updating Files..\n";
341 $has_epoll = $config{HAS_EPOLL};
342 $has_kqueue = $config{HAS_KQUEUE};
351 print "Module update failed: $@\n";
361 open(FH,"<.svn/entries") or $fail = 1;
363 print "This is not an SVN copy of InspIRCd.\n";
370 system("svn update");
371 system("perl configure -update");
372 if (defined $opt_rebuild) {
373 system("make install");
378 print "Running non-interactive configure...\n" unless $interactive;
379 print "Checking for cache from previous configure... ";
380 print ((getcache() eq "true") ? "found\n" : "not found\n");
381 print "Checking operating system version... ";
382 print getosflags() . "\n";
384 if (defined $opt_maxclients)
386 $config{MAX_CLIENT} = $opt_maxclients;
389 if (!$config{MAX_CLIENT}) {
390 # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
391 # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
392 # higher than the found value" :))
393 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
396 printf "Checking if stdint.h exists... ";
397 $config{HAS_STDINT} = "true";
399 open(STDINT, "</usr/include/stdint.h") or $config{HAS_STDINT} = "false";
400 if ($config{HAS_STDINT} eq "true") {
403 print "yes\n" if $config{HAS_STDINT} eq "true";
404 print "no\n" if $config{HAS_STDINT} eq "false";
407 printf "Checking if strlcpy exists... ";
408 # Perform the strlcpy() test..
409 $config{HAS_STRLCPY} = "false";
411 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
413 while (chomp($line = <STRLCPY>)) {
414 # try and find the delcaration of:
415 # size_t strlcpy(...)
416 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
417 $config{HAS_STRLCPY} = "true";
422 print "yes\n" if $config{HAS_STRLCPY} eq "true";
423 print "no\n" if $config{HAS_STRLCPY} eq "false";
426 printf "Checking if kqueue exists... ";
429 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
431 while (chomp($line = <KQUEUE>)) {
432 # try and find the delcaration of:
434 if ($line =~ /int(\0x9|\s)+kqueue/) {
440 print "yes\n" if $has_kqueue == 1;
441 print "no\n" if $has_kqueue == 0;
443 printf "Checking if epoll exists... ";
446 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
452 my $kernel = `uname -r`;
454 if (($kernel =~ /^2\.0\./) || ($kernel =~ /^2\.2\./) || ($kernel =~ /^2\.4\./)) {
458 print "yes\n" if $has_epoll == 1;
459 print "no\n" if $has_epoll == 0;
461 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
462 $config{HAS_STRLCPY} = "true";
465 $config{HAS_EPOLL} = $has_epoll;
466 $config{HAS_KQUEUE} = $has_kqueue;
468 printf "Checking for libgnutls... ";
469 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
471 $config{HAS_GNUTLS} = "y";
474 $config{HAS_GNUTLS} = "n";
477 printf "Checking for openssl... ";
478 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
480 $config{HAS_OPENSSL} = "y";
483 $config{HAS_OPENSSL} = "n";
486 ################################################################################
487 # BEGIN INTERACTIVE PART #
488 ################################################################################
496 my $rev = getrevision();
497 # Display Introduction Message..
499 Welcome to the \033[1mInspIRCd\033[0m Configuration program! (\033[1minteractive mode\033[0m)
500 \033[1mPackage maintainers: Type ./configure --help for non-interactive help\033[0m
502 *** If you are unsure of any of these values, leave it blank for ***
503 *** standard settings that will work, and your server will run ***
504 *** using them. Please consult your IRC network admin if in doubt. ***
506 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
507 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
508 dir, otherwise you won't have a config file!
510 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos)
511 Maximum file descriptors: \033[1;32m$config{MAX_CLIENT_T}\033[0m
512 Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
514 print " (Non-SVN build)";
518 $config{CHANGE_COMPILER} = "n";
519 print "I have detected the following compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
521 while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
522 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
523 should NOT be used. You should probably specify a newer compiler.\n\n";
524 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
525 if ($config{CHANGE_COMPILER} =~ /y/i) {
526 print "What command do you want to use to invoke your compiler?\n";
527 print "[\033[1;32m$config{CC}\033[0m] -> ";
528 chomp($config{CC} = <STDIN>);
529 if ($config{CC} eq "") {
532 chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
534 chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change compilers
535 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
536 if ($config{GCCVER} < 3) {
537 print "\033[1;32mGCC 2.x WILL NOT WORK!\033[0m. Let's try that again, shall we?\n";
541 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
548 # Directory Settings..
549 my $tmpbase = $config{BASE_DIR};
550 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
551 if ($tmpbase ne $config{BASE_DIR}) {
552 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Dir
553 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
554 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
555 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
558 dir_check("are the configuration files", "CONFIG_DIR");
559 dir_check("are the modules to be compiled to", "MODULE_DIR");
560 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
561 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
564 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?");
568 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?");
571 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
572 if (!$chose_hiperf) {
573 print "No high-performance socket engines are available, or you chose\n";
574 print "not to enable one. Defaulting to select() engine.\n\n";
577 yesno(IPV6,"Would you like to build InspIRCd with IPv6 support?");
580 if ($config{IPV6} eq "y") {
581 print "You have chosen to build an \033[1;32mIPV6-only\033[0m server.\nTo accept IPV4 users, you must use the '::ffff:' notation of addresses.\n\n";
582 $config{SUPPORT_IP6LINKS} = "y";
584 yesno(SUPPORT_IP6LINKS,"You have chosen to build an \033[1;32mIPV4-only\033[0m server.\nWould you like to enable support for linking to IPV6-enabled\nInspIRCd servers which are using '::ffff:' notation?\nIf you are using a recent operating\nsystem and are unsure, answer yes.");
588 if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
589 print "I have detected both GnuTLS and OpenSSL on your system.\n";
590 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
591 print "instead, you should enable the OpenSSL module yourself\n";
592 print "by copying it from src/modules/extra to src/modules.\n\n";
595 if ($config{HAS_GNUTLS} eq "y") {
596 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
597 if ($config{USE_GNUTLS} eq "y") {
598 print "\nUsing GnuTLS SSL module.\n";
600 } elsif ($config{HAS_OPENSSL} eq "y") {
601 yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
602 if ($config{USE_OPENSSL} eq "y") {
603 print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
607 print "\nThe following questions will ask you for various figures relating\n";
608 print "To your IRCd install. Please note that these should usually be left\n";
609 print "as defaults unless you have a real reason to change them. If they\n";
610 print "changed, then the values must be identical on all servers on your\n";
611 print "network, or malfunctions and/or crashes may occur, with the exception\n";
612 print "of the 'maximum number of clients' setting which may be different on\n";
613 print "different servers on the network.\n\n";
615 # File Descriptor Settings..
616 promptnumeric("number of clients at any one time", "MAX_CLIENT_T");
617 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
618 $config{MAX_DESCRIPTORS} = $config{MAX_CLIENT_T};
620 promptnumeric("length of nicknames", "NICK_LENGT");
621 promptnumeric("length of channel names", "CHAN_LENGT");
622 promptnumeric("number of channels a normal user may join at any one time", "MAX_CHANNE");
623 promptnumeric("number of channels an oper may join at any one time", "MAX_OPERCH");
624 promptnumeric("number of mode changes in one line", "MAXI_MODES");
625 promptnumeric("length of an ident (username)", "MAX_IDENT");
626 promptnumeric("length of a quit message", "MAX_QUIT");
627 promptnumeric("length of a channel topic", "MAX_TOPIC");
628 promptnumeric("length of a kick message", "MAX_KICK");
629 promptnumeric("length of a GECOS (real name)", "MAX_GECOS");
630 promptnumeric("length of an away message", "MAX_AWAY");
635 if (($config{USE_GNUTLS} eq "y") && ($config{HAS_GNUTLS} ne "y"))
637 print "Sorry, but i couldn't detect gnutls. Make sure gnutls-config is in your path.\n";
640 if (($config{USE_OPENSSL} eq "y") && ($config{HAS_OPENSSL} ne "y"))
642 print "Sorry, but i couldn't detect openssl. Make sure openssl is in your path.\n";
646 if ($config{USE_GNUTLS} eq "y") {
648 open(TMP, "<src/modules/m_ssl_gnutls.cpp") or $failed = 1;
651 print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
652 chdir("src/modules");
653 system("ln -s extra/m_ssl_gnutls.cpp");
654 system("ln -s extra/ssl_cert.h");
661 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
663 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
666 print "SSL Certificates Not found, Generating.. \n\n
667 *************************************************************
668 * Generating the Private Key may take some time, go grab a *
669 * Coffee. Even better, to generate some more entropy if it *
670 * is taking a while, open another console and type du / a *
671 * few times and get that HD going :) Then answer the *
672 * Questions which follow. If you are unsure, just hit enter *
673 *************************************************************\n\n";
674 system("certtool --generate-privkey --outfile key.pem");
675 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
676 print "\nCertificate generation complete, copying to config directory... ";
677 system("mv key.pem $config{CONFIG_DIR}/key.pem");
678 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
681 print "SSL Certificates found, skipping.\n\n"
686 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
688 } elsif ($config{USE_OPENSSL} eq "y") {
690 open(TMP, "<src/modules/m_ssl_openssl.cpp") or $failed = 1;
693 print "Symlinking src/modules/m_ssl_openssl.cpp from extra/\n";
694 chdir("src/modules");
695 system("ln -s extra/m_ssl_openssl.cpp");
696 system("ln -s extra/ssl_cert.h");
703 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
705 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
708 print "SSL Certificates Not found, Generating.. \n\n
709 *************************************************************
710 * Generating the certificates may take some time, go grab a *
711 * coffee, or something. *
712 *************************************************************\n\n";
713 system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
714 system("openssl dhparam -out dhparams.pem 1024");
715 print "\nCertificate generation complete, copying to config directory... ";
716 system("mv key.pem $config{CONFIG_DIR}/key.pem");
717 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
718 system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
721 print "SSL Certificates found, skipping.\n\n"
726 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
729 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
730 print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
738 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
739 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
740 print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
741 print "load the required modules in your config. This configure process\n";
742 print "has just prepared these modules to be compiled for you, and has not\n";
743 print "configured them to be compiled into the core of the ircd.\n";
745 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
746 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
747 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";
750 if ($config{GCCVER} < "3") {
752 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
753 GCC 2.x series compilers only had partial (read as broken) C++ support, and
754 your compile will most likely fail horribly! If you have any problems, do NOT
755 report them to the bugtracker or forums without first upgrading your compiler
756 to a newer 3.x or 4.x (or whatever is available currently) version.
760 ################################################################################
762 ################################################################################
764 # Retrieves the .config.cache file, and loads values into the main config hash.
765 open(CACHE, ".config.cache") or return undef;
768 # Ignore Blank lines, and comments..
771 my ($key, $value) = split("=", $_, 2);
772 $value =~ /^\"(.*)\"$/;
773 # Do something with data here!
781 # Dump the contents of %config
782 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
783 open(FILEHANDLE, ">.config.cache");
784 foreach $key (keys %config) {
785 print FILEHANDLE "$key=\"$config{$key}\"\n";
791 my ($desc, $hash_key) = @_;
794 print "In what directory $desc?\n";
795 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
796 chomp($var = <STDIN>);
798 $var = $config{$hash_key};
800 if ($var =~ /^\~\/(.+)$/) {
801 # Convert it to a full path..
802 $var = resolve_directory($ENV{HOME} . "/" . $1);
804 elsif ((($config{OSNAME} =~ /MINGW32/i) and ($var !~ /^[A-Z]{1}:\\.*/)) and (substr($var,0,1) ne "/"))
806 # Assume relative Path was given.. fill in the rest.
807 $var = $this . "/$var";
810 $var = resolve_directory($var);
812 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
813 chomp($tmp = <STDIN>);
814 if (($tmp eq "") || ($tmp =~ /^y/i)) {
815 # Attempt to Create the Dir..
817 system("mkdir -p \"$var\" >> /dev/null 2>&1");
818 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
820 print "Unable to create directory. ($var)\n\n";
825 # They said they don't want to create, and we can't install there.
831 # Target exists, but is not a directory.
832 print "File $var exists, but is not a directory.\n\n";
836 # Either Dir Exists, or was created fine.
837 $config{$hash_key} = $var;
845 $config{LDLIBS} = "-lstdc++";
846 $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
847 $config{MAKEPROG} = "make";
849 if ($config{OSNAME} =~ /OpenBSD/i) {
850 $config{MAKEPROG} = "gmake";
851 chomp($foo = `eg++ -dumpversion | cut -c 1`);
852 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
853 # if theyre not running this, configure lets the build continue but they probably wont manage to
854 # compile as this standard version is 2.95.3!
856 $config{CC} = "eg++";
857 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
862 if ($config{OSNAME} =~ /Linux/i) {
863 $config{LDLIBS} = "-ldl -lstdc++";
864 $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
865 $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
866 $config{MAKEPROG} = "make";
867 if ($config{OSNAME} =~ /CYGWIN/) {
868 $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
869 $config{LDLIBS} = "";
870 $config{MAKEPROG} = "/usr/bin/make";
871 $config{MAKEORDER} = "ircd mods";
873 } elsif ($config{OSNAME} eq "CYG-STATIC") {
874 $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
875 $config{LDLIBS} = "";
876 $config{MAKEPROG} = "/usr/bin/make";
877 $config{MAKEORDER} = "mods ircd";
878 $config{STATICLIBS} = "modules/mods.a";
879 $config{STATIC_LINK} = "yes";
880 return "Cygwin-Static";
882 $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
885 if ($config{OSNAME} =~ /SunOS/i)
887 # solaris/sunos needs these
888 # socket = bsd sockets api
890 # rt = POSIX realtime extensions
891 # resolv = inet_aton only (why isnt this in nsl?!)
892 $config{MAKEPROG} = "gmake";
893 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
897 if($config{OSNAME} =~ /MINGW32/i)
899 # All code is position-independent on windows
900 $config{FLAGS} =~ s/-fPIC //;
904 return $config{OSNAME};
908 my($writeheader) = @_;
909 # First File.. inspircd_config.h
910 chomp(my $incos = `uname -n -s -r`);
911 chomp(my $version = `sh ./src/version.sh`);
912 chomp(my $revision = getrevision());
913 $version = "$version(r$revision)";
914 chomp(my $revision2 = getrevision());
915 if ($writeheader == 1)
917 print "Writing \033[1;32minspircd_config.h\033[0m\n";
918 open(FILEHANDLE, ">include/inspircd_config.h");
919 my $NL = $config{NICK_LENGT}+1;
920 my $CL = $config{CHAN_LENGT}+1;
921 print FILEHANDLE <<EOF;
922 /* Auto generated by configure, do not modify! */
923 #ifndef __CONFIGURATION_AUTO__
924 #define __CONFIGURATION_AUTO__
926 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
927 #define MOD_PATH "$config{MODULE_DIR}"
928 #define VERSION "$version"
929 #define REVISION "$revision2"
930 #define MAXCLIENTS $config{MAX_CLIENT}
931 #define MAXCLIENTS_S "$config{MAX_CLIENT}"
932 #define SOMAXCONN_S "$config{_SOMAXCONN}"
933 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
936 #define MAXCHANS $config{MAX_CHANNE}
937 #define OPERMAXCHANS $config{MAX_OPERCH}
938 #define MAXMODES $config{MAXI_MODES}
939 #define IDENTMAX $config{MAX_IDENT}
940 #define MAXQUIT $config{MAX_QUIT}
941 #define MAXTOPIC $config{MAX_TOPIC}
942 #define MAXKICK $config{MAX_KICK}
943 #define MAXGECOS $config{MAX_GECOS}
944 #define MAXAWAY $config{MAX_AWAY}
945 #define OPTIMISATION $config{OPTIMITEMP}
946 #define LIBRARYDIR "$config{LIBRARY_DIR}"
947 #define SYSTEM "$incos"
950 if ($config{OSNAME} =~ /SunOS/i) {
951 print FILEHANDLE "#define IS_SOLARIS\n";
953 if ($config{OSNAME} =~ /CYGWIN/i) {
954 print FILEHANDLE "#define IS_CYGWIN\n";
955 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
957 if ($config{OSNAME} =~ /MINGW32/i) {
958 print FILEHANDLE "#define IS_MINGW\n";
960 if ($config{OSNAME} =~ /CYG-STATIC/i) {
961 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
963 if ($config{STATIC_LINK} eq "yes") {
964 print FILEHANDLE "#define STATIC_LINK\n";
966 if ($config{GCCVER} >= 3) {
967 print FILEHANDLE "#define GCC3\n";
969 if ($config{HAS_STRLCPY} eq "true") {
970 print FILEHANDLE "#define HAS_STRLCPY\n";
972 if ($config{HAS_STDINT} eq "true") {
973 print FILEHANDLE "#define HAS_STDINT\n";
975 if ($config{IPV6} =~ /y/i) {
976 print FILEHANDLE "#define IPV6\n";
978 if ($config{SUPPORT_IP6LINKS} =~ /y/i) {
979 print FILEHANDLE "#define SUPPORT_IP6LINKS\n";
982 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
983 print FILEHANDLE "#define USE_KQUEUE\n";
984 $se = "socketengine_kqueue";
987 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
988 print FILEHANDLE "#define USE_EPOLL\n";
989 $se = "socketengine_epoll";
992 # user didn't choose either epoll or select for their OS.
993 # default them to USE_SELECT (ewwy puke puke)
995 print FILEHANDLE "#define USE_SELECT\n";
996 $se = "socketengine_select";
998 print FILEHANDLE "\n#endif\n";
1004 open(FILEHANDLE, ">include/inspircd_se_config.h");
1005 print FILEHANDLE <<EOF;
1006 /* Auto generated by configure, do not modify or commit to svn! */
1007 #ifndef __CONFIGURATION_SOCKETENGINE__
1008 #define __CONFIGURATION_SOCKETENGINE__
1018 # Create a Modules List..
1020 foreach $i (@modlist)
1022 if ($config{STATIC_LINK} eq "yes") {
1023 $modules .= "m_".$i.".o ";
1026 $modules .= "m_".$i.".so ";
1029 chomp($modules); # Remove Redundant whitespace..
1031 opendir(DIRHANDLE, "src/modules");
1032 foreach $name (sort readdir(DIRHANDLE)) {
1033 if ($name =~ /^m_(.+?)$/) {
1034 if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1035 closedir(MDIRHANDLE);
1036 $modules .= "$name.so ";
1040 closedir(DIRHANDLE);
1043 # Write all .in files.
1046 my $exe = "inspircd";
1048 if ($config{OSNAME} =~ /CYGWIN/i) {
1049 $exe = "inspircd.exe";
1052 opendir(DIRHANDLE, $this);
1054 # Do this once here, and cache it in the .*.inc files,
1055 # rather than attempting to read src/version.sh from
1056 # compiled code -- we might not have the source to hand.
1057 # Fix for bug#177 by Brain.
1059 chomp(my $version = `sh ./src/version.sh`);
1060 chomp(my $revision = getrevision());
1061 $version = "$version(r$revision)";
1063 # We can actually parse any file starting with . and ending with .inc,
1064 # but right now we only parse .inspircd.inc to form './inspircd'
1066 foreach $name (sort readdir(DIRHANDLE)) {
1067 if ($name =~ /^\.(.+)\.inc$/) {
1069 # All .name.inc files need parsing!
1071 open(FILEHANDLE, ".$file.inc");
1072 while (<FILEHANDLE>) {
1077 $tmp =~ s/\@CC\@/$config{CC}/;
1078 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1079 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1080 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1081 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1082 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1083 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1084 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1085 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1086 $tmp =~ s/\@MODULES\@/$modules/;
1087 $tmp =~ s/\@EXECUTABLE\@/$exe/;
1088 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1089 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1090 $tmp =~ s/\@VERSION\@/$version/;
1092 print "Writing \033[1;32m$file\033[0m\n";
1093 open(FILEHANDLE, ">$file");
1094 print FILEHANDLE $tmp;
1097 closedir(DIRHANDLE);
1099 # Make inspircd executable!
1100 chmod 0744, 'inspircd';
1102 if ($config{STATIC_LINK} eq "yes") {
1103 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1104 write_static_makefile();
1105 write_static_modules_makefile();
1106 } elsif ($config{OSNAME} =~ /CYGWIN/i) {
1107 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1108 write_static_makefile();
1109 write_dynamic_modules_makefile();
1111 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1112 write_dynamic_makefile();
1113 write_dynamic_modules_makefile();
1117 sub write_static_modules_makefile {
1118 # Modules Makefile..
1119 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1120 open(FILEHANDLE, ">src/modules/Makefile");
1123 # Module Makefile Header
1125 print FILEHANDLE <<EOF;
1126 # (C) ChatSpike development team
1127 # Makefile by <Craig\@ChatSpike.net>
1128 # Many Thanks to Andrew Church <achurch\@achurch.org>
1129 # for assisting with making this work right.
1131 # Automatically Generated by ./configure to add a modules
1132 # please run ./configure --update
1138 # End Module Makefile Header
1141 # Create a Modules List..
1146 open(MODLIST,">include/modlist.h");
1149 # Include File Header
1151 print MODLIST <<HEADER;
1152 // Generated automatically by configure. DO NOT EDIT!
1154 #ifndef __SYMBOLS__H_CONFIGURED__
1155 #define __SYMBOLS__H_CONFIGURED__
1159 # End Include File Header
1162 # Place Module List into Include
1163 foreach $i (@modlist) {
1164 if ($i !~ /_static$/) {
1165 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1168 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1173 foreach $i (@modlist)
1175 if ($i !~ /_static$/) {
1176 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1177 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1178 $deps = getdependencies("src/modules/m_".$i.".cpp");
1180 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1183 # Write Entry to the Makefile
1185 print FILEHANDLE <<EOCHEESE;
1186 m_$i.o: .m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h $deps
1187 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c .m_$i\_static.cpp
1188 mv .m_$i\_static.o ../m_$i.o
1192 # End Write Entry to the MakeFile
1194 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1195 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1196 open(MUNGED,">src/modules/.m_".$i."_static.cpp") or die("Could not create .m_".$i."_static.cpp");
1197 while (chomp($a = <MODULE>)) {
1198 $a =~ s/init_module/$i\_init/g;
1199 print MUNGED "$a\n";
1203 print MODLIST <<EOENT;
1204 {"m_$i.so",\&$i\_init},
1210 print MODLIST "{0}};\n\n#endif\n";
1214 sub write_dynamic_modules_makefile {
1215 # Modules Makefile..
1216 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1217 open(FILEHANDLE, ">src/modules/Makefile");
1220 if ($config{OSNAME} =~ /CYGWIN/i) {
1221 $extra = "../inspircd.dll.a";
1225 # Module Makefile Header
1227 print FILEHANDLE <<EOF;
1228 # (C) ChatSpike development team
1229 # Makefile by <Craig\@ChatSpike.net>
1230 # Many Thanks to Andrew Church <achurch\@achurch.org>
1231 # for assisting with making this work right.
1233 # Automatically Generated by ./configure to add a modules
1234 # please run ./configure -update or ./configure -modupdate
1240 # End Module Makefile Header
1243 # Create a Modules List..
1249 foreach $i (@modlist) {
1251 # Write Entry to the MakeFile
1253 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1254 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1255 $deps = getdependencies("src/modules/m_".$i.".cpp");
1257 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1259 print FILEHANDLE <<EOCHEESE;
1260 m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps
1261 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1262 \$(CC) -pipe \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1265 $crud = $crud . " install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
1267 # End Write Entry to the MakeFile
1271 opendir(DIRHANDLE, "src/modules");
1272 foreach $name (sort readdir(DIRHANDLE)) {
1273 if ($name =~ /^m_(.+?)$/) {
1276 # A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
1277 if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1278 print "Composing Makefile rules for directory \033[1;32m$name\033[0m... ";
1280 print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h";
1281 foreach $fname (sort readdir(MDIRHANDLE)) {
1282 if ($fname =~ /\.cpp$/) {
1283 $cmflags = getcompilerflags("src/modules/$name/$fname");
1284 $liflags = getlinkerflags("src/modules/$name/$fname");
1285 $deps = getdependencies("src/modules/$name/$fname");
1287 $oname =~ s/\.cpp$/.o/g;
1288 print FILEHANDLE " $name/$oname";
1289 $crapola = $crapola . "$name/$oname: $name/$fname ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps\n";
1290 $crapola = $crapola . " \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $name/$oname -c $name/$fname\n\n";
1291 $crap3 = $crap3 . " $name/$oname";
1295 print "(\033[1;32m$i files found\033[0m)\n";
1296 print FILEHANDLE "\n \$(CC) -pipe \$(FLAGS) -shared $liflags -o $name.so $crap3\n";
1297 print FILEHANDLE "\n$crapola\n";
1298 closedir(MDIRHANDLE);
1299 $crud = $crud . " install -m \$(INSTMODE) $name.so \$(MODPATH)\n";
1303 closedir(DIRHANDLE);
1305 print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
1309 sub write_static_makefile {
1310 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1313 opendir(DIRHANDLE, "src");
1314 foreach $name (sort readdir(DIRHANDLE)) {
1315 if ($name =~ /^cmd_(.+)\.cpp$/) {
1316 $cmdlist[$i++] = $1;
1319 closedir(DIRHANDLE);
1322 foreach my $cmd (@cmdlist) {
1323 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1324 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1329 # (C) ChatSpike development team
1330 # Makefile by <Craig\@ChatSpike.net>
1331 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1334 CC = im a cheezeball
1336 CXXFLAGS = -I../include \${FLAGS}
1337 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1338 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1342 $se = "socketengine_select";
1343 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1344 $se = "socketengine_kqueue";
1346 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1347 $se = "socketengine_epoll";
1351 # This next section is for cygwin dynamic module builds.
1352 # Basically, what we do, is build the inspircd core as a library
1353 # then the main executable uses that. the library is capable of
1354 # loading / unloading the modules dynamically :)
1355 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1359 if ($config{OSNAME} =~ /CYGWIN/i) {
1361 all: timer.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o configreader.o inspsocket.o $cmdobjs commands.o dynamic.o users.o modules.o wildcard.o helperfuncs.o snomasks.o inspircd.exe
1363 inspircd.exe: inspircd.dll.a
1366 inspircd.dll inspircd.dll.a: inspircd.o channels.o mode.o xline.o inspstring.o dns.o base.o configreader.o inspsocket.o $cmdobjs commands.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 timer.o snomasks.o
1367 \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1371 all: timer.o command_parse.o cull_list.o userprocess.o socketengine.o socket.o hashcomp.o channels.o mode.o xline.o inspstring.o dns.o base.o configreader.o inspsocket.o $cmdobjs commands.o dynamic.o users.o modules.o wildcard.o helperfuncs.o snomasks.o \$(MODULES) inspircd.exe
1373 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
1374 \$(CC) -I../include \$(FLAGS) inspircd.cpp -o inspircd.exe \$(LDLIBS) channels.o mode.o xline.o inspstring.o dns.o base.o inspsocket.o configreader.o $cmdobjs commands.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 timer.o snomasks.o modes/modeclasses.a \$(MODULES)
1380 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
1381 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1383 snomasks.o: snomasks.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/channels.h
1384 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1386 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
1387 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1389 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1390 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1392 socketengine.o: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1393 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1395 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1396 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1398 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1399 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1401 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1402 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1404 mode.o: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES) modes/modeclasses.a
1405 \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS)
1406 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1408 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
1409 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1411 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
1412 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1414 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 ../include/timer.h
1415 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1417 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1418 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1420 configreader.o: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1421 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1423 commands.o: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h $srcobjs
1424 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1426 dynamic.o: dynamic.cpp ../include/base.h ../include/dynamic.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1427 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1429 users.o: users.cpp ../include/base.h ../include/users.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1430 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1432 modules.o: modules.cpp ../include/base.h ../include/modules.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1433 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1435 wildcard.o: wildcard.cpp ../include/base.h ../include/wildcard.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1436 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1438 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1439 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1441 inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1442 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1444 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1445 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1448 foreach my $cmd (@cmdlist) {
1450 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/commands/cmd_$cmd.h
1451 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1457 sub write_dynamic_makefile {
1461 opendir(DIRHANDLE, "src");
1462 foreach $name (sort readdir(DIRHANDLE)) {
1463 if ($name =~ /^cmd_(.+)\.cpp$/) {
1464 $cmdlist[$i++] = $1;
1467 closedir(DIRHANDLE);
1471 foreach my $cmd (@cmdlist) {
1472 $cmdobjs = $cmdobjs . "cmd_$cmd.so ";
1473 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1476 $se = "socketengine_select";
1477 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1478 $se = "socketengine_kqueue";
1480 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1481 $se = "socketengine_epoll";
1484 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1488 # (C) ChatSpike development team
1489 # Makefile by <Craig\@ChatSpike.net>
1490 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1493 CC = im a cheezeball
1495 CXXFLAGS = -I../include \${FLAGS}
1496 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1497 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1499 all: libIRCDtimer.so libIRCDcull_list.so libIRCDuserprocess.so libIRCDsocketengine.so libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDconfigreader.so libIRCDinspsocket.so $cmdobjs libIRCDcommands.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so libIRCDsnomasks.so inspircd
1501 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 libIRCDtimer.so libIRCDcull_list.so libIRCDuserprocess.so libIRCDsocketengine.so libIRCDsocket.so libIRCDhash.so libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDconfigreader.so libIRCDinspsocket.so $cmdobjs libIRCDsnomasks.so libIRCDcommands.so libIRCDdynamic.so libIRCDusers.so libIRCDmodules.so libIRCDwildcard.so libIRCDhelper.so libIRCDcommand_parse.so
1502 \$(CC) -pipe -I../include $extra -Wl,--rpath -Wl,$config{LIBRARY_DIR} \$(FLAGS) -rdynamic -L. inspircd.cpp -o inspircd \$(LDLIBS) libIRCDchannels.so libIRCDmode.so libIRCDxline.so libIRCDstring.so libIRCDasyncdns.so libIRCDbase.so libIRCDconfigreader.so libIRCDinspsocket.so libIRCDcommands.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 libIRCDtimer.so libIRCDsnomasks.so
1504 libIRCDsocketengine.so: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1505 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1506 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o $se.o
1508 libIRCDsnomasks.so: snomasks.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/channels.h
1509 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1510 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsnomasks.so snomasks.o
1512 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
1513 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1514 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1516 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
1517 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1518 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1520 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1521 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1522 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1524 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1525 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1526 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1528 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1529 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1530 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1532 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1533 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1534 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1536 libIRCDmode.so: mode.cpp ../include/base.h ../include/mode.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h \$(RELCPPFILES)
1537 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1538 \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1539 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o modes/modeclasses.a
1541 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 ../include/timer.h
1542 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1543 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1545 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
1546 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1547 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1549 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 ../include/timer.h
1550 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1551 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1553 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1554 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1555 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1557 libIRCDconfigreader.so: configreader.cpp ../include/base.h ../include/configreader.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1558 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1559 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDconfigreader.so configreader.o
1561 libIRCDcommands.so: commands.cpp ../include/base.h ../include/inspircd.h ../include/channels.h ../include/users.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1562 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1563 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o
1565 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
1566 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1567 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1569 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 ../include/timer.h
1570 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1571 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1573 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 ../include/timer.h
1574 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1575 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1577 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
1578 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1579 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1581 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1582 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1583 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1585 libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1586 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1587 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDinspsocket.so inspsocket.o
1589 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1590 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1591 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1594 foreach my $cmd (@cmdlist) {
1596 cmd_$cmd.so: 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/commands/cmd_$cmd.h
1597 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1598 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o cmd_$cmd.so cmd_$cmd.o