From f3c734eb7d1759d67e64614a6285865e6edac0bf Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 20 Jun 2013 22:14:42 +0200 Subject: [PATCH] configure.ac: Check if __overflow() is available. --- configure.ac | 2 ++ src/coloredstderr.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b4ea8f2..ef95ae9 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,8 @@ AC_CHECK_FUNCS([memmove setenv], AC_CHECK_FUNCS([execvpe]) dnl These are not in POSIX. AC_CHECK_FUNCS([fwrite_unlocked fputs_unlocked fputc_unlocked]) +dnl Internal functions in libc implementations which must be hooked. +AC_CHECK_FUNCS([__overflow]) dnl Thanks to gperftools' configure.ac (https://code.google.com/p/gperftools). AC_MSG_CHECKING([for __builtin_expect]) diff --git a/src/coloredstderr.c b/src/coloredstderr.c index 85b2b94..22c3767 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -275,7 +275,7 @@ HOOK_FILE1(int, putchar_unlocked, stdout, * part. As writes to stderr are never buffered, __overflow() is always called * and everything works fine. This is only a problem if stdout is dupped to * stderr (which shouldn't be the case too often). */ -#ifdef HAVE_STRUCT__IO_FILE__FILENO +#if defined(HAVE_STRUCT__IO_FILE__FILENO) && defined(HAVE___OVERFLOW) /* _IO_FILE is glibc's representation of FILE. */ HOOK_FILE2(int, __overflow, f, _IO_FILE *, f, int, ch) #endif -- 2.43.2