Fails with: /opt/gentoo/bin/bash ../libtool --tag=CC --mode=compile x86_64-apple-darwin10-gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -O2 -fno-math-errno -march=core2 -msse4.1 -mfpmath=sse -pipe -MT libpaper_la-paper.lo -MD -MP -MF .deps/libpaper_la-paper.Tpo -c -o libpaper_la-paper.lo `test -f 'paper.c' || echo './'`paper.c libtool: compile: x86_64-apple-darwin10-gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -O2 -fno-math-errno -march=core2 -msse4.1 -mfpmath=sse -pipe -MT libpaper_la-paper.lo -MD -MP -MF .deps/libpaper_la-paper.Tpo -c paper.c -fno-common -DPIC -o .libs/libpaper_la-paper.o paper.c:17:20: error: malloc.h: No such file or directory make[3]: *** [libpaper_la-paper.lo] Error 1 On OS X, '#include <malloc.h>' needs to be '#include <malloc/malloc.h>': --- lib/paper.c.dist +++ lib/paper.c @@ -14,7 +14,7 @@ #include <sys/stat.h> #include <stdio.h> -#include <malloc.h> +#include <malloc/malloc.h> #include <string.h> #include <ctype.h> ... I'm not sure off-hand what symbols can be checked to see if the library is being built on OS X, though.
include stdlib.h instead, that's what you're supposed to include when you need malloc, and is portable, while malloc/malloc.h isn't.
BSD probably needs the same fix. The patch is simple, and can be found here: http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/app-text/libpaper/files/libpaper-1.1.23_p2-darwin-malloc.patch