mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
Selectively-compile open_memstream
This commit is contained in:
parent
4aec9a341f
commit
1d4d710b3b
3 changed files with 12 additions and 4 deletions
4
Makefile
4
Makefile
|
@ -71,8 +71,10 @@ libcyclone.a: runtime.c include/cyclone/runtime.h include/cyclone/types.h gc.c d
|
||||||
# echo $(CC_EXEC)
|
# echo $(CC_EXEC)
|
||||||
# echo $(CC_LIB)
|
# echo $(CC_LIB)
|
||||||
$(CC) $(CFLAGS) -c dispatch.c -o dispatch.o
|
$(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) -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 \
|
$(CC) $(CFLAGS) -c \
|
||||||
-DCYC_INSTALL_DIR=\"$(PREFIX)\" \
|
-DCYC_INSTALL_DIR=\"$(PREFIX)\" \
|
||||||
-DCYC_INSTALL_LIB=\"$(LIBDIR)\" \
|
-DCYC_INSTALL_LIB=\"$(LIBDIR)\" \
|
||||||
|
|
|
@ -4,15 +4,19 @@
|
||||||
#
|
#
|
||||||
# Configuration options for the makefile
|
# 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
|
# Use these lines instead for debugging or profiling
|
||||||
#CFLAGS = -g -Wall
|
#CFLAGS = -g -Wall
|
||||||
#CFLAGS = -g -pg -Wall
|
#CFLAGS = -g -pg -Wall
|
||||||
CFLAGS ?= -O2 -Wall -Iinclude -L.
|
|
||||||
COMP_CFLAGS ?= -O2 -Wall -I$(PREFIX)/include -L$(PREFIX)/lib
|
|
||||||
CC ?= cc
|
CC ?= cc
|
||||||
LIBS = -pthread -lcyclone -lck -lm
|
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_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_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"
|
CC_LIB ?= "$(CC) ~src-file~ $(COMP_CFLAGS) -c -o ~exec-file~.o"
|
||||||
|
|
|
@ -37,7 +37,9 @@ port_type Cyc_io_open_output_string(void *data)
|
||||||
{
|
{
|
||||||
make_port(p, NULL, 0);
|
make_port(p, NULL, 0);
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
#if CYC_HAVE_OPEN_MEMSTREAM
|
||||||
p.fp = open_memstream(&(p.mem_buf), &(p.mem_buf_len));
|
p.fp = open_memstream(&(p.mem_buf), &(p.mem_buf_len));
|
||||||
|
#endif
|
||||||
if (p.fp == NULL){
|
if (p.fp == NULL){
|
||||||
Cyc_rt_raise2(data, "Unable to open memory stream", obj_int2obj(errno));
|
Cyc_rt_raise2(data, "Unable to open memory stream", obj_int2obj(errno));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue