autoreconf.in

来自「LINUX下的源码工具,可自己分析,或者直接装在系统上作为应用」· IN 代码 · 共 617 行 · 第 1/2 页

IN
617
字号
	  if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/)	    {	      $aclocal_flags = $1;	      last;	    }	}    }  if (!$uses_aclocal)    {      verbose "$configure_ac: not using aclocal";    }  else    {      # Some filesystems have sub-second time stamps, and if so we may      # run into trouble later, after we rerun autoconf and set the      # time stamps of input files to be no greater than aclocal.m4,      # because the time-stamp-setting operation (utime) has a      # resolution of only 1 second.  Work around the problem by      # ensuring that there is at least a one-second window before the      # time stamp of aclocal.m4t in which no file time stamps can      # fall.      sleep 1;      xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t");      # aclocal may produce no output.      update_file ('aclocal.m4t', 'aclocal.m4')	if -f 'aclocal.m4t';    }  # We might have to rerun aclocal if Libtool (or others) imports new  # macros.  my $rerun_aclocal = 0;  # ------------------------------- #  # See what tools will be needed.  #  # ------------------------------- #  # Perform a single trace reading to avoid --force forcing a rerun  # between two --trace, that's useless.  If there is no AC_INIT, then  # we are not interested: it looks like a Cygnus thingy.  my $uses_gettext_via_traces;  my $uses_libtool;  my $uses_autoheader;  my @subdir;  verbose "$configure_ac: tracing";  my $traces = new Autom4te::XFile    ("$autoconf"     . join (' --trace=', '',	     # If you change this list, update the	     # `Autoreconf-preselections' section of autom4te.in.	     'AC_CONFIG_HEADERS',	     'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1',	     'AC_INIT',	     'AC_PROG_LIBTOOL',	     'AM_GNU_GETTEXT',	    )     . ' |');  while ($_ = $traces->getline)    {      $uses_autoconf = 1            if /AC_INIT/;      $uses_gettext_via_traces = 1  if /AM_GNU_GETTEXT/;      $uses_libtool = 1             if /AC_PROG_LIBTOOL/;      $uses_autoheader = 1          if /AC_CONFIG_HEADERS/;      push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/;    }  # The subdirs are *optional*, they may not exist.  foreach (@subdir)    {      if (-d)	{	  verbose "$configure_ac: subdirectory $_ to autoreconf";	  autoreconf ($_);	}      else	{	  verbose "$configure_ac: subdirectory $_ not present";	}    }  # Gettext consistency checks...  error "$configure_ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION"    if $uses_gettext_via_traces && ! $uses_gettext;  error "$configure_ac: AM_GNU_GETTEXT_VERSION is used, but not AM_GNU_GETTEXT"    if $uses_gettext && ! $uses_gettext_via_traces;  # -------------------- #  # Running libtoolize.  #  # -------------------- #  if (!$uses_libtool)    {      verbose "$configure_ac: not using Libtool";    }  elsif ($install)    {      xsystem ($libtoolize);      $rerun_aclocal = 1;    }  else    {      verbose "$configure_ac: not running libtoolize: --install not given";    }  # ------------------- #  # Rerunning aclocal.  #  # ------------------- #  # If we re-installed Libtool or Gettext, the macros might have changed.  # Automake also needs an up-to-date aclocal.m4.  if ($rerun_aclocal)    {      if (!$uses_aclocal)	{	  verbose "$configure_ac: not using aclocal";	}      else	{	  xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t");	  # 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;		    }		}	    }	}    }  # ------------------ #  # Running autoconf.  #  # ------------------ #  # Don't try to be smarter than `autoconf', which does its own up to  # date checks.  #  # We prefer running autoconf before autoheader, because (i) the  # latter runs the former, and (ii) autoconf is stricter than  # autoheader.  So all in all, autoconf should give better error  # messages.  xsystem ($autoconf);  # -------------------- #  # Running autoheader.  #  # -------------------- #  # We now consider that if AC_CONFIG_HEADERS is used, then autoheader  # is used too.  #  # Just as for autoconf, up to date ness is performed by the tool  # itself.  #  # Run it before automake, since the latter checks the presence of  # config.h.in when it sees an AC_CONFIG_HEADERS.  if (!$uses_autoheader)    {      verbose "$configure_ac: not using Autoheader";    }  else    {      xsystem ($autoheader);    }  # ------------------ #  # Running automake.  #  # ------------------ #  # Assumes that there is a Makefile.am in the topmost directory.  if (!-f 'Makefile.am')    {      verbose "$configure_ac: not using Automake";    }  else    {      # We should always run automake, and let it decide whether it shall      # update the file or not.  In fact, the effect of `$force' is already      # included in `$automake' via `--no-force'.      xsystem ($automake);    }  # -------------- #  # Running make.  #  # -------------- #  if ($make)    {      if (!-f "config.status")	{	  verbose "no config.status: cannot re-make";	}      else	{	  xsystem ("./config.status --recheck");	  xsystem ("./config.status");	  if (!-f "Makefile")	    {	      verbose "no Makefile: cannot re-make";	    }	  else	    {	      xsystem ("make");	    }	}    }}# &autoreconf ($DIRECTORY)# ------------------------# Reconf the $DIRECTORY.sub autoreconf ($){  my ($directory) = @_;  my $cwd = cwd;  # The format for this message is not free: taken from Emacs, itself  # using GNU Make's format.  verbose "Entering directory `$directory'";  chdir $directory    or error "cannot chdir to $directory: $!";  autoreconf_current_directory;  # The format is not free: taken from Emacs, itself using GNU Make's  # format.  verbose "Leaving directory `$directory'";  chdir $cwd    or error "cannot chdir to $cwd: $!";}## ------ #### Main.  #### ------ ### When debugging, it is convenient that all the related temporary# files be at the same place.mktmpdir ('ar');$ENV{'TMPDIR'} = $tmp;parse_args;# Autoreconf all the given configure.ac.  A while loop, not a for,# since the list can change at runtime because of AC_CONFIG_SUBDIRS.for my $directory (@ARGV)  {    autoreconf ($directory);  }### Setup "GNU" style for perl-mode and cperl-mode.## Local Variables:## perl-indent-level: 2## perl-continued-statement-offset: 2## perl-continued-brace-offset: 0## perl-brace-offset: 0## perl-brace-imaginary-offset: 0## perl-label-offset: -2## cperl-indent-level: 2## cperl-brace-offset: 0## cperl-continued-brace-offset: 0## cperl-label-offset: -2## cperl-extra-newline-before-brace: t## cperl-merge-trailing-else: nil## cperl-continued-statement-offset: 2## End:

⌨️ 快捷键说明

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