automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: better diagnostics about undefined variables + simplifications


From: Alexandre Duret-Lutz
Subject: FYI: better diagnostics about undefined variables + simplifications
Date: 01 Jul 2002 00:08:07 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

This patch changes the following error messages

1.  C++ source seen but `CXX' not defined in `configure.ac'

2.  invalid variable `pkgpython_PYTHON'

3.  invalid variable `foo_SCRIPTS'

4.  invalid variable `lib_SCRIPTS'

into

1.  C++ source seen but `CXX' not defined.
    The usual way to define `CXX' is to add `AC_PROG_CXX'
    to `configure.ac' and run `autoconf' again.

2.  `pkgpython_PYTHON' is used but `pkgpythondir' is not defined.
    The usual way to define `pkgpythondir' is to add `AM_PATH_PYTHON'
    to `configure.ac' and run `aclocal' and `autoconf' again.

3.  `foo_SCRIPTS' is used but `foodir' is not defined.

4.  `libdir' is not a legitimate directory for `SCRIPTS'

The fourth error apart, all these messages are produced by a new
function, `require_variables', that checks whether some
variables are defined and prints an error otherwise.  Two
associative arrays, `am_macro_for_var' and `ac_macro_for_var'
map known variables to AC_ or AM_ macros so we can suggest which
macro should be called to fix the error.

In addition to improving the disgnostics, this also simplify a
few places in Automake.  Especially we don't have to scan
AC_PROG_LEX, AM_C_PROTOTYPE, AM_PATH_LISPDIR, and
AM_PATH_PYTHON, we just requires the variables we need: LEX,
ANSI2KNR, EMACS, lispdir, PYTHON, pythondir, etc.  (Actually, we
don't even have to require pythondir explicitely, this will be
done automatically when python_PYTHON is used.)

Doing this is also more flexible: we don't require that a
particular Autoconf macro is called, we simply require that the
variable Automake uses are defined.  If the user wants to
hardcode lispdir in his Makefile.am, he can do so.  If he wants
to call MY_PATH_PYTHON instead of AM_PATH_PYTHON, he can do this
too.

I'll commit once `make check' has finished.

