Resurrect autoconf from the 'full' branch
[msysgit.git] / share / autoconf / Autom4te / Configure_ac.pm
blobf96affcb64e08954201ad1d8f4092ec231184245
1 # Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2, or (at your option)
6 # any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 # 02110-1301, USA.
18 ###############################################################
19 # The main copy of this file is in Automake's CVS repository. #
20 # Updates should be sent to automake-patches@gnu.org. #
21 ###############################################################
23 package Autom4te::Configure_ac;
25 use strict;
26 use Exporter;
27 use Autom4te::Channels;
28 use Autom4te::ChannelDefs;
30 use vars qw (@ISA @EXPORT);
32 @ISA = qw (Exporter);
33 @EXPORT = qw (&find_configure_ac &require_configure_ac);
35 =head1 NAME
37 Autom4te::Configure_ac - Locate configure.ac or configure.in.
39 =head1 SYNOPSIS
41 use Autom4te::Configure_ac;
43 # Try to locate configure.in or configure.ac in the current
44 # directory. It may be absent. Complain if both files exist.
45 my $file_name = find_configure_ac;
47 # Likewise, but bomb out if the file does not exist.
48 my $file_name = require_configure_ac;
50 # Likewise, but in $dir.
51 my $file_name = find_configure_ac ($dir);
52 my $file_name = require_configure_ac ($dir);
54 =cut
56 sub find_configure_ac (;@)
58 my ($directory) = @_;
59 $directory ||= '.';
60 my $configure_ac =
61 File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.ac'));
62 my $configure_in =
63 File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.in'));
65 if (-f $configure_ac)
67 if (-f $configure_in)
69 msg ('unsupported',
70 "`$configure_ac' and `$configure_in' both present.\n"
71 . "proceeding with `$configure_ac'.");
73 return $configure_ac
75 elsif (-f $configure_in)
77 return $configure_in;
79 return $configure_ac;
83 sub require_configure_ac (;$)
85 my $res = find_configure_ac (@_);
86 fatal "`configure.ac' or `configure.in' is required"
87 unless -f $res;
88 return $res
93 ### Setup "GNU" style for perl-mode and cperl-mode.
94 ## Local Variables:
95 ## perl-indent-level: 2
96 ## perl-continued-statement-offset: 2
97 ## perl-continued-brace-offset: 0
98 ## perl-brace-offset: 0
99 ## perl-brace-imaginary-offset: 0
100 ## perl-label-offset: -2
101 ## cperl-indent-level: 2
102 ## cperl-brace-offset: 0
103 ## cperl-continued-brace-offset: 0
104 ## cperl-label-offset: -2
105 ## cperl-extra-newline-before-brace: t
106 ## cperl-merge-trailing-else: nil
107 ## cperl-continued-statement-offset: 2
108 ## End: