File: check-examples

package info (click to toggle)
gettext 0.23.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 168,104 kB
  • sloc: ansic: 532,579; sh: 68,252; perl: 28,011; makefile: 9,066; lisp: 3,184; yacc: 1,055; java: 615; cs: 589; cpp: 397; objc: 343; sed: 79; tcl: 63; xml: 40; pascal: 11; php: 7; awk: 7
file content (840 lines) | stat: -rwxr-xr-x 26,633 bytes parent folder | download | duplicates (2)
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
#!/bin/bash
# Script that checks against build infrastructure mistakes in the examples.

# Copyright (C) 2018, 2023 Free Software Foundation, Inc.
#
# This program 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 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.


# func_init sample
# sets environment variables for building and running the given sample.
func_init ()
{
  case "$1" in
    hello-objc-gnustep) . /usr/share/GNUstep/Makefiles/GNUstep.sh ;;
  esac
}


# func_autogen sample
# adds generated build infrastructure files to the given sample.
func_autogen ()
{
  case "$1" in
    hello-objc-gnustep)
      (func_init "$1"; cd "$1" && ./autogen.sh)
      ;;
    *)
      (cd "$1" && ./autogen.sh)
      ;;
  esac
}

# func_autoclean sample
# removes generated build infrastructure files from the given sample.
func_autoclean ()
{
  case "$1" in
    hello-objc-gnustep)
      (func_init "$1"; cd "$1" && ./autoclean.sh)
      ;;
    *)
      (cd "$1" && ./autoclean.sh)
      ;;
  esac
}

# func_configure sample [builddir]
# runs configure for the given sample, optionally in a VPATH build.
func_configure ()
{
  case "$1" in
    hello-objc-gnustep) ;;
    *)
      if test -n "$2"; then
        (cd "$1"
         mkdir "$2"
         (cd "$2" && ../configure)
        )
      else
        (cd "$1" && ./configure)
      fi
      ;;
  esac
}

# func_distclean sample [builddir]
# undoes the effects of func_configure sample [builddir].
func_distclean ()
{
  case "$1" in
    hello-objc-gnustep) ;;
    *)
      if test -n "$2"; then
        (cd "$1/$2" && make distclean)
      else
        (cd "$1" && make distclean)
      fi
      ;;
  esac
}

# func_maintainerclean sample [builddir]
# also removes files that are expensive to rebuild.
func_maintainerclean ()
{
  case "$1" in
    hello-objc-gnustep)
      (func_init "$1"; cd "$1" && make distclean)
      ;;
    *)
      if test -n "$2"; then
        (cd "$1/$2" && make maintainer-clean)
      else
        (cd "$1" && make maintainer-clean)
      fi
      ;;
  esac
}


# func_check_autoclean sample
# checks whether the autoclean.sh script is complete.
func_check_autoclean ()
{
  sample="$1"
  rm -rf "$sample.bak"
  cp -a "$sample" "$sample.bak"
  func_autogen "$sample"
  func_autoclean "$sample"
  LC_ALL=C diff -r -q "$sample.bak" "$sample" | sed -n -e 's/^Only in //p' | sed -e 's|: |/|' > "$sample.out"
  if ! test -s "$sample.out"; then
    rm -f "$sample.out"
  fi
  rm -rf "$sample.bak"
}

func_check_autoclean_all ()
{
  rm -f hello-*.out
  func_check_autoclean hello-c
  func_check_autoclean hello-c-gnome
  func_check_autoclean hello-c-gnome3
  func_check_autoclean hello-c++
  func_check_autoclean hello-c++20
  func_check_autoclean hello-c++-qt
  func_check_autoclean hello-c++-kde
  func_check_autoclean hello-c++-gnome
  func_check_autoclean hello-c++-wxwidgets
  func_check_autoclean hello-objc
  func_check_autoclean hello-objc-gnustep
  func_check_autoclean hello-objc-gnome
  func_check_autoclean hello-sh
  func_check_autoclean hello-python
  func_check_autoclean hello-clisp
  func_check_autoclean hello-librep
  func_check_autoclean hello-guile
  func_check_autoclean hello-smalltalk
  func_check_autoclean hello-java
  func_check_autoclean hello-java-awt
  func_check_autoclean hello-java-swing
  func_check_autoclean hello-java-qtjambi
  func_check_autoclean hello-csharp
  func_check_autoclean hello-csharp-forms
  func_check_autoclean hello-gawk
  func_check_autoclean hello-pascal
  func_check_autoclean hello-ycp
  func_check_autoclean hello-tcl
  func_check_autoclean hello-tcl-tk
  func_check_autoclean hello-perl
  func_check_autoclean hello-php
  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
    echo "*** func_check_autoclean error: Leftover files:"
    cat hello-*.out
    rm -f hello-*.out
    exit 1
  fi
}


