Skip to content

Commit

Permalink
more intl ifdefery
Browse files Browse the repository at this point in the history
Change-Id: If33c555c64272edd41259e0ad196630544ddeddf
  • Loading branch information
cooljeanius committed Oct 16, 2024
1 parent 52106cf commit d22e2d5
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 34 deletions.
3 changes: 3 additions & 0 deletions src/intl/config.h.in

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/intl/configure
Original file line number Diff line number Diff line change
Expand Up @@ -20411,6 +20411,12 @@ if test "x$ac_cv_header_fcntl_h" = xyes
then :
printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h

fi
ac_fn_c_check_header_compile "$LINENO" "gcc/sys-types.h" "ac_cv_header_gcc_sys_types_h" "$ac_includes_default"
if test "x$ac_cv_header_gcc_sys_types_h" = xyes
then :
printf "%s\n" "#define HAVE_GCC_SYS_TYPES_H 1" >>confdefs.h

fi
ac_fn_c_check_header_compile "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
if test "x$ac_cv_header_iconv_h" = xyes
Expand Down
8 changes: 4 additions & 4 deletions src/intl/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ AC_REQUIRE_HEADER_STDC
AC_HEADER_STAT
AC_HEADER_STDBOOL dnl# also "_CHECK"s it
AC_CHECK_HEADERS([argz.h bits/libc-lock.h byteswap.h ctype.h errno.h \
fcntl.h iconv.h io.h langinfo.h libintl.h limits.h locale.h \
malloc.h malloc/malloc.h nl_types.h php_iconv.h \
stddef.h stdio.h sys/malloc.h sys/mman.h sys/param.h \
uniconv.h wchar.h])dnl
fcntl.h gcc/sys-types.h iconv.h io.h langinfo.h \
libintl.h limits.h locale.h malloc.h malloc/malloc.h \
nl_types.h php_iconv.h stddef.h stdio.h sys/malloc.h \
sys/mman.h sys/param.h uniconv.h wchar.h])dnl
AC_CHECK_HEADERS_ONCE([sys/types.h])dnl

# Checks for typedefs, structures, and compiler characteristics.
Expand Down
43 changes: 27 additions & 16 deletions src/intl/l10nflist.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
# endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* HAVE_CONFIG_H */

#if defined HAVE_STRING_H || defined _LIBC
#if !defined(__has_include)
# define __has_include(foo) 0
#endif /* !__has_include */

#if defined(HAVE_STRING_H) || defined(_LIBC) || __has_include(<string.h>)
# ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
# endif
# endif /* !_GNU_SOURCE */
# include <string.h>
#else
# if defined HAVE_STRINGS_H
# if defined(HAVE_STRINGS_H) || __has_include(<strings.h>)
# include <strings.h>
# ifndef memcpy
# define memcpy(Dst, Src, Num) bcopy(Src, Dst, Num)
Expand All @@ -48,25 +52,39 @@
# endif /* !strchr */
#endif /* HAVE_STRING_H || _LIBC */

#if defined _LIBC || defined HAVE_ARGZ_H
#if defined(_LIBC) || defined(HAVE_ARGZ_H) || __has_include(<argz.h>)
# include <argz.h>
#else
# if defined(__GNUC__) && defined(__STDC__) && defined(ANSI_PROTOTYPES) \
&& !defined(__STRICT_ANSI__)
# warning "l10nflist.c expects <argz.h> to be included on some systems."
# endif /* __GNUC__ && __STDC__ && ANSI_PROTOTYPES && !__STRICT_ANSI__ */
#endif /* HAVE_ARGZ_H */
#ifdef HAVE_CTYPE_H
#endif /* _LIBC || HAVE_ARGZ_H */

#if defined(HAVE_CTYPE_H) || __has_include(<ctype.h>)
# include <ctype.h>
#else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# warning "l10nflist.c expects <ctype.h> to be included."
# endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* HAVE_CTYPE_H */
#ifdef HAVE_MALLOC_H

#if defined(HAVE_SYS_TYPES_H) || __has_include(<sys/types.h>)
# include <sys/types.h>
#else
# if defined(HAVE_GCC_SYS_TYPES_H) || __has_include(<gcc/sys-types.h>)
# include <gcc/sys-types.h>
# else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# warning "l10nflist.c expects <sys/types.h> (or something) to be included."
# endif /* __GNUC__ && !__STRICT_ANSI__ */
# endif /* HAVE_GCC_SYS_TYPES_H */
#endif /* HAVE_SYS_TYPES_H */

