hurd: Add stubs for missing libc+tcc functions.
[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
45     if test $mes_kernel = gnu; then
46         libc_mini_shared_SOURCES="$libc_mini_shared_SOURCES
47 lib/gnu/_exit.c
48 lib/gnu/exec-startup-get-data.c
49 lib/gnu/fd-get.c
50 lib/gnu/fd-write.c
51 lib/gnu/io-write.c
52 lib/gnu/_write.c
53 lib/gnu/hurd-start.c
54 lib/gnu/proc-mark-exit.c
55 lib/gnu/syscall.c
56 lib/gnu/task-get-special-port.c
57 lib/gnu/task-terminate.c
58 lib/gnu/vm-statistics.c
59 lib/mach/mach-init.c
60 lib/mach/mach_host_self.S
61 lib/mach/mach_msg_trap.S
62 lib/mach/mach_reply_port.S
63 lib/mach/mach_task_self.S
64 lib/mach/mach_thread_self.S
65 lib/mach/msg.c
66 "
67     fi
68 fi
69
70 libc_mini_SOURCES="$libc_mini_shared_SOURCES"
71
72 if test $mes_libc = mes; then
73     libc_mini_SOURCES="$libc_mini_SOURCES
74 lib/mes/mini-write.c
75 "
76 fi
77
78 libmes_SOURCES="
79 $libc_mini_shared_SOURCES
80 lib/ctype/isnumber.c
81 lib/mes/abtol.c
82 lib/mes/div.c
83 lib/mes/eputc.c
84 lib/mes/fdgetc.c
85 lib/mes/fdputc.c
86 lib/mes/fdputs.c
87 lib/mes/fdungetc.c
88 lib/mes/itoa.c
89 lib/mes/ltoa.c
90 lib/mes/ltoab.c
91 lib/mes/mes_open.c
92 lib/mes/ntoab.c
93 lib/mes/oputc.c
94 lib/mes/ultoa.c
95 lib/mes/utoa.c
96 "
97
98 if test $mes_libc = mes; then
99     libmes_SOURCES="$libmes_SOURCES
100 lib/ctype/isdigit.c
101 lib/ctype/isspace.c
102 lib/ctype/isxdigit.c
103 lib/posix/write.c
104 lib/stdlib/atoi.c
105 "
106     if test $mes_kernel = gnu; then
107         libmes_SOURCES="$libmes_SOURCES
108 lib/stub/lseek.c
109 "
110     fi
111     if test $mes_kernel = linux; then
112         libmes_SOURCES="$libmes_SOURCES
113 lib/linux/lseek.c
114 "
115     fi
116 else
117     libmes_SOURCES="$libmes_SOURCES
118 lib/mes/abtod.c
119 lib/mes/dtoab.c
120 "
121 fi
122
123 libc_SOURCES="
124 $libmes_SOURCES
125 lib/mes/__assert_fail.c
126 lib/mes/__buffered_read.c
127 lib/mes/__mes_debug.c
128 lib/posix/execv.c
129 lib/posix/getcwd.c
130 lib/posix/getenv.c
131 lib/posix/isatty.c
132 lib/posix/open.c
133 lib/posix/buffered-read.c
134 lib/posix/setenv.c
135 lib/posix/wait.c
136 lib/stdio/fgetc.c
137 lib/stdio/fputc.c
138 lib/stdio/fputs.c
139 lib/stdio/getc.c
140 lib/stdio/getchar.c
141 lib/stdio/putc.c
142 lib/stdio/putchar.c
143 lib/stdio/ungetc.c
144 lib/stdlib/free.c
145 lib/stdlib/malloc.c
146 lib/stdlib/realloc.c
147 lib/string/memchr.c
148 lib/string/memcmp.c
149 lib/string/memcpy.c
150 lib/string/memmove.c
151 lib/string/memset.c
152 lib/string/strcmp.c
153 lib/string/strcpy.c
154 lib/string/strncmp.c
155 "
156
157 if test $mes_kernel = gnu; then
158     libc_SOURCES="$libc_SOURCES
159 lib/gnu/_read.c
160 lib/gnu/fd-read.c
161 lib/gnu/io-read.c
162 lib/stub/access.c
163 lib/stub/brk.c
164 lib/stub/chmod.c
165 lib/stub/clock_gettime.c
166 lib/stub/dup2.c
167 lib/stub/dup.c
168 lib/stub/execve.c
169 lib/stub/fork.c
170 lib/stub/_getcwd.c
171 lib/stub/gettimeofday.c
172 lib/stub/ioctl.c
173 lib/stub/_open3.c
174 lib/stub/time.c
175 lib/stub/unlink.c
176 lib/stub/waitpid.c
177 "
178 fi
179
180 if test $mes_kernel = linux; then
181     libc_SOURCES="$libc_SOURCES
182 lib/linux/access.c
183 lib/linux/brk.c
184 lib/linux/chmod.c
185 lib/linux/clock_gettime.c
186 lib/linux/dup.c
187 lib/linux/dup2.c
188 lib/linux/execve.c
189 lib/linux/fork.c
190 lib/linux/fsync.c
191 lib/linux/_getcwd.c
192 lib/linux/gettimeofday.c
193 lib/linux/ioctl.c
194 lib/linux/_open3.c
195 lib/linux/_read.c
196 lib/linux/time.c
197 lib/linux/unlink.c
198 lib/linux/waitpid.c
199 lib/linux/$mes_cpu-mes-$compiler/syscall.c
200 "
201 fi
202
203 libtcc1_SOURCES="
204 lib/libtcc1.c
205 "
206
207 libc_tcc_SOURCES="
208 $libc_SOURCES
209 lib/ctype/islower.c
210 lib/ctype/isupper.c
211 lib/ctype/tolower.c
212 lib/ctype/toupper.c
213 lib/mes/abtod.c
214 lib/mes/dtoab.c
215 lib/mes/search-path.c
216 lib/posix/execvp.c
217 lib/stdio/fclose.c
218 lib/stdio/fdopen.c
219 lib/stdio/ferror.c
220 lib/stdio/fflush.c
221 lib/stdio/fopen.c
222 lib/stdio/fprintf.c
223 lib/stdio/fread.c
224 lib/stdio/fseek.c
225 lib/stdio/ftell.c
226 lib/stdio/fwrite.c
227 lib/stdio/printf.c
228 lib/stdio/remove.c
229 lib/stdio/snprintf.c
230 lib/stdio/sprintf.c
231 lib/stdio/sscanf.c
232 lib/stdio/vfprintf.c
233 lib/stdio/vprintf.c
234 lib/stdio/vsnprintf.c
235 lib/stdio/vsprintf.c
236 lib/stdio/vsscanf.c
237 lib/stdlib/calloc.c
238 lib/stdlib/qsort.c
239 lib/stdlib/strtod.c
240 lib/stdlib/strtof.c
241 lib/stdlib/strtol.c
242 lib/stdlib/strtold.c
243 lib/stdlib/strtoll.c
244 lib/stdlib/strtoul.c
245 lib/stdlib/strtoull.c
246 lib/string/memmem.c
247 lib/string/strcat.c
248 lib/string/strchr.c
249 lib/string/strlwr.c
250 lib/string/strncpy.c
251 lib/string/strrchr.c
252 lib/string/strstr.c
253 lib/string/strupr.c
254 lib/stub/sigaction.c
255 lib/stub/ldexp.c
256 lib/stub/mprotect.c
257 lib/stub/localtime.c
258 lib/stub/sigemptyset.c
259 lib/$mes_cpu-mes-$compiler/setjmp.c
260 "
261
262 if test $mes_kernel = linux; then
263     libc_tcc_SOURCES="$libc_tcc_SOURCES
264 lib/linux/close.c
265 lib/linux/rmdir.c
266 lib/linux/stat.c
267 "
268 fi
269
270 if test $mes_kernel = gnu; then
271     libc_tcc_SOURCES="$libc_tcc_SOURCES
272 lib/stub/close.c
273 lib/stub/rmdir.c
274 lib/stub/stat.c
275 "
276 fi
277
278 libc_gnu_SOURCES="
279 $libc_tcc_SOURCES
280 lib/ctype/isalnum.c
281 lib/ctype/isalpha.c
282 lib/ctype/isascii.c
283 lib/ctype/iscntrl.c
284 lib/ctype/isgraph.c
285 lib/ctype/isprint.c
286 lib/ctype/ispunct.c
287 lib/dirent/__getdirentries.c
288 lib/dirent/closedir.c
289 lib/dirent/opendir.c
290 lib/dirent/readdir.c
291 lib/math/ceil.c
292 lib/math/fabs.c
293 lib/math/floor.c
294 lib/mes/fdgets.c
295 lib/posix/alarm.c
296 lib/posix/execl.c
297 lib/posix/execlp.c
298 lib/posix/mktemp.c
299 lib/posix/raise.c
300 lib/posix/sbrk.c
301 lib/posix/sleep.c
302 lib/posix/unsetenv.c
303 lib/stdio/clearerr.c
304 lib/stdio/feof.c
305 lib/stdio/fgets.c
306 lib/stdio/fileno.c
307 lib/stdio/freopen.c
308 lib/stdio/fscanf.c
309 lib/stdio/perror.c
310 lib/stdio/vfscanf.c
311 lib/stdlib/__exit.c
312 lib/stdlib/abort.c
313 lib/stdlib/abs.c
314 lib/stdlib/alloca.c
315 lib/stdlib/atexit.c
316 lib/stdlib/atof.c
317 lib/stdlib/atol.c
318 lib/stdlib/mbstowcs.c
319 lib/string/bcmp.c
320 lib/string/bcopy.c
321 lib/string/bzero.c
322 lib/string/index.c
323 lib/string/rindex.c
324 lib/string/strcspn.c
325 lib/string/strdup.c
326 lib/string/strerror.c
327 lib/string/strncat.c
328 lib/string/strpbrk.c
329 lib/string/strspn.c
330 lib/stub/__cleanup.c
331 lib/stub/atan2.c
332 lib/stub/bsearch.c
333 lib/stub/chown.c
334 lib/stub/cos.c
335 lib/stub/ctime.c
336 lib/stub/exp.c
337 lib/stub/fpurge.c
338 lib/stub/freadahead.c
339 lib/stub/frexp.c
340 lib/stub/getgrgid.c
341 lib/stub/getgrnam.c
342 lib/stub/getlogin.c
343 lib/stub/getpgid.c
344 lib/stub/getpgrp.c
345 lib/stub/getpwnam.c
346 lib/stub/getpwuid.c
347 lib/stub/gmtime.c
348 lib/stub/log.c
349 lib/stub/mktime.c
350 lib/stub/modf.c
351 lib/stub/pclose.c
352 lib/stub/popen.c
353 lib/stub/pow.c
354 lib/stub/rand.c
355 lib/stub/rewind.c
356 lib/stub/setbuf.c
357 lib/stub/setgrent.c
358 lib/stub/setlocale.c
359 lib/stub/setvbuf.c
360 lib/stub/sigaddset.c
361 lib/stub/sigblock.c
362 lib/stub/sigdelset.c
363 lib/stub/sigsetmask.c
364 lib/stub/sin.c
365 lib/stub/sqrt.c
366 lib/stub/strftime.c
367 lib/stub/sys_siglist.c
368 lib/stub/system.c
369 lib/stub/times.c
370 lib/stub/ttyname.c
371 lib/stub/umask.c
372 lib/stub/utime.c
373 "
374
375 if test $mes_kernel = linux; then
376     libc_gnu_SOURCES="$libc_gnu_SOURCES
377 lib/linux/chdir.c
378 lib/linux/fcntl.c
379 lib/linux/fstat.c
380 lib/linux/getdents.c
381 lib/linux/getegid.c
382 lib/linux/geteuid.c
383 lib/linux/getgid.c
384 lib/linux/getpid.c
385 lib/linux/getppid.c
386 lib/linux/getrusage.c
387 lib/linux/getuid.c
388 lib/linux/kill.c
389 lib/linux/link.c
390 lib/linux/lstat.c
391 lib/linux/mkdir.c
392 lib/linux/mknod.c
393 lib/linux/nanosleep.c
394 lib/linux/pipe.c
395 lib/linux/readlink.c
396 lib/linux/rename.c
397 lib/linux/setgid.c
398 lib/linux/settimer.c
399 lib/linux/setuid.c
400 lib/linux/signal.c
401 lib/linux/sigprogmask.c
402 lib/linux/symlink.c
403 "
404 fi
405
406 mes_SOURCES="
407 src/gc.c
408 src/hash.c
409 src/lib.c
410 src/math.c
411 src/mes.c
412 src/module.c
413 src/posix.c
414 src/reader.c
415 src/string.c
416 src/struct.c
417 src/vector.c
418 "