* m4/Makefile.am (m4data_DATA): Added minuso.m4.
* Makefile.am (dist_script_DATA): Added compile.
* m4/minuso.m4: New file.
* automake.in (initialize_global_constants): Added compile to
common_files.
(seen_cc_c_o): New global.
(scan_one_configure_file): Set it when AM_PROG_CC_C_O seen.
(handle_options): Recognize `subdir-objects' option.
(lang_c_rewrite): Added directory argument.
(lang_yacc_rewrite): Likewise.
(lang_yaccxx_rewrite): Likewise.
(lang_lex_rewrite): Likewise.
(lang_lexxx_rewrite): Likewise.
(handle_single_transform_list): Pass directory to _rewrite
function. Generate dependencies for dirstamp files for each .o;
it is just the rules we want to create once.
(lang_c_rewrite): Handle `subdir-objects' option.
(lang_c_rewrite): Require `compile' program.
* compile: New file.
1999-04-11 Tom Tromey <tromey@cygnus.com>
+ First cut at allowing objects in subdirectories:
+ * m4/Makefile.am (m4data_DATA): Added minuso.m4.
+ * Makefile.am (dist_script_DATA): Added compile.
+ * m4/minuso.m4: New file.
+ * automake.in (initialize_global_constants): Added compile to
+ common_files.
+ (seen_cc_c_o): New global.
+ (scan_one_configure_file): Set it when AM_PROG_CC_C_O seen.
+ (handle_options): Recognize `subdir-objects' option.
+ (lang_c_rewrite): Added directory argument.
+ (lang_yacc_rewrite): Likewise.
+ (lang_yaccxx_rewrite): Likewise.
+ (lang_lex_rewrite): Likewise.
+ (lang_lexxx_rewrite): Likewise.
+ (handle_single_transform_list): Pass directory to _rewrite
+ function. Generate dependencies for dirstamp files for each .o;
+ it is just the rules we want to create once.
+ (lang_c_rewrite): Handle `subdir-objects' option.
+ (lang_c_rewrite): Require `compile' program.
+ * compile: New file.
+
* automake.in (initialize_per_input): Initialize %directory_map.
(handle_single_transform_list): Only create .dirstamp rules once
per directory.
## what we want. So we make them executable by hand.
scriptdir = $(pkgdatadir)
dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \
-mkinstalldirs elisp-comp ylwrap acinstall
+mkinstalldirs elisp-comp ylwrap acinstall compile
install-data-hook:
@$(POST_INSTALL)
scriptdir = $(pkgdatadir)
dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \
-mkinstalldirs elisp-comp ylwrap acinstall
+mkinstalldirs elisp-comp ylwrap acinstall compile
ETAGS_ARGS = $(amfiles)
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
- tar ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz
+ $(TAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
- tar ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz
+ $(TAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz
-rm -rf $(distdir)
distdir: $(DISTFILES)
@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \
+* Test subdir-objects option with yacc, lex, ansi2knr
+ Test `compile' program
+ Our locking scheme won't prevent a parallel make from losing
+ if there are two `bar.o' files and the timing is just right
+ This only happens with parallel make and no-`-c -o' compiler,
+ so it probably isn't very important
+
* Run automake before libtool. It will report an error but
still won't put the file into the disty. This is wrong.
From Mark H Wilkinson <mhw@kremvax.demon.co.uk>
# TRUE if we've seen AC_ENABLE_MULTILIB.
$seen_multilib = 0;
+# TRUE if we've seen AM_PROG_CC_C_O
+$seen_cc_c_o = 0;
+
# Hash table of discovered configure substitutions. Keys are names,
# values are `FILE:LINE' strings which are used by error message
# generation.
|| $_ eq 'dist-shar' || $_ eq 'dist-zip'
|| $_ eq 'dist-tarZ' || $_ eq 'dist-bzip2'
|| $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
- || $_ eq 'readme-alpha' || $_ eq 'check-news')
+ || $_ eq 'readme-alpha' || $_ eq 'check-news'
+ || $_ eq 'subdir-objects')
{
# Explicitly recognize these.
}
# Found the language, so see what it says.
local ($subr) = 'lang_' . $lang . '_rewrite';
# Note: computed subr call.
- # FIXME: should pass directory to this function.
- local ($r) = & $subr ($base, $extension);
+ local ($r) = & $subr ($directory, $base, $extension);
# Skip this entry if we were asked not to process it.
next if $r == $LANG_IGNORE;
# sure the subdir exists at build time.
if ($object =~ /\//)
{
+ # FIXME: check that $DIRECTORY is somewhere in the
+ # project
+
+ # We don't allow `..' in object file names for
+ # *any* source, not just Java. For Java it just
+ # doesn't make sense, but in general it is
+ # a problem because we can't pick a good name for
+ # the .deps entry.
if ($object =~ /(\/|^)\.\.\//)
{
&am_error ("\`$full' contains \`..' component but should not");
}
+ push (@dep_list, $directory . '/.dirstamp');
+
+ # If we're generating dependencies, we also want
+ # to make sure that the appropriate subdir of the
+ # .deps directory is created.
+ if ($use_dependencies)
+ {
+ push (@dep_list, '.deps/' . $directory . '/.dirstamp');
+ }
+
if (! defined $directory_map{$directory})
{
$directory_map{$directory} = 1;
-
- push (@dep_list, $directory . '/.dirstamp');
$output_rules .= ($directory . "/.dirstamp:\n"
. "\t\@\$(mkinstalldirs) $directory\n"
. "\t\@: > $directory/.dirstamp\n");
-
- # If we're generating dependencies, we also
- # want to make sure that the appropriate
- # subdir of the .deps directory is created.
if ($use_dependencies)
{
- push (@dep_list, '.deps/' . $directory . '/.dirstamp');
$output_rules .= ('.deps/' . $directory
. "/.dirstamp:\n"
. "\t\@\$(mkinstalldirs) .deps/$directory\n"
$configure_vars{'OBJEXT'} = $filename . ':' . $.;
}
+ # Check for `-c -o' code.
+ $seen_cc_c_o = 1 if /AM_PROG_CC_C_O/;
+
# Check for NLS support.
if (/AM_GNU_GETTEXT/)
{
# Functions to handle files of each language.
# Each `lang_X_rewrite' function follows a simple formula:
-# * Args are the base name and extension of the file.
+# * Args are the directory, base name and extension of the file.
# * Return value is 1 if file is to be dealt with, 0 otherwise.
# Much of the actual processing is handled in handle_single_transform_list.
# These functions exist so that auxiliary information can be recorded
# Rewrite a single C source file.
sub lang_c_rewrite
{
- local ($base, $ext) = @_;
+ local ($directory, $base, $ext) = @_;
if (defined $options{'ansi2knr'} && $base =~ /_$/)
{
&am_error ("C source file \`$base.c' would be deleted by ansi2knr rules");
}
+ local ($r) = $LANG_PROCESS;
+ if (defined $options{'subdir-objects'})
+ {
+ $r = $LANG_SUBDIR;
+ $base = $directory . '/' . $base;
+
+ if (! $seen_cc_c_o)
+ {
+ # Only give error once.
+ $seen_cc_c_o = 1;
+ # FIXME: line number.
+ &am_error ("C objects in subdir but \`AM_PROG_CC_C_O' not in \`configure.in'");
+ }
+
+ &require_file ($FOREIGN, 'compile')
+ if $relative_dir eq '.';
+ }
+
$de_ansi_files{$base} = 1;
- return $LANG_PROCESS;
+ return $r;
}
# Rewrite a single C++ source file.
# Rewrite a single yacc file.
sub lang_yacc_rewrite
{
- local ($base, $ext) = @_;
+ local ($directory, $base, $ext) = @_;
- &lang_c_rewrite ($base, $ext);
+ &lang_c_rewrite ($directory, $base, $ext);
$yacc_sources{$base . '.' . $ext} = 1;
$ext =~ tr/y/c/;
&saw_extension ('c');
# Rewrite a single yacc++ file.
sub lang_yaccxx_rewrite
{
- local ($base, $ext) = @_;
+ local ($directory, $base, $ext) = @_;
$yacc_sources{$base . '.' . $ext} = 1;
$ext =~ tr/y/c/;
# Rewrite a single lex file.
sub lang_lex_rewrite
{
- local ($base, $ext) = @_;
+ local ($directory, $base, $ext) = @_;
- &lang_c_rewrite ($base, $ext);
+ &lang_c_rewrite ($directory, $base, $ext);
$lex_sources{$base . '.' . $ext} = 1;
$ext =~ tr/l/c/;
&saw_extension ('c');
# Rewrite a single lex++ file.
sub lang_lexxx_rewrite
{
- local ($base, $ext) = @_;
+ local ($directory, $base, $ext) = @_;
$lex_sources{$base . '.' . $ext} = 1;
$ext =~ tr/l/c/;
"libversion.in", "mdate-sh", "mkinstalldirs", "install-sh",
'texinfo.tex', "ansi2knr.c", "ansi2knr.1", 'elisp-comp',
'ylwrap', 'acinclude.m4', @libtoolize_files,
- 'missing'
+ 'missing', 'compile'
);
# Commonly used files we auto-include, but only sometimes.
--- /dev/null
+#! /bin/sh
+
+# Wrapper for compilers which do not understand `-c -o'.
+
+# Copyright (C) 1999 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# 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.
+
+# Usage:
+# compile PROGRAM [ARGS]...
+# `-o FOO.o' is removed from the args passed to the actual compile.
+
+prog="$1"
+shift
+
+ofile=
+cfile=
+args=
+while test $# -gt 0; do
+ case "$1" in
+ -o)
+ ofile="$2"
+ shift
+ ;;
+ *.c)
+ cfile="$1"
+ args="$args $1"
+ ;;
+ *)
+ args="$args $1"
+ ;;
+ esac
+ shift
+done
+
+test -z "$ofile" && {
+ echo "compile: no \`-o' option seen" 1>&2
+ exit 1
+}
+
+test -z "$cfile" && {
+ echo "compile: no \`.c' file seen" 1>&2
+ exit 1
+}
+
+# Name of file we expect compiler to create.
+cofile="`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`"
+
+# Create the lock directory.
+lockdir="`echo $ofile | sed -e 's|/|_|g'`"
+while true; do
+ if mkdir $lockdir > /dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir $lockdir; exit 1" 1 2 15
+
+# Run the compile.
+"$prog" $args
+status=$?
+
+if test -f "$cofile"; then
+ mv "$cofile" "$ofile"
+fi
+
+rmdir $lockdir
+exit $status
## what we want. So we make them executable by hand.
scriptdir = $(pkgdatadir)
dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \
-mkinstalldirs elisp-comp ylwrap acinstall
+mkinstalldirs elisp-comp ylwrap acinstall compile
install-data-hook:
@$(POST_INSTALL)
--- /dev/null
+#! /bin/sh
+
+# Wrapper for compilers which do not understand `-c -o'.
+
+# Copyright (C) 1999 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# 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.
+
+# Usage:
+# compile PROGRAM [ARGS]...
+# `-o FOO.o' is removed from the args passed to the actual compile.
+
+prog="$1"
+shift
+
+ofile=
+cfile=
+args=
+while test $# -gt 0; do
+ case "$1" in
+ -o)
+ ofile="$2"
+ shift
+ ;;
+ *.c)
+ cfile="$1"
+ args="$args $1"
+ ;;
+ *)
+ args="$args $1"
+ ;;
+ esac
+ shift
+done
+
+test -z "$ofile" && {
+ echo "compile: no \`-o' option seen" 1>&2
+ exit 1
+}
+
+test -z "$cfile" && {
+ echo "compile: no \`.c' file seen" 1>&2
+ exit 1
+}
+
+# Name of file we expect compiler to create.
+cofile="`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`"
+
+# Create the lock directory.
+lockdir="`echo $ofile | sed -e 's|/|_|g'`"
+while true; do
+ if mkdir $lockdir > /dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir $lockdir; exit 1" 1 2 15
+
+# Run the compile.
+"$prog" $args
+status=$?
+
+if test -f "$cofile"; then
+ mv "$cofile" "$ofile"
+fi
+
+rmdir $lockdir
+exit $status
m4datadir = $(datadir)/aclocal
m4data_DATA = ccstdc.m4 cond.m4 dmalloc.m4 error.m4 gcj.m4 header.m4 \
-init.m4 lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 multi.m4 \
-obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 \
+init.m4 lex.m4 lispdir.m4 maintainer.m4 minuso.m4 missing.m4 mktime.m4 \
+multi.m4 obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 \
termios.m4 winsz.m4
EXTRA_DIST = $(m4data_DATA)
m4datadir = $(datadir)/aclocal
m4data_DATA = ccstdc.m4 cond.m4 dmalloc.m4 error.m4 gcj.m4 header.m4 \
-init.m4 lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 multi.m4 \
-obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 \
+init.m4 lex.m4 lispdir.m4 maintainer.m4 minuso.m4 missing.m4 mktime.m4 \
+multi.m4 obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 \
termios.m4 winsz.m4
--- /dev/null
+dnl Like AC_PROG_CC_C_O, but changed for automake.
+
+AC_DEFUN([AM_PROG_CC_C_O],[
+AC_REQUIRE([AC_PROG_CC_C_O])
+dnl FIXME: we rely on the cache variable name because
+dnl there is no other way.
+set dummy $CC; ac_cc="`echo [$]2 |
+changequote(, )dnl
+ sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
+changequote([, ])dnl
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+ # Losing compiler, so override with the script.
+ CC="\$(top_srcdir)/compile $CC"
+fi
+])