# Known configure failures:
# hello-c-gnome: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install
# hello-c-gnome3: error: can't find gtk+-3.0 >= 3.10
# hello-c++-qt: error: cannot find correct Qt headers!
# hello-c++-kde: configure: error: Qt (>= Qt 3.1.0) (headers and libraries) not found. Please check your installation!
# hello-c++-gnome: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install
# hello-objc-gnome: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install
# hello-ycp: *** Essential program y2base not found

# func_check_distclean sample
# checks 'make distclean' directly after 'configure'.
func_check_distclean ()
{
  sample="$1"
  rm -rf "$sample.bak"
  func_autogen "$sample"
  cp -a "$sample" "$sample.bak"
  if func_configure "$sample" > "$sample.log" 2>&1; then
    rm -f "$sample.log"
    func_distclean "$sample"
    LC_ALL=C diff -r -q "$sample.bak" "$sample" | sed -n -e 's/^Only in //p' | sed -e 's|: |/|' > "$sample.out"
  fi
  func_autoclean "$sample"
  if ! test -s "$sample.out"; then
    rm -f "$sample.out"
  fi
  rm -rf "$sample.bak"
}

func_check_distclean_all ()
{
  rm -f hello-*.log hello-*.out
  func_check_distclean hello-c
 #func_check_distclean hello-c-gnome
 #func_check_distclean hello-c-gnome3
  func_check_distclean hello-c++
  func_check_distclean hello-c++20
 #func_check_distclean hello-c++-qt
 #func_check_distclean hello-c++-kde
 #func_check_distclean hello-c++-gnome
  func_check_distclean hello-c++-wxwidgets
  func_check_distclean hello-objc
  func_check_distclean hello-objc-gnustep
 #func_check_distclean hello-objc-gnome
  func_check_distclean hello-sh
  func_check_distclean hello-python
  func_check_distclean hello-clisp
  func_check_distclean hello-librep
  func_check_distclean hello-guile
  func_check_distclean hello-smalltalk
  func_check_distclean hello-java
  func_check_distclean hello-java-awt
  func_check_distclean hello-java-swing
  func_check_distclean hello-java-qtjambi
  func_check_distclean hello-csharp
  func_check_distclean hello-csharp-forms
  func_check_distclean hello-gawk
  func_check_distclean hello-pascal
 #func_check_distclean hello-ycp
  func_check_distclean hello-tcl
  func_check_distclean hello-tcl-tk
  func_check_distclean hello-perl
  func_check_distclean hello-php
  if (shopt -s failglob; echo hello-*.log) >/dev/null 2>/dev/null; then
    echo "*** func_check_distclean error: 'configure' failures"
    echo hello-*.log
    exit 1
  fi
  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
    echo "*** func_check_distclean error: incomplete 'make distclean'"
    echo hello-*.out
    exit 1
  fi
}


# Known make failures:
# hello-java-qtjambi: error: package com.trolltech.qt.core does not exist

# func_check_maintainerclean sample
# checks 'make distclean' after 'configure; make'.
func_check_maintainerclean ()
{
  sample="$1"
  rm -rf "$sample.bak"
  func_autogen "$sample"
  cp -a "$sample" "$sample.bak"
  if func_configure "$sample"; then
    if (func_init "$sample"; cd "$sample" && make) > "$sample.log" 2>&1; then
      rm -f "$sample.log"
    fi
  fi
  func_maintainerclean "$sample"
  # TODO: Remove .pot files workaround after next release.
  # TODO: Remove .po~ files workaround.
  LC_ALL=C diff -r -q "$sample.bak" "$sample" | sed -n -e 's/^Only in //p' | sed -e 's|: |/|' | grep "^${sample}/" | { if test -f "$sample"/po/Makevars || test "$sample" = hello-objc-gnustep; then grep -v '\.pot$'; else cat; fi; } | grep -v '\.po~$' > "$sample.out"
  func_autoclean "$sample"
  if ! test -s "$sample.out"; then
    rm -f "$sample.out"
  fi
  rm -rf "$sample.bak"
}

