@ai-ecoverse/wasix-autoconf 0.0.0-stage → 2.72.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +338 -0
  2. package/README.md +2 -2
  3. package/bin/autoconf +215 -0
  4. package/bin/autoheader +335 -0
  5. package/bin/autom4te +1174 -0
  6. package/bin/autoreconf +937 -0
  7. package/bin/autoscan +686 -0
  8. package/bin/autoupdate +1074 -0
  9. package/bin/ifnames +158 -0
  10. package/package.json +75 -4
  11. package/share/autoconf/Autom4te/C4che.pm +263 -0
  12. package/share/autoconf/Autom4te/ChannelDefs.pm +549 -0
  13. package/share/autoconf/Autom4te/Channels.pm +856 -0
  14. package/share/autoconf/Autom4te/Config.pm +43 -0
  15. package/share/autoconf/Autom4te/Configure_ac.pm +112 -0
  16. package/share/autoconf/Autom4te/FileUtils.pm +429 -0
  17. package/share/autoconf/Autom4te/General.pm +413 -0
  18. package/share/autoconf/Autom4te/Getopt.pm +99 -0
  19. package/share/autoconf/Autom4te/Request.pm +121 -0
  20. package/share/autoconf/Autom4te/XFile.pm +304 -0
  21. package/share/autoconf/INSTALL +368 -0
  22. package/share/autoconf/autoconf/autoconf.m4 +105 -0
  23. package/share/autoconf/autoconf/autoconf.m4f +15460 -0
  24. package/share/autoconf/autoconf/autoheader.m4 +78 -0
  25. package/share/autoconf/autoconf/autoscan.m4 +51 -0
  26. package/share/autoconf/autoconf/autotest.m4 +81 -0
  27. package/share/autoconf/autoconf/autoupdate.m4 +123 -0
  28. package/share/autoconf/autoconf/c.m4 +2794 -0
  29. package/share/autoconf/autoconf/erlang.m4 +270 -0
  30. package/share/autoconf/autoconf/fortran.m4 +1933 -0
  31. package/share/autoconf/autoconf/functions.m4 +2127 -0
  32. package/share/autoconf/autoconf/general.m4 +3374 -0
  33. package/share/autoconf/autoconf/go.m4 +177 -0
  34. package/share/autoconf/autoconf/headers.m4 +839 -0
  35. package/share/autoconf/autoconf/lang.m4 +730 -0
  36. package/share/autoconf/autoconf/libs.m4 +493 -0
  37. package/share/autoconf/autoconf/oldnames.m4 +92 -0
  38. package/share/autoconf/autoconf/programs.m4 +1015 -0
  39. package/share/autoconf/autoconf/specific.m4 +763 -0
  40. package/share/autoconf/autoconf/status.m4 +1787 -0
  41. package/share/autoconf/autoconf/trailer.m4 +4 -0
  42. package/share/autoconf/autoconf/types.m4 +1133 -0
  43. package/share/autoconf/autom4te.cfg +169 -0
  44. package/share/autoconf/autoscan/autoscan.list +264 -0
  45. package/share/autoconf/autotest/autotest.m4 +27 -0
  46. package/share/autoconf/autotest/autotest.m4f +3915 -0
  47. package/share/autoconf/autotest/general.m4 +2292 -0
  48. package/share/autoconf/autotest/specific.m4 +74 -0
  49. package/share/autoconf/build-aux/config.guess +1807 -0
  50. package/share/autoconf/build-aux/config.sub +1960 -0
  51. package/share/autoconf/build-aux/install-sh +541 -0
  52. package/share/autoconf/m4sugar/foreach.m4 +362 -0
  53. package/share/autoconf/m4sugar/m4sh.m4 +2217 -0
  54. package/share/autoconf/m4sugar/m4sh.m4f +2046 -0
  55. package/share/autoconf/m4sugar/m4sugar.m4 +3307 -0
  56. package/share/autoconf/m4sugar/m4sugar.m4f +868 -0
  57. package/share/autoconf/version.m4 +12 -0
