1 # Copyright (C) 2003, 2005, 2006, 2009, 2010 Free Software Foundation,
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 ###############################################################
18 # The main copy of this file is in Automake's CVS repository. #
19 # Updates should be sent to automake-patches@gnu.org. #
20 ###############################################################
22 package Automake::Configure_ac;
26 use Automake::Channels;
27 use Automake::ChannelDefs;
29 use vars qw (@ISA @EXPORT);
32 @EXPORT = qw (&find_configure_ac &require_configure_ac);
36 Automake::Configure_ac - Locate configure.ac or configure.in.
40 use Automake::Configure_ac;
42 # Try to locate configure.in or configure.ac in the current
43 # directory. It may be absent. Complain if both files exist.
44 my $file_name = find_configure_ac;
46 # Likewise, but bomb out if the file does not exist.
47 my $file_name = require_configure_ac;
49 # Likewise, but in $dir.
50 my $file_name = find_configure_ac ($dir);
51 my $file_name = require_configure_ac ($dir);
61 =item C<$configure_ac = find_configure_ac ([$directory])>
63 Find a F<configure.ac> or F<configure.in> file in C<$directory>,
64 defaulting to the current directory. Complain if both files are present.
65 Return the name of the file found, or the former if neither is present.
69 sub find_configure_ac (;@)
74 File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.ac'));
76 File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.in'));
83 "`$configure_ac' and `$configure_in' both present.\n"
84 . "proceeding with `$configure_ac'");
88 elsif (-f $configure_in)
96 =item C<$configure_ac = require_configure_ac ([$directory])>
98 Like C<find_configure_ac>, but fail if neither is present.
102 sub require_configure_ac (;$)
104 my $res = find_configure_ac (@_);
105 fatal "`configure.ac' or `configure.in' is required"
112 ### Setup "GNU" style for perl-mode and cperl-mode.
114 ## perl-indent-level: 2
115 ## perl-continued-statement-offset: 2
116 ## perl-continued-brace-offset: 0
117 ## perl-brace-offset: 0
118 ## perl-brace-imaginary-offset: 0
119 ## perl-label-offset: -2
120 ## cperl-indent-level: 2
121 ## cperl-brace-offset: 0
122 ## cperl-continued-brace-offset: 0
123 ## cperl-label-offset: -2
124 ## cperl-extra-newline-before-brace: t
125 ## cperl-merge-trailing-else: nil
126 ## cperl-continued-statement-offset: 2