tests: avoid a race in tail --retry testing
[coreutils.git] / build-aux / gen-lists-of-programs.sh
blobbf63ee30adf14002bfab15ce919cbe6c4048d4be
1 #!/bin/sh
2 # Generate lists of all coreutils programs, to be fed both to Autoconf
3 # and Automake, and with further distinctions about how and when these
4 # programs should be built. This is useful to avoid duplicating these
5 # list definitions among several files ('configure.ac' and
6 # 'src/local.mk' at least); such duplication had proved a source of
7 # inconsistencies and bugs in the past.
9 set -u
10 set -e
12 # These are the names of programs that are neither built nor installed
13 # by default. This list is *not* intended for programs like 'who',
14 # 'nice', 'chroot', etc., that are built only when certain requisite
15 # system features are detected.
16 # If you would like to install programs from this list anyway, say A and B,
17 # use "--enable-install-program=A,B" when invoking configure.
18 disabled_by_default_progs='
19 arch
20 hostname
23 # Programs that can be built only when certain requisite system
24 # features are detected at configure time.
25 build_if_possible_progs='
26 chroot
28 hostid
29 libstdbuf.so
30 nice
31 pinky
32 stdbuf
33 stty
34 uptime
35 users
36 who
39 # All the other programs, to be built by default, and that should
40 # be buildable without problems on any target system.
41 normal_progs='
43 base64
44 basename
45 cat
46 chcon
47 chgrp
48 chmod
49 chown
50 cksum
51 comm
53 csplit
54 cut
55 date
57 dir
58 dircolors
59 dirname
61 echo
62 env
63 expand
64 expr
65 factor
66 false
67 fmt
68 fold
69 ginstall
70 groups
71 head
73 join
74 kill
75 link
77 logname
79 md5sum
80 mkdir
81 mkfifo
82 mknod
83 mktemp
86 nproc
87 nohup
88 numfmt
90 paste
91 pathchk
93 printenv
94 printf
95 ptx
96 pwd
97 readlink
98 realpath
100 rmdir
101 runcon
103 sha1sum
104 sha224sum
105 sha256sum
106 sha384sum
107 sha512sum
108 shred
109 shuf
110 sleep
111 sort
112 split
113 stat
115 sync
117 tail
119 test
120 timeout
121 touch
123 true
124 truncate
125 tsort
127 uname
128 unexpand
129 uniq
130 unlink
131 vdir
133 whoami
137 me=`echo "$0" | sed 's,.*/,,'`
138 msg="Automatically generated by $me. DO NOT EDIT BY HAND!"
140 case $#,$1 in
141 1,--autoconf|1,--for-autoconf)
142 echo "dnl $msg"
143 for p in $normal_progs; do
144 test x"$p" = x"[" && p='@<:@'
145 echo "gl_ADD_PROG([optional_bin_progs], [$p])"
146 done
147 # Extra 'echo' to normalize whitespace.
148 echo "no_install_progs_default='`echo $disabled_by_default_progs`'"
149 sed 's/^ *//' <<END
150 # Given the name of a variable containing a space-separated
151 # list of install-by-default programs and the actual list of
152 # do-not-install-by-default programs, modify the former variable
153 # to reflect any "do-install" and "don't-install" requests.
154 # That is, add any program specified via --enable-install-program,
155 # and remove any program specified via --enable-no-install-program.
156 # Note how the second argument below is a literal, with ","
157 # separators. That is required due to the way the macro works,
158 # and since the corresponding ./configure option argument is
159 # comma-separated on input.
160 gl_INCLUDE_EXCLUDE_PROG([optional_bin_progs], [`\
161 echo $disabled_by_default_progs \
162 | sed 's/ /,/g'`])
165 1,--automake|1,--for-automake)
166 echo "## $msg"
167 progsdir=src
168 echo no_install__progs =
169 for p in $disabled_by_default_progs; do
170 echo no_install__progs += $progsdir/$p
171 done
172 echo build_if_possible__progs =
173 for p in $build_if_possible_progs; do
174 echo build_if_possible__progs += $progsdir/$p
175 done
176 echo default__progs =
177 for p in $normal_progs; do
178 echo default__progs += $progsdir/$p
179 done
182 echo "$0: invalid usage" >&2; exit 2
184 esac
186 exit 0