build: Replace POSIX, posix_p by WITH_GLIBC, wip_glibc_p.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 23 Mar 2019 20:44:00 +0000 (21:44 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 23 Mar 2019 20:44:00 +0000 (21:44 +0100)
* 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.

23 files changed:
build-aux/build-mes.sh
build-aux/build.sh.in
build-aux/cc.sh
build-aux/config.make.in
build-aux/config.sh
build-aux/config.status.in
build-aux/test.sh
configure
configure.sh
include/libmes.h
include/linux/x86_64/syscall.h
lib/libmes.c
lib/tests/stdio/70-printf-hello.c
lib/tests/stdio/70-printf-simple.c
lib/tests/stdio/80-sscanf.c
lib/tests/stdlib/50-malloc.c
module/mescc/preprocess.scm
scaffold/cons-mes.c
scaffold/lib/stdlib/malloc.c
scaffold/micro-mes.c
scaffold/tests/61-array.c
scaffold/tiny-mes.c
src/mes.c

index 4699eec06bf766871e877430441bf532590a4fb1..397fdc098dfe5c9f1df0225d7507c1297175510f 100755 (executable)
@@ -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)
 
index 68727d30972d82835300880db74f0aeda69f7769..d9704677e9fe226130834fc2616e4645c7e038f0 100644 (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
index 0d03235b698c7844a853ae5bce6daa10b13690e5..20d1ee077789a8bfc1a30a46d5a71c0b4edd1463 100755 (executable)
@@ -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
 }
index caffe8d42f8d61ed6ce218898e2d0c5962e14bb0..19ad218d2ec2b309a866b6edd33331d560d05c83 100644 (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@
index 75d1d42b0fa40c17033e23807a5d339fa0b736af..de59582b224e35541e7be7994e5861fe617754ab 100644 (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
index b77050075bbda55c3fb75fd336985c8b62a9cd60..cbe88d404543237fc89f3b1f93a8c2c6bdedc21b 100644 (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@"
index eb9bba1467c6d1fa3e00e796c7b42f2ee900e931..55a4fed6471502bc405390f036f4aaebfa3089c2 100755 (executable)
@@ -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
index 6615e5cc1b5ad445451067ec7567675ae24bfed4..520007d1a31933f33717f39b4b80c63357f70a3a 100755 (executable)
--- 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)
index 701eac059a853301bc66d36410c27fbb19eda259..a2798cef8f57472b26f4661b203027abeb3d97eb 100755 (executable)
@@ -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
index 5377b1db79254a014aa0d0ec056b5607c46297cb..e15a0e40deec220815e63eb621ad6b61946a3e76 100644 (file)
 
 #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);
index 269546e2a466ba477f8a6af5e293adeda6b1a6c6..5ad16fb854f1e4aea11d15127dff689377caecc9 100644 (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
index 0c32f3da9f15d5a874c5ae0bcfaf8f10d1dd38b5..49974b675e7df2d96372cf258922632a76a655c6 100644 (file)
 #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>
index 7169a3346c1c1366d21b5fcd9667d81a0a3a88ff..f61246aface07abdcef568a408d0aab50ceb86f3 100644 (file)
@@ -27,7 +27,7 @@
 int
 main ()
 {
-#if __GNUC__ && __x86_64__ && !POSIX
+#if __GNUC__ && __x86_64__ && !WITH_GLIBC
   return 0;
 #endif
   int i = 42;
index b8a3a40e175fbc1cb5211d5eb2d4ea4bc90cd6be..02814bc0855540b540a567b2732a4fe251c72c20 100644 (file)
@@ -27,7 +27,7 @@
 int
 main ()
 {
-#if __GNUC__ && __x86_64__ && !POSIX
+#if __GNUC__ && __x86_64__ && !WITH_GLIBC
   return 0;
 #endif
   char *s = "mes";
index 34313ecce6d0bafb272f110574b3cab0fc23fb5d..7691eba20ca7012e1c92d8a0db6b17cf24f26385 100644 (file)
@@ -26,7 +26,7 @@
 int
 main ()
 {
-#if __GNUC__ && __x86_64__ && !POSIX
+#if __GNUC__ && __x86_64__ && !WITH_GLIBC
   return 0;
 #endif
   int i;
index 4d022d1efcd0d14fca80ca6b9f538515866d30b1..fd3cb8e3801f31251d52f66afa463f3c618eb99b 100644 (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>
index 0f6607e603a8dd3205fdabebfeb02c555d70581c..cb0460135763fc8e344668dcf733f093927a1d28 100644 (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")
index 09a066916c94bcf9f4a1044e4ebfec575a26042a..41b3506d8a2bdaa1f512ea2f18a81ea286998fc7 100644 (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>
index 6491fd9537077824f168fa158ec2f3ebe1d9c28e..b3f26128d0964fb9e35b6f58f87bc94404256dbe 100644 (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>
index 5b539bf63da6e3fad87bb0cb3cc6bee9bb3cd2cb..4dda7a7cfb71cb645e9ce6fc0bc719cc3f95f606 100644 (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>
index 18b62399d5262d92406835bf538cb9d731ddf5ca..6f024ab6b8b2fea79327b0516931fb9d4925fa8c 100644 (file)
@@ -26,7 +26,7 @@
 
 char *env[] = {"foo", "bar", "baz", 0};
 
-#if 0//!POSIX
+#if 0//!WITH_GLIBC
 #define getenv xgetenv
 
 char *
index a7f6566e60246200d7ac96475701cd7f59464aec..32c92bd4498714304452443c7ad63af5562411cc 100644 (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>
index be9133a08fb52bb1bed92128eb543cc4e445dd7d..fe31b968ef987296011b9220b1fda2debdc7b390 100644 (file)
--- a/src/mes.c
+++ b/src/mes.c
@@ -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