From 54c6d7201cd245196955726c0b9fb30d86b8437f Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 30 Jun 2002 22:44:12 +0000 Subject: [PATCH] * 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) : 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 that Automake suggests AM_PROG_LEX. * tests/python.test: Make sure py-compile is installed. --- ChangeLog | 29 +++++ automake.in | 292 ++++++++++++++++++++++++++------------------- tests/Makefile.am | 5 + tests/Makefile.in | 5 + tests/ansi8.test | 17 +++ tests/asm.test | 32 +++-- tests/cxx2.test | 19 +++ tests/gcj5.test | 21 ++++ tests/lex2.test | 14 +-- tests/lisp2.test | 58 +++++++++ tests/python.test | 7 +- tests/python2.test | 102 ++++++++++++++++ 12 files changed, 459 insertions(+), 142 deletions(-) create mode 100755 tests/ansi8.test create mode 100755 tests/cxx2.test create mode 100755 tests/gcj5.test create mode 100755 tests/lisp2.test create mode 100755 tests/python2.test diff --git a/ChangeLog b/ChangeLog index 29a1ad0e..9dc73a3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2002-06-30 Alexandre Duret-Lutz + + * 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) : 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 that Automake suggests AM_PROG_LEX. + * tests/python.test: Make sure py-compile is installed. + 2002-06-27 Alexandre Duret-Lutz * automake.in (LANG_IGNORE, LANG_PROCESS, LANG_SUBDIR, diff --git a/automake.in b/automake.in index 8a64ed0e..f122fd31 100755 --- a/automake.in +++ b/automake.in @@ -221,6 +221,35 @@ my %standard_prefix = 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 @@ my $configure_ac = ''; # 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 @@ my $seen_gettext = 0; # 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 @@ my $package_version = ''; # 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 @@ my %subobjvar = (); # 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 @@ sub initialize_per_input () %subobjvar = (); %appendvar = (); + + %required_variables = (); } @@ -1784,13 +1810,8 @@ sub handle_languages 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 @@ sub handle_compile () # 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 @@ sub handle_tests # Handle Emacs Lisp. sub handle_emacs_lisp { - my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP', - 'lisp', 'noinst'); + my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP', + 'lisp', 'noinst'); - return if ! @elfiles; + return if ! @elfiles; - # Generate .elc files. - my @elcfiles = map { $_ . 'c' } @elfiles; - define_pretty_variable ('ELCFILES', '', @elcfiles); + # Generate .elc files. + my @elcfiles = map { $_ . 'c' } @elfiles; + define_pretty_variable ('ELCFILES', '', @elcfiles); - push (@all, '$(ELCFILES)'); + push (@all, '$(ELCFILES)'); - &am_error ("`lisp_LISP' defined but `AM_PATH_LISPDIR' not in `$configure_ac'") - if ! $am_lispdir_location && variable_defined ('lisp_LISP'); - - 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'); + my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON', + 'noinst'); + return if ! @pyfiles; - require_conf_file ($pythondir_location, FOREIGN, 'py-compile'); - &define_variable ('py_compile', $config_aux_dir . '/py-compile'); + 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 @@ sub scan_autoconf_traces ($) 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 @@ sub scan_autoconf_traces ($) { $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 @@ sub scan_autoconf_traces ($) { $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 @@ sub scan_autoconf_traces ($) { $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 @@ sub scan_autoconf_files 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 @@ sub lang_lex_finish 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 @@ sub define_variable ($$) # substitution by the same name. sub define_configure_variable ($) { - my ($var) = @_; - if (! variable_defined ($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'); + # 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 @@ sub append_exeext ($) # need it. sub am_primary_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}; - - if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_$primary$/) - { - my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || ''); - if ($dist ne '' && ! $can_dist) + 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 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$/) + { + 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}; + macro_error ($varname, + "invalid variable `$varname': `dist' is forbidden"); } - # 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})) + # 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'"); } - else + # 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 { - # 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; } @@ -8307,6 +8300,59 @@ sub keyed_aclocal_warning ($) 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. sub usage () { diff --git a/tests/Makefile.am b/tests/Makefile.am index a6cbae92..7587177a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -28,6 +28,7 @@ ansi4.test \ ansi5.test \ ansi6.test \ ansi7.test \ +ansi8.test \ ar.test \ asm.test \ autoheader.test \ @@ -108,6 +109,7 @@ confvar2.test \ copy.test \ ctarget1.test \ cxx.test \ +cxx2.test \ cxxansi.test \ cxxcpp.test \ cxxlibobj.test \ @@ -171,6 +173,7 @@ gcj.test \ gcj2.test \ gcj3.test \ gcj4.test \ +gcj5.test \ gnits.test \ gnits2.test \ header.test \ @@ -220,6 +223,7 @@ link_f_c_cxx.test \ link_f_cxx.test \ link_f_only.test \ lisp.test \ +lisp2.test \ listval.test \ ltdeps.test \ ltlibobjs.test \ @@ -291,6 +295,7 @@ primary.test \ primary2.test \ proginst.test \ python.test \ +python2.test \ ranlib.test \ recurs.test \ recurs2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 076a3b58..67b9725a 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -115,6 +115,7 @@ ansi4.test \ ansi5.test \ ansi6.test \ ansi7.test \ +ansi8.test \ ar.test \ asm.test \ autoheader.test \ @@ -195,6 +196,7 @@ confvar2.test \ copy.test \ ctarget1.test \ cxx.test \ +cxx2.test \ cxxansi.test \ cxxcpp.test \ cxxlibobj.test \ @@ -258,6 +260,7 @@ gcj.test \ gcj2.test \ gcj3.test \ gcj4.test \ +gcj5.test \ gnits.test \ gnits2.test \ header.test \ @@ -307,6 +310,7 @@ link_f_c_cxx.test \ link_f_cxx.test \ link_f_only.test \ lisp.test \ +lisp2.test \ listval.test \ ltdeps.test \ ltlibobjs.test \ @@ -378,6 +382,7 @@ primary.test \ primary2.test \ proginst.test \ python.test \ +python2.test \ ranlib.test \ recurs.test \ recurs2.test \ diff --git a/tests/ansi8.test b/tests/ansi8.test new file mode 100755 index 00000000..d325a29d --- /dev/null +++ b/tests/ansi8.test @@ -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 diff --git a/tests/asm.test b/tests/asm.test index f12e9039..5b1b838a 100755 --- a/tests/asm.test +++ b/tests/asm.test @@ -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_SUBST(CCASFLAGS) 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_SUBST(CCASFLAGS) 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_PROG_CC 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_SUBST(CCASFLAGS) AC_OUTPUT(Makefile) END -$ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$ACLOCAL +$AUTOMAKE # We have every needed, expect a success. @@ -75,7 +87,7 @@ AM_PROG_AS AC_OUTPUT(Makefile) END -$ACLOCAL || exit 1 -$AUTOMAKE || exit 1 +$ACLOCAL +$AUTOMAKE exit 0 diff --git a/tests/cxx2.test b/tests/cxx2.test new file mode 100755 index 00000000..b1b0241d --- /dev/null +++ b/tests/cxx2.test @@ -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 diff --git a/tests/gcj5.test b/tests/gcj5.test new file mode 100755 index 00000000..bf1a7ad9 --- /dev/null +++ b/tests/gcj5.test @@ -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 diff --git a/tests/lex2.test b/tests/lex2.test index 34d45a9c..a1c172db 100755 --- a/tests/lex2.test +++ b/tests/lex2.test @@ -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 diff --git a/tests/lisp2.test b/tests/lisp2.test new file mode 100755 index 00000000..841de189 --- /dev/null +++ b/tests/lisp2.test @@ -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 diff --git a/tests/python.test b/tests/python.test index 9d06d22c..fe88dbc2 100755 --- a/tests/python.test +++ b/tests/python.test @@ -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 diff --git a/tests/python2.test b/tests/python2.test new file mode 100755 index 00000000..852ce0a1 --- /dev/null +++ b/tests/python2.test @@ -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 -- 2.43.5