File: | /usr/local/share/automake-1.11/Automake/Configure_ac.pm |
Coverage: | 63.8% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | # Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc. | ||||||
2 | |||||||
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. | ||||||
7 | |||||||
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. | ||||||
12 | |||||||
13 | # You should have received a copy of the GNU General Public License | ||||||
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||||
15 | |||||||
16 | ############################################################### | ||||||
17 | # The main copy of this file is in Automake's CVS repository. # | ||||||
18 | # Updates should be sent to automake-patches@gnu.org. # | ||||||
19 | ############################################################### | ||||||
20 | |||||||
21 | package Automake::Configure_ac; | ||||||
22 | |||||||
23 | 1 1 1 | 5 2 8 | use strict; | ||||
24 | 1 1 1 | 3 1 5 | use Exporter; | ||||
25 | 1 1 1 | 4 1 2 | use Automake::Channels; | ||||
26 | 1 1 1 | 4 1 2 | use Automake::ChannelDefs; | ||||
27 | |||||||
28 | 1 1 1 | 3 2 4 | use vars qw (@ISA @EXPORT); | ||||
29 | |||||||
30 | @ISA = qw (Exporter); | ||||||
31 | @EXPORT = qw (&find_configure_ac &require_configure_ac); | ||||||
32 | |||||||
33 - 52 | =head1 NAME Automake::Configure_ac - Locate configure.ac or configure.in. =head1 SYNOPSIS use Automake::Configure_ac; # Try to locate configure.in or configure.ac in the current # directory. It may be absent. Complain if both files exist. my $file_name = find_configure_ac; # Likewise, but bomb out if the file does not exist. my $file_name = require_configure_ac; # Likewise, but in $dir. my $file_name = find_configure_ac ($dir); my $file_name = require_configure_ac ($dir); =cut | ||||||
53 | |||||||
54 | sub find_configure_ac (;@) | ||||||
55 | { | ||||||
56 | 1 | 0 | 2 | my ($directory) = @_; | |||
57 | 1 | 23 | $directory ||= '.'; | ||||
58 | 1 | 12 | my $configure_ac = | ||||
59 | File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.ac')); | ||||||
60 | 1 | 4 | my $configure_in = | ||||
61 | File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.in')); | ||||||
62 | |||||||
63 | 1 | 12 | if (-f $configure_ac) | ||||
64 | { | ||||||
65 | 0 | 0 | if (-f $configure_in) | ||||
66 | { | ||||||
67 | 0 | 0 | msg ('unsupported', | ||||
68 | "`$configure_ac' and `$configure_in' both present.\n" | ||||||
69 | . "proceeding with `$configure_ac'."); | ||||||
70 | } | ||||||
71 | 0 | 0 | return $configure_ac | ||||
72 | } | ||||||
73 | elsif (-f $configure_in) | ||||||
74 | { | ||||||
75 | 1 | 3 | return $configure_in; | ||||
76 | } | ||||||
77 | 0 | return $configure_ac; | |||||
78 | } | ||||||
79 | |||||||
80 | |||||||
81 | sub require_configure_ac (;$) | ||||||
82 | { | ||||||
83 | 0 | 0 | my $res = find_configure_ac (@_); | ||||
84 | 0 | fatal "`configure.ac' or `configure.in' is required" | |||||
85 | unless -f $res; | ||||||
86 | 0 | return $res | |||||
87 | } | ||||||
88 | |||||||
89 | 1; | ||||||
90 | |||||||
91 | ### Setup "GNU" style for perl-mode and cperl-mode. | ||||||
92 | ## Local Variables: | ||||||
93 | ## perl-indent-level: 2 | ||||||
94 | ## perl-continued-statement-offset: 2 | ||||||
95 | ## perl-continued-brace-offset: 0 | ||||||
96 | ## perl-brace-offset: 0 | ||||||
97 | ## perl-brace-imaginary-offset: 0 | ||||||
98 | ## perl-label-offset: -2 | ||||||
99 | ## cperl-indent-level: 2 | ||||||
100 | ## cperl-brace-offset: 0 | ||||||
101 | ## cperl-continued-brace-offset: 0 | ||||||
102 | ## cperl-label-offset: -2 | ||||||
103 | ## cperl-extra-newline-before-brace: t | ||||||
104 | ## cperl-merge-trailing-else: nil | ||||||
105 | ## cperl-continued-statement-offset: 2 | ||||||
106 | ## End: |