func_check_maintainerclean_all ()
{
  rm -f hello-*.log hello-*.out
  func_check_maintainerclean hello-c
 #func_check_maintainerclean hello-c-gnome
 #func_check_maintainerclean hello-c-gnome3
  func_check_maintainerclean hello-c++
  func_check_maintainerclean hello-c++20
 #func_check_maintainerclean hello-c++-qt
 #func_check_maintainerclean hello-c++-kde
 #func_check_maintainerclean hello-c++-gnome
  func_check_maintainerclean hello-c++-wxwidgets
  func_check_maintainerclean hello-objc
  func_check_maintainerclean hello-objc-gnustep
 #func_check_maintainerclean hello-objc-gnome
  func_check_maintainerclean hello-sh
  func_check_maintainerclean hello-python
  func_check_maintainerclean hello-clisp
  func_check_maintainerclean hello-librep
  func_check_maintainerclean hello-guile
  func_check_maintainerclean hello-smalltalk
  func_check_maintainerclean hello-java
  func_check_maintainerclean hello-java-awt
  func_check_maintainerclean hello-java-swing
 #func_check_maintainerclean hello-java-qtjambi
  func_check_maintainerclean hello-csharp
  func_check_maintainerclean hello-csharp-forms
  func_check_maintainerclean hello-gawk
  func_check_maintainerclean hello-pascal
 #func_check_maintainerclean hello-ycp
  func_check_maintainerclean hello-tcl
  func_check_maintainerclean hello-tcl-tk
  func_check_maintainerclean hello-perl
  func_check_maintainerclean hello-php
  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
    echo "*** func_check_maintainerclean error: 'make' failures"
    echo hello-*.log
    exit 1
  fi
  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
    echo "*** func_check_maintainerclean error: incomplete 'make maintainer-clean'"
    echo hello-*.out
    exit 1
  fi
}


# func_check_maintainerclean_vpath sample
# checks 'make distclean' after 'configure; make' with a VPATH build.
func_check_maintainerclean_vpath ()
{
  sample="$1"
  case "$sample" in
    hello-objc-gnustep) ;;
    *)
      rm -rf "$sample.bak"
      func_autogen "$sample"
      cp -a "$sample" "$sample.bak"
      if func_configure "$sample" build; then
        if (func_init "$sample"; cd "$sample"/build && make) > "$sample.log" 2>&1; then
          rm -f "$sample.log"
        fi
      fi
      func_maintainerclean "$sample" build
      # TODO: Remove .pot files workaround after next release.
      # TODO: Remove .po~ files workaround.
      find "$sample"/build -type f | LC_ALL=C sort | { if test -f "$sample"/po/Makevars; then grep -v '\.pot$'; else cat; fi; } | grep -v '\.po~$' > "$sample.out"
      rm -rf "$sample"/build
      func_autoclean "$sample"
      if ! test -s "$sample.out"; then
        rm -f "$sample.out"
      fi
      rm -rf "$sample.bak"
      ;;
  esac
}

