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");
291 chomp($topdir = getcwd());
292 $this = resolve_directory($topdir); # PWD, Regardless.
294 # Does the cache file exist?
296 # No, No it doesn't.. *BASH*
297 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
300 # We've Loaded the cache file and all our variables..
301 print "Updating Files..\n";
303 if ($opt_disable_debug == 1)
305 print "Disabling debug information (-g).\n";
306 $config{OPTIMISATI} = "";
309 $has_epoll = $config{HAS_EPOLL};
310 $has_kqueue = $config{HAS_KQUEUE};
319 chomp($topdir = getcwd());
320 $this = resolve_directory($topdir); # PWD, Regardless.
322 # Does the cache file exist?
324 # No, No it doesn't.. *BASH*
325 print "You have not run ./configure before. Please do this before trying to run the update script.\n";
328 # We've Loaded the cache file and all our variables..
329 print "Updating Files..\n";
331 $has_epoll = $config{HAS_EPOLL};
332 $has_kqueue = $config{HAS_KQUEUE};
344 open(FH,"<.svn/entries") or $fail = 1;
346 print "This is not an SVN copy of InspIRCd.\n";
349 system("svn update");
350 system("perl configure -update");
351 if ($ARGV[1] eq "rebuild") {
352 system("make install");
357 print "Running non-interactive configure...\n" unless $interactive;
358 print "Checking for cache from previous configure... ";
359 print ((getcache() eq "true") ? "found\n" : "not found\n");
360 print "Checking operating system version... ";
361 print getosflags() . "\n";
363 if (defined $opt_maxclients)
365 $config{MAX_CLIENT} = $opt_maxclients;
368 if (!$config{MAX_CLIENT}) {
369 # If the cache hasn't set the max clients, copy the variable of MAX_CLIENT_T, this
370 # allows us to keep _T for testing purposes. (ie. "Are you sure you want to go
371 # higher than the found value" :))
372 $config{MAX_CLIENT} = $config{MAX_CLIENT_T};
375 printf "Checking if stdint.h exists... ";
376 $config{HAS_STDINT} = "true";
378 open(STDINT, "</usr/include/stdint.h") or $config{HAS_STDINT} = "false";
379 if ($config{HAS_STDINT} eq "true") {
382 print "yes\n" if $config{HAS_STDINT} eq "true";
383 print "no\n" if $config{HAS_STDINT} eq "false";
386 printf "Checking if strlcpy exists... ";
387 # Perform the strlcpy() test..
388 $config{HAS_STRLCPY} = "false";
390 open(STRLCPY, "</usr/include/string.h") or $fail = 1;
392 while (chomp($line = <STRLCPY>)) {
393 # try and find the delcaration of:
394 # size_t strlcpy(...)
395 if ($line =~ /size_t(\0x9|\s)+strlcpy/) {
396 $config{HAS_STRLCPY} = "true";
401 print "yes\n" if $config{HAS_STRLCPY} eq "true";
402 print "no\n" if $config{HAS_STRLCPY} eq "false";
405 printf "Checking if kqueue exists... ";
408 open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
410 while (chomp($line = <KQUEUE>)) {
411 # try and find the delcaration of:
413 if ($line =~ /int(\0x9|\s)+kqueue/) {
419 print "yes\n" if $has_kqueue == 1;
420 print "no\n" if $has_kqueue == 0;
422 printf "Checking if epoll exists... ";
425 open(EPOLL, "</usr/include/sys/epoll.h") or $fail = 1;
431 my $kernel = `uname -r`;
433 if (($kernel =~ /2\.0/) || ($kernel =~ /2\.2/) || ($kernel =~ /2\.4/)) {
437 print "yes\n" if $has_epoll == 1;
438 print "no\n" if $has_epoll == 0;
440 if (($config{OSNAME} =~ /CYGWIN/) || ($config{OSNAME} eq "CYG-STATIC")) {
441 $config{HAS_STRLCPY} = "true";
444 $config{HAS_EPOLL} = $has_epoll;
445 $config{HAS_KQUEUE} = $has_kqueue;
447 printf "Checking for libgnutls... ";
448 if (($config{HAS_GNUTLS}) && (($config{HAS_GNUTLS} >= 1.2) || ($config{HAS_GNUTLS} eq "y"))) {
450 $config{HAS_GNUTLS} = "y";
453 $config{HAS_GNUTLS} = "n";
456 printf "Checking for openssl... ";
457 if (($config{HAS_OPENSSL}) && (($config{HAS_OPENSSL} >= 0.8) || ($config{HAS_OPENSSL} eq "y"))) {
459 $config{HAS_OPENSSL} = "y";
462 $config{HAS_OPENSSL} = "n";
465 ################################################################################
466 # BEGIN INTERACTIVE PART #
467 ################################################################################
475 my $rev = getrevision();
476 # Display Introduction Message..
478 Welcome to the \033[1mInspIRCd\033[0m Configuration program! (\033[1minteractive mode\033[0m)
479 \033[1mPackage maintainers: Type ./configure --help for non-interactive help\033[0m
481 *** If you are unsure of any of these values, leave it blank for ***
482 *** standard settings that will work, and your server will run ***
483 *** using them. Please consult your IRC network admin if in doubt. ***
485 Press \033[1m<RETURN>\033[0m to accept the default for any option, or enter
486 a new value. Please note: You will \033[1mHAVE\033[0m to read the docs
487 dir, otherwise you won't have a config file!
489 Your operating system is: \033[1;32m$config{OSNAME}\033[0m ($wholeos)
490 Maximum file descriptors: \033[1;32m$config{MAX_CLIENT_T}\033[0m
491 Your InspIRCd revision ID is \033[1;32mr$rev\033[0m";
493 print " (Non-SVN build)";
497 $config{CHANGE_COMPILER} = "n";
498 print "I have detected the following compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
500 while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
501 print "\033[1;32mIMPORTANT!\033[0m A GCC 2.x compiler has been detected, and
502 should NOT be used. You should probably specify a newer compiler.\n\n";
503 yesno(CHANGE_COMPILER,"Do you want to change the compiler?");
504 if ($config{CHANGE_COMPILER} =~ /y/i) {
505 print "What command do you want to use to invoke your compiler?\n";
506 print "[\033[1;32m$config{CC}\033[0m] -> ";
507 chomp($config{CC} = <STDIN>);
508 if ($config{CC} eq "") {
511 chomp($foo = `$config{CC} -dumpversion | cut -c 1`);
513 chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change compilers
514 print "Queried compiler: \033[1;32m$config{CC}\033[0m (version \033[1;32m$config{GCCVER}.x\033[0m)\n";
515 if ($config{GCCVER} < 3) {
516 print "\033[1;32mGCC 2.x WILL NOT WORK!\033[0m. Let's try that again, shall we?\n";
520 print "\033[1;32mWARNING!\033[0m Could not execute the compiler you specified. You may want to try again.\n";
527 # Directory Settings..
528 my $tmpbase = $config{BASE_DIR};
529 dir_check("do you wish to install the InspIRCd base", "BASE_DIR");
530 if ($tmpbase ne $config{BASE_DIR}) {
531 $config{CONFIG_DIR} = resolve_directory($config{BASE_DIR}."/conf"); # Configuration Dir
532 $config{MODULE_DIR} = resolve_directory($config{BASE_DIR}."/modules"); # Modules Directory
533 $config{BINARY_DIR} = resolve_directory($config{BASE_DIR}."/bin"); # Binary Directory
534 $config{LIBRARY_DIR} = resolve_directory($config{BASE_DIR}."/lib"); # Library Directory
537 dir_check("are the configuration files", "CONFIG_DIR");
538 dir_check("are the modules to be compiled to", "MODULE_DIR");
539 dir_check("is the IRCd binary to be placed", "BINARY_DIR");
540 dir_check("are the IRCd libraries to be placed", "LIBRARY_DIR");
543 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?");
547 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?");
550 $chose_hiperf = (($config{USE_EPOLL} eq "y") || ($config{USE_KQUEUE} eq "y"));
551 if (!$chose_hiperf) {
552 print "No high-performance socket engines are available, or you chose\n";
553 print "not to enable one. Defaulting to select() engine.\n\n";
556 yesno(IPV6,"Would you like to build InspIRCd with IPv6 support?");
559 if ($config{IPV6} eq "y") {
560 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";
561 $config{SUPPORT_IP6LINKS} = "y";
563 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.");
567 if (($config{HAS_GNUTLS} eq "y") && ($config{HAS_OPENSSL} eq "y")) {
568 print "I have detected both GnuTLS and OpenSSL on your system.\n";
569 print "I will default to GnuTLS. If you wish to use OpenSSL\n";
570 print "instead, you should enable the OpenSSL module yourself\n";
571 print "by copying it from src/modules/extra to src/modules.\n\n";
574 if ($config{HAS_GNUTLS} eq "y") {
575 yesno(USE_GNUTLS, "Would you like to enable SSL Support?");
576 if ($config{USE_GNUTLS} eq "y") {
577 print "\nUsing GnuTLS SSL module.\n";
579 } elsif ($config{HAS_OPENSSL} eq "y") {
580 yesno(USE_OPENSSL, "Would you like to enable SSL Support?");
581 if ($config{USE_OPENSSL} eq "y") {
582 print "\nUsing OpenSSL SSL module.\nYou will get better performance if you move to GnuTLS in the future.\n";
586 print "\nThe following questions will ask you for various figures relating\n";
587 print "To your IRCd install. Please note that these should usually be left\n";
588 print "as defaults unless you have a real reason to change them. If they\n";
589 print "changed, then the values must be identical on all servers on your\n";
590 print "network, or malfunctions and/or crashes may occur, with the exception\n";
591 print "of the 'maximum number of clients' setting which may be different on\n";
592 print "different servers on the network.\n\n";
594 # File Descriptor Settings..
595 promptnumeric("number of clients at any one time", "MAX_CLIENT_T");
597 $config{MAX_CLIENT} = $var;
598 $config{MAX_DESCRIPTORS} = $var;
600 promptnumeric("length of nicknames", "NICK_LENGT");
601 promptnumeric("length of channel names", "CHAN_LENGT");
602 promptnumeric("number of channels a normal user may join at any one time", "MAX_CHANNE");
603 promptnumeric("number of channels an oper may join at any one time", "MAX_OPERCH");
604 promptnumeric("number of mode changes in one line", "MAXI_MODES");
605 promptnumeric("length of an ident (username)", "MAX_IDENT");
606 promptnumeric("length of a quit message", "MAX_QUIT");
607 promptnumeric("length of a channel topic", "MAX_TOPIC");
608 promptnumeric("length of a kick message", "MAX_KICK");
609 promptnumeric("length of a GECOS (real name)", "MAX_GECOS");
610 promptnumeric("length of an away message", "MAX_AWAY");
615 if (($config{USE_GNUTLS} eq "y") && ($config{HAS_GNUTLS} ne "y"))
617 print "Sorry, but i couldn't detect gnutls. Make sure gnutls-config is in your path.\n";
620 if (($config{USE_OPENSSL} eq "y") && ($config{HAS_OPENSSL} ne "y"))
622 print "Sorry, but i couldn't detect openssl. Make sure openssl is in your path.\n";
626 if ($config{USE_GNUTLS} eq "y") {
628 open(TMP, "<src/modules/m_ssl_gnutls.cpp") or $failed = 1;
631 print "Symlinking src/modules/m_ssl_gnutls.cpp from extra/\n";
632 chdir("src/modules");
633 system("ln -s extra/m_ssl_gnutls.cpp");
634 system("ln -s extra/ssl_cert.h");
641 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
643 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
646 print "SSL Certificates Not found, Generating.. \n\n
647 *************************************************************
648 * Generating the Private Key may take some time, go grab a *
649 * Coffee. Even better, to generate some more entropy if it *
650 * is taking a while, open another console and type du / a *
651 * few times and get that HD going :) Then answer the *
652 * Questions which follow. If you are unsure, just hit enter *
653 *************************************************************\n\n";
654 system("certtool --generate-privkey --outfile key.pem");
655 system("certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem");
656 print "\nCertificate generation complete, copying to config directory... ";
657 system("mv key.pem $config{CONFIG_DIR}/key.pem");
658 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
661 print "SSL Certificates found, skipping.\n\n"
666 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
668 } elsif ($config{USE_OPENSSL} eq "y") {
670 open(TMP, "<src/modules/m_ssl_openssl.cpp") or $failed = 1;
673 print "Symlinking src/modules/m_ssl_openssl.cpp from extra/\n";
674 chdir("src/modules");
675 system("ln -s extra/m_ssl_openssl.cpp");
676 system("ln -s extra/ssl_cert.h");
683 open(TMP, "<$config{CONFIG_DIR}/key.pem") or $failed = 1;
685 open(TMP, "<$config{CONFIG_DIR}/cert.pem") or $failed = 1;
688 print "SSL Certificates Not found, Generating.. \n\n
689 *************************************************************
690 * Generating the certificates may take some time, go grab a *
691 * coffee, or something. *
692 *************************************************************\n\n";
693 system("openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem");
694 system("openssl dhparam -out dhparams.pem 1024");
695 print "\nCertificate generation complete, copying to config directory... ";
696 system("mv key.pem $config{CONFIG_DIR}/key.pem");
697 system("mv cert.pem $config{CONFIG_DIR}/cert.pem");
698 system("mv dhparams.pem $config{CONFIG_DIR}/dhparams.pem");
701 print "SSL Certificates found, skipping.\n\n"
706 print "Skipping SSL certificate generation\nin non-interactive mode.\n\n";
709 if (($config{USE_GNUTLS} eq "n") && ($config{USE_OPENSSL} eq "n")) {
710 print "Skipping SSL Certificate generation, SSL support is not available.\n\n";
718 print "To build your server with these settings, please type '\033[1;32m$config{MAKEPROG}\033[0m' now.\n";
719 if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
720 print "Please remember that to enable \033[1;32mSSL support\033[0m you must\n";
721 print "load the required modules in your config. This configure process\n";
722 print "has just prepared these modules to be compiled for you, and has not\n";
723 print "configured them to be compiled into the core of the ircd.\n";
725 print "*** \033[1;32mRemember to edit your configuration files!!!\033[0m ***\n\n\n";
726 if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
727 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";
730 if ($config{GCCVER} < "3") {
732 \033[1;32mWARNING!\033[0m You are attempting to compile InspIRCd on GCC 2.x!
733 GCC 2.x series compilers only had partial (read as broken) C++ support, and
734 your compile will most likely fail horribly! If you have any problems, do NOT
735 report them to the bugtracker or forums without first upgrading your compiler
736 to a newer 3.x or 4.x (or whatever is available currently) version.
740 ################################################################################
742 ################################################################################
744 # Retrieves the .config.cache file, and loads values into the main config hash.
745 open(CACHE, ".config.cache") or return undef;
748 # Ignore Blank lines, and comments..
751 my ($key, $value) = split("=", $_);
752 $value =~ /^\"(.*)\"$/;
753 # Do something with data here!
761 # Dump the contents of %config
762 print "Writing \033[1;32mcache file\033[0m for future ./configures ...\n";
763 open(FILEHANDLE, ">.config.cache");
764 foreach $key (keys %config) {
765 print FILEHANDLE "$key=\"$config{$key}\"\n";
771 my ($desc, $hash_key) = @_;
774 print "In what directory $desc?\n";
775 print "[\033[1;32m$config{$hash_key}\033[0m] -> ";
776 chomp($var = <STDIN>);
778 $var = $config{$hash_key};
780 if ($var =~ /^\~\/(.+)$/) {
781 # Convert it to a full path..
782 $var = resolve_directory($ENV{HOME} . "/" . $1);
784 elsif ((($config{OSNAME} =~ /MINGW32/i) and ($var !~ /^[A-Z]{1}:\\.*/)) and (substr($var,0,1) ne "/"))
786 # Assume relative Path was given.. fill in the rest.
787 $var = $this . "/$var";
790 $var = resolve_directory($var);
792 print "$var does not exist. Create it?\n[\033[1;32my\033[0m] ";
793 chomp($tmp = <STDIN>);
794 if (($tmp eq "") || ($tmp =~ /^y/i)) {
795 # Attempt to Create the Dir..
797 system("mkdir -p \"$var\" >> /dev/null 2>&1");
798 $chk = system("mkdir -p \"$var\" >> /dev/null 2>&1") / 256;
800 print "Unable to create directory. ($var)\n\n";
805 # They said they don't want to create, and we can't install there.
811 # Target exists, but is not a directory.
812 print "File $var exists, but is not a directory.\n\n";
816 # Either Dir Exists, or was created fine.
817 $config{$hash_key} = $var;
825 $config{LDLIBS} = "-lstdc++";
826 $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
827 $config{MAKEPROG} = "make";
829 if ($config{OSNAME} =~ /OpenBSD/i) {
830 $config{MAKEPROG} = "gmake";
831 chomp($foo = `eg++ -dumpversion | cut -c 1`);
832 # theyre running the package version of gcc (eg++)... detect it and set up its version numbers.
833 # if theyre not running this, configure lets the build continue but they probably wont manage to
834 # compile as this standard version is 2.95.3!
836 $config{CC} = "eg++";
837 chomp($config{GCCVER} = `eg++ -dumpversion | cut -c 1`); # we must redo these if we change the compiler path
842 if ($config{OSNAME} =~ /Linux/i) {
843 $config{LDLIBS} = "-ldl -lstdc++";
844 $config{FLAGS} = "-fno-strict-aliasing -fPIC -Wall -Woverloaded-virtual $config{OPTIMISATI}";
845 $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
846 $config{MAKEPROG} = "make";
847 if ($config{OSNAME} =~ /CYGWIN/) {
848 $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
849 $config{LDLIBS} = "";
850 $config{MAKEPROG} = "/usr/bin/make";
851 $config{MAKEORDER} = "ircd mods";
853 } elsif ($config{OSNAME} eq "CYG-STATIC") {
854 $config{FLAGS} = "-fno-strict-aliasing -Wall -Woverloaded-virtual $config{OPTIMISATI}";
855 $config{LDLIBS} = "";
856 $config{MAKEPROG} = "/usr/bin/make";
857 $config{MAKEORDER} = "mods ircd";
858 $config{STATICLIBS} = "modules/mods.a";
859 $config{STATIC_LINK} = "yes";
860 return "Cygwin-Static";
862 $config{FLAGS} .= " " . $ENV{CXXFLAGS} if exists($ENV{CXXFLAGS});
865 if ($config{OSNAME} =~ /SunOS/i)
867 # solaris/sunos needs these
868 # socket = bsd sockets api
870 # rt = POSIX realtime extensions
871 # resolv = inet_aton only (why isnt this in nsl?!)
872 $config{MAKEPROG} = "gmake";
873 $config{LDLIBS} = $config{LDLIBS} . " -lsocket -lnsl -lrt -lresolv";
877 if($config{OSNAME} =~ /MINGW32/i)
879 # All code is position-independent on windows
880 $config{FLAGS} =~ s/-fPIC //;
884 return $config{OSNAME};
888 my($writeheader) = @_;
889 # First File.. inspircd_config.h
890 chomp(my $incos = `uname -n -s -r`);
891 chomp(my $version = `sh ./src/version.sh`);
892 chomp(my $revision = getrevision());
893 $version = "$version(r$revision)";
894 chomp(my $revision2 = getrevision());
895 if ($writeheader == 1)
897 print "Writing \033[1;32minspircd_config.h\033[0m\n";
898 open(FILEHANDLE, ">include/inspircd_config.h");
899 my $NL = $config{NICK_LENGT}+1;
900 my $CL = $config{CHAN_LENGT}+1;
901 print FILEHANDLE <<EOF;
902 /* Auto generated by configure, do not modify! */
903 #ifndef __CONFIGURATION_AUTO__
904 #define __CONFIGURATION_AUTO__
906 #define CONFIG_FILE "$config{CONFIG_DIR}/inspircd.conf"
907 #define MOD_PATH "$config{MODULE_DIR}"
908 #define VERSION "$version"
909 #define REVISION "$revision2"
910 #define MAXCLIENTS $config{MAX_CLIENT}
911 #define MAXCLIENTS_S "$config{MAX_CLIENT}"
912 #define SOMAXCONN_S "$config{_SOMAXCONN}"
913 #define MAX_DESCRIPTORS $config{MAX_DESCRIPTORS}
916 #define MAXCHANS $config{MAX_CHANNE}
917 #define OPERMAXCHANS $config{MAX_OPERCH}
918 #define MAXMODES $config{MAXI_MODES}
919 #define IDENTMAX $config{MAX_IDENT}
920 #define MAXQUIT $config{MAX_QUIT}
921 #define MAXTOPIC $config{MAX_TOPIC}
922 #define MAXKICK $config{MAX_KICK}
923 #define MAXGECOS $config{MAX_GECOS}
924 #define MAXAWAY $config{MAX_AWAY}
925 #define OPTIMISATION $config{OPTIMITEMP}
926 #define LIBRARYDIR "$config{LIBRARY_DIR}"
927 #define SYSTEM "$incos"
930 if ($config{OSNAME} =~ /SunOS/i) {
931 print FILEHANDLE "#define IS_SOLARIS\n";
933 if ($config{OSNAME} =~ /CYGWIN/i) {
934 print FILEHANDLE "#define IS_CYGWIN\n";
935 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
937 if ($config{OSNAME} =~ /MINGW32/i) {
938 print FILEHANDLE "#define IS_MINGW\n";
940 if ($config{OSNAME} =~ /CYG-STATIC/i) {
941 print FILEHANDLE "#ifndef FD_SETSIZE\n#define FD_SETSIZE 1024\n#endif\n";
943 if ($config{STATIC_LINK} eq "yes") {
944 print FILEHANDLE "#define STATIC_LINK\n";
946 if ($config{GCCVER} >= 3) {
947 print FILEHANDLE "#define GCC3\n";
949 if ($config{HAS_STRLCPY} eq "true") {
950 print FILEHANDLE "#define HAS_STRLCPY\n";
952 if ($config{HAS_STDINT} eq "true") {
953 print FILEHANDLE "#define HAS_STDINT\n";
955 if ($config{IPV6} =~ /y/i) {
956 print FILEHANDLE "#define IPV6\n";
958 if ($config{SUPPORT_IP6LINKS} =~ /y/i) {
959 print FILEHANDLE "#define SUPPORT_IP6LINKS\n";
962 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
963 print FILEHANDLE "#define USE_KQUEUE\n";
964 $se = "socketengine_kqueue";
967 if (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
968 print FILEHANDLE "#define USE_EPOLL\n";
969 $se = "socketengine_epoll";
972 # user didn't choose either epoll or select for their OS.
973 # default them to USE_SELECT (ewwy puke puke)
975 print FILEHANDLE "#define USE_SELECT\n";
976 $se = "socketengine_select";
978 print FILEHANDLE "\n#endif\n";
984 open(FILEHANDLE, ">include/inspircd_se_config.h");
985 print FILEHANDLE <<EOF;
986 /* Auto generated by configure, do not modify or commit to svn! */
987 #ifndef __CONFIGURATION_SOCKETENGINE__
988 #define __CONFIGURATION_SOCKETENGINE__
998 # Create a Modules List..
1000 foreach $i (@modlist)
1002 if ($config{STATIC_LINK} eq "yes") {
1003 $modules .= "m_".$i.".o ";
1006 $modules .= "m_".$i.".so ";
1009 chomp($modules); # Remove Redundant whitespace..
1012 # Write all .in files.
1015 my $exe = "inspircd";
1017 if ($config{OSNAME} =~ /CYGWIN/i) {
1018 $exe = "inspircd.exe";
1021 opendir(DIRHANDLE, $this);
1023 # Do this once here, and cache it in the .*.inc files,
1024 # rather than attempting to read src/version.sh from
1025 # compiled code -- we might not have the source to hand.
1026 # Fix for bug#177 by Brain.
1028 chomp(my $version = `sh ./src/version.sh`);
1029 chomp(my $revision = getrevision());
1030 $version = "$version(r$revision)";
1032 # We can actually parse any file starting with . and ending with .inc,
1033 # but right now we only parse .inspircd.inc to form './inspircd'
1035 foreach $name (sort readdir(DIRHANDLE)) {
1036 if ($name =~ /^\.(.+)\.inc$/) {
1038 # All .name.inc files need parsing!
1040 open(FILEHANDLE, ".$file.inc");
1041 while (<FILEHANDLE>) {
1046 $tmp =~ s/\@CC\@/$config{CC}/;
1047 $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
1048 $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
1049 $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
1050 $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
1051 $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
1052 $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
1053 $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
1054 $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
1055 $tmp =~ s/\@MODULES\@/$modules/;
1056 $tmp =~ s/\@EXECUTABLE\@/$exe/;
1057 $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
1058 $tmp =~ s/\@STATICLIBS\@/$config{STATICLIBS}/;
1059 $tmp =~ s/\@VERSION\@/$version/;
1061 print "Writing \033[1;32m$file\033[0m\n";
1062 open(FILEHANDLE, ">$file");
1063 print FILEHANDLE $tmp;
1066 closedir(DIRHANDLE);
1068 # Make inspircd executable!
1069 chmod 0744, 'inspircd';
1071 if ($config{STATIC_LINK} eq "yes") {
1072 print "Writing static-build \033[1;32msrc/Makefile\033[0m\n";
1073 write_static_makefile();
1074 write_static_modules_makefile();
1075 } elsif ($config{OSNAME} =~ /CYGWIN/i) {
1076 print "Writing cygwin-build \033[1;32msrc/Makefile\033[0m\n";
1077 write_static_makefile();
1078 write_dynamic_modules_makefile();
1080 print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
1081 write_dynamic_makefile();
1082 write_dynamic_modules_makefile();
1086 sub write_static_modules_makefile {
1087 # Modules Makefile..
1088 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1089 open(FILEHANDLE, ">src/modules/Makefile");
1092 # Module Makefile Header
1094 print FILEHANDLE <<EOF;
1095 # (C) ChatSpike development team
1096 # Makefile by <Craig\@ChatSpike.net>
1097 # Many Thanks to Andrew Church <achurch\@achurch.org>
1098 # for assisting with making this work right.
1100 # Automatically Generated by ./configure to add a modules
1101 # please run ./configure --update
1107 # End Module Makefile Header
1110 # Create a Modules List..
1115 open(MODLIST,">include/modlist.h");
1118 # Include File Header
1120 print MODLIST <<HEADER;
1121 // Generated automatically by configure. DO NOT EDIT!
1123 #ifndef __SYMBOLS__H_CONFIGURED__
1124 #define __SYMBOLS__H_CONFIGURED__
1128 # End Include File Header
1131 # Place Module List into Include
1132 foreach $i (@modlist) {
1133 if ($i !~ /_static$/) {
1134 print MODLIST "extern \"C\" void * $i\_init (void);\n";
1137 print MODLIST "\nstruct {const char *name; initfunc *value; } modsyms[] = {\n";
1142 foreach $i (@modlist)
1144 if ($i !~ /_static$/) {
1145 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1146 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1147 $deps = getdependencies("src/modules/m_".$i.".cpp");
1149 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1152 # Write Entry to the Makefile
1154 print FILEHANDLE <<EOCHEESE;
1155 m_$i.o: .m_$i\_static.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h $deps
1156 \$(CC) -pipe -I../../include \$(FLAGS) $flags -export-dynamic -c .m_$i\_static.cpp
1157 mv .m_$i\_static.o ../m_$i.o
1161 # End Write Entry to the MakeFile
1163 print "Configuring module [\033[1;32mm_$i.so\033[0m] for static linking... ";
1164 open(MODULE,"<src/modules/m_".$i.".cpp") or die("Could not open m_".$i.".cpp");
1165 open(MUNGED,">src/modules/.m_".$i."_static.cpp") or die("Could not create .m_".$i."_static.cpp");
1166 while (chomp($a = <MODULE>)) {
1167 $a =~ s/init_module/$i\_init/g;
1168 print MUNGED "$a\n";
1172 print MODLIST <<EOENT;
1173 {"m_$i.so",\&$i\_init},
1178 print MODLIST "{0}};\n\n#endif\n";
1182 sub write_dynamic_modules_makefile {
1183 # Modules Makefile..
1184 print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
1185 open(FILEHANDLE, ">src/modules/Makefile");
1188 if ($config{OSNAME} =~ /CYGWIN/i) {
1189 $extra = "../inspircd.dll.a";
1193 # Module Makefile Header
1195 print FILEHANDLE <<EOF;
1196 # (C) ChatSpike development team
1197 # Makefile by <Craig\@ChatSpike.net>
1198 # Many Thanks to Andrew Church <achurch\@achurch.org>
1199 # for assisting with making this work right.
1201 # Automatically Generated by ./configure to add a modules
1202 # please run ./configure -update or ./configure -modupdate
1208 # End Module Makefile Header
1211 # Create a Modules List..
1217 foreach $i (@modlist) {
1219 # Write Entry to the MakeFile
1221 $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
1222 $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
1223 $deps = getdependencies("src/modules/m_".$i.".cpp");
1225 #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
1227 print FILEHANDLE <<EOCHEESE;
1228 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
1229 \$(CC) -pipe -I../../include \$(FLAGS) $cmflags -export-dynamic -c m_$i.cpp
1230 \$(CC) -pipe \$(FLAGS) -shared $liflags -o m_$i.so m_$i.o $extra
1233 $crud = $crud . " install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
1235 # End Write Entry to the MakeFile
1238 print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
1242 sub write_static_makefile {
1243 open(FH,">src/Makefile") or die("Could not write src/Makefile!");
1246 opendir(DIRHANDLE, "src");
1247 foreach $name (sort readdir(DIRHANDLE)) {
1248 if ($name =~ /^cmd_(.+)\.cpp$/) {
1249 $cmdlist[$i++] = $1;
1252 closedir(DIRHANDLE);
1255 foreach my $cmd (@cmdlist) {
1256 $cmdobjs = $cmdobjs . "cmd_$cmd.o ";
1257 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1262 # (C) ChatSpike development team
1263 # Makefile by <Craig\@ChatSpike.net>
1264 # Makefile version 2 (statically linked core) by <brain\@inspircd.org>
1267 CC = im a cheezeball
1269 CXXFLAGS = -I../include \${FLAGS}
1270 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1271 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1275 $se = "socketengine_select";
1276 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1277 $se = "socketengine_kqueue";
1279 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1280 $se = "socketengine_epoll";
1284 # This next section is for cygwin dynamic module builds.
1285 # Basically, what we do, is build the inspircd core as a library
1286 # then the main executable uses that. the library is capable of
1287 # loading / unloading the modules dynamically :)
1288 # Massive thanks to the guys on #cygwin @ irc.freenode.net for helping
1292 if ($config{OSNAME} =~ /CYGWIN/i) {
1294 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
1296 inspircd.exe: inspircd.dll.a
1299 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
1300 \$(CC) -shared -Wl,--out-implib=inspircd.dll.a -o inspircd.dll \$^
1304 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
1306 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
1307 \$(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)
1313 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
1314 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1316 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
1317 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1319 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
1320 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1322 userprocess.o: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1323 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1325 socketengine.o: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1326 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1328 hashcomp.o: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1329 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1331 helperfuncs.o: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1332 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1334 channels.o: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1335 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1337 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
1338 \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS)
1339 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1341 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
1342 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1344 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
1345 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1347 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
1348 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1350 base.o: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1351 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1353 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
1354 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1356 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
1357 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp $cmdobjs
1359 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
1360 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1362 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
1363 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1365 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
1366 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1368 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
1369 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1371 socket.o: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1372 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1374 inspsocket.o: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1375 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1377 timer.o: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1378 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1381 foreach my $cmd (@cmdlist) {
1383 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
1384 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1390 sub write_dynamic_makefile {
1394 opendir(DIRHANDLE, "src");
1395 foreach $name (sort readdir(DIRHANDLE)) {
1396 if ($name =~ /^cmd_(.+)\.cpp$/) {
1397 $cmdlist[$i++] = $1;
1400 closedir(DIRHANDLE);
1404 foreach my $cmd (@cmdlist) {
1405 $cmdobjs = $cmdobjs . "cmd_$cmd.so ";
1406 $srcobjs = $srcobjs . "cmd_$cmd.cpp ";
1409 $se = "socketengine_select";
1410 if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
1411 $se = "socketengine_kqueue";
1413 elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
1414 $se = "socketengine_epoll";
1417 open(FH,">src/Makefile") or die("Could not write src/Makefile");
1421 # (C) ChatSpike development team
1422 # Makefile by <Craig\@ChatSpike.net>
1423 # Makefile version 2 (dynamically linked core) by <brain\@inspircd.org>
1426 CC = im a cheezeball
1428 CXXFLAGS = -I../include \${FLAGS}
1429 CPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* //' | grep -v svn)
1430 RELCPPFILES = \$(shell /bin/ls -l modes/ | grep '\\.cpp' | sed 's/^.* /modes\\//' | grep -v svn)
1432 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
1434 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
1435 \$(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
1437 libIRCDsocketengine.so: $se.cpp socketengine.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h ../include/$se.h
1438 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socketengine.cpp $se.cpp
1439 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocketengine.so socketengine.o $se.o
1441 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
1442 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c snomasks.cpp
1443 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsnomasks.so snomasks.o
1445 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
1446 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c command_parse.cpp
1447 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommand_parse.so command_parse.o
1449 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
1450 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cull_list.cpp
1451 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcull_list.so cull_list.o
1453 libIRCDuserprocess.so: userprocess.cpp ../include/base.h ../include/hashcomp.h ../include/globals.h ../include/inspircd_config.h
1454 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c userprocess.cpp
1455 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDuserprocess.so userprocess.o
1457 libIRCDhash.so: hashcomp.cpp ../include/base.h ../include/hashcomp.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1458 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c hashcomp.cpp
1459 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhash.so hashcomp.o
1461 libIRCDhelper.so: helperfuncs.cpp ../include/base.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1462 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c helperfuncs.cpp
1463 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDhelper.so helperfuncs.o
1465 libIRCDchannels.so: channels.cpp ../include/base.h ../include/channels.h ../include/inspircd.h ../include/users.h ../include/globals.h ../include/inspircd_config.h
1466 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c channels.cpp
1467 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDchannels.so channels.o
1469 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)
1470 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c mode.cpp
1471 \${MAKE} -C "modes" DIRNAME="src/modes" CC="\$(CC)" \$(MAKEARGS) CPPFILES="\$(CPPFILES)"
1472 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmode.so mode.o modes/modeclasses.a
1474 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
1475 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c xline.cpp
1476 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDxline.so xline.o
1478 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
1479 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspstring.cpp
1480 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDstring.so inspstring.o
1482 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
1483 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dns.cpp
1484 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDasyncdns.so dns.o
1486 libIRCDbase.so: base.cpp ../include/base.h ../include/globals.h ../include/inspircd_config.h
1487 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c base.cpp
1488 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDbase.so base.o
1490 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
1491 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c configreader.cpp
1492 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDconfigreader.so configreader.o
1494 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
1495 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c commands.cpp
1496 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDcommands.so commands.o
1498 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
1499 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c dynamic.cpp
1500 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDdynamic.so dynamic.o
1502 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
1503 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c users.cpp
1504 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDusers.so users.o
1506 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
1507 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c modules.cpp
1508 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDmodules.so modules.o
1510 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
1511 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c wildcard.cpp
1512 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDwildcard.so wildcard.o
1514 libIRCDsocket.so: socket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h
1515 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c socket.cpp
1516 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDsocket.so socket.o
1518 libIRCDinspsocket.so: inspsocket.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1519 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c inspsocket.cpp
1520 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDinspsocket.so inspsocket.o
1522 libIRCDtimer.so: timer.cpp ../include/base.h ../include/inspircd.h ../include/globals.h ../include/inspircd_config.h ../include/timer.h
1523 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c timer.cpp
1524 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o libIRCDtimer.so timer.o
1527 foreach my $cmd (@cmdlist) {
1529 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
1530 \$(CC) -pipe -I../include \$(FLAGS) -export-dynamic -c cmd_$cmd.cpp
1531 \$(CC) -pipe -Wl,--rpath -Wl,$config{LIBRARY_DIR} -shared -o cmd_$cmd.so cmd_$cmd.o
1540 chomp($PWD = `pwd`);
1541 print "Usage: configure [options]
1543 *** NOTE: NON-INTERACTIVE CONFIGURE IS *NOT* SUPPORTED BY THE ***
1544 *** INSPIRCD DEVELOPMENT TEAM. DO NOT ASK FOR HELP REGARDING ***
1545 *** NON-INTERACTIVE CONFIGURE ON THE FORUMS OR ON IRC! ***
1547 Options: [defaults in brackets after descriptions]
1549 When no options are specified, interactive
1550 configuration is started and you must specify
1551 any required values manually. If one or more
1552 options are specified, non-interactive configuration
1553 is started, and any omitted values are defaulted.
1555 Arguments with a single \"-\" symbol, as in
1556 InspIRCd 1.0.x, are also allowed.
1558 --disable-interactive Sets no options intself, but
1559 will disable any interactive prompting.
1560 --update Update makefiles and dependencies
1561 --modupdate Detect new modules and write makefiles
1562 --svnupdate {rebuild} Update working copy via subversion
1563 {and optionally rebuild it}
1564 --clean Remove .config.cache file and go interactive
1565 --enable-gnutls Enable GnuTLS module [no]
1566 --enable-openssl Enable OpenSSL module [no]
1567 --with-nick-length=[n] Specify max. nick length [32]
1568 --with-channel-length=[n] Specify max. channel length [64]
1569 --with-max-channels=[n] Specify max. number of channels
1570 a normal user may join [20]
1571 --with-max-oper-channels=[n] Specify max. number of channels
1572 an irc operator may join [60]
1573 --with-max-clients=[n] Specify maximum number of users
1574 which may connect locally
1575 --enable-optimization=[n] Optimize using -O[n] gcc flag
1576 --enable-epoll Enable epoll() where supported [set]
1577 --enable-kqueue Enable kqueue() where supported [set]
1578 --disable-epoll Do not enable epoll(), fall back
1579 to select() [not set]
1580 --disable-kqueue Do not enable kqueue(), fall back
1581 to select() [not set]
1582 --enable-ipv6 Build ipv6 native InspIRCd [no]
1583 --enable-remote-ipv6 Build with ipv6 support for remote
1584 servers on the network [yes]
1585 --disable-remote-ipv6 Do not allow remote ipv6 servers [not set]
1586 --with-cc=[filename] Use an alternative g++ binary to
1587 build InspIRCd [g++]
1588 --with-ident-length=[n] Specify max length of ident [12]
1589 --with-quit-length=[n] Specify max length of quit [200]
1590 --with-topic-length=[n] Specify max length of topic [350]
1591 --with-kick-length=[n] Specify max length of kick [200]
1592 --with-gecos-length=[n] Specify max length of gecos [150]
1593 --with-away-length=[n] Specify max length of away [150]
1594 --with-max-modes=[n] Specify max modes per line which
1595 have parameters [20]
1596 --prefix=[directory] Base directory to install into (if defined,
1597 can automatically define config, module, bin
1598 and library dirs as subdirectories of prefix)
1600 --config-dir=[directory] Config file directory for config and SSL certs
1602 --module-dir=[directory] Modules directory for loadable modules
1604 --binary-dir=[directory] Binaries directory for core binary
1606 --library-dir=[directory] Library directory for core libraries
1608 --help Show this help text and exit