diff --git a/autogen.cmd b/autogen.cmd
new file mode 100755
index 0000000..fe21757
--- /dev/null
+++ b/autogen.cmd
@@ -0,0 +1,3 @@
+extproc sh
+
+./autogen.sh --skip-gnulib
diff --git a/build-aux/moopp b/build-aux/moopp
index 96a50a6..0e2dbb1 100755
--- a/build-aux/moopp
+++ b/build-aux/moopp
@@ -306,12 +306,12 @@ func_check_header_syntax ()
   }
   class_end_lineno=`expr $methods_lineno + $class_end_lineno`
   sed_extract_methods="$class_end_lineno"',$d;1,'"$methods_lineno"'d'
-  methods=`sed -e "$sed_remove_comments" < "$file" | sed -e "$sed_extract_methods" | tr '\n' ' ' | tr ';' '\n' | sed -e 's,[ 	]*$,,'`
+  methods=`sed -e "$sed_remove_comments" < "$file" | sed -e "$sed_extract_methods" | tr '\r\n' '  ' | tr ';' '\n' | sed -e 's,[ 	]*$,,'`
   sed_remove_valid_arg1_lines='/([ 	]*'"$classname"'_t[ 	]*[A-Za-z_0-9]*[ 	]*[,)]/d'
   sed_extract_method_name='s,^.*[^A-Za-z_0-9]\([A-Za-z_0-9][A-Za-z_0-9]*\)[ 	]*(.*$,\1,'
   methods_with_bad_arg1=`echo "$methods" | sed -e "$sed_remove_empty_lines" -e "$sed_remove_valid_arg1_lines" -e "$sed_extract_method_name"`
   if test -n "$methods_with_bad_arg1"; then
-    methods_with_bad_arg1=`{ echo "$methods_with_bad_arg1" | sed -e 's/$/, /' | tr -d '\n'; echo; } | sed -e 's/\(, \)*$//'`
+    methods_with_bad_arg1=`{ echo "$methods_with_bad_arg1" | sed -e 's/$/, /' | tr -d '\r\n'; echo; } | sed -e 's/\(, \)*$//'`
     func_fatal_error "$file: some methods don't have a first argument of type ${classname}_t: $methods_with_bad_arg1"
   fi
 }
diff --git a/configure.cmd b/configure.cmd
new file mode 100755
index 0000000..802189f
--- /dev/null
+++ b/configure.cmd
@@ -0,0 +1,7 @@
+extproc sh
+
+./configure --prefix=/usr \
+            --enable-shared \
+            --enable-static \
+            --disable-relocatable \
+            --with-included-gettext
diff --git a/gettext-runtime/configure.ac b/gettext-runtime/configure.ac
index e9299b6..77e954b 100644
--- a/gettext-runtime/configure.ac
+++ b/gettext-runtime/configure.ac
@@ -102,7 +102,7 @@ AH_BOTTOM([
 #endif
 
 /* Extra OS/2 (emx+gcc) defines.  */
-#ifdef __EMX__
+#if defined __EMX__ && !defined __KLIBC__
 # include "intl/os2compat.h"
 #endif
 ])
diff --git a/gettext-runtime/gnulib-lib/stdint.in.h b/gettext-runtime/gnulib-lib/stdint.in.h
index 378de2e..92e5038 100644
--- a/gettext-runtime/gnulib-lib/stdint.in.h
+++ b/gettext-runtime/gnulib-lib/stdint.in.h
@@ -290,8 +290,15 @@ typedef gl_uint_fast32_t gl_uint_fast16_t;
 
 #undef intptr_t
 #undef uintptr_t
+#ifndef __KLIBC__
 typedef long int gl_intptr_t;
 typedef unsigned long int gl_uintptr_t;
+#else
+/* intptr_t and uintptr_t are defined as int and unsigned int on OS/2 kLIBC,
+   respectively */
+typedef int gl_intptr_t;
+typedef unsigned int gl_uintptr_t;
+#endif
 #define intptr_t gl_intptr_t
 #define uintptr_t gl_uintptr_t
 