func_check_maintainerclean_vpath_all ()
{
  rm -f hello-*.log hello-*.out
  func_check_maintainerclean_vpath hello-c
 #func_check_maintainerclean_vpath hello-c-gnome
 #func_check_maintainerclean_vpath hello-c-gnome3
  func_check_maintainerclean_vpath hello-c++
  func_check_maintainerclean_vpath hello-c++20
 #func_check_maintainerclean_vpath hello-c++-qt
 #func_check_maintainerclean_vpath hello-c++-kde
 #func_check_maintainerclean_vpath hello-c++-gnome
  func_check_maintainerclean_vpath hello-c++-wxwidgets
  func_check_maintainerclean_vpath hello-objc
  func_check_maintainerclean_vpath hello-objc-gnustep
 #func_check_maintainerclean_vpath hello-objc-gnome
  func_check_maintainerclean_vpath hello-sh
  func_check_maintainerclean_vpath hello-python
  func_check_maintainerclean_vpath hello-clisp
  func_check_maintainerclean_vpath hello-librep
  func_check_maintainerclean_vpath hello-guile
  func_check_maintainerclean_vpath hello-smalltalk
  func_check_maintainerclean_vpath hello-java
  func_check_maintainerclean_vpath hello-java-awt
  func_check_maintainerclean_vpath hello-java-swing
 #func_check_maintainerclean_vpath hello-java-qtjambi
  func_check_maintainerclean_vpath hello-csharp
  func_check_maintainerclean_vpath hello-csharp-forms
  func_check_maintainerclean_vpath hello-gawk
  func_check_maintainerclean_vpath hello-pascal
 #func_check_maintainerclean_vpath hello-ycp
  func_check_maintainerclean_vpath hello-tcl
  func_check_maintainerclean_vpath hello-tcl-tk
  func_check_maintainerclean_vpath hello-perl
  func_check_maintainerclean_vpath hello-php
  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
    echo "*** func_check_maintainerclean_vpath error: 'make' failures"
    echo hello-*.log
    exit 1
  fi
  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
    echo "*** func_check_maintainerclean_vpath error: incomplete 'make maintainer-clean'"
    echo hello-*.out
    exit 1
  fi
}


# func_check_dist sample
# checks 'make dist' after 'configure; make'.
func_check_dist ()
{
  sample="$1"
  case "$sample" in
    hello-objc-gnustep) ;;
    *)
      func_autogen "$sample"
      if func_configure "$sample"; then
        if (func_init "$sample"; cd "$sample" && make); then
          if (func_init "$sample"; cd "$sample" && make dist) > "$sample.log" 2>&1; then
            rm -f "$sample.log"
            (func_init "$sample"; cd "$sample" && make distclean)
            rm -f `find "$sample" -name '*~'` `find "$sample" -name '*.orig'`
            rm -rf "$sample/autom4te.cache"
            if test -f "$sample/$sample-0.tar.gz"; then
              (cd "$sample" && tar xfz "$sample-0.tar.gz")
              LC_ALL=C diff -r -q "$sample" "$sample/$sample-0" | grep -v "^Only in $sample: $sample-0$" | grep -v "^Only in $sample: $sample-0.tar.gz$" | grep -v "^Only in $sample: BUGS$" > "$sample.out"
            else
              echo "$sample-0.tar.gz was not created" > "$sample.out"
            fi
          fi
          rm -rf "$sample/$sample-0"
          rm -f "$sample/$sample-0.tar.gz"
        fi
      fi
      func_configure "$sample"
      func_maintainerclean "$sample"
      func_autoclean "$sample"
      if ! test -s "$sample.out"; then
        rm -f "$sample.out"
      fi
      ;;
  esac
}

func_check_dist_all ()
{
  rm -f hello-*.log hello-*.out
  func_check_dist hello-c
 #func_check_dist hello-c-gnome
 #func_check_dist hello-c-gnome3
  func_check_dist hello-c++
  func_check_dist hello-c++20
 #func_check_dist hello-c++-qt
 #func_check_dist hello-c++-kde
 #func_check_dist hello-c++-gnome
  func_check_dist hello-c++-wxwidgets
  func_check_dist hello-objc
  func_check_dist hello-objc-gnustep
 #func_check_dist hello-objc-gnome
  func_check_dist hello-sh
  func_check_dist hello-python
  func_check_dist hello-clisp
  func_check_dist hello-librep
  func_check_dist hello-guile
  func_check_dist hello-smalltalk
  func_check_dist hello-java
  func_check_dist hello-java-awt
  func_check_dist hello-java-swing
 #func_check_dist hello-java-qtjambi
  func_check_dist hello-csharp
  func_check_dist hello-csharp-forms
  func_check_dist hello-gawk
  func_check_dist hello-pascal
 #func_check_dist hello-ycp
  func_check_dist hello-tcl
  func_check_dist hello-tcl-tk
  func_check_dist hello-perl
  func_check_dist hello-php
  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
    echo "*** func_check_dist error: 'make dist' failures"
    echo hello-*.log
    exit 1
  fi
  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
    echo "*** func_check_dist error: tarball created by 'make dist' does not contain the expected files"
    echo hello-*.out
    exit 1
  fi
}


