Subject: Re: FreeBSD misses malloc.h
To: Julio M. Merino Vidal <jmmv@menta.net>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 07/23/2003 09:29:19
On Wed, 23 Jul 2003, Julio M. Merino Vidal wrote:
> I see several PRs that attempt to fix the build of packages in FreeBSD.
I am curious: Do you have any PR numbers?
I could only quickly find:
#21913: pkgsrc/graphics/gle doesn't build on FreeBSD + fix
FreeBSD's ports/graphics/gle/Makefile has:
post-patch:
.for file in ex_angle.c ex_cut_round.c ex_raw.c extrude.c round_cap.c segment.c texgen.c
@${REINPLACE_CMD} -e "s/malloc.h/stdlib.h/g" ${WRKSRC}/src/${file}
.endfor
ports/games/tinymux/Makefile does similar:
@${REINPLACE_CMD} -e 's,<malloc.h>,<stdlib.h>,' ${WRKSRC}/udb_ochunk.c
ports/graphics/ImageMagick uses:
@${REINPLACE_CMD} -e 's|<malloc.h>|<stdlib.h>|g' ${WRKSRC}/ltdl/ltdl.c
And many other FreeBSD ports do this too.
> This system does not include a malloc.h header, so programs need to include
> stdlib.h. In NetBSD we have a compatibility malloc.h header that simply
> includes stdlib.h.
FreeBSD has a malloc.h replacement. FreeBSD's malloc.h replacement
for 5.x and -current stops compilation with #error, but 4.x continues with
#warning.
FreeBSD 5.x and -current:
/* $FreeBSD: /repoman/r/ncvs/src/include/malloc.h,v 1.5 2001/11/07
23:14:31 obrien Exp $ */
#if __STDC__
#error "<malloc.h> has been replaced by <stdlib.h>"
#else
#include <stdlib.h>
#endif
FreeBSD 4.x uses:
#if __GNUC__
#warning "this file includes <malloc.h> which is deprecated, use
<stdlib.h> instead"
#endif
#include <stdlib.h>
(I wonder if FreeBSD's port maintainers have requested this fixed in
original code.)
Jeremy C. Reed
http://bsd.reedmedia.net/