1 # +------------------------------------+
2 # | Inspire Internet Relay Chat Daemon |
3 # +------------------------------------+
5 # InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 # See: http://www.inspircd.org/wiki/index.php/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 = `svn info`;
66 $data =~ /Revision: (\d+)/;
75 sub getcompilerflags {
77 open(FLAGS, $file) or return "";
79 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
80 my $x = translate_functions($1, $file);
92 open(FLAGS, $file) or return "";
94 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
95 my $x = translate_functions($1, $file);
105 sub getdependencies {
107 open(FLAGS, $file) or return "";
109 if ($_ =~ /^\/\* \$ModDep: (.+) \*\/$/) {
110 my $x = translate_functions($1, $file);
122 open(FLAGS, $file) or return "";
124 if ($_ =~ /^\/\* \$NoPedantic \*\/$/) {
125 my $x = translate_functions($_, $file);
138 print "Detecting modules ";
139 opendir(DIRHANDLE, "src/modules") or die("WTF, missing src/modules!");
140 foreach my $name (sort readdir(DIRHANDLE))
142 if ($name =~ /^m_(.+)\.cpp$/)
145 $main::modlist[$i++] = $mod;
150 print "\nOk, $i modules.\n";
153 sub promptnumeric($$)
156 my ($prompt, $configitem) = @_;
159 print "Please enter the maximum $prompt?\n";
160 print "[\e[1;32m$main::config{$configitem}\e[0m] -> ";
161 chomp(my $var = <STDIN>);
164 $var = $main::config{$configitem};
166 if ($var =~ /^\d+$/) {
167 # We don't care what the number is, set it and be on our way.
168 $main::config{$configitem} = $var;
172 print "You must enter a number in this field. Please try again.\n\n";
177 sub promptstring_s($$)
179 my ($prompt,$default) = @_;
182 print "[\e[1;32m$default\e[0m] -> ";
183 chomp($var = <STDIN>);
184 $var = $default if $var eq "";
191 print "\n\e[1;32mPre-build configuration is complete!\e[0m\n\n";
192 print "\e[0mBase install path:\e[1;32m\t\t$main::config{BASE_DIR}\e[0m\n";
193 print "\e[0mConfig path:\e[1;32m\t\t\t$main::config{CONFIG_DIR}\e[0m\n";
194 print "\e[0mModule path:\e[1;32m\t\t\t$main::config{MODULE_DIR}\e[0m\n";
195 print "\e[0mLibrary path:\e[1;32m\t\t\t$main::config{LIBRARY_DIR}\e[0m\n";
196 print "\e[0mMax nickname length:\e[1;32m\t\t$main::config{NICK_LENGT}\e[0m\n";
197 print "\e[0mMax channel length:\e[1;32m\t\t$main::config{CHAN_LENGT}\e[0m\n";
198 print "\e[0mMax mode length:\e[1;32m\t\t$main::config{MAXI_MODES}\e[0m\n";
199 print "\e[0mMax ident length:\e[1;32m\t\t$main::config{MAX_IDENT}\e[0m\n";
200 print "\e[0mMax quit length:\e[1;32m\t\t$main::config{MAX_QUIT}\e[0m\n";
201 print "\e[0mMax topic length:\e[1;32m\t\t$main::config{MAX_TOPIC}\e[0m\n";
202 print "\e[0mMax kick length:\e[1;32m\t\t$main::config{MAX_KICK}\e[0m\n";
203 print "\e[0mMax name length:\e[1;32m\t\t$main::config{MAX_GECOS}\e[0m\n";
204 print "\e[0mMax away length:\e[1;32m\t\t$main::config{MAX_AWAY}\e[0m\n";
205 print "\e[0mGCC Version Found:\e[1;32m\t\t$main::config{GCCVER}.x\e[0m\n";
206 print "\e[0mCompiler program:\e[1;32m\t\t$main::config{CC}\e[0m\n";
207 print "\e[0mIPv6 Support:\e[1;32m\t\t\t$main::config{IPV6}\e[0m\n";
208 print "\e[0mIPv6 to IPv4 Links:\e[1;32m\t\t$main::config{SUPPORT_IP6LINKS}\e[0m\n";
209 print "\e[0mGnuTLS Support:\e[1;32m\t\t\t$main::config{USE_GNUTLS}\e[0m\n";
210 print "\e[0mOpenSSL Support:\e[1;32m\t\t$main::config{USE_OPENSSL}\e[0m\n\n";
231 chomp(my $PWD = `pwd`);
232 print "Usage: configure [options]
234 *** NOTE: NON-INTERACTIVE CONFIGURE IS *NOT* SUPPORTED BY THE ***
235 *** INSPIRCD DEVELOPMENT TEAM. DO NOT ASK FOR HELP REGARDING ***
236 *** NON-INTERACTIVE CONFIGURE ON THE FORUMS OR ON IRC! ***
238 Options: [defaults in brackets after descriptions]
240 When no options are specified, interactive
241 configuration is started and you must specify
242 any required values manually. If one or more
243 options are specified, non-interactive configuration
244 is started, and any omitted values are defaulted.
246 Arguments with a single \"-\" symbol, as in
247 InspIRCd 1.0.x, are also allowed.
249 --disable-interactive Sets no options intself, but
250 will disable any interactive prompting.
251 --disable-rpath Disable runtime paths. DO NOT USE UNLESS
252 YOU KNOW WHAT YOU ARE DOING!
253 --update Update makefiles and dependencies
254 --modupdate Detect new modules and write makefiles
255 --svnupdate {--rebuild} Update working copy via subversion
256 {and optionally rebuild if --rebuild
258 --clean Remove .config.cache file and go interactive
259 --enable-gnutls Enable GnuTLS module [no]
260 --enable-openssl Enable OpenSSL module [no]
261 --with-nick-length=[n] Specify max. nick length [32]
262 --with-channel-length=[n] Specify max. channel length [64]
263 --enable-optimization=[n] Optimize using -O[n] gcc flag
264 --enable-epoll Enable epoll() where supported [set]
265 --enable-kqueue Enable kqueue() where supported [set]
266 --disable-epoll Do not enable epoll(), fall back
267 to select() [not set]
268 --disable-kqueue Do not enable kqueue(), fall back
269 to select() [not set]
270 --enable-ipv6 Build ipv6 native InspIRCd [no]
271 --enable-remote-ipv6 Build with ipv6 support for remote
272 servers on the network [yes]
273 --disable-remote-ipv6 Do not allow remote ipv6 servers [not set]
274 --with-cc=[filename] Use an alternative g++ binary to
276 --with-ident-length=[n] Specify max length of ident [12]
277 --with-quit-length=[n] Specify max length of quit [200]
278 --with-topic-length=[n] Specify max length of topic [350]
279 --with-kick-length=[n] Specify max length of kick [200]
280 --with-gecos-length=[n] Specify max length of gecos [150]
281 --with-away-length=[n] Specify max length of away [150]
282 --with-max-modes=[n] Specify max modes per line which
284 --with-maxbuf=[n] Change the per message buffer size [512]
285 DO NOT ALTER THIS OPTION WITHOUT GOOD REASON
286 AS IT *WILL* BREAK CLIENTS!!!
287 --prefix=[directory] Base directory to install into (if defined,
288 can automatically define config, module, bin
289 and library dirs as subdirectories of prefix)
291 --config-dir=[directory] Config file directory for config and SSL certs
293 --module-dir=[directory] Modules directory for loadable modules
295 --binary-dir=[directory] Binaries directory for core binary
297 --library-dir=[directory] Library directory for core libraries
299 --list-extras Show current status of extra modules
300 --enable-extras=[extras] Enable the specified list of extras
301 --disable-extras=[extras] Disable the specified list of extras
302 --help Show this help text and exit