Find another way to deal with system dependent aliases.
diff --git a/ChangeLog b/ChangeLog
index ee1097b..d3da71d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2000-03-13  Bruno Haible  <haible@clisp.cons.org>
+
+        Provide all encodings used by AIX locales.
+        * tools/Makefile (all): Add cp856.h, cp922.h, cp1046.h, cp1124.h,
+          cp1129.h.
+          (cp856.h, cp922.h, cp1046.h, cp1124.h, cp1129.h): New targets.
+        * src/cp856.h, src/cp922.h, src/cp943.h, src/cp1046.h, src/cp1124.h,
+          src/cp1129.h: New files.
+        * src/converters.h: Include them if USE_AIX is defined.
+        * src/encodings_aix.def: New file, with CP856, CP922, CP943, CP1046,
+          CP1124, CP1129.
+        * src/genflags.c: Define USE_AIX. Include encodings_aix.def.
+        * src/genaliases2.c: New file.
+        * src/iconv.c: Define USE_AIX on AIX.
+          Include encodings_aix.def and aliases_aix.h.
+          (aliases2_lookup): New function.
+          (iconv_open): Call aliases2_lookup.
+        * src/Makefile.in (iconv.lo): Depend on encodings_aix.def and
+          aliases_aix.h.
+        * Makefile.devel (all): Add src/aliases_aix.h.
+          (src/aliases_aix.h): New rule.
+          (src/flags.h): Depend on src/encodings_aix.def.
+
 2000-02-24  Bruno Haible  <haible@clisp.cons.org>
 
         * src/iconv.c (iconv): Don't write beyond the end of the output buffer.
@@ -13,24 +36,6 @@
 
 2000-02-05  Bruno Haible  <haible@clisp.cons.org>
 
-        Provide all encodings used by AIX locales.
-        * tools/Makefile (all): Add cp856.h, cp922.h, cp1046.h, cp1124.h,
-          cp1129.h.
-          (cp856.h, cp922.h, cp1046.h, cp1124.h, cp1129.h): New targets.
-        * src/cp856.h, src/cp922.h, src/cp943.h, src/cp1046.h, src/cp1124.h,
-          src/cp1129.h: New files.
-        * src/converters.h: Include them if either USE_AIX or USE_ALL is
-          defined.
-        * src/encodings.def: Add CP856, CP922, CP943, CP1046, CP1124, CP1129.
-        * src/genflags.c: Define USE_ALL.
-        * src/use_aliases2.h: New file.
-        * src/genaliases2.c: New file.
-        * src/iconv.c: Include use_aliases2.h and aliases2.h.
-          (iconv_open): Call aliases2_lookup.
-        * src/Makefile.in (iconv.lo): Depend on aliases2.h.
-          (aliases2.h): New rule.
-          (clean): Remove aliases2.h.
-
         * src/tis620.h: Simplify.
 
 2000-01-27  Bruno Haible  <haible@clisp.cons.org>
diff --git a/Makefile.devel b/Makefile.devel
index 4cef91f..6a052d6 100644
--- a/Makefile.devel
+++ b/Makefile.devel
@@ -10,7 +10,7 @@
 RM = rm -f
 
 
-all : configures src/config.h.msvc include/iconv.h.msvc src/aliases.h src/flags.h src/translit.h
+all : configures src/config.h.msvc include/iconv.h.msvc src/aliases.h src/aliases_aix.h src/flags.h src/translit.h
 
 
 # Before making a new release:
@@ -61,8 +61,13 @@
 	./genaliases > src/aliases.gperf
 	$(RM) genaliases
 
+src/aliases_aix.h : src/encodings_aix.def src/genaliases2.c
+	$(CC) $(CFLAGS) -DUSE_AIX src/genaliases2.c -o genaliases
+	./genaliases > src/aliases_aix.h
+	$(RM) genaliases
 