# func_check_dist_vpath sample
# checks 'make dist' after 'configure; make' with a VPATH build
func_check_dist_vpath ()
{
  sample="$1"
  case "$sample" in
    hello-objc-gnustep) ;;
    *)
      func_autogen "$sample"
      if func_configure "$sample" build; then
        if (func_init "$sample"; cd "$sample"/build && make); then
          if (func_init "$sample"; cd "$sample"/build && make dist) > "$sample.log" 2>&1; then
            rm -f "$sample.log"
            (func_init "$sample"; cd "$sample"/build && make distclean)
            rm -f `find "$sample" -name '*~'` `find "$sample" -name '*.orig'`
            rm -rf "$sample/autom4te.cache"
            if test -f "$sample/build/$sample-0.tar.gz"; then
              (cd "$sample"/build && tar xfz "$sample-0.tar.gz")
              # TODO: Remove stamp-po workaround after next release.
              LC_ALL=C diff -r -q "$sample" "$sample/build/$sample-0" | grep -v "^Only in $sample: build$" | grep -v "^Only in $sample: BUGS$" | { if test -f "$sample"/po/Makevars; then grep -v "^Only in $sample/build/$sample-0/po: stamp-po$"; else cat; fi; } > "$sample.out"
            else
              echo "$sample-0.tar.gz was not created" > "$sample.out"
            fi
          fi
          rm -rf "$sample/build/$sample-0"
          rm -f "$sample/build/$sample-0.tar.gz"
        fi
      fi
      rm -rf "$sample"/build
      func_autoclean "$sample"
      if ! test -s "$sample.out"; then
        rm -f "$sample.out"
      fi
      ;;
  esac
}

func_check_dist_vpath_all ()
{
  rm -f hello-*.log hello-*.out
  func_check_dist_vpath hello-c
 #func_check_dist_vpath hello-c-gnome
 #func_check_dist_vpath hello-c-gnome3
  func_check_dist_vpath hello-c++
  func_check_dist_vpath hello-c++20
 #func_check_dist_vpath hello-c++-qt
 #func_check_dist_vpath hello-c++-kde
 #func_check_dist_vpath hello-c++-gnome
  func_check_dist_vpath hello-c++-wxwidgets
  func_check_dist_vpath hello-objc
  func_check_dist_vpath hello-objc-gnustep
 #func_check_dist_vpath hello-objc-gnome
  func_check_dist_vpath hello-sh
  func_check_dist_vpath hello-python
  func_check_dist_vpath hello-clisp
  func_check_dist_vpath hello-librep
  func_check_dist_vpath hello-guile
  func_check_dist_vpath hello-smalltalk
  func_check_dist_vpath hello-java
  func_check_dist_vpath hello-java-awt
  func_check_dist_vpath hello-java-swing
 #func_check_dist_vpath hello-java-qtjambi
  func_check_dist_vpath hello-csharp
  func_check_dist_vpath hello-csharp-forms
  func_check_dist_vpath hello-gawk
  func_check_dist_vpath hello-pascal
 #func_check_dist_vpath hello-ycp
  func_check_dist_vpath hello-tcl
  func_check_dist_vpath hello-tcl-tk
  func_check_dist_vpath hello-perl
  func_check_dist_vpath hello-php
  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
    echo "*** func_check_dist_vpath error: 'make dist' failures"
    echo hello-*.log
    exit 1
  fi
  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
    echo "*** func_check_dist_vpath error: tarball created by 'make dist' does not contain the expected files"
    echo hello-*.out
    exit 1
  fi
}


# Base installation directory for all samples.
instdir=/tmp/gtexinst

