## Process this file with automake to produce Makefile.in
noinst_LTLIBRARIES = libcompat.la
-libcompat_la_SOURCES = libcompat.c
+libcompat_la_SOURCES = libcompat.c libcompat.h
libcompat_la_LIBADD = $(LTLIBOBJS) $(LTALLOCA)
--- /dev/null
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* defines size_t */
+#include <sys/types.h>
+
+#if !HAVE_MALLOC
+void *rpl_malloc (size_t n)
+#endif /* !HAVE_MALLOC */
+
+#if !HAVE_REALLOC
+void *rpl_realloc (void *p, size_t n)
+#endif /* !HAVE_REALLOC */
+
+#if !HAVE_SLEEP
+unsigned int sleep (unsigned int seconds);
+#endif /* !HAVE_SLEEP */
+
+#if !HAVE_STRSIGNAL
+static const char *strsignal(int sig);
+#endif /* !HAVE_STRSIGNAL */
#if HAVE_CONFIG_H
#include <config.h>
#endif
+
+/* malloc has been defined to rpl_malloc, so first undo that */
#undef malloc
+/* defines size_t */
#include <sys/types.h>
+/* this gives us the real malloc to use below */
void *malloc (size_t n);
/* force malloc(0) to return a valid pointer */
#if HAVE_CONFIG_H
#include <config.h>
#endif
+
+/* realloc has been defined to rpl_realloc, so first undo that */
#undef realloc
+/* defines size_t */
#include <sys/types.h>
+/* this gives us the real realloc to use below */
void *realloc (void *p, size_t n);
-/* force realloc(p, 0) to return a valid pointer */
+/* force realloc(p, 0) and realloc (NULL, n) to return a valid pointer */
void *
rpl_realloc (void *p, size_t n)
{
/* This file gets included if AC_REPLACE_FUNCS([sleep]) cannot find the function. */
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-
-#if !HAVE_SLEEP
-unsigned int sleep (unsigned int seconds);
-#endif /* !HAVE_SLEEP */
-
unsigned int
sleep (unsigned int seconds)
{
/* This file gets included if AC_REPLACE_FUNCS([strsignal]) cannot find the function. */
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <sys/types.h>
-
-#if !HAVE_STRSIGNAL
-static const char *strsignal(int sig);
-#endif /* !HAVE_STRSIGNAL */
+#include <stdio.h>
/* Note that Gnulib has a much more advanced version of strsignal */
static const char *
*/
#include "config.h"
+#include "lib/libcompat.h"
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>