summaryrefslogtreecommitdiff
path: root/install-win32/ifdef.pl
diff options
context:
space:
mode:
authorAlberto Gonzalez Iniesta <agi@inittab.org>2012-11-05 16:28:09 +0100
committerAlberto Gonzalez Iniesta <agi@inittab.org>2012-11-05 16:28:09 +0100
commit8dd0350e1607aa30f7a043c8d5ec7a7eeb874115 (patch)
tree566d0620eb693320cb121dfd93a5675fa704a30b /install-win32/ifdef.pl
parent349cfa7acb95abe865209a28e417ec74b56f9bba (diff)
Imported Upstream version 2.3_rc1
Diffstat (limited to 'install-win32/ifdef.pl')
-rw-r--r--install-win32/ifdef.pl53
1 files changed, 0 insertions, 53 deletions
diff --git a/install-win32/ifdef.pl b/install-win32/ifdef.pl
deleted file mode 100644
index d240ebb..0000000
--- a/install-win32/ifdef.pl
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/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);