[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: automake/401: 1-gary-scan-ac-config-libobj-dir.patch
From: |
Alexandre Duret-Lutz |
Subject: |
Re: automake/401: 1-gary-scan-ac-config-libobj-dir.patch |
Date: |
Sun, 07 Sep 2003 17:41:41 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
>>> "Gary" == Gary V Vaughan <address@hidden> writes:
Gary> Automakers:
Gary> I thought I would have a play with the single makefile support using
Gary> automake-1.7.6, but tripped over buggy support for LIBOBJS in subdirs.
Gary> This patch takes note of a AC_CONFIG_LIBOBJ_DIR declaration, and at
Gary> least looks in the right directory for LIBOBJ files without bailing
Gary> out.
Gary> There are a couple of other problems my perl-fu is inadequate to resolve:
Gary> i) No compile rule for LIBOBJ sources is generated in Makefile.in
Gary> ii) No dependencies are generated (the dep file says #dummy)
Gary> iii) The compiled objects are dropped in the
Gary> $top_builddir -- no good if two dirs each contain files
Gary> with the same name.
I've looked at this. One problem I can see is that $(LIBOBJS)
contains unprefixed object names. So if all your objects lie in
lib/, then it is not sensible to use $(LIBOBJS) outside
lib/Makefile.am. AC_CONFIG_LIBOBJ_DIR([lib]) could be used to
warn about uses of $(LIBOBJS) outside lib/. The appended patch
does this (I'm not installing it because the ideas below seem
neater).
In order to support AC_CONFIG_LIBOBJ_DIR([lib]) in single Makefile
configurations, I think Autoconf should adjust LIBOBJS so that it
is usable in each directory (when AC_CONFIG_LIBOBJ_DIR is used). I.e.,
LIBOBJS='foo.o bar.o' in lib/Makefile
LIBOBJS='lib/foo.o lib/bar.o' in ./Makefile
LIBOBJS='../lib/foo.o ../lib/bar.o' in src/Makefile
This way it would make sense to use $(LIBOBJS) outside AC_CONFIG_LIBOBJ_DIR.
A variation is to always define LIBOBJS='${LIBOBJ_DIR}foo.o ${LIBOBJ_DIR}bar.o'
and let Automake define LIBOBJ_DIR differently in each Makefile.am. This
should be easy.
I've thought about always using
LIBOBJS='$(top_buildir)/lib/foo.o $(top_buildir)/lib/bar.o'
but that is not backward compatible with projects using rules
for foo.o and bar.o in lib/Makefile (not all Make will
recognize $(top_buildir)/lib/foo.o and foo.o as being the same
file).
2003-09-07 Alexandre Duret-Lutz <address@hidden>
For PR automake/401:
* automake.in (handle_lib_objects): Warn about LIBOBJ or LTLIBOBJ
being used outside of AC_CONFIG_LIBOBJ_DIR.
(scan_autoconf_traces): Trace AC_CONFIG_LIBOBJ_DIR.
(config_libobj_dir, config_libobj_dir_location): New variables.
* tests/libobjd.test: New file.
* tests/Makefile.am (TESTS): Add libobjd.test.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1504
diff -u -r1.1504 automake.in
--- automake.in 7 Sep 2003 09:55:35 -0000 1.1504
+++ automake.in 7 Sep 2003 15:11:16 -0000
@@ -325,6 +325,10 @@
my $config_aux_dir = '';
my $config_aux_dir_set_in_configure_in = 0;
+# Argument and location of AC_CONFIG_LIBOBJ_DIR.
+my $config_libobj_dir;
+my $config_libobj_dir_location;
+
# Whether AM_GNU_GETTEXT has been seen in configure.ac.
my $seen_gettext = 0;
# Whether AM_GNU_GETTEXT([external]) is used.
@@ -1900,6 +1904,14 @@
}
elsif ($val =~ /^\@(LT)address@hidden/)
{
+ if ($config_libobj_dir && $relative_dir ne $config_libobj_dir)
+ {
+ msg_var ('syntax', $var,
+ "`$val' used outside directory "
+ . "`$config_libobj_dir' ...", partial => 1);
+ msg ('syntax', $config_libobj_dir_location,
+ "... specified here");
+ }
handle_LIBOBJS ($subvar, $full_cond, $1);
$seen_libobjs = 1;
return $val;
@@ -4232,6 +4244,7 @@
AC_CONFIG_AUX_DIR => 1,
AC_CONFIG_FILES => 1,
AC_CONFIG_HEADERS => 1,
+ AC_CONFIG_LIBOBJ_DIR => 1,
AC_CONFIG_LINKS => 1,
AC_INIT => 0,
AC_LIBSOURCE => 1,
@@ -4304,6 +4317,11 @@
{
$config_header_location = $where;
push @config_headers, split (' ', $args[1]);
+ }
+ elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR')
+ {
+ $config_libobj_dir = $args[1];
+ $config_libobj_dir_location = $where;
}
elsif ($macro eq 'AC_CONFIG_LINKS')
{
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.516
diff -u -r1.516 Makefile.am
--- tests/Makefile.am 7 Sep 2003 13:26:44 -0000 1.516
+++ tests/Makefile.am 7 Sep 2003 15:11:16 -0000
@@ -262,6 +262,7 @@
libobj11.test \
libobj12.test \
libobj13.test \
+libobjd.test \
library.test \
library2.test \
library3.test \
Index: tests/libobjd.test
===================================================================
RCS file: tests/libobjd.test
diff -N tests/libobjd.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/libobjd.test 7 Sep 2003 15:11:16 -0000
@@ -0,0 +1,97 @@
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Check support for AC_CONFIG_LIBOBJ_DIR.
+# Related to PR/401.
+
+required=gcc
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'EOF'
+## The following line will be activated later.
+#: AC_CONFIG_LIBOBJ_DIR([lib])
+AC_PROG_CC
+AC_LIBOBJ([two])
+AC_LIBSOURCE([two.c])
+AC_PROG_RANLIB
+AC_CONFIG_FILES([lib/Makefile sub/Makefile])
+AC_OUTPUT
+EOF
+
+mkdir lib sub
+
+cat >Makefile.am <<'EOF'
+SUBDIRS = lib sub
+
+distdir-check: distdir
+ test -f $(distdir)/lib/two.c
+ test ! -f $(distdir)/sub/two.c
+
+distdir-check2: distdir
+ test -f $(distdir)/lib/two.c
+ test -f $(distdir)/sub/two.c
+EOF
+
+cat >lib/Makefile.am <<'EOF'
+noinst_LIBRARIES = liblibobj.a
+liblibobj_a_SOURCES =
+liblibobj_a_LIBADD = $(LIBOBJS)
+EOF
+
+cat > lib/two.c <<'EOF'
+int
+two ()
+{
+ return 2;
+}
+EOF
+
+cp lib/two.c sub
+
+: >sub/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE
+test -f lib/liblibobj.a
+$MAKE distdir-check
+
+cat >sub/Makefile.am <<'EOF'
+noinst_LIBRARIES = libtwo.a
+libtwo_a_SOURCES =
+libtwo_a_LIBADD = $(LIBOBJS)
+EOF
+
+$AUTOMAKE
+./configure
+$MAKE distdir-check2
+
+
+$PERL -pi -e 's/#: //' configure.in
+
+$ACLOCAL
+$AUTOCONF
+AUTOMAKE_fails
+grep 'sub/Makefile.am:3:.*LIBOBJS.*outside.*lib' stderr
+grep 'configure.in:.*here' stderr
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: automake/401: 1-gary-scan-ac-config-libobj-dir.patch,
Alexandre Duret-Lutz <=