Comment 0 for bug 1068328

Revision history for this message
Jim Long (evergreen-9) wrote :

FreeBSD declares the prototypes for malloc(), et al in stdlib.h.

Patch attached.

Without the patch, the following behaviour is observed:

# uname -srp
FreeBSD 8.3-STABLE amd64
# pwd
/home/opensrf/OpenSRF
# autoreconf -i
...
# CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure --prefix=/openils \
--sysconfdir=/openils/conf --with-apxs=/usr/local/sbin/apxs --with-libxml=/usr/local/include/libxml2 \
--with-includes=/usr/local/include
...
# gmake
...
In file included from timejson.c:8:
/usr/include/malloc.h:3:2: error: #error "<malloc.h> has been replaced by <stdlib.h>"
gmake[2]: *** [timejson.o] Error 1
gmake[2]: Leaving directory `/usr/home/opensrf/OpenSRF/src/c-apps'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/home/opensrf/OpenSRF/src'
gmake: *** [all-recursive] Error 1
# cat -n src/c-apps/timejson.c | head
     1 #include <stdlib.h>
     2 #include <stdio.h>
     3 #include <string.h>
     4 #include <stdarg.h>
     5 #include <time.h>
     6 #include <sys/time.h>
     7 #include <sys/resource.h>
     8 #include <malloc.h>
     9 #include "opensrf/utils.h"
    10 #include "opensrf/osrf_json.h"
#