diff --git a/gettext-runtime/gnulib-lib/wchar.in.h b/gettext-runtime/gnulib-lib/wchar.in.h
index 684299f..7905bc7 100644
--- a/gettext-runtime/gnulib-lib/wchar.in.h
+++ b/gettext-runtime/gnulib-lib/wchar.in.h
@@ -31,7 +31,7 @@
 @PRAGMA_COLUMNS@
 
 #if (((defined __need_mbstate_t || defined __need_wint_t)               \
-      && !defined __MINGW32__)                                          \
+      && !defined __MINGW32__ && !defined __KLIBC__)                    \
      || (defined __hpux                                                 \
          && ((defined _INTTYPES_INCLUDED && !defined strtoimax)         \
              || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
@@ -445,6 +445,10 @@ _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
 #  if !@HAVE_DECL_WCWIDTH@
 /* wcwidth exists but is not declared.  */
 _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
+#  elif defined __KLIBC__
+/* On OS/2 kLIBC, wcwidth is a macro to static inline function. Implementation
+   of wcwidth in wcwidth.c causes 'conflicting types' error. */
+#   undef wcwidth
 #  endif
 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
 # endif
diff --git a/gettext-runtime/intl/bindtextdom.c b/gettext-runtime/intl/bindtextdom.c
index 887393c..0d530be 100644
--- a/gettext-runtime/intl/bindtextdom.c
+++ b/gettext-runtime/intl/bindtextdom.c
@@ -317,7 +317,32 @@ set_binding_values (const char *domainname,
 char *
 BINDTEXTDOMAIN (const char *domainname, const char *dirname)
 {
+#ifdef __EMX__
+  const char *saved_dirname = dirname;
+  char dirname_with_drive[_MAX_PATH];
+
+  if (dirname && (dirname[0] == '/' || dirname[0] == '\\' ))
+    {
+      const char *unixroot = getenv ("UNIXROOT");
+      size_t len = strlen (dirname) + 1;
+
+      if (unixroot
+          && unixroot[0] != '\0'
+          && unixroot[1] == ':'
+          && unixroot[2] == '\0'
+          && 2 + len <= _MAX_PATH)
+        {
+          memcpy (dirname_with_drive, unixroot, 2);
+          memcpy (dirname_with_drive + 2, dirname, len);
+
+          dirname = dirname_with_drive;
+        }
+    }
+#endif
   set_binding_values (domainname, &dirname, NULL);
+#ifdef __EMX__
+  dirname = saved_dirname;
+#endif
   return (char *) dirname;
 }
 
diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c
index 8a3f091..c0faf18 100644
--- a/gettext-runtime/intl/dcigettext.c
+++ b/gettext-runtime/intl/dcigettext.c
@@ -323,7 +323,7 @@ const char *_nl_current_default_domain attribute_hidden
 #endif
 
 /* Contains the default location of the message catalogs.  */
-#if defined __EMX__
+#if defined __EMX__ && !defined __KLIBC__
 extern const char _nl_default_dirname[];
 #else
 # ifdef _LIBC
diff --git a/gettext-runtime/intl/gettextP.h b/gettext-runtime/intl/gettextP.h
index bbd2139..f3a9ded 100644
--- a/gettext-runtime/intl/gettextP.h
+++ b/gettext-runtime/intl/gettextP.h
@@ -219,6 +219,9 @@ struct binding
 /* A counter which is incremented each time some previous translations
    become invalid.
    This variable is part of the external ABI of the GNU libintl.  */
+#if defined __KLIBC__ && !defined _LIBC
+# define _nl_msg_cat_cntr libintl_nl_msg_cat_cntr
+#endif
 #ifdef IN_LIBGLOCALE
 # include <glocale/config.h>
 extern LIBGLOCALE_DLL_EXPORTED int _nl_msg_cat_cntr;
diff --git a/gettext-runtime/intl/osdep.c b/gettext-runtime/intl/osdep.c
index 25f8dfa..eda9d28 100644
--- a/gettext-runtime/intl/osdep.c
+++ b/gettext-runtime/intl/osdep.c
@@ -16,7 +16,7 @@
 
 #if defined __CYGWIN__ || defined __MINGW32__
 # include "intl-exports.c"
-#elif defined __EMX__
+#elif defined __EMX__ && !defined __KLIBC__
 # include "os2compat.c"
 #else
 /* Avoid AIX compiler warning.  */
diff --git a/gettext-runtime/libasprintf/configure.ac b/gettext-runtime/libasprintf/configure.ac
index a7c2811..659e414 100644
--- a/gettext-runtime/libasprintf/configure.ac
+++ b/gettext-runtime/libasprintf/configure.ac
@@ -44,7 +44,7 @@ LT_INIT([win32-dll])
 case "$host_os" in
   # On Cygwin, without -no-undefined, a warning is emitted and only a static
   # library is built.
-  beos* | mingw* | cygwin*) LTNOUNDEF='-no-undefined' ;;
+  beos* | mingw* | cygwin* | os2*) LTNOUNDEF='-no-undefined' ;;
   *) LTNOUNDEF='' ;;
 esac
 AC_SUBST([LTNOUNDEF])
