Selectively-compile open_memstream

This commit is contained in:
Justin Ethier 2016-08-25 23:48:31 -04:00
parent 4aec9a341f
commit 1d4d710b3b
3 changed files with 12 additions and 4 deletions

View file

@ -71,8 +71,10 @@ libcyclone.a: runtime.c include/cyclone/runtime.h include/cyclone/types.h gc.c d
# echo $(CC_EXEC)
# echo $(CC_LIB)
$(CC) $(CFLAGS) -c dispatch.c -o dispatch.o
$(CC) $(CFLAGS) -c mem-streams.c -o mem-streams.o
$(CC) $(CFLAGS) -std=gnu99 -c gc.c -o gc.o
$(CC) $(CFLAGS) -c \
-DCYC_HAVE_OPEN_MEMSTREAM=$(CYC_PLATFORM_HAS_MEMSTREAM) \
mem-streams.c -o mem-streams.o
$(CC) $(CFLAGS) -c \
-DCYC_INSTALL_DIR=\"$(PREFIX)\" \
-DCYC_INSTALL_LIB=\"$(LIBDIR)\" \

View file

@ -4,15 +4,19 @@
#
# Configuration options for the makefile
# Platform-specific flags, set to 0 if not supported
CYC_PLATFORM_HAS_MEMSTREAM ?= 1
# Compiler options
CFLAGS ?= -O2 -Wall -Iinclude -L.
COMP_CFLAGS ?= -O2 -Wall -I$(PREFIX)/include -L$(PREFIX)/lib
# Use these lines instead for debugging or profiling
#CFLAGS = -g -Wall
#CFLAGS = -g -pg -Wall
CFLAGS ?= -O2 -Wall -Iinclude -L.
COMP_CFLAGS ?= -O2 -Wall -I$(PREFIX)/include -L$(PREFIX)/lib
CC ?= cc
LIBS = -pthread -lcyclone -lck -lm
# Commands "baked into" cycone for invoking the C compiler
# Commands "baked into" cyclone for invoking the C compiler
CC_PROG ?= "$(CC) ~src-file~ $(COMP_CFLAGS) -c -o ~exec-file~.o"
CC_EXEC ?= "$(CC) ~exec-file~.o ~obj-files~ $(LIBS) $(COMP_CFLAGS) -o ~exec-file~"
CC_LIB ?= "$(CC) ~src-file~ $(COMP_CFLAGS) -c -o ~exec-file~.o"

View file

@ -37,7 +37,9 @@ port_type Cyc_io_open_output_string(void *data)
{
make_port(p, NULL, 0);
errno = 0;
#if CYC_HAVE_OPEN_MEMSTREAM
p.fp = open_memstream(&(p.mem_buf), &(p.mem_buf_len));
#endif
if (p.fp == NULL){
Cyc_rt_raise2(data, "Unable to open memory stream", obj_int2obj(errno));
}