diff options
Diffstat (limited to 'meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in')
-rwxr-xr-x | meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in | 267 |
1 files changed, 267 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in b/meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in new file mode 100755 index 0000000000..be8580c8e6 --- /dev/null +++ b/meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in | |||
@@ -0,0 +1,267 @@ | |||
1 | #! /usr/bin/perl -w | ||
2 | # -*- perl -*- | ||
3 | |||
4 | eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' | ||
5 | if 0; | ||
6 | |||
7 | # gnu-configize - install the GNU config.guess / config.sub in a directory tree | ||
8 | # Based on autoreconf: | ||
9 | # Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003 | ||
10 | # Free Software Foundation, Inc. | ||
11 | |||
12 | # This program is free software; you can redistribute it and/or modify | ||
13 | # it under the terms of the GNU General Public License as published by | ||
14 | # the Free Software Foundation; either version 2, or (at your option) | ||
15 | # any later version. | ||
16 | |||
17 | # This program is distributed in the hope that it will be useful, | ||
18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | # GNU General Public License for more details. | ||
21 | |||
22 | # You should have received a copy of the GNU General Public License | ||
23 | # along with this program; if not, write to the Free Software | ||
24 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
25 | # 02111-1307, USA. | ||
26 | |||
27 | BEGIN | ||
28 | { | ||
29 | my $datadir = $ENV{'autom4te_perllibdir'} || '@autom4te_perllibdir@'; | ||
30 | # '/home/kergoth/code/build-arm/tmp/staging/share/autoconf'; | ||
31 | unshift @INC, $datadir; | ||
32 | |||
33 | # Override SHELL. On DJGPP SHELL may not be set to a shell | ||
34 | # that can handle redirection and quote arguments correctly, | ||
35 | # e.g.: COMMAND.COM. For DJGPP always use the shell that configure | ||
36 | # has detected. | ||
37 | $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); | ||
38 | } | ||
39 | |||
40 | use Autom4te::ChannelDefs; | ||
41 | use Autom4te::Channels; | ||
42 | use Autom4te::Configure_ac; | ||
43 | use Autom4te::FileUtils; | ||
44 | use Autom4te::General; | ||
45 | use Autom4te::XFile; | ||
46 | # Do not use Cwd::chdir, since it might hang. | ||
47 | use Cwd 'cwd'; | ||
48 | use strict; | ||
49 | |||
50 | ## ----------- ## | ||
51 | ## Variables. ## | ||
52 | ## ----------- ## | ||
53 | |||
54 | # $HELP | ||
55 | # ----- | ||
56 | $help = "Usage: $0 [OPTION] ... [CONFIGURE-AC or DIRECTORY] ... | ||
57 | |||
58 | Install the GNU config.sub and config.guess scripts in the | ||
59 | DIRECTORIES or the directory trees driven by CONFIGURE-AC | ||
60 | (defaulting to `.'). | ||
61 | |||
62 | Operation modes: | ||
63 | -h, --help print this help, then exit | ||
64 | -V, --version print version number, then exit | ||
65 | -v, --verbose verbosely report processing | ||
66 | -f, --force consider all files obsolete | ||
67 | -s, --symlink install symbolic links instead of copies | ||
68 | -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax] | ||
69 | |||
70 | " . Autom4te::ChannelDefs::usage . " | ||
71 | |||
72 | The environment variable \`WARNINGS\' is honored. Some subtools might | ||
73 | support other warning types, using \`all' is encouraged. | ||
74 | "; | ||
75 | |||
76 | # $VERSION | ||
77 | # -------- | ||
78 | $version = "gnu-configize 1.0 | ||
79 | |||
80 | Copyright (C) 2004 Chris Larson | ||
81 | This is free software; see the source for copying conditions. There is NO | ||
82 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
83 | "; | ||
84 | |||
85 | my $configdir = '@gnu-configdir@'; | ||
86 | #'/home/kergoth/code/build-arm/tmp/staging/i686-linux/share/gnu-config'; | ||
87 | my $autoconf = $ENV{'AUTOCONF'} || 'autoconf'; | ||
88 | |||
89 | # use symlinks instead. | ||
90 | my $symlink = 0; | ||
91 | |||
92 | my $configure_ac; | ||
93 | |||
94 | my $rm = "rm -f"; | ||
95 | my $ln_s = "ln -sf"; | ||
96 | my $cp = "cp -f"; | ||
97 | my $mkdir = "mkdir"; | ||
98 | my $chmod = "chmod"; | ||
99 | |||
100 | ## ---------- ## | ||
101 | ## Routines. ## | ||
102 | ## ---------- ## | ||
103 | |||
104 | |||
105 | # parse_args () | ||
106 | # ------------- | ||
107 | # Process any command line arguments. | ||
108 | sub parse_args () | ||
109 | { | ||
110 | my $srcdir; | ||
111 | |||
112 | getopt ('s|symlink' => \$symlink); | ||
113 | |||
114 | # Even if the user specified a configure.ac, trim to get the | ||
115 | # directory, and look for configure.ac again. Because (i) the code | ||
116 | # is simpler, and (ii) we are still able to diagnose simultaneous | ||
117 | # presence of configure.ac and configure.in. | ||
118 | @ARGV = map { /configure\.(ac|in)$/ ? dirname ($_) : $_ } @ARGV; | ||
119 | push @ARGV, '.' unless @ARGV; | ||
120 | } | ||
121 | |||
122 | |||
123 | # &gnu_configize_current_directory | ||
124 | # ----------------------------- | ||
125 | sub gnu_configize_current_directory () | ||
126 | { | ||
127 | my $configure_ac = require_configure_ac; | ||
128 | |||
129 | # ---------------------- # | ||
130 | # Is it using Autoconf? # | ||
131 | # ---------------------- # | ||
132 | |||
133 | my $uses_autoconf; | ||
134 | my $uses_gettext; | ||
135 | my $configure_ac_file = new Autom4te::XFile $configure_ac; | ||
136 | while ($_ = $configure_ac_file->getline) | ||
137 | { | ||
138 | s/#.*//; | ||
139 | s/dnl.*//; | ||
140 | $uses_autoconf = 1 if /AC_INIT/; | ||
141 | } | ||
142 | |||
143 | if (!$uses_autoconf) | ||
144 | { | ||
145 | verb "$configure_ac: not using Autoconf"; | ||
146 | return; | ||
147 | } | ||
148 | |||
149 | my $aux_dir; | ||
150 | my @subdir; | ||
151 | my $cmd; | ||
152 | my $dest; | ||
153 | |||
154 | verb "$configure_ac: tracing"; | ||
155 | my $traces = new Autom4te::XFile | ||
156 | ("$autoconf" | ||
157 | . join (' --trace=', '', | ||
158 | # If you change this list, update the | ||
159 | # `Autoreconf-preselections' section of autom4te.in. | ||
160 | 'AC_CONFIG_AUX_DIR:AC_CONFIG_AUX_DIR:\$1', | ||
161 | 'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1', | ||
162 | 'AC_INIT', | ||
163 | ) | ||
164 | . ' |'); | ||
165 | while ($_ = $traces->getline) | ||
166 | { | ||
167 | $aux_dir = $1 if /AC_CONFIG_AUX_DIR:(.*)/; | ||
168 | $uses_autoconf = 1 if /AC_INIT/; | ||
169 | push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/; | ||
170 | } | ||
171 | |||
172 | # The subdirs are *optional*, they may not exist. | ||
173 | foreach (@subdir) | ||
174 | { | ||
175 | if (-d) | ||
176 | { | ||
177 | verb "$configure_ac: subdirectory $_ to gnu-configize"; | ||
178 | gnu_configize ($_); | ||
179 | } | ||
180 | else | ||
181 | { | ||
182 | verb "$configure_ac: subdirectory $_ not present"; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | $dest = "."; | ||
187 | |||
188 | if (defined $aux_dir) | ||
189 | { | ||
190 | $dest = $aux_dir; | ||
191 | if (! -d $aux_dir) | ||
192 | { | ||
193 | verb "$configure_ac: creating directory $aux_dir"; | ||
194 | mkdir $aux_dir | ||
195 | or error "cannot create $aux_dir: $!"; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | if (!$symlink) | ||
200 | { | ||
201 | $cmd = $cp; | ||
202 | } | ||
203 | else | ||
204 | { | ||
205 | $cmd = $ln_s; | ||
206 | } | ||
207 | |||
208 | xsystem ("$cmd $configdir/config.guess $dest/"); | ||
209 | xsystem ("$chmod u+x $dest/config.guess"); | ||
210 | xsystem ("$cmd $configdir/config.sub $dest/"); | ||
211 | xsystem ("$chmod u+x $dest/config.sub"); | ||
212 | } | ||
213 | |||
214 | |||
215 | # &gnu_configize ($DIRECTORY) | ||
216 | # ------------------------ | ||
217 | # Reconf the $DIRECTORY. | ||
218 | sub gnu_configize ($) | ||
219 | { | ||
220 | my ($directory) = @_; | ||
221 | my $cwd = cwd; | ||
222 | |||
223 | # The format for this message is not free: taken from Emacs, itself | ||
224 | # using GNU Make's format. | ||
225 | verb "Entering directory `$directory'"; | ||
226 | chdir $directory | ||
227 | or error "cannot chdir to $directory: $!"; | ||
228 | |||
229 | gnu_configize_current_directory; | ||
230 | |||
231 | # The format is not free: taken from Emacs, itself using GNU Make's | ||
232 | # format. | ||
233 | verb "Leaving directory `$directory'"; | ||
234 | chdir $cwd | ||
235 | or error "cannot chdir to $cwd: $!"; | ||
236 | } | ||
237 | |||
238 | |||
239 | ## ------ ## | ||
240 | ## Main. ## | ||
241 | ## ------ ## | ||
242 | |||
243 | parse_args; | ||
244 | |||
245 | # Autoreconf all the given configure.ac. A while loop, not a for, | ||
246 | # since the list can change at runtime because of AC_CONFIG_SUBDIRS. | ||
247 | for my $directory (@ARGV) | ||
248 | { | ||
249 | gnu_configize ($directory); | ||
250 | } | ||
251 | |||
252 | ### Setup "GNU" style for perl-mode and cperl-mode. | ||
253 | ## Local Variables: | ||
254 | ## perl-indent-level: 2 | ||
255 | ## perl-continued-statement-offset: 2 | ||
256 | ## perl-continued-brace-offset: 0 | ||
257 | ## perl-brace-offset: 0 | ||
258 | ## perl-brace-imaginary-offset: 0 | ||
259 | ## perl-label-offset: -2 | ||
260 | ## cperl-indent-level: 2 | ||
261 | ## cperl-brace-offset: 0 | ||
262 | ## cperl-continued-brace-offset: 0 | ||
263 | ## cperl-label-offset: -2 | ||
264 | ## cperl-extra-newline-before-brace: t | ||
265 | ## cperl-merge-trailing-else: nil | ||
266 | ## cperl-continued-statement-offset: 2 | ||
267 | ## End: | ||