configure: Check for stdio_ext.h
For portability, check for stdio_ext.h during configure and define HAVE_STDIO_EXT_H accordingly. If the current system does not provide this header, use a fallback for __fpending(). This definition will not work on all systems as it relies on internal data structures of libc. A more portable solution should be preferred, for example by using gnulib.
This commit is contained in:
parent
538bd978a4
commit
6df4fc403d
@ -137,6 +137,8 @@ dnl else
|
|||||||
dnl ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
|
dnl ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
|
||||||
dnl fi
|
dnl fi
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(stdio_ext.h, [], [], AC_INCLUDES_DEFAULT)
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether program_invocation_name is defined)
|
AC_MSG_CHECKING(whether program_invocation_name is defined)
|
||||||
AC_TRY_COMPILE([#include <errno.h>],
|
AC_TRY_COMPILE([#include <errno.h>],
|
||||||
[program_invocation_name = "test";],
|
[program_invocation_name = "test";],
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
|
#ifdef HAVE_STDIO_EXT_H
|
||||||
# include <stdio_ext.h>
|
# include <stdio_ext.h>
|
||||||
|
#else
|
||||||
|
/* FIXME: use a more portable definition of __fpending() (from gnulib?) */
|
||||||
|
# include <stdio.h>
|
||||||
|
# define __fpending(fp) ((fp)->_p - (fp)->_bf._base)
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user