diff -EbuNr --strip-trailing-cr bin/autoupdate.in.org bin/autoupdate.in
--- bin/autoupdate.in.org	2006-10-16 13:58:24.000000000 +0900
+++ bin/autoupdate.in	2008-03-29 18:21:48.000000000 +0900
@@ -141,7 +141,7 @@
   my $macros = new Autom4te::XFile ("$autoconf"
 				    . " --trace AU_DEFINE:'AU:\$f:\$1'"
 				    . " --trace define:'AC:\$f:\$1'"
-				    . " --melt /dev/null |");
+				    . " --melt |");
   while ($_ = $macros->getline)
     {
       chomp;
@@ -234,7 +234,7 @@
 
 # au.m4 -- definitions the AU macros.
 xsystem ("$autoconf --trace AU_DEFINE:'_au_defun(\@<:\@\$1\@:>\@,
-\@<:\@\$2\@:>\@)' --melt /dev/null "
+\@<:\@\$2\@:>\@)' --melt "
 	. ">$tmp/au.m4");
 
 
diff -EbuNr --strip-trailing-cr lib/autoconf/c.m4.org lib/autoconf/c.m4
--- lib/autoconf/c.m4.org	2006-11-08 01:26:24.000000000 +0900
+++ lib/autoconf/c.m4	2008-03-29 18:36:16.000000000 +0900
@@ -578,7 +578,10 @@
   [ac_save_c_werror_flag=$ac_c_werror_flag
    ac_c_werror_flag=yes
    ac_cv_prog_cc_g=no
-   CFLAGS="-g"
+   dnl On OS/2 $ac_objext might depend on CFLAGS, so "gcc -c -g" might fail because
+   dnl the object file can not be found, but "gcc -c -g $CFLAGS" will succeed.
+   dnl CFLAGS="-g"
+   CFLAGS="$CFLAGS -g"
    _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
      [ac_cv_prog_cc_g=yes],
      [CFLAGS=""
diff -EbuNr --strip-trailing-cr lib/autoconf/general.m4.org lib/autoconf/general.m4
--- lib/autoconf/general.m4.org	2006-11-16 17:37:34.000000000 +0900
+++ lib/autoconf/general.m4	2008-03-29 18:36:16.000000000 +0900
@@ -886,7 +886,7 @@
 do
   eval ac_val=\$$ac_var
   case $ac_val in
-    [[\\/$]]* | ?:[[\\/]]* )  continue;;
+    [[\\/$]]* | ?:[[\\/]]* | ?: )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
   AC_MSG_ERROR([expected an absolute directory name for --$ac_var: $ac_val])
@@ -1782,6 +1782,35 @@
     . "$ac_site_file"
   fi
 done
+# Backslashes into forward slashes:
+# The following OS/2 specific code is performed AFTER config.site
+# has been loaded to allow users to change their environment there.
+# This strange code is necessary to deal with handling of backslashes by ksh.
+
+if test "$ac_emxsupport" != "no" -a "$ac_emxsupport" != "NO"; then
+  ac_save_IFS="$IFS"
+  IFS="\\"
+  ac_TEMP_PATH=
+  for ac_dir in $PATH; do
+    IFS=$ac_save_IFS
+    if test -z "$ac_TEMP_PATH"; then
+      ac_TEMP_PATH="$ac_dir"
+    else
+      ac_TEMP_PATH="$ac_TEMP_PATH/$ac_dir"
+    fi
+  done
+  export PATH="$ac_TEMP_PATH"
+  unset ac_TEMP_PATH
+fi
+
+# set ac_executable_extensions!
+if ls.exe --version >/dev/null 2>/dev/null; then
+  if test "$ac_executable_extensions" = ""; then
+    AC_MSG_WARN([ac_executable_extensions not set, assuming .exe])
+    ac_executable_extensions=".exe"
+    export ac_executable_extensions
+  fi
+fi
 ])
 
 
diff -EbuNr --strip-trailing-cr lib/autoconf/libs.m4.org lib/autoconf/libs.m4
--- lib/autoconf/libs.m4.org	2006-10-14 18:12:04.000000000 +0900
+++ lib/autoconf/libs.m4	2008-03-29 18:36:14.000000000 +0900
@@ -125,11 +125,25 @@
 	      [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl
 AC_CACHE_CHECK([for $2 in -l$1], [ac_Lib],
 [ac_check_lib_save_LIBS=$LIBS
+dnl special treatment for EMX (OS/2) because AC_CHECK_LIB can fail if FUNCTION is already in libc
+if test "$ac_emxsupport" = no; then
+  AS_VAR_SET(ac_Lib, not_in_libc)
+else
+dnl check whether the function is already in libc
+AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
+           [AS_VAR_SET(ac_Lib, no)],
+           [AS_VAR_SET(ac_Lib, not_in_libc)])
+fi
+dnl if function is not in libc or if $ac_emxsupport=no was specified try to link with that library
+AS_IF([test AS_VAR_GET(ac_Lib) = not_in_libc],
+[
 LIBS="-l$1 $5 $LIBS"
 AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
 	       [AS_VAR_SET([ac_Lib], [yes])],
 	       [AS_VAR_SET([ac_Lib], [no])])
-LIBS=$ac_check_lib_save_LIBS])
+])
+LIBS=$ac_check_lib_save_LIBS]) dnl end of AC_CACHE_CHECK
+
 AS_IF([test AS_VAR_GET([ac_Lib]) = yes],
       [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
   LIBS="-l$1 $LIBS"
