Skip to content

Commit

Permalink
fix for build using MINGW-10.0 with msys2
Browse files Browse the repository at this point in the history
  • Loading branch information
tavmem committed Jul 11, 2017
1 parent ab39b86 commit 59d856e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DEVFLAGS = -O0 -g3 -DDEBUG -Wunused -Wreturn-type -Wimplicit-int #-Wall
OS := $(shell uname -s | tr "[:upper:]" "[:lower:]")

# Win-64
ifeq (mingw32_nt-6.2,$(OS))
ifeq (mingw64_nt-10.0,$(OS))
CC=gcc -DWIN32=1
PRODFLAGS += -D_FILE_OFFSET_BITS=64
LDFLAGS = -lws2_32 -static -lpthread
Expand All @@ -19,7 +19,7 @@ OBJS= src/win/mman.o src/win/dlfcn.o src/win/safe-ctype.o src/win/fnmatch.o \
endif

# Win-32
ifeq (mingw32_nt-6.0,$(OS))
ifeq (mingw32_nt-10.0,$(OS))
CC=gcc -DWIN32=1
LDFLAGS = -lws2_32 -static -lpthread
OBJS= src/win/mman.o src/win/dlfcn.o src/win/safe-ctype.o src/win/fnmatch.o \
Expand Down Expand Up @@ -131,15 +131,15 @@ TAGS: *.c *.h
.PHONY: all clean install android-debug

# Dependencies.
ifeq (mingw32_nt-6.2,$(OS))
ifeq (mingw64_nt-10.0,$(OS))
src/win/dlfcn.c: src/win/dlfcn.h
src/win/mman.c: src/win/mman.h
src/win/safe-ctype.c: src/win/safe-ctype.h
src/win/fnmatch.c: src/win/fnmatch.h src/win/safe-ctype.h src/win/ansidecl.h
src/*.o: src/incs.h src/ts.h Makefile src/k.h src/win/mman.h src/win/dlfcn.h
endif

ifeq (mingw32_nt-6.0,$(OS))
ifeq (mingw32_nt-10.0,$(OS))
src/win/dlfcn.c: src/win/dlfcn.h
src/win/mman.c: src/win/mman.h
src/win/safe-ctype.c: src/win/safe-ctype.h
Expand Down
4 changes: 3 additions & 1 deletion src/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ S fBreak = "t";

void boilerplate()
{
if(!isatty(STDOUT) || !isatty(STDIN)) R;
#ifndef __MINGW32__
if(!isatty(STDOUT) || !isatty(STDIN)) R; //kluge: isatty() fails using mingw-10.0 with msys2
#endif
O("K Console - Enter \\ for help\n\n");
prompt(0);
}
Expand Down
9 changes: 7 additions & 2 deletions src/kc.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,13 @@ I lines(FILE*f) {
I line(FILE*f, S*a, I*n, PDA*p) { //just starting or just executed: *a=*n=*p=0, intermediate is non-zero
S s=0; I b=0,c=0,m=0; K k; F d; fer=0;

//I o = isatty(STDIN) && f==stdin; //display results to stdout?
I o = isatty(STDIN); //display results to stdout?
//kluge: isatty() fails using mingw-10.0 with msys2
#ifndef __MINGW32__
//I o = isatty(STDIN) && f==stdin; //display results to stdout?
I o = isatty(STDIN); //display results to stdout?
#else
I o = 1;
#endif

if(-1==(c=getline_(&s,&m,f))) GC;
if(fln&&(s[0]=='#' && s[1]=='!')) GC;
Expand Down

0 comments on commit 59d856e

Please sign in to comment.