diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2007-04-25 21:37:49 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2007-04-25 21:37:49 +0000 |
commit | 657ecf14acc58a6d345341a5e36411bde5be9cd9 (patch) | |
tree | 4f5a53feb9c26991d822e2e606de511f57e32be6 /install-win32/ifdef.pl | |
parent | Forgot to add changelog item about OpenVPN GUI being (diff) | |
download | openvpn-657ecf14acc58a6d345341a5e36411bde5be9cd9.tar.xz |
TAP driver now passes signing tests on Vista x64.
Added new settings to settings.in to better control
build process.
Removed some unneeded JYFIXMEs from source code.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@1874 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to '')
-rw-r--r-- | install-win32/ifdef.pl | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/install-win32/ifdef.pl b/install-win32/ifdef.pl new file mode 100644 index 0000000..d240ebb --- /dev/null +++ b/install-win32/ifdef.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +# Simple ifdef/else/endif processor. + +die "usage: ifdef [-C<command-prefix>] [-Dname ...] [control-file ...] " if (@ARGV[0] =~ /^(-h|--help)$/); + +%Parms = (); + +$pre = "!"; +while ($arg=shift(@ARGV)) { + if ($arg =~ /^-/) { + if ($arg =~ /^-D(\w+)$/) { + $Parms{$1} = 1; + } elsif ($arg =~ /-C(.*)$/) { + $pre = $1; + } else { + die "unrecognized option: $arg"; + } + } else { + open(CONTROL, "< $arg") or die "cannot open $arg"; + while (<CONTROL>) { + if (/^!define\s+(\w+)/) { + $Parms{$1} = 1; + } + } + } +} + +sub ifdef { + my ($var, $enabled) = @_; + my $def = 0; + $def = 1 if (defined $Parms{$var}) || ($var eq "true"); + $def = 0 if $var eq "false"; + while (<STDIN>) { + if (/^\s*\Q$pre\Eifdef\s+(\w+)\s*$/) { + return 1 if ifdef ($1, $def & $enabled); + } elsif (/^\s*\Q$pre\Eelseif\s+(\w+)\s*$/) { + $def = $def ^ 1; + return ifdef ($1, $def & $enabled); + } elsif (/^\s*\Q$pre\Eelse\s*$/) { + $def = $def ^ 1; + } elsif (/^\s*\Q$pre\Eendif\s*$/) { + return 0; + } elsif (/^\s*\Q$pre\E/) { + die "unrecognized command: $_"; + } else { + print if $def && $enabled; + } + } + return 1; +} + +ifdef("true", 1); |