diff -uN octave-3.8.1/libgnu/stdio.in.h.ORG octave-3.8.1/libgnu/stdio.in.h
--- octave-3.8.1/libgnu/stdio.in.h.ORG	2014-03-07 04:41:35.000000000 +0900
+++ octave-3.8.1/libgnu/stdio.in.h	2014-09-10 14:18:27.932433000 +0900
@@ -717,10 +717,12 @@
 /* It is very rare that the developer ever has full control of stdin,
    so any use of gets warrants an unconditional warning; besides, C11
    removed it.  */
+#ifndef __sun
 #undef gets
 #if HAVE_RAW_DECL_GETS
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 #endif
+#endif
 
 
 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
diff -uN octave-3.8.1/libgnu/sys_select.in.h.ORG octave-3.8.1/libgnu/sys_select.in.h
--- octave-3.8.1/libgnu/sys_select.in.h.ORG	2014-03-07 04:41:35.000000000 +0900
+++ octave-3.8.1/libgnu/sys_select.in.h	2014-09-10 14:18:27.938964000 +0900
@@ -27,7 +27,7 @@
      && ((defined __osf__ && defined _SYS_TYPES_H_                      \
           && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H         \
           && defined _OSF_SOURCE)                                       \
-         || (defined __sun && defined _SYS_TYPES_H                      \
+         || (!defined __sun && defined _SYS_TYPES_H                      \
              && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE)   \
                  || defined __EXTENSIONS__))))
 
@@ -39,7 +39,7 @@
            || (defined __osf__ && defined _SYS_TIME_H_                  \
                && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H    \
                && defined _OSF_SOURCE)                                  \
-           || (defined __sun && defined _SYS_TIME_H                     \
+           || (!defined __sun && defined _SYS_TIME_H                     \
                && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
                    || defined __EXTENSIONS__))))
 
diff -uN octave-3.8.1/libgui/Makefile.in.ORG octave-3.8.1/libgui/Makefile.in
--- octave-3.8.1/libgui/Makefile.in.ORG	2014-03-07 04:42:51.000000000 +0900
+++ octave-3.8.1/libgui/Makefile.in	2014-09-10 14:18:28.779698000 +0900
@@ -602,7 +602,7 @@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
+CXXFLAGS = @CXXFLAGS@ -DHAVE_UTMPX -DHAVE_SYS_STROPTS_H
 CXXPICFLAG = @CXXPICFLAG@
 CXX_VERSION = @CXX_VERSION@
 CYGPATH_W = @CYGPATH_W@
diff -uN octave-3.8.1/libinterp/corefcn/oct-stream.cc.ORG octave-3.8.1/libinterp/corefcn/oct-stream.cc
--- octave-3.8.1/libinterp/corefcn/oct-stream.cc.ORG	2014-03-07 04:37:50.000000000 +0900
+++ octave-3.8.1/libinterp/corefcn/oct-stream.cc	2014-09-10 14:18:30.434600000 +0900
@@ -3653,7 +3653,9 @@
 INSTANTIATE_WRITE (int64_t);
 INSTANTIATE_WRITE (uint64_t);
 INSTANTIATE_WRITE (bool);
+#if 0
 INSTANTIATE_WRITE (char);
+#endif
 INSTANTIATE_WRITE (float);
 INSTANTIATE_WRITE (double);
 
diff -uN octave-3.8.1/test/build-sparse-tests.sh.ORG octave-3.8.1/test/build-sparse-tests.sh
--- octave-3.8.1/test/build-sparse-tests.sh.ORG	2014-03-07 04:37:51.000000000 +0900
+++ octave-3.8.1/test/build-sparse-tests.sh	2014-09-10 14:20:57.662976000 +0900
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Copyright (C) 2006-2013 David Bateman
 #
diff -uN octave-3.8.1/test/build-bc-overload-tests.sh.ORG octave-3.8.1/test/build-bc-overload-tests.sh
--- octave-3.8.1/test/build-bc-overload-tests.sh.ORG	2014-03-07 04:37:51.000000000 +0900
+++ octave-3.8.1/test/build-bc-overload-tests.sh	2014-09-10 14:20:47.287795000 +0900
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 # Copyright (C) 2010-2013 VZLU Prague
 #
diff -uN octave-3.8.1/doc/interpreter/config-images.sh.ORG octave-3.8.1/doc/interpreter/config-images.sh
--- octave-3.8.1/doc/interpreter/config-images.sh.ORG	2014-03-07 04:37:51.000000000 +0900
+++ octave-3.8.1/doc/interpreter/config-images.sh	2014-09-10 14:21:17.617462000 +0900
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 set -e
 
diff -uN octave-3.8.1/doc/interpreter/find-docstring-files.sh.ORG octave-3.8.1/doc/interpreter/find-docstring-files.sh
--- octave-3.8.1/doc/interpreter/find-docstring-files.sh.ORG	2014-03-07 04:37:51.000000000 +0900
+++ octave-3.8.1/doc/interpreter/find-docstring-files.sh	2014-09-10 14:21:35.215922000 +0900
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 if [ $# -ne 1 ]; then
   echo "usage: find-docstring-files TOP-SRCDIR" 1>&2
diff -uN octave-3.8.1/build-aux/find-files-with-tests.sh.ORG octave-3.8.1/build-aux/find-files-with-tests.sh
--- octave-3.8.1/build-aux/find-files-with-tests.sh.ORG	2014-03-07 04:37:50.000000000 +0900
+++ octave-3.8.1/build-aux/find-files-with-tests.sh	2014-09-10 14:21:51.128057000 +0900
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 set -e
 GREP=${GREP:-grep}
diff -uN octave-3.8.1/liboctave/operators/config-ops.sh.ORG octave-3.8.1/liboctave/operators/config-ops.sh
--- octave-3.8.1/liboctave/operators/config-ops.sh.ORG	2014-03-07 04:37:51.000000000 +0900
+++ octave-3.8.1/liboctave/operators/config-ops.sh	2014-09-10 14:22:42.715972000 +0900
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 set -e
 
diff -uN octave-3.8.1/libinterp/find-defun-files.sh.ORG octave-3.8.1/libinterp/find-defun-files.sh
--- octave-3.8.1/libinterp/find-defun-files.sh.ORG	2014-03-07 04:37:51.000000000 +0900
+++ octave-3.8.1/libinterp/find-defun-files.sh	2014-09-10 14:23:02.409932000 +0900
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 set -e
 SED=${SED:-sed}
diff -uN octave-3.8.1/libinterp/config-features.sh.ORG octave-3.8.1/libinterp/config-features.sh
--- octave-3.8.1/libinterp/config-features.sh.ORG	2014-03-07 04:37:51.000000000 +0900
+++ octave-3.8.1/libinterp/config-features.sh	2014-09-10 14:22:57.412076000 +0900
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 set -e
 AWK=${AWK:-awk}
diff -uN octave-3.8.1/libinterp/dldfcn/config-module.sh.ORG octave-3.8.1/libinterp/dldfcn/config-module.sh
--- octave-3.8.1/libinterp/dldfcn/config-module.sh.ORG	2014-03-07 04:37:51.000000000 +0900
+++ octave-3.8.1/libinterp/dldfcn/config-module.sh	2014-09-10 14:23:15.853919000 +0900
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 set -e
 