-src/flags.h : src/encodings.def src/converters.h src/genflags.c
+
+src/flags.h : src/encodings.def src/encodings_aix.def src/converters.h src/genflags.c
 	$(CC) $(CFLAGS) src/genflags.c -o genflags
 	./genflags > src/flags.h
 	$(RM) genflags
diff --git a/src/Makefile.in b/src/Makefile.in
index 4f426cf..1a8957d 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -67,15 +67,9 @@
 libiconv_plug_osf.so : $(SOURCES)
 	$(CC) $(CFLAGS) $(INCLUDES) -fPIC -DPIC -DLIBICONV_PLUG $(SOURCES) $(PLUG_SOURCES) -shared -o libiconv_plug_osf.so
 
-iconv.lo : $(srcdir)/iconv.c $(srcdir)/converters.h $(srcdir)/encodings.def $(srcdir)/aliases.h $(srcdir)/flags.h aliases2.h
+iconv.lo : $(srcdir)/iconv.c $(srcdir)/converters.h $(srcdir)/encodings.def $(srcdir)/encodings_aix.def $(srcdir)/aliases.h $(srcdir)/aliases_aix.h $(srcdir)/flags.h
 	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/iconv.c
 
-aliases2.h : $(srcdir)/genaliases2.c $(srcdir)/encodings.def
-	$(CC) $(CFLAGS) $(srcdir)/genaliases2.c -o genaliases2
-	./genaliases2 > aliases2.tmp
-	$(MV) aliases2.tmp aliases2.h
-	$(RM) genaliases2
-
 
 # Installs the library and include files only. Typically called with only
 # $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here.
@@ -104,7 +98,7 @@
 mostlyclean : clean
 
 clean : force
-	$(RM) *.o *.lo *.a *.la libiconv_plug* aliases2.h core
+	$(RM) *.o *.lo *.a *.la libiconv_plug* core
 	$(RM) -r .libs _libs
 
 distclean : clean
diff --git a/src/aliases_aix.h b/src/aliases_aix.h
new file mode 100644
index 0000000..6e3b46c
--- /dev/null
+++ b/src/aliases_aix.h
@@ -0,0 +1,6 @@
+  { "CP856", ei_cp856 },
+  { "CP922", ei_cp922 },
+  { "CP943", ei_cp943 },
+  { "CP1046", ei_cp1046 },
+  { "CP1124", ei_cp1124 },
+  { "CP1129", ei_cp1129 },
diff --git a/src/converters.h b/src/converters.h
index 14c4f25..b836700 100644
--- a/src/converters.h
+++ b/src/converters.h
@@ -207,7 +207,7 @@
 
 /* Encodings used by system dependent locales. */
 
-#if defined(USE_AIX) || defined(USE_ALL)
+#ifdef USE_AIX
 #include "cp856.h"
 #include "cp922.h"
 #include "cp943.h"
diff --git a/src/encodings.def b/src/encodings.def
index e796878..fa6b387 100644
--- a/src/encodings.def
+++ b/src/encodings.def
@@ -16,7 +16,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* The list of all user-visible encodings. */
+/* The list of all system independent user-visible encodings. */
 
 /* By convention, an encoding named FOOBAR or FOO_BAR or FOO-BAR is defined
    in a file named "foobar.h" through the functions foobar_mbtowc and
@@ -36,8 +36,6 @@
  */
 
 
