#! /usr/bin/env perl =for gpg -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 =cut # update_acsite -- Place all m4 autoconf macros found in DIR into the file named # "acsite.m4" under ${PREFIX}/share/autoconf. use warnings; use strict; use File::Glob qw{:glob}; use File::Spec::Functions qw{rel2abs splitpath file_name_is_absolute catfile canonpath}; use vars qw{@MacrDa}; my $MyDir = $ARGV[0] || q|/usr/local/share/repository_ac_macros|; my $OutFN = $ARGV[1] || q|/usr/local/share/autoconf/acsite.m4|; my $OutDN = (splitpath($OutFN))[1]; # my $MyGlb = catfile($MyDir , "*.m4"); $MyDir = rel2abs( canonpath($MyDir) => '' ) if not file_name_is_absolute($MyDir); die "This process cannot write to the dest directory: $!" if not ( -w $OutFN || (-d $OutDN && -w _) ); die "This indicated directory does not exist!: $!" if not chdir( $MyDir ); my @repos_macs = bsd_glob( '*.m4' , GLOB_ERROR | GLOB_MARK | GLOB_NOCASE | GLOB_TILDE | GLOB_NOSORT ); if (@repos_macs) { foreach my $macfile_data (@repos_macs) { my $fsz = -s $macfile_data; (my $fln = <<"!ROBUSTO!" ) =~s/^\s*//mg; dnl ------------------------------------------------------------- dnl The next file added $fsz bytes to this collection. dnl file: $macfile_data dnl ------------------------------------------------------------- !ROBUSTO! open IFH,$macfile_data or die "Failed to open() \"$macfile_data\" "; read(IFH, my $data, $fsz); $data or die "Could not read any data from \"$macfile_data\""; close IFH; push @MacrDa , qq{\n\n}, $fln , $data; } open OFH,">$OutFN" or die "Cannot open() the outfile \"$OutFN\" -- $!"; print OFH @MacrDa; } else { my $me = (splitpath($0))[3]; print STDERR <<"!CLEMENTINE!"; $me terminated because there were no macro *.m4 files found in the indicated or default directory location. Please check your arguments and try again. !CLEMENTINE! } __END__ =begin gpg -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE/FWU8BXOj2U4kTqYRArKyAJwKJ/9gmyof0MZJ+Ao2TQ+rcPEwYQCdEmdC 5/oKZKbs5XfVaHlvV1r3h+0= =TX52 -----END PGP SIGNATURE----- =end gpg This Program is Free Software, (C)2003 Soren Andersen it may be used under the same terms as Perl itself.