2002-06-30  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (am_macro_for_var, ac_macro_for_var,
        required_variables): New variables.
        (am_c_prototypes, seen_prog_lex, am_lispdir_location,
        pythondir_location): Remove.
        (initialize_per_input): Clear %required_variables.
        (require_variables, require_variables_for_macro): New functions.
        (handle_languages): Call &require_variables for $lang->config_vars.
        (handle_compile): Call &require_variables_for_macro for the
        ANSI2KNR and U variables.
        (handle_emacs_lisp): Call &require_variables for EMACS and libdir.
        (handle_python): Call &require_variables for PYTHON.  Don't
        explicitly allow `python' as a prefix for PYTHON.
        (scan_autoconf_traces): Don't scan AC_PROG_LEX, AM_C_PROTOTYPES,
        AM_PATH_LISPDIR, and AM_PATH_PYTHON.
        (scan_autoconf_traces) <AC_SUBST>: Don't filter out ANSI2KNR and
        AMDEPBACKSLASH here...
        (define_configure_variable): ... do this here.
        (am_primary_prefixes): Probe the existence of ${X}dir using
        &require_variables_for_macro.  If a standard prefix is not
        legitimate, say so.  Ignore all configure variables.
        * tests/ansi8.test, tests/cxx2.test, tests/gcj5.test,
        tests/lisp2.test, tests/python2.test: New files
        * tests/Makefile.am (TESTS): Add them.
        * tests/asm.test: Grep stderr.
        * tests/lex2.test: Rewrite to test the Automake suggest AM_PROG_LEX.
        * tests/python.test: Make sure py-compile is installed.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1312
diff -u -r1.1312 automake.in
--- automake.in 27 Jun 2002 19:31:59 -0000      1.1312
+++ automake.in 30 Jun 2002 21:54:13 -0000
@@ -221,6 +221,35 @@
                        pkgincludedir pkglibdir sbin sharedstate
                        sysconf));
 
+# Declare the macros that define known variables, so we can
+# hint the user if she try to use one of these variables.
+my %am_macro_for_var =
+  (
+   ANSI2KNR => 'AM_C_PROTOTYPES',
+   CCAS => 'AM_PROG_AS',
+   CCASFLAGS => 'AM_PROG_AS',
+   EMACS => 'AM_PATH_LISPDIR',
+   GCJ => 'AM_PROG_GCJ',
+   LEX => 'AM_PROG_LEX',
+   lispdir => 'AM_PATH_LISPDIR',
+   pkgpyexecdir => 'AM_PATH_PYTHON',
+   pkgpythondir => 'AM_PATH_PYTHON',
+   pyexecdir => 'AM_PATH_PYTHON',
+   PYTHON => 'AM_PATH_PYTHON',
+   pythondir => 'AM_PATH_PYTHON',
+   U => 'AM_C_PROTOTYPES',
+   );
+
+my %ac_macro_for_var =
+  (
+   CC => 'AC_PROG_CC',
+   CFLAGS => 'AC_PROG_CC',
+   CXX => 'AC_PROG_CXX',
+   CXXFLAGS => 'AC_PROG_CXX',
+   F77 => 'AC_PROG_F77',
+   F77FLAGS => 'AC_PROG_F77',
+   );
+
 # Copyright on generated Makefile.ins.
 my $gen_copyright = "\
 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
@@ -294,9 +323,6 @@
 # Files found by scanning configure.ac for LIBOBJS.
 my %libsources = ();
 
-# True if AM_C_PROTOTYPES appears in configure.ac.
-my $am_c_prototypes = 0;
-
 # Names used in AC_CONFIG_HEADER call.
 my @config_headers = ();
 # Where AC_CONFIG_HEADER appears.
@@ -330,9 +356,6 @@
 # Where AM_GNU_GETTEXT appears.
 my $ac_gettext_location;
 
-# TRUE if AC_PROG_LEX or AM_PROG_LEX were seen.
-my $seen_prog_lex = 0;
-
 # TRUE if we've seen AC_CANONICAL_(HOST|SYSTEM).
 my $seen_canonical = 0;
 my $canonical_location;
@@ -349,12 +372,6 @@
 # Where version is defined.
 my $package_version_location;
 
-# Where AM_PATH_LISPDIR appears.
-my $am_lispdir_location;
-
-# Where AM_PATH_PYTHON appears.
-my $pythondir_location;
-
 # TRUE if we've seen AC_ENABLE_MULTILIB.
 my $seen_multilib = 0;
 
@@ -632,6 +649,13 @@
 # the named of the helper variable used to append to VAR in CONDITIONS.
 my %appendvar = ();
 
+# Variables required via &require_variables.
+# FIXME: This is a temporary hack so that &require_variables prints error
+# messages only once.  It should not be needed the day we have an error
+# reporting function which can print an error message only once.
+my %required_variables = ();
+
+
 ## --------------------------------- ##
 ## Forward subroutine declarations.  ##
 ## --------------------------------- ##
@@ -776,6 +800,8 @@
     %subobjvar = ();
 
     %appendvar = ();
+
+    %required_variables = ();
 }
 
 
@@ -1784,13 +1810,8 @@
        define_linker_variable ($lang)
          if ($lang->link);
 
-       foreach my $var (@{$lang->config_vars})
-         {
-           am_error ($lang->Name
-                     . " source seen but `$var' not defined in"
-                     . " `$configure_ac'")
-             if !exists $configure_vars{$var};
-         }
+       require_variables ("$am_file.am", $lang->Name . " source seen",
+                          @{$lang->config_vars});
 
        # Call the finisher.
        $lang->finish;
