diff --git a/build-aux/build-mes.sh b/build-aux/build-mes.sh index 4699eec0..397fdc09 100755 --- a/build-aux/build-mes.sh +++ b/build-aux/build-mes.sh @@ -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) diff --git a/build-aux/build.sh.in b/build-aux/build.sh.in index 68727d30..d9704677 100644 --- a/build-aux/build.sh.in +++ b/build-aux/build.sh.in @@ -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 diff --git a/build-aux/cc.sh b/build-aux/cc.sh index 0d03235b..20d1ee07 100755 --- a/build-aux/cc.sh +++ b/build-aux/cc.sh @@ -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 } diff --git a/build-aux/config.make.in b/build-aux/config.make.in index caffe8d4..19ad218d 100644 --- a/build-aux/config.make.in +++ b/build-aux/config.make.in @@ -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@ diff --git a/build-aux/config.sh b/build-aux/config.sh index 75d1d42b..de59582b 100644 --- a/build-aux/config.sh +++ b/build-aux/config.sh @@ -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 diff --git a/build-aux/config.status.in b/build-aux/config.status.in index b7705007..cbe88d40 100644 --- a/build-aux/config.status.in +++ b/build-aux/config.status.in @@ -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@" diff --git a/build-aux/test.sh b/build-aux/test.sh index eb9bba14..55a4fed6 100755 --- a/build-aux/test.sh +++ b/build-aux/test.sh @@ -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 diff --git a/configure b/configure index 6615e5cc..520007d1 100755 --- a/configure +++ b/configure @@ -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) diff --git a/configure.sh b/configure.sh index 701eac05..a2798cef 100755 --- a/configure.sh +++ b/configure.sh @@ -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 diff --git a/include/libmes.h b/include/libmes.h index 5377b1db..e15a0e40 100644 --- a/include/libmes.h +++ b/include/libmes.h @@ -23,6 +23,11 @@ #include +#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); diff --git a/include/linux/x86_64/syscall.h b/include/linux/x86_64/syscall.h index 269546e2..5ad16fb8 100644 --- a/include/linux/x86_64/syscall.h +++ b/include/linux/x86_64/syscall.h @@ -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 diff --git a/lib/libmes.c b/lib/libmes.c index 0c32f3da..49974b67 100644 --- a/lib/libmes.c +++ b/lib/libmes.c @@ -41,7 +41,10 @@ #include #include -#if POSIX +#if WITH_GLIBC +#undef open +#include +#include // 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 #include -#endif // POSIX +#endif // WITH_GLIBC #include #include diff --git a/lib/tests/stdio/70-printf-hello.c b/lib/tests/stdio/70-printf-hello.c index 7169a334..f61246af 100644 --- a/lib/tests/stdio/70-printf-hello.c +++ b/lib/tests/stdio/70-printf-hello.c @@ -27,7 +27,7 @@ int main () { -#if __GNUC__ && __x86_64__ && !POSIX +#if __GNUC__ && __x86_64__ && !WITH_GLIBC return 0; #endif int i = 42; diff --git a/lib/tests/stdio/70-printf-simple.c b/lib/tests/stdio/70-printf-simple.c index b8a3a40e..02814bc0 100644 --- a/lib/tests/stdio/70-printf-simple.c +++ b/lib/tests/stdio/70-printf-simple.c @@ -27,7 +27,7 @@ int main () { -#if __GNUC__ && __x86_64__ && !POSIX +#if __GNUC__ && __x86_64__ && !WITH_GLIBC return 0; #endif char *s = "mes"; diff --git a/lib/tests/stdio/80-sscanf.c b/lib/tests/stdio/80-sscanf.c index 34313ecc..7691eba2 100644 --- a/lib/tests/stdio/80-sscanf.c +++ b/lib/tests/stdio/80-sscanf.c @@ -26,7 +26,7 @@ int main () { -#if __GNUC__ && __x86_64__ && !POSIX +#if __GNUC__ && __x86_64__ && !WITH_GLIBC return 0; #endif int i; diff --git a/lib/tests/stdlib/50-malloc.c b/lib/tests/stdlib/50-malloc.c index 4d022d1e..fd3cb8e3 100644 --- a/lib/tests/stdlib/50-malloc.c +++ b/lib/tests/stdlib/50-malloc.c @@ -18,8 +18,8 @@ * along with GNU Mes. If not, see . */ -#if POSIX -#error "POSIX not supported" +#if WITH_GLIBC +#error "WITH_GLIBC not supported" #endif #include diff --git a/module/mescc/preprocess.scm b/module/mescc/preprocess.scm index 0f6607e6..cb046013 100644 --- a/module/mescc/preprocess.scm +++ b/module/mescc/preprocess.scm @@ -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") diff --git a/scaffold/cons-mes.c b/scaffold/cons-mes.c index 09a06691..41b3506d 100644 --- a/scaffold/cons-mes.c +++ b/scaffold/cons-mes.c @@ -18,8 +18,8 @@ * along with GNU Mes. If not, see . */ -#if POSIX -#error "POSIX not supported" +#if WITH_GLIBC +#error "WITH_GLIBC not supported" #endif #include diff --git a/scaffold/lib/stdlib/malloc.c b/scaffold/lib/stdlib/malloc.c index 6491fd95..b3f26128 100644 --- a/scaffold/lib/stdlib/malloc.c +++ b/scaffold/lib/stdlib/malloc.c @@ -18,8 +18,8 @@ * along with GNU Mes. If not, see . */ -#if POSIX -#error "POSIX not supported" +#if WITH_GLIBC +#error "WITH_GLIBC not supported" #endif #include diff --git a/scaffold/micro-mes.c b/scaffold/micro-mes.c index 5b539bf6..4dda7a7c 100644 --- a/scaffold/micro-mes.c +++ b/scaffold/micro-mes.c @@ -18,8 +18,8 @@ * along with GNU Mes. If not, see . */ -#if POSIX -#error "POSIX not supported" +#if WITH_GLIBC +#error "WITH_GLIBC not supported" #endif #include diff --git a/scaffold/tests/61-array.c b/scaffold/tests/61-array.c index 18b62399..6f024ab6 100644 --- a/scaffold/tests/61-array.c +++ b/scaffold/tests/61-array.c @@ -26,7 +26,7 @@ char *env[] = {"foo", "bar", "baz", 0}; -#if 0//!POSIX +#if 0//!WITH_GLIBC #define getenv xgetenv char * diff --git a/scaffold/tiny-mes.c b/scaffold/tiny-mes.c index a7f6566e..32c92bd4 100644 --- a/scaffold/tiny-mes.c +++ b/scaffold/tiny-mes.c @@ -18,8 +18,8 @@ * along with GNU Mes. If not, see . */ -#if POSIX -#error "POSIX not supported" +#if WITH_GLIBC +#error "WITH_GLIBC not supported" #endif #include diff --git a/src/mes.c b/src/mes.c index be9133a0..fe31b968 100644 --- a/src/mes.c +++ b/src/mes.c @@ -27,7 +27,7 @@ #include //#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