1 package make::configure;
5 @EXPORT = qw(promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies resolve_directory yesno showhelp);
10 my ($flag,$prompt) = @_;
11 print "$prompt [\033[1;32m$main::config{$flag}\033[0m] -> ";
12 chomp($tmp = <STDIN>);
13 if ($tmp eq "") { $tmp = $main::config{$flag} }
14 if (($tmp eq "") || ($tmp =~ /^y/i))
16 $main::config{$flag} = "y";
20 $main::config{$flag} = "n";
31 $ret = File::Spec->rel2abs($_[0]);
41 my $data = `svn info`;
48 $data =~ /Revision: (\d+)/;
57 sub getcompilerflags {
61 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
63 return translate_functions($1,$file);
74 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
76 return translate_functions($1,$file);
87 if ($_ =~ /^\/\* \$ModDep: (.+) \*\/$/) {
89 return translate_functions($1,$file);
100 print "Detecting modules ";
101 opendir(DIRHANDLE, "src/modules");
102 foreach $name (sort readdir(DIRHANDLE))
104 if ($name =~ /^m_(.+)\.cpp$/)
107 if ($mod !~ /_static$/)
109 $main::modlist[$i++] = $mod;
115 print "\nOk, $i modules.\n";
118 sub promptnumeric($$)
121 my ($prompt, $configitem) = @_;
124 print "Please enter the maximum $prompt?\n";
125 print "[\033[1;32m$main::config{$configitem}\033[0m] -> ";
126 chomp($var = <STDIN>);
129 $var = $main::config{$configitem};
131 if ($var =~ /^\d+$/) {
132 # We don't care what the number is, set it and be on our way.
133 $main::config{$configitem} = $var;
137 print "You must enter a number in this field. Please try again.\n\n";
144 print "\n\033[1;32mPre-build configuration is complete!\033[0m\n\n";
145 print "\033[0mBase install path:\033[1;32m\t\t$main::config{BASE_DIR}\033[0m\n";
146 print "\033[0mConfig path:\033[1;32m\t\t\t$main::config{CONFIG_DIR}\033[0m\n";
147 print "\033[0mModule path:\033[1;32m\t\t\t$main::config{MODULE_DIR}\033[0m\n";
148 print "\033[0mLibrary path:\033[1;32m\t\t\t$main::config{LIBRARY_DIR}\033[0m\n";
149 print "\033[0mMax connections:\033[1;32m\t\t$main::config{MAX_CLIENT}\033[0m\n";
150 print "\033[0mMax User Channels:\033[1;32m\t\t$main::config{MAX_CHANNE}\033[0m\n";
151 print "\033[0mMax Oper Channels:\033[1;32m\t\t$main::config{MAX_OPERCH}\033[0m\n";
152 print "\033[0mMax nickname length:\033[1;32m\t\t$main::config{NICK_LENGT}\033[0m\n";
153 print "\033[0mMax channel length:\033[1;32m\t\t$main::config{CHAN_LENGT}\033[0m\n";
154 print "\033[0mMax mode length:\033[1;32m\t\t$main::config{MAXI_MODES}\033[0m\n";
155 print "\033[0mMax ident length:\033[1;32m\t\t$main::config{MAX_IDENT}\033[0m\n";
156 print "\033[0mMax quit length:\033[1;32m\t\t$main::config{MAX_QUIT}\033[0m\n";
157 print "\033[0mMax topic length:\033[1;32m\t\t$main::config{MAX_TOPIC}\033[0m\n";
158 print "\033[0mMax kick length:\033[1;32m\t\t$main::config{MAX_KICK}\033[0m\n";
159 print "\033[0mMax name length:\033[1;32m\t\t$main::config{MAX_GECOS}\033[0m\n";
160 print "\033[0mMax away length:\033[1;32m\t\t$main::config{MAX_AWAY}\033[0m\n";
161 print "\033[0mGCC Version Found:\033[1;32m\t\t$main::config{GCCVER}.x\033[0m\n";
162 print "\033[0mCompiler program:\033[1;32m\t\t$main::config{CC}\033[0m\n";
163 print "\033[0mStatic modules:\033[1;32m\t\t\t$main::config{STATIC_LINK}\033[0m\n";
164 print "\033[0mIPv6 Support:\033[1;32m\t\t\t$main::config{IPV6}\033[0m\n";
165 print "\033[0mIPv6 to IPv4 Links:\033[1;32m\t\t$main::config{SUPPORT_IP6LINKS}\033[0m\n";
166 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$main::config{USE_GNUTLS}\033[0m\n";
167 print "\033[0mOpenSSL Support:\033[1;32m\t\t$main::config{USE_OPENSSL}\033[0m\n\n";
189 print "Usage: configure [options]
191 *** NOTE: NON-INTERACTIVE CONFIGURE IS *NOT* SUPPORTED BY THE ***
192 *** INSPIRCD DEVELOPMENT TEAM. DO NOT ASK FOR HELP REGARDING ***
193 *** NON-INTERACTIVE CONFIGURE ON THE FORUMS OR ON IRC! ***
195 Options: [defaults in brackets after descriptions]
197 When no options are specified, interactive
198 configuration is started and you must specify
199 any required values manually. If one or more
200 options are specified, non-interactive configuration
201 is started, and any omitted values are defaulted.
203 Arguments with a single \"-\" symbol, as in
204 InspIRCd 1.0.x, are also allowed.
206 --disable-interactive Sets no options intself, but
207 will disable any interactive prompting.
208 --update Update makefiles and dependencies
209 --modupdate Detect new modules and write makefiles
210 --svnupdate {--rebuild} Update working copy via subversion
211 {and optionally rebuild it if --update
212 if --rebuild is also specified}
213 --clean Remove .config.cache file and go interactive
214 --enable-gnutls Enable GnuTLS module [no]
215 --enable-openssl Enable OpenSSL module [no]
216 --with-nick-length=[n] Specify max. nick length [32]
217 --with-channel-length=[n] Specify max. channel length [64]
218 --with-max-channels=[n] Specify max. number of channels
219 a normal user may join [20]
220 --with-max-oper-channels=[n] Specify max. number of channels
221 an irc operator may join [60]
222 --with-max-clients=[n] Specify maximum number of users
223 which may connect locally
224 --enable-optimization=[n] Optimize using -O[n] gcc flag
225 --enable-epoll Enable epoll() where supported [set]
226 --enable-kqueue Enable kqueue() where supported [set]
227 --disable-epoll Do not enable epoll(), fall back
228 to select() [not set]
229 --disable-kqueue Do not enable kqueue(), fall back
230 to select() [not set]
231 --enable-ipv6 Build ipv6 native InspIRCd [no]
232 --enable-remote-ipv6 Build with ipv6 support for remote
233 servers on the network [yes]
234 --disable-remote-ipv6 Do not allow remote ipv6 servers [not set]
235 --with-cc=[filename] Use an alternative g++ binary to
237 --with-ident-length=[n] Specify max length of ident [12]
238 --with-quit-length=[n] Specify max length of quit [200]
239 --with-topic-length=[n] Specify max length of topic [350]
240 --with-kick-length=[n] Specify max length of kick [200]
241 --with-gecos-length=[n] Specify max length of gecos [150]
242 --with-away-length=[n] Specify max length of away [150]
243 --with-max-modes=[n] Specify max modes per line which
245 --prefix=[directory] Base directory to install into (if defined,
246 can automatically define config, module, bin
247 and library dirs as subdirectories of prefix)
249 --config-dir=[directory] Config file directory for config and SSL certs
251 --module-dir=[directory] Modules directory for loadable modules
253 --binary-dir=[directory] Binaries directory for core binary
255 --library-dir=[directory] Library directory for core libraries
257 --help Show this help text and exit