⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autoscan.in

📁 autoconf是一个产生可以自动配置源代码包
💻 IN
📖 第 1 页 / 共 2 页
字号:
#! @PERL@ -w# -*- perl -*-# @configure_input@# autoscan - Create configure.scan (a preliminary configure.ac) for a package.# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006#  Free Software Foundation, Inc.# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.# You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA# 02110-1301, USA.# Written by David MacKenzie <djm@gnu.ai.mit.edu>.eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'    if 0;BEGIN{  my $datadir = $ENV{'autom4te_perllibdir'} || '@datadir@';  unshift @INC, $datadir;  # Override SHELL.  On DJGPP SHELL may not be set to a shell  # that can handle redirection and quote arguments correctly,  # e.g.: COMMAND.COM.  For DJGPP always use the shell that configure  # has detected.  $ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');}use Autom4te::ChannelDefs;use Autom4te::Configure_ac;use Autom4te::General;use Autom4te::FileUtils;use Autom4te::XFile;use File::Basename;use File::Find;use strict;use vars qw(@cfiles @makefiles @shfiles @subdirs %printed);# The kind of the words we are looking for.my @kinds = qw (function header identifier program		makevar librarie);# For each kind, the default macro.my %generic_macro =  (   'function'   => 'AC_CHECK_FUNCS',   'header'     => 'AC_CHECK_HEADERS',   'identifier' => 'AC_CHECK_TYPES',   'program'    => 'AC_CHECK_PROGS',   'library'    => 'AC_CHECK_LIB'  );my %kind_comment =  (   'function'   => 'Checks for library functions.',   'header'     => 'Checks for header files.',   'identifier' => 'Checks for typedefs, structures, and compiler characteristics.',   'program'    => 'Checks for programs.',  );# $USED{KIND}{ITEM} is the list of locations where the ITEM (of KIND) was used# in the user package.# For instance $USED{function}{alloca} is the list of `file:line' where# `alloca (...)' appears.my %used = ();# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM.# Initialized from lib/autoscan/*.  E.g., $MACRO{function}{alloca} contains# the singleton AC_FUNC_ALLOCA.  Some require several checks.my %macro = ();# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.# E.g., $NEEDED_MACROS{AC_FUNC_ALLOC} the list of `file:line' containing# `alloca (...)'.my %needed_macros =  (   'AC_PREREQ' => [$me],  );my $configure_scan = 'configure.scan';my $log;# Autoconf and lib files.my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';my $autoconf = "$autom4te --language=autoconf";my @prepend_include;my @include = ('@datadir@');# $help# -----$help = "Usage: $0 [OPTION] ... [SRCDIR]Examine source files in the directory tree rooted at SRCDIR, or thecurrent directory if none is given.  Search the source files forcommon portability problems, check for incompleteness of`configure.ac', and create a file `$configure_scan' which is apreliminary `configure.ac' for that package.  -h, --help          print this help, then exit  -V, --version       print version number, then exit  -v, --verbose       verbosely report processing  -d, --debug         don't remove temporary filesLibrary directories:  -B, --prepend-include=DIR  prepend directory DIR to search path  -I, --include=DIR          append directory DIR to search pathReport bugs to <bug-autoconf\@gnu.org>.\n";# $version# --------$version = "autoscan (@PACKAGE_NAME@) @VERSION@Written by David J. MacKenzie and Akim Demaille.Copyright (C) 2006 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";## ------------------------ #### Command line interface.  #### ------------------------ ### parse_args ()# -------------# Process any command line arguments.sub parse_args (){  getopt ('I|include=s' => \@include,	  'B|prepend-include=s' => \@prepend_include);  die "$me: too many argumentsTry `$me --help' for more information.\n"    if @ARGV > 1;  my $srcdir = $ARGV[0] || ".";  verb "srcdir = $srcdir";  chdir $srcdir || error "cannot cd to $srcdir: $!";}# init_tables ()# --------------# Put values in the tables of what to do with each token.sub init_tables (){  # The data file format supports only one line of macros per function.  # 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 $file = find_file ("autoscan/autoscan.list",			reverse (@prepend_include), @include);  my $table = new Autom4te::XFile $file;  my $tables_are_consistent = 1;  while ($_ = $table->getline)    {      # Ignore blank lines and comments.      next	if /^\s*$/ || /^\s*\#/;      # '<kind>: <word> <macro invocation>' or...      # '<kind>: <word> warn: <message>'.      if (/^(\S+):\s+(\S+)\s+(\S.*)$/)	{	  my ($kind, $word, $macro) = ($1, $2, $3);	  error "$file:$.: invalid kind: $_"	    unless grep { $_ eq $kind } @kinds;	  push @{$macro{$kind}{$word}}, $macro;	}      else	{	  error "$file:$.: invalid definition: $_";	}    }  if ($debug)    {      foreach my $kind (@kinds)	{	  foreach my $word (sort keys %{$macro{$kind}})	    {	      print "$kind: $word: @{$macro{$kind}{$word}}\n";	    }	}    }}# used ($KIND, $WORD, [$WHERE])# -----------------------------# $WORD is used as a $KIND.sub used ($$;$){  my ($kind, $word, $where) = @_;  $where ||= "$File::Find::name:$.";  if (      # Check for all the libraries.  But `-links' is certainly a      # `find' argument, and `-le', a `test' argument.      ($kind eq 'library' && $word !~ /^(e|inks)$/)      # Other than libraries are to be checked only if listed in      # the Autoscan library files.      || defined $macro{$kind}{$word}     )    {      push (@{$used{$kind}{$word}}, $where);    }}## ----------------------- #### Scanning source files.  #### ----------------------- ### scan_c_file ($FILE-NAME)# ------------------------sub scan_c_file ($){  my ($file_name) = @_;  push @cfiles, $File::Find::name;  # Nonzero if in a multiline comment.  my $in_comment = 0;  my $file = new Autom4te::XFile "<$file_name";  while ($_ = $file->getline)    {      # Strip out comments.      if ($in_comment && s,^.*?\*/,,)	{	  $in_comment = 0;	}      # The whole line is inside a commment.      next if $in_comment;      # All on one line.      s,/\*.*?\*/,,g;      # Starting on this line.      if (s,/\*.*$,,)	{	  $in_comment = 1;	}      # Preprocessor directives.      if (s/^\s*\#\s*//)	{	  if (/^include\s*<([^>]*)>/)	    {	      used ('header', $1);	    }	  if (s/^(if|ifdef|ifndef|elif)\s+//)	    {	      foreach my $word (split (/\W+/))		{		  used ('identifier', $word)		    unless $word eq 'defined' || $word !~ /^[a-zA-Z_]/;		}	    }	  # Ignore other preprocessor directives.	  next;	}      # Remove string and character constants.      s,\"[^\"]*\",,g;      s,\'[^\']*\',,g;      # Tokens in the code.      # Maybe we should ignore function definitions (in column 0)?      while (s/\b([a-zA-Z_]\w*)\s*\(/ /)	{	  used ('function', $1);	}      while (s/\b([a-zA-Z_]\w*)\b/ /)	{	  used ('identifier', $1);	}    }  $file->close;}# scan_makefile($MAKEFILE-NAME)# -----------------------------sub scan_makefile ($){  my ($file_name) = @_;  push @makefiles, $File::Find::name;  my $file = new Autom4te::XFile "<$file_name";  while ($_ = $file->getline)    {      # Strip out comments.      s/#.*//;      # Variable assignments.      while (s/\b([a-zA-Z_]\w*)\s*=/ /)	{	  used ('makevar', $1);	}      # Be sure to catch a whole word.  For instance `lex$U.$(OBJEXT)'      # is a single token.  Otherwise we might believe `lex' is needed.      foreach my $word (split (/\s+/))	{	  # Libraries.	  if ($word =~ /^-l([a-zA-Z_]\w*)$/)	    {	      used ('library', $1);	    }	  # Tokens in the code.	  # We allow some additional characters, e.g., `+', since	  # autoscan/programs includes `c++'.	  if ($word =~ /^[a-zA-Z_][\w+]*$/)	    {	      used ('program', $word);	    }	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -