forked from msys2/MSYS2-packages
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathautomake1.9-backport-pr401-test-and-fix.patch
More file actions
299 lines (289 loc) · 8.19 KB
/
Copy pathautomake1.9-backport-pr401-test-and-fix.patch
File metadata and controls
299 lines (289 loc) · 8.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
--- origsrc/automake-1.9.6/automake.in 2008-10-27 08:43:13.042076800 -0400
+++ src/automake-1.9.6/automake.in 2008-10-27 08:43:38.017990400 -0400
@@ -334,6 +334,10 @@
# in Makefiles.
my $am_config_aux_dir = '';
+# Directory to search for AC_LIBSOURCE file, as set by AC_CONFIG_LIBOBJ_DIR
+# in configure.ac.
+my $config_libobj_dir = '';
+
# Whether AM_GNU_GETTEXT has been seen in configure.ac.
my $seen_gettext = 0;
# Whether AM_GNU_GETTEXT([external]) is used.
@@ -2074,7 +2078,7 @@
if ($iter =~ /\.h$/)
{
- require_file_with_macro ($cond, $var, FOREIGN, $iter);
+ require_libobj_with_macro ($cond, $var, FOREIGN, $iter);
}
elsif ($iter ne 'alloca.c')
{
@@ -2086,7 +2090,7 @@
my $bs = var ('BUILT_SOURCES');
if (! $bs || ! grep (/$rewrite/, $bs->value_as_list_recursive))
{
- require_file_with_macro ($cond, $var, FOREIGN, $iter);
+ require_libobj_with_macro ($cond, $var, FOREIGN, $iter);
}
}
}
@@ -2099,7 +2103,7 @@
$lt ||= '';
$var->requires_variables ("\@${lt}ALLOCA\@ used", $lt . 'ALLOCA');
$dep_files{'$(DEPDIR)/alloca.P' . $myobjext} = 1;
- require_file_with_macro ($cond, $var, FOREIGN, 'alloca.c');
+ require_libobj_with_macro ($cond, $var, FOREIGN, 'alloca.c');
&saw_extension ('c');
}
@@ -4638,6 +4642,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,
@@ -4733,6 +4738,12 @@
push @config_headers, $spec;
}
}
+ elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR')
+ {
+ $config_libobj_dir = $args[1];
+ $relative_dir = '.';
+ check_directory ($config_libobj_dir, $where);
+ }
elsif ($macro eq 'AC_CONFIG_LINKS')
{
foreach my $spec (split (' ', $args[1]))
@@ -5766,6 +5777,15 @@
use constant IN_COMMENT => 2;
my $prev_state = IN_RULE_DEF;
+ # Calculate the relative path from this Makefile to LIBOBJDIR.
+ my $am_libobj_dir = '';
+ unless ($config_libobj_dir eq '')
+ {
+ my $dir = File::Spec->abs2rel ($config_libobj_dir, $relative_dir);
+ $am_libobj_dir = "$dir/" unless $dir eq '';
+ }
+ &define_variable ('LIBOBJDIR', "$am_libobj_dir", INTERNAL);
+
while ($_ = $am_file->getline)
{
$where->set ("$amfile:$.");
@@ -6984,6 +7004,22 @@
require_file ($macro->rdef ($cond)->location, $mystrict, @files);
}
+# &require_libobj_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# -------------------------------------------------------------
+sub require_libobj_with_macro ($$$@)
+{
+ my ($cond, $macro, $mystrict, @files) = @_;
+ $macro = rvar ($macro) unless ref $macro;
+ if ($config_libobj_dir eq '')
+ {
+ require_file ($macro->rdef ($cond)->location, $mystrict, @files);
+ }
+ else
+ {
+ require_file_internal ($macro->rdef ($cond)->location, $mystrict,
+ $config_libobj_dir, @files);
+ }
+}
# &require_conf_file ($WHERE, $MYSTRICT, @FILES)
# ----------------------------------------------
--- origsrc/automake-1.9.6/doc/automake.texi 2005-07-09 05:28:44.000000000 -0400
+++ src/automake-1.9.6/doc/automake.texi 2008-10-27 19:44:50.308644800 -0400
@@ -3901,7 +3901,10 @@
The @code{AC_CONFIG_LIBOBJ_DIR} tells Autoconf that the source files
of these object files are to be found in the @file{lib/} directory.
-Automake does not yet use this information; it knows the source files
+
+In conjunction with @code{subdir-objects}, Automake uses this
+information to deduce that the object files will be in the same
+subdirectory relative to @code{$top_builddir}; it knows the source files
are expected to be in the directory where the @samp{$(LIBOBJS)} and
@samp{$(ALLOCA)} variables are used.
@@ -3947,13 +3950,9 @@
tool2_SOURCES = @dots{}
@end example
-Please note it would be wrong to use the variables @samp{$(LIBOBJS)} or
-@samp{$(ALLOCA)} in @file{src/Makefile.am}, because these variables
-contains unprefixed object names, and, for instance,
-@file{malloc.$(OBJEXT)} is not buildable in the @file{src/} directory.
-(Actually if you try using @samp{$(LIBOBJS)} in @file{src/}, Automake
-will require a copy of @file{malloc.c}, @file{memcmp.c},
-@file{strdup.c}, @file{alloca.c} in @file{src/} too.)
+Please note @code{$(LIBOBJS)} or @code{$(ALLOCA)} can only be used in
+@file{src/Makefile.am} in @code{subdir-objects} mode, because these
+variables contain object names prefixed with @code{$(LIBOBJDIR)}.
Because @samp{$(LIBOBJS)} and @samp{$(ALLOCA)} contain object
file names that end with @samp{.$(OBJEXT)}, they are not suitable for
--- origsrc/automake-1.9.6/tests/Makefile.am 2005-06-30 17:17:13.000000000 -0400
+++ src/automake-1.9.6/tests/Makefile.am 2008-10-27 08:43:38.068062400 -0400
@@ -412,6 +412,7 @@
pr300-ltlib.test \
pr300-prog.test \
pr307.test \
+pr401.test \
prefix.test \
primary.test \
primary2.test \
--- origsrc/automake-1.9.6/tests/pr401.test 1969-12-31 19:00:00.000000000 -0500
+++ src/automake-1.9.6/tests/pr401.test 2008-10-27 08:43:38.078076800 -0400
@@ -0,0 +1,155 @@
+#! /bin/sh
+# Copyright (C) 2005 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 vs LIBOBJS.
+
+required=gcc
+. ./defs || exit 1
+
+set -e
+
+mkdir lib src
+
+cat >lib/feep.c <<'EOF'
+char *
+feep ()
+{
+ return "feep";
+}
+EOF
+
+cat >src/feep.c <<'EOF'
+#include <stdio.h>
+
+extern char *feep ();
+
+int
+main (int argc, char **argv)
+{
+ printf ("%s\n", feep ());
+ return 0;
+}
+EOF
+
+cat >>configure.in << 'EOF'
+## These lines are activated for later tests
+#: AC_CONFIG_LIBOBJ_DIR([lib])
+AC_PROG_CC
+#: AM_PROG_CC_C_O
+AC_LIBOBJ([feep])
+AC_LIBSOURCE([feep.c])
+AC_PROG_RANLIB
+AC_CONFIG_FILES([lib/Makefile src/Makefile])
+AC_OUTPUT
+EOF
+
+## ------------------------------------------ ##
+## First a test of traditional LIBOBJS usage. ##
+## ------------------------------------------ ##
+
+cat >Makefile.am <<'EOF'
+SUBDIRS = lib src
+EOF
+
+cat >lib/Makefile.am <<'EOF'
+noinst_LIBRARIES = libfeep.a
+libfeep_a_SOURCES =
+libfeep_a_LIBADD = $(LIBOBJS)
+EOF
+
+cat >src/Makefile.am <<'EOF'
+check_PROGRAMS = feep
+feep_LDADD = $(top_builddir)/lib/libfeep.a
+
+TESTS = feep
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE
+$MAKE check
+
+rm -f configure Makefile* lib/Makefile* src/Makefile* */feep.o */libfeep.a
+
+
+## -------------------------------------------- ##
+## Test using LIBOBJS from a sibling directory. ##
+## -------------------------------------------- ##
+
+$PERL -pi -e 's/#: //' configure.in
+$PERL -pi -e 's/lib\/Makefile //' configure.in
+
+cat >Makefile.am <<'EOF'
+SUBDIRS = src
+EOF
+
+cat > src/Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+
+noinst_LIBRARIES = libfeep.a
+libfeep_a_SOURCES =
+libfeep_a_LIBADD = $(LIBOBJS)
+
+check_PROGRAMS = feep
+feep_LDADD = ./libfeep.a
+
+TESTS = feep
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+./configure
+$MAKE
+$MAKE check
+
+rm -f configure Makefile* src/Makefile* */feep.o */libfeep.a
+
+
+## ----------------------------------------- ##
+## Test using LIBOBJS from parent directory. ##
+## ----------------------------------------- ##
+
+$PERL -pi -e 's/^.*src\/Makefile.*$//' configure.in
+
+cat >Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+
+noinst_LIBRARIES = lib/libfeep.a
+lib_libfeep_a_SOURCES =
+lib_libfeep_a_LIBADD = $(LIBOBJS)
+
+check_PROGRAMS = src/feep
+src_feep_SOURCES = src/feep.c
+src_feep_LDADD = ./lib/libfeep.a
+
+TESTS = src/feep
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE
+$MAKE check
+
+rm -f configure Makefile* */feep.o */libfeep.a