+2001-06-25 Akim Demaille <akim@epita.fr>
+
+ * autoscan.in (%macro): Now maps from word to list of macros.
+ (&init_tables): Die when a word which is already handled by
+ explicit macros is mapped to the default macro.
+ (&print_unique): Remove, inlined in...
+ (&output_kind): here.
+ (File::Basename): Use it.
+ (&output): Sort the CONFIG_FILES.
+ * acheaders: Normalize.
+ * acfunctions: Likewise.
+
+
2001-06-25 Akim Demaille <akim@epita.fr>
* aclang.m4 (_AC_LANG_COMPILER_GNU): If GNU, dump the compiler
bcmp AC_HEADER_STDC
bcopy AC_HEADER_STDC
bzero AC_HEADER_STDC
+bzero AC_CHECK_FUNCS
chown AC_FUNC_CHOWN
error AC_FUNC_ERROR_AT_LINE
error_at_line AC_FUNC_ERROR_AT_LINE
fnmatch AC_FUNC_FNMATCH
-fork AC_FUNC_FORK
+fork AC_FUNC_FORK
fseeko AC_FUNC_FSEEKO
ftello AC_FUNC_FSEEKO
getgroups AC_FUNC_GETGROUPS
malloc AC_FUNC_MALLOC
makedev AC_HEADER_MAJOR
memchr AC_HEADER_STDC
+memchr AC_CHECK_FUNCS
memcmp AC_FUNC_MEMCMP
memcpy AC_HEADER_STDC
memmove AC_HEADER_STDC
+memmove AC_CHECK_FUNCS
memset AC_HEADER_STDC
+memset AC_CHECK_FUNCS
minor AC_HEADER_MAJOR
mktime AC_FUNC_MKTIME
mmap AC_FUNC_MMAP
strftime AC_FUNC_STRFTIME
strtod AC_FUNC_STRTOD
utime AC_FUNC_UTIME_NULL
+utime AC_CHECK_FUNCS
vfork AC_FUNC_FORK
vfprintf AC_FUNC_VPRINTF
vprintf AC_FUNC_VPRINTF
alarm
atexit
btowc
-bzero
clock_gettime
dcgettext
doprnt
fesetround
floor
fs_stat_dev
-fseeko
ftime
ftruncate
getcwd
getdelim
-getgroups
gethostbyaddr
gethostbyname
gethostname
gethrtime
-getloadavg
getmntent
getmntinfo
getpagesize
mblen
mbrlen
mbrtowc
-memchr
-memmove
mempcpy
-memset
mkdir
mkfifo
modf
strcspn
strdup
strerror
-strftime
strncasecmp
strndup
strnlen
strrchr
strspn
strstr
-strtod
strtol
strtoul
strtoull
sysinfo
tzset
uname
-utime
utmpname
utmpxname
-vprintf
wcwidth
# Local Variables:
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
+# FIXME: The case of AC_HEADER_STDC + AC_CHECK_HEADERS headers is
+# unclear to me --akim.
+
# Ones that have their own macros.
X11/Xlib.h AC_PATH_X
dirent.h AC_HEADER_DIRENT
float.h AC_HEADER_STDC
+float.h AC_CHECK_HEADERS
ndir.h AC_HEADER_DIRENT
stdarg.h AC_HEADER_STDC
stddef.h AC_HEADER_STDC
+stddef.h AC_CHECK_HEADERS
stdlib.h AC_HEADER_STDC
+stdlib.h AC_CHECK_HEADERS
string.h AC_HEADER_STDC
+string.h AC_CHECK_HEADERS
sys/dir.h AC_HEADER_DIRENT
sys/mkdev.h AC_HEADER_MAJOR
sys/ndir.h AC_HEADER_DIRENT
errno.h
fcntl.h
fenv.h
-float.h
fs_info.h
inttypes.h
langinfo.h
paths.h
sgtty.h
shadow.h
-stddef.h
stdint.h
stdio_ext.h
-stdlib.h
-string.h
strings.h
sys/acl.h
sys/file.h
sys/time.h
sys/timeb.h
sys/vfs.h
-sys/wait.h
sys/window.h
syslog.h
termio.h
use 5.005;
require "find.pl";
+use File::Basename;
use Getopt::Long;
use strict;
-use vars qw($autoconf $datadir $initfile $me $name $verbose
+use vars qw($autoconf $datadir $initfile $name
@cfiles @makefiles @shfiles %c_keywords %printed);
-($me = $0) =~ s,.*/,,;
-$verbose = 0;
+my $me = basename ($0);
+my $verbose = 0;
# $USED{KIND}{ITEM} is set if ITEM is used in the program.
# It is set to its list of locations.
my %used = ();
-# $MACRO{KIND}{ITEM} is the macro to use to test ITEM.
+# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM.
my %macro = ();
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
sub find_autoconf
{
$datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
- (my $dir = $0) =~ s,[^/]*$,,;
+ my $dir = dirname ($0);
$autoconf = '';
# We test "$dir/autoconf" in case we are in the build tree, in which case
# the names are not transformed yet.
# If more than that is required for a common portability problem,
# a new Autoconf macro should probably be written for that case,
# instead of duplicating the code in lots of configure.ac files.
-
+ my $tables_are_consistent = 1;
foreach my $kind (@kinds)
{
my $file = "$datadir/ac$kind";
}
my $word = $1;
my $macro = $2 || $generic_macro{$kind};
- $macro{$kind}{$word} = $macro;
+ # The default macro must be explicitly listed for words
+ # which have a specific macros. This allows to enforce
+ # consistency checks.
+ if (!defined $2 && exists $macro{$kind}{$word})
+ {
+ warn ("$datadir/ac$kind:$.: "
+ . "ignoring implicit call to the generic macro for $word\n");
+ $tables_are_consistent = 0;
+ }
+ else
+ {
+ push @{$macro{$kind}{$word}}, $macro;
+ }
}
close(TABLE);
}
+
+ die "$me: some tables are inconsistent\n"
+ if !$tables_are_consistent;
}
}
-# print_unique ($KIND, $WORD)
-# ---------------------------
-# $WORD, of some $KIND, is used, and needs to be checked. (i) output
-# the needed macro invocation in $configure_scan if it exists and
-# hasn't been printed already, (ii), remember this macro needed.
-sub print_unique ($@)
-{
- my ($kind, $word) = @_;
-
- my $macro = $macro{$kind}{$word};
- my @where = @{$used{$kind}{$word}};
-
- if (defined $macro && !defined $printed{$macro})
- {
- print CONF "$macro\n";
- $printed{$macro} = 1;
-
- push (@{$needed_macros{$macro}}, @where);
- }
-}
-
-
# output_kind ($KIND)
# -------------------
sub output_kind ($)
{
my ($kind) = @_;
+ # Lists of words to be checked with the generic macro.
my @have;
print CONF "\n# $kind_comment{$kind}\n"
if exists $kind_comment{$kind};
foreach my $word (sort keys %{$used{$kind}})
{
- if (defined $macro{$kind}{$word})
+ # Words that were caught, but not to be checked according to
+ # the autoscan library files.
+ next
+ if ! exists $macro{$kind}{$word};
+
+ # Output the needed macro invocations in $configure_scan if not
+ # already printed, and remember these macros are needed.
+ foreach my $macro (@{$macro{$kind}{$word}})
{
if (exists $generic_macro{$kind}
- && $macro{$kind}{$word} eq $generic_macro{$kind})
+ && $macro eq $generic_macro{$kind})
{
push (@have, $word);
push (@{$needed_macros{"$generic_macro{$kind}([$word])"}},
}
else
{
- print_unique ($kind, $word);
+ if (! $printed{$macro})
+ {
+ print CONF "$macro\n";
+ $printed{$macro} = 1;
+ }
+ push (@{$needed_macros{$macro}},
+ @{$used{$kind}{$word}});
}
}
}
$unique_makefiles{$m}++;
}
print CONF "\nAC_CONFIG_FILES([",
- join ("\n ", keys(%unique_makefiles)), "])\n";
+ join ("\n ", sort keys %unique_makefiles), "])\n";
print CONF "AC_OUTPUT\n";
close CONF ||
use 5.005;
require "find.pl";
+use File::Basename;
use Getopt::Long;
use strict;
-use vars qw($autoconf $datadir $initfile $me $name $verbose
+use vars qw($autoconf $datadir $initfile $name
@cfiles @makefiles @shfiles %c_keywords %printed);
-($me = $0) =~ s,.*/,,;
-$verbose = 0;
+my $me = basename ($0);
+my $verbose = 0;
# $USED{KIND}{ITEM} is set if ITEM is used in the program.
# It is set to its list of locations.
my %used = ();
-# $MACRO{KIND}{ITEM} is the macro to use to test ITEM.
+# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM.
my %macro = ();
# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
sub find_autoconf
{
$datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
- (my $dir = $0) =~ s,[^/]*$,,;
+ my $dir = dirname ($0);
$autoconf = '';
# We test "$dir/autoconf" in case we are in the build tree, in which case
# the names are not transformed yet.
# If more than that is required for a common portability problem,
# a new Autoconf macro should probably be written for that case,
# instead of duplicating the code in lots of configure.ac files.
-
+ my $tables_are_consistent = 1;
foreach my $kind (@kinds)
{
my $file = "$datadir/ac$kind";
}
my $word = $1;
my $macro = $2 || $generic_macro{$kind};
- $macro{$kind}{$word} = $macro;
+ # The default macro must be explicitly listed for words
+ # which have a specific macros. This allows to enforce
+ # consistency checks.
+ if (!defined $2 && exists $macro{$kind}{$word})
+ {
+ warn ("$datadir/ac$kind:$.: "
+ . "ignoring implicit call to the generic macro for $word\n");
+ $tables_are_consistent = 0;
+ }
+ else
+ {
+ push @{$macro{$kind}{$word}}, $macro;
+ }
}
close(TABLE);
}
+
+ die "$me: some tables are inconsistent\n"
+ if !$tables_are_consistent;
}
}
-# print_unique ($KIND, $WORD)
-# ---------------------------
-# $WORD, of some $KIND, is used, and needs to be checked. (i) output
-# the needed macro invocation in $configure_scan if it exists and
-# hasn't been printed already, (ii), remember this macro needed.
-sub print_unique ($@)
-{
- my ($kind, $word) = @_;
-
- my $macro = $macro{$kind}{$word};
- my @where = @{$used{$kind}{$word}};
-
- if (defined $macro && !defined $printed{$macro})
- {
- print CONF "$macro\n";
- $printed{$macro} = 1;
-
- push (@{$needed_macros{$macro}}, @where);
- }
-}
-
-
# output_kind ($KIND)
# -------------------
sub output_kind ($)
{
my ($kind) = @_;
+ # Lists of words to be checked with the generic macro.
my @have;
print CONF "\n# $kind_comment{$kind}\n"
if exists $kind_comment{$kind};
foreach my $word (sort keys %{$used{$kind}})
{
- if (defined $macro{$kind}{$word})
+ # Words that were caught, but not to be checked according to
+ # the autoscan library files.
+ next
+ if ! exists $macro{$kind}{$word};
+
+ # Output the needed macro invocations in $configure_scan if not
+ # already printed, and remember these macros are needed.
+ foreach my $macro (@{$macro{$kind}{$word}})
{
if (exists $generic_macro{$kind}
- && $macro{$kind}{$word} eq $generic_macro{$kind})
+ && $macro eq $generic_macro{$kind})
{
push (@have, $word);
push (@{$needed_macros{"$generic_macro{$kind}([$word])"}},
}
else
{
- print_unique ($kind, $word);
+ if (! $printed{$macro})
+ {
+ print CONF "$macro\n";
+ $printed{$macro} = 1;
+ }
+ push (@{$needed_macros{$macro}},
+ @{$used{$kind}{$word}});
}
}
}
$unique_makefiles{$m}++;
}
print CONF "\nAC_CONFIG_FILES([",
- join ("\n ", keys(%unique_makefiles)), "])\n";
+ join ("\n ", sort keys %unique_makefiles), "])\n";
print CONF "AC_OUTPUT\n";
close CONF ||
bcmp AC_HEADER_STDC
bcopy AC_HEADER_STDC
bzero AC_HEADER_STDC
+bzero AC_CHECK_FUNCS
chown AC_FUNC_CHOWN
error AC_FUNC_ERROR_AT_LINE
error_at_line AC_FUNC_ERROR_AT_LINE
fnmatch AC_FUNC_FNMATCH
-fork AC_FUNC_FORK
+fork AC_FUNC_FORK
fseeko AC_FUNC_FSEEKO
ftello AC_FUNC_FSEEKO
getgroups AC_FUNC_GETGROUPS
malloc AC_FUNC_MALLOC
makedev AC_HEADER_MAJOR
memchr AC_HEADER_STDC
+memchr AC_CHECK_FUNCS
memcmp AC_FUNC_MEMCMP
memcpy AC_HEADER_STDC
memmove AC_HEADER_STDC
+memmove AC_CHECK_FUNCS
memset AC_HEADER_STDC
+memset AC_CHECK_FUNCS
minor AC_HEADER_MAJOR
mktime AC_FUNC_MKTIME
mmap AC_FUNC_MMAP
strftime AC_FUNC_STRFTIME
strtod AC_FUNC_STRTOD
utime AC_FUNC_UTIME_NULL
+utime AC_CHECK_FUNCS
vfork AC_FUNC_FORK
vfprintf AC_FUNC_VPRINTF
vprintf AC_FUNC_VPRINTF
alarm
atexit
btowc
-bzero
clock_gettime
dcgettext
doprnt
fesetround
floor
fs_stat_dev
-fseeko
ftime
ftruncate
getcwd
getdelim
-getgroups
gethostbyaddr
gethostbyname
gethostname
gethrtime
-getloadavg
getmntent
getmntinfo
getpagesize
mblen
mbrlen
mbrtowc
-memchr
-memmove
mempcpy
-memset
mkdir
mkfifo
modf
strcspn
strdup
strerror
-strftime
strncasecmp
strndup
strnlen
strrchr
strspn
strstr
-strtod
strtol
strtoul
strtoull
sysinfo
tzset
uname
-utime
utmpname
utmpxname
-vprintf
wcwidth
# Local Variables:
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
+# FIXME: The case of AC_HEADER_STDC + AC_CHECK_HEADERS headers is
+# unclear to me --akim.
+
# Ones that have their own macros.
X11/Xlib.h AC_PATH_X
dirent.h AC_HEADER_DIRENT
float.h AC_HEADER_STDC
+float.h AC_CHECK_HEADERS
ndir.h AC_HEADER_DIRENT
stdarg.h AC_HEADER_STDC
stddef.h AC_HEADER_STDC
+stddef.h AC_CHECK_HEADERS
stdlib.h AC_HEADER_STDC
+stdlib.h AC_CHECK_HEADERS
string.h AC_HEADER_STDC
+string.h AC_CHECK_HEADERS
sys/dir.h AC_HEADER_DIRENT
sys/mkdev.h AC_HEADER_MAJOR
sys/ndir.h AC_HEADER_DIRENT
errno.h
fcntl.h
fenv.h
-float.h
fs_info.h
inttypes.h
langinfo.h
paths.h
sgtty.h
shadow.h
-stddef.h
stdint.h
stdio_ext.h
-stdlib.h
-string.h
strings.h
sys/acl.h
sys/file.h
sys/time.h
sys/timeb.h
sys/vfs.h
-sys/wait.h
sys/window.h
syslog.h
termio.h