]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - make/utilities.pm
Also redirect errors to /dev/null to avoid messy output on VCS that aren't installed...
[user/henk/code/inspircd.git] / make / utilities.pm
index 9b52e4e944ae1b81d6249ff9f961f8ddc95ce339..fdc4c4c7bdc1932e2bfc2452ab4854fb5e092be2 100644 (file)
@@ -30,6 +30,7 @@ our @EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs pk
 # \e[1;32msrc/Makefile\e[0m
 
 my %already_added = ();
+my $if_skip_lines = 0;
 
 sub promptstring($$$$$)
 {
@@ -113,7 +114,6 @@ sub pkgconfig_get_include_dirs($$$;$)
        my $v = `pkg-config --modversion $packagename 2>/dev/null`;
        my $ret = `pkg-config --cflags $packagename 2>/dev/null`;
        my $foo = "";
-
        if ((!defined $v) || ($v eq ""))
        {
                $foo = `locate "$headername" | head -n 1`;
@@ -320,6 +320,65 @@ sub translate_functions($$)
                {
                        die "Developers should no longer use backticks in configuration macros. Please use exec() and eval() macros instead. Offending line: $line (In module: $module)";
                }
+
+               if ($line =~ /ifuname\(\!"(\w+)"\)/)
+               {
+                       my $uname = $1;
+                       if ($uname eq $^O)
+                       {
+                               $line = "";
+                               return "";
+                       }
+
+                       $line =~ s/ifuname\(\!"(.+?)"\)//;
+               }
+
+               if ($line =~ /ifuname\("(\w+)"\)/)
+               {
+                       my $uname = $1;
+                       if ($uname ne $^O)
+                       {
+                               $line = "";
+                               return "";
+                       }
+
+                       $line =~ s/ifuname\("(.+?)"\)//;
+               }
+
+               if ($line =~ /if\("(\w+)"\)/)
+               {
+                       if (defined $main::config{$1})
+                       {
+                               if (($main::config{$1} !~ /y/i) and ($main::config{$1} ne "1"))
+                               {
+                                       $line = "";
+                                       return "";
+                               }
+                       }
+
+                       $line =~ s/if\("(.+?)"\)//;
+               }
+               if ($line =~ /if\(\!"(\w+)"\)/)
+               {
+                       if (!exists $main::config{$1})
+                       {
+                               $line = "";
+                               return "";
+                       }
+                       else
+                       {
+                               if (defined $1)
+                               {
+                                       if (exists ($main::config{$1}) and (($main::config{$1} =~ /y/i) or ($main::config{$1} eq "1")))
+                                       {
+                                               $line = "";
+                                               return "";
+                                       }
+                               }
+                       }
+
+                       $line =~ s/if\(\!"(.+?)"\)//;
+               }
                while ($line =~ /exec\("(.+?)"\)/)
                {
                        print "Executing program for module \e[1;32m$module\e[0m ... \e[1;32m$1\e[0m\n";
@@ -386,7 +445,7 @@ sub translate_functions($$)
        if ($@)
        {
                my $err = $@;
-               $err =~ s/at .+? line \d+.*//g;
+               #$err =~ s/at .+? line \d+.*//g;
                print "\n\nConfiguration failed. The following error occured:\n\n$err\n";
                exit;
        }