]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - scripts/www/build-cfg-help.pl
Docs: update cfgman tarball automation (#1546)
[thirdparty/squid.git] / scripts / www / build-cfg-help.pl
index e15ead1575c636a508af1f9d9eb62f5668d5537c..d908bef2ef78fa033973cd21eee77239bc65bae8 100755 (executable)
@@ -247,6 +247,7 @@ sub update_defaults()
     }
 }
 
+my @ifelse = ();
 while (<>) {
     chomp;
     last if (/^EOF$/);
@@ -267,8 +268,28 @@ while (<>) {
         $data->{'default_doc'} = "";
         $data->{'default_if_none'} = "";
 
-        print "DEBUG: new option: $name\n" if $verbose;
+        print "DEBUG: line $.: new option: $name\n" if $verbose;
         next;
+    } elsif ($_ =~ /^IF (.*)$/) {
+        my $cond = $1;
+        push(@ifelse, "$.: $1");
+        if (! defined $defines{$1}) {
+            print "NOTICE: line $.: unknown ./configure option '$1'\n";
+        } else {
+            $cond = $defines{$1};
+        }
+        if ($state eq "doc") {
+            $data->{"doc"} .= "if " . $cond . "\n";
+        } elsif ($state eq "comment") {
+            $comment .= "if " . $cond . "\n";
+        }
+    } elsif ($_ =~ /^ENDIF$/) {
+        pop(@ifelse);
+        if ($state eq "doc") {
+            $data->{"doc"} .= "endif\n";
+        } elsif ($state eq "comment") {
+            $comment .= "endif\n";
+        }
     } elsif ($_ =~ /^COMMENT: (.*)$/) {
         $data->{"comment"} = $1;
     } elsif ($_ =~ /^TYPE: (.*)$/) {
@@ -280,6 +301,11 @@ while (<>) {
         } else {
             $data->{"default"} .= "$name $1\n";
         }
+    } elsif ($_ =~ /^POSTSCRIPTUM: (.*)$/) {
+        if ($data->{"default"} eq "none") {
+            $data->{"default"} = "";
+        }
+        $data->{"default"} .= "$name $1\n";
     } elsif ($_ =~ /^DEFAULT_DOC: (.*)$/) {
         $data->{"default_doc"} .= "$1\n";
     } elsif ($_ =~ /^DEFAULT_IF_NONE: (.*)$/) {
@@ -323,9 +349,12 @@ while (<>) {
     } elsif (/^#/) {
         next;
     } elsif ($_ ne "") {
-        print "NOTICE: unknown line '$_'\n";
+        print "NOTICE: line $.: unknown line '$_'\n";
     }
 }
+foreach my $condition (@ifelse) {
+    print "ERROR: missing ENDIF to match $condition\n";
+}
 end_options;
 print $index "<p><a href=\"index_all.html\">Alphabetic index</a></p>\n" if $format eq "splithtml";
 print $index "<p><a href=\"#index\">Alphabetic index</a></p>\n" if $format eq "singlehtml";