From 70a5fdcedd670ff21d39e7d872bc7180e7afbd6d Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Tue, 11 Aug 2009 12:05:21 +0100 Subject: Add script to add AU_ALIAS call to a macro. --- alias-macro.pl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 alias-macro.pl (limited to 'alias-macro.pl') diff --git a/alias-macro.pl b/alias-macro.pl new file mode 100755 index 0000000..5fa107e --- /dev/null +++ b/alias-macro.pl @@ -0,0 +1,32 @@ +#! /usr/bin/env perl +# alias-macro +# Alias an autoconf-archive macro +# Usage: alias-macro FROM TO + +use strict; +use warnings; + +my ($old_file, $new_file) = @ARGV; + +# Extract names from file names +my $old_name = $old_file; +$old_name =~ s/\..*$//; +my $uc_old_name = uc($old_name); +$old_name = lc($old_name); +my $new_name = $new_file; +$new_name =~ s/\..*$//; +my $uc_new_name = uc($new_name); +$new_name = lc($new_name); + +# Check new name exists +die "could not find `$new_file'\n" unless -e $new_file; + +# Read file +open IN, $old_file or die "could not read `$old_file'\n"; +my $text = do { local $/, }; + +# Alias the macro +my $old_text = $text; +$old_text =~ s/^AC_DEFUN\(\[$uc_old_name/AU_ALIAS([$uc_old_name], [$uc_new_name])\nAC_DEFUN([$uc_old_name/m; +open OUTFILE, ">$old_file" or die "could not write `$old_file'"; +print OUTFILE $old_text; -- cgit v1.2.1