Merge branch 'next' into sparc
diff --git a/CONFIG b/CONFIG
deleted file mode 100644
index e86e47f..0000000
--- a/CONFIG
+++ /dev/null
@@ -1,6 +0,0 @@
-// Package version
-
-#define PKG_MAJOR 2
-#define PKG_MINOR 1
-
-
diff --git a/Makefile b/Makefile
index cbf89d3..f5143c2 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@
 # By Nguyen Anh Quynh <aquynh@gmail.com>, 2013>
 
 include config.mk
+include pkgconfig.mk	# package version
 
 ifeq ($(CROSS),)
 CC ?= cc
@@ -15,12 +16,6 @@
 STRIP = $(CROSS)strip
 endif
 
-ifeq ($(CAPSTONE_DIET),yes)
-# remove string check & stack protector functions
-CFLAGS += -D_FORTIFY_SOURCE=0
-CFLAGS += -fno-stack-protector
-endif
-
 CFLAGS += -fPIC -O3 -Wall -Iinclude
 
 ifeq ($(USE_SYS_DYN_MEM),yes)
@@ -150,6 +145,10 @@
 ifeq ($(UNAME_S),Darwin)
 EXT = dylib
 AR_EXT = a
+ifneq ($(USE_SYS_DYN_MEM),yes)
+# remove string check because OSX kernel complains about missing symbols
+CFLAGS += -D_FORTIFY_SOURCE=0
+endif
 # By default, suppose that Brew is installed & use Brew path for pkgconfig file
 PKGCFCGDIR = /usr/local/lib/pkgconfig
 # is Macport installed instead?
@@ -188,8 +187,6 @@
 ARCHIVE = lib$(LIBNAME).$(AR_EXT)
 PKGCFGF = $(LIBNAME).pc
 
-VERSION=$(shell echo `grep -e PKG_MAJOR -e PKG_MINOR CONFIG | grep -v = | awk '{print $$3}'` | awk '{print $$1"."$$2}')
-
 .PHONY: all clean install uninstall dist
 
 all: $(LIBRARY) $(ARCHIVE) $(PKGCFGF)
@@ -232,7 +229,11 @@
 $(PKGCFGF):
 	echo 'Name: capstone' > $(PKGCFGF)
 	echo 'Description: Capstone disassembly engine' >> $(PKGCFGF)
-	echo 'Version: $(VERSION)' >> $(PKGCFGF)
+ifeq ($(PKG_EXTRA),)
+	echo 'Version: $(PKG_MAJOR).$(PKG_MINOR)' >> $(PKGCFGF)
+else
+	echo 'Version: $(PKG_MAJOR).$(PKG_MINOR).$(PKG_EXTRA)' >> $(PKGCFGF)
+endif
 	echo 'libdir=$(LIBDIR)' >> $(PKGCFGF)
 	echo 'includedir=$(PREFIX)/include/capstone' >> $(PKGCFGF)
 	echo 'archive=$${libdir}/libcapstone.a' >> $(PKGCFGF)
diff --git a/config.mk b/config.mk
index 1b4479d..437c148 100644
--- a/config.mk
+++ b/config.mk
@@ -24,10 +24,10 @@
 
 ################################################################################
 # Comment out the line below ('USE_SYS_DYN_MEM = yes'), or change it to
-# 'USE_SYS_DYN_MEM = no' if do NOT use malloc/calloc/realloc/free/vnsprintf()
+# 'USE_SYS_DYN_MEM = no' if do NOT use malloc/calloc/realloc/free/vsnprintf()
 # provided by system for internal dynamic memory management.
 #
-# NOTE: in that case, specify your own malloc/calloc/realloc/free/vnsprintf()
+# NOTE: in that case, specify your own malloc/calloc/realloc/free/vsnprintf()
 # functions in your program via API cs_option(), using CS_OPT_MEM option type.
 
 USE_SYS_DYN_MEM = yes
diff --git a/pkgconfig.mk b/pkgconfig.mk
new file mode 100644
index 0000000..e265e8c
--- /dev/null
+++ b/pkgconfig.mk
@@ -0,0 +1,11 @@
+# Package version of Capstone for Makefile.
+# To be used to generate capstone.pc for pkg-config
+
+# version major & minor 
+PKG_MAJOR = 2
+PKG_MINOR = 1
+
+# version bugfix level. Example: PKG_EXTRA = 1
+PKG_EXTRA =
+
+