[PATCH 7/8] newlib: iconv: autogenerate iconv define list

Mike Frysinger vapier@gentoo.org
Tue Jan 18 04:47:40 GMT 2022


The list of iconv to/from defines is hand maintained in newlib.hin.
Lets leverage mkdeps.pl to generate this list automatically from the
list of known encodings.  The newlib.hin list is up-to-date, so the
list in iconv.m4 matches the list already generated.
---
 newlib/Makefile.in              |   4 +-
 newlib/aclocal.m4               |   1 +
 newlib/configure                | 521 +++++++++++++++++++++++++++++++-
 newlib/configure.ac             |   9 +-
 newlib/iconv.m4                 | 305 +++++++++++++++++++
 newlib/libc/iconv/ces/mkdeps.pl |  39 +++
 newlib/newlib.hin               | 204 ++++++++++++-
 7 files changed, 1055 insertions(+), 28 deletions(-)
 create mode 100644 newlib/iconv.m4

diff --git a/newlib/configure.ac b/newlib/configure.ac
index 4942aceae7b1..cb65cdd78778 100644
--- a/newlib/configure.ac
+++ b/newlib/configure.ac
@@ -588,9 +588,9 @@ if test "x${iconv_encodings}" != "x" \
   dnl Enable appropriate option in newlib.h
   for encoding in ${iconv_encodings}; do
       opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-      AC_DEFINE_UNQUOTED($opt,1)
+      eval "$opt=1"
       opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-      AC_DEFINE_UNQUOTED($opt,1)
+      eval "$opt=1"
   done
 
   dnl iconv_to_encodings
@@ -607,7 +607,7 @@ if test "x${iconv_encodings}" != "x" \
   dnl Enable appropriate option in newlib.h
   for encoding in ${iconv_to_encodings}; do
       opt=_ICONV_TO_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-      AC_DEFINE_UNQUOTED($opt,1)
+      eval "$opt=1"
   done
 
   dnl iconv_from_encodings
