mescc: Mes C Library: Have write behave well with buffered reads.
[mes.git] / build-aux / configure-lib.sh
1 #! /bin/sh
2
3 # GNU Mes --- Maxwell Equations of Software
4 # Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
5 #
6 # This file is part of GNU Mes.
7 #
8 # GNU Mes is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or (at
11 # your option) any later version.
12 #
13 # GNU Mes is distributed in the hope that it will be useful, but
14 # 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 Mes.  If not, see <http://www.gnu.org/licenses/>.
20
21 set -e
22 set -u
23
24 V=${V-1}
25
26 if [ "$V" = 2 ]; then
27     set -x
28 fi
29
30 . ./config.sh
31
32 libc_mini_shared_SOURCES="
33 lib/mes/eputs.c
34 lib/mes/oputs.c
35 "
36
37 if test $mes_libc = mes; then
38     libc_mini_shared_SOURCES="$libc_mini_shared_SOURCES
39 lib/$mes_kernel/$mes_cpu-mes-$compiler/mini.c
40 lib/stdlib/exit.c
41 lib/stdlib/puts.c
42 lib/string/strlen.c
43 "
44 fi
45
46 libc_mini_SOURCES="$libc_mini_shared_SOURCES"
47
48 if test $mes_libc = mes; then
49     libc_mini_SOURCES="$libc_mini_SOURCES
50 lib/mes/write.c
51 "
52 fi
53
54 libmes_SOURCES="
55 $libc_mini_shared_SOURCES
56 lib/ctype/isnumber.c
57 lib/mes/abtol.c
58 lib/mes/eputc.c
59 lib/mes/fdgetc.c
60 lib/mes/fdputc.c
61 lib/mes/fdputs.c
62 lib/mes/fdungetc.c
63 lib/mes/itoa.c
64 lib/mes/ltoa.c
65 lib/mes/ltoab.c
66 lib/mes/mes_open.c
67 lib/mes/ntoab.c
68 lib/mes/oputc.c
69 lib/mes/ultoa.c
70 lib/mes/utoa.c
71 "
72
73 if test $mes_libc = mes; then
74     libmes_SOURCES="$libmes_SOURCES
75 lib/ctype/isdigit.c
76 lib/ctype/isspace.c
77 lib/ctype/isxdigit.c
78 lib/posix/write.c
79 lib/stdlib/atoi.c
80 "
81     if test $mes_kernel = linux; then
82         libmes_SOURCES="$libmes_SOURCES
83 lib/linux/lseek.c
84 "
85     fi
86 else
87     libmes_SOURCES="$libmes_SOURCES
88 "
89 fi
90
91 libc_SOURCES="
92 $libmes_SOURCES
93 lib/mes/__assert_fail.c
94 lib/mes/__buffered_read.c
95 lib/mes/__mes_debug.c
96 lib/posix/execv.c
97 lib/posix/getcwd.c
98 lib/posix/getenv.c
99 lib/posix/isatty.c
100 lib/posix/open.c
101 lib/posix/read.c
102 lib/posix/setenv.c
103 lib/posix/wait.c
104 lib/stdio/fgetc.c
105 lib/stdio/fputc.c
106 lib/stdio/fputs.c
107 lib/stdio/getc.c
108 lib/stdio/getchar.c
109 lib/stdio/putc.c
110 lib/stdio/putchar.c
111 lib/stdio/ungetc.c
112 lib/stdlib/free.c
113 lib/stdlib/malloc.c
114 lib/stdlib/realloc.c
115 lib/string/memchr.c
116 lib/string/memcmp.c
117 lib/string/memcpy.c
118 lib/string/memmove.c
119 lib/string/memset.c
120 lib/string/strcmp.c
121 lib/string/strcpy.c
122 lib/string/strncmp.c
123 "
124
125 if test $mes_kernel = linux; then
126     libc_SOURCES="$libc_SOURCES
127 lib/linux/access.c
128 lib/linux/brk.c
129 lib/linux/chmod.c
130 lib/linux/clock_gettime.c
131 lib/linux/dup.c
132 lib/linux/dup2.c
133 lib/linux/execve.c
134 lib/linux/fork.c
135 lib/linux/fsync.c
136 lib/linux/_getcwd.c
137 lib/linux/gettimeofday.c
138 lib/linux/ioctl.c
139 lib/linux/_open3.c
140 lib/linux/_read.c
141 lib/linux/time.c
142 lib/linux/unlink.c
143 lib/linux/waitpid.c
144 lib/linux/$mes_cpu-mes-$compiler/syscall.c
145 "
146 fi
147
148 libtcc1_SOURCES="
149 lib/libtcc1.c
150 "
151
152 libc_tcc_SOURCES="
153 $libc_SOURCES
154 lib/ctype/islower.c
155 lib/ctype/isupper.c
156 lib/ctype/tolower.c
157 lib/ctype/toupper.c
158 lib/mes/search-path.c
159 lib/posix/execvp.c
160 lib/stdio/fclose.c
161 lib/stdio/fdopen.c
162 lib/stdio/ferror.c
163 lib/stdio/fflush.c
164 lib/stdio/fopen.c
165 lib/stdio/fprintf.c
166 lib/stdio/fread.c
167 lib/stdio/fseek.c
168 lib/stdio/ftell.c
169 lib/stdio/fwrite.c
170 lib/stdio/printf.c
171 lib/stdio/remove.c
172 lib/stdio/snprintf.c
173 lib/stdio/sprintf.c
174 lib/stdio/sscanf.c
175 lib/stdio/vfprintf.c
176 lib/stdio/vprintf.c
177 lib/stdio/vsnprintf.c
178 lib/stdio/vsprintf.c
179 lib/stdio/vsscanf.c
180 lib/stdlib/calloc.c
181 lib/stdlib/qsort.c
182 lib/stdlib/strtof.c
183 lib/stdlib/strtol.c
184 lib/stdlib/strtold.c
185 lib/stdlib/strtoll.c
186 lib/stdlib/strtoul.c
187 lib/stdlib/strtoull.c
188 lib/string/memmem.c
189 lib/string/strcat.c
190 lib/string/strchr.c
191 lib/string/strlwr.c
192 lib/string/strncpy.c
193 lib/string/strrchr.c
194 lib/string/strstr.c
195 lib/string/strupr.c
196 lib/stub/sigaction.c
197 lib/stub/ldexp.c
198 lib/stub/mprotect.c
199 lib/stub/localtime.c
200 lib/stub/sigemptyset.c
201 lib/stub/strtod.c
202 lib/$mes_cpu-mes-$compiler/setjmp.c
203 "
204
205 if test $mes_kernel = linux; then
206     libc_tcc_SOURCES="$libc_tcc_SOURCES
207 lib/linux/close.c
208 lib/linux/rmdir.c
209 lib/linux/stat.c
210 "
211 fi
212
213 libc_gnu_SOURCES="
214 $libc_tcc_SOURCES
215 lib/ctype/isalnum.c
216 lib/ctype/isalpha.c
217 lib/ctype/isascii.c
218 lib/ctype/iscntrl.c
219 lib/ctype/isprint.c
220 lib/ctype/ispunct.c
221 lib/dirent/__getdirentries.c
222 lib/dirent/closedir.c
223 lib/dirent/opendir.c
224 lib/dirent/readdir.c
225 lib/math/fabs.c
226 lib/mes/fdgets.c
227 lib/posix/alarm.c
228 lib/posix/execl.c
229 lib/posix/mktemp.c
230 lib/posix/raise.c
231 lib/posix/sbrk.c
232 lib/posix/sleep.c
233 lib/posix/unsetenv.c
234 lib/stdio/clearerr.c
235 lib/stdio/feof.c
236 lib/stdio/fgets.c
237 lib/stdio/fileno.c
238 lib/stdio/freopen.c
239 lib/stdio/perror.c
240 lib/stdlib/__exit.c
241 lib/stdlib/abort.c
242 lib/stdlib/abs.c
243 lib/stdlib/alloca.c
244 lib/stdlib/atexit.c
245 lib/stdlib/atol.c
246 lib/stdlib/mbstowcs.c
247 lib/string/bcmp.c
248 lib/string/bcopy.c
249 lib/string/bzero.c
250 lib/string/index.c
251 lib/string/rindex.c
252 lib/string/strcspn.c
253 lib/string/strdup.c
254 lib/string/strerror.c
255 lib/string/strncat.c
256 lib/string/strpbrk.c
257 lib/string/strspn.c
258 lib/stub/__cleanup.c
259 lib/stub/bsearch.c
260 lib/stub/chown.c
261 lib/stub/ctime.c
262 lib/stub/fpurge.c
263 lib/stub/freadahead.c
264 lib/stub/frexp.c
265 lib/stub/getlogin.c
266 lib/stub/getpwnam.c
267 lib/stub/getpwuid.c
268 lib/stub/gmtime.c
269 lib/stub/pclose.c
270 lib/stub/popen.c
271 lib/stub/rand.c
272 lib/stub/setbuf.c
273 lib/stub/setlocale.c
274 lib/stub/setvbuf.c
275 lib/stub/sigaddset.c
276 lib/stub/sigblock.c
277 lib/stub/sigdelset.c
278 lib/stub/sigsetmask.c
279 lib/stub/strftime.c
280 lib/stub/sys_siglist.c
281 lib/stub/system.c
282 lib/stub/times.c
283 lib/stub/ttyname.c
284 lib/stub/umask.c
285 lib/stub/utime.c
286 "
287
288 if test $mes_kernel = linux; then
289     libc_gnu_SOURCES="$libc_gnu_SOURCES
290 lib/linux/chdir.c
291 lib/linux/fcntl.c
292 lib/linux/fstat.c
293 lib/linux/getdents.c
294 lib/linux/getegid.c
295 lib/linux/geteuid.c
296 lib/linux/getgid.c
297 lib/linux/getpid.c
298 lib/linux/getppid.c
299 lib/linux/getrusage.c
300 lib/linux/getuid.c
301 lib/linux/kill.c
302 lib/linux/link.c
303 lib/linux/lstat.c
304 lib/linux/mkdir.c
305 lib/linux/nanosleep.c
306 lib/linux/pipe.c
307 lib/linux/rename.c
308 lib/linux/setgid.c
309 lib/linux/settimer.c
310 lib/linux/setuid.c
311 lib/linux/signal.c
312 lib/linux/sigprogmask.c
313 "
314 fi
315
316 mes_SOURCES="
317 src/gc.c
318 src/hash.c
319 src/lib.c
320 src/math.c
321 src/mes.c
322 src/module.c
323 src/posix.c
324 src/reader.c
325 src/string.c
326 src/struct.c
327 src/vector.c
328 "