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 nickname length:\033[1;32m\t\t$main::config{NICK_LENGT}\033[0m\n";
151 print "\033[0mMax channel length:\033[1;32m\t\t$main::config{CHAN_LENGT}\033[0m\n";
152 print "\033[0mMax mode length:\033[1;32m\t\t$main::config{MAXI_MODES}\033[0m\n";
153 print "\033[0mMax ident length:\033[1;32m\t\t$main::config{MAX_IDENT}\033[0m\n";
154 print "\033[0mMax quit length:\033[1;32m\t\t$main::config{MAX_QUIT}\033[0m\n";
155 print "\033[0mMax topic length:\033[1;32m\t\t$main::config{MAX_TOPIC}\033[0m\n";
156 print "\033[0mMax kick length:\033[1;32m\t\t$main::config{MAX_KICK}\033[0m\n";
157 print "\033[0mMax name length:\033[1;32m\t\t$main::config{MAX_GECOS}\033[0m\n";
158 print "\033[0mMax away length:\033[1;32m\t\t$main::config{MAX_AWAY}\033[0m\n";
159 print "\033[0mGCC Version Found:\033[1;32m\t\t$main::config{GCCVER}.x\033[0m\n";
160 print "\033[0mCompiler program:\033[1;32m\t\t$main::config{CC}\033[0m\n";
161 print "\033[0mStatic modules:\033[1;32m\t\t\t$main::config{STATIC_LINK}\033[0m\n";
162 print "\033[0mIPv6 Support:\033[1;32m\t\t\t$main::config{IPV6}\033[0m\n";
163 print "\033[0mIPv6 to IPv4 Links:\033[1;32m\t\t$main::config{SUPPORT_IP6LINKS}\033[0m\n";
164 print "\033[0mGnuTLS Support:\033[1;32m\t\t\t$main::config{USE_GNUTLS}\033[0m\n";
165 print "\033[0mOpenSSL Support:\033[1;32m\t\t$main::config{USE_OPENSSL}\033[0m\n\n";
187 print "Usage: configure [options]
189 *** NOTE: NON-INTERACTIVE CONFIGURE IS *NOT* SUPPORTED BY THE ***
190 *** INSPIRCD DEVELOPMENT TEAM. DO NOT ASK FOR HELP REGARDING ***
191 *** NON-INTERACTIVE CONFIGURE ON THE FORUMS OR ON IRC! ***
193 Options: [defaults in brackets after descriptions]
195 When no options are specified, interactive
196 configuration is started and you must specify
197 any required values manually. If one or more
198 options are specified, non-interactive configuration
199 is started, and any omitted values are defaulted.
201 Arguments with a single \"-\" symbol, as in
202 InspIRCd 1.0.x, are also allowed.
204 --disable-interactive Sets no options intself, but
205 will disable any interactive prompting.
206 --update Update makefiles and dependencies
207 --modupdate Detect new modules and write makefiles
208 --svnupdate {--rebuild} Update working copy via subversion
209 {and optionally rebuild if --rebuild
211 --clean Remove .config.cache file and go interactive
212 --enable-gnutls Enable GnuTLS module [no]
213 --enable-openssl Enable OpenSSL module [no]
214 --with-nick-length=[n] Specify max. nick length [32]
215 --with-channel-length=[n] Specify max. channel length [64]
216 --with-max-clients=[n] Specify maximum number of users
217 which may connect locally
218 --enable-optimization=[n] Optimize using -O[n] gcc flag
219 --enable-epoll Enable epoll() where supported [set]
220 --enable-kqueue Enable kqueue() where supported [set]
221 --disable-epoll Do not enable epoll(), fall back
222 to select() [not set]
223 --disable-kqueue Do not enable kqueue(), fall back
224 to select() [not set]
225 --enable-ipv6 Build ipv6 native InspIRCd [no]
226 --enable-remote-ipv6 Build with ipv6 support for remote
227 servers on the network [yes]
228 --disable-remote-ipv6 Do not allow remote ipv6 servers [not set]
229 --with-cc=[filename] Use an alternative g++ binary to
231 --with-ident-length=[n] Specify max length of ident [12]
232 --with-quit-length=[n] Specify max length of quit [200]
233 --with-topic-length=[n] Specify max length of topic [350]
234 --with-kick-length=[n] Specify max length of kick [200]
235 --with-gecos-length=[n] Specify max length of gecos [150]
236 --with-away-length=[n] Specify max length of away [150]
237 --with-max-modes=[n] Specify max modes per line which
239 --prefix=[directory] Base directory to install into (if defined,
240 can automatically define config, module, bin
241 and library dirs as subdirectories of prefix)
243 --config-dir=[directory] Config file directory for config and SSL certs
245 --module-dir=[directory] Modules directory for loadable modules
247 --binary-dir=[directory] Binaries directory for core binary
249 --library-dir=[directory] Library directory for core libraries
251 --help Show this help text and exit