]> sourceware.org Git - automake.git/commitdiff
Scan configure.in Fixes for dist. Added dist-shar option.
authorTom Tromey <tromey@redhat.com>
Sat, 13 Jan 1996 20:02:57 +0000 (20:02 +0000)
committerTom Tromey <tromey@redhat.com>
Sat, 13 Jan 1996 20:02:57 +0000 (20:02 +0000)
ChangeLog
Makefile.in
NEWS
TODO
automake.in
texi-version.am

index 840f0da56b80ec4c8d632649e770d5070383d15b..2968b625307e5222314f4a856c199a2420c97338 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Sat Jan 13 00:18:06 1996  Tom Tromey  <tromey@creche.cygnus.com>
+
+       * automake.in (handle_options): Support dist-shar option.
+       (handle_dist_worker): New function.
+       (handle_dist): Use it.
+
+       * texi-version.am (mostlyclean-vti): Remove version.tmp, not
+       *.tmp.
+
+       * automake.in (handle_dist): Chmod distdir 777.  From François
+       Pinard.
+
+       * automake.in (scan_configure): New function.
+       (initialize_per_input): Init libsources.
+       (generate_makefile): Run handle_configure first.
+       (handle_configure): Run scan_configure.
+       (handle_configure): Don't look for AC_PROG_MAKE_SET here.
+
 Thu Jan 11 23:14:18 1996  Tom Tromey  <tromey@creche.cygnus.com>
 
        * Makefile.am (AUTOMAKE_OPTIONS): New variable.
