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} = "-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{DEVELOPER} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual -g";
848 $config{MAKEPROG} = "make";
850 if ($config{OSNAME} =~ /OpenBSD/i) {
851 $config{MAKEPROG} = "gmake";
852 chomp($foo = `eg++ -dumpversion | cut -c 1`);
853 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
854 # if theyre not running this, configure lets the build continue but they probably wont manage to
855 # compile as this standard version is 2.95.3!
857 $config{CC} = "eg++";
858 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
863 if ($config{OSNAME} =~ /Linux/i) {
864 $config{LDLIBS} = "-ldl -lstdc++";
865 $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
866 $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
867 $config{MAKEPROG} = "make";
868 if ($config{OSNAME} =~ /CYGWIN/) {
869 $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
870 $config{LDLIBS} = "";
871 $config{MAKEPROG} = "/usr/bin/make";
872 $config{MAKEORDER} = "ircd mods";
874 } elsif ($config{OSNAME} eq "CYG-STATIC") {
875 $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
876 $config{LDLIBS} = "";
877 $config{MAKEPROG} = "/usr/bin/make";
878 $config{MAKEORDER} = "mods ircd";
879 $config{STATICLIBS} = "modules/mods.a";
880 $config{STATIC_LINK} = "yes";
881 return "Cygwin-Static";
883 $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
886 if ($config{OSNAME} =~ /SunOS/i)
888 # solaris/sunos needs these
889 # socket = bsd sockets api
891 # rt = POSIX realtime extensions
892 # resolv = inet_aton only (why isnt this in nsl?!)
893 $config{MAKEPROG} = "gmake";
894 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
898 if($config{OSNAME} =~ /MINGW32/i)
900 # All code is position-independent on windows
901 $config{FLAGS} =~ s/-fPIC //;
905 return $config{OSNAME};
909 my($writeheader) = @_;
910 # First File.. inspircd_config.h
911 chomp(my $incos = `uname -n -s -r`);
912 chomp(my $version = `sh ./src/version.sh`);
913 chomp(my $revision = getrevision());
914 $version = "$version(r$revision)";
915 chomp(my $revision2 = getrevision());
916 if ($writeheader == 1)
918 print "Writing \033[1;32minspircd_config.h\033[0m\n";
919 open(FILEHANDLE, ">include/inspircd_config.h");
920 my $NL = $config{NICK_LENGT}+1;
921 my $CL = $config{CHAN_LENGT}+1;
922 print FILEHANDLE <<EOF;
923 /* Auto generated by configure, do not modify! */
924 #ifndef __CONFIGURATION_AUTO__
925 #define __CONFIGURATION_AUTO__
927 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
928 #define MOD_PATH "$config{MODULE_DIR}"
929 #define VERSION "$version"
930 #define REVISION "$revision2"
931 #define MAXCLIENTS $config{MAX_CLIENT}
932 #define MAXCLIENTS_S "$config{MAX_CLIENT}"
933 #define SOMAXCONN_S "$config{_SOMAXCONN}"
934 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
937 #define MAXCHANS $config{MAX_CHANNE}
938 #define OPERMAXCHANS $config{MAX_OPERCH}
939 #define MAXMODES $config{MAXI_MODES}
940 #define IDENTMAX $config{MAX_IDENT}
941 #define MAXQUIT $config{MAX_QUIT}
942 #define MAXTOPIC $config{MAX_TOPIC}
943 #define MAXKICK $config{MAX_KICK}
944 #define MAXGECOS $config{MAX_GECOS}
945 #define MAXAWAY $config{MAX_AWAY}
946 #define OPTIMISATION $config{OPTIMITEMP}
947 #define LIBRARYDIR "$config{LIBRARY_DIR}"
948 #define SYSTEM "$incos"
951 if ($config{OSNAME} =~ /SunOS/i) {
952 print FILEHANDLE "#define IS_SOLARIS\n";
954 if ($config{OSNAME} =~ /CYGWIN/i) {
955 print FILEHANDLE "#define IS_CYGWIN\n";
956 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
958 if ($config{OSNAME} =~ /MINGW32/i) {
959 print FILEHANDLE "#define IS_MINGW\n";
961 if ($config{OSNAME} =~ /CYG-STATIC/i) {
962 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
964 if ($config{STATIC_LINK} eq "yes") {
965 print FILEHANDLE "#define STATIC_LINK\n";
967 if ($config{GCCVER} >= 3) {
968 print FILEHANDLE "#define GCC3\n";
970 if ($config{HAS_STRLCPY} eq "true") {
971 print FILEHANDLE "#define HAS_STRLCPY\n";
973 if ($config{HAS_STDINT} eq "true") {
974 print FILEHANDLE "#define HAS_STDINT\n";
976 if ($config{IPV6} =~ /y/i) {
977 print FILEHANDLE "#define IPV6\n";
979 if ($config{SUPPORT_IP6LINKS} =~ /y/i) {
980 print FILEHANDLE "#define SUPPORT_IP6LINKS\n";
983 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
984 print FILEHANDLE "#define USE_KQUEUE\n";
985 $se = "socketengine_kqueue";
988 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
989 print FILEHANDLE "#define USE_EPOLL\n";
990 $se = "socketengine_epoll";
993 # user didn't choose either epoll or select for their OS.
994 # default them to USE_SELECT (ewwy puke puke)
996 print FILEHANDLE "#define USE_SELECT\n";
997 $se = "socketengine_select";
999 print FILEHANDLE "\n#endif\n";
1005 open(FILEHANDLE, ">include/inspircd_se_config.h");
1006 print FILEHANDLE <<EOF;
1007 /* Auto generated by configure, do not modify or commit to svn! */
1008 #ifndef __CONFIGURATION_SOCKETENGINE__
1009 #define __CONFIGURATION_SOCKETENGINE__
1019 # Create a Modules List..
1021 foreach $i (@modlist)
1023 if ($config{STATIC_LINK} eq "yes") {
1024 $modules .= "m_".$i.".o ";
1027 $modules .= "m_".$i.".so ";
1030 chomp($modules); # Remove Redundant whitespace..
1032 opendir(DIRHANDLE, "src/modules");
1033 foreach $name (sort readdir(DIRHANDLE)) {
1034 if ($name =~ /^m_(.+?)$/) {
1035 if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1036 closedir(MDIRHANDLE);
1037 $modules .= "$name.so ";
1041 closedir(DIRHANDLE);
1044 # Write all .in files.
1047 my $exe = "inspircd";
1049 if ($config{OSNAME} =~ /CYGWIN/i) {
1050 $exe = "inspircd.exe";
1053 opendir(DIRHANDLE, $this);
1055 # Do this once here, and cache it in the .*.inc files,
1056 # rather than attempting to read src/version.sh from
1057 # compiled code -- we might not have the source to hand.
1058 # Fix for bug#177 by Brain.
1060 chomp(my $version = `sh ./src/version.sh`);
1061 chomp(my $revision = getrevision());
1062 $version = "$version(r$revision)";
1064 # We can actually parse any file starting with . and ending with .inc,
1065 # but right now we only parse .inspircd.inc to form './inspircd'
1067 foreach $name (sort readdir(DIRHANDLE)) {
1068 if ($name =~ /^\.(.+)\.inc$/) {
1070 # All .name.inc files need parsing!
1072 open(FILEHANDLE, ".$file.inc");
1073 while (<FILEHANDLE>) {
1078 $tmp =~ s/\@CC\@/$config{CC}/;
1079 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1080 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1081 $tmp =~ s/\@DEVELOPER\@/$config{DEVELOPER}/;
1082 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1083 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1084 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1085 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1086 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1087 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1088 $tmp =~ s/\@MODULES\@/$modules/;
1089 $tmp =~ s/\@EXECUTABLE\@/$exe/;
1090 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1091 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1092 $tmp =~ s/\@VERSION\@/$version/;
1094 print "Writing \033[1;32m$file\033[0m\n";
1095 open(FILEHANDLE, ">$file");
1096 print FILEHANDLE $tmp;
1099 closedir(DIRHANDLE);
1101 # Make inspircd executable!
1102 chmod 0744, 'inspircd';
1104 if ($config{STATIC_LINK} eq "yes") {
1105 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1106 write_static_makefile();
1107 write_static_modules_makefile();
1108 } elsif ($config{OSNAME} =~ /CYGWIN/i) {
1109 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1110 write_static_makefile();
1111 write_dynamic_modules_makefile();
1113 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1114 write_dynamic_makefile();
1115 write_dynamic_modules_makefile();
1119 sub write_static_modules_makefile {
1120 # Modules Makefile..
1121 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1122 open(FILEHANDLE, ">src/modules/Makefile");
1125 # Module Makefile Header
1127 print FILEHANDLE <<EOF;
1128 # (C) ChatSpike development team
1129 # Makefile by <Craig\@ChatSpike.net>
1130 # Many Thanks to Andrew Church <achurch\@achurch.org>
1131 # for assisting with making this work right.
1133 # Automatically Generated by ./configure to add a modules
1134 # please run ./configure --update
1140 # End Module Makefile Header
1143 # Create a Modules List..
1148 open(MODLIST,">include/modlist.h");
1151 # Include File Header
1153 print MODLIST <<HEADER;
1154 // Generated automatically by configure. DO NOT EDIT!
1156 #ifndef __SYMBOLS__H_CONFIGURED__
1157 #define __SYMBOLS__H_CONFIGURED__
1161 # End Include File Header
1164 # Place Module List into Include
1165 foreach $i (@modlist) {
1166 if ($i !~ /_static$/) {
1167 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1170 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1175 foreach $i (@modlist)
1177 if ($i !~ /_static$/) {
1178 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1179 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1180 $deps = getdependencies("src/modules/m_".$i.".cpp");
1182 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1185 # Write Entry to the Makefile
1187 print FILEHANDLE <<EOCHEESE;
1188 m_$i.o: .m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h $deps
1189 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c .m_$i\_static.cpp
1190 mv .m_$i\_static.o ../m_$i.o
1194 # End Write Entry to the MakeFile
1196 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1197 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1198 open(MUNGED,">src/modules/.m_".$i."_static.cpp") or die("Could not create .m_".$i."_static.cpp");
1199 while (chomp($a = <MODULE>)) {
1200 $a =~ s/init_module/$i\_init/g;
1201 print MUNGED "$a\n";
1205 print MODLIST <<EOENT;
1206 {"m_$i.so",\&$i\_init},
1212 print MODLIST "{0}};\n\n#endif\n";
1216 sub write_dynamic_modules_makefile {
1217 # Modules Makefile..
1218 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1219 open(FILEHANDLE, ">src/modules/Makefile");
1222 if ($config{OSNAME} =~ /CYGWIN/i) {
1223 $extra = "../inspircd.dll.a";
1227 # Module Makefile Header
1229 print FILEHANDLE <<EOF;
1230 # (C) ChatSpike development team
1231 # Makefile by <Craig\@ChatSpike.net>
1232 # Many Thanks to Andrew Church <achurch\@achurch.org>
1233 # for assisting with making this work right.
1235 # Automatically Generated by ./configure to add a modules
1236 # please run ./configure -update or ./configure -modupdate
1242 # End Module Makefile Header
1245 # Create a Modules List..
1251 foreach $i (@modlist) {
1253 # Write Entry to the MakeFile
1255 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1256 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1257 $deps = getdependencies("src/modules/m_".$i.".cpp");
1259 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1261 print FILEHANDLE <<EOCHEESE;
1262 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
1263 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1264 \$(CC) -pipe \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1267 $crud = $crud . " install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
1269 # End Write Entry to the MakeFile
1273 opendir(DIRHANDLE, "src/modules");
1274 foreach $name (sort readdir(DIRHANDLE)) {
1275 if ($name =~ /^m_(.+?)$/) {
1278 # A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
1279 if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
1280 print "Composing Makefile rules for directory \033[1;32m$name\033[0m... ";
1282 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";
1283 foreach $fname (sort readdir(MDIRHANDLE)) {
1284 if ($fname =~ /\.cpp$/) {
1285 $cmflags = getcompilerflags("src/modules/$name/$fname");
1286 $liflags = getlinkerflags("src/modules/$name/$fname");
1287 $deps = getdependencies("src/modules/$name/$fname");
1289 $oname =~ s/\.cpp$/.o/g;
1290 print FILEHANDLE " $name/$oname";
1291 $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";
1292 $crapola = $crapola . " \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $name/$oname -c $name/$fname\n\n";
1293 $crap3 = $crap3 . " $name/$oname";
1297 print "(\033[1;32m$i files found\033[0m)\n";
1298 print FILEHANDLE "\n \$(CC) -pipe \$(FLAGS) -shared $liflags -o $name.so $crap3\n";
1299 print FILEHANDLE "\n$crapola\n";
1300 closedir(MDIRHANDLE);
1301 $crud = $crud . " install -m \$(INSTMODE) $name.so \$(MODPATH)\n";
1305 closedir(DIRHANDLE);
1307 print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
1311 sub write_static_makefile {
1312 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1315 opendir(DIRHANDLE, "src");
1316 foreach $name (sort readdir(DIRHANDLE)) {
1317 if ($name =~ /^cmd_(.+)\.cpp$/) {
1318 $cmdlist[$i++] = $1;
1321 closedir(DIRHANDLE);
1324 foreach my $cmd (@cmdlist) {
1325 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1326 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1331 # (C) ChatSpike development team
1332 # Makefile by <Craig\@ChatSpike.net>
1333 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1336 CC = im a cheezeball
1338 CXXFLAGS = -I../include \${FLAGS}
1339 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1340 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1344 $se = "socketengine_select";
1345 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1346 $se = "socketengine_kqueue";
1348 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1349 $se = "socketengine_epoll";
1353 # This next section is for cygwin dynamic module builds.
1354 # Basically, what we do, is build the inspircd core as a library
1355 # then the main executable uses that. the library is capable of
1356 # loading / unloading the modules dynamically :)
1357 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1361 if ($config{OSNAME} =~ /CYGWIN/i) {
1363 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
1365 inspircd.exe: inspircd.dll.a
1368 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
1369 \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1373 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
1375 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
1376 \$(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)
1382 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
1383 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1385 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
1386 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1388 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
1389 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1391 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1392 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1394 socketengine.o: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1395 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1397 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1398 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1400 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1401 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1403 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1404 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1406 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
1407 \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS)
1408 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1410 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
1411 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1413 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
1414 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1416 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
1417 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1419 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1420 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1422 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
1423 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1425 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
1426 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1428 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
1429 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1431 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
1432 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1434 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
1435 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1437 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
1438 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1440 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1441 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1443 inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1444 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1446 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1447 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1450 foreach my $cmd (@cmdlist) {
1452 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
1453 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1459 sub write_dynamic_makefile {
1463 opendir(DIRHANDLE, "src");
1464 foreach $name (sort readdir(DIRHANDLE)) {
1465 if ($name =~ /^cmd_(.+)\.cpp$/) {
1466 $cmdlist[$i++] = $1;
1469 closedir(DIRHANDLE);
1473 foreach my $cmd (@cmdlist) {
1474 $cmdobjs = $cmdobjs . "cmd_$cmd.so ";
1475 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1478 $se = "socketengine_select";
1479 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1480 $se = "socketengine_kqueue";
1482 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1483 $se = "socketengine_epoll";
1486 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1490 # (C) ChatSpike development team
1491 # Makefile by <Craig\@ChatSpike.net>
1492 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1495 CC = im a cheezeball
1497 CXXFLAGS = -I../include \${FLAGS}
1498 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1499 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1501 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
1503 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
1504 \$(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
1506 libIRCDsocketengine.so: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1507 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1508 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o $se.o
1510 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
1511 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1512 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsnomasks.so snomasks.o
1514 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
1515 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1516 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1518 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
1519 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1520 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1522 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1523 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1524 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1526 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1527 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1528 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1530 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1531 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1532 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1534 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1535 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1536 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1538 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)
1539 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1540 \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1541 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o modes/modeclasses.a
1543 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
1544 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1545 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1547 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
1548 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1549 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1551 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
1552 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1553 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1555 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1556 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1557 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1559 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
1560 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1561 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDconfigreader.so configreader.o
1563 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
1564 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1565 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o
1567 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
1568 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1569 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1571 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
1572 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1573 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1575 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
1576 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1577 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1579 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
1580 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1581 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1583 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1584 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1585 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1587 libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1588 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1589 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDinspsocket.so inspsocket.o
1591 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1592 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1593 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1596 foreach my $cmd (@cmdlist) {
1598 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
1599 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1600 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o cmd_$cmd.so cmd_$cmd.o