From 3750638682f8d8ac67bdeb4f31058e402a7f8c46 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 27 Jul 2001 00:02:43 +0000 Subject: [PATCH] * automake.in (am_print_error): New function. (am_error): Use it. (am_file_error): Likewise. (am_line_error): Likewise. (am_conf_error): Likewise. (am_conf_line_error): Likewise. * automake.texi (Options): Document no-exeext. * automake.in (handle_options): Recognize no-exeext. (rule_define): Handle no-exeext. * tests/Makefile.am (TESTS): Added new file. * tests/exeext2.test: New file. * automake.in (make_input_list): Removed. (scan_autoconf_config_files): Don't add to make_input_list. (scan_one_autoconf_file): Don't use make_input_list. (scan_autoconf_files): Use make_list, not make_input_list. (scan_autoconf_files): Likewise. * automake.in (seen_exeext): Removed. (generate_makefile): Don't define EXEEXT or OBJEXT. (scan_one_autoconf_file): Don't check for AC_EXEEXT. (am_install_var): Don't check $seen_exeext. (handle_programs): Likewise. (rule_define): Allow x to override x$(EXEEXT), for now. (file_contents_internal): Only define rule if rule_define allows us to. * m4/init.m4 (AM_INIT_AUTOMAKE): Define EXEEXT and OBJEXT. --- ChangeLog | 31 ++++++++++++ TODO | 9 ++-- automake.in | 117 ++++++++++++++++++++++++++------------------- automake.texi | 10 ++++ m4/init.m4 | 9 ++++ stamp-vti | 2 +- tests/Makefile.am | 1 + tests/Makefile.in | 3 +- tests/exeext2.test | 25 ++++++++++ version.texi | 2 +- 10 files changed, 152 insertions(+), 57 deletions(-) create mode 100755 tests/exeext2.test diff --git a/ChangeLog b/ChangeLog index e58791539..3397ba50b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2001-07-26 Tom Tromey + + * automake.in (am_print_error): New function. + (am_error): Use it. + (am_file_error): Likewise. + (am_line_error): Likewise. + (am_conf_error): Likewise. + (am_conf_line_error): Likewise. + + * automake.texi (Options): Document no-exeext. + * automake.in (handle_options): Recognize no-exeext. + (rule_define): Handle no-exeext. + * tests/Makefile.am (TESTS): Added new file. + * tests/exeext2.test: New file. + + * automake.in (make_input_list): Removed. + (scan_autoconf_config_files): Don't add to make_input_list. + (scan_one_autoconf_file): Don't use make_input_list. + (scan_autoconf_files): Use make_list, not make_input_list. + (scan_autoconf_files): Likewise. + + * automake.in (seen_exeext): Removed. + (generate_makefile): Don't define EXEEXT or OBJEXT. + (scan_one_autoconf_file): Don't check for AC_EXEEXT. + (am_install_var): Don't check $seen_exeext. + (handle_programs): Likewise. + (rule_define): Allow x to override x$(EXEEXT), for now. + (file_contents_internal): Only define rule if rule_define allows + us to. + * m4/init.m4 (AM_INIT_AUTOMAKE): Define EXEEXT and OBJEXT. + 2001-07-25 Tom Tromey From Nicolas Joly: diff --git a/TODO b/TODO index 459616ecd..76fd5cb67 100644 --- a/TODO +++ b/TODO @@ -103,6 +103,10 @@ Alex Hornby a single file containing all the macro assignments. then read this file via `include' unfortunately this can't be done because of conditionals + -- but it could be made to work if we also changed: + * automake to rewrite @FOO@ to $(FOO), and + * the implementation of conditionals to rely on some new + config.status magic * support prog_LIBS as override for LIBS @@ -410,11 +414,6 @@ Per> .class files from a list of .java source files. Jim's idea: should look for @setfilename and warn if filenames too long * guess split size -** many requests for a way to omit a file from the distribution. - Should be done like `!foo' or `~foo' in _SOURCES, etc. - Such files should be removed explicitly after the copy step! - Doing this requires rewriting macros before generating Makefile.in. - from joerg-martin schwarz: -- If Makefile.am contains $(CC), $(COMPILE), $(YLWRAP), .... in an explicitly written rule, you should emit the corresponding diff --git a/automake.in b/automake.in index 83822053f..f34cdb8a9 100755 --- a/automake.in +++ b/automake.in @@ -425,9 +425,6 @@ my $seen_lispdir = 0; # TRUE if we've seen AM_PATH_PYTHON. my $seen_pythondir = 0; -# TRUE if we've seen AC_EXEEXT. -my $seen_exeext = 0; - # TRUE if we've seen AC_OBJEXT. my $seen_objext = 0; @@ -1218,14 +1215,6 @@ sub generate_makefile push (@sources, '$(SOURCES)') if &variable_defined ('SOURCES'); - # If OBJEXT/EXEEXT were not set in configure.in, do it, it - # simplifies our task, and anyway starting with Autoconf 2.50, it - # will always be defined, and this code will be dead. - $output_vars .= "EXEEXT =\n" - unless $seen_exeext; - $output_vars .= "OBJEXT = o\n" - unless $seen_objext; - # Must do this after reading .am file. See read_main_am_file to # understand weird tricks we play there with variables. &define_variable ('subdir', $relative_dir); @@ -1437,7 +1426,8 @@ sub handle_options || $_ eq 'dist-tarZ' || $_ eq 'dist-bzip2' || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex' || $_ eq 'readme-alpha' || $_ eq 'check-news' - || $_ eq 'subdir-objects' || $_ eq 'nostdinc') + || $_ eq 'subdir-objects' || $_ eq 'nostdinc' + || $_ eq 'no-exeext') { # Explicitly recognize these. } @@ -2463,7 +2453,7 @@ sub handle_programs my $dirstamp = &require_build_directory_maybe ($one_file); # Don't add $(EXEEXT) if user already did. - my $extension = (($seen_exeext && $one_file !~ /\$\(EXEEXT\)$/) + my $extension = ($one_file !~ /\$\(EXEEXT\)$/ ? "\$(EXEEXT)" : ''); @@ -4321,7 +4311,7 @@ sub handle_minor_options ################################################################ my %make_list; -my @make_input_list; + # &scan_autoconf_config_files ($CONFIG-FILES) # ------------------------------------------- # Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES @@ -4352,7 +4342,6 @@ sub scan_autoconf_config_files if (-f $input . '.am') { # We have a file that automake should generate. - push (@make_input_list, $input); $make_list{$input} = join (':', ($local, @rest)); } else @@ -4574,7 +4563,9 @@ sub scan_one_autoconf_file # Look at potential Makefile.am's. &scan_autoconf_config_files ($_); - if ($closing && @make_input_list == 0 && @other_input_files == 0) + if ($closing + && scalar keys %make_list == 0 + && @other_input_files == 0) { &am_conf_line_error ($filename, $ac_output_line, "No files mentioned in `AC_OUTPUT'"); @@ -4591,13 +4582,6 @@ sub scan_one_autoconf_file # Check for ansi2knr. $am_c_prototypes = 1 if /AM_C_PROTOTYPES/; - # Check for exe extension stuff. - if (/AC_EXEEXT/) - { - $seen_exeext = 1; - $configure_vars{'EXEEXT'} = $filename . ':' . $.; - } - if (/AC_OBJEXT/) { $seen_objext = 1; @@ -4816,11 +4800,11 @@ sub scan_autoconf_files # Set input and output files if not specified by user. if (! @input_files) { - @input_files = @make_input_list; + @input_files = sort keys %make_list; %output_files = %make_list; } - @configure_input_files = @make_input_list; + @configure_input_files = sort keys %make_list; &am_conf_error ("`AM_INIT_AUTOMAKE' must be used") if ! $seen_init_automake; @@ -6416,41 +6400,66 @@ sub define_linker_variable ($) ## Handling rules. ## ## ---------------- ## +# $BOOL +# rule_define ($TARGET, $IS_AM, $COND, $WHERE) +# -------------------------------------------- +# Define a new rule. $TARGET is the rule name. $IS_AM is a boolean +# which is true if the new rule is defined by the user. $COND is the +# condition under which the rule is defined. $WHERE is where the rule +# is defined (file name or line number). Returns true if it is ok to +# define the rule, false otherwise. sub rule_define ($$$$) { my ($target, $rule_is_am, $cond, $where) = @_; + # For now `foo:' will override `foo$(EXEEXT):'. This is temporary, + # though, so we emit a warning. + (my $noexe = $target) =~ s,\$\(EXEEXT\)$,,; + if ($noexe ne $target && defined $targets{$noexe}) + { + # The no-exeext option enables this feature. + if (! defined $options{'no-exeext'}) + { + &am_line_error ($noexe, + "deprecated feature: `$noexe' overrides `$noexe\$(EXEEXT)'\nchange your target to read `$noexe\$(EXEEXT)'"); + } + # Don't define. + return 0; + } + if (defined $targets{$target} && ($cond ? ! defined $target_conditional{$target} : defined $target_conditional{$target})) - { + { &am_line_error ($target, "$target defined both conditionally and unconditionally"); - } + } # Value here doesn't matter; for targets we only note existence. $targets{$target} = $where; if ($cond) - { + { if ($target_conditional{$target}) - { + { &check_ambiguous_conditional ($target, $cond); - } + } $target_conditional{$target}{$cond} = $where; - } + } # Check the rule for being a suffix rule. If so, store in a hash. if ((my ($source_suffix, $object_suffix)) = ($target =~ $SUFFIX_RULE_PATTERN)) { - $suffix_rules{$source_suffix} = $object_suffix; - print "Sources ending in .$source_suffix become .$object_suffix\n" - if $verbose; - # Set SUFFIXES from suffix_rules. - push @suffixes, ".$source_suffix", ".$object_suffix"; + $suffix_rules{$source_suffix} = $object_suffix; + print "Sources ending in .$source_suffix become .$object_suffix\n" + if $verbose; + # Set SUFFIXES from suffix_rules. + push @suffixes, ".$source_suffix", ".$object_suffix"; } + + return 1; } @@ -6988,8 +6997,8 @@ sub file_contents_internal ($$%) && $cond ne 'FALSE') { $paragraph =~ s/^/make_condition (@cond_stack)/gme; - $result_rules .= "$spacing$comment$paragraph\n"; - rule_define ($targets, $is_am, $cond, $file); + $result_rules .= "$spacing$comment$paragraph\n" + if rule_define ($targets, $is_am, $cond, $file); } $comment = $spacing = ''; last; @@ -7277,11 +7286,8 @@ sub am_install_var } # A blatant hack: we rewrite each _PROGRAMS primary to include - # EXEEXT when in Cygwin32 mode. You might think we could - # simply always use $(EXEEXT), since we define it as empty - # when it isn't available. However, it isn't that simple. - # See nolink.test. - if ($seen_exeext && $primary eq 'PROGRAMS') + # EXEEXT. + if ($primary eq 'PROGRAMS') { my @conds = &variable_conditions ($one_name); @@ -7796,10 +7802,24 @@ sub unquote_m4_arg ################################################################ +# am_print_error ($LEADER, @ARGS) +# ------------------------------- +# Do the work of printing the error message. Join @ARGS with spaces, +# then split at newlines and add $LEADER to each line. Uses `warn' to +# print message. +sub am_print_error +{ + my ($leader, @args) = @_; + my $text = join (' ', @args); + @args = split ("\n", $text); + $text = $leader . join ("\n" . $leader, @args) . "\n"; + warn $text; +} + # Print an error message and set exit status. sub am_error { - warn "$me: ${am_file}.am: @_\n"; + am_print_error ("$me: ${am_file}.am: ", @_); $exit_status = 1; } @@ -7809,7 +7829,7 @@ sub am_file_error { my ($file, @args) = @_; - warn "$file: @args\n"; + am_print_error ("$file: ", @args); $exit_status = 1; } @@ -7842,7 +7862,8 @@ sub am_line_error { # Couldn't find the line number. } - warn $file, ": @args\n"; + + am_print_error ("$file: ", @args); $exit_status = 1; } else @@ -7855,7 +7876,7 @@ sub am_line_error sub am_conf_error { # FIXME: can run in subdirs. - warn "$me: $configure_ac: @_\n"; + am_print_error ("$me: $configure_ac: ", @_); $exit_status = 1; } @@ -7866,7 +7887,7 @@ sub am_conf_line_error if ($line) { - warn "$file: $line: @args\n"; + am_print_error ("$file: $line: ", @args); $exit_status = 1; } else diff --git a/automake.texi b/automake.texi index 9a5ccbf85..6a8153e5f 100644 --- a/automake.texi +++ b/automake.texi @@ -3721,6 +3721,16 @@ is useful for those situations where you don't have the necessary bits to make automatic dependency tracking work @xref{Dependencies}. In this case the effect is to effectively disable automatic dependency tracking. +@item @code{no-exeext} +@cindex Option, no-exeext +If your @file{Makefile.am} defines a target @samp{foo}, it will override +a target named @samp{foo$(EXEEXT)}. This is necessary when +@code{EXEEXT} is found to be empty. However, by default automake will +generate an error for this use. The @code{no-exeext} option will +disable this error. This is intended for use only where it is known in +advance that the package will not be ported to Windows, or any other +operating system using extensions on executables. + @item @code{no-installinfo} @cindex Option, no-installinfo The generated @file{Makefile.in} will not cause info pages to be built diff --git a/m4/init.m4 b/m4/init.m4 index 863403672..0b6e78ee1 100644 --- a/m4/init.m4 +++ b/m4/init.m4 @@ -52,6 +52,15 @@ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) ifdef([m4_pattern_allow], [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl +# Autoconf 2.50 always computes EXEEXT. However we need to be +# compatible with 2.13, for now. So we always define EXEEXT, but we +# don't compute it. +AC_SUBST(EXEEXT) +# Similar for OBJEXT -- only we only use OBJEXT if the user actually +# requests that it be used. This is a bit dumb. +: ${OBJEXT=o} +AC_SUBST(OBJEXT) + # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl diff --git a/stamp-vti b/stamp-vti index e70725917..6a93b6349 100644 --- a/stamp-vti +++ b/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 21 July 2001 +@set UPDATED 26 July 2001 @set UPDATED-MONTH July 2001 @set EDITION 1.4i @set VERSION 1.4i diff --git a/tests/Makefile.am b/tests/Makefile.am index 6a3fda503..089cb18a0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -122,6 +122,7 @@ error.test \ exdir.test \ exdir2.test \ exeext.test \ +exeext2.test \ exsource.test \ ext.test \ extra.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index a2e7cd523..900e5d6ee 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -188,6 +188,7 @@ error.test \ exdir.test \ exdir2.test \ exeext.test \ +exeext2.test \ exsource.test \ ext.test \ extra.test \ @@ -384,8 +385,6 @@ yaccvpath.test EXTRA_DIST = defs ChangeLog-old $(TESTS) -EXEEXT = -OBJEXT = o subdir = tests mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs CONFIG_CLEAN_FILES = diff --git a/tests/exeext2.test b/tests/exeext2.test new file mode 100755 index 000000000..aaa2b8705 --- /dev/null +++ b/tests/exeext2.test @@ -0,0 +1,25 @@ +#! /bin/sh + +# Make sure no-exeext option works. + +. $srcdir/defs || exit 1 + +cat >> configure.in << 'END' +AC_PROG_CC +AC_EXEEXT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = maude + +maude: + yeah +END + +$ACLOCAL + +$AUTOMAKE --Werror && exit 1 + +echo 'AUTOMAKE_OPTIONS = no-exeext' >> Makefile.am + +$AUTOMAKE --Werror diff --git a/version.texi b/version.texi index e70725917..6a93b6349 100644 --- a/version.texi +++ b/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 21 July 2001 +@set UPDATED 26 July 2001 @set UPDATED-MONTH July 2001 @set EDITION 1.4i @set VERSION 1.4i -- 2.47.2