build: Replace POSIX, posix_p by WITH_GLIBC, wip_glibc_p.

* build-aux/build-mes.sh: Replace POSIX, posix_p by WITH_GLIBC, wip_glibc_p.
* build-aux/build.sh.in: Likewise.
* build-aux/cc.sh (link): Likewise.
* build-aux/config.make.in (with_glibc_p): Likewise.
* build-aux/config.sh (libc): Likewise.
(CPPFLAGS): Likewise.
* build-aux/config.status.in (with_glibc_p): Likewise.
* build-aux/test.sh: Likewise.
* configure (main): Likewise.
* configure.sh (subst): Likewise.
(mes_arch): Likewise.
* include/libmes.h: Likewise.
* include/linux/x86_64/syscall.h: Likewise.
* lib/libmes.c: Likewise.
* lib/tests/stdio/70-printf-hello.c (main): Likewise.
* lib/tests/stdio/70-printf-simple.c (main): Likewise.
* lib/tests/stdio/80-sscanf.c (main): Likewise.
* lib/tests/stdlib/50-malloc.c: Likewise.
* module/mescc/preprocess.scm (c99-input->full-ast): Likewise.
* scaffold/cons-mes.c: Likewise.
* scaffold/lib/stdlib/malloc.c: Likewise.
* scaffold/micro-mes.c: Likewise.
* scaffold/tests/61-array.c (getenv): Likewise.
* scaffold/tiny-mes.c: Likewise.
* src/mes.c: Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2019-03-23 21:44:00 +01:00
parent 66019c8421
commit 48a0bf181d
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
23 changed files with 38 additions and 30 deletions

View file

@ -32,7 +32,7 @@ fi
[ "$mes_p" -a ! "$gcc_p" ] && cp -f lib/linux/$mes_arch/crt1.S lib/$mes_arch/crt1.S
[ "$mes_p" -a ! "$gcc_p" ] && cp -f lib/linux/$mes_arch/crt1.o lib/$mes_arch/crt1.o
[ ! "$mesc_p" -a ! "$posix_p" ] && (program_prefix= compile lib/linux/$mes_arch/crt0)
[ ! "$mesc_p" -a ! "$with_glibc_p" ] && (program_prefix= compile lib/linux/$mes_arch/crt0)
[ "$mes_p" -a "$gcc_p" ] && (program_prefix= compile lib/linux/$mes_arch/crti)
[ "$mes_p" -a "$gcc_p" ] && (program_prefix= compile lib/linux/$mes_arch/crtn)

View file

@ -34,7 +34,7 @@ elif [ -d "$MES_SEED" ]; then
fi
## FIXME: remove this and have user configure/build/install for each compiler?
unset CFLAGS CPPFLAGS LDFLAGS gcc_p tcc_p posix_p
unset CFLAGS CPPFLAGS LDFLAGS gcc_p tcc_p with_glibc_p
MES=guile
mesc_p=1
mes_p=1

View file