diff --git a/gettext-runtime/tests/test-lock.c b/gettext-runtime/tests/test-lock.c
index 0be81f2..ec5695c 100644
--- a/gettext-runtime/tests/test-lock.c
+++ b/gettext-runtime/tests/test-lock.c
@@ -81,7 +81,11 @@
 
 #if TEST_POSIX_THREADS
 # include <pthread.h>
-# include <sched.h>
+# ifndef __KLIBC__
+#  include <sched.h>
+# else
+#  define sched_yield() pthread_yield()
+# endif
 typedef pthread_t gl_thread_t;
 static inline gl_thread_t gl_thread_create (void * (*func) (void *), void *arg)
 {
diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac
index 920eeb6..d9a2788 100644
--- a/gettext-tools/configure.ac
+++ b/gettext-tools/configure.ac
@@ -105,6 +105,8 @@ case "$host_os" in
 esac
 AM_CONDITIONAL([WOE32], [test $is_woe32 = yes])
 
+AM_CONDITIONAL([OS2], [test "${host_os#os2}" != "${host_os}"])
+
 dnl On Cygwin 1.7.10-1 or later, error_* variables are defined in the
 dnl Cygwin DLL.  To avoid any conflict with gettext DLLs, always link
 dnl to gnulib's error.c.  See GETTEXTLIB_EXPORTS_FLAGS setting below.
@@ -286,7 +288,7 @@ AH_BOTTOM([
 #endif
 
 /* Extra OS/2 (emx+gcc) defines.  */
-#ifdef __EMX__
+#if defined __EMX__ && !defined __KLIBC__
 # include "intl/os2compat.h"
 #endif
 ])
diff --git a/gettext-tools/examples/hello-c++-kde/admin/configure.in.min b/gettext-tools/examples/hello-c++-kde/admin/configure.in.min
index 7c7e25a..0f025bd 100644
--- a/gettext-tools/examples/hello-c++-kde/admin/configure.in.min
+++ b/gettext-tools/examples/hello-c++-kde/admin/configure.in.min
@@ -41,7 +41,7 @@ AM_INIT_AUTOMAKE(@MODULENAME@, @VERSION@) dnl searches for some needed programs
 KDE_SET_PREFIX
 
 dnl generate the config header
-AM_CONFIG_HEADER(config.h) dnl at the distribution this done
+AC_CONFIG_HEADER(config.h) dnl at the distribution this done
 
 dnl Checks for programs.
 AC_CHECK_COMPILERS
diff --git a/gettext-tools/examples/hello-c++-kde/admin/cvs.sh b/gettext-tools/examples/hello-c++-kde/admin/cvs.sh
index a39fddd..52eabb7 100644
--- a/gettext-tools/examples/hello-c++-kde/admin/cvs.sh
+++ b/gettext-tools/examples/hello-c++-kde/admin/cvs.sh
@@ -113,7 +113,7 @@ $ACLOCAL || exit 1
 echo "*** Creating configure"
 call_and_fix_autoconf
 
-if egrep "^AM_CONFIG_HEADER" configure.in >/dev/null 2>&1; then
+if egrep "^AC_CONFIG_HEADER" configure.in >/dev/null 2>&1; then
   echo "*** Creating config.h template"
   $AUTOHEADER || exit 1
 fi
diff --git a/gettext-tools/gnulib-lib/Makefile.am b/gettext-tools/gnulib-lib/Makefile.am
index 9e43721..c930367 100644
--- a/gettext-tools/gnulib-lib/Makefile.am
+++ b/gettext-tools/gnulib-lib/Makefile.am
@@ -61,6 +61,11 @@ include Makefile.gnulib
 # Which classes to export from the shared library.
 MOOPPFLAGS += --dllexport=styled_ostream
 
+# OS/2 does not support a DLL name longer than 8 characters.
+if OS2
+libgettextlib_la_LDFLAGS += -os2dllname gtlib
+endif
+
 # Linking with C++ libraries is needed _only_ on mingw and Cygwin.
 if !WOE32DLL
 libgettextlib_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
diff --git a/gettext-tools/gnulib-lib/binary-io.h b/gettext-tools/gnulib-lib/binary-io.h
index f5b66c7..380ae98 100644
--- a/gettext-tools/gnulib-lib/binary-io.h
+++ b/gettext-tools/gnulib-lib/binary-io.h
@@ -60,7 +60,7 @@ set_binary_mode (int fd, int mode)
 
 /* SET_BINARY (fd);
    changes the file descriptor fd to perform binary I/O.  */
-#ifdef __DJGPP__
+#if defined __DJGPP__ || defined __EMX__
 # include <unistd.h> /* declares isatty() */
   /* Avoid putting stdin/stdout in binary mode if it is connected to
      the console, because that would make it impossible for the user
diff --git a/gettext-tools/gnulib-lib/pipe-filter-ii.c b/gettext-tools/gnulib-lib/pipe-filter-ii.c
index 88b0d0d..dc91179 100644
--- a/gettext-tools/gnulib-lib/pipe-filter-ii.c
+++ b/gettext-tools/gnulib-lib/pipe-filter-ii.c
@@ -27,6 +27,127 @@
 #include <unistd.h>
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 # include <windows.h>
+#elif defined __KLIBC__
+# define INCL_DOS
+# include <os2.h>
+
+/* Simple implementation of Win32 APIs */
+
+#define WINAPI
+
+typedef struct _HANDLE
+{
+    TID tid;
+    HEV hevDone;
+    unsigned int WINAPI (*start) (void *);
+    void *arg;
+} *HANDLE;
+
+typedef ULONG DWORD;
+
+static void
+start_wrapper (void *arg)
+{
+  HANDLE h = (HANDLE) arg;
+
+  h->start (h->arg);
+
+  DosPostEventSem (h->hevDone);
+  _endthread ();
+}
+
+static HANDLE
+_beginthreadex (void *s, unsigned n, unsigned int WINAPI (*start) (void *),
+                void *arg, unsigned fl, unsigned *th)
+{
+  HANDLE h;
+
+  h = malloc (sizeof (*h));
+  if (!h)
+    return NULL;
+
+  if (DosCreateEventSem (NULL, &h->hevDone, 0, FALSE ))
+    goto exit_free;
+
+  h->start = start;
+  h->arg   = arg;
+
+  h->tid = _beginthread (start_wrapper, NULL, n, (void *) h);
+  if (h->tid == -1)
+    goto exit_close_event_sem;
+
+  return h;
+
+exit_close_event_sem:
+  DosCloseEventSem (h->hevDone);
+
+exit_free:
+  free (h);
+
+  return NULL;
+}
+
+static BOOL
+CloseHandle (HANDLE h)
+{
+  DosCloseEventSem (h->hevDone);
+  free (h);
+}
+
+# define _endthreadex(x) return (x)
+# define TerminateThread(h, e) DosKillThread (h->tid)
+
+# define GetLastError()  -1
+
+# ifndef ERROR_NO_DATA
+#  define ERROR_NO_DATA 232
+# endif
+
+# define INFINITE       SEM_INDEFINITE_WAIT
+# define WAIT_OBJECT_0  0
+
+static DWORD
+WaitForSingleObject (HANDLE h, DWORD ms)
+{
+  return DosWaitEventSem (h->hevDone, ms) == 0 ? WAIT_OBJECT_0 : (DWORD) -1;
+}
+
+static DWORD
+WaitForMultipleObjects (DWORD nCount, const HANDLE *pHandles, BOOL bWaitAll,
+                        DWORD ms)
+{
+    HMUX       hmux;
+    PSEMRECORD psr;
+    ULONG      ulUser;
+    ULONG      rc = (ULONG) -1;
+    DWORD      i;
+
+    psr = malloc (sizeof (*psr) * nCount);
+    if (!psr)
+      goto exit_return;
+
+    for (i = 0; i < nCount; ++i)
+      {
+        psr[i].hsemCur = (HSEM) pHandles[i]->hevDone;
+        psr[i].ulUser  = WAIT_OBJECT_0 + i;
+      }
+
+    if (DosCreateMuxWaitSem (NULL, &hmux, nCount, psr,
+                             bWaitAll ? DCMW_WAIT_ALL : DCMW_WAIT_ANY))
+      goto exit_free;
+
+    rc = DosWaitMuxWaitSem (hmux, ms, &ulUser);
+    DosCloseMuxWaitSem (hmux);
+
+exit_free:
+    free (psr);
+
+exit_return:
+    if (rc)
+        return (DWORD) -1;
+
+    return ulUser;
+}
 #else
 # include <signal.h>
 # include <sys/select.h>
@@ -41,7 +162,7 @@
 
 #include "pipe-filter-aux.h"
 
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ || defined __KLIBC__
 
 struct locals
 {
@@ -143,7 +264,7 @@ pipe_filter_ii_execute (const char *progname,
 {
   pid_t child;
   int fd[2];
-#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ || defined __KLIBC__)
   struct sigaction orig_sigpipe_action;
 #endif
 
@@ -154,7 +275,7 @@ pipe_filter_ii_execute (const char *progname,
   if (child == -1)
     return -1;
 
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ || defined __KLIBC__
   /* Native Windows API.  */
   /* Pipes have a non-blocking mode, see function SetNamedPipeHandleState and
      the article "Named Pipe Type, Read, and Wait Modes", but Microsoft's
@@ -462,7 +583,7 @@ pipe_filter_ii_execute (const char *progname,
   {
     int saved_errno = errno;
     close (fd[1]);
-#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ || defined __KLIBC__)
     if (sigaction (SIGPIPE, &orig_sigpipe_action, NULL) < 0)
       abort ();
 #endif
diff --git a/gettext-tools/gnulib-lib/spawn-pipe.c b/gettext-tools/gnulib-lib/spawn-pipe.c
index a87844e..e98e470 100644
--- a/gettext-tools/gnulib-lib/spawn-pipe.c
+++ b/gettext-tools/gnulib-lib/spawn-pipe.c
@@ -35,7 +35,7 @@
 
 #define _(str) gettext (str)
 
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ || defined __KLIBC__
 
 /* Native Windows API.  */
 # include <process.h>
@@ -116,7 +116,7 @@ create_pipe (const char *progname,
              bool slave_process, bool exit_on_error,
              int fd[2])
 {
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ || defined __KLIBC__
 
   /* Native Windows API.
      This uses _pipe(), dup2(), and spawnv().  It could also be implemented
diff --git a/gettext-tools/gnulib-lib/spawn.in.h b/gettext-tools/gnulib-lib/spawn.in.h
index aa8222a..22b265e 100644
--- a/gettext-tools/gnulib-lib/spawn.in.h
+++ b/gettext-tools/gnulib-lib/spawn.in.h
@@ -32,7 +32,7 @@
 
 /* Get definitions of 'struct sched_param' and 'sigset_t'.
    But avoid namespace pollution on glibc systems.  */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
+#if !(defined __GLIBC__ && !defined __UCLIBC__) && !defined __KLIBC__
 # include <sched.h>
 # include <signal.h>
 #endif
diff --git a/gettext-tools/gnulib-lib/stdint.in.h b/gettext-tools/gnulib-lib/stdint.in.h
index 378de2e..92e5038 100644
--- a/gettext-tools/gnulib-lib/stdint.in.h
+++ b/gettext-tools/gnulib-lib/stdint.in.h
@@ -290,8 +290,15 @@ typedef gl_uint_fast32_t gl_uint_fast16_t;
 
 #undef intptr_t
 #undef uintptr_t
+#ifndef __KLIBC__
 typedef long int gl_intptr_t;
 typedef unsigned long int gl_uintptr_t;
+#else
+/* intptr_t and uintptr_t are defined as int and unsigned int on OS/2 kLIBC,
+   respectively */
+typedef int gl_intptr_t;
+typedef unsigned int gl_uintptr_t;
+#endif
 #define intptr_t gl_intptr_t
 #define uintptr_t gl_uintptr_t
 
diff --git a/gettext-tools/gnulib-lib/w32spawn.h b/gettext-tools/gnulib-lib/w32spawn.h
index 4a21a4e..ab76bbf 100644
--- a/gettext-tools/gnulib-lib/w32spawn.h
+++ b/gettext-tools/gnulib-lib/w32spawn.h
@@ -16,8 +16,10 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Get declarations of the native Windows API functions.  */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+#ifndef __KLIBC__
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
 
 /* Get _open_osfhandle().  */
 #include <io.h>
diff --git a/gettext-tools/gnulib-lib/wchar.in.h b/gettext-tools/gnulib-lib/wchar.in.h
index 684299f..7905bc7 100644
--- a/gettext-tools/gnulib-lib/wchar.in.h
+++ b/gettext-tools/gnulib-lib/wchar.in.h
@@ -31,7 +31,7 @@
 @PRAGMA_COLUMNS@
 
 #if (((defined __need_mbstate_t || defined __need_wint_t)               \
-      && !defined __MINGW32__)                                          \
+      && !defined __MINGW32__ && !defined __KLIBC__)                    \
      || (defined __hpux                                                 \
          && ((defined _INTTYPES_INCLUDED && !defined strtoimax)         \
              || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
@@ -445,6 +445,10 @@ _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
 #  if !@HAVE_DECL_WCWIDTH@
 /* wcwidth exists but is not declared.  */
 _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
+#  elif defined __KLIBC__
+/* On OS/2 kLIBC, wcwidth is a macro to static inline function. Implementation
+   of wcwidth in wcwidth.c causes 'conflicting types' error. */
+#   undef wcwidth
 #  endif
 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
 # endif
diff --git a/gettext-tools/libgettextpo/Makefile.am b/gettext-tools/libgettextpo/Makefile.am
index 5a4404d..7b26ac2 100644
--- a/gettext-tools/libgettextpo/Makefile.am
+++ b/gettext-tools/libgettextpo/Makefile.am
@@ -117,6 +117,11 @@ libgettextpo_la_SOURCES += ../woe32dll/gettextpo-exports.c
 libgettextpo_la_LDFLAGS += -Wl,--export-all-symbols
 endif
 
+# OS/2 does not support a DLL name longer than 8 characters.
+if OS2
+libgettextpo_la_LDFLAGS += -os2dllname gtpo
+endif
+
 # Version information according to Woe32 conventions.
 EXTRA_DIST += libgettextpo.rc
 if WOE32
diff --git a/gettext-tools/libgettextpo/stdint.in.h b/gettext-tools/libgettextpo/stdint.in.h
index 378de2e..92e5038 100644
--- a/gettext-tools/libgettextpo/stdint.in.h
+++ b/gettext-tools/libgettextpo/stdint.in.h
@@ -290,8 +290,15 @@ typedef gl_uint_fast32_t gl_uint_fast16_t;
 
 #undef intptr_t
 #undef uintptr_t
+#ifndef __KLIBC__
 typedef long int gl_intptr_t;
 typedef unsigned long int gl_uintptr_t;
+#else
+/* intptr_t and uintptr_t are defined as int and unsigned int on OS/2 kLIBC,
+   respectively */
+typedef int gl_intptr_t;
+typedef unsigned int gl_uintptr_t;
+#endif
 #define intptr_t gl_intptr_t
 #define uintptr_t gl_uintptr_t
 
diff --git a/gettext-tools/libgettextpo/wchar.in.h b/gettext-tools/libgettextpo/wchar.in.h
index 684299f..7905bc7 100644
--- a/gettext-tools/libgettextpo/wchar.in.h
+++ b/gettext-tools/libgettextpo/wchar.in.h
@@ -31,7 +31,7 @@
 @PRAGMA_COLUMNS@
 
 #if (((defined __need_mbstate_t || defined __need_wint_t)               \
-      && !defined __MINGW32__)                                          \
+      && !defined __MINGW32__ && !defined __KLIBC__)                    \
      || (defined __hpux                                                 \
          && ((defined _INTTYPES_INCLUDED && !defined strtoimax)         \
              || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H))               \
@@ -445,6 +445,10 @@ _GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
 #  if !@HAVE_DECL_WCWIDTH@
 /* wcwidth exists but is not declared.  */
 _GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
+#  elif defined __KLIBC__
+/* On OS/2 kLIBC, wcwidth is a macro to static inline function. Implementation
+   of wcwidth in wcwidth.c causes 'conflicting types' error. */
+#   undef wcwidth
 #  endif
 _GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
 # endif
diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am
index 61da5c4..d46d0f1 100644
--- a/gettext-tools/src/Makefile.am
+++ b/gettext-tools/src/Makefile.am
@@ -240,6 +240,9 @@ hostname_SOURCES = hostname.c
 urlget_SOURCES = urlget.c
 cldr_plurals_SOURCES = cldr-plural.y cldr-plural-exp.c cldr-plurals.c
 cldr_plurals_LDADD = libgettextsrc.la $(LDADD)
+if OS2
+cldr_plurals_LDADD += @LTLIBEXPAT@
+endif
 
 # How to build libgettextsrc.la.
 # Need ../gnulib-lib/libgettextlib.la.
@@ -253,6 +256,11 @@ libgettextsrc_la_LDFLAGS = \
   -release @VERSION@ \
   ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) @LTLIBINTL@ @LTLIBICONV@ @LTLIBEXPAT@ -lc -no-undefined
 
+# OS/2 does not support a DLL name longer than 8 characters.
+if OS2
+libgettextsrc_la_LDFLAGS += -os2dllname gtsrc
+endif
+
 libgettextsrc_la_CPPFLAGS = $(AM_CPPFLAGS)
 
 # Tell the mingw or Cygwin linker which symbols to export.
@@ -283,6 +291,9 @@ msgfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
 msgmerge_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @MSGMERGE_LIBM@ $(WOE32_LDADD) $(OPENMP_CFLAGS)
 msgunfmt_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
 xgettext_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ @LTLIBICONV@ $(WOE32_LDADD)
+if OS2
+xgettext_LDADD += @LTLIBEXPAT@
+endif
 msgattrib_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
 msgcat_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
 msgcomm_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@ $(WOE32_LDADD)
diff --git a/gnulib-local/build-aux/moopp b/gnulib-local/build-aux/moopp
old mode 100755
new mode 100644
index 96a50a6..0e2dbb1
--- a/gnulib-local/build-aux/moopp
+++ b/gnulib-local/build-aux/moopp
@@ -306,12 +306,12 @@ func_check_header_syntax ()
   }
   class_end_lineno=`expr $methods_lineno + $class_end_lineno`
   sed_extract_methods="$class_end_lineno"',$d;1,'"$methods_lineno"'d'
-  methods=`sed -e "$sed_remove_comments" < "$file" | sed -e "$sed_extract_methods" | tr '\n' ' ' | tr ';' '\n' | sed -e 's,[ 	]*$,,'`
+  methods=`sed -e "$sed_remove_comments" < "$file" | sed -e "$sed_extract_methods" | tr '\r\n' '  ' | tr ';' '\n' | sed -e 's,[ 	]*$,,'`
   sed_remove_valid_arg1_lines='/([ 	]*'"$classname"'_t[ 	]*[A-Za-z_0-9]*[ 	]*[,)]/d'
   sed_extract_method_name='s,^.*[^A-Za-z_0-9]\([A-Za-z_0-9][A-Za-z_0-9]*\)[ 	]*(.*$,\1,'
   methods_with_bad_arg1=`echo "$methods" | sed -e "$sed_remove_empty_lines" -e "$sed_remove_valid_arg1_lines" -e "$sed_extract_method_name"`
   if test -n "$methods_with_bad_arg1"; then
-    methods_with_bad_arg1=`{ echo "$methods_with_bad_arg1" | sed -e 's/$/, /' | tr -d '\n'; echo; } | sed -e 's/\(, \)*$//'`
+    methods_with_bad_arg1=`{ echo "$methods_with_bad_arg1" | sed -e 's/$/, /' | tr -d '\r\n'; echo; } | sed -e 's/\(, \)*$//'`
     func_fatal_error "$file: some methods don't have a first argument of type ${classname}_t: $methods_with_bad_arg1"
   fi
 }