-#ifndef USE_SYSDEPENDENT_ONLY
-
 DEFENCODING(( "US-ASCII",               /* IANA */
               "ASCII",                  /* IANA, JDK 1.1 */
               "ISO646-US",              /* IANA */
@@ -755,41 +753,3 @@
             iso2022_kr,
             { iso2022_kr_mbtowc },        { iso2022_kr_wctomb, iso2022_kr_reset })
 
-#endif /* USE_SYSDEPENDENT_ONLY */
-
-/* Encodings used by system dependent locales. */
-
-#if defined(USE_AIX) || defined(USE_ALL)
-
-DEFENCODING(( "CP856",
-            ),
-            cp856,
-            { cp856_mbtowc },             { cp856_wctomb, NULL })
-
-DEFENCODING(( "CP922",
-            ),
-            cp922,
-            { cp922_mbtowc },             { cp922_wctomb, NULL })
-
-DEFENCODING(( "CP943",
-            ),
-            cp943,
-            { cp943_mbtowc },             { cp943_wctomb, NULL })
-
-DEFENCODING(( "CP1046",
-            ),
-            cp1046,
-            { cp1046_mbtowc },            { cp1046_wctomb, NULL })
-
-DEFENCODING(( "CP1124",
-            ),
-            cp1124,
-            { cp1124_mbtowc },            { cp1124_wctomb, NULL })
-
-DEFENCODING(( "CP1129",
-            ),
-            cp1129,
-            { cp1129_mbtowc },            { cp1129_wctomb, NULL })
-
-#endif
-
diff --git a/src/encodings_aix.def b/src/encodings_aix.def
new file mode 100644
index 0000000..ef4594d
--- /dev/null
+++ b/src/encodings_aix.def
@@ -0,0 +1,49 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU ICONV Library.
+
+   The GNU ICONV Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU ICONV Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU ICONV Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Encodings used by system dependent locales on AIX. */
+
+DEFENCODING(( "CP856",
+            ),
+            cp856,
+            { cp856_mbtowc },             { cp856_wctomb, NULL })
+
+DEFENCODING(( "CP922",
+            ),
+            cp922,
+            { cp922_mbtowc },             { cp922_wctomb, NULL })
+
+DEFENCODING(( "CP943",
+            ),
+            cp943,
+            { cp943_mbtowc },             { cp943_wctomb, NULL })
+
+DEFENCODING(( "CP1046",
+            ),
+            cp1046,
+            { cp1046_mbtowc },            { cp1046_wctomb, NULL })
+
+DEFENCODING(( "CP1124",
+            ),
+            cp1124,
+            { cp1124_mbtowc },            { cp1124_wctomb, NULL })
+
+DEFENCODING(( "CP1129",
+            ),
+            cp1129,
+            { cp1129_mbtowc },            { cp1129_wctomb, NULL })
diff --git a/src/genaliases2.c b/src/genaliases2.c
index e806fb8..074f5de 100644
--- a/src/genaliases2.c
+++ b/src/genaliases2.c
@@ -21,17 +21,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "use_aliases2.h"
-
-static int empty = 1;
-
 static void emit_encoding (const char* const* names, size_t n, const char* c_name)
 {
   for (; n > 0; names++, n--) {
-    if (empty) {
-      printf("static struct alias sysdep_aliases[] = {\n");
-      empty = 0;
-    }
     printf("  { \"");
     /* Output *names in upper case. */
     {
@@ -51,35 +43,17 @@
 
 int main ()
 {
-#define USE_SYSDEPENDENT_ONLY
 #define DEFENCODING(xxx_names,xxx,xxx_ifuncs,xxx_ofuncs1,xxx_ofuncs2) \
   {                                                           \
     static const char* const names[] = BRACIFY xxx_names;     \
     emit_encoding(names,sizeof(names)/sizeof(names[0]),#xxx); \
   }
 #define BRACIFY(...) { __VA_ARGS__ }
-#include "encodings.def"
+#ifdef USE_AIX
+#include "encodings_aix.def"
+#endif
 #undef BRACIFY
 #undef DEFENCODING
-#undef USE_SYSDEPENDENT_ONLY
-  if (!empty) {
-    printf("};\n\n");
-    printf("#ifdef __GNUC__\n");
-    printf("__inline\n");
-    printf("#endif\n");
-    printf("const struct alias *\n");
-    printf("aliases2_lookup (register const char *str)\n");
-    printf("{\n");
-    printf("  struct alias * ptr;\n");
-    printf("  unsigned int count;\n");
-    printf("  for (ptr = sysdep_aliases, count = sizeof(sysdep_aliases)/sizeof(sysdep_aliases[0]); count > 0; ptr++, count--)\n");
-    printf("    if (!strcmp(str,ptr->name))\n");
-    printf("      return ptr;\n");
-    printf("  return NULL;\n");
-    printf("}\n");
-  } else {
-    printf("#define aliases2_lookup(str)  NULL\n");
-  }
   fflush(stdout);
   if (ferror(stdout))
     exit(1);
diff --git a/src/genflags.c b/src/genflags.c
index b0f93fd..f009f12 100644
--- a/src/genflags.c
+++ b/src/genflags.c
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 
 /* Consider all encodings, including the system dependent ones. */
-#define USE_ALL
+#define USE_AIX
 
 #include "converters.h"
 
@@ -91,7 +91,9 @@
     struct wctomb_funcs ofuncs = xxx_ofuncs1,xxx_ofuncs2; \
     emit_encoding(&ofuncs,#xxx);                          \
   }
+/* Consider all encodings, including the system dependent ones. */
 #include "encodings.def"
+#include "encodings_aix.def"
 #undef DEFENCODING
 
   fflush(stdout);
diff --git a/src/iconv.c b/src/iconv.c
index 4eaede2..16a190d 100644
--- a/src/iconv.c
+++ b/src/iconv.c
@@ -23,6 +23,14 @@
 #include "config.h"
 
 /*
+ * Consider those system dependent encodings that are needed for the
+ * current system.
+ */
+#ifdef _AIX
+#define USE_AIX
+#endif
+
+/*
  * Converters.
  */
 #include "converters.h"
@@ -36,7 +44,6 @@
 /*
  * Table of all supported encodings.
  */
-#include "use_aliases2.h"
 struct encoding {
   struct mbtowc_funcs ifuncs; /* conversion multibyte -> unicode */
   struct wctomb_funcs ofuncs; /* conversion unicode -> multibyte */
@@ -46,6 +53,9 @@
 #define DEFENCODING(xxx_names,xxx,xxx_ifuncs,xxx_ofuncs1,xxx_ofuncs2) \
   ei_##xxx ,
 #include "encodings.def"
+#ifdef USE_AIX
+#include "encodings_aix.def"
+#endif
 #undef DEFENCODING
 ei_for_broken_compilers_that_dont_like_trailing_commas
 };
@@ -54,6 +64,9 @@
 #define DEFENCODING(xxx_names,xxx,xxx_ifuncs,xxx_ofuncs1,xxx_ofuncs2) \
   { xxx_ifuncs, xxx_ofuncs1,xxx_ofuncs2, ei_##xxx##_oflags },
 #include "encodings.def"
+#ifdef USE_AIX
+#include "encodings_aix.def"
+#endif
 #undef DEFENCODING
 };
 
@@ -71,7 +84,28 @@
  * Defines
  *   const struct alias * aliases2_lookup (const char *str);
  */
-#include "aliases2.h"
+#if defined(USE_AIX) /* || ... */
+static struct alias sysdep_aliases[] = {
+#ifdef USE_AIX
+#include "aliases_aix.h"
+#endif
+};
+#ifdef __GNUC__
+__inline
+#endif
+const struct alias *
+aliases2_lookup (register const char *str)
+{
+  struct alias * ptr;
+  unsigned int count;
+  for (ptr = sysdep_aliases, count = sizeof(sysdep_aliases)/sizeof(sysdep_aliases[0]); count > 0; ptr++, count--)
+    if (!strcmp(str,ptr->name))
+      return ptr;
+  return NULL;
+}
+#else
+#define aliases2_lookup(str)  NULL
+#endif
 
 #if 0
 /* Like !strcasecmp, except that the both strings can be assumed to be ASCII
diff --git a/src/use_aliases2.h b/src/use_aliases2.h
deleted file mode 100644
index 701c5cf..0000000
--- a/src/use_aliases2.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* Define macros indicating which system dependent encodings should be used. */
-
-#ifdef _AIX
-#define USE_AIX
-#endif