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 'enable-openssl' => \$opt_use_openssl,
28 'disable-interactive' => \$opt_nointeractive,
29 'with-nick-length=i' => \$opt_nick_length,
30 'with-channel-length=i' => \$opt_chan_length,
31 'with-max-channels=i' => \$opt_maxchans,
32 'with-max-oper-channels=i' => \$opt_opermaxchans,
33 'with-max-clients=i' => \$opt_maxclients,
34 'enable-epoll' => \$opt_epoll,
35 'enable-kqueue' => \$opt_kqueue,
36 'disable-epoll' => \$opt_noepoll,
37 'disable-kqueue' => \$opt_nokqueue,
38 'enable-ipv6' => \$opt_ipv6,
39 'enable-remote-ipv6' => \$opt_ipv6links,
40 'disable-remote-ipv6' => \$opt_noipv6links,
41 'with-cc=s' => \$opt_cc,
42 'with-ident-length=i' => \$opt_ident,
43 'with-quit-length=i' => \$opt_quit,
44 'with-topic-length=i' => \$opt_topic,
45 'with-kick-length=i' => \$opt_kick,
46 'with-gecos-length=i' => \$opt_gecos,
47 'with-away-length=i' => \$opt_away,
48 'with-max-modes=i' => \$opt_modes,
49 'prefix=s' => \$opt_base_dir,
50 'config-dir=s' => \$opt_config_dir,
51 'module-dir=s' => \$opt_module_dir,
52 'binary-dir=s' => \$opt_binary_dir,
53 'library-dir=s' => \$opt_library_dir,
54 'disable-debuginfo' => sub { $opt_disable_debug = 1 },
55 'help' => sub { showhelp(); },
56 'modupdate' => sub { modupdate(); },
57 'update' => sub { update(); },
58 'svnupdate' => sub { svnupdate(); },
59 'clean' => sub { clean(); },
62 my $non_interactive = (
63 (defined $opt_library_dir) ||
64 (defined $opt_base_dir) ||
65 (defined $opt_config_dir) ||
66 (defined $opt_module_dir) ||
67 (defined $opt_base_dir) ||
68 (defined $opt_binary_dir) ||
69 (defined $opt_nointeractive) ||
70 (defined $opt_away) ||
71 (defined $opt_gecos) ||
72 (defined $opt_kick) ||
73 (defined $opt_maxclients) ||
74 (defined $opt_modes) ||
75 (defined $opt_topic) ||
76 (defined $opt_quit) ||
77 (defined $opt_ident) ||
79 (defined $opt_ipv6) ||
80 (defined $opt_ipv6links) ||
81 (defined $opt_noipv6links) ||
82 (defined $opt_kqueue) ||
83 (defined $opt_epoll) ||
84 (defined $opt_maxchans) ||
85 (defined $opt_opermaxchans) ||
86 (defined $opt_chan_length) ||
87 (defined $opt_nick_length) ||
88 (defined $opt_use_openssl) ||
89 (defined $opt_nokqueue) ||
90 (defined $opt_noepoll) ||
91 (defined $opt_use_gnutls)
93 my $interactive = !$non_interactive;
96 chomp($topdir = getcwd());
97 $this = resolve_directory($topdir); # PWD, Regardless.
98 @modlist = (); # Declare for Module List..
99 %config = (); # Initiate Configuration Hash..
100 $config{ME} = resolve_directory($topdir); # Present Working Directory
102 $config{BASE_DIR} = $config{ME};
104 if (defined $opt_base_dir)
106 $config{BASE_DIR} = $opt_base_dir;
109 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Directory
110 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
111 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
112 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
114 if (defined $opt_config_dir)
116 $config{CONFIG_DIR} = $opt_config_dir;
118 if (defined $opt_module_dir)
120 $config{MODULE_DIR} = $opt_module_dir;
122 if (defined $opt_binary_dir)
124 $config{BINARY_DIR} = $opt_binary_dir;
126 if (defined $opt_library_dir)
128 $config{LIBRARY_DIR} = $opt_library_dir;
130 chomp($config{HAS_GNUTLS} = `libgnutls-config --version 2>/dev/null | cut -c 1,2,3`); # GNUTLS Version.
131 chomp($config{HAS_OPENSSL} = `openssl version 2>/dev/null`); # Openssl version
132 $config{USE_GNUTLS} = "n";
133 if (defined $opt_use_gnutls)
135 $config{USE_GNUTLS} = "y"; # Use gnutls.
137 $config{USE_OPENSSL} = "n"; # Use openssl.
138 if (defined $opt_use_openssl)
140 $config{USE_OPENSSL} = "y";
143 # no, let's not change these.
144 $config{OPTIMITEMP} = "0"; # Default Optimisation Value
145 if (!defined $opt_disable_debug)
147 $config{OPTIMISATI} = "-g"; # Optimisation Flag
151 $config{OPTIMISATI} = ""; # DEBUGGING OFF!
154 $config{NICK_LENGT} = "31"; # Default Nick Length
155 if (defined $opt_nick_length)
157 $config{NICK_LENGT} = $opt_nick_length;
159 $config{CHAN_LENGT} = "64"; # Default Channel Name Length
160 if (defined $opt_chan_length)
162 $config{CHAN_LENGT} = $opt_chan_length;
164 $config{MAX_CHANNE} = "20"; # Default Max. Channels per user
165 if (defined $opt_maxchans)
167 $config{MAX_CHANNE} = $opt_maxchans;
169 $config{MAX_OPERCH} = "60"; # Default Max. Channels per oper
170 if (defined $opt_opermaxchans)
172 $config{MAX_OPERCH} = $opt_opermaxchans;
174 $config{MAXI_MODES} = "20"; # Default Max. Number of Modes set at once.
175 if (defined $opt_modes)
177 $config{MAXI_MODES} = $opt_modes;
179 $config{HAS_STRLCPY} = "false"; # strlcpy Check.
180 $config{HAS_STDINT} = "false"; # stdint.h check
181 $config{USE_KQUEUE} = "y"; # kqueue enabled
182 if (defined $opt_kqueue)
184 $config{USE_KQUEUE} = "y";
186 if (defined $opt_nokqueue)
188 $config{USE_KQUEUE} = "n";
190 $config{USE_EPOLL} = "y"; # epoll enabled
191 if (defined $opt_epoll)
193 $config{USE_EPOLL} = "y";
195 if (defined $opt_noepoll)
197 $config{USE_EPOLL} = "n";
199 $config{IPV6} = "n"; # IPv6 support (experimental)
200 if (defined $opt_ipv6)
204 $config{SUPPORT_IP6LINKS} = "y"; # IPv4 supporting IPv6 links (experimental)
205 if (defined $opt_ipv6links)
207 $config{SUPPORT_IP6LINKS} = "y";
209 if (defined $opt_noipv6links)
211 $config{SUPPORT_IP6LINKS} = "n";
213 $config{STATIC_LINK} = "no"; # are doing static modules?
214 chomp($config{MAX_CLIENT_T} = `sh -c \"ulimit -n\"`); # FD Limit
215 chomp($config{MAX_DESCRIPTORS} = `sh -c \"ulimit -n\"`); # Hard FD Limit
216 chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version
217 $config{_SOMAXCONN} = SOMAXCONN; # Max connections in accept queue
218 $config{OSNAME} = $^O; # Operating System Name
219 $config{CC} = "g++"; # C++ compiler
222 $config{CC} = $opt_cc;
224 $exec = $config{CC} . " -dumpversion | cut -c 1";
225 chomp($config{GCCVER} = `$exec`); # Major GCC Version
226 $config{MAKEORDER} = "ircd mods"; # build order
227 $config{STATICLIBS} = ""; # library archive path
228 $config{MAX_IDENT} = "12"; # max ident size
229 $config{MAX_QUIT} = "255"; # max quit message size
230 $config{MAX_TOPIC} = "307"; # max topic size
231 $config{MAX_KICK} = "255"; # max kick message size
232 $config{MAX_GECOS} = "128"; # max GECOS size
233 $config{MAX_AWAY} = "200"; # max AWAY size
234 if (defined $opt_ident)
236 $config{MAX_IDENT} = $opt_ident;
238 if (defined $opt_quit)
240 $config{MAX_QUIT} = $opt_quit;
242 if (defined $opt_topic)
244 $config{MAX_TOPIC} = $opt_topic;
246 if (defined $opt_kick)
248 $config{MAX_KICK} = $opt_kick;
250 if (defined $opt_gecos)
252 $config{MAX_GECOS} = $opt_gecos;
254 if (defined $opt_away)
256 $config{MAX_AWAY} = $opt_away;
259 $config{HAS_OPENSSL} =~ /OpenSSL ([-[:digit:].]+)([a-z])?(\-[a-z][0-9])? (\w{3}|[0-9]+) (\w{3}|[0-9]+) [0-9]{4}/;
260 $config{HAS_OPENSSL} = $1;
262 if ($config{GCCVER} eq "") {
263 print $config{CC} . " was not found! You require g++ (the GNU C++ compiler, part of GCC) to build InspIRCd!\n";
267 # Minihack! Convert Cygwin to 'Cyg-Static' so i can
268 # Keep my dynamic module experiments here for later
271 if ($config{OSNAME} =~ /CYGWIN/i)
273 $config{OSNAME} = "CYG-STATIC";
276 if (!$config{MAX_CLIENT_T}) {
277 $config{MAX_CLIENT_T} = 1024; # Set a reasonable 'Default'
278 $fd_scan_fail = "true"; # Used Later
281 # Get and Set some important vars..
286 system("rm -rf .config.cache");
292 chomp($topdir = getcwd());
293 $this = resolve_directory($topdir); # PWD, Regardless.
295 # Does the cache file exist?
297 # No, No it doesn't.. *BASH*
298 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
301 # We've Loaded the cache file and all our variables..
302 print "Updating Files..\n";
304 if ($opt_disable_debug == 1)
306 print "Disabling debug information (-g).\n";
307 $config{OPTIMISATI} = "";
310 $has_epoll = $config{HAS_EPOLL};
311 $has_kqueue = $config{HAS_KQUEUE};
320 print "Configure update failed: $@\n";
328 chomp($topdir = getcwd());
329 $this = resolve_directory($topdir); # PWD, Regardless.
331 # Does the cache file exist?
333 # No, No it doesn't.. *BASH*
334 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
337 # We've Loaded the cache file and all our variables..
338 print "Updating Files..\n";
340 $has_epoll = $config{HAS_EPOLL};
341 $has_kqueue = $config{HAS_KQUEUE};
350 print "Module update failed: $@\n";
360 open(FH,"<.svn/entries") or $fail = 1;
362 print "This is not an SVN copy of InspIRCd.\n";
365 system("svn update");
366 system("perl configure -update");
367 if ($ARGV[1] eq "rebuild") {
368 system("make install");
373 print "Running non-interactive configure...\n" unless $interactive;
374 print "Checking for cache from previous configure... ";
375 print ((getcache() eq "true") ? "found\n" : "not found\n");
376 print "Checking operating system version... ";
377 print getosflags() . "\n";
379 if (defined $opt_maxclients)
381 $config{MAX_CLIENT} = $opt_maxclients;
384 if (!$config{MAX_CLIENT}) {
385 # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
386 # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
387 # higher than the found value" :))
388 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
391 printf "Checking if stdint.h exists... ";
392 $config{HAS_STDINT} = "true";
394 open(STDINT, "</usr/include/stdint.h") or $config{HAS_STDINT} = "false";
395 if ($config{HAS_STDINT} eq "true") {
398 print "yes\n" if $config{HAS_STDINT} eq "true";
399 print "no\n" if $config{HAS_STDINT} eq "false";
402 printf "Checking if strlcpy exists... ";
403 # Perform the strlcpy() test..
404 $config{HAS_STRLCPY} = "false";
406 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
408 while (chomp($line = <STRLCPY>)) {
409 # try and find the delcaration of:
410 # size_t strlcpy(...)
411 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
412 $config{HAS_STRLCPY} = "true";
417 print "yes\n" if $config{HAS_STRLCPY} eq "true";
418 print "no\n" if $config{HAS_STRLCPY} eq "false";
421 printf "Checking if kqueue exists... ";
424 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
426 while (chomp($line = <KQUEUE>)) {
427 # try and find the delcaration of:
429 if ($line =~ /int(\0x9|\s)+kqueue/) {
435 print "yes\n" if $has_kqueue == 1;
436 print "no\n" if $has_kqueue == 0;
438 printf "Checking if epoll exists... ";
441 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
447 my $kernel = `uname -r`;
449 if (($kernel =~ /^2\.0\./) || ($kernel =~ /^2\.2\./) || ($kernel =~ /^2\.4\./)) {
453 print "yes\n" if $has_epoll == 1;
454 print "no\n" if $has_epoll == 0;
456 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
457 $config{HAS_STRLCPY} = "true";
460 $config{HAS_EPOLL} = $has_epoll;
461 $config{HAS_KQUEUE} = $has_kqueue;
463 printf "Checking for libgnutls... ";
464 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
466 $config{HAS_GNUTLS} = "y";
469 $config{HAS_GNUTLS} = "n";
472 printf "Checking for openssl... ";
473 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
475 $config{HAS_OPENSSL} = "y";
478 $config{HAS_OPENSSL} = "n";
481 ################################################################################
482 # BEGIN INTERACTIVE PART #
483 ################################################################################
491 my $rev = getrevision();
492 # Display Introduction Message..
494 Welcome to the \033[1mInspIRCd\033[0m Configuration program! (\033[1minteractive mode\033[0m)
495 \033[1mPackage maintainers: Type ./configure --help for non-interactive help\033[0m
497 *** If you are unsure of any of these values, leave it blank for ***
498 *** standard settings that will work, and your server will run ***
499 *** using them. Please consult your IRC network admin if in doubt. ***
501 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
502 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
503 dir, otherwise you won't have a config file!
505 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos)
506 Maximum file descriptors: \033[1;32m$config{MAX_CLIENT_T}\033[0m
507 Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
509 print " (Non-SVN build)";
513 $config{CHANGE_COMPILER} = "n";
514 print "I have detected the following compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
516 while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
517 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
518 should NOT be used. You should probably specify a newer compiler.\n\n";
519 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
520 if ($config{CHANGE_COMPILER} =~ /y/i) {
521 print "What command do you want to use to invoke your compiler?\n";
522 print "[\033[1;32m$config{CC}\033[0m] -> ";
523 chomp($config{CC} = <STDIN>);
524 if ($config{CC} eq "") {
527 chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
529 chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change compilers
530 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
531 if ($config{GCCVER} < 3) {
532 print "\033[1;32mGCC 2.x WILL NOT WORK!\033[0m. Let's try that again, shall we?\n";
536 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
543 # Directory Settings..
544 my $tmpbase = $config{BASE_DIR};
545 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
546 if ($tmpbase ne $config{BASE_DIR}) {
547 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Dir
548 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
549 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
550 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
553 dir_check("are the configuration files", "CONFIG_DIR");
554 dir_check("are the modules to be compiled to", "MODULE_DIR");
555 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
556 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
559 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?");
563 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?");
566 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
567 if (!$chose_hiperf) {
568 print "No high-performance socket engines are available, or you chose\n";
569 print "not to enable one. Defaulting to select() engine.\n\n";
572 yesno(IPV6,"Would you like to build InspIRCd with IPv6 support?");
575 if ($config{IPV6} eq "y") {
576 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";
577 $config{SUPPORT_IP6LINKS} = "y";
579 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.");
583 if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
584 print "I have detected both GnuTLS and OpenSSL on your system.\n";
585 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
586 print "instead, you should enable the OpenSSL module yourself\n";
587 print "by copying it from src/modules/extra to src/modules.\n\n";
590 if ($config{HAS_GNUTLS} eq "y") {
591 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
592 if ($config{USE_GNUTLS} eq "y") {
593 print "\nUsing GnuTLS SSL module.\n";
595 } elsif ($config{HAS_OPENSSL} eq "y") {
596 yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
597 if ($config{USE_OPENSSL} eq "y") {
598 print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
602 print "\nThe following questions will ask you for various figures relating\n";
603 print "To your IRCd install. Please note that these should usually be left\n";
604 print "as defaults unless you have a real reason to change them. If they\n";
605 print "changed, then the values must be identical on all servers on your\n";
606 print "network, or malfunctions and/or crashes may occur, with the exception\n";
607 print "of the 'maximum number of clients' setting which may be different on\n";
608 print "different servers on the network.\n\n";
610 # File Descriptor Settings..
611 promptnumeric("number of clients at any one time", "MAX_CLIENT_T");
612 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
613 $config{MAX_DESCRIPTORS} = $config{MAX_CLIENT_T};
615 promptnumeric("length of nicknames", "NICK_LENGT");
616 promptnumeric("length of channel names", "CHAN_LENGT");
617 promptnumeric("number of channels a normal user may join at any one time", "MAX_CHANNE");
618 promptnumeric("number of channels an oper may join at any one time", "MAX_OPERCH");
619 promptnumeric("number of mode changes in one line", "MAXI_MODES");
620 promptnumeric("length of an ident (username)", "MAX_IDENT");
621 promptnumeric("length of a quit message", "MAX_QUIT");
622 promptnumeric("length of a channel topic", "MAX_TOPIC");
623 promptnumeric("length of a kick message", "MAX_KICK");
624 promptnumeric("length of a GECOS (real name)", "MAX_GECOS");
625 promptnumeric("length of an away message", "MAX_AWAY");
630 if (($config{USE_GNUTLS} eq "y") && ($config{HAS_GNUTLS} ne "y"))
632 print "Sorry, but i couldn't detect gnutls. Make sure gnutls-config is in your path.\n";
635 if (($config{USE_OPENSSL} eq "y") && ($config{HAS_OPENSSL} ne "y"))
637 print "Sorry, but i couldn't detect openssl. Make sure openssl is in your path.\n";
641 if ($config{USE_GNUTLS} eq "y") {
643 open(TMP, "<src/modules/m_ssl_gnutls.cpp") or $failed = 1;
646 print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
647 chdir("src/modules");
648 system("ln -s extra/m_ssl_gnutls.cpp");
649 system("ln -s extra/ssl_cert.h");
656 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
658 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
661 print "SSL Certificates Not found, Generating.. \n\n
662 *************************************************************
663 * Generating the Private Key may take some time, go grab a *
664 * Coffee. Even better, to generate some more entropy if it *
665 * is taking a while, open another console and type du / a *
666 * few times and get that HD going :) Then answer the *
667 * Questions which follow. If you are unsure, just hit enter *
668 *************************************************************\n\n";
669 system("certtool --generate-privkey --outfile key.pem");
670 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
671 print "\nCertificate generation complete, copying to config directory... ";
672 system("mv key.pem $config{CONFIG_DIR}/key.pem");
673 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
676 print "SSL Certificates found, skipping.\n\n"
681 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
683 } elsif ($config{USE_OPENSSL} eq "y") {
685 open(TMP, "<src/modules/m_ssl_openssl.cpp") or $failed = 1;
688 print "Symlinking src/modules/m_ssl_openssl.cpp from extra/\n";
689 chdir("src/modules");
690 system("ln -s extra/m_ssl_openssl.cpp");
691 system("ln -s extra/ssl_cert.h");
698 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
700 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
703 print "SSL Certificates Not found, Generating.. \n\n
704 *************************************************************
705 * Generating the certificates may take some time, go grab a *
706 * coffee, or something. *
707 *************************************************************\n\n";
708 system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
709 system("openssl dhparam -out dhparams.pem 1024");
710 print "\nCertificate generation complete, copying to config directory... ";
711 system("mv key.pem $config{CONFIG_DIR}/key.pem");
712 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
713 system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
716 print "SSL Certificates found, skipping.\n\n"
721 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
724 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
725 print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
733 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
734 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
735 print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
736 print "load the required modules in your config. This configure process\n";
737 print "has just prepared these modules to be compiled for you, and has not\n";
738 print "configured them to be compiled into the core of the ircd.\n";
740 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
741 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
742 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";
745 if ($config{GCCVER} < "3") {
747 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
748 GCC 2.x series compilers only had partial (read as broken) C++ support, and
749 your compile will most likely fail horribly! If you have any problems, do NOT
750 report them to the bugtracker or forums without first upgrading your compiler
751 to a newer 3.x or 4.x (or whatever is available currently) version.
755 ################################################################################
757 ################################################################################
759 # Retrieves the .config.cache file, and loads values into the main config hash.
760 open(CACHE, ".config.cache") or return undef;
763 # Ignore Blank lines, and comments..
766 my ($key, $value) = split("=", $_, 2);
767 $value =~ /^\"(.*)\"$/;
768 # Do something with data here!
776 # Dump the contents of %config
777 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
778 open(FILEHANDLE, ">.config.cache");
779 foreach $key (keys %config) {
780 print FILEHANDLE "$key=\"$config{$key}\"\n";
786 my ($desc, $hash_key) = @_;
789 print "In what directory $desc?\n";
790 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
791 chomp($var = <STDIN>);
793 $var = $config{$hash_key};
795 if ($var =~ /^\~\/(.+)$/) {
796 # Convert it to a full path..
797 $var = resolve_directory($ENV{HOME} . "/" . $1);
799 elsif ((($config{OSNAME} =~ /MINGW32/i) and ($var !~ /^[A-Z]{1}:\\.*/)) and (substr($var,0,1) ne "/"))
801 # Assume relative Path was given.. fill in the rest.
802 $var = $this . "/$var";
805 $var = resolve_directory($var);
807 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
808 chomp($tmp = <STDIN>);
809 if (($tmp eq "") || ($tmp =~ /^y/i)) {
810 # Attempt to Create the Dir..
812 system("mkdir -p \"$var\" >> /dev/null 2>&1");
813 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
815 print "Unable to create directory. ($var)\n\n";
820 # They said they don't want to create, and we can't install there.
826 # Target exists, but is not a directory.
827 print "File $var exists, but is not a directory.\n\n";
831 # Either Dir Exists, or was created fine.
832 $config{$hash_key} = $var;
840 $config{LDLIBS} = "-lstdc++";
841 $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
842 $config{MAKEPROG} = "make";
844 if ($config{OSNAME} =~ /OpenBSD/i) {
845 $config{MAKEPROG} = "gmake";
846 chomp($foo = `eg++ -dumpversion | cut -c 1`);
847 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
848 # if theyre not running this, configure lets the build continue but they probably wont manage to
849 # compile as this standard version is 2.95.3!
851 $config{CC} = "eg++";
852 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
857 if ($config{OSNAME} =~ /Linux/i) {
858 $config{LDLIBS} = "-ldl -lstdc++";
859 $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
860 $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
861 $config{MAKEPROG} = "make";
862 if ($config{OSNAME} =~ /CYGWIN/) {
863 $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
864 $config{LDLIBS} = "";
865 $config{MAKEPROG} = "/usr/bin/make";
866 $config{MAKEORDER} = "ircd mods";
868 } elsif ($config{OSNAME} eq "CYG-STATIC") {
869 $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
870 $config{LDLIBS} = "";
871 $config{MAKEPROG} = "/usr/bin/make";
872 $config{MAKEORDER} = "mods ircd";
873 $config{STATICLIBS} = "modules/mods.a";
874 $config{STATIC_LINK} = "yes";
875 return "Cygwin-Static";
877 $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
880 if ($config{OSNAME} =~ /SunOS/i)
882 # solaris/sunos needs these
883 # socket = bsd sockets api
885 # rt = POSIX realtime extensions
886 # resolv = inet_aton only (why isnt this in nsl?!)
887 $config{MAKEPROG} = "gmake";
888 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
892 if($config{OSNAME} =~ /MINGW32/i)
894 # All code is position-independent on windows
895 $config{FLAGS} =~ s/-fPIC //;
899 return $config{OSNAME};
903 my($writeheader) = @_;
904 # First File.. inspircd_config.h
905 chomp(my $incos = `uname -n -s -r`);
906 chomp(my $version = `sh ./src/version.sh`);
907 chomp(my $revision = getrevision());
908 $version = "$version(r$revision)";
909 chomp(my $revision2 = getrevision());
910 if ($writeheader == 1)
912 print "Writing \033[1;32minspircd_config.h\033[0m\n";
913 open(FILEHANDLE, ">include/inspircd_config.h");
914 my $NL = $config{NICK_LENGT}+1;
915 my $CL = $config{CHAN_LENGT}+1;
916 print FILEHANDLE <<EOF;
917 /* Auto generated by configure, do not modify! */
918 #ifndef __CONFIGURATION_AUTO__
919 #define __CONFIGURATION_AUTO__
921 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
922 #define MOD_PATH "$config{MODULE_DIR}"
923 #define VERSION "$version"
924 #define REVISION "$revision2"
925 #define MAXCLIENTS $config{MAX_CLIENT}
926 #define MAXCLIENTS_S "$config{MAX_CLIENT}"
927 #define SOMAXCONN_S "$config{_SOMAXCONN}"
928 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
931 #define MAXCHANS $config{MAX_CHANNE}
932 #define OPERMAXCHANS $config{MAX_OPERCH}
933 #define MAXMODES $config{MAXI_MODES}
934 #define IDENTMAX $config{MAX_IDENT}
935 #define MAXQUIT $config{MAX_QUIT}
936 #define MAXTOPIC $config{MAX_TOPIC}
937 #define MAXKICK $config{MAX_KICK}
938 #define MAXGECOS $config{MAX_GECOS}
939 #define MAXAWAY $config{MAX_AWAY}
940 #define OPTIMISATION $config{OPTIMITEMP}
941 #define LIBRARYDIR "$config{LIBRARY_DIR}"
942 #define SYSTEM "$incos"
945 if ($config{OSNAME} =~ /SunOS/i) {
946 print FILEHANDLE "#define IS_SOLARIS\n";
948 if ($config{OSNAME} =~ /CYGWIN/i) {
949 print FILEHANDLE "#define IS_CYGWIN\n";
950 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
952 if ($config{OSNAME} =~ /MINGW32/i) {
953 print FILEHANDLE "#define IS_MINGW\n";
955 if ($config{OSNAME} =~ /CYG-STATIC/i) {
956 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
958 if ($config{STATIC_LINK} eq "yes") {
959 print FILEHANDLE "#define STATIC_LINK\n";
961 if ($config{GCCVER} >= 3) {
962 print FILEHANDLE "#define GCC3\n";
964 if ($config{HAS_STRLCPY} eq "true") {
965 print FILEHANDLE "#define HAS_STRLCPY\n";
967 if ($config{HAS_STDINT} eq "true") {
968 print FILEHANDLE "#define HAS_STDINT\n";
970 if ($config{IPV6} =~ /y/i) {
971 print FILEHANDLE "#define IPV6\n";
973 if ($config{SUPPORT_IP6LINKS} =~ /y/i) {
974 print FILEHANDLE "#define SUPPORT_IP6LINKS\n";
977 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
978 print FILEHANDLE "#define USE_KQUEUE\n";
979 $se = "socketengine_kqueue";
982 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
983 print FILEHANDLE "#define USE_EPOLL\n";
984 $se = "socketengine_epoll";
987 # user didn't choose either epoll or select for their OS.
988 # default them to USE_SELECT (ewwy puke puke)
990 print FILEHANDLE "#define USE_SELECT\n";
991 $se = "socketengine_select";
993 print FILEHANDLE "\n#endif\n";
999 open(FILEHANDLE, ">include/inspircd_se_config.h");
1000 print FILEHANDLE <<EOF;
1001 /* Auto generated by configure, do not modify or commit to svn! */
1002 #ifndef __CONFIGURATION_SOCKETENGINE__
1003 #define __CONFIGURATION_SOCKETENGINE__
1013 # Create a Modules List..
1015 foreach $i (@modlist)
1017 if ($config{STATIC_LINK} eq "yes") {
1018 $modules .= "m_".$i.".o ";
1021 $modules .= "m_".$i.".so ";
1024 chomp($modules); # Remove Redundant whitespace..
1026 opendir(DIRHANDLE, "src/modules");
1027 foreach $name (sort readdir(DIRHANDLE)) {
1028 if ($name =~ /^m_(.+?)$/) {
1029 if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1030 closedir(MDIRHANDLE);
1031 $modules .= "$name.so ";
1035 closedir(DIRHANDLE);
1038 # Write all .in files.
1041 my $exe = "inspircd";
1043 if ($config{OSNAME} =~ /CYGWIN/i) {
1044 $exe = "inspircd.exe";
1047 opendir(DIRHANDLE, $this);
1049 # Do this once here, and cache it in the .*.inc files,
1050 # rather than attempting to read src/version.sh from
1051 # compiled code -- we might not have the source to hand.
1052 # Fix for bug#177 by Brain.
1054 chomp(my $version = `sh ./src/version.sh`);
1055 chomp(my $revision = getrevision());
1056 $version = "$version(r$revision)";
1058 # We can actually parse any file starting with . and ending with .inc,
1059 # but right now we only parse .inspircd.inc to form './inspircd'
1061 foreach $name (sort readdir(DIRHANDLE)) {
1062 if ($name =~ /^\.(.+)\.inc$/) {
1064 # All .name.inc files need parsing!
1066 open(FILEHANDLE, ".$file.inc");
1067 while (<FILEHANDLE>) {
1072 $tmp =~ s/\@CC\@/$config{CC}/;
1073 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1074 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1075 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1076 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1077 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1078 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1079 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1080 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1081 $tmp =~ s/\@MODULES\@/$modules/;
1082 $tmp =~ s/\@EXECUTABLE\@/$exe/;
1083 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1084 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1085 $tmp =~ s/\@VERSION\@/$version/;
1087 print "Writing \033[1;32m$file\033[0m\n";
1088 open(FILEHANDLE, ">$file");
1089 print FILEHANDLE $tmp;
1092 closedir(DIRHANDLE);
1094 # Make inspircd executable!
1095 chmod 0744, 'inspircd';
1097 if ($config{STATIC_LINK} eq "yes") {
1098 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1099 write_static_makefile();
1100 write_static_modules_makefile();
1101 } elsif ($config{OSNAME} =~ /CYGWIN/i) {
1102 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1103 write_static_makefile();
1104 write_dynamic_modules_makefile();
1106 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1107 write_dynamic_makefile();
1108 write_dynamic_modules_makefile();
1112 sub write_static_modules_makefile {
1113 # Modules Makefile..
1114 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1115 open(FILEHANDLE, ">src/modules/Makefile");
1118 # Module Makefile Header
1120 print FILEHANDLE <<EOF;
1121 # (C) ChatSpike development team
1122 # Makefile by <Craig\@ChatSpike.net>
1123 # Many Thanks to Andrew Church <achurch\@achurch.org>
1124 # for assisting with making this work right.
1126 # Automatically Generated by ./configure to add a modules
1127 # please run ./configure --update
1133 # End Module Makefile Header
1136 # Create a Modules List..
1141 open(MODLIST,">include/modlist.h");
1144 # Include File Header
1146 print MODLIST <<HEADER;
1147 // Generated automatically by configure. DO NOT EDIT!
1149 #ifndef __SYMBOLS__H_CONFIGURED__
1150 #define __SYMBOLS__H_CONFIGURED__
1154 # End Include File Header
1157 # Place Module List into Include
1158 foreach $i (@modlist) {
1159 if ($i !~ /_static$/) {
1160 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1163 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1168 foreach $i (@modlist)
1170 if ($i !~ /_static$/) {
1171 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1172 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1173 $deps = getdependencies("src/modules/m_".$i.".cpp");
1175 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1178 # Write Entry to the Makefile
1180 print FILEHANDLE <<EOCHEESE;
1181 m_$i.o: .m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h $deps
1182 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c .m_$i\_static.cpp
1183 mv .m_$i\_static.o ../m_$i.o
1187 # End Write Entry to the MakeFile
1189 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1190 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1191 open(MUNGED,">src/modules/.m_".$i."_static.cpp") or die("Could not create .m_".$i."_static.cpp");
1192 while (chomp($a = <MODULE>)) {
1193 $a =~ s/init_module/$i\_init/g;
1194 print MUNGED "$a\n";
1198 print MODLIST <<EOENT;
1199 {"m_$i.so",\&$i\_init},
1205 print MODLIST "{0}};\n\n#endif\n";
1209 sub write_dynamic_modules_makefile {
1210 # Modules Makefile..
1211 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1212 open(FILEHANDLE, ">src/modules/Makefile");
1215 if ($config{OSNAME} =~ /CYGWIN/i) {
1216 $extra = "../inspircd.dll.a";
1220 # Module Makefile Header
1222 print FILEHANDLE <<EOF;
1223 # (C) ChatSpike development team
1224 # Makefile by <Craig\@ChatSpike.net>
1225 # Many Thanks to Andrew Church <achurch\@achurch.org>
1226 # for assisting with making this work right.
1228 # Automatically Generated by ./configure to add a modules
1229 # please run ./configure -update or ./configure -modupdate
1235 # End Module Makefile Header
1238 # Create a Modules List..
1244 foreach $i (@modlist) {
1246 # Write Entry to the MakeFile
1248 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1249 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1250 $deps = getdependencies("src/modules/m_".$i.".cpp");
1252 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1254 print FILEHANDLE <<EOCHEESE;
1255 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
1256 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1257 \$(CC) -pipe \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1260 $crud = $crud . " install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
1262 # End Write Entry to the MakeFile
1266 opendir(DIRHANDLE, "src/modules");
1267 foreach $name (sort readdir(DIRHANDLE)) {
1268 if ($name =~ /^m_(.+?)$/) {
1271 # A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
1272 if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1273 print "Composing Makefile rules for directory \033[1;32m$name\033[0m... ";
1275 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";
1276 foreach $fname (sort readdir(MDIRHANDLE)) {
1277 if ($fname =~ /\.cpp$/) {
1278 $cmflags = getcompilerflags("src/modules/$name/$fname");
1279 $liflags = getlinkerflags("src/modules/$name/$fname");
1280 $deps = getdependencies("src/modules/$name/$fname");
1282 $oname =~ s/\.cpp$/.o/g;
1283 print FILEHANDLE " $name/$oname";
1284 $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";
1285 $crapola = $crapola . " \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $name/$oname -c $name/$fname\n\n";
1286 $crap3 = $crap3 . " $name/$oname";
1290 print "(\033[1;32m$i files found\033[0m)\n";
1291 print FILEHANDLE "\n \$(CC) -pipe \$(FLAGS) -shared $liflags -o $name.so $crap3\n";
1292 print FILEHANDLE "\n$crapola\n";
1293 closedir(MDIRHANDLE);
1294 $crud = $crud . " install -m \$(INSTMODE) $name.so \$(MODPATH)\n";
1298 closedir(DIRHANDLE);
1300 print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
1304 sub write_static_makefile {
1305 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1308 opendir(DIRHANDLE, "src");
1309 foreach $name (sort readdir(DIRHANDLE)) {
1310 if ($name =~ /^cmd_(.+)\.cpp$/) {
1311 $cmdlist[$i++] = $1;
1314 closedir(DIRHANDLE);
1317 foreach my $cmd (@cmdlist) {
1318 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1319 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1324 # (C) ChatSpike development team
1325 # Makefile by <Craig\@ChatSpike.net>
1326 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1329 CC = im a cheezeball
1331 CXXFLAGS = -I../include \${FLAGS}
1332 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1333 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1337 $se = "socketengine_select";
1338 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1339 $se = "socketengine_kqueue";
1341 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1342 $se = "socketengine_epoll";
1346 # This next section is for cygwin dynamic module builds.
1347 # Basically, what we do, is build the inspircd core as a library
1348 # then the main executable uses that. the library is capable of
1349 # loading / unloading the modules dynamically :)
1350 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1354 if ($config{OSNAME} =~ /CYGWIN/i) {
1356 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
1358 inspircd.exe: inspircd.dll.a
1361 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
1362 \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1366 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
1368 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
1369 \$(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)
1375 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
1376 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1378 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
1379 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1381 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
1382 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1384 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1385 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1387 socketengine.o: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1388 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1390 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1391 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1393 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1394 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1396 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1397 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1399 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
1400 \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS)
1401 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1403 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
1404 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1406 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
1407 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1409 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
1410 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1412 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1413 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1415 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
1416 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1418 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
1419 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1421 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
1422 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1424 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
1425 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1427 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
1428 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1430 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
1431 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1433 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1434 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1436 inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1437 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1439 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1440 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1443 foreach my $cmd (@cmdlist) {
1445 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
1446 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1452 sub write_dynamic_makefile {
1456 opendir(DIRHANDLE, "src");
1457 foreach $name (sort readdir(DIRHANDLE)) {
1458 if ($name =~ /^cmd_(.+)\.cpp$/) {
1459 $cmdlist[$i++] = $1;
1462 closedir(DIRHANDLE);
1466 foreach my $cmd (@cmdlist) {
1467 $cmdobjs = $cmdobjs . "cmd_$cmd.so ";
1468 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1471 $se = "socketengine_select";
1472 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1473 $se = "socketengine_kqueue";
1475 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1476 $se = "socketengine_epoll";
1479 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1483 # (C) ChatSpike development team
1484 # Makefile by <Craig\@ChatSpike.net>
1485 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1488 CC = im a cheezeball
1490 CXXFLAGS = -I../include \${FLAGS}
1491 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1492 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1494 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
1496 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
1497 \$(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
1499 libIRCDsocketengine.so: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1500 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1501 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o $se.o
1503 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
1504 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1505 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsnomasks.so snomasks.o
1507 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
1508 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1509 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1511 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
1512 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1513 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1515 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1516 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1517 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1519 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1520 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1521 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1523 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1524 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1525 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1527 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1528 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1529 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1531 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)
1532 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1533 \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1534 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o modes/modeclasses.a
1536 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
1537 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1538 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1540 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
1541 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1542 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1544 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
1545 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1546 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1548 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1549 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1550 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1552 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
1553 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1554 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDconfigreader.so configreader.o
1556 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
1557 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1558 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o
1560 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
1561 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1562 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1564 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
1565 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1566 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1568 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
1569 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1570 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1572 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
1573 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1574 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1576 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1577 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1578 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1580 libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1581 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1582 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDinspsocket.so inspsocket.o
1584 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1585 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1586 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1589 foreach my $cmd (@cmdlist) {
1591 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
1592 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1593 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o cmd_$cmd.so cmd_$cmd.o