6 |
if 0; |
if 0; |
7 |
|
|
8 |
# autoreconf - install the GNU Build System in a directory tree |
# autoreconf - install the GNU Build System in a directory tree |
9 |
# Copyright (C) 1994, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
# 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 |
# 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 |
# it under the terms of the GNU General Public License as published by |
102 |
$version = "autoreconf (@PACKAGE_NAME@) @VERSION@ |
$version = "autoreconf (@PACKAGE_NAME@) @VERSION@ |
103 |
Written by David J. MacKenzie and Akim Demaille. |
Written by David J. MacKenzie and Akim Demaille. |
104 |
|
|
105 |
Copyright 2002 Free Software Foundation, Inc. |
Copyright (C) 2003 Free Software Foundation, Inc. |
106 |
This is free software; see the source for copying conditions. There is NO |
This is free software; see the source for copying conditions. There is NO |
107 |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
108 |
"; |
"; |
119 |
my $install = 0; |
my $install = 0; |
120 |
# symlink -- when --install, use symlinks instead. |
# symlink -- when --install, use symlinks instead. |
121 |
my $symlink = 0; |
my $symlink = 0; |
122 |
|
# Does aclocal support --force? |
123 |
|
my $aclocal_supports_force = 0; |
124 |
|
|
125 |
my @prepend_include; |
my @prepend_include; |
126 |
my @include; |
my @include; |
173 |
} |
} |
174 |
} |
} |
175 |
|
|
176 |
|
$aclocal_supports_force = `$aclocal --help` =~ /--force/; |
177 |
|
|
178 |
# Dispatch autoreconf's option to the tools. |
# Dispatch autoreconf's option to the tools. |
179 |
# --include; |
# --include; |
180 |
$autoconf .= join (' --include=', '', @include); |
$autoconf .= join (' --include=', '', @include); |
192 |
# --force; |
# --force; |
193 |
if ($force) |
if ($force) |
194 |
{ |
{ |
195 |
|
$aclocal .= ' --force' |
196 |
|
if $aclocal_supports_force; |
197 |
$autoconf .= ' --force'; |
$autoconf .= ' --force'; |
198 |
$autoheader .= ' --force'; |
$autoheader .= ' --force'; |
199 |
$automake .= ' --force-missing'; |
$automake .= ' --force-missing'; |
224 |
} |
} |
225 |
|
|
226 |
|
|
227 |
|
# &run_aclocal ($ACLOCAL, $FLAGS) |
228 |
|
# ------------------------------- |
229 |
|
# Update aclocal.m4 as lazily as possible, as aclocal pre-1.8 always |
230 |
|
# overwrites aclocal.m4, hence triggers autoconf, autoheader, automake |
231 |
|
# etc. uselessly. aclocal 1.8+ does not need this. |
232 |
|
sub run_aclocal ($$) |
233 |
|
{ |
234 |
|
my ($aclocal, $flags) = @_; |
235 |
|
|
236 |
|
# aclocal 1.8+ does all this for free. It can be recognized by its |
237 |
|
# --force support. |
238 |
|
if ($aclocal_supports_force) |
239 |
|
{ |
240 |
|
xsystem ("$aclocal $flags"); |
241 |
|
} |
242 |
|
else |
243 |
|
{ |
244 |
|
xsystem ("$aclocal $flags --output=aclocal.m4t"); |
245 |
|
# aclocal may produce no output. |
246 |
|
if (-f 'aclocal.m4t') |
247 |
|
{ |
248 |
|
update_file ('aclocal.m4t', 'aclocal.m4'); |
249 |
|
# Make sure that the local m4 files are older than |
250 |
|
# aclocal.m4. |
251 |
|
# |
252 |
|
# Why is not always the case? Because we already run |
253 |
|
# aclocal at first (before tracing), which, for instance, |
254 |
|
# can find Gettext's macros in .../share/aclocal, so we may |
255 |
|
# have had the right aclocal.m4 already. Then autopoint is |
256 |
|
# run, and installs locally these M4 files. Then |
257 |
|
# autoreconf, via update_file, sees it is the _same_ |
258 |
|
# aclocal.m4, and doesn't change its timestamp. But later, |
259 |
|
# Automake's Makefile expresses that aclocal.m4 depends on |
260 |
|
# these local files, which are newer, so it triggers aclocal |
261 |
|
# again. |
262 |
|
# |
263 |
|
# To make sure aclocal.m4 is no older, we change the |
264 |
|
# modification times of the local M4 files to be not newer |
265 |
|
# than it. |
266 |
|
# |
267 |
|
# First, where are the local files? |
268 |
|
my $aclocal_local_dir = '.'; |
269 |
|
if ($flags =~ /-I\s+(\S+)/) |
270 |
|
{ |
271 |
|
$aclocal_local_dir = $1; |
272 |
|
} |
273 |
|
# All the local files newer than aclocal.m4 are to be |
274 |
|
# made not newer than it. |
275 |
|
my $aclocal_m4_mtime = mtime ('aclocal.m4'); |
276 |
|
for my $file (glob ("$aclocal_local_dir/*.m4"), 'acinclude.m4') |
277 |
|
{ |
278 |
|
if ($aclocal_m4_mtime < mtime ($file)) |
279 |
|
{ |
280 |
|
debug "aging $file to be not newer than aclocal.m4"; |
281 |
|
utime $aclocal_m4_mtime, $aclocal_m4_mtime, $file; |
282 |
|
} |
283 |
|
} |
284 |
|
} |
285 |
|
} |
286 |
|
} |
287 |
|
|
288 |
# &autoreconf_current_directory |
# &autoreconf_current_directory |
289 |
# ----------------------------- |
# ----------------------------- |
290 |
sub autoreconf_current_directory () |
sub autoreconf_current_directory () |
405 |
# fall. |
# fall. |
406 |
sleep 1; |
sleep 1; |
407 |
|
|
408 |
xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t"); |
run_aclocal ($aclocal, $aclocal_flags); |
|
# aclocal may produce no output. |
|
|
update_file ('aclocal.m4t', 'aclocal.m4') |
|
|
if -f 'aclocal.m4t'; |
|
409 |
} |
} |
410 |
|
|
411 |
# We might have to rerun aclocal if Libtool (or others) imports new |
# We might have to rerun aclocal if Libtool (or others) imports new |
502 |
} |
} |
503 |
else |
else |
504 |
{ |
{ |
505 |
xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t"); |
run_aclocal ($aclocal, $aclocal_flags); |
|
# aclocal may produce no output. |
|
|
if (-f 'aclocal.m4t') |
|
|
{ |
|
|
update_file ('aclocal.m4t', 'aclocal.m4'); |
|
|
# Make sure that the local m4 files are older than |
|
|
# aclocal.m4. |
|
|
# |
|
|
# Why is not always the case? Because we already run |
|
|
# aclocal at first (before tracing), which, for instance, |
|
|
# can find Gettext's macros in .../share/aclocal, so we |
|
|
# may have had the right aclocal.m4 already. Then |
|
|
# autopoint is run, and installs locally these M4 |
|
|
# files. Then autoreconf, via update_file, sees it is |
|
|
# the _same_ aclocal.m4, and doesn't change its |
|
|
# timestamp. But later, Automake's Makefile expresses |
|
|
# that aclocal.m4 depends on these local files, which |
|
|
# are newer, so it triggers aclocal again. |
|
|
# |
|
|
# To make sure aclocal.m4 is no older, we change the |
|
|
# modification times of the local M4 files to be |
|
|
# not newer than it. |
|
|
# |
|
|
# First, where are the local files? |
|
|
my $aclocal_local_dir = '.'; |
|
|
if ($aclocal_flags =~ /-I\s+(\S+)/) |
|
|
{ |
|
|
$aclocal_local_dir = $1; |
|
|
} |
|
|
# All the local files newer than aclocal.m4 are to be |
|
|
# made not newer than it. |
|
|
my $aclocal_m4_mtime = mtime ('aclocal.m4'); |
|
|
for my $file (glob ("$aclocal_local_dir/*.m4"), 'acinclude.m4') |
|
|
{ |
|
|
if ($aclocal_m4_mtime < mtime ($file)) |
|
|
{ |
|
|
debug "aging $file to be not newer than aclocal.m4"; |
|
|
utime $aclocal_m4_mtime, $aclocal_m4_mtime, $file; |
|
|
} |
|
|
} |
|
|
} |
|
506 |
} |
} |
507 |
} |
} |
508 |
|
|