package/bin/autoreconf ADDED
@@ -0,0 +1,937 @@
1
+ #!/usr/bin/perl
2
+ # -*- perl -*-
3
+ # Generated from bin/autoreconf.in; do not edit by hand.
4
+
5
+ eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac'
6
+ if 0;
7
+
8
+ # autoreconf - install the GNU Build System in a directory tree
9
+ # Copyright (C) 1994, 1999-2017, 2020-2023 Free Software Foundation,
10
+ # 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 3 of the License, or
15
+ # (at your option) 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, see <https://www.gnu.org/licenses/>.
24
+
25
+ # Written by David J. MacKenzie.
26
+ # Extended and rewritten in Perl by Akim Demaille.
27
+
28
+ use 5.006;
29
+ use strict;
30
+ use warnings FATAL => 'all';
31
+
32
+ my $buildauxdir;
33
+ BEGIN
34
+ {
35
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || do { require File::Basename; require File::Spec; File::Spec->catdir(File::Basename::dirname(File::Basename::dirname(File::Spec->rel2abs($0))), 'share', 'autoconf') };
36
+ unshift @INC, $pkgdatadir;
37
+
38
+ $buildauxdir = $ENV{'autom4te_buildauxdir'} || $pkgdatadir . '/build-aux';
39
+
40
+ # Override SHELL. On DJGPP SHELL may not be set to a shell
41
+ # that can handle redirection and quote arguments correctly,
42
+ # e.g.: COMMAND.COM. For DJGPP always use the shell that configure
43
+ # has detected.
44
+ $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos');
45
+ }
46
+
47
+ # Do not use Cwd::chdir, since it might hang.
48
+ use Cwd qw (cwd);
49
+ use File::Copy qw (copy);
50
+ use File::Temp qw (tempfile);
51
+
52
+ use Autom4te::ChannelDefs;
53
+ use Autom4te::Channels;
54
+ use Autom4te::Configure_ac;
55
+ use Autom4te::FileUtils;
56
+ use Autom4te::General;
57
+ use Autom4te::XFile;
58
+
59
+ ## ----------- ##
60
+ ## Variables. ##
61
+ ## ----------- ##
62
+
63
+ # $HELP
64
+ # -----
65
+ $help = "Usage: $0 [OPTION]... [DIRECTORY]...
66
+
67
+ Run 'autoconf' and, when needed, 'aclocal', 'autoheader', 'automake',
68
+ 'autopoint' (formerly 'gettextize'), 'libtoolize', 'intltoolize', and
69
+ 'gtkdocize' to regenerate the GNU Build System files in specified
70
+ DIRECTORIES and their subdirectories (defaulting to '.').
71
+
72
+ By default, it only remakes those files that are older than their
73
+ sources. If you install new versions of the GNU Build System,
74
+ you can make 'autoreconf' remake all of the files by giving it the
75
+ '--force' option.
76
+
77
+ Operation modes:
78
+ -h, --help print this help, then exit
79
+ -V, --version print version number, then exit
80
+ -v, --verbose verbosely report processing
81
+ -d, --debug don't remove temporary files
82
+ -f, --force consider all generated and standard files obsolete
83
+ -i, --install copy missing standard auxiliary files
84
+ --no-recursive don't rebuild sub-packages
85
+ -s, --symlink with -i, install symbolic links instead of copies
86
+ -m, --make when applicable, re-run ./configure && make
87
+ -W, --warnings=CATEGORY report the warnings falling in CATEGORY
88
+ (comma-separated list accepted)
89
+
90
+ " . Autom4te::ChannelDefs::usage . "
91
+
92
+ Library directories:
93
+ -B, --prepend-include=DIR prepend directory DIR to search path
94
+ -I, --include=DIR append directory DIR to search path
95
+
96
+ The environment variables AUTOCONF, ACLOCAL, AUTOHEADER, AUTOM4TE,
97
+ AUTOMAKE, AUTOPOINT, GTKDOCIZE, INTLTOOLIZE, LIBTOOLIZE, M4, MAKE,
98
+ and WARNINGS are honored.
99
+
100
+ Report bugs to <bug-autoconf\@gnu.org>.
101
+
102
+ The full documentation for Autoconf can be read via 'info autoconf',
103
+ or on the Web at <https://www.gnu.org/software/autoconf/manual/>.
104
+ ";
105
+
106
+ # $VERSION
107
+ # --------
108
+ $version = "autoreconf (GNU Autoconf) 2.72
109
+ Copyright (C) 2023 Free Software Foundation, Inc.
110
+ License GPLv3+/Autoconf: GNU GPL version 3 or later
111
+ <https://gnu.org/licenses/gpl.html>, <https://gnu.org/licenses/exceptions.html>
112
+ This is free software: you are free to change and redistribute it.
113
+ There is NO WARRANTY, to the extent permitted by law.
114
+
115
+ Written by David J. MacKenzie and Akim Demaille.
116
+ ";
117
+
118
+ # Lib files.
119
+ my $autoconf = $ENV{'AUTOCONF'} || do { require File::Basename; File::Basename::dirname($0).'/autoconf' };
120
+ my $autoheader = $ENV{'AUTOHEADER'} || do { require File::Basename; File::Basename::dirname($0).'/autoheader' };
121
+ my $autom4te = $ENV{'AUTOM4TE'} || do { require File::Basename; File::Basename::dirname($0).'/autom4te' };
122
+ my $automake = $ENV{'AUTOMAKE'} || 'automake';
123
+ my $aclocal = $ENV{'ACLOCAL'} || 'aclocal';
124
+ my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize';
125
+ my $intltoolize = $ENV{'INTLTOOLIZE'} || 'intltoolize';
126
+ my $gtkdocize = $ENV{'GTKDOCIZE'} || 'gtkdocize';
127
+ my $autopoint = $ENV{'AUTOPOINT'} || 'autopoint';
128
+ my $make = $ENV{'MAKE'} || 'make';
129
+
130
+ # --install -- as --add-missing in other tools.
131
+ my $install = 0;
132
+ # symlink -- when --install, use symlinks instead.
133
+ my $symlink = 0;
134
+
135
+ my @prepend_include;
136
+ my @include;
137
+
138
+ # Rerun './configure && make'?
139
+ my $run_make = 0;
140
+
141
+ # Recurse into subpackages
142
+ my $recursive = 1;
143
+
144
+ ## ---------- ##
145
+ ## Routines. ##
146
+ ## ---------- ##
147
+
148
+
149
+ # parse_args ()
150
+ # -------------
151
+ # Process any command line arguments.
152
+ sub parse_args ()
153
+ {
154
+ my $srcdir;
155
+
156
+ # List of command line warning requests.
157
+ my @warning;
158
+
159
+ getopt ("W|warnings=s" => \@warning,
160
+ 'I|include=s' => \@include,
161
+ 'B|prepend-include=s' => \@prepend_include,
162
+ 'i|install' => \$install,
163
+ 's|symlink' => \$symlink,
164
+ 'm|make' => \$run_make,
165
+ 'recursive!' => \$recursive);
166
+
167
+ # Split the warnings as a list of elements instead of a list of
168
+ # lists.
169
+ @warning = map { split /,/ } @warning;
170
+ parse_WARNINGS;
171
+ parse_warnings @warning;
172
+
173
+ # Even if the user specified a configure.ac, trim to get the
174
+ # directory, and look for configure.ac again. Because (i) the code
175
+ # is simpler, and (ii) we are still able to diagnose simultaneous
176
+ # presence of configure.ac and configure.in.
177
+ @ARGV = map { /configure\.(ac|in)$/ ? dirname ($_) : $_ } @ARGV;
178
+ push @ARGV, '.' unless @ARGV;
179
+
180
+ if ($verbose && $debug)
181
+ {
182
+ for my $prog ($autoconf, $autoheader,
183
+ $automake, $aclocal,
184
+ $autopoint,
185
+ $libtoolize,
186
+ $intltoolize,
187
+ $gtkdocize)
188
+ {
189
+ xsystem ("$prog --version | sed 1q >&2");
190
+ print STDERR "\n";
191
+ }
192
+ }
193
+
194
+ # Dispatch autoreconf's option to the tools.
195
+ # --include;
196
+ $aclocal .= join (' -I ', '', map { shell_quote ($_) } @include);
197
+ $autoconf .= join (' --include=', '', map { shell_quote ($_) } @include);
198
+ $autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
199
+ $autoheader .= join (' --include=', '', map { shell_quote ($_) } @include);
200
+ $autoheader .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
201
+
202
+ # --install and --symlink;
203
+ if ($install)
204
+ {
205
+ $automake .= ' --add-missing';
206
+ $automake .= ' --copy' unless $symlink;
207
+ $libtoolize .= ' --copy' unless $symlink;
208
+ $intltoolize .= ' --copy' unless $symlink;
209
+ $gtkdocize .= ' --copy' unless $symlink;
210
+ }
211
+ # --force;
212
+ if ($force)
213
+ {
214
+ $aclocal .= ' --force';
215
+ $autoconf .= ' --force';
216
+ $autoheader .= ' --force';
217
+ $automake .= ' --force-missing';
218
+ $autopoint .= ' --force';
219
+ $libtoolize .= ' --force';
220
+ $intltoolize .= ' --force';
221
+ }
222
+ else
223
+ {
224
+ $automake .= ' --no-force';
225
+ }
226
+ # --verbose --verbose or --debug;
227
+ if ($verbose > 1 || $debug)
228
+ {
229
+ $autoconf .= ' --verbose';
230
+ $autoheader .= ' --verbose';
231
+ $automake .= ' --verbose';
232
+ $aclocal .= ' --verbose';
233
+ }
234
+ if ($debug)
235
+ {
236
+ $autoconf .= ' --debug';
237
+ $autoheader .= ' --debug';
238
+ $libtoolize .= ' --debug';
239
+ }
240
+
241
+ # Pass down warnings via the WARNINGS environment variable, instead
242
+ # of via --warnings, so that unrecognized warning categories are
243
+ # silently ignored. We already issued diagnostics about warning
244
+ # categories *we* don't recognize; older subsidiary tools may not
245
+ # know all of them, and may treat unrecognized warning categories on
246
+ # the command line as a fatal error when -Werror is in effect.
247
+ $ENV{WARNINGS} = merge_WARNINGS @warning;
248
+ verb "export WARNINGS=$ENV{WARNINGS}";
249
+ }
250
+
251
+
252
+ ## ----------------------- ##
253
+ ## Handling of aux files. ##
254
+ ## ----------------------- ##
255
+
256
+ # find_missing_aux_files
257
+ # ----------------------
258
+ # Look in $aux_dir (or, if that is empty, ., .., and ../..) for all of the
259
+ # files in @$aux_files; return a list of those that do not exist.
260
+ sub find_missing_aux_files
261
+ {
262
+ my ($aux_files, $aux_dir) = @_;
263
+ my @aux_dirs;
264
+ if ($aux_dir)
265
+ {
266
+ push @aux_dirs, $aux_dir;
267
+ }
268
+ else
269
+ {
270
+ @aux_dirs = qw(. .. ../..);
271
+ }
272
+
273
+ # If we find all the aux files in _some_ directory in @aux_dirs, we're
274
+ # good. But if we don't find all of them in any directory in @aux_dirs,
275
+ # return the set of missing files from the _first_ directory in @aux_dirs;
276
+ # this will be less confusing in the common case where AC_CONFIG_AUX_DIR
277
+ # wasn't used and the parent directories don't provide any aux files.
278
+ my @missing_aux_files;
279
+ my @first_missing_aux_files;
280
+
281
+ for my $dir (@aux_dirs)
282
+ {
283
+ @missing_aux_files = ();
284
+ for my $file (@{$aux_files})
285
+ {
286
+ push @missing_aux_files, $file
287
+ unless -e "${dir}/${file}";
288
+ }
289
+
290
+ return () if !@missing_aux_files;
291
+
292
+ @first_missing_aux_files = @missing_aux_files
293
+ unless @first_missing_aux_files;
294
+ }
295
+
296
+ return @first_missing_aux_files;
297
+ }
298
+
299
+ # can_install_aux_files
300
+ # ---------------------
301
+ # Report whether all of the files listed in @_ exist in $buildauxdir,
302
+ # which means we could install them.
303
+ sub can_install_aux_files
304
+ {
305
+ local $_;
306
+ for (@_)
307
+ {
308
+ return 0 unless -f "${buildauxdir}/$_";
309
+ }
310
+ return 1;
311
+ }
312
+
313
+ # extract_time_stamp ($fname)
314
+ # ---------------------------
315
+ # Extract a timestamp line from $fname.
316
+ # This is hardwired to know what to look for in the files we currently install.
317
+ sub extract_time_stamp
318
+ {
319
+ my $fname = shift;
320
+ open my $fh, '<', $fname
321
+ or fatal "opening $fname: $!";
322
+ while (my $l = <$fh>)
323
+ {
324
+ if ($l =~ /^(?:scriptversion|timestamp)='?(\d\d\d\d-\d\d-\d\d(?:\.\d\d)?)/)
325
+ {
326
+ return $1;
327
+ }
328
+ }
329
+ # Old versions of install-sh did not have a timestamp line.
330
+ return '1970-01-01';
331
+ }
332
+
333
+ # our_aux_file_is_newer ($dest, $src)
334
+ # -----------------------------------
335
+ # True if our copy of an aux file ($src) has a newer 'timestamp' line
336
+ # than the matching line in $dest.
337
+ sub our_aux_file_is_newer
338
+ {
339
+ my ($dest, $src) = @_;
340
+ my $dstamp = extract_time_stamp ($dest);
341
+ my $sstamp = extract_time_stamp ($src);
342
+ return $sstamp gt $dstamp;
343
+ }
344
+
345
+ # try_install_aux_files
346
+ # ---------------------
347
+ # Install each of the aux files listed in @$auxfiles, that we are able
348
+ # to install, into $destdir.
349
+ # Remove the files we were able to install from @$auxfiles.
350
+ sub try_install_aux_files
351
+ {
352
+ my ($auxfiles, $destdir) = @_;
353
+ my @unable;
354
+ for my $f (@$auxfiles)
355
+ {
356
+ my $src = "${buildauxdir}/$f";
357
+ if (-f $src)
358
+ {
359
+ install_aux_file ($destdir, $f, $src);
360
+ }
361
+ else
362
+ {
363
+ push @unable, $f;
364
+ }
365
+ }
366
+ @$auxfiles = @unable;
367
+ }
368
+
369
+ # install_aux_file
370
+ # ----------------
371
+ # Install the file $src as $destdir/$f, honoring --symlink and --force.
372
+ sub install_aux_file
373
+ {
374
+ my ($destdir, $f, $src) = @_;
375
+ my $dest = "${destdir}/$f";
376
+ if (-e $dest && ! our_aux_file_is_newer ($dest, $src))
377
+ {
378
+ return;
379
+ }
380
+
381
+ if ($symlink)
382
+ {
383
+ if ($force || ! -l $dest || readlink $dest != $src)
384
+ {
385
+ if (-e $dest)
386
+ {
387
+ unlink $dest
388
+ or fatal "rm -f $dest: $!";
389
+ }
390
+ verb "linking $dest to $src";
391
+ symlink $src, $dest
392
+ or fatal "ln -s $src $dest: $!";
393
+ }
394
+ }
395
+ else
396
+ {
397
+ if (-e $dest && ! -f $dest)
398
+ {
399
+ unlink $dest
400
+ or fatal "rm -f $dest: $!";
401
+ }
402
+ my ($temp, $tempname) = tempfile (UNLINK => 0, DIR => $destdir);
403
+ copy ($src, $tempname)
404
+ or fatal "copying $src to $tempname: $!";
405
+ make_executable ($tempname) if -x $src;
406
+ update_file ($tempname, $dest, $force);
407
+ }
408
+ }
409
+
410
+ # make_executable
411
+ # ---------------
412
+ # Make the file $f be executable by all users it is currently readable by.
413
+ sub make_executable
414
+ {
415
+ my $f = shift;
416
+ my $perm = (stat $f)[2] & 07777;
417
+ $perm |= 0100 if ($perm & 0400);
418
+ $perm |= 0010 if ($perm & 0040);
419
+ $perm |= 0001 if ($perm & 0004);
420
+ chmod $perm, $f
421
+ or fatal "chmod $f: $!";
422
+ }
423
+
424
+
425
+ ## -------------------------- ##
426
+ ## Per-directory operations. ##
427
+ ## -------------------------- ##
428
+
429
+ # &autoreconf_current_directory
430
+ # -----------------------------
431
+ sub autoreconf_current_directory ($)
432
+ {
433
+ my ($directory) = @_;
434
+ my $configure_ac = find_configure_ac;
435
+
436
+ # ---------------------- #
437
+ # Is it using Autoconf? #
438
+ # ---------------------- #
439
+
440
+ my $uses_autoconf;
441
+ my $uses_gettext;
442
+ if (-f $configure_ac)
443
+ {
444
+ my $configure_ac_file = new Autom4te::XFile ("$configure_ac", "<");
445
+ while ($_ = $configure_ac_file->getline)
446
+ {
447
+ s/#.*//;
448
+ s/dnl.*//;
449
+ $uses_autoconf = 1 if /AC_INIT/;
450
+ # See below for why we look for gettext here.
451
+ $uses_gettext = 1 if /^AM_GNU_GETTEXT_(?:REQUIRE_)?VERSION/;
452
+ }
453
+ if (!$uses_autoconf)
454
+ {
455
+ error "$configure_ac: AC_INIT not found; not an autoconf script?";
456
+ return;
457
+ }
458
+ }
459
+ else
460
+ {
461
+ verb "neither configure.ac nor configure.in present in $directory";
462
+ return;
463
+ }
464
+
465
+
466
+ # ------------------- #
467
+ # Running autopoint. #
468
+ # ------------------- #
469
+
470
+ # Gettext is a bit of a problem: its macros are not necessarily
471
+ # visible to aclocal, so if we start with a completely stripped down
472
+ # package (think of a fresh CVS checkout), running 'aclocal' first
473
+ # will fail: the Gettext macros are missing.
474
+ #
475
+ # Therefore, we can't use the traces to decide if we use Gettext or
476
+ # not. I guess that once Gettext move to 2.5x we will be able to,
477
+ # but in the meanwhile forget it.
478
+ #
479
+ # We can only grep for AM_GNU_GETTEXT_(REQUIRE_)?VERSION in configure.ac.
480
+ # You might think this approach is naive, and indeed it is, as it prevents
481
+ # one to embed AM_GNU_GETTEXT_(REQUIRE_)?VERSION in another *.m4, but
482
+ # anyway we don't limit the generality, since... that's what autopoint does.
483
+ # Actually, it is even more restrictive, as it greps for
484
+ # '^AM_GNU_GETTEXT_(REQUIRE_)?VERSION('. We did this above, while
485
+ # scanning configure.ac.
486
+ if (!$uses_gettext)
487
+ {
488
+ verb "$configure_ac: not using Gettext";
489
+ }
490
+ elsif (!$install)
491
+ {
492
+ verb "$configure_ac: not running autopoint: --install not given";
493
+ }
494
+ else
495
+ {
496
+ xsystem_hint ("autopoint is needed because this package uses Gettext",
497
+ $autopoint);
498
+ }
499
+
500
+
501
+ # ----------------- #
502
+ # Running aclocal. #
503
+ # ----------------- #
504
+
505
+ # Run it first: it might discover new macros to add, e.g.,
506
+ # AC_PROG_LIBTOOL, which we will trace later to see if Libtool is
507
+ # used.
508
+ #
509
+ # Always run it. Tracking its sources for up-to-dateness is too
510
+ # complex and too error prone. The best we can do is avoiding
511
+ # nuking the timestamp.
512
+ my $uses_aclocal = 1;
513
+
514
+ # Nevertheless, if aclocal.m4 exists and is not made by aclocal,
515
+ # don't run aclocal.
516
+
517
+ if (-f 'aclocal.m4')
518
+ {
519
+ my $aclocal_m4 = new Autom4te::XFile 'aclocal.m4';
520
+ $_ = $aclocal_m4->getline;
521
+ $uses_aclocal = 0
522
+ unless defined ($_) && /generated.*by aclocal/;
523
+ }
524
+
525
+ # If there are flags for aclocal in Makefile.am, use them.
526
+ my $aclocal_flags = '';
527
+ if ($uses_aclocal && -f 'Makefile.am')
528
+ {
529
+ my $makefile = new Autom4te::XFile 'Makefile.am';
530
+ while ($_ = $makefile->getline)
531
+ {
532
+ if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/)
533
+ {
534
+ $aclocal_flags = $1;
535
+ last;
536
+ }
537
+ }
538
+ }
539
+
540
+ if (!$uses_aclocal)
541
+ {
542
+ verb "$configure_ac: not using aclocal";
543
+ }
544
+ else
545
+ {
546
+ # Some file systems have sub-second timestamps, and if so we may
547
+ # run into trouble later, after we rerun autoconf and set the
548
+ # timestamps of input files to be no greater than aclocal.m4,
549
+ # because the time-stamp-setting operation (utime) has a
550
+ # resolution of only 1 second. Work around the problem by
551
+ # ensuring that there is at least a one-second window before the
552
+ # timestamp of aclocal.m4t in which no file timestamps can
553
+ # fall.
554
+ sleep 1;
555
+
556
+ xsystem ("$aclocal $aclocal_flags");
557
+ }
558
+
559
+ # We might have to rerun aclocal if Libtool (or others) imports new
560
+ # macros.
561
+ my $rerun_aclocal = 0;
562
+
563
+
564
+
565
+ # ------------------------------- #
566
+ # See what tools will be needed. #
567
+ # ------------------------------- #
568
+
569
+ # Perform a single trace reading to avoid --force forcing a rerun
570
+ # between two --trace, that's useless. If there is no AC_INIT, then
571
+ # it's not an Autoconf script; ignore it.
572
+ # Suppress all warnings from this invocation; they may be spurious
573
+ # due to out-of-date files, and in any case they'll duplicate warnings
574
+ # from the final autoconf invocation.
575
+ my $aux_dir;
576
+ my @aux_files;
577
+ my $uses_gettext_via_traces;
578
+ my $uses_libtool;
579
+ my $uses_intltool;
580
+ my $uses_gtkdoc;
581
+ my $uses_libltdl;
582
+ my $uses_autoheader;
583
+ my $uses_automake;
584
+ my @subdir;
585
+ my $traces;
586
+ verb "$configure_ac: tracing";
587
+ {
588
+ local $ENV{WARNINGS} = 'none';
589
+ $traces = new Autom4te::XFile
590
+ ("$autoconf"
591
+ . join (' ',
592
+ map { ' --trace=' . $_ . ':\$n::\${::}%' }
593
+ # If you change this list, update the
594
+ # 'Autoreconf-preselections' section of autom4te.in.
595
+ 'AC_CONFIG_AUX_DIR',
596
+ 'AC_CONFIG_HEADERS',
597
+ 'AC_CONFIG_SUBDIRS',
598
+ 'AC_INIT',
599
+ 'AC_REQUIRE_AUX_FILE',
600
+ 'AC_PROG_LIBTOOL',
601
+ 'AM_PROG_LIBTOOL',
602
+ 'LT_INIT',
603
+ 'LT_CONFIG_LTDL_DIR',
604
+ 'AM_GNU_GETTEXT',
605
+ 'AM_INIT_AUTOMAKE',
606
+ 'GTK_DOC_CHECK',
607
+ 'IT_PROG_INTLTOOL',
608
+ )
609
+ . ' |');
610
+ }
611
+ while ($_ = $traces->getline)
612
+ {
613
+ chomp;
614
+ my ($macro, @args) = split (/::/);
615
+ $aux_dir = $args[0] if $macro eq "AC_CONFIG_AUX_DIR";
616
+ push @aux_files, $args[0] if $macro eq "AC_REQUIRE_AUX_FILE";
617
+ $uses_autoconf = 1 if $macro eq "AC_INIT";
618
+ $uses_gettext_via_traces = 1 if $macro eq "AM_GNU_GETTEXT";
619
+ $uses_libtool = 1 if $macro eq "AC_PROG_LIBTOOL"
620
+ || $macro eq "AM_PROG_LIBTOOL"
621
+ || $macro eq "LT_INIT";
622
+ $uses_libltdl = 1 if $macro eq "LT_CONFIG_LTDL_DIR";
623
+ $uses_autoheader = 1 if $macro eq "AC_CONFIG_HEADERS";
624
+ $uses_automake = 1 if $macro eq "AM_INIT_AUTOMAKE";
625
+ $uses_intltool = 1 if $macro eq "IT_PROG_INTLTOOL";
626
+ $uses_gtkdoc = 1 if $macro eq "GTK_DOC_CHECK";
627
+ push @subdir, split (' ', $args[0] || '')
628
+ if $macro eq "AC_CONFIG_SUBDIRS"
629
+ && $recursive;
630
+ }
631
+ $traces->close;
632
+
633
+ # The subdirs are *optional*, they may not exist.
634
+ foreach (@subdir)
635
+ {
636
+ if (-d)
637
+ {
638
+ verb "$configure_ac: adding subdirectory $_ to autoreconf";
639
+ autoreconf ($_);
640
+ }
641
+ else
642
+ {
643
+ verb "$configure_ac: subdirectory $_ not present";
644
+ }
645
+ }
646
+
647
+ # Gettext consistency checks.
648
+ # Some projects intentionally don't call AM_GNU_GETTEXT_(REQUIRE_)VERSION
649
+ # because they have all of the gettext infrastructure checked into version
650
+ # control and they want us to _not_ run autopoint. Therefore, these
651
+ # diagnostics are only warnings.
652
+ msg('syntax', $configure_ac,
653
+ "AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION"
654
+ . " or AM_GNU_GETTEXT_REQUIRE_VERSION")
655
+ if $uses_gettext_via_traces && ! $uses_gettext;
656
+ msg('syntax', $configure_ac,
657
+ "AM_GNU_GETTEXT_VERSION or AM_GNU_GETTEXT_REQUIRE_VERSION is used,"
658
+ . " but not AM_GNU_GETTEXT")
659
+ if $uses_gettext && ! $uses_gettext_via_traces;
660
+
661
+
662
+ # ---------------------------- #
663
+ # Setting up the source tree. #
664
+ # ---------------------------- #
665
+
666
+ # libtoolize, automake --add-missing etc. will drop files in the
667
+ # $AUX_DIR. But these tools fail to install these files if the
668
+ # directory itself does not exist, which valid: just imagine a CVS
669
+ # repository with hand written code only (there is not even a need
670
+ # for a Makefile.am!).
671
+
672
+ if ($install && defined $aux_dir && ! -d $aux_dir)
673
+ {
674
+ verb "$configure_ac: creating directory $aux_dir";
675
+ mkdir $aux_dir, 0755
676
+ or error "cannot create $aux_dir: $!";
677
+ }
678
+
679
+
680
+ # -------------------- #
681
+ # Running libtoolize. #
682
+ # -------------------- #
683
+
684
+ if (!$uses_libtool)
685
+ {
686
+ verb "$configure_ac: not using Libtool";
687
+ }
688
+ elsif ($install)
689
+ {
690
+ if ($uses_libltdl)
691
+ {
692
+ $libtoolize .= " --ltdl";
693
+ }
694
+ xsystem_hint ("libtoolize is needed because this package uses Libtool",
695
+ $libtoolize);
696
+ $rerun_aclocal = 1;
697
+ }
698
+ else
699
+ {
700
+ verb "$configure_ac: not running libtoolize: --install not given";
701
+ }
702
+
703
+
704
+ # --------------------- #
705
+ # Running intltoolize. #
706
+ # --------------------- #
707
+
708
+ if (!$uses_intltool)
709
+ {
710
+ verb "$configure_ac: not using Intltool";
711
+ }
712
+ elsif ($install)
713
+ {
714
+ xsystem_hint ("intltoolize is needed because this package uses Intltool",
715
+ $intltoolize);
716
+ }
717
+ else
718
+ {
719
+ verb "$configure_ac: not running intltool: --install not given";
720
+ }
721
+
722
+
723
+ # ------------------- #
724
+ # Running gtkdocize. #
725
+ # ------------------- #
726
+
727
+ if (!$uses_gtkdoc)
728
+ {
729
+ verb "$configure_ac: not using Gtkdoc";
730
+ }
731
+ elsif ($install)
732
+ {
733
+ xsystem_hint ("gtkdocize is needed because this package uses Gtkdoc",
734
+ $gtkdocize);
735
+ }
736
+ else
737
+ {
738
+ verb "$configure_ac: not running gtkdocize: --install not given";
739
+ }
740
+
741
+
742
+ # ------------------- #
743
+ # Rerunning aclocal. #
744
+ # ------------------- #
745
+
746
+ # If we re-installed Libtool or Gettext, the macros might have changed.
747
+ # Automake also needs an up-to-date aclocal.m4.
748
+ if ($rerun_aclocal)
749
+ {
750
+ if (!$uses_aclocal)
751
+ {
752
+ verb "$configure_ac: not using aclocal";
753
+ }
754
+ else
755
+ {
756
+ xsystem ("$aclocal $aclocal_flags");
757
+ }
758
+ }
759
+
760
+
761
+ # ------------------ #
762
+ # Running autoconf. #
763
+ # ------------------ #
764
+
765
+ # Don't try to be smarter than 'autoconf', which does its own up to
766
+ # date checks.
767
+ #
768
+ # We prefer running autoconf before autoheader, because (i) the
769
+ # latter runs the former, and (ii) autoconf is stricter than
770
+ # autoheader. So all in all, autoconf should give better error
771
+ # messages.
772
+ xsystem ($autoconf);
773
+
774
+
775
+ # -------------------- #
776
+ # Running autoheader. #
777
+ # -------------------- #
778
+
779
+ # We now consider that if AC_CONFIG_HEADERS is used, then autoheader
780
+ # is used too.
781
+ #
782
+ # Just as for autoconf, up to date ness is performed by the tool
783
+ # itself.
784
+ #
785
+ # Run it before automake, since the latter checks the presence of
786
+ # config.h.in when it sees an AC_CONFIG_HEADERS.
787
+ if (!$uses_autoheader)
788
+ {
789
+ verb "$configure_ac: not using Autoheader";
790
+ }
791
+ else
792
+ {
793
+ xsystem ($autoheader);
794
+ }
795
+
796
+
797
+ # ------------------ #
798
+ # Running automake. #
799
+ # ------------------ #
800
+
801
+ if (!$uses_automake)
802
+ {
803
+ verb "$configure_ac: not using Automake";
804
+ }
805
+ else
806
+ {
807
+ # We should always run automake, and let it decide whether it shall
808
+ # update the file or not. In fact, the effect of '$force' is already
809
+ # included in '$automake' via '--no-force'.
810
+ xsystem ($automake);
811
+ }
812
+
813
+ # ---------------------------------------------------- #
814
+ # Installing aux files and checking for missing ones. #
815
+ # ---------------------------------------------------- #
816
+ try_install_aux_files (\@aux_files, $aux_dir || '.')
817
+ if $install && $force;
818
+
819
+ my @missing_aux_files = find_missing_aux_files (\@aux_files, $aux_dir);
820
+ if (@missing_aux_files)
821
+ {
822
+ try_install_aux_files (\@missing_aux_files, $aux_dir || '.')
823
+ if $install && !$force;
824
+
825
+ for (0 .. $#missing_aux_files)
826
+ {
827
+ my $f = $missing_aux_files[$_];
828
+ if ($_ == $#missing_aux_files)
829
+ {
830
+ # Offer some advice if --install wasn't given and has a
831
+ # chance of helping.
832
+ my $trailer = "";
833
+ $trailer = "\n try running autoreconf --install"
834
+ if (!$install
835
+ && ($uses_automake
836
+ || $uses_libtool
837
+ || $uses_intltool
838
+ || $uses_gtkdoc
839
+ || can_install_aux_files @missing_aux_files));
840
+
841
+ error $configure_ac, "required file '$f' not found$trailer";
842
+ }
843
+ else
844
+ {
845
+ error $configure_ac, "required file '$f' not found";
846
+ }
847
+ }
848
+ }
849
+
850
+ # -------------- #
851
+ # Running make. #
852
+ # -------------- #
853
+
854
+ if ($run_make)
855
+ {
856
+ if (!-f "config.status")
857
+ {
858
+ verb "no config.status: cannot re-make";
859
+ }
860
+ else
861
+ {
862
+ xsystem ("./config.status --recheck");
863
+ xsystem ("./config.status");
864
+ if (!-f "Makefile")
865
+ {
866
+ verb "no Makefile: cannot re-make";
867
+ }
868
+ else
869
+ {
870
+ xsystem ("$make");
871
+ }
872
+ }
873
+ }
874
+ }
875
+
876
+
877
+ # &autoreconf ($DIRECTORY)
878
+ # ------------------------
879
+ # Reconf the $DIRECTORY.
880
+ sub autoreconf ($)
881
+ {
882
+ my ($directory) = @_;
883
+ my $cwd = cwd;
884
+
885
+ # The format for this message is not free: taken from Emacs, itself
886
+ # using GNU Make's format.
887
+ verb "Entering directory '$directory'";
888
+ chdir $directory
889
+ or error "cannot chdir to $directory: $!";
890
+
891
+ autoreconf_current_directory ($directory);
892
+
893
+ # The format is not free: taken from Emacs, itself using GNU Make's
894
+ # format.
895
+ verb "Leaving directory '$directory'";
896
+ chdir $cwd
897
+ or error "cannot chdir to $cwd: $!";
898
+ }
899
+
900
+
901
+ ## ------ ##
902
+ ## Main. ##
903
+ ## ------ ##
904
+
905
+ # When debugging, it is convenient that all the related temporary
906
+ # files be at the same place.
907
+ mktmpdir ('ar');
908
+ $ENV{'TMPDIR'} = $tmp;
909
+ parse_args;
910
+
911
+ # Autoreconf all the given configure.ac. Unless '--no-recursive' is passed,
912
+ # AC_CONFIG_SUBDIRS will be traversed in &autoreconf_current_directory.
913
+ $ENV{'AUTOM4TE'} = $autom4te;
914
+ for my $directory (@ARGV)
915
+ {
916
+ require_configure_ac ($directory);
917
+ autoreconf ($directory);
918
+ }
919
+
920
+ exit $exit_code;
921
+
922
+ ### Setup "GNU" style for perl-mode and cperl-mode.
923
+ ## Local Variables:
924
+ ## perl-indent-level: 2
925
+ ## perl-continued-statement-offset: 2
926
+ ## perl-continued-brace-offset: 0
927
+ ## perl-brace-offset: 0
928
+ ## perl-brace-imaginary-offset: 0
929
+ ## perl-label-offset: -2
930
+ ## cperl-indent-level: 2
931
+ ## cperl-brace-offset: 0
932
+ ## cperl-continued-brace-offset: 0
933
+ ## cperl-label-offset: -2
934
+ ## cperl-extra-newline-before-brace: t
935
+ ## cperl-merge-trailing-else: nil
936
+ ## cperl-continued-statement-offset: 2
937
+ ## End: