[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch: FYI: EXEEXT fix
From: |
Tom Tromey |
Subject: |
Patch: FYI: EXEEXT fix |
Date: |
26 Jul 2001 18:29:03 -0600 |
I'm checking this in.
It is larger than one might think because it also fixes a couple
other problems I ran into while debugging.
* The make_input_list stuff fixes a bug whereby a single Makefile.in
could be generated more than once
* The am_print_error stuff was introduced to handle the case of an
error message with an embedded newline. We now handle this more
gracefully.
* I added a no-exeext option to address Alexandre's concerns.
EXEEXT is still not documented in the manual. This is on my to-do
list for the manual though.
Tom
Index: ChangeLog
from Tom Tromey <address@hidden>
* 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.
Index: TODO
===================================================================
RCS file: /cvs/automake/automake/TODO,v
retrieving revision 1.412
diff -u -r1.412 TODO
--- TODO 2001/07/14 19:30:42 1.412
+++ TODO 2001/07/27 00:00:33
@@ -103,6 +103,10 @@
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
@@ -409,11 +413,6 @@
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), ....
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1160
diff -u -r1.1160 automake.in
--- automake.in 2001/07/23 00:53:50 1.1160
+++ automake.in 2001/07/27 00:00:37
@@ -425,9 +425,6 @@
# 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 @@
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 @@
|| $_ 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 @@
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 @@
################################################################
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 @@
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 @@
# 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 @@
# 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 @@
# 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 @@
## 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 @@
&& $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 @@
}
# 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 @@
################################################################
+# 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 @@
{
my ($file, @args) = @_;
- warn "$file: @args\n";
+ am_print_error ("$file: ", @args);
$exit_status = 1;
}
@@ -7842,7 +7862,8 @@
{
# 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_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 @@
if ($line)
{
- warn "$file: $line: @args\n";
+ am_print_error ("$file: $line: ", @args);
$exit_status = 1;
}
else
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.227
diff -u -r1.227 automake.texi
--- automake.texi 2001/07/21 18:35:20 1.227
+++ automake.texi 2001/07/27 00:00:42
@@ -3721,6 +3721,16 @@
to make automatic dependency tracking work @xref{Dependencies}. In this
case the effect is to effectively disable automatic dependency tracking.
address@hidden @code{no-exeext}
address@hidden 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
address@hidden 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
Index: stamp-vti
===================================================================
RCS file: /cvs/automake/automake/stamp-vti,v
retrieving revision 1.127
diff -u -r1.127 stamp-vti
--- stamp-vti 2001/07/21 18:19:38 1.127
+++ stamp-vti 2001/07/27 00:00:42
@@ -1,4 +1,4 @@
address@hidden UPDATED 21 July 2001
address@hidden UPDATED 26 July 2001
@set UPDATED-MONTH July 2001
@set EDITION 1.4i
@set VERSION 1.4i
Index: version.texi
===================================================================
RCS file: /cvs/automake/automake/version.texi,v
retrieving revision 1.200
diff -u -r1.200 version.texi
--- version.texi 2001/07/21 18:19:38 1.200
+++ version.texi 2001/07/27 00:00:42
@@ -1,4 +1,4 @@
address@hidden UPDATED 21 July 2001
address@hidden UPDATED 26 July 2001
@set UPDATED-MONTH July 2001
@set EDITION 1.4i
@set VERSION 1.4i
Index: m4/init.m4
===================================================================
RCS file: /cvs/automake/automake/m4/init.m4,v
retrieving revision 1.29
diff -u -r1.29 init.m4
--- m4/init.m4 2001/07/17 05:40:56 1.29
+++ m4/init.m4 2001/07/27 00:00:42
@@ -52,6 +52,15 @@
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
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.332
diff -u -r1.332 Makefile.am
--- tests/Makefile.am 2001/07/23 01:01:53 1.332
+++ tests/Makefile.am 2001/07/27 00:00:42
@@ -122,6 +122,7 @@
exdir.test \
exdir2.test \
exeext.test \
+exeext2.test \
exsource.test \
ext.test \
extra.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.432
diff -u -r1.432 Makefile.in
--- tests/Makefile.in 2001/07/23 01:01:53 1.432
+++ tests/Makefile.in 2001/07/27 00:00:42
@@ -188,6 +188,7 @@
exdir.test \
exdir2.test \
exeext.test \
+exeext2.test \
exsource.test \
ext.test \
extra.test \
@@ -384,8 +385,6 @@
EXTRA_DIST = defs ChangeLog-old $(TESTS)
-EXEEXT =
-OBJEXT = o
subdir = tests
mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs
CONFIG_CLEAN_FILES =
Index: tests/exeext2.test
===================================================================
RCS file: exeext2.test
diff -N exeext2.test
--- /dev/null Tue May 5 13:32:27 1998
+++ tests/exeext2.test Thu Jul 26 17:00:43 2001
@@ -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Patch: FYI: EXEEXT fix,
Tom Tromey <=