Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / tests / libtoolize.at
1 # libtoolize.at -- test libtoolize operation                  -*- Autotest -*-
2 #
3 #   Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
4 #   Written by Gary V. Vaughan, 2005
5 #
6 #   This file is part of GNU Libtool.
7 #
8 # GNU Libtool is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
12 #
13 # GNU Libtool is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Libtool; see the file COPYING.  If not, a copy
20 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
21 # or obtained by writing to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ####
24
25
26 AT_BANNER([Libtoolize operation.])
27
28 # _LT_CONFIGURE_AC
29 # ----------------
30 m4_define([_LT_CONFIGURE_AC],
31 [AT_DATA([configure.ac],
32 [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
33 AC_CONFIG_AUX_DIR([build-aux])
34 AC_CONFIG_MACRO_DIR([m4])
35 LT_INIT
36 AC_OUTPUT
37 ]])
38 ])# _LT_CONFIGURE_AC
39
40 # _LT_LIBTOOLIZE_SETUP
41 # --------------------
42 m4_define([_LT_LIBTOOLIZE_SETUP],
43 [_LT_CONFIGURE_AC
44
45 test -d m4 || { rm -f m4 && mkdir m4; }
46
47 rm -f m4/libtool.m4 m4/ltoptions.m4 build-aux/ltmain.sh
48
49 AT_DATA([Makefile.am],
50 [[ACLOCAL_AMFLAGS = -I m4
51 ]])
52
53 # This file should be upgraded.
54 AT_DATA([m4/libtool.m4], [[
55 # serial 25 LT_INIT
56 ]])
57
58 # This file has a very high serial number, and should be left unchanged
59 # until --force is passed.
60 AT_DATA([m4/ltoptions.m4], [[
61 # serial 99999 ltoptions.m4
62 ]])
63
64 test -d build-aux || { rm -f build-aux && mkdir build-aux; }
65
66 # This file has a very high serial number, and needs --force to be updated.
67 AT_DATA([build-aux/ltmain.sh], [[
68 package_revision=9999.9999
69 ]])
70
71 # This file has a very old serial number, but should be left unchanged
72 # unless the --install flag is invoked.
73 AT_DATA([build-aux/config.guess], [[
74 timestamp='1970-01-01'
75 ]])
76 ])# LT_LIBTOOLIZE_SETUP
77
78
79 ## ------------------- ##
80 ## Macro installation. ##
81 ## ------------------- ##
82
83 AT_SETUP([libtoolize macro installation])
84
85 _LT_CONFIGURE_AC
86
87 AT_DATA(expout,
88 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
89 libtoolize: copying file `build-aux/ltmain.sh'
90 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
91 libtoolize: copying file `m4/libtool.m4'
92 libtoolize: copying file `m4/ltoptions.m4'
93 libtoolize: copying file `m4/ltsugar.m4'
94 libtoolize: copying file `m4/ltversion.m4'
95 libtoolize: copying file `m4/lt~obsolete.m4'
96 libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
97 ]])
98
99 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
100
101 AT_CLEANUP
102
103
104 ## ------------------------- ##
105 ## ACLOCAL_AMFLAGS mismatch. ##
106 ## ------------------------- ##
107
108 AT_SETUP([libtoolize macro directory mismatch error])
109
110 _LT_CONFIGURE_AC
111
112 AT_DATA([Makefile.am],
113 [[ACLOCAL_AMFLAGS = -I me2
114 ]])
115
116 AT_DATA(experr,
117 [[libtoolize: AC_CONFIG_MACRO_DIR([m4]) conflicts with ACLOCAL_AMFLAGS=-I me2.
118 ]])
119
120 LT_AT_CHECK_LIBTOOLIZE([--copy], 1, [ignore], experr)
121
122 AT_CLEANUP
123
124 ## -------------- ##
125 ## Serial update. ##
126 ## -------------- ##
127
128 AT_SETUP([libtoolize macro serial update])
129
130 _LT_LIBTOOLIZE_SETUP
131
132
133
134 ## -------------------------------------------------------------------- ##
135 ## First we try to update with some newer files in the destination dir. ##
136 ## -------------------------------------------------------------------- ##
137
138 AT_DATA(expout,
139 [[libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
140 libtoolize: copying file `m4/libtool.m4'
141 libtoolize: copying file `m4/ltsugar.m4'
142 libtoolize: copying file `m4/ltversion.m4'
143 libtoolize: copying file `m4/lt~obsolete.m4'
144 ]])
145
146 AT_DATA(experr,
147 [[libtoolize: `build-aux/ltmain.sh' is newer: use `--force' to overwrite
148 libtoolize: `m4/ltoptions.m4' is newer: use `--force' to overwrite
149 ]])
150
151 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout, experr)
152
153
154 ## ---------------------------------------------------------- ##
155 ## Next, a second update attempt with everything now updated. ##
156 ## ---------------------------------------------------------- ##
157
158 : >expout
159
160 AT_DATA(experr,
161 [[libtoolize: `build-aux/ltmain.sh' is newer: use `--force' to overwrite
162 libtoolize: `m4/ltoptions.m4' is newer: use `--force' to overwrite
163 ]])
164
165 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout, experr)
166
167
168 ## ----------------------------------------------------------- ##
169 ## Now, a forced update to downgrade files with newer serials. ##
170 ## ----------------------------------------------------------- ##
171
172 AT_DATA(expout,
173 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
174 libtoolize: copying file `build-aux/ltmain.sh'
175 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
176 libtoolize: copying file `m4/libtool.m4'
177 libtoolize: copying file `m4/ltoptions.m4'
178 libtoolize: copying file `m4/ltsugar.m4'
179 libtoolize: copying file `m4/ltversion.m4'
180 libtoolize: copying file `m4/lt~obsolete.m4'
181 ]])
182
183 LT_AT_CHECK_LIBTOOLIZE([--copy --force], 0, expout)
184
185
186 ## ---------------------------------------------------------------- ##
187 ## A final update attempt with everything previously force updated. ##
188 ## ---------------------------------------------------------------- ##
189
190 : >expout
191
192 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
193
194 AT_CLEANUP
195
196
197 ## --------------- ##
198 ## --install flag. ##
199 ## --------------- ##
200
201 AT_SETUP([libtoolize config files serial update])
202
203 _LT_LIBTOOLIZE_SETUP
204
205
206
207 ## -------------------------------------------------------------------- ##
208 ## First we try to update with some newer files in the destination dir. ##
209 ## -------------------------------------------------------------------- ##
210
211 AT_DATA(expout,
212 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
213 libtoolize: copying file `build-aux/config.guess'
214 libtoolize: copying file `build-aux/config.sub'
215 libtoolize: copying file `build-aux/install-sh'
216 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
217 libtoolize: copying file `m4/libtool.m4'
218 libtoolize: copying file `m4/ltsugar.m4'
219 libtoolize: copying file `m4/ltversion.m4'
220 libtoolize: copying file `m4/lt~obsolete.m4'
221 ]])
222
223 AT_DATA(experr,
224 [[libtoolize: `build-aux/ltmain.sh' is newer: use `--force' to overwrite
225 libtoolize: `m4/ltoptions.m4' is newer: use `--force' to overwrite
226 ]])
227
228 LT_AT_CHECK_LIBTOOLIZE([--copy --install], 0, expout, experr)
229
230
231 ## ---------------------------------------------------------- ##
232 ## Next, a second update attempt with everything now updated. ##
233 ## ---------------------------------------------------------- ##
234
235 : >expout
236
237 AT_DATA(experr,
238 [[libtoolize: `build-aux/ltmain.sh' is newer: use `--force' to overwrite
239 libtoolize: `m4/ltoptions.m4' is newer: use `--force' to overwrite
240 ]])
241
242 LT_AT_CHECK_LIBTOOLIZE([--copy --install], 0, expout, experr)
243
244
245 ## ----------------------------------------------------------- ##
246 ## Now, a forced update to downgrade files with newer serials. ##
247 ## ----------------------------------------------------------- ##
248
249 AT_DATA(expout,
250 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
251 libtoolize: copying file `build-aux/config.guess'
252 libtoolize: copying file `build-aux/config.sub'
253 libtoolize: copying file `build-aux/install-sh'
254 libtoolize: copying file `build-aux/ltmain.sh'
255 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
256 libtoolize: copying file `m4/libtool.m4'
257 libtoolize: copying file `m4/ltoptions.m4'
258 libtoolize: copying file `m4/ltsugar.m4'
259 libtoolize: copying file `m4/ltversion.m4'
260 libtoolize: copying file `m4/lt~obsolete.m4'
261 ]])
262
263 LT_AT_CHECK_LIBTOOLIZE([--copy --force --install], 0, expout)
264
265
266 ## ---------------------------------------------------------------- ##
267 ## A final update attempt with everything previously force updated. ##
268 ## ---------------------------------------------------------------- ##
269
270 : >expout
271
272 LT_AT_CHECK_LIBTOOLIZE([--copy --install], 0, expout)
273
274 AT_CLEANUP
275
276
277 ## ----------------------------------------------------------------- ##
278 ## Ensure libtoolize works when LT_CONFIG_LTDL_DIR is not specified. ##
279 ## ----------------------------------------------------------------- ##
280
281 AT_SETUP([diagnose missing LT_CONFIG_LTDL_DIR])
282
283 AT_DATA(expout,
284 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
285 libtoolize: copying file `build-aux/config.guess'
286 libtoolize: copying file `build-aux/config.sub'
287 libtoolize: copying file `build-aux/install-sh'
288 libtoolize: copying file `build-aux/ltmain.sh'
289 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
290 libtoolize: copying file `m4/argz.m4'
291 libtoolize: copying file `m4/libtool.m4'
292 libtoolize: copying file `m4/ltdl.m4'
293 libtoolize: copying file `m4/ltoptions.m4'
294 libtoolize: copying file `m4/ltsugar.m4'
295 libtoolize: copying file `m4/ltversion.m4'
296 libtoolize: copying file `m4/lt~obsolete.m4'
297 libtoolize: putting libltdl files in `ltdl'.
298 libtoolize: copying file `ltdl/COPYING.LIB'
299 libtoolize: copying file `ltdl/README'
300 libtoolize: copying file `ltdl/argz_.h'
301 libtoolize: copying file `ltdl/argz.c'
302 libtoolize: copying file `ltdl/loaders/dld_link.c'
303 libtoolize: copying file `ltdl/loaders/dlopen.c'
304 libtoolize: copying file `ltdl/loaders/dyld.c'
305 libtoolize: copying file `ltdl/loaders/load_add_on.c'
306 libtoolize: copying file `ltdl/loaders/loadlibrary.c'
307 libtoolize: copying file `ltdl/loaders/shl_load.c'
308 libtoolize: copying file `ltdl/lt__dirent.c'
309 libtoolize: copying file `ltdl/lt__strl.c'
310 libtoolize: copying file `ltdl/libltdl/lt__alloc.h'
311 libtoolize: copying file `ltdl/libltdl/lt__dirent.h'
312 libtoolize: copying file `ltdl/libltdl/lt__glibc.h'
313 libtoolize: copying file `ltdl/libltdl/lt__private.h'
314 libtoolize: copying file `ltdl/libltdl/lt__strl.h'
315 libtoolize: copying file `ltdl/libltdl/lt_dlloader.h'
316 libtoolize: copying file `ltdl/libltdl/lt_error.h'
317 libtoolize: copying file `ltdl/libltdl/lt_system.h'
318 libtoolize: copying file `ltdl/libltdl/slist.h'
319 libtoolize: copying file `ltdl/loaders/preopen.c'
320 libtoolize: copying file `ltdl/lt__alloc.c'
321 libtoolize: copying file `ltdl/lt_dlloader.c'
322 libtoolize: copying file `ltdl/lt_error.c'
323 libtoolize: copying file `ltdl/ltdl.c'
324 libtoolize: copying file `ltdl/ltdl.h'
325 libtoolize: copying file `ltdl/slist.c'
326 libtoolize: creating file `ltdl/Makefile.inc'
327 libtoolize: Remember to add `LT_CONFIG_LTDL_DIR([ltdl])' to `configure.ac'.
328 libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
329 ]])
330
331 AT_DATA([configure.ac],
332 [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
333 AC_CONFIG_AUX_DIR([build-aux])
334 AC_CONFIG_MACRO_DIR([m4])
335 LT_INIT
336 LTDL_INIT([nonrecursive])
337 AC_OUTPUT
338 ]])
339
340 LT_AT_CHECK_LIBTOOLIZE([--copy --install --ltdl=ltdl], 0, expout)
341
342 AT_CLEANUP
343
344
345 ## ---------------------------- ##
346 ## Make sure ltdl.m4 is copied. ##
347 ## ---------------------------- ##
348
349 # _LT_AT_LTDL_SETUP
350 # -----------------
351 # Macro to generate data files common to several tests.
352 m4_pushdef([_LT_AT_LTDL_SETUP],
353 [AT_DATA(expout,
354 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `ltdl/config'.
355 libtoolize: linking file `ltdl/config/compile'
356 libtoolize: linking file `ltdl/config/config.guess'
357 libtoolize: linking file `ltdl/config/config.sub'
358 libtoolize: linking file `ltdl/config/depcomp'
359 libtoolize: linking file `ltdl/config/install-sh'
360 libtoolize: linking file `ltdl/config/missing'
361 libtoolize: linking file `ltdl/config/ltmain.sh'
362 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `ltdl/m4'.
363 libtoolize: linking file `ltdl/m4/argz.m4'
364 libtoolize: linking file `ltdl/m4/libtool.m4'
365 libtoolize: linking file `ltdl/m4/ltdl.m4'
366 libtoolize: linking file `ltdl/m4/ltoptions.m4'
367 libtoolize: linking file `ltdl/m4/ltsugar.m4'
368 libtoolize: linking file `ltdl/m4/ltversion.m4'
369 libtoolize: linking file `ltdl/m4/lt~obsolete.m4'
370 libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, `ltdl'.
371 libtoolize: linking file `ltdl/COPYING.LIB'
372 libtoolize: linking file `ltdl/README'
373 libtoolize: linking file `ltdl/Makefile.am'
374 libtoolize: linking file `ltdl/configure.ac'
375 libtoolize: copying file `ltdl/aclocal.m4'
376 libtoolize: linking file `ltdl/Makefile.in'
377 libtoolize: linking file `ltdl/config-h.in'
378 libtoolize: linking file `ltdl/configure'
379 libtoolize: linking file `ltdl/argz_.h'
380 libtoolize: linking file `ltdl/argz.c'
381 libtoolize: linking file `ltdl/loaders/dld_link.c'
382 libtoolize: linking file `ltdl/loaders/dlopen.c'
383 libtoolize: linking file `ltdl/loaders/dyld.c'
384 libtoolize: linking file `ltdl/loaders/load_add_on.c'
385 libtoolize: linking file `ltdl/loaders/loadlibrary.c'
386 libtoolize: linking file `ltdl/loaders/shl_load.c'
387 libtoolize: linking file `ltdl/lt__dirent.c'
388 libtoolize: linking file `ltdl/lt__strl.c'
389 libtoolize: linking file `ltdl/libltdl/lt__alloc.h'
390 libtoolize: linking file `ltdl/libltdl/lt__dirent.h'
391 libtoolize: linking file `ltdl/libltdl/lt__glibc.h'
392 libtoolize: linking file `ltdl/libltdl/lt__private.h'
393 libtoolize: linking file `ltdl/libltdl/lt__strl.h'
394 libtoolize: linking file `ltdl/libltdl/lt_dlloader.h'
395 libtoolize: linking file `ltdl/libltdl/lt_error.h'
396 libtoolize: linking file `ltdl/libltdl/lt_system.h'
397 libtoolize: linking file `ltdl/libltdl/slist.h'
398 libtoolize: linking file `ltdl/loaders/preopen.c'
399 libtoolize: linking file `ltdl/lt__alloc.c'
400 libtoolize: linking file `ltdl/lt_dlloader.c'
401 libtoolize: linking file `ltdl/lt_error.c'
402 libtoolize: linking file `ltdl/ltdl.c'
403 libtoolize: linking file `ltdl/ltdl.h'
404 libtoolize: linking file `ltdl/slist.c'
405 ]])
406
407 AT_DATA([configure.ac],
408 [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
409 LT_CONFIG_LTDL_DIR([ltdl])
410 AC_CONFIG_AUX_DIR([ltdl/config])
411 AC_CONFIG_MACRO_DIR([ltdl/m4])
412 LT_INIT
413 LTDL_INIT
414 AC_OUTPUT
415 ]])
416
417 AT_DATA([Makefile.am],
418 [[ACLOCAL_AMFLAGS = -I ltdl/m4
419 ]])
420 ])# _LT_AT_LTDL_SETUP
421
422 ## ------------------------------------------------ ##
423 ## First we make sure libtoolize --ltdl is working. ##
424 ## ------------------------------------------------ ##
425
426 AT_SETUP([copy ltdl.m4 with shared macro directory])
427
428 _LT_AT_LTDL_SETUP
429
430 LT_AT_CHECK_LIBTOOLIZE([--ltdl], 0, expout)
431
432 AT_CLEANUP
433
434 ## ----------------------------------------------------- ##
435 ## And also that libtoolize is taking note of LTDL_INIT. ##
436 ## ----------------------------------------------------- ##
437
438 AT_SETUP([correctly parse LTDL_INIT from configure.ac])
439
440 _LT_AT_LTDL_SETUP
441
442 LT_AT_CHECK_LIBTOOLIZE([], 0, expout)
443
444 AT_CLEANUP
445
446 ## ----------------------------------------------------------- ##
447 ## And finally, that libtoolize diagnoses a missing LTDL_INIT. ##
448 ## ----------------------------------------------------------- ##
449
450 AT_SETUP([diagnose missing LTDL_INIT invocation])
451
452 AT_DATA(expout,
453 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `ltdl/config'.
454 libtoolize: copying file `ltdl/config/compile'
455 libtoolize: copying file `ltdl/config/config.guess'
456 libtoolize: copying file `ltdl/config/config.sub'
457 libtoolize: copying file `ltdl/config/depcomp'
458 libtoolize: copying file `ltdl/config/install-sh'
459 libtoolize: copying file `ltdl/config/missing'
460 libtoolize: copying file `ltdl/config/ltmain.sh'
461 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `ltdl/m4'.
462 libtoolize: copying file `ltdl/m4/argz.m4'
463 libtoolize: copying file `ltdl/m4/libtool.m4'
464 libtoolize: copying file `ltdl/m4/ltdl.m4'
465 libtoolize: copying file `ltdl/m4/ltoptions.m4'
466 libtoolize: copying file `ltdl/m4/ltsugar.m4'
467 libtoolize: copying file `ltdl/m4/ltversion.m4'
468 libtoolize: copying file `ltdl/m4/lt~obsolete.m4'
469 libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, `ltdl'.
470 libtoolize: copying file `ltdl/COPYING.LIB'
471 libtoolize: copying file `ltdl/README'
472 libtoolize: copying file `ltdl/Makefile.am'
473 libtoolize: copying file `ltdl/configure.ac'
474 libtoolize: copying file `ltdl/aclocal.m4'
475 libtoolize: copying file `ltdl/Makefile.in'
476 libtoolize: copying file `ltdl/config-h.in'
477 libtoolize: copying file `ltdl/configure'
478 libtoolize: copying file `ltdl/argz_.h'
479 libtoolize: copying file `ltdl/argz.c'
480 libtoolize: copying file `ltdl/loaders/dld_link.c'
481 libtoolize: copying file `ltdl/loaders/dlopen.c'
482 libtoolize: copying file `ltdl/loaders/dyld.c'
483 libtoolize: copying file `ltdl/loaders/load_add_on.c'
484 libtoolize: copying file `ltdl/loaders/loadlibrary.c'
485 libtoolize: copying file `ltdl/loaders/shl_load.c'
486 libtoolize: copying file `ltdl/lt__dirent.c'
487 libtoolize: copying file `ltdl/lt__strl.c'
488 libtoolize: copying file `ltdl/libltdl/lt__alloc.h'
489 libtoolize: copying file `ltdl/libltdl/lt__dirent.h'
490 libtoolize: copying file `ltdl/libltdl/lt__glibc.h'
491 libtoolize: copying file `ltdl/libltdl/lt__private.h'
492 libtoolize: copying file `ltdl/libltdl/lt__strl.h'
493 libtoolize: copying file `ltdl/libltdl/lt_dlloader.h'
494 libtoolize: copying file `ltdl/libltdl/lt_error.h'
495 libtoolize: copying file `ltdl/libltdl/lt_system.h'
496 libtoolize: copying file `ltdl/libltdl/slist.h'
497 libtoolize: copying file `ltdl/loaders/preopen.c'
498 libtoolize: copying file `ltdl/lt__alloc.c'
499 libtoolize: copying file `ltdl/lt_dlloader.c'
500 libtoolize: copying file `ltdl/lt_error.c'
501 libtoolize: copying file `ltdl/ltdl.c'
502 libtoolize: copying file `ltdl/ltdl.h'
503 libtoolize: copying file `ltdl/slist.c'
504 libtoolize: Remember to add `LTDL_INIT' to configure.ac.
505 libtoolize: Consider adding `-I ltdl/m4' to ACLOCAL_AMFLAGS in Makefile.am.
506 ]])
507
508 AT_DATA([configure.ac],
509 [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
510 LT_CONFIG_LTDL_DIR([ltdl])
511 AC_CONFIG_AUX_DIR([ltdl/config])
512 AC_CONFIG_MACRO_DIR([ltdl/m4])
513 LT_INIT
514 AC_OUTPUT
515 ]])
516
517 LT_AT_CHECK_LIBTOOLIZE([--ltdl --copy], 0, expout)
518
519 AT_CLEANUP
520
521 m4_popdef([_LT_AT_LTDL_SETUP])
522
523 ## ------------------------------------------------------ ##
524 ## Creating an aclocal.m4 without in-tree libtool macros. ##
525 ## ------------------------------------------------------ ##
526
527 AT_SETUP([upgrading verbatim style aclocal.m4])
528
529 AT_DATA([configure.ac],
530 [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
531 AC_CONFIG_AUX_DIR([build-aux])
532 LT_INIT
533 AC_OUTPUT
534 ]])
535
536 AT_DATA([expout],
537 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
538 libtoolize: copying file `build-aux/ltmain.sh'
539 libtoolize: You should add the contents of the following files to `aclocal.m4':
540 libtoolize:   `/usr/local/share/aclocal/libtool.m4'
541 libtoolize:   `/usr/local/share/aclocal/ltoptions.m4'
542 libtoolize:   `/usr/local/share/aclocal/ltversion.m4'
543 libtoolize:   `/usr/local/share/aclocal/ltsugar.m4'
544 libtoolize:   `/usr/local/share/aclocal/lt~obsolete.m4'
545 libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
546 libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
547 libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
548 ]])
549
550 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
551
552
553 ## --------------------------------------- ##
554 ## Upgrading a hand maintained aclocal.m4. ##
555 ## --------------------------------------- ##
556
557 AT_DATA([configure.ac],
558 [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
559 AC_CONFIG_AUX_DIR([build-aux])
560 AC_CONFIG_MACRO_DIR([m4])
561 LT_INIT
562 AC_OUTPUT
563 ]])
564
565 AT_DATA([Makefile.am],
566 [[ACLOCAL_AMFLAGS = -I m4
567 ]])
568
569 AT_DATA([aclocal.m4],
570 [[# This should need upgrading:
571 # serial 25 LT_INIT
572 AC_DEFUN([LT_INIT],
573 [blah])
574
575 # This is newer than the upgrade version:
576 # serial 99999 ltoptions.m4
577
578 # This is older than the upgrade version:
579 # serial 1 ltversion.m4
580 ]])
581
582 AT_DATA([expout],
583 [[libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
584 libtoolize: copying file `m4/libtool.m4'
585 libtoolize: copying file `m4/ltoptions.m4'
586 libtoolize: copying file `m4/ltsugar.m4'
587 libtoolize: You should add the contents of `m4/ltsugar.m4' to `aclocal.m4'.
588 libtoolize: copying file `m4/ltversion.m4'
589 libtoolize: You should add the contents of `m4/ltversion.m4' to `aclocal.m4'.
590 libtoolize: copying file `m4/lt~obsolete.m4'
591 libtoolize: You should add the contents of `m4/lt~obsolete.m4' to `aclocal.m4'.
592 ]])
593
594 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
595
596
597 ## ------------------------------------------- ##
598 ## Upgrading an aclocal maintained aclocal.m4. ##
599 ## ------------------------------------------- ##
600
601 LT_AT_ACLOCAL([-I m4])
602
603 rm -f m4/libtool.m4 m4/ltoptions.m4
604
605 # This file should be upgraded.
606 AT_DATA([m4/libtool.m4], [[
607 # serial 25 LT_INIT
608 AC_DEFUN([LT_INIT])
609 ]])
610
611 # This file has a very high serial number, and should be left unchanged.
612 AT_DATA([m4/ltoptions.m4], [[
613 # serial 99999 ltoptions.m4
614 ]])
615
616 AT_DATA([expout],
617 [[libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
618 libtoolize: copying file `m4/libtool.m4'
619 ]])
620
621 AT_DATA([experr],
622 [[libtoolize: `m4/ltoptions.m4' is newer: use `--force' to overwrite
623 ]])
624
625 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout, experr)
626
627 ## ----------------------------------------------------------- ##
628 ## Now, a forced update to downgrade files with newer serials. ##
629 ## ----------------------------------------------------------- ##
630
631 AT_DATA(expout,
632 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
633 libtoolize: copying file `build-aux/ltmain.sh'
634 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
635 libtoolize: copying file `m4/libtool.m4'
636 libtoolize: copying file `m4/ltoptions.m4'
637 libtoolize: copying file `m4/ltsugar.m4'
638 libtoolize: copying file `m4/ltversion.m4'
639 libtoolize: copying file `m4/lt~obsolete.m4'
640 ]])
641
642 LT_AT_CHECK_LIBTOOLIZE([--copy --force], 0, expout)
643
644 AT_CLEANUP
645
646
647 ## ------------------------------------------------------------------ ##
648 ## Ensure libtoolize works when AC_CONFIG_MACRO_DIR is not specified. ##
649 ## ------------------------------------------------------------------ ##
650
651 AT_SETUP([verbatim aclocal.m4 w/o AC_CONFIG_MACRO_DIR])
652
653 AT_DATA([configure.ac],
654 [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
655 LT_INIT
656 AC_OUTPUT
657 ]])
658
659 AT_DATA([aclocal.m4],
660 [[# This should need upgrading:
661 # serial 25 LT_INIT
662 AC_DEFUN([LT_INIT],
663 [blah])
664
665 # This is newer than the upgrade version:
666 # serial 99999 ltoptions.m4
667
668 # This is older than the upgrade version:
669 # serial 1 ltversion.m4
670 ]])
671
672 AT_DATA([expout],
673 [[libtoolize: putting auxiliary files in `.'.
674 libtoolize: copying file `./ltmain.sh'
675 libtoolize: You should add the contents of the following files to `aclocal.m4':
676 libtoolize:   `/usr/local/share/aclocal/libtool.m4'
677 libtoolize:   `/usr/local/share/aclocal/ltversion.m4'
678 libtoolize:   `/usr/local/share/aclocal/ltsugar.m4'
679 libtoolize:   `/usr/local/share/aclocal/lt~obsolete.m4'
680 libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
681 libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
682 libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
683 ]])
684
685 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
686
687
688 ## ----------------------------------------------------------------------- ##
689 ## Upgrading an aclocal maintained aclocal.m4 without AC_CONFIG_MACRO_DIR. ##
690 ## ----------------------------------------------------------------------- ##
691
692 LT_AT_ACLOCAL([-I $abs_top_srcdir/libltdl/m4])
693
694 ## The following code is adapted (and simplified) from libtoolize.m4sh
695 ####
696 : ${GREP="grep"}
697 : ${SED="sed"}
698
699 basename="s,^.*/,,"
700
701 # func_grep expression filename
702 # Check whether EXPRESSION matches any line of FILENAME, without output.
703 func_grep ()
704 {
705     $GREP "$1" "$2" >/dev/null 2>&1
706 }
707
708 # func_serial filename [macro_regex]
709 # Output the value of the serial number comment in FILENAME, where the
710 # comment line must also match MACRO_REGEX, if given.
711 func_serial ()
712 {
713     my_filename="$1"
714     my_macro_regex="$2"
715     my_sed_serial='
716         /^# serial [1-9][0-9.]*[        ]*'"$my_macro_regex"'[  ]*$/ {
717             s,^# serial \([1-9][0-9.]*\).*$,\1,
718             q
719         }
720         d'
721
722     # Search FILENAME and all the files it m4_includes for a serial number
723     # in the file that AC_DEFUNs MACRO_REGEX.
724     my_serial=
725     if test -z "$my_macro_regex" ||
726        test "$my_filename" = aclocal.m4 ||
727        test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
728        func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_filename"
729     then
730       my_serial=`$SED -e "$my_sed_serial" "$my_filename"`
731     fi
732
733     # If the file has no serial number, something is badly wrong!
734     test -n "$my_serial" || exit 1
735
736     echo $my_serial
737 }
738
739 # Make the serial number in aclocal.m4 higher than installed ltoptions.m4,
740 # and the others match the macro files that libtoolize will compare against.
741 libtool_serial=`func_serial "$tst_aclocaldir/libtool.m4" LT_INIT`
742 ltversion_serial=`func_serial "$tst_aclocaldir/ltversion.m4" ltversion.m4`
743 ltsugar_serial=`func_serial "$tst_aclocaldir/ltsugar.m4" ltsugar.m4`
744 lt_obsolete_serial=`func_serial "$tst_aclocaldir/lt~obsolete.m4" lt~obsolete.m4`
745 $SED -e 's,^#.*serial.*ltoptions.m4$,# serial 99999 ltoptions.m4,' \
746   -e "s,^#.*serial.*libtool.m4\$,# serial $libtool_serial libtool.m4," \
747   -e "s,^#.*serial.*ltversion.m4\$,# serial $ltversion_serial ltversion.m4," \
748   -e "s,^#.*serial.*ltsugar.m4\$,# serial $ltsugar_serial ltsugar.m4," \
749   -e "s,^#.*serial.*lt~obsolete.m4\$,# serial $lt_obsolete_serial lt~obsolete.m4," \
750  < aclocal.m4 > aclocal.m4t
751 mv -f aclocal.m4t aclocal.m4
752
753 AT_DATA([expout],
754 [[libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
755 libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
756 libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
757 ]])
758
759 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, expout)
760
761
762 ## --------------------- ##
763 ## Now, a forced update. ##
764 ## --------------------- ##
765
766 AT_DATA(expout,
767 [[libtoolize: putting auxiliary files in `.'.
768 libtoolize: copying file `./ltmain.sh'
769 libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
770 libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
771 libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
772 ]])
773
774 LT_AT_CHECK_LIBTOOLIZE([--copy --force], 0, expout)
775
776 AT_CLEANUP
777
778
779 ## ------------------------------------------------------------- ##
780 ## Check nonrecursive ltdl puts m4 files in AC_CONFIG_MACRO_DIR. ##
781 ## ------------------------------------------------------------- ##
782
783 AT_SETUP([nonrecursive ltdl with AC_CONFIG_MACRO_DIR])
784
785 AT_DATA(expout,
786 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
787 libtoolize: copying file `build-aux/config.guess'
788 libtoolize: copying file `build-aux/config.sub'
789 libtoolize: copying file `build-aux/install-sh'
790 libtoolize: copying file `build-aux/ltmain.sh'
791 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
792 libtoolize: copying file `m4/argz.m4'
793 libtoolize: copying file `m4/libtool.m4'
794 libtoolize: copying file `m4/ltdl.m4'
795 libtoolize: copying file `m4/ltoptions.m4'
796 libtoolize: copying file `m4/ltsugar.m4'
797 libtoolize: copying file `m4/ltversion.m4'
798 libtoolize: copying file `m4/lt~obsolete.m4'
799 libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, `ltdl'.
800 libtoolize: copying file `ltdl/COPYING.LIB'
801 libtoolize: copying file `ltdl/README'
802 libtoolize: copying file `ltdl/argz_.h'
803 libtoolize: copying file `ltdl/argz.c'
804 libtoolize: copying file `ltdl/loaders/dld_link.c'
805 libtoolize: copying file `ltdl/loaders/dlopen.c'
806 libtoolize: copying file `ltdl/loaders/dyld.c'
807 libtoolize: copying file `ltdl/loaders/load_add_on.c'
808 libtoolize: copying file `ltdl/loaders/loadlibrary.c'
809 libtoolize: copying file `ltdl/loaders/shl_load.c'
810 libtoolize: copying file `ltdl/lt__dirent.c'
811 libtoolize: copying file `ltdl/lt__strl.c'
812 libtoolize: copying file `ltdl/libltdl/lt__alloc.h'
813 libtoolize: copying file `ltdl/libltdl/lt__dirent.h'
814 libtoolize: copying file `ltdl/libltdl/lt__glibc.h'
815 libtoolize: copying file `ltdl/libltdl/lt__private.h'
816 libtoolize: copying file `ltdl/libltdl/lt__strl.h'
817 libtoolize: copying file `ltdl/libltdl/lt_dlloader.h'
818 libtoolize: copying file `ltdl/libltdl/lt_error.h'
819 libtoolize: copying file `ltdl/libltdl/lt_system.h'
820 libtoolize: copying file `ltdl/libltdl/slist.h'
821 libtoolize: copying file `ltdl/loaders/preopen.c'
822 libtoolize: copying file `ltdl/lt__alloc.c'
823 libtoolize: copying file `ltdl/lt_dlloader.c'
824 libtoolize: copying file `ltdl/lt_error.c'
825 libtoolize: copying file `ltdl/ltdl.c'
826 libtoolize: copying file `ltdl/ltdl.h'
827 libtoolize: copying file `ltdl/slist.c'
828 libtoolize: creating file `ltdl/Makefile.inc'
829 ]])
830
831 AT_DATA([configure.ac],
832 [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
833 LT_CONFIG_LTDL_DIR([ltdl])
834 AC_CONFIG_AUX_DIR([build-aux])
835 AC_CONFIG_MACRO_DIR([m4])
836 LT_INIT
837 LTDL_INIT([nonrecursive])
838 AC_OUTPUT
839 ]])
840
841 AT_DATA([Makefile.am],
842 [[ACLOCAL_AMFLAGS = -I m4
843 ]])
844
845 LT_AT_CHECK_LIBTOOLIZE([--copy --install --ltdl=ltdl], 0, expout)
846
847 AT_CLEANUP
848
849
850 ## -------------------------------------------------------- ##
851 ## Check subproject ltdl with non-shared AC_CONFIG_.*_DIRs. ##
852 ## -------------------------------------------------------- ##
853
854 AT_SETUP([subproject ltdl with non-shared directories])
855
856 AT_DATA(expout,
857 [[libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
858 libtoolize: copying file `build-aux/config.guess'
859 libtoolize: copying file `build-aux/config.sub'
860 libtoolize: copying file `build-aux/install-sh'
861 libtoolize: copying file `build-aux/ltmain.sh'
862 libtoolize: putting auxiliary files in `build-aux'.
863 libtoolize: copying file `ltdl/config/compile'
864 libtoolize: copying file `ltdl/config/config.guess'
865 libtoolize: copying file `ltdl/config/config.sub'
866 libtoolize: copying file `ltdl/config/depcomp'
867 libtoolize: copying file `ltdl/config/install-sh'
868 libtoolize: copying file `ltdl/config/missing'
869 libtoolize: copying file `ltdl/config/ltmain.sh'
870 libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `acm4'.
871 libtoolize: copying file `acm4/argz.m4'
872 libtoolize: copying file `acm4/libtool.m4'
873 libtoolize: copying file `acm4/ltdl.m4'
874 libtoolize: copying file `acm4/ltoptions.m4'
875 libtoolize: copying file `acm4/ltsugar.m4'
876 libtoolize: copying file `acm4/ltversion.m4'
877 libtoolize: copying file `acm4/lt~obsolete.m4'
878 libtoolize: putting macros in `ltdl/m4'.
879 libtoolize: copying file `ltdl/m4/argz.m4'
880 libtoolize: copying file `ltdl/m4/libtool.m4'
881 libtoolize: copying file `ltdl/m4/ltdl.m4'
882 libtoolize: copying file `ltdl/m4/ltoptions.m4'
883 libtoolize: copying file `ltdl/m4/ltsugar.m4'
884 libtoolize: copying file `ltdl/m4/ltversion.m4'
885 libtoolize: copying file `ltdl/m4/lt~obsolete.m4'
886 libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, `ltdl'.
887 libtoolize: copying file `ltdl/COPYING.LIB'
888 libtoolize: copying file `ltdl/README'
889 libtoolize: copying file `ltdl/Makefile.am'
890 libtoolize: copying file `ltdl/configure.ac'
891 libtoolize: copying file `ltdl/aclocal.m4'
892 libtoolize: copying file `ltdl/Makefile.in'
893 libtoolize: copying file `ltdl/config-h.in'
894 libtoolize: copying file `ltdl/configure'
895 libtoolize: copying file `ltdl/argz_.h'
896 libtoolize: copying file `ltdl/argz.c'
897 libtoolize: copying file `ltdl/loaders/dld_link.c'
898 libtoolize: copying file `ltdl/loaders/dlopen.c'
899 libtoolize: copying file `ltdl/loaders/dyld.c'
900 libtoolize: copying file `ltdl/loaders/load_add_on.c'
901 libtoolize: copying file `ltdl/loaders/loadlibrary.c'
902 libtoolize: copying file `ltdl/loaders/shl_load.c'
903 libtoolize: copying file `ltdl/lt__dirent.c'
904 libtoolize: copying file `ltdl/lt__strl.c'
905 libtoolize: copying file `ltdl/libltdl/lt__alloc.h'
906 libtoolize: copying file `ltdl/libltdl/lt__dirent.h'
907 libtoolize: copying file `ltdl/libltdl/lt__glibc.h'
908 libtoolize: copying file `ltdl/libltdl/lt__private.h'
909 libtoolize: copying file `ltdl/libltdl/lt__strl.h'
910 libtoolize: copying file `ltdl/libltdl/lt_dlloader.h'
911 libtoolize: copying file `ltdl/libltdl/lt_error.h'
912 libtoolize: copying file `ltdl/libltdl/lt_system.h'
913 libtoolize: copying file `ltdl/libltdl/slist.h'
914 libtoolize: copying file `ltdl/loaders/preopen.c'
915 libtoolize: copying file `ltdl/lt__alloc.c'
916 libtoolize: copying file `ltdl/lt_dlloader.c'
917 libtoolize: copying file `ltdl/lt_error.c'
918 libtoolize: copying file `ltdl/ltdl.c'
919 libtoolize: copying file `ltdl/ltdl.h'
920 libtoolize: copying file `ltdl/slist.c'
921 libtoolize: Consider using `AC_CONFIG_AUX_DIR([ltdl/config])' in configure.ac.
922 libtoolize: Consider using `AC_CONFIG_MACRO_DIR([ltdl/m4])' in configure.ac.
923 libtoolize: Consider adding `-I ltdl/m4' to ACLOCAL_AMFLAGS in Makefile.am.
924 ]])
925
926 AT_DATA([configure.ac],
927 [[AC_INIT([libtoolize-demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
928 LT_CONFIG_LTDL_DIR([ltdl])
929 AC_CONFIG_AUX_DIR([build-aux])
930 AC_CONFIG_MACRO_DIR([acm4])
931 LT_INIT
932 LTDL_INIT([subproject])
933 AC_OUTPUT
934 ]])
935
936 LT_AT_CHECK_LIBTOOLIZE([--copy --install], 0, expout)
937
938 AT_CLEANUP
939
940
941 ## --------------------------- ##
942 ## Garbled LIBTOOLIZE_OPTIONS. ##
943 ## --------------------------- ##
944
945 AT_SETUP([LIBTOOLIZE_OPTIONS])
946
947 _LT_CONFIGURE_AC
948
949 LIBTOOLIZE_OPTIONS="narf"
950 export LIBTOOLIZE_OPTIONS
951
952 AT_DATA(experr,
953 [[libtoolize: garbled LIBTOOLIZE_OPTIONS near `narf'
954 libtoolize: Try `libtoolize --help' for more information.
955 ]])
956
957 LT_AT_CHECK_LIBTOOLIZE([--copy], 1, [ignore], experr)
958
959
960 ## --------------------------- ##
961 ## Unknown LIBTOOLIZE_OPTIONS. ##
962 ## --------------------------- ##
963
964 LIBTOOLIZE_OPTIONS=--no-such-option
965 export LIBTOOLIZE_OPTIONS
966
967 AT_DATA(experr,
968 [[libtoolize: warning: unrecognized environment option `--no-such-option'
969 ]])
970
971 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, [ignore], experr)
972
973
974 ## ----------------------------- ##
975 ## --no-warn environment option. ##
976 ## ----------------------------- ##
977
978 LIBTOOLIZE_OPTIONS=--no-warn,--no-such-option
979 export LIBTOOLIZE_OPTIONS
980
981 : >experr
982
983 LT_AT_CHECK_LIBTOOLIZE([--copy], 0, [ignore], experr)
984
985 AT_CLEANUP
986
987
988 ## ------------------------------------------------------ ##
989 ## Remove file droppings from old libtoolize invocations. ##
990 ## ------------------------------------------------------ ##
991
992 AT_SETUP([cleanup old installation])
993
994 _LT_CONFIGURE_AC
995
996 AT_DATA([Makefile.am],
997 [[ACLOCAL_AMFLAGS = -I m4
998 ]])
999
1000 AT_DATA([acinclude.m4],
1001 [[AC_DEFUN([LT_INIT],
1002 [: keep me, I might be hand maintained!]) # LT_INIT
1003 ]])
1004
1005 AT_DATA([libltdl/acinclude.m4],
1006 [[AC_DEFUN([LT_INIT],
1007 [: delete me, I was left here by on old libltdl build]) # LT_INIT
1008 ]])
1009
1010 LT_AT_CHECK_LIBTOOLIZE([--copy --force --ltdl], 0, [ignore])
1011
1012 # check files are left as expected
1013 AT_CHECK([grep 'keep me' acinclude.m4], 0, [ignore])
1014 AT_CHECK([test -f libltdl/acinclude.m4], 1, [ignore], [ignore])
1015
1016 AT_CLEANUP
1017