printbuf.c \
random_seed.c
+if ENABLE_STRERROR_OVERRIDE
+libjson_cinclude_HEADERS+= \
+ strerror_override.h
+libjson_c_la_SOURCES+= \
+ strerror_override.c
+endif
distclean-local:
-rm -rf $(testsubdir)
AC_MSG_RESULT([RDRAND Hardware RNG Hash Seed disabled. Use --enable-rdrand to enable])
fi
+AC_ARG_ENABLE(strerror-override,
+ AS_HELP_STRING([--enable-strerror-override],
+ [Override strerror() function with internal version.]),
+[if test x$enableval = xyes; then
+ enable_strerror_override=yes
+ AC_DEFINE(ENABLE_STRERROR_OVERRIDE, 1, [Override strerror() with internal version])
+fi])
+
+AM_CONDITIONAL([ENABLE_STRERROR_OVERRIDE], [test "x$enable_strerror_override" = "xyes"])
+
+if test "x$enable_strerror_override" = "xyes"; then
+ AC_MSG_RESULT([Overriding `strerror()` function with internal version])
+else
+ AC_MSG_RESULT([Using libc's `strerror()` function])
+fi
+
# enable silent build by default
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
#include "config.h"
+#include "strerror_override.h"
+
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <math.h>
-#include <errno.h>
#include "debug.h"
#include "printbuf.h"
#include "config.h"
+#include "strerror_override.h"
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <errno.h>
#include <string.h>
#include <ctype.h>
#include "config.h"
#undef realloc
+#include "strerror_override.h"
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <limits.h>
#include <string.h>
-#include <errno.h>
#include <ctype.h>
#ifdef HAVE_SYS_TYPES_H
*
*/
+#include "strerror_override.h"
#include <stdio.h>
#include "config.h"
#include "random_seed.h"
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
-#include <errno.h>
#include <stdlib.h>
#include <sys/stat.h>
-#include <errno.h>
+#include "strerror_override.h"
/*
* Override strerror() to get consistent output across platforms.
#define PREFIX "ERRNO="
static char errno_buf[128] = PREFIX;
-char *strerror(int errno_in)
+char *_json_c_strerror(int errno_in)
{
int start_idx;
char digbuf[20];
--- /dev/null
+#ifndef __STRERROR_OVERRIDE_H__
+#define __STRERROR_OVERRIDE_H__
+
+#include "config.h"
+#include <errno.h>
+
+#if ENABLE_STRERROR_OVERRIDE
+char *_json_c_strerror(int errno_in);
+#define strerror _json_c_strerror
+#endif
+
+#endif /* __STRERROR_OVERRIDE_H__ */
EXTRA_DIST+= test2Formatted_pretty.expected
EXTRA_DIST+= test2Formatted_spaced.expected
-test_util_file_SOURCES = test_util_file.c strerror_override.c
+test_util_file_SOURCES = test_util_file.c
testsubdir=testSubDir
TESTS_ENVIRONMENT = top_builddir=$(top_builddir)
-#include <errno.h>
+#include "strerror_override.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
-#include <errno.h>
+#include "strerror_override.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>