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;
17 use Exporter 'import';
20 @EXPORT = qw(promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic resolve_directory yesno showhelp promptstring_s);
25 my ($flag,$prompt) = @_;
26 print "$prompt [\033[1;32m$main::config{$flag}\033[0m] -> ";
27 chomp($tmp = <STDIN>);
28 if ($tmp eq "") { $tmp = $main::config{$flag} }
29 if (($tmp eq "") || ($tmp =~ /^y/i))
31 $main::config{$flag} = "y";
35 $main::config{$flag} = "n";
46 $ret = File::Spec->rel2abs($_[0]);
56 my $data = `svn info`;
63 $data =~ /Revision: (\d+)/;
72 sub getcompilerflags {
76 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
78 return translate_functions($1,$file);
89 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
91 return translate_functions($1,$file);
102 if ($_ =~ /^\/\* \$ModDep: (.+) \*\/$/) {
104 return translate_functions($1,$file);
115 if ($_ =~ /^\/\* \$NoPedantic \*\/$/) {
127 print "Detecting modules ";
128 opendir(DIRHANDLE, "src/modules");
129 foreach $name (sort readdir(DIRHANDLE))
131 if ($name =~ /^m_(.+)\.cpp$/)
134 $main::modlist[$i++] = $mod;
139 print "\nOk, $i modules.\n";
142 sub promptnumeric($$)
145 my ($prompt, $configitem) = @_;
148 print "Please enter the maximum $prompt?\n";
149 print "[\033[1;32m$main::config{$configitem}\033[0m] -> ";
150 chomp($var = <STDIN>);
153 $var = $main::config{$configitem};
155 if ($var =~ /^\d+$/) {
156 # We don't care what the number is, set it and be on our way.
157 $main::config{$configitem} = $var;
161 print "You must enter a number in this field. Please try again.\n\n";
166 sub promptstring_s($$)
168 my ($prompt,$default) = @_;
171 print "[\033[1;32m$default\033[0m] -> ";
172 chomp($var = <STDIN>);
173 $var = $default if $var eq "";
180 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
181 print "\033[0mBase install path:\033[1;32m\t\t$main::config{BASE_DIR}\033[0m\n";
182 print "\033[0mConfig path:\033[1;32m\t\t\t$main::config{CONFIG_DIR}\033[0m\n";
183 print "\033[0mModule path:\033[1;32m\t\t\t$main::config{MODULE_DIR}\033[0m\n";
184 print "\033[0mLibrary path:\033[1;32m\t\t\t$main::config{LIBRARY_DIR}\033[0m\n";
185 print "\033[0mMax connections:\033[1;32m\t\t$main::config{MAX_CLIENT}\033[0m\n";
186 print "\033[0mMax nickname length:\033[1;32m\t\t$main::config{NICK_LENGT}\033[0m\n";
187 print "\033[0mMax channel length:\033[1;32m\t\t$main::config{CHAN_LENGT}\033[0m\n";
188 print "\033[0mMax mode length:\033[1;32m\t\t$main::config{MAXI_MODES}\033[0m\n";
189 print "\033[0mMax ident length:\033[1;32m\t\t$main::config{MAX_IDENT}\033[0m\n";
190 print "\033[0mMax quit length:\033[1;32m\t\t$main::config{MAX_QUIT}\033[0m\n";
191 print "\033[0mMax topic length:\033[1;32m\t\t$main::config{MAX_TOPIC}\033[0m\n";
192 print "\033[0mMax kick length:\033[1;32m\t\t$main::config{MAX_KICK}\033[0m\n";
193 print "\033[0mMax name length:\033[1;32m\t\t$main::config{MAX_GECOS}\033[0m\n";
194 print "\033[0mMax away length:\033[1;32m\t\t$main::config{MAX_AWAY}\033[0m\n";
195 print "\033[0mGCC Version Found:\033[1;32m\t\t$main::config{GCCVER}.x\033[0m\n";
196 print "\033[0mCompiler program:\033[1;32m\t\t$main::config{CC}\033[0m\n";
197 print "\033[0mIPv6 Support:\033[1;32m\t\t\t$main::config{IPV6}\033[0m\n";
198 print "\033[0mIPv6 to IPv4 Links:\033[1;32m\t\t$main::config{SUPPORT_IP6LINKS}\033[0m\n";
199 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$main::config{USE_GNUTLS}\033[0m\n";
200 print "\033[0mOpenSSL Support:\033[1;32m\t\t$main::config{USE_OPENSSL}\033[0m\n\n";
222 print "Usage: configure [options]
224 *** NOTE: NON-INTERACTIVE CONFIGURE IS *NOT* SUPPORTED BY THE ***
225 *** INSPIRCD DEVELOPMENT TEAM. DO NOT ASK FOR HELP REGARDING ***
226 *** NON-INTERACTIVE CONFIGURE ON THE FORUMS OR ON IRC! ***
228 Options: [defaults in brackets after descriptions]
230 When no options are specified, interactive
231 configuration is started and you must specify
232 any required values manually. If one or more
233 options are specified, non-interactive configuration
234 is started, and any omitted values are defaulted.
236 Arguments with a single \"-\" symbol, as in
237 InspIRCd 1.0.x, are also allowed.
239 --disable-interactive Sets no options intself, but
240 will disable any interactive prompting.
241 --update Update makefiles and dependencies
242 --modupdate Detect new modules and write makefiles
243 --svnupdate {--rebuild} Update working copy via subversion
244 {and optionally rebuild if --rebuild
246 --clean Remove .config.cache file and go interactive
247 --enable-gnutls Enable GnuTLS module [no]
248 --enable-openssl Enable OpenSSL module [no]
249 --with-nick-length=[n] Specify max. nick length [32]
250 --with-channel-length=[n] Specify max. channel length [64]
251 --with-max-clients=[n] Specify maximum number of users
252 which may connect locally
253 --enable-optimization=[n] Optimize using -O[n] gcc flag
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 --enable-ipv6 Build ipv6 native InspIRCd [no]
261 --enable-remote-ipv6 Build with ipv6 support for remote
262 servers on the network [yes]
263 --disable-remote-ipv6 Do not allow remote ipv6 servers [not set]
264 --with-cc=[filename] Use an alternative g++ binary to
266 --with-ident-length=[n] Specify max length of ident [12]
267 --with-quit-length=[n] Specify max length of quit [200]
268 --with-topic-length=[n] Specify max length of topic [350]
269 --with-kick-length=[n] Specify max length of kick [200]
270 --with-gecos-length=[n] Specify max length of gecos [150]
271 --with-away-length=[n] Specify max length of away [150]
272 --with-max-modes=[n] Specify max modes per line which
274 --with-maxbuf=[n] Change the per message buffer size [512]
275 DO NOT ALTER THIS OPTION WITHOUT GOOD REASON
276 AS IT *WILL* BREAK CLIENTS!!!
277 --prefix=[directory] Base directory to install into (if defined,
278 can automatically define config, module, bin
279 and library dirs as subdirectories of prefix)
281 --config-dir=[directory] Config file directory for config and SSL certs
283 --module-dir=[directory] Modules directory for loadable modules
285 --binary-dir=[directory] Binaries directory for core binary
287 --library-dir=[directory] Library directory for core libraries
289 --help Show this help text and exit