commit a64a0ac77ee5dcfa40c727c53f86fe9c62ff12be
parent ec09d0a88b84508b103aa8d8c826695429d3565d
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Wed, 1 Sep 2021 10:19:16 +0300
Test for stdlib.h presence
Diffstat:
10 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -1057,7 +1057,7 @@ AC_CHECK_HEADERS([sys/types.h sys/time.h sys/msg.h time.h sys/mman.h sys/ioctl.h
sys/socket.h sys/select.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h \
endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h \
signal.h \
- inttypes.h stddef.h unistd.h \
+ inttypes.h stddef.h stdlib.h unistd.h \
sockLib.h inetLib.h net/if.h], [], [], [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADER([[search.h]],
diff --git a/src/include/platform.h b/src/include/platform.h
@@ -37,7 +37,9 @@
#include "mhd_options.h"
#include <stdio.h>
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
#include <stdint.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
@@ -25,7 +25,9 @@
* @author Karlson2k (Evgeny Grin)
*/
#include "memorypool.h"
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
#include <string.h>
#include <stdint.h>
#include "mhd_assert.h"
diff --git a/src/microhttpd/mhd_compat.h b/src/microhttpd/mhd_compat.h
@@ -35,7 +35,9 @@
#define MHD_COMPAT_H 1
#include "mhd_options.h"
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
#ifdef HAVE_STRING_H /* for strerror() */
#include <string.h>
#endif /* HAVE_STRING_H */
diff --git a/src/microhttpd/mhd_itc.h b/src/microhttpd/mhd_itc.h
@@ -38,7 +38,9 @@
#ifndef MHD_PANIC
# include <stdio.h>
-# include <stdlib.h>
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif /* HAVE_STDLIB_H */
/* Simple implementation of MHD_PANIC, to be used outside lib */
# define MHD_PANIC(msg) do { fprintf (stderr, \
"Abnormal termination at %d line in file %s: %s\n", \
diff --git a/src/microhttpd/mhd_locks.h b/src/microhttpd/mhd_locks.h
@@ -58,7 +58,9 @@
#ifndef MHD_PANIC
# include <stdio.h>
-# include <stdlib.h>
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif /* HAVE_STDLIB_H */
/* Simple implementation of MHD_PANIC, to be used outside lib */
# define MHD_PANIC(msg) do { fprintf (stderr, \
"Abnormal termination at %d line in file %s: %s\n", \
diff --git a/src/microhttpd/mhd_threads.c b/src/microhttpd/mhd_threads.c
@@ -30,7 +30,9 @@
#include <process.h>
#endif
#ifdef MHD_USE_THREAD_NAME_
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
#ifdef HAVE_PTHREAD_NP_H
#include <pthread_np.h>
#endif /* HAVE_PTHREAD_NP_H */
diff --git a/src/microhttpd/mhd_threads.h b/src/microhttpd/mhd_threads.h
@@ -39,9 +39,11 @@
#include "mhd_options.h"
#ifdef HAVE_STDDEF_H
# include <stddef.h> /* for size_t */
-#else /* ! HAVE_STDDEF_H */
+#elif defined(HAVE_STDLIB_H)
# include <stdlib.h> /* for size_t */
-#endif /* ! HAVE_STDDEF_H */
+#else /* ! HAVE_STDLIB_H */
+# include <stdio.h> /* for size_t */
+#endif /* ! HAVE_STDLIB_H */
#if defined(MHD_USE_POSIX_THREADS)
# undef HAVE_CONFIG_H
diff --git a/src/microhttpd/sysfdsetsize.c b/src/microhttpd/sysfdsetsize.c
@@ -33,7 +33,9 @@
#undef FD_SETSIZE
#endif /* FD_SETSIZE */
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
#if defined(__VXWORKS__) || defined(__vxworks) || defined(OS_VXWORKS)
#include <sockLib.h>
#endif /* OS_VXWORKS */
diff --git a/src/microhttpd/tsearch.c b/src/microhttpd/tsearch.c
@@ -10,7 +10,9 @@
*/
#include "tsearch.h"
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
typedef struct node