# func_check_install sample
# checks 'make install' after 'configure; make'.
# You need to check afterwards whether the installed binaries work.
func_check_install ()
{
  sample="$1"
  case "$sample" in
    hello-objc-gnustep)
      # In this sample, you have to check the uninstalled binaries (see the INSTALL file).
      ;;
    *)
      func_autogen "$sample"
      if (cd "$sample" && ./configure --prefix="$instdir/$sample"); then
        if (func_init "$sample"; cd "$sample" && make); then
          if (func_init "$sample"; cd "$sample" && make install) > "$sample.log" 2>&1; then
            rm -f "$sample.log"
          fi
        fi
      fi
      func_maintainerclean "$sample"
      func_autoclean "$sample"
      ;;
  esac
}

func_check_install_all ()
{
  rm -f hello-*.log
  rm -rf "$instdir/hello-*"
  func_check_install hello-c
 #func_check_install hello-c-gnome
 #func_check_install hello-c-gnome3
  func_check_install hello-c++
  func_check_install hello-c++20
 #func_check_install hello-c++-qt
 #func_check_install hello-c++-kde
 #func_check_install hello-c++-gnome
  func_check_install hello-c++-wxwidgets
  func_check_install hello-objc
  func_check_install hello-objc-gnustep
 #func_check_install hello-objc-gnome
  func_check_install hello-sh
  func_check_install hello-python
  func_check_install hello-clisp
  func_check_install hello-librep
  func_check_install hello-guile
  func_check_install hello-smalltalk
  func_check_install hello-java
  func_check_install hello-java-awt
  func_check_install hello-java-swing
 #func_check_install hello-java-qtjambi
  func_check_install hello-csharp
  func_check_install hello-csharp-forms
  func_check_install hello-gawk
  func_check_install hello-pascal
 #func_check_install hello-ycp
  func_check_install hello-tcl
  func_check_install hello-tcl-tk
  func_check_install hello-perl
  func_check_install hello-php
  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
    echo "*** func_check_install error: 'make install' failures"
    echo hello-*.log
    exit 1
  fi
}


# func_check_uninstall sample
# checks 'make uninstall' after 'configure; make; make install'.
func_check_uninstall ()
{
  sample="$1"
  case "$sample" in
    hello-objc-gnustep)
      # In this sample, you have to check the uninstalled binaries (see the INSTALL file).
      ;;
    *)
      func_autogen "$sample"
      if (cd "$sample" && ./configure --prefix="$instdir/$sample"); then
        if (func_init "$sample"; cd "$sample" && make); then
          if (func_init "$sample"; cd "$sample" && make install); then
            if (func_init "$sample"; cd "$sample" && make uninstall) > "$sample.log" 2>&1; then
              rm -f "$sample.log"
              (cd "$instdir" && find "$sample" -type f | LC_ALL=C sort) > "$sample.out"
            fi
          fi
        fi
      fi
      func_maintainerclean "$sample"
      func_autoclean "$sample"
      if ! test -s "$sample.out"; then
        rm -f "$sample.out"
      fi
      ;;
  esac
}

func_check_uninstall_all ()
{
  rm -f hello-*.log hello-*.out
  rm -rf "$instdir/hello-*"
  func_check_uninstall hello-c
 #func_check_uninstall hello-c-gnome
 #func_check_uninstall hello-c-gnome3
  func_check_uninstall hello-c++
  func_check_uninstall hello-c++20
 #func_check_uninstall hello-c++-qt
 #func_check_uninstall hello-c++-kde
 #func_check_uninstall hello-c++-gnome
  func_check_uninstall hello-c++-wxwidgets
  func_check_uninstall hello-objc
  func_check_uninstall hello-objc-gnustep
 #func_check_uninstall hello-objc-gnome
  func_check_uninstall hello-sh
  func_check_uninstall hello-python
  func_check_uninstall hello-clisp
  func_check_uninstall hello-librep
  func_check_uninstall hello-guile
  func_check_uninstall hello-smalltalk
  func_check_uninstall hello-java
  func_check_uninstall hello-java-awt
  func_check_uninstall hello-java-swing
 #func_check_uninstall hello-java-qtjambi
  func_check_uninstall hello-csharp
  func_check_uninstall hello-csharp-forms
  func_check_uninstall hello-gawk
  func_check_uninstall hello-pascal
 #func_check_uninstall hello-ycp
  func_check_uninstall hello-tcl
  func_check_uninstall hello-tcl-tk
  func_check_uninstall hello-perl
  func_check_uninstall hello-php
  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
    echo "*** func_check_uninstall error: 'make uninstall' failures"
    echo hello-*.log
    exit 1
  fi
  if (shopt -s failglob; echo hello-*.out) >/dev/null 2>/dev/null; then
    echo "*** func_check_uninstall error: left-over files"
    echo hello-*.out
    exit 1
  fi
}


