X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=make%2Fconfigure.pm;h=bd3591e3ca3c798d5bbabc37fc4b25903897eadf;hb=8deed905c2f5231a212816034d30581aeac8f845;hp=0a7ea566a0e96406ea664a6aca1a31c1b3bb1eb1;hpb=021fe61d8589db751d32a50db650e1ea9177984c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/make/configure.pm b/make/configure.pm index 0a7ea566a..bd3591e3c 100644 --- a/make/configure.pm +++ b/make/configure.pm @@ -1,10 +1,9 @@ # # InspIRCd -- Internet Relay Chat Daemon # -# Copyright (C) 2012-2017 Peter Powell -# Copyright (C) 2008 Robin Burchell -# Copyright (C) 2007-2008 Craig Edwards -# Copyright (C) 2008 Thomas Stagner +# Copyright (C) 2013-2019 Sadie Powell +# Copyright (C) 2012 Robby +# Copyright (C) 2007-2008 Craig Edwards # Copyright (C) 2007 Dennis Friis # # This file is part of InspIRCd. InspIRCd is free software: you can @@ -273,10 +272,12 @@ sub parse_templates($$$) { chomp $line; # Does this line match a variable? - while ($line =~ /(@(\w+?)@)/) { - my ($variable, $name) = ($1, $2); + while ($line =~ /(@(\w+?)(?:\|(\w*))?@)/) { + my ($variable, $name, $default) = ($1, $2, $3); if (defined $settings{$name}) { $line =~ s/\Q$variable\E/$settings{$name}/; + } elsif (defined $default) { + $line =~ s/\Q$variable\E/$default/; } else { print_warning "unknown template variable '$name' in $_!"; last; @@ -284,21 +285,21 @@ sub parse_templates($$$) { } # Does this line match a directive? - if ($line =~ /^\s*%(\w+)\s+(.+)$/) { - if ($1 eq 'define') { - if ($settings{$2}) { - push @lines, "#define $2"; + if ($line =~ /^(\s*)%(\w+)\s+(.+)$/) { + if ($2 eq 'define') { + if ($settings{$3}) { + push @lines, "#$1define $3"; } else { - push @lines, "#undef $2"; + push @lines, "#$1undef $3"; } - } elsif ($1 eq 'mode') { - $mode = oct $2; - } elsif ($1 eq 'platform') { - push @platforms, $2; - } elsif ($1 eq 'target') { - push @targets, $2 + } elsif ($2 eq 'mode') { + $mode = oct $3; + } elsif ($2 eq 'platform') { + push @platforms, $3; + } elsif ($2 eq 'target') { + push @targets, $3 } else { - print_warning "unknown template command '$1' in $_!"; + print_warning "unknown template command '$2' in $_!"; push @lines, $line; } next;