3 # This script reorders config_h.SH after metaconfig
4 # Changing metaconfig is too complicated
6 # Copyright (C) 2005-2005 by H.Merijn Brand (m)'05 [25-05-2005]
8 # You may distribute under the terms of either the GNU General Public
9 # License or the Artistic License, as specified in the README file.
14 my ($cSH, $ch, @ch, %ch) = ("config_h.SH");
15 open $ch, "<$cSH" or die "Cannot open $cSH: $!\n";
24 foreach my $ch (0 .. $#ch) {
25 while ($ch[$ch] =~ m{^/\* ([A-Z]\w+)}gm) {
32 # This symbol must be defined BEFORE ...
33 BYTEORDER => [ qw( UVSIZE ) ],
34 LONGSIZE => [ qw( BYTEORDER ) ],
35 MULTIARCH => [ qw( BYTEORDER MEM_ALIGNBYTES ) ],
36 USE_CROSS_COMPILE => [ qw( BYTEORDER MEM_ALIGNBYTES ) ],
37 HAS_QUAD => [ qw( I64TYPE ) ],
38 HAS_GETGROUPS => [ qw( Groups_t ) ],
39 HAS_SETGROUPS => [ qw( Groups_t ) ],
45 foreach my $sym (keys %dep) {
47 foreach my $dep (@{$dep{$sym}}) {
48 print STDERR "Check if $sym\t($ch{$sym}) precedes $dep\t($ch{$dep})\n";
49 $ch{$sym} < $ch{$dep} and next;
50 my $ch = splice @ch, $ch{$sym}, 1;
51 splice @ch, $ch{$dep}, 0, $ch;
58 open $ch, "> $cSH" or die "Cannot write $cSH: $!\n";