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 getmodversion 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 2>/dev/null`;
62 $data = `git describe --tags 2>/dev/null`;
68 chomp $data; # remove \n
71 $data =~ /Revision: (\d+)/;
80 sub getcompilerflags {
82 open(FLAGS, $file) or return "";
84 if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
85 my $x = translate_functions($1, $file);
97 open(FLAGS, $file) or return "";
99 if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
100 my $x = translate_functions($1, $file);
110 sub getdependencies {
112 open(FLAGS, $file) or return "";
114 if ($_ =~ /^\/\* \$ModDep: (.+) \*\/$/) {
115 my $x = translate_functions($1, $file);
127 open(FLAGS, $file) or return "";
129 if ($_ =~ /^\/\* \$ModVersion: (.+) \*\/$/) {
130 my $x = translate_functions($1, $file);
142 open(FLAGS, $file) or return "";
144 if ($_ =~ /^\/\* \$NoPedantic \*\/$/) {
145 my $x = translate_functions($_, $file);
158 print "Detecting modules ";
159 opendir(DIRHANDLE, "src/modules") or die("WTF, missing src/modules!");
160 foreach my $name (sort readdir(DIRHANDLE))
162 if ($name =~ /^m_(.+)\.cpp$/)
165 $main::modlist[$i++] = $mod;
170 print "\nOk, $i modules.\n";
173 sub promptnumeric($$)
176 my ($prompt, $configitem) = @_;
179 print "Please enter the maximum $prompt?\n";
180 print "[\e[1;32m$main::config{$configitem}\e[0m] -> ";
181 chomp(my $var = <STDIN>);
184 $var = $main::config{$configitem};
186 if ($var =~ /^\d+$/) {
187 # We don't care what the number is, set it and be on our way.
188 $main::config{$configitem} = $var;
192 print "You must enter a number in this field. Please try again.\n\n";
197 sub promptstring_s($$)
199 my ($prompt,$default) = @_;
202 print "[\e[1;32m$default\e[0m] -> ";
203 chomp($var = <STDIN>);
204 $var = $default if $var eq "";
211 print "\n\e[1;32mPre-build configuration is complete!\e[0m\n\n";
212 print "\e[0mBase install path:\e[1;32m\t\t$main::config{BASE_DIR}\e[0m\n";
213 print "\e[0mConfig path:\e[1;32m\t\t\t$main::config{CONFIG_DIR}\e[0m\n";
214 print "\e[0mModule path:\e[1;32m\t\t\t$main::config{MODULE_DIR}\e[0m\n";
215 print "\e[0mLibrary path:\e[1;32m\t\t\t$main::config{LIBRARY_DIR}\e[0m\n";
216 print "\e[0mGCC Version Found:\e[1;32m\t\t$main::config{GCCVER}.$main::config{GCCMINOR}\e[0m\n";
217 print "\e[0mCompiler program:\e[1;32m\t\t$main::config{CC}\e[0m\n";
218 print "\e[0mIPv6 Support:\e[1;32m\t\t\t$main::config{IPV6}\e[0m\n";
219 print "\e[0mIPv6 to IPv4 Links:\e[1;32m\t\t$main::config{SUPPORT_IP6LINKS}\e[0m\n";
220 print "\e[0mGnuTLS Support:\e[1;32m\t\t\t$main::config{USE_GNUTLS}\e[0m\n";
221 print "\e[0mOpenSSL Support:\e[1;32m\t\t$main::config{USE_OPENSSL}\e[0m\n\n";
222 print "\e[1;32mImportant note: The maximum length values are now configured in the\e[0m\n";
223 print "\e[1;32m configuration file, not in ./configure! See the <limits>\e[0m\n";
224 print "\e[1;32m tag in the configuration file for more information.\e[0m\n\n";
245 chomp(my $PWD = `pwd`);
246 print "Usage: configure [options]
248 *** NOTE: NON-INTERACTIVE CONFIGURE IS *NOT* SUPPORTED BY THE ***
249 *** INSPIRCD DEVELOPMENT TEAM. DO NOT ASK FOR HELP REGARDING ***
250 *** NON-INTERACTIVE CONFIGURE ON THE FORUMS OR ON IRC! ***
252 Options: [defaults in brackets after descriptions]
254 When no options are specified, interactive
255 configuration is started and you must specify
256 any required values manually. If one or more
257 options are specified, non-interactive configuration
258 is started, and any omitted values are defaulted.
260 Arguments with a single \"-\" symbol, as in
261 InspIRCd 1.0.x, are also allowed.
263 --disable-interactive Sets no options intself, but
264 will disable any interactive prompting.
265 --disable-rpath Disable runtime paths. DO NOT USE UNLESS
266 YOU KNOW WHAT YOU ARE DOING!
267 --update Update makefiles and dependencies
268 --modupdate Detect new modules and write makefiles
269 --svnupdate {--rebuild} Update working copy via subversion
270 {and optionally rebuild if --rebuild
272 --clean Remove .config.cache file and go interactive
273 --enable-gnutls Enable GnuTLS module [no]
274 --enable-openssl Enable OpenSSL module [no]
275 --enable-optimization=[n] Optimize using -O[n] gcc flag
276 --enable-epoll Enable epoll() where supported [set]
277 --enable-kqueue Enable kqueue() where supported [set]
278 --disable-epoll Do not enable epoll(), fall back
279 to select() [not set]
280 --disable-kqueue Do not enable kqueue(), fall back
281 to select() [not set]
282 --enable-ipv6 Build ipv6 native InspIRCd [no]
283 --enable-remote-ipv6 Build with ipv6 support for remote
284 servers on the network [yes]
285 --disable-remote-ipv6 Do not allow remote ipv6 servers [not set]
286 --with-cc=[filename] Use an alternative g++ binary to
288 --with-maxbuf=[n] Change the per message buffer size [512]
289 DO NOT ALTER THIS OPTION WITHOUT GOOD REASON
290 AS IT *WILL* BREAK CLIENTS!!!
291 --prefix=[directory] Base directory to install into (if defined,
292 can automatically define config, module, bin
293 and library dirs as subdirectories of prefix)
295 --config-dir=[directory] Config file directory for config and SSL certs
297 --module-dir=[directory] Modules directory for loadable modules
299 --binary-dir=[directory] Binaries directory for core binary
301 --library-dir=[directory] Library directory for core libraries
303 --list-extras Show current status of extra modules
304 --enable-extras=[extras] Enable the specified list of extras
305 --disable-extras=[extras] Disable the specified list of extras
306 --help Show this help text and exit