@ -41,7 +41,7 @@ archive () {
link () {
lib=$libc
[ "$posix_p" ] && lib='-l mes'
[ "$with_glibc_p" ] && lib='-l mes'
out=$(dirname "$1")/${program_prefix}$(basename "$1")
trace "CCLD $1" $CC $CFLAGS $LDFLAGS -o" $out" $crt1 "$1".${program_prefix}o $2 $lib
}

View file

@ -64,7 +64,7 @@ infodir:=@infodir@
libdir:=@libdir@
mandir:=@mandir@
moduledir:=@moduledir@
posix_p:=@posix_p@
with_glibc_p:=@with_glibc_p@
program_prefix:=@program_prefix@
srcdest:=@srcdest@
srcdir:=@srcdir@

View file

@ -81,7 +81,7 @@ export mes_p
export mesc_p
export tcc_p
export mes_arch
export posix_p
export with_glibc_p
CPPFLAGS=${CPPFLAGS-"
-D 'VERSION=\"$VERSION\"'
@ -92,7 +92,7 @@ CPPFLAGS=${CPPFLAGS-"
-I ${srcdest}include
"}
[ "$posix_p" ] && CPPFLAGS="$CPPFLAGS -D POSIX=1 -D WITH_GLIBC=1"
[ "$with_glibc_p" ] && CPPFLAGS="$CPPFLAGS -D WITH_GLIBC=1"
LDFLAGS=${LDFLAGS-"
-v

View file

@ -64,7 +64,7 @@ infodir="@infodir@"
libdir="@libdir@"
mandir="@mandir@"
moduledir="@moduledir@"
posix_p="@posix_p@"
with_glibc_p="@with_glibc_p@"
program_prefix="@program_prefix@"
srcdest="@srcdest@"
srcdir="@srcdir@"

View file

@ -26,7 +26,7 @@ sh ${srcdest}build-aux/test-cc.sh $1
if [ ! "$mesc_p" ]; then
#FIXME: c&p
unset CFLAGS CPPFLAGS LDFLAGS gcc_p tcc_p posix_p
unset CFLAGS CPPFLAGS LDFLAGS gcc_p tcc_p with_glibc_p
MES=${MES-guile}
mesc_p=1
mes_p=1

2
configure vendored
View file

@ -533,7 +533,7 @@ Some influential environment variables:
("@mes_arch@" . ,mes-arch)
("@mes_p@" . ,(if mes? "1" ""))
("@mesc_p@" . ,(if mesc? "1" ""))
("@posix_p@" . ,(if posix? "1" ""))
("@with_glibc_p@" . ,(if posix? "1" ""))
("@tcc_p@" . ,(if tcc? "1" ""))
("@abs_top_srcdir@" . ,abs-top-srcdir)

View file

@ -111,7 +111,7 @@ subst () {
-e s,"@mesc_p@,$mesc_p,"\
-e s,"@tcc_p@,$tcc_p,"\
-e s,"@mes_arch@,$mes_arch,"\
-e s,"@posix_p@,$posix_p,"\
-e s,"@with_glibc_p@,$with_glibc_p,"\
-e s,"@abs_top_srcdir@,$abs_top_srcdir,"\
-e s,"@abs_top_builddir@,$abs_top_builddir,"\
-e s,"@top_builddir@,$top_builddir,"\
@ -195,7 +195,7 @@ if [ ! "$mesc_p" ]; then
mes_arch=$mes_arch-$compiler
fi
if [ ! "$mesc_p" -a ! "$mes_p" ]; then
posix_p=1
with_glibc_p=1
fi
subst ${srcdest}mes/module/mes/boot-0.scm.in mes/module/mes/boot-0.scm

View file

@ -23,6 +23,11 @@
#include <libmes-mini.h>
#if WITH_GLIBC
int mes_open (char const *file_name, int flags, ...);
#define open mes_open
#endif
int __mes_debug ();
void __ungetc_init ();
void __ungetc_clear (int filedes);

View file

@ -77,7 +77,7 @@
#define SYS_getegid 0x6c
#define SYS_getppid 0x6e
// make+POSIX
// make+WITH_GLIBC
#define SYS_rt_sigprocmask 0x0e
#endif // __MES_LINUX_X86_64_SYSCALL_H

View file

@ -41,7 +41,10 @@
#include <mes/fdputs.c>
#include <mes/fdungetc.c>
#if POSIX
#if WITH_GLIBC
#undef open
#include <fcntl.h>
#include <stdarg.h>
// The Mes C Library defines and initializes these in crt1
int __stdin = STDIN;
int __stdout = STDOUT;
@ -63,7 +66,7 @@ mes_open (char const *file_name, int flags, ...)
#include <mes/eputs.c>
#include <mes/oputs.c>
#endif // POSIX
#endif // WITH_GLIBC
#include <mes/eputc.c>
#include <mes/oputc.c>

View file

@ -27,7 +27,7 @@
int
main ()
{
#if __GNUC__ && __x86_64__ && !POSIX
#if __GNUC__ && __x86_64__ && !WITH_GLIBC
return 0;
#endif
int i = 42;

View file

@ -27,7 +27,7 @@
int
main ()
{
#if __GNUC__ && __x86_64__ && !POSIX
#if __GNUC__ && __x86_64__ && !WITH_GLIBC
return 0;
#endif
char *s = "mes";

View file

@ -26,7 +26,7 @@
int
main ()
{
#if __GNUC__ && __x86_64__ && !POSIX
#if __GNUC__ && __x86_64__ && !WITH_GLIBC
return 0;
#endif
int i;

View file

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if POSIX
#error "POSIX not supported"
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#endif
#include <libmes.h>

View file

@ -84,8 +84,8 @@
#:cpp-defs `(
"NULL=0"
"__linux__=1"
"POSIX=0"
"_POSIX_SOURCE=0"
"WITH_GLIBC=0"
"__STDC__=1"
"__MESC__=1"
,(if mes? "__MESC_MES__=1" "__MESC_MES__=0")

View file

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if POSIX
#error "POSIX not supported"
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#endif
#include <stdio.h>

View file

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if POSIX
#error "POSIX not supported"
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#endif
#include <libmes.h>

View file

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if POSIX
#error "POSIX not supported"
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#endif
#include <stdio.h>

View file

@ -26,7 +26,7 @@
char *env[] = {"foo", "bar", "baz", 0};
#if 0//!POSIX
#if 0//!WITH_GLIBC
#define getenv xgetenv
char *

View file

@ -18,8 +18,8 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/
#if POSIX
#error "POSIX not supported"
#if WITH_GLIBC
#error "WITH_GLIBC not supported"
#endif
#include <libmes.h>

View file

@ -27,7 +27,7 @@
#include <libmes.h>
//#define MES_MINI 1
#if POSIX
#if WITH_GLIBC
long ARENA_SIZE = 100000000; // 2.3GiB
#else
long ARENA_SIZE = 300000; // 32b: 3MiB, 64b: 6 MiB