Avoid directly calling objc runtime functions in C

By managing autorelease pools in objc code we avoid warnings on OS X
10.9 and it is also safer than calling objc runtime functions from C.
Avoid warning if HAVE_DUP is redefined
Snapshot 72
Stop using 10.9 deprecated CGContext function
Only pull in AvailabilityMacros.h when necessary
Merge remote-tracking branch 'source/master'