index df20bbe03d3f2ea393a869efb7eff339e05818a8..c3d1e0afc272b20e4d2bebb98bc4601236e64a31 100644 (file)
@@ -63,6 +63,7 @@ DIST_SUBDIRS = samples/cpio/*Makefile.am
 # The following requires a fixed version of the Emacs 19.30 etags.
 ETAGS_ARGS = automake.in --lang=none \
  --regex='/^@node[ \t]+\([^,]+\)/\1/' automake.texi
+ACLOCAL = aclocal.m4
 SCRIPTS = $(bin_SCRIPTS)
 
 
@@ -74,7 +75,6 @@ DVIS = automake.dvi
 
 DATA = $(pkgdata_DATA)
 
-ACLOCAL = aclocal.m4
 DIST_COMMON = README mkinstalldirs configure Makefile.in stamp-vti \
 AUTHORS configure.in ChangeLog THANKS README version.texi mdate-sh TODO \
 INSTALL COPYING Makefile.am texinfo.tex NEWS aclocal.m4 install-sh
@@ -88,6 +88,18 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(INFOS) $(MANS) \
 default: all
 
 
+$(srcdir)/Makefile.in: Makefile.am
+       cd $(srcdir) && automake Makefile
+
+# For an explanation of the following Makefile rules, see node
+# `Automatic Remaking' in GNU Autoconf documentation.
+Makefile: Makefile.in config.status
+       CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
+config.status: configure
+       ./config.status --recheck
+$(srcdir)/configure: configure.in $(ACLOCAL)
+       cd $(srcdir) && autoconf
+
 mostlyclean-binSCRIPTS:
 
 clean-binSCRIPTS:
@@ -125,7 +137,7 @@ stamp-vti: automake.texi $(top_srcdir)/configure.in
        echo timestamp > $(srcdir)/stamp-vti
 
 mostlyclean-vti:
-       rm -f *.tmp
+       rm -f version.tmp
 
 clean-vti:
 
@@ -178,18 +190,6 @@ uninstall-pkgdataDATA:
          rm -f $(pkgdatadir)/$$p;              \
        done
 
-$(srcdir)/Makefile.in: Makefile.am
-       cd $(srcdir) && automake Makefile
-
-# For an explanation of the following Makefile rules, see node
-# `Automatic Remaking' in GNU Autoconf documentation.
-Makefile: Makefile.in config.status
-       CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
-config.status: configure
-       ./config.status --recheck
-$(srcdir)/configure: configure.in $(ACLOCAL)
-       cd $(srcdir) && autoconf
-
 ID:    $(HEADERS) $(SOURCES)
        here=`pwd` && cd $(srcdir) && mkid -f $$here/ID $(SOURCES) $(HEADERS)
 
@@ -211,6 +211,7 @@ distdir = $(PACKAGE)-$(VERSION)
 dist: $(DISTFILES)
        rm -rf $(distdir)
        mkdir $(distdir)
+       chmod 777 $(distdir)
        distdir=`cd $(distdir) && pwd` \
          && cd $(srcdir) \
          && automake --include-deps --output-dir=$$distdir --strictness=gnits
diff --git a/NEWS b/NEWS
index 3cf6b71e81bcc6950deba19e7ffdfbc4939c4fee..d79f689cf9de8288aad716c51d49505c96eaf03e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,7 +3,8 @@ New in 0.28:
 * More standards checking
 * Bug fixes
 * Cleaned up 'dist' targets
-* Added AUTOMAKE_OPTIONS variable
+* Added AUTOMAKE_OPTIONS variable and several options
+* Now scans configure.in to get some information
 \f
 New in 0.27:
 * Works with Perl 4 again
diff --git a/TODO b/TODO
index d2f49a03b59512b5f217578f53f80e583aba6515..b0250c5eb62f0c247e8f46318ae9a456593537a2 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,6 @@
 Top priorities:
+* finish configure.in scanning.  must do something with C files found
+  must handle subdir case correctly (don't reinit libsources each time)
 * Use info_TEXINFOS
 * Figure out how to handle MANS:
   * use man_MANS?  Or man1_MANS, man2_MANS, etc?
@@ -63,8 +65,6 @@ It might be cool to generate .texi dependencies by grepping for
 @include.  (If done, it should be done the same way C dependency is
 done)
 
-Rename --include-deps to --insert-deps?
-
 It would be good to check some parts of GNU standards.  Already check
 for install-sh and mkinstalldirs.  What else is required to be in
 package by GNU standards or by automake?
index f36b06d46c5acd383f5d8d760e49f8c1096aabf0..9f406e22b356ca129f3a566204b6e5375944e46a 100755 (executable)
@@ -236,6 +236,7 @@ sub generate_makefile
     &check_gnu_standards;
     &check_gnits_standards;
 
+    &handle_configure;
     &handle_libraries;
     &handle_programs;
     &handle_scripts;
@@ -250,7 +251,6 @@ sub generate_makefile
     &handle_data;
     &handle_headers;
     &handle_subdirs;
-    &handle_configure;
     &handle_tags;
     &handle_dist;
     &handle_dependencies;
@@ -292,7 +292,7 @@ sub handle_options
        {
            &set_strictness ($_);
        }
-       elsif ($_ eq 'no-installman' || $_ eq 'ansi2knr')
+       elsif ($_ eq 'no-installman' || $_ eq 'ansi2knr' || $_ eq 'dist-shar')
        {
            # Explicitly recognize these.
        }
@@ -676,50 +676,23 @@ sub handle_tags
     }
 }
 
-# Handle 'dist' target.
-sub handle_dist
+# Generate actual 'dist' (or dist-shar) rule.
+sub handle_dist_worker
 {
-    # Look for common files that should be included in distribution.
-    local ($cfile);
-    foreach $cfile (@common_files)
-    {
-       if (-f ($relative_dir . "/" . $cfile))
-       {
-           &push_dist_common ($cfile);
-       }
-    }
-
-    # Keys of %dist_common are names of files to distributed.  We put
-    # README first because it then becomes easier to make a
-    # Usenet-compliant shar file (in these, README must be first).
-    # FIXME do more ordering of files here.
-    local (@coms);
-    if (defined $dist_common{'README'})
-    {
-       push (@coms, 'README');
-       undef $dist_common{'README'};
-    }
-    push (@coms, keys %dist_common);
-
-    &pretty_print ("DIST_COMMON =", '', @coms);
-    $output_vars .= "\n";
-
-    # Some boilerplate.
-    $output_vars .= &file_contents ('dist-vars');
+    local ($distshar) = @_;
+    local ($target) = $distshar ? 'dist-shar' : 'dist';
 
+    $output_rules .= $target . ': $(DISTFILES)' . "\n";
+    
     # Initialization; only at top level.
     if ($relative_dir eq '.')
     {
        $output_rules .=
            (
-            # Some boilerplate.
-            '
-distdir = $(PACKAGE)-$(VERSION)
-dist: $(DISTFILES)
-'
             # Create dist directory.
-            . '        rm -rf $(distdir)
+            '  rm -rf $(distdir)
        mkdir $(distdir)
+       chmod 777 $(distdir)
 '
             # We need an absolute path for --output-dir.  Thus the
             # weirdness.
@@ -730,17 +703,6 @@ dist: $(DISTFILES)
             . $strictness_name . "\n"
             );
     }
-    else
-    {
-       $output_rules .=
-           (
-            # Some boilerplate.
-            "\nsubdir = " . $relative_dir . "\n"
-            . 'distdir = $(PACKAGE)-$(VERSION)/$(subdir)
-dist: $(DISTFILES)
-'
-            );
-    }
 
     # In loop, test for file existence because sometimes a file gets
     # included in DISTFILES twice.  For example this happens when a
@@ -786,13 +748,68 @@ dist: $(DISTFILES)
     # Finalize.
     if ($relative_dir eq '.')
     {
-       $output_rules .= '      chmod -R a+r $(distdir)
-       tar -chozf $(distdir).tar.gz $(distdir)
-       rm -rf $(distdir)
-';
+       $output_rules .= '      chmod -R a+r $(distdir)' . "\n\t";
+       if ($distshar)
+       {
+           $output_rules .= 'shar $(distdir) | gzip > $(distdir).shar.gz';
+       }
+       else
+       {
+           $output_rules .= 'tar -chozf $(distdir).tar.gz $(distdir)';
+       }
+       $output_rules .= "\n\t" . 'rm -rf $(distdir)' . "\n";
+    }
+
+    push (@phony, $target);
+}
+
+# Handle 'dist' target.
+sub handle_dist
+{
+    # Look for common files that should be included in distribution.
+    local ($cfile);
+    foreach $cfile (@common_files)
+    {
+       if (-f ($relative_dir . "/" . $cfile))
+       {
+           &push_dist_common ($cfile);
+       }
+    }
+
+    # Keys of %dist_common are names of files to distributed.  We put
+    # README first because it then becomes easier to make a
+    # Usenet-compliant shar file (in these, README must be first).
+    # FIXME do more ordering of files here.
+    local (@coms);
+    if (defined $dist_common{'README'})
+    {
+       push (@coms, 'README');
+       undef $dist_common{'README'};
+    }
+    push (@coms, keys %dist_common);
+
+    &pretty_print ("DIST_COMMON =", '', @coms);
+    $output_vars .= "\n";
+
+    # Some boilerplate.
+    $output_vars .= &file_contents ('dist-vars');
+
+    # Put these things in rules section so it is easier for whoever
+    # reads Makefile.in.
+    if ($relative_dir eq '.')
+    {
+       $output_rules .= "\n" . 'distdir = $(PACKAGE)-$(VERSION)' . "\n";
+    }
+    else
+    {
+       $output_rules .= ("\nsubdir = " . $relative_dir . "\n"
+                         . 'distdir = $(PACKAGE)-$(VERSION)/$(subdir)'
+                         . "\n");
     }
 
-    push (@phony, 'dist');
+    # Generate 'dist' target, and maybe dist-shar.
+    &handle_dist_worker (0);
+    &handle_dist_worker (1) if defined $options{'dist-shar'};
 }
 
 # Handle auto-dependency code.
@@ -874,19 +891,7 @@ sub handle_configure
     else
     {
        &require_file ($NORMAL, 'configure.in');
-       # FIXME require 'configure'?  What if autoconf hasn't been run
-       # yet?
-
-       if (defined $contents{'SUBDIRS'})
-       {
-           # We required AC_PROG_MAKE_SET.
-           system ("grep AC_PROG_MAKE_SET configure.in > /dev/null 2>&1");
-           if ($? >> 8)
-           {
-               # Nope.
-               &am_error ("AC_PROG_MAKE_SET must be used in configure.in");
-           }
-       }
+       &scan_configure;
 
        if (-f 'aclocal.m4')
        {
@@ -1186,6 +1191,60 @@ sub handle_phony
 
 ################################################################
 
+# Scan configure.in for interesting things.
+sub scan_configure
+{
+    open (CONFIGURE, 'configure.in')
+       || die "automake: couldn't open configure.in: $!\n";
+
+    local ($seen_make_set) = 0;
+    while (<CONFIGURE>)
+    {
+       # Populate libobjs array.
+       if (/AC_FUNC_ALLOCA/)
+       {
+           $libsources{'alloca.c'} = 1;
+       }
+       elsif (/AC_FUNC_GETLOADAVG/)
+       {
+           $libsources{'getloadavg.c'} = 1;
+       }
+       elsif (/AC_FUNC_MEMCMP/)
+       {
+           $libsources{'memcmp.c'} = 1;
+       }
+       elsif (/AC_STRUCT_ST_BLOCKS/)
+       {
+           $libsources{'fileblocks.c'} = 1;
+       }
+       elsif (/AC_REPLACE_FUNCS\s*\((.*)\)/)
+       {
+           foreach (split (/\s+/, $1))
+           {
+               $libsources{$_ . '.c'} = 1;
+           }
+       }
+       elsif (/LIBOBJS="(.*)\.o \$LIBOBJS"/)
+       {
+           $libsources{$1 . '.c'} = 1;
+       }
+       elsif (/LIBOBJS="\$LIBOBJS (.*)\.o"/)
+       {
+           $libsources{$1 . '.c'} = 1;
+       }
+
+       $seen_make_set = 1 if /AC_PROG_MAKE_SET/;
+    }
+
+    # If SUBDIRS defined, require AC_PROG_MAKE_SET.
+    &am_error ("AC_PROG_MAKE_SET must be used in configure.in")
+       if defined $contents{'SUBDIRS'} && ! $seen_make_set;
+
+    close (CONFIGURE);
+}
+
+################################################################
+
 # Do any extra checking for GNU standards.
 sub check_gnu_standards
 {
@@ -1542,6 +1601,9 @@ sub initialize_per_input
 
     # Options from AUTOMAKE_OPTIONS.
     %options = ();
+
+    # Files found by scanning configure.in for LIBOBJS.
+    %libsources = ();
 }
 
 
index 7bc0efd2ee9e1da07cf2aef1916453b11b0b00c5..451c92922938b4f247f8f4ab3e0ded911727894b 100644 (file)
@@ -32,7 +32,7 @@ stamp-vti: @TEXI@ $(top_srcdir)/configure.in
        echo timestamp > $(srcdir)/stamp-vti
 
 mostlyclean-vti:
-       rm -f *.tmp
+       rm -f version.tmp
 
 clean-vti:
 
This page took 0.039478 seconds and 5 git commands to generate.