#if defined(HAVE_MALLOC_H) || __has_include(<malloc.h>)
# include <malloc.h>
#else
# ifdef HAVE_MALLOC_MALLOC_H
# if defined(HAVE_MALLOC_MALLOC_H) || __has_include(<malloc/malloc.h>)
# include <malloc/malloc.h>
# else
# if defined(HAVE_SYS_MALLOC_H) && defined(HAVE_U_SHORT) && defined(HAVE_U_INT64_T)
Expand All @@ -78,15 +96,8 @@
# endif /* HAVE_SYS_MALLOC_H && HAVE_U_SHORT && HAVE_U_INT64_T */
# endif /* HAVE_MALLOC_MALLOC_H */
#endif /* HAVE_MALLOC_H */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# warning "l10nflist.c expects <sys/types.h> to be included."
# endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* HAVE_SYS_TYPES_H */

#if defined STDC_HEADERS || defined _LIBC || defined HAVE_STDLIB_H
#if defined(STDC_HEADERS) || defined(_LIBC) || defined(HAVE_STDLIB_H)
# include <stdlib.h>
#else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
Expand Down
40 changes: 26 additions & 14 deletions src/intl/loadmsgcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,34 @@
# endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* HAVE_CONFIG_H */

#ifdef HAVE_FCNTL_H
#if !defined(__has_include)
# define __has_include(foo) 0
#endif /* !__has_include */

#if defined(HAVE_FCNTL_H) || __has_include(<fcntl.h>)
# include <fcntl.h>
#else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# warning "loadmsgcat.c expects <fcntl.h> to be included."
# endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* HAVE_FCNTL_H */
#ifdef HAVE_MALLOC_H

#if defined(HAVE_SYS_TYPES_H) || __has_include(<sys/types.h>)
# include <sys/types.h>
#else
# if defined(HAVE_GCC_SYS_TYPES_H) || __has_include(<gcc/sys-types.h>)
# include <gcc/sys-types.h>
# else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# warning "loadmsgcat.c expects <sys/types.h> (or something) to be included."
# endif /* __GNUC__ && !__STRICT_ANSI__ */
# endif /* HAVE_GCC_SYS_TYPES_H */
#endif /* HAVE_SYS_TYPES_H */

#if defined(HAVE_MALLOC_H) || __has_include(<malloc.h>)
# include <malloc.h>
#else
# ifdef HAVE_MALLOC_MALLOC_H
# if defined(HAVE_MALLOC_MALLOC_H) || __has_include(<malloc/malloc.h>)
# include <malloc/malloc.h>
# else
# if defined(HAVE_SYS_MALLOC_H) && defined(HAVE_U_SHORT) && defined(HAVE_U_INT64_T)
Expand All @@ -46,38 +63,33 @@
# endif /* HAVE_SYS_MALLOC_H && HAVE_U_SHORT && HAVE_U_INT64_T */
# endif /* HAVE_MALLOC_MALLOC_H */
#endif /* HAVE_MALLOC_H */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# warning "loadmsgcat.c expects <sys/types.h> to be included."
# endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_SYS_STAT_H

#if defined(HAVE_SYS_STAT_H) || __has_include(<sys/stat.h>)
# include <sys/stat.h>
#else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# warning "loadmsgcat.c expects <sys/stat.h> to be included."
# endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* HAVE_SYS_STAT_H */

#if defined STDC_HEADERS || defined _LIBC || defined HAVE_STDLIB_H
#if defined(STDC_HEADERS) || defined(_LIBC) || defined(HAVE_STDLIB_H)
# include <stdlib.h>
#else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# warning "loadmsgcat.c expects <stdlib.h> to be included."
# endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* HAVE_STDLIB_H || _LIBC || STDC_HEADERS */

#if defined HAVE_UNISTD_H || defined _LIBC
#if defined(HAVE_UNISTD_H) || defined(_LIBC) || __has_include(<unistd.h>)
# include <unistd.h>
#else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# warning "loadmsgcat.c expects <unistd.h> to be included."
# endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* HAVE_UNISTD_H || _LIBC */

#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC || defined HAVE_SYS_MMAN_H
#if (defined(HAVE_MMAP) && defined(HAVE_MUNMAP)) || defined(_LIBC) || \
defined(HAVE_SYS_MMAN_H) || __has_include(<sys/mman.h>)
# include <sys/mman.h>
#else
# if defined(__GNUC__) && !defined(__STRICT_ANSI__)
Expand Down

0 comments on commit d22e2d5

Please sign in to comment.