Autodetect configuration items

This commit is contained in:
Justin Ethier 2016-08-26 03:04:39 -04:00
parent 1e2dac3026
commit 24109550cd

View file

@ -4,9 +4,6 @@
#
# 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
@ -38,3 +35,47 @@ INCDIR ?= $(PREFIX)/include/cyclone
DATADIR ?= $(PREFIX)/share/cyclone
DESTDIR ?=
# Automatically detect platform-specific flags, instead of using autoconf
#CYC_PLATFORM_HAS_MEMSTREAM ?= 1
CYC_PLATFORM_HAS_MEMSTREAM := $(shell echo "main(){char *buf; int len; open_memstream(&buf, &len);}" | gcc -xc - >/dev/null 2>/dev/null && echo 1 || echo 0)
# code from chibi's makefile to detect platform
ifndef PLATFORM
ifeq ($(shell uname),Darwin)
PLATFORM=macosx
else
ifeq ($(shell uname),FreeBSD)
PLATFORM=bsd
else
ifeq ($(shell uname),NetBSD)
PLATFORM=bsd
else
ifeq ($(shell uname),OpenBSD)
PLATFORM=bsd
else
ifeq ($(shell uname),DragonFly)
PLATFORM=bsd
else
ifeq ($(shell uname -o),Msys)
PLATFORM=mingw
SOLIBDIR = $(BINDIR)
DIFFOPTS = -b
else
ifeq ($(shell uname -o),Cygwin)
PLATFORM=cygwin
SOLIBDIR = $(BINDIR)
DIFFOPTS = -b
else
ifeq ($(shell uname -o),GNU/Linux)
PLATFORM=linux
else
PLATFORM=unix
endif
endif
endif
endif
endif
endif
endif
endif