From 3e1f26e1351c7184123e843b0c1c441fa3c8bb15 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 31 Dec 2001 01:01:03 +0000 Subject: [PATCH] For PR automake/211: * automake.in (object_compilation_map): New global. (initialize_per_input): Initialize it. (COMPILE_LIBTOOL): New constant. (COMPILE_ORDINARY): Likewise. * tests/Makefile.am (TESTS): Added pr211.test. * tests/pr211.test: New file. --- ChangeLog | 8 ++++++++ automake.in | 26 ++++++++++++++++++++++++++ tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/pr211.test | 26 ++++++++++++++++++++++++++ 5 files changed, 62 insertions(+) create mode 100755 tests/pr211.test diff --git a/ChangeLog b/ChangeLog index 6da8767..133f338 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2001-12-30 Tom Tromey + For PR automake/211: + * automake.in (object_compilation_map): New global. + (initialize_per_input): Initialize it. + (COMPILE_LIBTOOL): New constant. + (COMPILE_ORDINARY): Likewise. + * tests/Makefile.am (TESTS): Added pr211.test. + * tests/pr211.test: New file. + For PR automake/215: * configure.in: Use AM_AUTOMAKE_OPTIONS. * Makefile.am (AUTOMAKE_OPTIONS): Removed. diff --git a/automake.in b/automake.in index 4d0237a..725e871 100755 --- a/automake.in +++ b/automake.in @@ -236,6 +236,11 @@ my $LANG_IGNORE = 0; my $LANG_PROCESS = 1; my $LANG_SUBDIR = 2; +# These are used when keeping track of whether an object can be built +# by two different paths. +my $COMPILE_LIBTOOL = 1; +my $COMPILE_ORDINARY = 2; + # Map from obsolete macros to hints for new macros. # If you change this, change the corresponding list in aclocal.in. # FIXME: should just put this into a single file. @@ -551,6 +556,12 @@ my @dist_sources; # by a single source file. my %object_map; +# This hash maps object file names onto an integer value representing +# whether this object has been built via ordinary compilation or +# libtool compilation (the COMPILE_* constants). +my %object_compilation_map; + + # This keeps track of the directories for which we've already # created `.dirstamp' code. my %directory_map; @@ -725,6 +736,7 @@ sub initialize_per_input () @dist_sources = (); %object_map = (); + %object_compilation_map = (); %directory_map = (); @@ -1967,6 +1979,20 @@ sub handle_single_transform_list ($$$$@) } } + my $comp_val = (($object =~ /\.lo$/) + ? $COMPILE_LIBTOOL : $COMPILE_ORDINARY); + (my $comp_obj = $object) =~ s/\.lo$/.\$(OBJEXT)/; + if (defined $object_compilation_map{$comp_obj} + && $object_compilation_map{$comp_obj} != 0 + # Only see the error once. + && ($object_compilation_map{$comp_obj} + != ($COMPILE_LIBTOOL | $COMPILE_ORDINARY)) + && $object_compilation_map{$comp_obj} != $comp_val) + { + am_error ("object `$object' created both with libtool and without"); + } + $object_compilation_map{$comp_obj} |= $comp_val; + if (defined $lang) { # Let the language do some special magic if required. $lang->target_hook ($aggregate, $object, $full); diff --git a/tests/Makefile.am b/tests/Makefile.am index 7104b09..6472ffe 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -240,6 +240,7 @@ pluseq7.test \ pluseq8.test \ ppf77.test \ pr2.test \ +pr211.test \ pr220.test \ pr243.test \ pr266.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 58b0eb2..6e69068 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -313,6 +313,7 @@ pluseq7.test \ pluseq8.test \ ppf77.test \ pr2.test \ +pr211.test \ pr220.test \ pr243.test \ pr266.test \ diff --git a/tests/pr211.test b/tests/pr211.test new file mode 100755 index 0000000..1d9fb0f --- /dev/null +++ b/tests/pr211.test @@ -0,0 +1,26 @@ +#! /bin/sh + +# Test for PR 211. + +requires=libtoolize +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AC_INIT(Makefile.am) +AM_INIT_AUTOMAKE(hello,0.23) +AC_PROG_CC +AC_PROG_LIBTOOL +AC_OUTPUT(Makefile) +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = helldl +lib_LTLIBRARIES = libfoo.la +helldl_SOURCES = foo.c +libfoo_la_SOURCES = foo.c +END + +libtoolize || exit 1 +$ACLOCAL || exit 1 +$AUTOMAKE -a && exit 1 +exit 0 -- 2.7.4