2 # Copyright 2002-2007 The ChatSpike Development Team
3 # <brain@chatspike.net>
4 # <Craig@chatspike.net>
6 # Licensed under GPL, please see the COPYING file
10 package make::configure;
11 use Exporter 'import';
14 @EXPORT = qw(promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies resolve_directory yesno showhelp);
19 my ($flag,$prompt) = @_;
20 print "$prompt [\033[1;32m$main::config{$flag}\033[0m] -> ";
21 chomp($tmp = <STDIN>);
22 if ($tmp eq "") { $tmp = $main::config{$flag} }
23 if (($tmp eq "") || ($tmp =~ /^y/i))
25 $main::config{$flag} = "y";
29 $main::config{$flag} = "n";
40 $ret = File::Spec->rel2abs($_[0]);
50 my $data = `svn info`;
57 $data =~ /Revision: (\d+)/;
66 sub getcompilerflags {
70 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
72 return translate_functions($1,$file);
83 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
85 return translate_functions($1,$file);
96 if ($_ =~ /^\/\* \$ModDep: (.+) \*\/$/) {
98 return translate_functions($1,$file);
109 print "Detecting modules ";
110 opendir(DIRHANDLE, "src/modules");
111 foreach $name (sort readdir(DIRHANDLE))
113 if ($name =~ /^m_(.+)\.cpp$/)
116 if ($mod !~ /_static$/)
118 $main::modlist[$i++] = $mod;
124 print "\nOk, $i modules.\n";
127 sub promptnumeric($$)
130 my ($prompt, $configitem) = @_;
133 print "Please enter the maximum $prompt?\n";
134 print "[\033[1;32m$main::config{$configitem}\033[0m] -> ";
135 chomp($var = <STDIN>);
138 $var = $main::config{$configitem};
140 if ($var =~ /^\d+$/) {
141 # We don't care what the number is, set it and be on our way.
142 $main::config{$configitem} = $var;
146 print "You must enter a number in this field. Please try again.\n\n";
153 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
154 print "\033[0mBase install path:\033[1;32m\t\t$main::config{BASE_DIR}\033[0m\n";
155 print "\033[0mConfig path:\033[1;32m\t\t\t$main::config{CONFIG_DIR}\033[0m\n";
156 print "\033[0mModule path:\033[1;32m\t\t\t$main::config{MODULE_DIR}\033[0m\n";
157 print "\033[0mLibrary path:\033[1;32m\t\t\t$main::config{LIBRARY_DIR}\033[0m\n";
158 print "\033[0mMax connections:\033[1;32m\t\t$main::config{MAX_CLIENT}\033[0m\n";
159 print "\033[0mMax nickname length:\033[1;32m\t\t$main::config{NICK_LENGT}\033[0m\n";
160 print "\033[0mMax channel length:\033[1;32m\t\t$main::config{CHAN_LENGT}\033[0m\n";
161 print "\033[0mMax mode length:\033[1;32m\t\t$main::config{MAXI_MODES}\033[0m\n";
162 print "\033[0mMax ident length:\033[1;32m\t\t$main::config{MAX_IDENT}\033[0m\n";
163 print "\033[0mMax quit length:\033[1;32m\t\t$main::config{MAX_QUIT}\033[0m\n";
164 print "\033[0mMax topic length:\033[1;32m\t\t$main::config{MAX_TOPIC}\033[0m\n";
165 print "\033[0mMax kick length:\033[1;32m\t\t$main::config{MAX_KICK}\033[0m\n";
166 print "\033[0mMax name length:\033[1;32m\t\t$main::config{MAX_GECOS}\033[0m\n";
167 print "\033[0mMax away length:\033[1;32m\t\t$main::config{MAX_AWAY}\033[0m\n";
168 print "\033[0mGCC Version Found:\033[1;32m\t\t$main::config{GCCVER}.x\033[0m\n";
169 print "\033[0mCompiler program:\033[1;32m\t\t$main::config{CC}\033[0m\n";
170 print "\033[0mStatic modules:\033[1;32m\t\t\t$main::config{STATIC_LINK}\033[0m\n";
171 print "\033[0mIPv6 Support:\033[1;32m\t\t\t$main::config{IPV6}\033[0m\n";
172 print "\033[0mIPv6 to IPv4 Links:\033[1;32m\t\t$main::config{SUPPORT_IP6LINKS}\033[0m\n";
173 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$main::config{USE_GNUTLS}\033[0m\n";
174 print "\033[0mOpenSSL Support:\033[1;32m\t\t$main::config{USE_OPENSSL}\033[0m\n\n";
196 print "Usage: configure [options]
198 *** NOTE: NON-INTERACTIVE CONFIGURE IS *NOT* SUPPORTED BY THE ***
199 *** INSPIRCD DEVELOPMENT TEAM. DO NOT ASK FOR HELP REGARDING ***
200 *** NON-INTERACTIVE CONFIGURE ON THE FORUMS OR ON IRC! ***
202 Options: [defaults in brackets after descriptions]
204 When no options are specified, interactive
205 configuration is started and you must specify
206 any required values manually. If one or more
207 options are specified, non-interactive configuration
208 is started, and any omitted values are defaulted.
210 Arguments with a single \"-\" symbol, as in
211 InspIRCd 1.0.x, are also allowed.
213 --disable-interactive Sets no options intself, but
214 will disable any interactive prompting.
215 --update Update makefiles and dependencies
216 --modupdate Detect new modules and write makefiles
217 --svnupdate {--rebuild} Update working copy via subversion
218 {and optionally rebuild if --rebuild
220 --clean Remove .config.cache file and go interactive
221 --enable-gnutls Enable GnuTLS module [no]
222 --enable-openssl Enable OpenSSL module [no]
223 --with-nick-length=[n] Specify max. nick length [32]
224 --with-channel-length=[n] Specify max. channel length [64]
225 --with-max-clients=[n] Specify maximum number of users
226 which may connect locally
227 --enable-optimization=[n] Optimize using -O[n] gcc flag
228 --enable-epoll Enable epoll() where supported [set]
229 --enable-kqueue Enable kqueue() where supported [set]
230 --disable-epoll Do not enable epoll(), fall back
231 to select() [not set]
232 --disable-kqueue Do not enable kqueue(), fall back
233 to select() [not set]
234 --enable-ipv6 Build ipv6 native InspIRCd [no]
235 --enable-remote-ipv6 Build with ipv6 support for remote
236 servers on the network [yes]
237 --disable-remote-ipv6 Do not allow remote ipv6 servers [not set]
238 --with-cc=[filename] Use an alternative g++ binary to
240 --with-ident-length=[n] Specify max length of ident [12]
241 --with-quit-length=[n] Specify max length of quit [200]
242 --with-topic-length=[n] Specify max length of topic [350]
243 --with-kick-length=[n] Specify max length of kick [200]
244 --with-gecos-length=[n] Specify max length of gecos [150]
245 --with-away-length=[n] Specify max length of away [150]
246 --with-max-modes=[n] Specify max modes per line which
248 --prefix=[directory] Base directory to install into (if defined,
249 can automatically define config, module, bin
250 and library dirs as subdirectories of prefix)
252 --config-dir=[directory] Config file directory for config and SSL certs
254 --module-dir=[directory] Modules directory for loadable modules
256 --binary-dir=[directory] Binaries directory for core binary
258 --library-dir=[directory] Library directory for core libraries
260 --help Show this help text and exit