1 # +------------------------------------+
2 # | Inspire Internet Relay Chat Daemon |
3 # +------------------------------------+
5 # InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 # See: http://wiki.inspircd.org/Credits
8 # This program is free but copyrighted software; see
9 # the file COPYING for details.
11 # ---------------------------------------------------
13 package make::configure;
18 use warnings FATAL => qw(all);
20 use Exporter 'import';
23 our @EXPORT = qw(promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic resolve_directory yesno showhelp promptstring_s);
28 my ($flag,$prompt) = @_;
29 print "$prompt [\e[1;32m$main::config{$flag}\e[0m] -> ";
30 chomp(my $tmp = <STDIN>);
31 if ($tmp eq "") { $tmp = $main::config{$flag} }
32 if (($tmp eq "") || ($tmp =~ /^y/i))
34 $main::config{$flag} = "y";
38 $main::config{$flag} = "n";
49 $ret = File::Spec->rel2abs($_[0]);
59 my $data = `git describe --tags 2>/dev/null`;
65 chomp $data; # remove \n
69 sub getcompilerflags {
71 open(FLAGS, $file) or return "";
73 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
74 my $x = translate_functions($1, $file);
86 open(FLAGS, $file) or return "";
88 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
89 my $x = translate_functions($1, $file);
101 open(FLAGS, $file) or return "";
103 if ($_ =~ /^\/\* \$ModDep: (.+) \*\/$/) {
104 my $x = translate_functions($1, $file);
116 open(FLAGS, $file) or return "";
118 if ($_ =~ /^\/\* \$NoPedantic \*\/$/) {
119 my $x = translate_functions($_, $file);
137 print "Detecting modules ";
140 opendir(DIRHANDLE, "src/modules") or die("WTF, missing src/modules!");
141 foreach my $name (sort readdir(DIRHANDLE))
143 if ($name =~ /^m_(.+)\.cpp$/)
146 $main::modlist[$i++] = $mod;
157 print "\nOk, $i modules.\n";
161 sub promptnumeric($$)
164 my ($prompt, $configitem) = @_;
167 print "Please enter the maximum $prompt?\n";
168 print "[\e[1;32m$main::config{$configitem}\e[0m] -> ";
169 chomp(my $var = <STDIN>);
172 $var = $main::config{$configitem};
174 if ($var =~ /^\d+$/) {
175 # We don't care what the number is, set it and be on our way.
176 $main::config{$configitem} = $var;
180 print "You must enter a number in this field. Please try again.\n\n";
185 sub promptstring_s($$)
187 my ($prompt,$default) = @_;
190 print "[\e[1;32m$default\e[0m] -> ";
191 chomp($var = <STDIN>);
192 $var = $default if $var eq "";
199 print "\n\e[1;32mPre-build configuration is complete!\e[0m\n\n";
200 print "\e[0mBase install path:\e[1;32m\t\t$main::config{BASE_DIR}\e[0m\n";
201 print "\e[0mConfig path:\e[1;32m\t\t\t$main::config{CONFIG_DIR}\e[0m\n";
202 print "\e[0mModule path:\e[1;32m\t\t\t$main::config{MODULE_DIR}\e[0m\n";
203 print "\e[0mGCC Version Found:\e[1;32m\t\t$main::config{GCCVER}.$main::config{GCCMINOR}\e[0m\n";
204 print "\e[0mCompiler program:\e[1;32m\t\t$main::config{CC}\e[0m\n";
205 print "\e[0mGnuTLS Support:\e[1;32m\t\t\t$main::config{USE_GNUTLS}\e[0m\n";
206 print "\e[0mOpenSSL Support:\e[1;32m\t\t$main::config{USE_OPENSSL}\e[0m\n\n";
207 print "\e[1;32mImportant note: The maximum length values are now configured in the\e[0m\n";
208 print "\e[1;32m configuration file, not in ./configure! See the <limits>\e[0m\n";
209 print "\e[1;32m tag in the configuration file for more information.\e[0m\n\n";
230 chomp(my $PWD = `pwd`);
231 print "Usage: configure [options]
233 *** NOTE: NON-INTERACTIVE CONFIGURE IS *NOT* SUPPORTED BY THE ***
234 *** INSPIRCD DEVELOPMENT TEAM. DO NOT ASK FOR HELP REGARDING ***
235 *** NON-INTERACTIVE CONFIGURE ON THE FORUMS OR ON IRC! ***
237 Options: [defaults in brackets after descriptions]
239 When no options are specified, interactive
240 configuration is started and you must specify
241 any required values manually. If one or more
242 options are specified, non-interactive configuration
243 is started, and any omitted values are defaulted.
245 Arguments with a single \"-\" symbol, as in
246 InspIRCd 1.0.x, are also allowed.
248 --disable-interactive Sets no options itself, but
249 will disable any interactive prompting.
250 --update Update makefiles and dependencies
251 --clean Remove .config.cache file and go interactive
252 --enable-gnutls Enable GnuTLS module [no]
253 --enable-openssl Enable OpenSSL module [no]
254 --enable-epoll Enable epoll() where supported [set]
255 --enable-kqueue Enable kqueue() where supported [set]
256 --disable-epoll Do not enable epoll(), fall back
257 to select() [not set]
258 --disable-kqueue Do not enable kqueue(), fall back
259 to select() [not set]
260 --disable-ipv6 Do not build ipv6 native InspIRCd [not set]
261 --with-cc=[filename] Use an alternative g++ binary to
263 --with-maxbuf=[n] Change the per message buffer size [512]
264 DO NOT ALTER THIS OPTION WITHOUT GOOD REASON
265 AS IT *WILL* BREAK CLIENTS!!!
266 --prefix=[directory] Base directory to install into (if defined,
267 can automatically define config, module, bin
268 and library dirs as subdirectories of prefix)
270 --config-dir=[directory] Config file directory for config and SSL certs
272 --module-dir=[directory] Modules directory for loadable modules
274 --binary-dir=[directory] Binaries directory for core binary
276 --library-dir=[directory] Library directory for core libraries
278 --list-extras Show current status of extra modules
279 --enable-extras=[extras] Enable the specified list of extras
280 --disable-extras=[extras] Disable the specified list of extras
281 --help Show this help text and exit