@@ -624,9 +624,10 @@ if test "x${iconv_encodings}" != "x" \
   dnl Enable appropriate option in newlib.h
   for encoding in ${iconv_from_encodings}; do
       opt=_ICONV_FROM_ENCODING_`echo "${encoding}" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-      AC_DEFINE_UNQUOTED($opt,1)
+      eval "$opt=1"
   done
 fi;
+NEWLIB_ICONV_DEFINES
 
 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
 	       libc_cv_initfinit_array, [dnl
diff --git a/newlib/iconv.m4 b/newlib/iconv.m4
new file mode 100644
index 000000000000..696b93a45f1e
--- /dev/null
+++ b/newlib/iconv.m4
@@ -0,0 +1,305 @@
+/*
+ * This file was automatically generated mkdeps.pl script. Don't edit.
+ */
+AC_DEFUN([NEWLIB_ICONV_DEFINES],[dnl
+  if test "$_ICONV_TO_ENCODING_BIG5" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_BIG5, 1, [Support big5 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_BIG5" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_BIG5, 1, [Support big5 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_CP775" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_CP775, 1, [Support cp775 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_CP775" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_CP775, 1, [Support cp775 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_CP850" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_CP850, 1, [Support cp850 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_CP850" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_CP850, 1, [Support cp850 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_CP852" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_CP852, 1, [Support cp852 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_CP852" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_CP852, 1, [Support cp852 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_CP855" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_CP855, 1, [Support cp855 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_CP855" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_CP855, 1, [Support cp855 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_CP866" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_CP866, 1, [Support cp866 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_CP866" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_CP866, 1, [Support cp866 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_EUC_JP" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_EUC_JP, 1, [Support euc_jp output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_EUC_JP" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_EUC_JP, 1, [Support euc_jp input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_EUC_KR" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_EUC_KR, 1, [Support euc_kr output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_EUC_KR" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_EUC_KR, 1, [Support euc_kr input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_EUC_TW" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_EUC_TW, 1, [Support euc_tw output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_EUC_TW" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_EUC_TW, 1, [Support euc_tw input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_1" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_1, 1, [Support iso_8859_1 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_1" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_1, 1, [Support iso_8859_1 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_10" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_10, 1, [Support iso_8859_10 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_10" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_10, 1, [Support iso_8859_10 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_11" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_11, 1, [Support iso_8859_11 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_11" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_11, 1, [Support iso_8859_11 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_13" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_13, 1, [Support iso_8859_13 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_13" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_13, 1, [Support iso_8859_13 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_14" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_14, 1, [Support iso_8859_14 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_14" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_14, 1, [Support iso_8859_14 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_15" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_15, 1, [Support iso_8859_15 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_15" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_15, 1, [Support iso_8859_15 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_2" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_2, 1, [Support iso_8859_2 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_2" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_2, 1, [Support iso_8859_2 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_3" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_3, 1, [Support iso_8859_3 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_3" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_3, 1, [Support iso_8859_3 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_4" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_4, 1, [Support iso_8859_4 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_4" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_4, 1, [Support iso_8859_4 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_5" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_5, 1, [Support iso_8859_5 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_5" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_5, 1, [Support iso_8859_5 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_6" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_6, 1, [Support iso_8859_6 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_6" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_6, 1, [Support iso_8859_6 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_7" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_7, 1, [Support iso_8859_7 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_7" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_7, 1, [Support iso_8859_7 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_8" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_8, 1, [Support iso_8859_8 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_8" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_8, 1, [Support iso_8859_8 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_8859_9" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_8859_9, 1, [Support iso_8859_9 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_8859_9" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_8859_9, 1, [Support iso_8859_9 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_ISO_IR_111" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_ISO_IR_111, 1, [Support iso_ir_111 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_ISO_IR_111" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_ISO_IR_111, 1, [Support iso_ir_111 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_KOI8_R" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_KOI8_R, 1, [Support koi8_r output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_KOI8_R" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_KOI8_R, 1, [Support koi8_r input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_KOI8_RU" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_KOI8_RU, 1, [Support koi8_ru output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_KOI8_RU" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_KOI8_RU, 1, [Support koi8_ru input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_KOI8_U" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_KOI8_U, 1, [Support koi8_u output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_KOI8_U" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_KOI8_U, 1, [Support koi8_u input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_KOI8_UNI" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_KOI8_UNI, 1, [Support koi8_uni output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_KOI8_UNI" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_KOI8_UNI, 1, [Support koi8_uni input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UCS_2" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UCS_2, 1, [Support ucs_2 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UCS_2" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UCS_2, 1, [Support ucs_2 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UCS_2_INTERNAL" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UCS_2_INTERNAL, 1, [Support ucs_2_internal output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UCS_2_INTERNAL" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UCS_2_INTERNAL, 1, [Support ucs_2_internal input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UCS_2BE" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UCS_2BE, 1, [Support ucs_2be output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UCS_2BE" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UCS_2BE, 1, [Support ucs_2be input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UCS_2LE" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UCS_2LE, 1, [Support ucs_2le output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UCS_2LE" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UCS_2LE, 1, [Support ucs_2le input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UCS_4" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UCS_4, 1, [Support ucs_4 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UCS_4" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UCS_4, 1, [Support ucs_4 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UCS_4_INTERNAL" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UCS_4_INTERNAL, 1, [Support ucs_4_internal output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UCS_4_INTERNAL" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UCS_4_INTERNAL, 1, [Support ucs_4_internal input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UCS_4BE" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UCS_4BE, 1, [Support ucs_4be output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UCS_4BE" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UCS_4BE, 1, [Support ucs_4be input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UCS_4LE" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UCS_4LE, 1, [Support ucs_4le output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UCS_4LE" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UCS_4LE, 1, [Support ucs_4le input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_US_ASCII" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_US_ASCII, 1, [Support us_ascii output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_US_ASCII" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_US_ASCII, 1, [Support us_ascii input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UTF_16" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UTF_16, 1, [Support utf_16 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UTF_16" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UTF_16, 1, [Support utf_16 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UTF_16BE" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UTF_16BE, 1, [Support utf_16be output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UTF_16BE" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UTF_16BE, 1, [Support utf_16be input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UTF_16LE" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UTF_16LE, 1, [Support utf_16le output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UTF_16LE" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UTF_16LE, 1, [Support utf_16le input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_UTF_8" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_UTF_8, 1, [Support utf_8 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_UTF_8" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_UTF_8, 1, [Support utf_8 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_WIN_1250" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_WIN_1250, 1, [Support win_1250 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_WIN_1250" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1250, 1, [Support win_1250 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_WIN_1251" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_WIN_1251, 1, [Support win_1251 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_WIN_1251" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1251, 1, [Support win_1251 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_WIN_1252" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_WIN_1252, 1, [Support win_1252 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_WIN_1252" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1252, 1, [Support win_1252 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_WIN_1253" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_WIN_1253, 1, [Support win_1253 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_WIN_1253" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1253, 1, [Support win_1253 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_WIN_1254" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_WIN_1254, 1, [Support win_1254 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_WIN_1254" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1254, 1, [Support win_1254 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_WIN_1255" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_WIN_1255, 1, [Support win_1255 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_WIN_1255" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1255, 1, [Support win_1255 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_WIN_1256" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_WIN_1256, 1, [Support win_1256 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_WIN_1256" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1256, 1, [Support win_1256 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_WIN_1257" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_WIN_1257, 1, [Support win_1257 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_WIN_1257" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1257, 1, [Support win_1257 input encoding.])
+  fi
+  if test "$_ICONV_TO_ENCODING_WIN_1258" = 1; then
+    AC_DEFINE(_ICONV_TO_ENCODING_WIN_1258, 1, [Support win_1258 output encoding.])
+  fi
+  if test "$_ICONV_FROM_ENCODING_WIN_1258" = 1; then
+    AC_DEFINE(_ICONV_FROM_ENCODING_WIN_1258, 1, [Support win_1258 input encoding.])
+  fi
+])
diff --git a/newlib/libc/iconv/ces/mkdeps.pl b/newlib/libc/iconv/ces/mkdeps.pl
index 4e648694a72f..b279fd4e8c05 100755
--- a/newlib/libc/iconv/ces/mkdeps.pl
+++ b/newlib/libc/iconv/ces/mkdeps.pl
@@ -334,6 +334,9 @@ sub process_section_encodings($)
   # Generate ccsnames.h header file
   generate_ccsnames_h (\%ccsenc);
 
+  # Generate iconv.m4 file
+  my @encodings = sort keys %encalias;
+  generate_iconv_m4 (\@encodings);
 }
 
 # ==============================================================================
@@ -928,3 +931,39 @@ sub generate_ccsnames_h($)
   print CCSNAMES_H "\n#endif /* !__CCSNAMES_H__ */\n\n";
   close CCSNAMES_H or err "Error while closing ../ccs/ccsnames.h file.";
 }
+
+# ==============================================================================
+#
+# Generate iconv.m4 file.
+#
+# Parameter 1 (input): array reference with encoding names
+#
+# ==============================================================================
+sub generate_iconv_m4($)
+{
+  my @encodings = @{$_[0]};
+
+  print "Debug: create \"../../../iconv.m4\" file.\n" if $verbose;
+  open (ICONV_M4, '>', "../../../iconv.m4")
+  or err "Can't create \"../../../iconv.m4\" file for writing.\nSystem error message: $!.\n";
+
+  print ICONV_M4 "$comment_automatic\n";
+  print ICONV_M4 "AC_DEFUN([NEWLIB_ICONV_DEFINES],[dnl\n";
+  foreach my $encoding (@encodings)
+  {
+    my $ucencoding = uc $encoding;
+
+    my $tovar = "_ICONV_TO_ENCODING_$ucencoding";
+    print ICONV_M4 "  if test \"\$$tovar\" = 1; then\n";
+    print ICONV_M4 "    AC_DEFINE($tovar, 1, [Support $encoding output encoding.])\n";
+    print ICONV_M4 "  fi\n";
+
+    my $fromvar = "_ICONV_FROM_ENCODING_$ucencoding";
+    print ICONV_M4 "  if test \"\$$fromvar\" = 1; then\n";
+    print ICONV_M4 "    AC_DEFINE($fromvar, 1, [Support $encoding input encoding.])\n";
+    print ICONV_M4 "  fi\n";
+  }
+  print ICONV_M4 "])\n";
+
+  close ICONV_M4 or err "Error while closing ../../../iconv.m4 file.";
+}
diff --git a/newlib/newlib.hin b/newlib/newlib.hin
index 2b7b8d0d8ea6..15543f4030a4 100644
--- a/newlib/newlib.hin
+++ b/newlib/newlib.hin
@@ -36,112 +36,304 @@
 /* Enable ICONV external CCS files loading capabilities. */
 #undef _ICONV_ENABLE_EXTERNAL_CCS
 
-/*
- * Iconv encodings enabled ("from" direction)
- */
+/* Support big5 input encoding. */
 #undef _ICONV_FROM_ENCODING_BIG5
+
+/* Support cp775 input encoding. */
 #undef _ICONV_FROM_ENCODING_CP775
+
+/* Support cp850 input encoding. */
 #undef _ICONV_FROM_ENCODING_CP850
+
+/* Support cp852 input encoding. */
 #undef _ICONV_FROM_ENCODING_CP852
+
+/* Support cp855 input encoding. */
 #undef _ICONV_FROM_ENCODING_CP855
+
+/* Support cp866 input encoding. */
 #undef _ICONV_FROM_ENCODING_CP866
+
+/* Support euc_jp input encoding. */
 #undef _ICONV_FROM_ENCODING_EUC_JP
+
+/* Support euc_kr input encoding. */
 #undef _ICONV_FROM_ENCODING_EUC_KR
+
+/* Support euc_tw input encoding. */
 #undef _ICONV_FROM_ENCODING_EUC_TW
+
+/* Support iso_8859_1 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_1
+
+/* Support iso_8859_10 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_10
+
+/* Support iso_8859_11 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_11
+
+/* Support iso_8859_13 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_13
+
+/* Support iso_8859_14 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_14
+
+/* Support iso_8859_15 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_15
+
+/* Support iso_8859_2 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_2
+
+/* Support iso_8859_3 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_3
+
+/* Support iso_8859_4 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_4
+
+/* Support iso_8859_5 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_5
+
+/* Support iso_8859_6 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_6
+
+/* Support iso_8859_7 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_7
+
+/* Support iso_8859_8 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_8
+
+/* Support iso_8859_9 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_8859_9
+
+/* Support iso_ir_111 input encoding. */
 #undef _ICONV_FROM_ENCODING_ISO_IR_111
+
+/* Support koi8_r input encoding. */
 #undef _ICONV_FROM_ENCODING_KOI8_R
+
+/* Support koi8_ru input encoding. */
 #undef _ICONV_FROM_ENCODING_KOI8_RU
+
+/* Support koi8_u input encoding. */
 #undef _ICONV_FROM_ENCODING_KOI8_U
+
+/* Support koi8_uni input encoding. */
 #undef _ICONV_FROM_ENCODING_KOI8_UNI
+
+/* Support ucs_2 input encoding. */
 #undef _ICONV_FROM_ENCODING_UCS_2
+
+/* Support ucs_2be input encoding. */
 #undef _ICONV_FROM_ENCODING_UCS_2BE
+
+/* Support ucs_2le input encoding. */
 #undef _ICONV_FROM_ENCODING_UCS_2LE
+
+/* Support ucs_2_internal input encoding. */
 #undef _ICONV_FROM_ENCODING_UCS_2_INTERNAL
+
+/* Support ucs_4 input encoding. */
 #undef _ICONV_FROM_ENCODING_UCS_4
+
+/* Support ucs_4be input encoding. */
 #undef _ICONV_FROM_ENCODING_UCS_4BE
+
+/* Support ucs_4le input encoding. */
 #undef _ICONV_FROM_ENCODING_UCS_4LE
+
+/* Support ucs_4_internal input encoding. */
 #undef _ICONV_FROM_ENCODING_UCS_4_INTERNAL
+
+/* Support us_ascii input encoding. */
 #undef _ICONV_FROM_ENCODING_US_ASCII
+
+/* Support utf_16 input encoding. */
 #undef _ICONV_FROM_ENCODING_UTF_16
+
+/* Support utf_16be input encoding. */
 #undef _ICONV_FROM_ENCODING_UTF_16BE
+
+/* Support utf_16le input encoding. */
 #undef _ICONV_FROM_ENCODING_UTF_16LE
+
+/* Support utf_8 input encoding. */
 #undef _ICONV_FROM_ENCODING_UTF_8
+
+/* Support win_1250 input encoding. */
 #undef _ICONV_FROM_ENCODING_WIN_1250
+
+/* Support win_1251 input encoding. */
 #undef _ICONV_FROM_ENCODING_WIN_1251
+
+/* Support win_1252 input encoding. */
 #undef _ICONV_FROM_ENCODING_WIN_1252
+
+/* Support win_1253 input encoding. */
 #undef _ICONV_FROM_ENCODING_WIN_1253
+
+/* Support win_1254 input encoding. */
 #undef _ICONV_FROM_ENCODING_WIN_1254
+
+/* Support win_1255 input encoding. */
 #undef _ICONV_FROM_ENCODING_WIN_1255
+
+/* Support win_1256 input encoding. */
 #undef _ICONV_FROM_ENCODING_WIN_1256
+
+/* Support win_1257 input encoding. */
 #undef _ICONV_FROM_ENCODING_WIN_1257
+
+/* Support win_1258 input encoding. */
 #undef _ICONV_FROM_ENCODING_WIN_1258
 
-/*
- * Iconv encodings enabled ("to" direction)
- */
+/* Support big5 output encoding. */
 #undef _ICONV_TO_ENCODING_BIG5
+
+/* Support cp775 output encoding. */
 #undef _ICONV_TO_ENCODING_CP775
+
+/* Support cp850 output encoding. */
 #undef _ICONV_TO_ENCODING_CP850
+
+/* Support cp852 output encoding. */
 #undef _ICONV_TO_ENCODING_CP852
+
+/* Support cp855 output encoding. */
 #undef _ICONV_TO_ENCODING_CP855
+
+/* Support cp866 output encoding. */
 #undef _ICONV_TO_ENCODING_CP866
+
+/* Support euc_jp output encoding. */
 #undef _ICONV_TO_ENCODING_EUC_JP
+
+/* Support euc_kr output encoding. */
 #undef _ICONV_TO_ENCODING_EUC_KR
+
+/* Support euc_tw output encoding. */
 #undef _ICONV_TO_ENCODING_EUC_TW
+
+/* Support iso_8859_1 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_1
+
+/* Support iso_8859_10 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_10
+
+/* Support iso_8859_11 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_11
+
+/* Support iso_8859_13 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_13
+
+/* Support iso_8859_14 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_14
+
+/* Support iso_8859_15 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_15
+
+/* Support iso_8859_2 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_2
+
+/* Support iso_8859_3 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_3
+
+/* Support iso_8859_4 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_4
+
+/* Support iso_8859_5 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_5
+
+/* Support iso_8859_6 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_6
+
+/* Support iso_8859_7 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_7
+
+/* Support iso_8859_8 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_8
+
+/* Support iso_8859_9 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_8859_9
+
+/* Support iso_ir_111 output encoding. */
 #undef _ICONV_TO_ENCODING_ISO_IR_111
+
+/* Support koi8_r output encoding. */
 #undef _ICONV_TO_ENCODING_KOI8_R
+
+/* Support koi8_ru output encoding. */
 #undef _ICONV_TO_ENCODING_KOI8_RU
+
+/* Support koi8_u output encoding. */
 #undef _ICONV_TO_ENCODING_KOI8_U
+
+/* Support koi8_uni output encoding. */
 #undef _ICONV_TO_ENCODING_KOI8_UNI
+
+/* Support ucs_2 output encoding. */
 #undef _ICONV_TO_ENCODING_UCS_2
+
+/* Support ucs_2be output encoding. */
 #undef _ICONV_TO_ENCODING_UCS_2BE
+
+/* Support ucs_2le output encoding. */
 #undef _ICONV_TO_ENCODING_UCS_2LE
+
+/* Support ucs_2_internal output encoding. */
 #undef _ICONV_TO_ENCODING_UCS_2_INTERNAL
+
+/* Support ucs_4 output encoding. */
 #undef _ICONV_TO_ENCODING_UCS_4
+
+/* Support ucs_4be output encoding. */
 #undef _ICONV_TO_ENCODING_UCS_4BE
+
+/* Support ucs_4le output encoding. */
 #undef _ICONV_TO_ENCODING_UCS_4LE
+
+/* Support ucs_4_internal output encoding. */
 #undef _ICONV_TO_ENCODING_UCS_4_INTERNAL
+
+/* Support us_ascii output encoding. */
 #undef _ICONV_TO_ENCODING_US_ASCII
+
+/* Support utf_16 output encoding. */
 #undef _ICONV_TO_ENCODING_UTF_16
+
+/* Support utf_16be output encoding. */
 #undef _ICONV_TO_ENCODING_UTF_16BE
+
+/* Support utf_16le output encoding. */
 #undef _ICONV_TO_ENCODING_UTF_16LE
+
+/* Support utf_8 output encoding. */
 #undef _ICONV_TO_ENCODING_UTF_8
+
+/* Support win_1250 output encoding. */
 #undef _ICONV_TO_ENCODING_WIN_1250
+
+/* Support win_1251 output encoding. */
 #undef _ICONV_TO_ENCODING_WIN_1251
+
+/* Support win_1252 output encoding. */
 #undef _ICONV_TO_ENCODING_WIN_1252
+
+/* Support win_1253 output encoding. */
 #undef _ICONV_TO_ENCODING_WIN_1253
+
+/* Support win_1254 output encoding. */
 #undef _ICONV_TO_ENCODING_WIN_1254
+
+/* Support win_1255 output encoding. */
 #undef _ICONV_TO_ENCODING_WIN_1255
+
+/* Support win_1256 output encoding. */
 #undef _ICONV_TO_ENCODING_WIN_1256
+
+/* Support win_1257 output encoding. */
 #undef _ICONV_TO_ENCODING_WIN_1257
+
+/* Support win_1258 output encoding. */
 #undef _ICONV_TO_ENCODING_WIN_1258
 
 /* Define if the platform long double type is equal to double. */
-- 
2.33.0



More information about the Newlib mailing list