diff --git a/configure.ac b/configure.ac index 6ac3624d0..bd66b43a9 100644 --- a/configure.ac +++ b/configure.ac @@ -179,28 +179,29 @@ fi if test "$ac_cv_func_fwprintf" = yes; then -# Check if fwprintf is broken -AC_MSG_CHECKING([if fwprintf is broken]) -AC_RUN_IFELSE( - [AC_LANG_PROGRAM([ + # Check if fwprintf is broken + AC_MSG_CHECKING([if fwprintf is broken]) + AC_RUN_IFELSE( + [AC_LANG_PROGRAM([ #include #include #include #include -],[ - setlocale( LC_ALL, "" ); - fwprintf( stderr, L"%ls%ls", L"", L"fish:" ); -])], - [fwprintf_broken=no], - [fwprintf_broken=yes] ) + ], + [ + setlocale( LC_ALL, "" ); + fwprintf( stderr, L"%ls%ls", L"", L"fish:" ); + ])], + [fwprintf_broken=no], + [fwprintf_broken=yes] ) -if test "$fwprintf_broken" = yes; then - AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_FWPRINTF], [0], - [Undefined if no fwprintf implementation exists, defined to 0 if fwprintf exist but is broken, 1 if it exists and works]) -else - AC_MSG_RESULT(no) -fi + if test "$fwprintf_broken" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_BROKEN_FWPRINTF], [1], + [Define to 1 one if the implemented fwprintf is broken]) + else + AC_MSG_RESULT(no) + fi fi diff --git a/fallback.c b/fallback.c index de9fe23a4..78b42de14 100644 --- a/fallback.c +++ b/fallback.c @@ -51,8 +51,15 @@ int tputs(const char *str, int affcnt, int (*putc)(tputs_arg_t)) #endif +#ifndef HAVE_FWPRINTF +#define INTERNAL_FWPRINTF 1 +#endif -#if !HAVE_FWPRINTF +#ifdef HAVE_BROKEN_FWPRINTF +#define INTERNAL_FWPRINTF 1 +#endif + +#ifdef INTERNAL_FWPRINTF void pad( void (*writer)(wchar_t), int count) {