]> git.draconx.ca Git - dxcommon.git/blob - tests/scripts.at
gen-tree.awk: Add options to tweak the strtab output.
[dxcommon.git] / tests / scripts.at
1 dnl Copyright © 2021-2022 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 AT_BANNER([Script tests])
8
9 AT_SETUP([gen-options.awk])
10 AT_KEYWORDS([gen-options awk script scripts])
11
12 AT_DATA([options.def],
13 [[--option-only
14 --option-with-val (5)
15 --option-with-flagval (&x, 5)
16 --option-with-arg=ARG
17 some "text" goes here
18 --option-with-optional-arg[=OPTIONAL]
19
20 hello
21 -a, --option-with-sopt
22
23 -b, --option-with-sopt-and-arg=SOPTARG
24 -c, --option-with-sopt-and-optional-arg[=SOPTOPTIONAL]
25 --option-with-arg-and-val=ARGVAL (42)
26 --option-with-arg-and-flagval=ARGFLAGVAL (&a[1], 'x')
27 --option-with-optional-arg-and-val[=OPTIONALARGVAL] (54)
28 --option-with-optional-arg-and-flagval[=OPTIONALFLAGVAL] (0, 0)
29 --with-sopt
30 Here is a help string
31     that has a line randomly indented
32 # with a comment
33     @&t@
34 and a blank line
35 --with-arg=ARG
36 do stuff with ARG
37 --flagval
38 ]])
39
40 AT_CHECK([$AWK -f "$builddir/scripts/gen-options.awk" <options.def >options.h])
41
42 AT_DATA([context.h],
43 [[struct option { const char *name; int has_arg; int *flag; int val; };
44 int x, a[5];
45 ]])
46
47 # test 0: sanity test
48 AT_DATA([test0.c],
49 [[#include "context.h"
50 #include "options.h"
51
52 static const char sopts[] = SOPT_STRING;
53 static const struct option opts[] = { LOPTS_INITIALIZER, {0} };
54
55 int main(void)
56 {
57   return 0;
58 }
59 ]])
60 AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], [], [ignore])
61
62 # test 1: long option names and help text
63 AT_DATA([test1.c],
64 [[#include <stdio.h>
65 #include <stdlib.h>
66
67 #include "context.h"
68 #include "options.h"
69
70 static const struct option opts[] = { LOPTS_INITIALIZER };
71
72 int main(void)
73 {
74   unsigned i;
75
76   for (i = 0; i < sizeof opts / sizeof opts[0]; i++) {
77     struct lopt_help help = { "INVALID", "INVALID" };
78
79     if (!lopt_get_help(&opts[i], &help))
80       return EXIT_FAILURE;
81
82     printf("--%s", opts[i].name);
83     if (opts[i].has_arg)
84       printf("=%s", help.arg);
85     printf("\n%s", help.desc);
86     if (help.desc[0])
87       putchar('\n');
88   }
89
90   return 0;
91 }
92 ]])
93
94 # pick out interesting bits from the definitions file
95 sed -n '/^-/s/^.*--\([[^\= @<:@]]*\).*$/\1/p' options.def >options
96 sed -n '/^-/{
97   s/[[^=]]*\(=[[^@:>@ ]]*\).*$/\1/
98   s/^[[^=]].*//
99   s/^=//
100   p
101 }' options.def >argnames
102
103 AS_ECHO(["-"]) | sed -n '1s/^-.*//p
104 1,/^-/d
105 t clear
106 :clear
107 s/^-.*//p
108 t
109 s/^#.*//
110 s/^ *//
111 t next
112 :next
113 N
114 s/\n-.*//
115 t done
116 s/\n#.*//
117 s/\n */\n/g
118 t next
119 :done
120 s/"/\\\\"/g
121 s/[[^\n]][[^\n]]*/\\"&\\"/g
122 s/^\n*//
123 s/\n*$//
124 s/\n\n*/ /g
125 p
126 ' options.def - >helptext
127
128 exec 3<options 4<argnames 5<helptext 6>expout
129 while read opt <&3 && read arg <&4 && read help <&5; do
130   if test ${arg:+y}; then
131     AS_ECHO(["--$opt=$arg"]) >&6
132   else
133     AS_ECHO(["--$opt"]) >&6
134   fi
135   eval "set x $help"; shift
136   for arg
137   do
138     AS_ECHO(["$arg"]) >&6
139   done
140 done
141 exec 3<&- 4<&- 5<&- 6>&-
142
143 AT_CHECK([$CC -o test1$EXEEXT test1.c && ./test1$EXEEXT],
144   [0], [expout], [ignore])
145
146 # test 2: short option string
147 AT_DATA([test2.c],
148 [[#include <stdio.h>
149 #include <stdlib.h>
150
151 #include "context.h"
152 #include "options.h"
153
154 int main(void)
155 {
156   struct option lopts[] = {LOPTS_INITIALIZER};
157   unsigned i, j;
158
159   for (i = 0; i < sizeof SOPT_STRING - 1; i++) {
160     if (SOPT_STRING[i] != ':') {
161       for (j = 0; j < sizeof lopts / sizeof lopts[0]; j++) {
162         if (lopts[j].val == SOPT_STRING[i]) {
163           printf("--%s ", lopts[j].name);
164           break;
165         }
166       }
167     }
168     putchar(SOPT_STRING[i]);
169     if (SOPT_STRING[i+1] != ':')
170       putchar('\n');
171   }
172 }
173 ]])
174
175 sed -n '/^-/{
176   s/=.*/:/
177   s/[[@<:@]]/:/
178   s/^-\([[^-]]\)[[^:]]*/\1/p
179   s/^-.*//p
180 }' options.def >sopts
181
182 exec 3<options 4<sopts 5>expout
183 while read lopt <&3 && read sopt <&4; do
184   if test ${sopt:+y}; then
185     AS_ECHO(["--$lopt $sopt"]) >&5
186   fi
187 done
188 exec 3<&- 4<&- 5>&-
189
190 AT_CHECK([$CC -o test2$EXEEXT test2.c && ./test2$EXEEXT],
191   [0], [expout], [ignore])
192
193 # Check that all help strings are translatable
194 sed 's/\([[^\\]]\\\)" /\1\\n\\" /g' helptext >help-po
195 exec 3<options 4<argnames 5<help-po 6>expected.po
196 while read opt <&3 && read arg <&4 && read help <&5; do
197   if test ${arg:+y}; then
198     AS_ECHO(["msgctxt \"$opt\" msgid \"$arg\""]) >&6
199   fi
200   AS_ECHO(["msgctxt \"$opt\" msgid${help:+ }$help"]) >&6
201 done
202 exec 3<&- 4<&- 5<&- 6>&-
203
204 AT_CHECK([xgettext --keyword=PN_:1c,2 options.h
205   test -f messages.po || exit 77])
206
207 LC_ALL=C sort expected.po >expout
208 AT_CHECK([sed -n '/^msgctxt/{
209 t next
210 :next
211 N
212 s/\nmsgstr.*//
213 t done
214 s/\s*""//
215 s/\n/ /
216 t next
217 :done
218 p
219 }' messages.po | LC_ALL=C sort], [0], [expout])
220
221 AT_CLEANUP
222
223 AT_SETUP([gen-strtab.awk])
224 AT_KEYWORDS([gen-strtab awk script scripts])
225
226 AT_DATA([test.def],
227 [[
228 &a world
229 &b
230 hello world
231 &c
232 hello
233 world
234 &d world\n
235 &e
236 \\not a newline
237 &f
238 \not a newline
239 &g inline
240 continued
241 &h    no\
242 newline\
243 &i
244 \   leading whitespace
245 &j oneline
246 # with a comment
247 ]])
248
249 AT_CHECK([$AWK -f "$builddir/scripts/gen-strtab.awk" <test.def >test.h])
250
251 sed -n 's/^[[&]]\([[^ ]]*\).*/\1/p' test.def >identifiers
252
253 # test 0: sanity test
254 AT_DATA([test0.c],
255 [[#include "test.h"
256 #include <stdio.h>
257
258 int main(void)
259 {
260   printf("---\n");
261 ]])
262 exec 3<identifiers 4>>test0.c
263 while read ident <&3; do
264   AS_ECHO(['  printf("%s\n---\n", '"strtab+$ident);"]) >&4
265 done
266 AS_ECHO(['  return 0;']) >&4
267 AS_ECHO(['}']) >&4
268 exec 3<&- 4>&-
269
270 AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], [---
271 world
272 ---
273 hello world
274
275 ---
276 hello
277 world
278
279 ---
280 world
281
282 ---
283 \not a newline
284
285 ---
286
287 ot a newline
288
289 ---
290 inline
291 continued
292
293 ---
294 nonewline
295 ---
296    leading whitespace
297
298 ---
299 oneline
300 ---
301 ], [ignore])
302
303 AT_CLEANUP
304
305 AT_SETUP([gen-tree.awk])
306 AT_KEYWORDS([gen-tree awk script scripts])
307
308 AT_DATA([tree.def],
309 [[ROOT0
310   r0a, r0a_OFFSET
311     r0b, r0b_OFFSET
312       r0c
313     r0d
314   r0e, r0e_OFFSET
315     r0f
316     r0g
317 ROOT1
318   r1a, r1a_OFFSET
319     r1b, r1b_OFFSET
320       r1b
321       r1e
322       r1b
323   r1c, r1c_OFFSET
324     r1d, r1d_OFFSET
325       r1e
326       r1b
327       r1e
328 ]])
329
330 AT_CHECK([$AWK -f "$builddir/scripts/gen-tree.awk" <tree.def >tree.h])
331
332 AT_DATA([test0.c],
333 [[#include "tree.h"
334 #include <stdio.h>
335
336 struct tree { unsigned id, subtree; };
337
338 static const struct tree tree0[] = {
339   ROOT0_INITIALIZER
340 };
341 static const struct tree tree1[] = {
342   ROOT1_INITIALIZER
343 };
344
345 void print_subtree(const struct tree *root, unsigned offset, int depth)
346 {
347   const struct tree *node;
348
349   for (node = &root[offset]; node->id; node++) {
350     printf("%*s%s", 2*depth, "", &tree_strtab[node->id]);
351     if (node->subtree) {
352       printf(", %s_OFFSET\n", &tree_strtab[node->id]);
353       print_subtree(root, node->subtree, depth+1);
354     } else {
355       putchar('\n');
356     }
357   }
358 }
359
360 int main(void)
361 {
362   printf("ROOT0\n");
363   print_subtree(tree0, 0, 1);
364   printf("ROOT1\n");
365   print_subtree(tree1, 0, 1);
366   return 0;
367 }
368 ]])
369 cp tree.def expout
370 AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0], [expout])
371
372 AT_CLEANUP
373
374 # Test the gen-tree features that avoid creating string labels for nodes.
375 AT_SETUP([gen-tree.awk @nostrtab option])
376 AT_KEYWORDS([gen-tree awk script scripts])
377
378 AT_DATA([tree.def],
379 [[@nostrtab
380 ROOT
381  a 1, a_OFFSET
382   b 1
383   c 2
384  d 2, d_OFFSET
385   e 1
386   f 2
387 ]])
388 AT_CHECK([$AWK -f "$builddir/scripts/gen-tree.awk" <tree.def >tree.h])
389
390 AT_DATA([test0.c],
391 [[float tree_strtab = 0;
392 #define a []
393 #define b []
394 #define c []
395 #define e []
396 #define f []
397 #include "tree.h"
398 #include <stdio.h>
399
400 static struct { int num, offset; } root[] = { ROOT_INITIALIZER };
401
402 int main(void)
403 {
404   unsigned i;
405   for (i = 0; i < sizeof root / sizeof root[0]; i++) {
406     printf("%d, %d\n", root[i].num, root[i].offset);
407   }
408 }
409 ]])
410
411 AT_CHECK([$CC -o test0$EXEEXT test0.c && ./test0$EXEEXT], [0],
412 [[1, 3
413 2, 6
414 0, 0
415 1, 0
416 2, 0
417 0, 0
418 1, 0
419 2, 0
420 0, 0
421 ]])
422
423 AT_DATA([flat.def],
424 [[FLAT
425  a 1
426  b 2
427  c 3
428 @nostrtab
429 ]])
430 AT_CHECK([$AWK -f "$builddir/scripts/gen-tree.awk" <flat.def >flat.h])
431
432 sed -e 's/tree\.h/flat.h/' -e 's/ROOT/FLAT/' test0.c >test1.c
433 AT_CHECK([$CC -o test1$EXEEXT test1.c && ./test1$EXEEXT], [0],
434 [[1, 0
435 2, 0
436 3, 0
437 0, 0
438 ]])
439
440 AT_CLEANUP
441
442 AT_SETUP([join.awk])
443 AT_KEYWORDS([join awk script scripts])
444
445 JOIN="$AWK -f $builddir/scripts/join.awk --"
446
447 AT_DATA([a],
448 [[1 a
449 3 a1 x
450 3 a2 x
451 5 a
452 6 a
453 8 a1 x
454 8 a2 x
455 9 a1
456 9 a2
457 9 a3
458 ]])
459
460 AT_DATA([b],
461 [[2 b
462 2 b
463 3 b y
464 4 b
465 6 b1 y
466 6 b2 y
467 7 b
468 8 b1 y
469 8 b2 y
470 ]])
471
472 AT_CHECK([$JOIN a b], [0],
473 [[3 a1 x b y
474 3 a2 x b y
475 6 a b1 y
476 6 a b2 y
477 8 a1 x b1 y
478 8 a1 x b2 y
479 8 a2 x b1 y
480 8 a2 x b2 y
481 ]])
482
483 AT_CHECK([$JOIN -v1 a b], [0],
484 [[1 a
485 5 a
486 9 a1
487 9 a2
488 9 a3
489 ]])
490
491 AT_CHECK([$JOIN -v2 a b], [0],
492 [[2 b
493 2 b
494 4 b
495 7 b
496 ]])
497
498 AT_CHECK([$JOIN -v1 -v2 a b], [0],
499 [[1 a
500 2 b
501 2 b
502 4 b
503 5 a
504 7 b
505 9 a1
506 9 a2
507 9 a3
508 ]])
509
510 AT_CHECK([$JOIN -a1 a b], [0],
511 [[1 a
512 3 a1 x b y
513 3 a2 x b y
514 5 a
515 6 a b1 y
516 6 a b2 y
517 8 a1 x b1 y
518 8 a1 x b2 y
519 8 a2 x b1 y
520 8 a2 x b2 y
521 9 a1
522 9 a2
523 9 a3
524 ]])
525
526 AT_CHECK([$JOIN -a2 a b], [0],
527 [[2 b
528 2 b
529 3 a1 x b y
530 3 a2 x b y
531 4 b
532 6 a b1 y
533 6 a b2 y
534 7 b
535 8 a1 x b1 y
536 8 a1 x b2 y
537 8 a2 x b1 y
538 8 a2 x b2 y
539 ]])
540
541 AT_CHECK([$JOIN -a1 -a2 a b], [0],
542 [[1 a
543 2 b
544 2 b
545 3 a1 x b y
546 3 a2 x b y
547 4 b
548 5 a
549 6 a b1 y
550 6 a b2 y
551 7 b
552 8 a1 x b1 y
553 8 a1 x b2 y
554 8 a2 x b1 y
555 8 a2 x b2 y
556 9 a1
557 9 a2
558 9 a3
559 ]])
560
561 AT_CHECK([$JOIN b a], [0],
562 [[3 b y a1 x
563 3 b y a2 x
564 6 b1 y a
565 6 b2 y a
566 8 b1 y a1 x
567 8 b1 y a2 x
568 8 b2 y a1 x
569 8 b2 y a2 x
570 ]])
571
572 AT_CHECK([$JOIN -v1 b a], [0],
573 [[2 b
574 2 b
575 4 b
576 7 b
577 ]])
578
579 AT_CHECK([$JOIN -v2 b a], [0],
580 [[1 a
581 5 a
582 9 a1
583 9 a2
584 9 a3
585 ]])
586
587 AT_CHECK([$JOIN -v1 -v2 b a], [0],
588 [[1 a
589 2 b
590 2 b
591 4 b
592 5 a
593 7 b
594 9 a1
595 9 a2
596 9 a3
597 ]])
598
599 AT_CHECK([$JOIN -a1 b a], [0],
600 [[2 b
601 2 b
602 3 b y a1 x
603 3 b y a2 x
604 4 b
605 6 b1 y a
606 6 b2 y a
607 7 b
608 8 b1 y a1 x
609 8 b1 y a2 x
610 8 b2 y a1 x
611 8 b2 y a2 x
612 ]])
613
614 AT_CHECK([$JOIN -a2 b a], [0],
615 [[1 a
616 3 b y a1 x
617 3 b y a2 x
618 5 a
619 6 b1 y a
620 6 b2 y a
621 8 b1 y a1 x
622 8 b1 y a2 x
623 8 b2 y a1 x
624 8 b2 y a2 x
625 9 a1
626 9 a2
627 9 a3
628 ]])
629
630 AT_CHECK([$JOIN -a1 -a2 b a], [0],
631 [[1 a
632 2 b
633 2 b
634 3 b y a1 x
635 3 b y a2 x
636 4 b
637 5 a
638 6 b1 y a
639 6 b2 y a
640 7 b
641 8 b1 y a1 x
642 8 b1 y a2 x
643 8 b2 y a1 x
644 8 b2 y a2 x
645 9 a1
646 9 a2
647 9 a3
648 ]])
649
650 AT_CHECK([echo wat | $JOIN -v1 - /dev/null], [0],
651 [[wat
652 ]])
653
654 AT_CLEANUP
655
656 m4_divert_push([PREPARE_TESTS])dnl
657 test_fix_ltdl () {
658   $PERL -e 'my $x = 42; exit $x;'; test $? = 42 || exit 77
659   $PERL -f "$srcdir/scripts/fix-ltdl.pl" "$@"
660 }
661 test_fix_gnulib () {
662   $PERL -e 'my $x = 42; exit $x;'; test $? = 42 || exit 77
663   $PERL -f "$srcdir/scripts/fix-gnulib.pl" "$@"
664 }
665 test_gnulib_mk () {
666   echo;
667   for arg
668   do
669     sed -n -f - "$srcdir/tests/data/gnulib.mk" <<EOF
670 /^## begin gnulib module $arg/,/^## end   gnulib module $arg/p
671 EOF
672   done
673 }
674 m4_divert_pop([PREPARE_TESTS])
675
676 AT_SETUP([fix-gnulib.pl SED_HEADER variables])
677
678 test_gnulib_mk gen-header >test.mk.in
679 AT_CHECK([grep SED_HEADER test.mk.in >expout || exit 99])
680 AT_CHECK([test_fix_gnulib -i test.mk.in -o test.mk || exit
681 grep SED_HEADER test.mk], [0], [expout])
682
683 AT_CLEANUP
684
685 AT_SETUP([fix-gnulib.pl %reldir% substitution])
686
687 test_gnulib_mk sys_types >test.mk.in
688 AT_CHECK([grep '%reldir%' test.mk.in >/dev/null || exit 99])
689
690 sed -n -f - test.mk.in >expout <<'EOF'
691 ${G;p;b}
692 /^## begin gnulib/,/^## end   gnulib/!b
693 /^#/{p;b}
694 s|(srcdir)|(top_srcdir)|
695 s|%reldir%|lib|
696 s|BUILT_SOURCES|gnulib_core_headers|
697 s|sys[[/_]]|lib/&|g
698 /^MOSTLYCLEANFILES/{h;b}
699 p
700 EOF
701
702 AT_CHECK([test_fix_gnulib -i test.mk.in -o test.mk || exit
703 sed -n -e '/^## begin gnulib/,/^## end   gnulib/p' \
704        -e '/CLEANFILES/p' test.mk],
705 [0], [expout])
706
707 AT_CLEANUP
708
709 AT_SETUP([fix-gnulib.pl warning removal])
710
711 AT_DATA([test.mk.in], [[
712 ## test begin
713 noinst_LTLIBRARIES += libgnu.la
714 libgnu_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS)
715 noinst_LIBRARIES += libgnu.a
716 libgnu_a_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS)
717 ## test end
718 ]])
719 AT_CHECK([test_fix_gnulib -i test.mk.in -o test.mk || exit
720 sed -n '/^## test begin/,/^## test end/p' test.mk], [0], [## test begin
721 EXTRA_LTLIBRARIES += libgnu.la
722 EXTRA_LIBRARIES += libgnu.a
723 ## test end
724 ])
725
726 AT_CLEANUP
727
728 AT_SETUP([fix-gnulib.pl header directory creation])
729
730 AT_DATA([extract.sed],
731 [[/AM_V_GEN/b ok
732 /gl_V_at/b ok
733 s/:.*/:/
734 h
735 b
736 :ok
737 s/'//g
738 x
739 G
740 p
741 n
742 s/[)].*/)/
743 p
744 ]])
745
746 test_gnulib_mk alloca-opt sys_types stddef >test.mk.in
747 AT_CHECK([test_fix_gnulib -i test.mk.in -o test.mk || exit
748 sed -n -f extract.sed test.mk], [0],
749 [[lib/alloca.h:
750         $(AM_V_GEN)$(MKDIR_P) lib
751         $(AM_V_at)
752 lib/sys/types.h:
753         $(AM_V_GEN)$(MKDIR_P) lib/sys
754         $(AM_V_at)
755 lib/stddef.h:
756         $(AM_V_GEN)$(MKDIR_P) lib
757         $(AM_V_at)
758 ]])
759
760 AT_CLEANUP
761
762 dnl TEST_FIND_AUTOMAKE_VER([to-check], [test-action])
763 dnl
764 dnl For each whitespace-separated version token in to-check, check if we can
765 dnl run the programs automake-VER and aclocal-VER.  The special token 'default'
766 dnl also checks the unversioned automake and aclocal (or, if set in the
767 dnl environment, $AUTOMAKE and $ACLOCAL).
768 dnl
769 dnl Then test-action is expanded such that shell variables $ac and $am refer to
770 dnl the aclocal and automake programs, and $amver is the actual version
771 dnl reported by --version.  The action should do nothing if the version is
772 dnl acceptable, or "continue" if the version is unacceptable.
773 dnl
774 dnl If an acceptable version is found, the AUTOMAKE and ACLOCAL environment
775 dnl variables are set accordingly.  Otherwise, the test group is skipped.
776 m4_define([TEST_FIND_AUTOMAKE],
777 [have_am=false
778 for am in $1; do
779   AS_CASE([$am],
780     [default], [ac=${ACLOCAL-aclocal} am=${AUTOMAKE-automake}],
781     [ac=aclocal-$am; am=automake-$am])
782   amver=`$am --version | sed -n '1s/.* //p'`
783   acver=`$ac --version | sed -n '1s/.* //p'`
784   set x $amver $acver; shift; test x"$[]#" = x"2" || continue
785   test x"$amver" = x"$acver" || continue
786   $2
787   have_am=:; break
788 done
789 AT_CHECK([$have_am || exit 77])
790 AUTOMAKE=$am; export AUTOMAKE
791 ACLOCAL=$ac; export ACLOCAL
792 AT_CHECK([$ACLOCAL --version && $AUTOMAKE --version], [0], [stdout])
793 ])
794
795 m4_define([TEST_LTDL_LIBOBJ_MANGLING],
796 [TEST_CONFIGURE_AC([[AM_INIT_AUTOMAKE([foreign subdir-objects])
797 AC_PROG_CC
798 LT_INIT
799 AC_SUBST([ltdl_LTLIBOBJS], [libltdl/test.lo])
800 AC_CONFIG_FILES([Makefile])
801 ]])
802
803 mkdir libltdl
804 AT_DATA([ltdl.mk.in], [[
805 AM_CPPFLAGS += -DSTRING=\"helloworld\"
806
807 noinst_LTLIBRARIES = libltdl/libltdl.la
808 libltdl_libltdl_la_SOURCES = libltdl/ltdl.c
809 libltdl_libltdl_la_LIBADD = $(ltdl_LTLIBOBJS)
810 libltdl_libltdl_la_DEPENDENCIES = $(ltdl_LTLIBOBJS)
811
812 EXTRA_DIST += libltdl/test.c
813 ]])
814 AT_DATA([Makefile.am], [[AM_CPPFLAGS =
815 include $(top_srcdir)/ltdl.mk
816 AM_LIBTOOLFLAGS = --quiet
817 bin_PROGRAMS = test
818 test_SOURCES =
819 test_LDADD = libltdl/libltdl.la
820 all-local: ; @printf '%s\n' $(AM_CPPFLAGS)
821 ]])
822 AT_DATA([libltdl/test.c], [[#include <stdio.h>
823 int foo(void) { printf("%s\n", STRING); return 0; }
824 ]])
825 AT_DATA([libltdl/ltdl.c], [[int foo(void); int main(void) { return foo(); }
826 ]])
827
828 AT_CHECK([test_fix_ltdl -i ltdl.mk.in -o ltdl.mk])
829 libtoolize; TEST_AUTORECONF
830 TEST_CONFIGURE([--disable-shared])
831 AT_CHECK([make -s && ./test], [0], [
832 helloworld
833 ])])
834
835 AT_SETUP([fix-ltdl.pl LIBOBJ mangling (<automake-1.16)])
836
837 TEST_FIND_AUTOMAKE([default 1.10 1.11 1.12 1.13 1.14 1.15],
838   [AS_VERSION_COMPARE(["$amver"], [1.16], [], [continue], [continue])])
839 TEST_LTDL_LIBOBJ_MANGLING
840
841 AT_CLEANUP
842
843 AT_SETUP([fix-ltdl.pl LIBOBJ mangling (>=automake-1.16)])
844
845 TEST_FIND_AUTOMAKE([default 1.16 1.17 1.18 1.19],
846   [AS_VERSION_COMPARE(["$amver"], [1.16], [continue])])
847 TEST_LTDL_LIBOBJ_MANGLING
848
849 AT_CLEANUP