@@ -2649,14 +2670,9 @@
     # Check for automatic de-ANSI-fication.
     if (defined $options{'ansi2knr'})
       {
-       if (! $am_c_prototypes)
-         {
-           macro_error ('AUTOMAKE_OPTIONS',
-                        "option `ansi2knr' in use but `AM_C_PROTOTYPES' not in 
`$configure_ac'");
-           &keyed_aclocal_warning ('AM_C_PROTOTYPES');
-           # Only give this error once.
-           $am_c_prototypes = 1;
-         }
+       require_variables_for_macro ('AUTOMAKE_OPTIONS',
+                                    "option `ansi2knr' is used",
+                                    "ANSI2KNR", "U");
 
        # topdir is where ansi2knr should be.
        if ($options{'ansi2knr'} eq 'ansi2knr')
@@ -4459,37 +4475,33 @@
 # Handle Emacs Lisp.
 sub handle_emacs_lisp
 {
-    my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP',
-                                  'lisp', 'noinst');
-
-    return if ! @elfiles;
+  my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP',
+                                'lisp', 'noinst');
 
-    # Generate .elc files.
-    my @elcfiles = map { $_ . 'c' } @elfiles;
-    define_pretty_variable ('ELCFILES', '', @elcfiles);
+  return if ! @elfiles;
 
-    push (@all, '$(ELCFILES)');
+  # Generate .elc files.
+  my @elcfiles = map { $_ . 'c' } @elfiles;
+  define_pretty_variable ('ELCFILES', '', @elcfiles);
 
-    &am_error ("`lisp_LISP' defined but `AM_PATH_LISPDIR' not in 
`$configure_ac'")
-      if ! $am_lispdir_location && variable_defined ('lisp_LISP');
+  push (@all, '$(ELCFILES)');
 
-    require_conf_file ($am_lispdir_location, FOREIGN, 'elisp-comp');
-    &define_variable ('elisp_comp', $config_aux_dir . '/elisp-comp');
+  require_variables ("$am_file.am", "Emacs Lisp sources seen",
+                    'EMACS', 'lispdir');
+  require_conf_file ("$am_file.am", FOREIGN, 'elisp-comp');
+  &define_variable ('elisp_comp', $config_aux_dir . '/elisp-comp');
 }
 
 # Handle Python
 sub handle_python
 {
-    my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON',
-                                  'python', 'noinst');
-    return if ! @pyfiles;
-
-    # Found some python.
-    &am_error ("`python_PYTHON' defined but `AM_PATH_PYTHON' not in 
`$configure_ac'")
-       if ! $pythondir_location && variable_defined ('python_PYTHON');
-
-    require_conf_file ($pythondir_location, FOREIGN, 'py-compile');
-    &define_variable ('py_compile', $config_aux_dir . '/py-compile');
+  my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON',
+                                'noinst');
+  return if ! @pyfiles;
+
+  require_variables ("$am_file.am", "Python sources seen", 'PYTHON');
+  require_conf_file ("$am_file.am", FOREIGN, 'py-compile');
+  &define_variable ('py_compile', $config_aux_dir . '/py-compile');
 }
 
 # Handle Java.
@@ -4620,17 +4632,13 @@
                  AC_CONFIG_HEADERS
                  AC_INIT
                  AC_LIBSOURCE
-                 AC_PROG_LEX
                  AC_PROG_LIBTOOL AM_PROG_LIBTOOL
                  AC_SUBST
                  AM_AUTOMAKE_VERSION
                  AM_CONDITIONAL
-                 AM_C_PROTOTYPES
                  AM_GNU_GETTEXT
                  AM_INIT_AUTOMAKE
                  AM_MAINTAINER_MODE
-                 AM_PATH_LISPDIR
-                 AM_PATH_PYTHON
                  AM_PROG_CC_C_O);
 
   my $traces = ($ENV{AUTOCONF} || 'autoconf') . " ";
@@ -4695,17 +4703,7 @@
        {
          $seen_libtool = $here;
        }
-      elsif ($macro eq 'AC_PROG_LEX')
-       {
-         $seen_prog_lex = $here;
-       }
-      elsif ($macro eq 'AC_SUBST'
-            # Explicitly avoid ANSI2KNR -- we AC_SUBST that in
-            # protos.m4, but later define it elsewhere.  This is
-            # pretty hacky.  We also explicitly avoid AMDEPBACKSLASH:
-            # it might be subst'd by `\', which certainly would not be
-            # appreciated by Make.
-            && ! grep { $_ eq $args[1] } (qw(ANSI2KNR AMDEPBACKSLASH)))
+      elsif ($macro eq 'AC_SUBST')
        {
          # Just check for alphanumeric in AC_SUBST.  If you do
          # AC_SUBST(5), then too bad.
@@ -4727,10 +4725,6 @@
        {
          $configure_cond{$args[1]} = $here;
        }
-      elsif ($macro eq 'AM_C_PROTOTYPES')
-       {
-         $am_c_prototypes = $here;
-       }
       elsif ($macro eq 'AM_GNU_GETTEXT')
        {
          $seen_gettext = $here;
@@ -4753,14 +4747,6 @@
        {
          $seen_maint_mode = $here;
        }
-      elsif ($macro eq 'AM_PATH_LISPDIR')
-       {
-         $am_lispdir_location = $here;
-       }
-      elsif ($macro eq 'AM_PATH_PYTHON')
-       {
-         $pythondir_location = $here;
-       }
       elsif ($macro eq 'AM_PROG_CC_C_O')
        {
          $seen_cc_c_o = $here;
@@ -4830,9 +4816,6 @@
     am_error ("`install.sh' is an anachronism; use `install-sh' instead")
         if -f $config_aux_path[0] . '/install.sh';
 
-    require_conf_file ($pythondir_location, FOREIGN, 'py-compile')
-      if $pythondir_location;
-
     # Preserve dist_common for later.
     $configure_dist_common = variable_value ('DIST_COMMON', 'TRUE') || '';
 }
@@ -5196,9 +5179,6 @@
     return if defined $language_scratch{'lex-done'};
     $language_scratch{'lex-done'} = 1;
 
-    am_error ("lex source seen but `AM_PROG_LEX' not in `$configure_ac'")
-      unless $seen_prog_lex;
-
     if (count_files_for_language ('lex') > 1)
     {
        &yacc_lex_finish_helper;
@@ -6718,13 +6698,19 @@
 # substitution by the same name.
 sub define_configure_variable ($)
 {
-    my ($var) = @_;
-    if (! variable_defined ($var, 'TRUE'))
-    {
-       # A macro defined via configure is a `user' macro -- we should not
-       # override it.
-       macro_define ($var, 0, '', 'TRUE', subst $var, $configure_vars{$var});
-       variable_pretty_output ($var, 'TRUE');
+  my ($var) = @_;
+  if (! variable_defined ($var, 'TRUE')
+      # Explicitly avoid ANSI2KNR -- we AC_SUBST that in
+      # protos.m4, but later define it elsewhere.  This is
+      # pretty hacky.  We also explicitly avoid AMDEPBACKSLASH:
+      # it might be subst'd by `\', which certainly would not be
+      # appreciated by Make.
+      && ! grep { $_ eq $var } (qw(ANSI2KNR AMDEPBACKSLASH)))
+    {
+      # A macro defined via configure is a `user' macro -- we should not
+      # override it.
+      macro_define ($var, 0, '', 'TRUE', subst $var, $configure_vars{$var});
+      variable_pretty_output ($var, 'TRUE');
     }
 }
 
@@ -7630,51 +7616,58 @@
 # need it.
 sub am_primary_prefixes ($$@)
 {
-    my ($primary, $can_dist, @prefixes) = @_;
+  my ($primary, $can_dist, @prefixes) = @_;
 
-    local $_;
-    my %valid = map { $_ => 0 } @prefixes;
-    $valid{'EXTRA'} = 0;
-    foreach my $varname (keys %var_value)
-    {
-        # Automake is allowed to define variables that look like they
-        # are magic variables, such as INSTALL_DATA.
-        next
-         if $var_is_am{$varname};
+  local $_;
+  my %valid = map { $_ => 0 } @prefixes;
+  $valid{'EXTRA'} = 0;
+  foreach my $varname (keys %var_value)
+    {
+      # Automake is allowed to define variables that look like primaries
+      # but which aren't.  E.g. INSTALL_sh_DATA.
+      next
+       if $var_is_am{$varname};
+      # Autoconf can also define variables like INSTALL_DATA, so
+      # ignore all configure variables.
+      # FIXME: Actually we'd better ignore configure variables which
+      # are not overridden in Makefile.am; but it's not clear how to
+      # do this presently.
+      next
+       if exists $configure_vars{$varname};
 
-       if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_$primary$/)
+      if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_$primary$/)
        {
-           my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || '');
-           if ($dist ne '' && ! $can_dist)
+         my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || '');
+         if ($dist ne '' && ! $can_dist)
             {
-               # Note that a configure variable is always legitimate.
-               # It is natural to name such variables after the
-               # primary, so we explicitly allow it.
-               macro_error ($varname,
-                           "invalid variable `$varname': `dist' is forbidden")
-                 if ! exists $configure_vars{$varname};
-           }
-           # A not-explicitely-allowed prefix X is allowed if Xdir
-           # has been defined and X is not a standard prefix.
-           elsif (! defined $valid{$X} && (! variable_defined ("${X}dir")
-                                           || exists $standard_prefix{$X}))
+             macro_error ($varname,
+                          "invalid variable `$varname': `dist' is forbidden");
+           }
+         # Standard directories must be explicitely allowed.
+         elsif (! defined $valid{$X} && exists $standard_prefix{$X})
            {
-               # Note that a configure variable is always legitimate.
-               # It is natural to name such variables after the
-               # primary, so we explicitly allow it.
-               macro_error ($varname, "invalid variable `$varname'")
-                 if ! exists $configure_vars{$varname};
+             macro_error ($varname,
+                          "`${X}dir' is not a legitimate " .
+                          "directory for `$primary'");
+           }
+         # A not explicitely valid directory is allowed if Xdir is defined.
+         elsif (! defined $valid{$X} &&
+                require_variables_for_macro ($varname, "`$varname' is used",
+                                             "${X}dir"))
+           {
+             # Nothing to do.  Any error message has been output
+             # by require_variables_for_macro.
            }
-           else
+         else
            {
-               # Ensure all extended prefixes are actually used.
-               $valid{"$base$dist$X"} = 1;
+             # Ensure all extended prefixes are actually used.
+             $valid{"$base$dist$X"} = 1;
            }
        }
     }
 
-    # Return only those which are actually defined.
-    return sort grep { variable_defined ($_ . '_' . $primary) } keys %valid;
+  # Return only those which are actually defined.
+  return sort grep { variable_defined ($_ . '_' . $primary) } keys %valid;
 }
 
 
@@ -8305,6 +8298,59 @@
 {
     my ($key) = @_;
     warn "$me: macro `$key' can be generated by `aclocal'\n";
+}
+
+# INTEGER
+# require_variables ($WHERE, $REASON, @VARIABLES)
+# -----------------------------------------------
+# Make sure that each supplied variable is defined.
+# Otherwise, issue a warning.  If we know which macro can
+# define this variable, hint the user.
+# Return the number of undefined variables.
+sub require_variables ($$@)
+{
+  my ($where, $reason, @vars) = @_;
+  my $res = 0;
+  $reason .= ' but ' unless $reason eq '';
+
+  foreach my $var (@vars)
+    {
+      # Nothing to do if the variable exists.
+      next if (exists $var_value{$var});
+
+      ++$res;
+
+      # Don't print the error message twice.
+      next if exists $required_variables{$var};
+      $required_variables{$var} = $where; # The value doesn't matter.
+
+      my $text = "$reason`$var' is undefined.";
+      if (exists $am_macro_for_var{$var})
+       {
+         $text .= "\nThe usual way to define `$var' is to add "
+           . "`$am_macro_for_var{$var}'\nto `$configure_ac' and run "
+           . "`aclocal' and `autoconf' again.";
+       }
+      elsif (exists $ac_macro_for_var{$var})
+       {
+         $text .= "\nThe usual way to define `$var' is to add "
+           . "`$ac_macro_for_var{$var}'\nto `$configure_ac' and run "
+           . "`autoconf' again.";
+       }
+
+      file_error ($where, $text);
+    }
+  return $res;
+}
+
+# INTEGER
+# require_variables_for_macro ($MACRO, $REASON, @VARIABLES)
+# ---------------------------------------------------------
+# Same as require_variables, but take a macro mame as first argument.
+sub require_variables_for_macro ($$@)
+{
+  my ($macro, $reason, @args) = @_;
+  return require_variables ($var_location{$macro}, $reason, @args);
 }
 
 # Print usage information.
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.410
diff -u -r1.410 Makefile.am
--- tests/Makefile.am   19 Jun 2002 19:57:39 -0000      1.410
+++ tests/Makefile.am   30 Jun 2002 21:54:16 -0000
@@ -28,6 +28,7 @@
 ansi5.test \
 ansi6.test \
 ansi7.test \
+ansi8.test \
 ar.test \
 asm.test \
 autoheader.test \
@@ -108,6 +109,7 @@
 copy.test \
 ctarget1.test \
 cxx.test \
+cxx2.test \
 cxxansi.test \
 cxxcpp.test \
 cxxlibobj.test \
@@ -171,6 +173,7 @@
 gcj2.test \
 gcj3.test \
 gcj4.test \
+gcj5.test \
 gnits.test \
 gnits2.test \
 header.test \
@@ -220,6 +223,7 @@
 link_f_cxx.test        \
 link_f_only.test \
 lisp.test \
+lisp2.test \
 listval.test \
 ltdeps.test \
 ltlibobjs.test \
@@ -291,6 +295,7 @@
 primary2.test \
 proginst.test \
 python.test \
+python2.test \
 ranlib.test \
 recurs.test \
 recurs2.test \
Index: tests/ansi8.test
===================================================================
RCS file: tests/ansi8.test
diff -N tests/ansi8.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/ansi8.test    30 Jun 2002 21:54:16 -0000
@@ -0,0 +1,17 @@
+#! /bin/sh
+
+# Check that AM_C_PROTOTYPES is required by ansi2knr
+
+. $srcdir/defs || exit 1
+
+set -e
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = ansi2knr
+bin_PROGRAMS = hello
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr && exit 1
+cat stderr
+grep AM_C_PROTOTYPES stderr
Index: tests/asm.test
===================================================================
RCS file: /cvs/automake/automake/tests/asm.test,v
retrieving revision 1.6
diff -u -r1.6 asm.test
--- tests/asm.test      22 Jan 2002 17:16:17 -0000      1.6
+++ tests/asm.test      30 Jun 2002 21:54:16 -0000
@@ -4,6 +4,8 @@
 
 . $srcdir/defs || exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 noinst_PROGRAMS = maude
 maude_SOURCES = maude.s
@@ -20,8 +22,10 @@
 AC_OUTPUT(Makefile)
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE && exit 1
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep AM_PROG_AS stderr
 
 # We still need CCAS.
 echo 2
@@ -33,8 +37,12 @@
 AC_OUTPUT(Makefile)
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE && exit 1
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep CCAS stderr
+grep AM_PROG_AS stderr
+
 
 # We need CCASFLAGS.
 echo 3
@@ -47,8 +55,12 @@
 AC_OUTPUT(Makefile)
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE && exit 1
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep CCASFLAGS stderr
+grep AM_PROG_AS stderr
+
 
 # We have every needed, expect a success.
 echo 4
@@ -62,8 +74,8 @@
 AC_OUTPUT(Makefile)
 END
 
-$ACLOCAL  || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE
 
 
 # We have every needed, expect a success.
@@ -75,7 +87,7 @@
 AC_OUTPUT(Makefile)
 END
 
-$ACLOCAL  || exit 1
-$AUTOMAKE || exit 1
+$ACLOCAL
+$AUTOMAKE
 
 exit 0
Index: tests/cxx2.test
===================================================================
RCS file: tests/cxx2.test
diff -N tests/cxx2.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/cxx2.test     30 Jun 2002 21:54:16 -0000
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+# Test that Automake suggests using AC_PROG_CXX if C++ sources are used.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+echo AC_PROG_CC >>configure.in
+
+cat >Makefile.am <<'END'
+bin_PROGRAMS = hello
+hello_SOURCES = hello.cpp
+END
+
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep AC_PROG_CXX stderr
Index: tests/gcj5.test
===================================================================
RCS file: tests/gcj5.test
diff -N tests/gcj5.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/gcj5.test     30 Jun 2002 21:54:16 -0000
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+# Make sure Automake suggests AM_PROG_GCJ when GCJ is needed.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+_AM_DEPENDENCIES(GCJ)
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = convert
+convert_SOURCES = convert.java
+END
+
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep AM_PROG_GCJ stderr
Index: tests/lex2.test
===================================================================
RCS file: /cvs/automake/automake/tests/lex2.test,v
retrieving revision 1.7
diff -u -r1.7 lex2.test
--- tests/lex2.test     9 Apr 2001 14:50:52 -0000       1.7
+++ tests/lex2.test     30 Jun 2002 21:54:16 -0000
@@ -1,23 +1,23 @@
 #! /bin/sh
 
-# Test to make sure AC_PROG_LEX is an error.
+# Make sure that Automake suggest using AM_PROG_LEX when a lexer is used.
 
 . $srcdir/defs || exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_CC
-AC_PROG_LEX
-AC_DECL_YYTEXT
 END
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = zot
 zot_SOURCES = joe.l
-LDADD = @LEXLIB@
 END
 
 : > joe.l
 
-$ACLOCAL || exit 1
-$AUTOMAKE --Wno-error 2> output || exit 1
-test -n "`cat output`"
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep AM_PROG_LEX stderr
Index: tests/lisp2.test
===================================================================
RCS file: tests/lisp2.test
diff -N tests/lisp2.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/lisp2.test    30 Jun 2002 21:54:16 -0000
@@ -0,0 +1,58 @@
+#! /bin/sh
+
+# Make sure that Automake suggest using AM_PATH_LISPDIR to define lispdir.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+echo 1
+
+cat > Makefile.am << 'END'
+lisp_LISP = foo.el
+END
+
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep AM_PATH_LISPDIR stderr
+
+
+echo 2
+# Setting lispdir should not be enough.
+
+cat > Makefile.am << 'END'
+lispdir = /usr/share/emacs/site-lisp
+lisp_LISP = foo.el
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr && exit 1
+cat stderr
+grep AM_PATH_LISPDIR stderr
+
+echo 3
+# Setting EMACS should not be enough.
+
+cat > Makefile.am << 'END'
+EMACS = emacs
+lisp_LISP = foo.el
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr && exit 1
+cat stderr
+grep AM_PATH_LISPDIR stderr
+
+
+echo 4
+# Setting both is OK.
+
+cat > Makefile.am << 'END'
+lispdir = /usr/share/emacs/site-lisp
+EMACS = emacs
+lisp_LISP = foo.el
+END
+
+$ACLOCAL
+$AUTOMAKE -a
Index: tests/python.test
===================================================================
RCS file: /cvs/automake/automake/tests/python.test,v
retrieving revision 1.2
diff -u -r1.2 python.test
--- tests/python.test   20 Oct 2001 11:17:17 -0000      1.2
+++ tests/python.test   30 Jun 2002 21:54:16 -0000
@@ -4,13 +4,16 @@
 
 . $srcdir/defs || exit 1
 
+set -e
+
 echo 'AM_PATH_PYTHON' >> configure.in
 
 cat > Makefile.am << 'END'
 python_PYTHON = foo.py
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE -a || exit 1
+$ACLOCAL
+$AUTOMAKE -a
 
 grep '^py_compile =' Makefile.in
+test -f py-compile
Index: tests/python2.test
===================================================================
RCS file: tests/python2.test
diff -N tests/python2.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/python2.test  30 Jun 2002 21:54:16 -0000
@@ -0,0 +1,102 @@
+#! /bin/sh
+
+# Make sure that Automake suggests using AM_PATH_PYTHON.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+echo 1
+# pythondir not defined
+
+cat > Makefile.am <<'END'
+PYTHON = x
+python_PYTHON = foo.py
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr && exit 1
+cat stderr
+grep AM_PATH_PYTHON stderr
+
+echo 2
+# pkgpythondir not defined
+
+cat > Makefile.am <<'END'
+PYTHON = x
+pkgpython_PYTHON = foo.py
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr && exit 1
+cat stderr
+grep AM_PATH_PYTHON stderr
+
+
+echo 3
+# pyexecdir not defined
+
+cat > Makefile.am <<'END'
+PYTHON = x
+pyexec_PYTHON = foo.py
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr && exit 1
+cat stderr
+grep AM_PATH_PYTHON stderr
+
+
+echo 4
+# pkgpyexecdir not defined
+
+cat > Makefile.am <<'END'
+PYTHON = x
+pkgpyexec_PYTHON = foo.py
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr && exit 1
+cat stderr
+grep AM_PATH_PYTHON stderr
+
+
+echo 5
+# PYTHON not defined.
+
+cat > Makefile.am <<'END'
+pkgpyexecdir = /here/we/go
+pkgpyexec_PYTHON = foo.py
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr && exit 1
+cat stderr
+grep AM_PATH_PYTHON stderr
+
+
+echo 6
+# Ok.
+
+cat > Makefile.am <<'END'
+PYTHON = x
+pkgpyexecdir = /here/we/go
+pkgpyexec_PYTHON = foo.py
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+test -f py-compile
+
+
+echo 7
+# Ok.
+
+cat > Makefile.am <<'END'
+PYTHON = x
+fubardir = /here/we/go
+fubar_PYTHON = foo.py
+END
+
+$ACLOCAL
+$AUTOMAKE -a

-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]