# func_check_distcheck sample
# checks 'make distcheck' after 'configure; make'.
func_check_distcheck ()
{
  sample="$1"
  case "$sample" in
    hello-objc-gnustep) ;;
    *)
      func_autogen "$sample"
      if func_configure "$sample"; then
        if (func_init "$sample"; cd "$sample" && make); then
          if (func_init "$sample"; cd "$sample" && make distcheck) > "$sample.log" 2>&1; then
            rm -f "$sample.log"
          fi
          if test -d "$sample/$sample-0"; then chmod -R u+w "$sample/$sample-0"; fi
          rm -rf "$sample/$sample-0"
          rm -f "$sample/$sample-0.tar.gz"
        fi
      fi
      func_maintainerclean "$sample"
      func_autoclean "$sample"
      if ! test -s "$sample.out"; then
        rm -f "$sample.out"
      fi
      ;;
  esac
}

func_check_distcheck_all ()
{
  rm -f hello-*.log
  func_check_distcheck hello-c
 #func_check_distcheck hello-c-gnome
 #func_check_distcheck hello-c-gnome3
  func_check_distcheck hello-c++
  func_check_distcheck hello-c++20
 #func_check_distcheck hello-c++-qt
 #func_check_distcheck hello-c++-kde
 #func_check_distcheck hello-c++-gnome
  func_check_distcheck hello-c++-wxwidgets
  func_check_distcheck hello-objc
  func_check_distcheck hello-objc-gnustep
 #func_check_distcheck hello-objc-gnome
  func_check_distcheck hello-sh
  func_check_distcheck hello-python
  func_check_distcheck hello-clisp
  func_check_distcheck hello-librep
  func_check_distcheck hello-guile
  func_check_distcheck hello-smalltalk
  func_check_distcheck hello-java
  func_check_distcheck hello-java-awt
  func_check_distcheck hello-java-swing
 #func_check_distcheck hello-java-qtjambi
  func_check_distcheck hello-csharp
  func_check_distcheck hello-csharp-forms
  func_check_distcheck hello-gawk
  func_check_distcheck hello-pascal
 #func_check_distcheck hello-ycp
  func_check_distcheck hello-tcl
  func_check_distcheck hello-tcl-tk
  func_check_distcheck hello-perl
  func_check_distcheck hello-php
  if (shopt -s failglob; echo hello-*log) >/dev/null 2>/dev/null; then
    echo "*** func_check_distcheck error: 'make distcheck' failures"
    echo hello-*.log
    exit 1
  fi
}


# If you want to extend this script:

# A dummy check function.
func_check ()
{
  :
}

# Complete list of samples.
func_check_all ()
{
  func_check hello-c
  func_check hello-c-gnome
  func_check hello-c-gnome3
  func_check hello-c++
  func_check hello-c++20
  func_check hello-c++-qt
  func_check hello-c++-kde
  func_check hello-c++-gnome
  func_check hello-c++-wxwidgets
  func_check hello-objc
  func_check hello-objc-gnustep
  func_check hello-objc-gnome
  func_check hello-sh
  func_check hello-python
  func_check hello-clisp
  func_check hello-librep
  func_check hello-guile
  func_check hello-smalltalk
  func_check hello-java
  func_check hello-java-awt
  func_check hello-java-swing
  func_check hello-java-qtjambi
  func_check hello-csharp
  func_check hello-csharp-forms
  func_check hello-gawk
  func_check hello-pascal
  func_check hello-ycp
  func_check hello-tcl
  func_check hello-tcl-tk
  func_check hello-perl
  func_check hello-php
}


# Top-level code.

func_check_autoclean_all
func_check_distclean_all
func_check_maintainerclean_all
func_check_maintainerclean_vpath_all
func_check_dist_all
func_check_dist_vpath_all
func_check_install_all
func_check_uninstall_all
func_check_distcheck_all