summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure109
-rw-r--r--make/configure.pm131
2 files changed, 130 insertions, 110 deletions
diff --git a/configure b/configure
index 1ea43127d..6f5f222e7 100755
--- a/configure
+++ b/configure
@@ -256,8 +256,6 @@ if (defined $opt_away)
$config{MAX_AWAY} = $opt_away;
}
-$no_svn = 0;
-
$config{HAS_OPENSSL} =~ /OpenSSL ([-[:digit:].]+)([a-z])?(\-[a-z][0-9])? (\w{3}|[0-9]+) (\w{3}|[0-9]+) [0-9]{4}/;
$config{HAS_OPENSSL} = $1;
@@ -886,55 +884,6 @@ sub getosflags {
return $config{OSNAME};
}
-sub is_dir {
- my ($path) = @_;
- if (chdir($path)) {
- chdir($this);
- return 1;
- } else {
- # Just in case..
- chdir($this);
- return 0;
- }
-}
-
-sub getmodules {
- my $i = 0;
- print "Detecting modules ";
- opendir(DIRHANDLE, "src/modules");
- foreach $name (sort readdir(DIRHANDLE)) {
- if ($name =~ /^m_(.+)\.cpp$/)
- {
- $mod = $1;
- if ($mod !~ /_static$/) {
- $modlist[$i++] = $mod;
- print ".";
- }
- }
- }
- closedir(DIRHANDLE);
- print "\nOk, $i modules.\n";
-}
-
-sub getrevision {
- if ($no_svn) {
- return "0";
- }
- my $data = `svn info`;
-
- if ($data eq "") {
- $no_svn = 1;
- $rev = "0";
- return $rev;
- }
- $data =~ /Revision: (\d+)/;
- my $rev = $1;
- if (!defined($rev)) {
- $rev = "0";
- }
- return $rev;
-}
-
sub writefiles {
my($writeheader) = @_;
# First File.. inspircd_config.h
@@ -1134,64 +1083,6 @@ EOF
}
}
-sub getcompilerflags {
- my ($file) = @_;
- open(FLAGS, $file);
- while (<FLAGS>) {
- if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
- close(FLAGS);
- return translate_functions($1,$file);
- }
- }
- close(FLAGS);
- return undef;
-}
-
-sub getlinkerflags {
- my ($file) = @_;
- open(FLAGS, $file);
- while (<FLAGS>) {
- if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
- close(FLAGS);
- return translate_functions($1,$file);
- }
- }
- close(FLAGS);
- return undef;
-}
-
-sub getdependencies {
- my ($file) = @_;
- open(FLAGS, $file);
- while (<FLAGS>) {
- if ($_ =~ /^\/\* \$ModDep: (.+) \*\/$/) {
- close(FLAGS);
- return translate_functions($1,$file);
- }
- }
- close(FLAGS);
- return undef;
-}
-
-sub resolve_directory {
- use File::Spec;
- return File::Spec->rel2abs($_[0]);
-}
-
-sub yesno {
- my ($flag,$prompt) = @_;
- print "$prompt [\033[1;32m$config{$flag}\033[0m] -> ";
- chomp($tmp = <STDIN>);
- if ($tmp eq "") { $tmp = $config{$flag} }
-
- if (($tmp eq "") || ($tmp =~ /^y/i)) {
- $config{$flag} = "y";
- } else {
- $config{$flag} = "n";
- }
- return;
-}
-
sub write_static_modules_makefile {
# Modules Makefile..
print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
diff --git a/make/configure.pm b/make/configure.pm
index 223996305..11ff9be29 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -1,7 +1,119 @@
package make::configure;
use Exporter 'import';
use POSIX;
-@EXPORT = qw(promptnumeric dumphash);
+use make::utilities;
+@EXPORT = qw(promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies resolve_directory yesno);
+
+my $no_svn = 0;
+
+sub yesno {
+ my ($flag,$prompt) = @_;
+ print "$prompt [\033[1;32m$main::config{$flag}\033[0m] -> ";
+ chomp($tmp = <STDIN>);
+ if ($tmp eq "") { $tmp = $main::config{$flag} }
+ if (($tmp eq "") || ($tmp =~ /^y/i))
+ {
+ $main::config{$flag} = "y";
+ }
+ else
+ {
+ $main::config{$flag} = "n";
+ }
+ return;
+}
+
+sub resolve_directory
+{
+ my $ret = $_[0];
+ eval
+ {
+ use File::Spec;
+ $ret = File::Spec->rel2abs($_[0]);
+ };
+ return $ret;
+}
+
+sub getrevision {
+ if ($no_svn)
+ {
+ return "0";
+ }
+ my $data = `svn info`;
+ if ($data eq "")
+ {
+ $no_svn = 1;
+ $rev = "0";
+ return $rev;
+ }
+ $data =~ /Revision: (\d+)/;
+ my $rev = $1;
+ if (!defined($rev))
+ {
+ $rev = "0";
+ }
+ return $rev;
+}
+
+sub getcompilerflags {
+ my ($file) = @_;
+ open(FLAGS, $file);
+ while (<FLAGS>) {
+ if ($_ =~ /^\/\* \$CompileFlags: (.+) \*\/$/) {
+ close(FLAGS);
+ return translate_functions($1,$file);
+ }
+ }
+ close(FLAGS);
+ return undef;
+}
+
+sub getlinkerflags {
+ my ($file) = @_;
+ open(FLAGS, $file);
+ while (<FLAGS>) {
+ if ($_ =~ /^\/\* \$LinkerFlags: (.+) \*\/$/) {
+ close(FLAGS);
+ return translate_functions($1,$file);
+ }
+ }
+ close(FLAGS);
+ return undef;
+}
+
+sub getdependencies {
+ my ($file) = @_;
+ open(FLAGS, $file);
+ while (<FLAGS>) {
+ if ($_ =~ /^\/\* \$ModDep: (.+) \*\/$/) {
+ close(FLAGS);
+ return translate_functions($1,$file);
+ }
+ }
+ close(FLAGS);
+ return undef;
+}
+
+
+sub getmodules
+{
+ my $i = 0;
+ print "Detecting modules ";
+ opendir(DIRHANDLE, "src/modules");
+ foreach $name (sort readdir(DIRHANDLE))
+ {
+ if ($name =~ /^m_(.+)\.cpp$/)
+ {
+ $mod = $1;
+ if ($mod !~ /_static$/)
+ {
+ $main::modlist[$i++] = $mod;
+ print ".";
+ }
+ }
+ }
+ closedir(DIRHANDLE);
+ print "\nOk, $i modules.\n";
+}
sub promptnumeric($$)
{
@@ -55,4 +167,21 @@ sub dumphash()
print "\033[0mOpenSSL Support:\033[1;32m\t\t$main::config{USE_OPENSSL}\033[0m\n\n";
}
+sub is_dir
+{
+ my ($path) = @_;
+ if (chdir($path))
+ {
+ chdir($main::this);
+ return 1;
+ }
+ else
+ {
+ # Just in case..
+ chdir($main::this);
+ return 0;
+ }
+}
+
1;
+