Sun Aug 11 00:20:16 1996 Tom Tromey <tromey@creche.cygnus.com>
+ * automake.in (handle_yacc_lex_cxx): Require ylwrap in
+ multi-lex/yacc case.
+ (handle_source_transform): Changed return result.
+ (handle_programs): Use linker returned by
+ handle_source_transform.
+
+ * interlock: Changed usage.
+
+ * ylwrap: New file.
+
* automake.in (handle_yacc_lex_cxx): Renamed.
* automake.in (handle_dependencies): Handle %cxx_extensions.
## These must all be executable when installed.
pkgdata_SCRIPTS = config.guess config.sub install-sh interlock mdate-sh \
-mkinstalldirs elisp-comp
+mkinstalldirs elisp-comp ylwrap
CLEANFILES = automake aclocal
ansi2knr.1 aclocal.m4 lisp.am lisp-clean.am
pkgdata_SCRIPTS = config.guess config.sub install-sh interlock mdate-sh \
-mkinstalldirs elisp-comp
+mkinstalldirs elisp-comp ylwrap
CLEANFILES = automake aclocal
$output_rules .= ".y.c:\n\t";
if ($yacc_count > 1)
{
- $output_rules .= '$(INTERLOCK) y.tab.c $@ $(YACC) $(YFLAGS) $<';
+ $output_rules .= '$(INTERLOCK) =yacclockdir $(YLWRAP) y.tab.c $@ $(YACC) $(YFLAGS) $<';
}
else
{
. "\n");
if ($lex_count > 1)
{
- $output_rules .= '$(INTERLOCK) lex.yy.c $@ $(LEX) $(LFLAGS) $<';
+ $output_rules .= '$(INTERLOCK) =lexlockdir $(YLWRAP) lex.yy.c $@ $(LEX) $(LFLAGS) $<';
}
else
{
# file in a given directory, then the `interlock' program is
# required to allow parallel builds to work correctly. FIXME
# for now, no line number.
- &require_config_file ($FOREIGN, 'interlock');
- $output_vars .= 'INTERLOCK = ';
- if ($config_aux_dir ne '.' && $config_aux_dir ne '')
- {
- $output_vars .= $config_aux_dir;
- }
- else
- {
- $output_vars .= '$(top_srcdir)';
- }
- $output_vars .= "/interlock\n";
+ &require_config_file ($FOREIGN, 'interlock', 'ylwrap');
+ $output_vars .= ('INTERLOCK = ' . $config_aux_dir . "/interlock\n"
+ . 'YLWRAP = ' . $config_aux_dir . "/ylwrap\n");
}
}
# Handle SOURCE->OBJECT transform for one program or library.
+# Arguments are:
+# canonical (transformed) name of object to build
+# actual name of object to build
+# object extension (ie either `.o' or `$o'.
+# Return result is name of linker variable that must be used.
+# Empty return means just use `LINK'.
sub handle_source_transform
{
# one_file is canonical name. unxformed is given name. obj is
local ($objpat) = $obj;
$objpat =~ s/(\W)/\\$1/g;
+ local ($linker) = '';
+
if (&variable_defined ($one_file . "_OBJECTS"))
{
&am_line_error ($one_file . '_OBJECTS',
|| s/\.C$/$obj/g)
{
$cxx_extensions{$&} = 1;
+ $linker = 'CXXLINK';
}
# FORTRAN support.
. $contents{'CONFIG_HEADER'} . "\n");
}
- return @result;
+ return $linker;
}
# Special-case @ALLOCA@ and @LIBOBJS@ in _LDADD or _LIBADD variables.
}
}
- &handle_source_transform ($xname, $one_file, $obj);
+ local ($linker) = &handle_source_transform ($xname, $one_file, $obj);
if (&variable_defined ($xname . "_LDADD"))
{
}
else
{
- $xlink = 'LINK';
+ $xlink = $linker ? $linker : 'LINK';
}
$output_rules .=
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Pick a filename. Hopefully no-one actually uses this name.
-dirname='=interlockdir'
+# Usage:
+# interlock lock-dir-name program args-to-program...
-while (mkdir $dirname > /dev/null 2>&1 && exit 1 || exit 0); do
- # Nothing.
- :
-done
+dirname="$1"
+program="$2"
-# We have the lock.
-prog="$1"
-progoutput="$2"
-realoutput="$3"
-shift
shift
shift
-$prog ${1+"$@"}
-ret=$?
+while (mkdir $dirname > /dev/null 2>&1 && exit 1 || exit 0); do
+ # Wait a bit.
+ sleep 1
+done
-if test -f "$progoutput"; then
- mv "$progoutput" "$realoutput" || ret=$?
-fi
+# Race condition here: if interrupted after the loop but before this
+# trap, the lock can be left around.
+trap "rmdir $dirname > /dev/null 2>&1" 1 2
+
+# We have the lock, so run the program.
+$program ${1+"$@"}
+ret=$?
# Release the lock.
rmdir $dirname > /dev/null 2>&1
## These must all be executable when installed.
pkgdata_SCRIPTS = config.guess config.sub install-sh interlock mdate-sh \
-mkinstalldirs elisp-comp
+mkinstalldirs elisp-comp ylwrap
CLEANFILES = automake aclocal
--- /dev/null
+#! /bin/sh
+# ylwrap - wrapper for lex/yacc invocations.
+# Written by Tom Tromey <tromey@cygnus.com>, Aug 11 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# The program to run.
+prog="$1"
+
+# The output file the program generates, eg `y.tab.c'.
+progoutput="$2"
+
+# The output file we actually want.
+realoutput="$3"
+
+# Strip arguments we've used; remaining arguments go to PROG.
+shift
+shift
+shift
+
+$prog ${1+"$@"} || exit $?
+
+if test -f "$progoutput"; then
+ mv "$progoutput" "$realoutput" || exit $?
+else
+ exit 1
+fi
+exit 0
Sun Aug 11 00:10:42 1996 Tom Tromey <tromey@creche.cygnus.com>
+ * cxxlink.test: New file.
+
* yacc.test: Fixed test for new yacc code.
Sat Aug 10 10:09:45 1996 Tom Tromey <tromey@creche.cygnus.com>
yacc.test mkinstall2.test texinfo2.test ansi.test depacl.test depacl2.test \
error.test colon.test vtexi2.test tags.test comment.test libfiles.test \
man.test info.test obsolete.test lex.test scripts.test subdir2.test \
-exsource.test canon4.test dup.test defun.test
+exsource.test canon4.test dup.test defun.test cxxlink.test
EXTRA_DIST = defs $(TESTS)
yacc.test mkinstall2.test texinfo2.test ansi.test depacl.test depacl2.test \
error.test colon.test vtexi2.test tags.test comment.test libfiles.test \
man.test info.test obsolete.test lex.test scripts.test subdir2.test \
-exsource.test canon4.test dup.test defun.test
+exsource.test canon4.test dup.test defun.test cxxlink.test
EXTRA_DIST = defs $(TESTS)
mkinstalldirs = $(top_srcdir)/mkinstalldirs
--- /dev/null
+#! /bin/sh
+
+# Test to make sure C++ linker is used when appropriate.
+
+. $srcdir/defs || exit 1
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = lavalamp
+lavalamp_SOURCES = lava.c lamp.cxx
+END
+
+: > lava.c
+: > lamp.cxx
+
+$AUTOMAKE || exit 1
+
+# Look for this macro not at the beginning of any line; that will have
+# to be good enough for now.
+grep '.CXXLINK' Makefile.in
--- /dev/null
+#! /bin/sh
+# ylwrap - wrapper for lex/yacc invocations.
+# Written by Tom Tromey <tromey@cygnus.com>, Aug 11 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# The program to run.
+prog="$1"
+
+# The output file the program generates, eg `y.tab.c'.
+progoutput="$2"
+
+# The output file we actually want.
+realoutput="$3"
+
+# Strip arguments we've used; remaining arguments go to PROG.
+shift
+shift
+shift
+
+$prog ${1+"$@"} || exit $?
+
+if test -f "$progoutput"; then
+ mv "$progoutput" "$realoutput" || exit $?
+else
+ exit 1
+fi
+exit 0