From c7b2a10912ca3c427207d950346d2061bcff13a6 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 2 Aug 2007 00:04:35 +0000
Subject: [PATCH] Added new srun option --pty to start job with pseudo terminal
 attached     to task 0 (all other tasks have I/O discarded)

---
 Makefile.in                                   |   1 +
 NEWS                                          |   5 +
 auxdir/Makefile.in                            |   1 +
 config.h.in                                   |   6 +
 configure                                     | 131 ++++++++++++++----
 configure.ac                                  |   9 +-
 doc/Makefile.in                               |   1 +
 doc/html/Makefile.in                          |   1 +
 doc/man/Makefile.in                           |   1 +
 doc/man/man1/srun.1                           |  11 +-
 src/Makefile.in                               |   1 +
 src/api/Makefile.in                           |   1 +
 src/common/Makefile.in                        |   1 +
 src/common/slurm_protocol_defs.h              |   1 +
 src/common/slurm_protocol_pack.c              |   2 +
 src/plugins/Makefile.in                       |   1 +
 src/plugins/auth/Makefile.in                  |   1 +
 src/plugins/auth/authd/Makefile.in            |   1 +
 src/plugins/auth/munge/Makefile.in            |   1 +
 src/plugins/auth/none/Makefile.in             |   1 +
 src/plugins/checkpoint/Makefile.in            |   1 +
 src/plugins/checkpoint/aix/Makefile.in        |   1 +
 src/plugins/checkpoint/none/Makefile.in       |   1 +
 src/plugins/crypto/Makefile.in                |   1 +
 src/plugins/crypto/munge/Makefile.in          |   1 +
 src/plugins/crypto/openssl/Makefile.in        |   1 +
 src/plugins/database/Makefile.in              |   1 +
 src/plugins/database/flatfile/Makefile.in     |   1 +
 src/plugins/database/mysql/Makefile.in        |   1 +
 src/plugins/database/pgsql/Makefile.in        |   1 +
 src/plugins/jobacct/Makefile.in               |   1 +
 src/plugins/jobacct/aix/Makefile.in           |   1 +
 src/plugins/jobacct/linux/Makefile.in         |   1 +
 src/plugins/jobacct/none/Makefile.in          |   1 +
 src/plugins/jobcomp/Makefile.in               |   1 +
 src/plugins/jobcomp/database/Makefile.in      |   1 +
 src/plugins/jobcomp/filetxt/Makefile.in       |   1 +
 src/plugins/jobcomp/none/Makefile.in          |   1 +
 src/plugins/jobcomp/script/Makefile.in        |   1 +
 src/plugins/mpi/Makefile.in                   |   1 +
 src/plugins/mpi/lam/Makefile.in               |   1 +
 src/plugins/mpi/mpich1_p4/Makefile.in         |   1 +
 src/plugins/mpi/mpich1_shmem/Makefile.in      |   1 +
 src/plugins/mpi/mpichgm/Makefile.in           |   1 +
 src/plugins/mpi/mvapich/Makefile.in           |   1 +
 src/plugins/mpi/none/Makefile.in              |   1 +
 src/plugins/mpi/openmpi/Makefile.in           |   1 +
 src/plugins/proctrack/Makefile.in             |   1 +
 src/plugins/proctrack/aix/Makefile.in         |   1 +
 src/plugins/proctrack/linuxproc/Makefile.in   |   1 +
 src/plugins/proctrack/pgid/Makefile.in        |   1 +
 src/plugins/proctrack/rms/Makefile.in         |   1 +
 src/plugins/proctrack/sgi_job/Makefile.in     |   1 +
 src/plugins/sched/Makefile.in                 |   1 +
 src/plugins/sched/backfill/Makefile.in        |   1 +
 src/plugins/sched/builtin/Makefile.in         |   1 +
 src/plugins/sched/gang/Makefile.in            |   1 +
 src/plugins/sched/hold/Makefile.in            |   1 +
 src/plugins/sched/wiki/Makefile.in            |   1 +
 src/plugins/sched/wiki2/Makefile.in           |   1 +
 src/plugins/select/Makefile.in                |   1 +
 src/plugins/select/bluegene/Makefile.in       |   1 +
 .../bluegene/block_allocator/Makefile.in      |   1 +
 .../select/bluegene/plugin/Makefile.in        |   1 +
 src/plugins/select/cons_res/Makefile.in       |   1 +
 src/plugins/select/linear/Makefile.in         |   1 +
 src/plugins/switch/Makefile.in                |   1 +
 src/plugins/switch/elan/Makefile.in           |   1 +
 src/plugins/switch/federation/Makefile.in     |   1 +
 src/plugins/switch/none/Makefile.in           |   1 +
 src/plugins/task/Makefile.in                  |   1 +
 src/plugins/task/affinity/Makefile.in         |   1 +
 src/plugins/task/none/Makefile.in             |   1 +
 src/sacct/Makefile.in                         |   1 +
 src/salloc/Makefile.in                        |   1 +
 src/sattach/Makefile.in                       |   1 +
 src/sbatch/Makefile.in                        |   1 +
 src/sbcast/Makefile.in                        |   1 +
 src/scancel/Makefile.in                       |   1 +
 src/scontrol/Makefile.in                      |   1 +
 src/sinfo/Makefile.in                         |   1 +
 src/slaunch/Makefile.in                       |   1 +
 src/slurmctld/Makefile.in                     |   1 +
 src/slurmd/Makefile.in                        |   1 +
 src/slurmd/slurmd/Makefile.in                 |   1 +
 src/slurmd/slurmstepd/Makefile.am             |   2 +-
 src/slurmd/slurmstepd/Makefile.in             |   6 +-
 src/slurmd/slurmstepd/io.c                    |  91 ++++++++++--
 src/slurmd/slurmstepd/slurmstepd_job.c        |   3 +-
 src/slurmd/slurmstepd/slurmstepd_job.h        |   2 +-
 src/smap/Makefile.in                          |   1 +
 src/squeue/Makefile.in                        |   1 +
 src/srun/Makefile.in                          |   1 +
 src/srun/launch.c                             |   5 +-
 src/srun/opt.c                                |  20 +++
 src/srun/opt.h                                |   1 +
 src/srun/srun.c                               |  38 ++++-
 src/strigger/Makefile.in                      |   1 +
 src/sview/Makefile.in                         |   1 +
 testsuite/Makefile.in                         |   1 +
 testsuite/expect/Makefile.in                  |   1 +
 testsuite/slurm_unit/Makefile.in              |   1 +
 testsuite/slurm_unit/api/Makefile.in          |   1 +
 testsuite/slurm_unit/api/manual/Makefile.in   |   1 +
 testsuite/slurm_unit/common/Makefile.in       |   1 +
 testsuite/slurm_unit/slurmctld/Makefile.in    |   1 +
 testsuite/slurm_unit/slurmd/Makefile.in       |   1 +
 107 files changed, 368 insertions(+), 56 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index f7374855fca..e82c6560cc4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -207,6 +207,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/NEWS b/NEWS
index 27f95106134..092a816c376 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,11 @@
 This file describes changes in recent versions of SLURM. It primarily
 documents those changes that are of interest to users and admins.
 
+* Changes in SLURM 1.3.0-pre2
+=============================
+ -- Added new srun option --pty to start job with pseudo terminal attached 
+    to task 0 (all other tasks have I/O discarded)
+
 * Changes in SLURM 1.3.0-pre1
 =============================
  -- !!! SRUN CHANGES !!!
diff --git a/auxdir/Makefile.in b/auxdir/Makefile.in
index 95522e44c0e..700a8452070 100644
--- a/auxdir/Makefile.in
+++ b/auxdir/Makefile.in
@@ -170,6 +170,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/config.h.in b/config.h.in
index 760131f7186..9dac6917485 100644
--- a/config.h.in
+++ b/config.h.in
@@ -143,6 +143,9 @@
 /* Define to 1 if you have the `ptrace64' function. */
 #undef HAVE_PTRACE64
 
+/* Define to 1 if you have the <pty.h> header file. */
+#undef HAVE_PTY_H
+
 /* Define if you are compiling with readline. */
 #undef HAVE_READLINE
 
@@ -239,6 +242,9 @@
 /* Define to 1 if you have the `unsetenv' function. */
 #undef HAVE_UNSETENV
 
+/* Define to 1 if you have the <utmp.h> header file. */
+#undef HAVE_UTMP_H
+
 /* Define to 1 if you have the <values.h> header file. */
 #undef HAVE_VALUES_H
 
diff --git a/configure b/configure
index 4e9c0917233..84da9d9dbcd 100755
--- a/configure
+++ b/configure
@@ -958,6 +958,7 @@ AUTHD_LIBS
 AUTHD_CFLAGS
 WITH_AUTHD_TRUE
 WITH_AUTHD_FALSE
+UTIL_LIBS
 LTLIBOBJS'
 ac_subst_files=''
       ac_precious_vars='build_alias
@@ -7092,7 +7093,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 7095 "configure"' > conftest.$ac_ext
+  echo '#line 7096 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -8872,11 +8873,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8875: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8876: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8879: \$? = $ac_status" >&5
+   echo "$as_me:8880: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -9140,11 +9141,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9143: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9144: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:9147: \$? = $ac_status" >&5
+   echo "$as_me:9148: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -9244,11 +9245,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9247: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9248: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:9251: \$? = $ac_status" >&5
+   echo "$as_me:9252: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -11541,7 +11542,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 11544 "configure"
+#line 11545 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11641,7 +11642,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 11644 "configure"
+#line 11645 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13977,11 +13978,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13980: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13981: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13984: \$? = $ac_status" >&5
+   echo "$as_me:13985: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14081,11 +14082,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14084: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14085: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14088: \$? = $ac_status" >&5
+   echo "$as_me:14089: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -15642,11 +15643,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15645: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15646: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15649: \$? = $ac_status" >&5
+   echo "$as_me:15650: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -15746,11 +15747,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15749: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15750: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15753: \$? = $ac_status" >&5
+   echo "$as_me:15754: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17933,11 +17934,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:17936: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:17937: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:17940: \$? = $ac_status" >&5
+   echo "$as_me:17941: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -18201,11 +18202,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:18204: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18205: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:18208: \$? = $ac_status" >&5
+   echo "$as_me:18209: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -18305,11 +18306,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:18308: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18309: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:18312: \$? = $ac_status" >&5
+   echo "$as_me:18313: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -20991,6 +20992,8 @@ fi
 
 
 
+
+
 
 
 
@@ -20999,7 +21002,8 @@ for ac_header in mcheck.h values.h socket.h sys/socket.h  \
                  stdlib.h dirent.h pthread.h sys/prctl.h \
                  sysint.h inttypes.h termcap.h netdb.h sys/socket.h  \
                  sys/systemcfg.h ncurses.h curses.h sys/dr.h sys/vfs.h \
-		 pam/pam_appl.h security/pam_appl.h sys/sysctl.h \
+                 pam/pam_appl.h security/pam_appl.h sys/sysctl.h \
+                 pty.h utmp.h \
 
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -26526,6 +26530,76 @@ fi
 LIBS="$savedLIBS"
 CFLAGS="$savedCFLAGS"
 
+savedLIBS="$LIBS"
+LIBS="-lutil $LIBS"
+{ echo "$as_me:$LINENO: checking for openpty in -lutil" >&5
+echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6; }
+if test "${ac_cv_lib_util_openpty+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lutil  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char openpty ();
+int
+main ()
+{
+return openpty ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_util_openpty=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_util_openpty=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5
+echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6; }
+if test $ac_cv_lib_util_openpty = yes; then
+  UTIL_LIBS="-lutil"
+fi
+
+
+LIBS="$savedLIBS"
+
 
 cat >>confdefs.h <<\_ACEOF
 #define WITH_LSD_FATAL_ERROR_FUNC 1
@@ -27642,10 +27716,11 @@ AUTHD_LIBS!$AUTHD_LIBS$ac_delim
 AUTHD_CFLAGS!$AUTHD_CFLAGS$ac_delim
 WITH_AUTHD_TRUE!$WITH_AUTHD_TRUE$ac_delim
 WITH_AUTHD_FALSE!$WITH_AUTHD_FALSE$ac_delim
+UTIL_LIBS!$UTIL_LIBS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -27664,7 +27739,7 @@ fi
 
 cat >>$CONFIG_STATUS <<_ACEOF
 cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
 _ACEOF
 sed '
 s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
@@ -27677,8 +27752,6 @@ N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
 ' >>$CONFIG_STATUS <conf$$subs.sed
 rm -f conf$$subs.sed
 cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
 CEOF$ac_eof
 _ACEOF
 
@@ -27932,7 +28005,7 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
 s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed 's/|#_!!_#|//g' >$tmp/out
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
diff --git a/configure.ac b/configure.ac
index 02764932d61..fef1952f555 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,8 @@ AC_CHECK_HEADERS(mcheck.h values.h socket.h sys/socket.h  \
                  stdlib.h dirent.h pthread.h sys/prctl.h \
                  sysint.h inttypes.h termcap.h netdb.h sys/socket.h  \
                  sys/systemcfg.h ncurses.h curses.h sys/dr.h sys/vfs.h \
-		 pam/pam_appl.h security/pam_appl.h sys/sysctl.h \
+                 pam/pam_appl.h security/pam_appl.h sys/sysctl.h \
+                 pty.h utmp.h \
 		)
 AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
@@ -230,6 +231,12 @@ AM_CONDITIONAL(WITH_AUTHD, test "x$have_authd" = "xyes")
 LIBS="$savedLIBS"
 CFLAGS="$savedCFLAGS"
 
+savedLIBS="$LIBS"
+LIBS="-lutil $LIBS"
+AC_CHECK_LIB(util, openpty, [UTIL_LIBS="-lutil"], [])
+AC_SUBST(UTIL_LIBS)
+LIBS="$savedLIBS"
+
 dnl Add LSD-Tools defines:
 AC_DEFINE(WITH_LSD_FATAL_ERROR_FUNC, 1, [Have definition of lsd_fatal_error()])
 AC_DEFINE(WITH_LSD_NOMEM_ERROR_FUNC, 1, [Have definition of lsd_nomem_error()])
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 83b15f4f0f8..9ff482b2616 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -181,6 +181,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/doc/html/Makefile.in b/doc/html/Makefile.in
index 6bbf4dd316d..e4ebd66d634 100644
--- a/doc/html/Makefile.in
+++ b/doc/html/Makefile.in
@@ -180,6 +180,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/doc/man/Makefile.in b/doc/man/Makefile.in
index 7ebfba0c3e6..82d5f740875 100644
--- a/doc/man/Makefile.in
+++ b/doc/man/Makefile.in
@@ -177,6 +177,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/doc/man/man1/srun.1 b/doc/man/man1/srun.1
index 5b6fa233d3e..203e6e327cf 100644
--- a/doc/man/man1/srun.1
+++ b/doc/man/man1/srun.1
@@ -315,10 +315,6 @@ from remote tasks is line\-buffered directly to the stdout and stderr of
 The \fB\-\-label\fR option will prepend lines of output with the remote
 task id.
 
-.TP
-\fB-u\fR, \fB\-\-unbuffered\fR
-do not line buffer stdout from remote tasks. This option cannot be used
-with \fI\-\-label\fR. 
 .TP
 \fB\-m\fR, \fB\-\-distribution\fR=
 (\fIblock\fR|\fIcyclic\fR|\fIarbitrary\fR|\fIplane=<options>\fR)
@@ -690,6 +686,13 @@ The maximum resident set size
 The maximum stack size
 .RE
 
+.TP
+\fB\-\-pty\fR
+Execute task zero in pseudo terminal.
+Implicitly sets \fB\-\-unbuffered\fR.
+Implicitly sets \fB\-\-error\fR and \fB\-\-output\fR to /dev/null 
+for all tasks except task zero.
+
 .TP
 \fB\-Q\fR, \fB\-\-quiet\fR
 Quiet operation. Suppress informational messages. Errors will still
diff --git a/src/Makefile.in b/src/Makefile.in
index dfa80f5a934..429d6fee5d2 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -181,6 +181,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/api/Makefile.in b/src/api/Makefile.in
index 24a087b8657..9cbe125c060 100644
--- a/src/api/Makefile.in
+++ b/src/api/Makefile.in
@@ -221,6 +221,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/common/Makefile.in b/src/common/Makefile.in
index 900a0755016..80a4cf55fe5 100644
--- a/src/common/Makefile.in
+++ b/src/common/Makefile.in
@@ -249,6 +249,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h
index 514d17817ea..0e107bc12e3 100644
--- a/src/common/slurm_protocol_defs.h
+++ b/src/common/slurm_protocol_defs.h
@@ -437,6 +437,7 @@ typedef struct launch_tasks_request_msg {
 	
 	uint16_t user_managed_io; /* 0 for "normal" IO,
 				     1 for "user manged" IO */
+	uint8_t pty;		/* use pseudo tty */
 
 	/********** START "normal" IO only options **********/
 	/* These options are ignored if user_managed_io is 1 */
diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c
index 3a65953e6ba..6f88bd14ac9 100644
--- a/src/common/slurm_protocol_pack.c
+++ b/src/common/slurm_protocol_pack.c
@@ -2965,6 +2965,7 @@ _pack_launch_tasks_request_msg(launch_tasks_request_msg_t * msg, Buf buffer)
 	switch_pack_jobinfo(msg->switch_job, buffer);
 	job_options_pack(msg->options, buffer);
 	packstr(msg->complete_nodelist, buffer);
+	pack8(msg->pty, buffer);
 }
 
 static int
@@ -3058,6 +3059,7 @@ _unpack_launch_tasks_request_msg(launch_tasks_request_msg_t **
 		goto unpack_error;
 	}
 	safe_unpackstr_xmalloc(&msg->complete_nodelist, &uint16_tmp, buffer);	
+	safe_unpack8(&msg->pty, buffer);
 	return SLURM_SUCCESS;
 
 unpack_error:
diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in
index 4030e722765..68ff5531d2e 100644
--- a/src/plugins/Makefile.in
+++ b/src/plugins/Makefile.in
@@ -181,6 +181,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/auth/Makefile.in b/src/plugins/auth/Makefile.in
index 3099e5e96d7..7c33fb79e20 100644
--- a/src/plugins/auth/Makefile.in
+++ b/src/plugins/auth/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/auth/authd/Makefile.in b/src/plugins/auth/authd/Makefile.in
index 888faa8814c..e07bcd1cac8 100644
--- a/src/plugins/auth/authd/Makefile.in
+++ b/src/plugins/auth/authd/Makefile.in
@@ -202,6 +202,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/auth/munge/Makefile.in b/src/plugins/auth/munge/Makefile.in
index f070548734c..a1318f239f7 100644
--- a/src/plugins/auth/munge/Makefile.in
+++ b/src/plugins/auth/munge/Makefile.in
@@ -203,6 +203,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/auth/none/Makefile.in b/src/plugins/auth/none/Makefile.in
index c7c94ac7038..edf8504c35b 100644
--- a/src/plugins/auth/none/Makefile.in
+++ b/src/plugins/auth/none/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/checkpoint/Makefile.in b/src/plugins/checkpoint/Makefile.in
index 40b71699f09..d02575dfcf9 100644
--- a/src/plugins/checkpoint/Makefile.in
+++ b/src/plugins/checkpoint/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/checkpoint/aix/Makefile.in b/src/plugins/checkpoint/aix/Makefile.in
index 8164a0d4079..b51097a4e96 100644
--- a/src/plugins/checkpoint/aix/Makefile.in
+++ b/src/plugins/checkpoint/aix/Makefile.in
@@ -206,6 +206,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/checkpoint/none/Makefile.in b/src/plugins/checkpoint/none/Makefile.in
index 6156185008a..6f02f818c84 100644
--- a/src/plugins/checkpoint/none/Makefile.in
+++ b/src/plugins/checkpoint/none/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/crypto/Makefile.in b/src/plugins/crypto/Makefile.in
index e7bb98220e0..e0e5cb760d9 100644
--- a/src/plugins/crypto/Makefile.in
+++ b/src/plugins/crypto/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/crypto/munge/Makefile.in b/src/plugins/crypto/munge/Makefile.in
index 8a204ae9909..ebdc46c31aa 100644
--- a/src/plugins/crypto/munge/Makefile.in
+++ b/src/plugins/crypto/munge/Makefile.in
@@ -203,6 +203,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/crypto/openssl/Makefile.in b/src/plugins/crypto/openssl/Makefile.in
index 7b039ff00ce..115811f0f9f 100644
--- a/src/plugins/crypto/openssl/Makefile.in
+++ b/src/plugins/crypto/openssl/Makefile.in
@@ -209,6 +209,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/database/Makefile.in b/src/plugins/database/Makefile.in
index 5763043e65d..3102b84a0db 100644
--- a/src/plugins/database/Makefile.in
+++ b/src/plugins/database/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/database/flatfile/Makefile.in b/src/plugins/database/flatfile/Makefile.in
index d0cb2b5cc13..aac408f7384 100644
--- a/src/plugins/database/flatfile/Makefile.in
+++ b/src/plugins/database/flatfile/Makefile.in
@@ -204,6 +204,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/database/mysql/Makefile.in b/src/plugins/database/mysql/Makefile.in
index a59eca4cb57..2072a2cdb15 100644
--- a/src/plugins/database/mysql/Makefile.in
+++ b/src/plugins/database/mysql/Makefile.in
@@ -204,6 +204,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/database/pgsql/Makefile.in b/src/plugins/database/pgsql/Makefile.in
index 0cede517043..ee5a2b74f6c 100644
--- a/src/plugins/database/pgsql/Makefile.in
+++ b/src/plugins/database/pgsql/Makefile.in
@@ -204,6 +204,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/jobacct/Makefile.in b/src/plugins/jobacct/Makefile.in
index 27960099791..c354d8a722d 100644
--- a/src/plugins/jobacct/Makefile.in
+++ b/src/plugins/jobacct/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/jobacct/aix/Makefile.in b/src/plugins/jobacct/aix/Makefile.in
index d37e8e35f58..2682d80892a 100644
--- a/src/plugins/jobacct/aix/Makefile.in
+++ b/src/plugins/jobacct/aix/Makefile.in
@@ -202,6 +202,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/jobacct/linux/Makefile.in b/src/plugins/jobacct/linux/Makefile.in
index d0a57756580..53a022840f2 100644
--- a/src/plugins/jobacct/linux/Makefile.in
+++ b/src/plugins/jobacct/linux/Makefile.in
@@ -203,6 +203,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/jobacct/none/Makefile.in b/src/plugins/jobacct/none/Makefile.in
index b7ea2718149..4d92d9950b1 100644
--- a/src/plugins/jobacct/none/Makefile.in
+++ b/src/plugins/jobacct/none/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/jobcomp/Makefile.in b/src/plugins/jobcomp/Makefile.in
index 5523495f9cf..0f09c7fc39f 100644
--- a/src/plugins/jobcomp/Makefile.in
+++ b/src/plugins/jobcomp/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/jobcomp/database/Makefile.in b/src/plugins/jobcomp/database/Makefile.in
index fabbfe28369..76fd4749cdf 100644
--- a/src/plugins/jobcomp/database/Makefile.in
+++ b/src/plugins/jobcomp/database/Makefile.in
@@ -200,6 +200,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/jobcomp/filetxt/Makefile.in b/src/plugins/jobcomp/filetxt/Makefile.in
index 18e8109914d..98170be3ad2 100644
--- a/src/plugins/jobcomp/filetxt/Makefile.in
+++ b/src/plugins/jobcomp/filetxt/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/jobcomp/none/Makefile.in b/src/plugins/jobcomp/none/Makefile.in
index c8845e4f21c..967c72e5d42 100644
--- a/src/plugins/jobcomp/none/Makefile.in
+++ b/src/plugins/jobcomp/none/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/jobcomp/script/Makefile.in b/src/plugins/jobcomp/script/Makefile.in
index 50c67249674..2fd14e19ec2 100644
--- a/src/plugins/jobcomp/script/Makefile.in
+++ b/src/plugins/jobcomp/script/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/mpi/Makefile.in b/src/plugins/mpi/Makefile.in
index b07b66dca11..7bd4680240c 100644
--- a/src/plugins/mpi/Makefile.in
+++ b/src/plugins/mpi/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/mpi/lam/Makefile.in b/src/plugins/mpi/lam/Makefile.in
index 19746dcdc0d..5d32940e8c8 100644
--- a/src/plugins/mpi/lam/Makefile.in
+++ b/src/plugins/mpi/lam/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/mpi/mpich1_p4/Makefile.in b/src/plugins/mpi/mpich1_p4/Makefile.in
index 8751fe5a15b..018f2ad651a 100644
--- a/src/plugins/mpi/mpich1_p4/Makefile.in
+++ b/src/plugins/mpi/mpich1_p4/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/mpi/mpich1_shmem/Makefile.in b/src/plugins/mpi/mpich1_shmem/Makefile.in
index cd8c5eccbe2..1e408499750 100644
--- a/src/plugins/mpi/mpich1_shmem/Makefile.in
+++ b/src/plugins/mpi/mpich1_shmem/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/mpi/mpichgm/Makefile.in b/src/plugins/mpi/mpichgm/Makefile.in
index 474780fc6da..a8a26821a87 100644
--- a/src/plugins/mpi/mpichgm/Makefile.in
+++ b/src/plugins/mpi/mpichgm/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/mpi/mvapich/Makefile.in b/src/plugins/mpi/mvapich/Makefile.in
index f242d2766d9..4062b384dd3 100644
--- a/src/plugins/mpi/mvapich/Makefile.in
+++ b/src/plugins/mpi/mvapich/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/mpi/none/Makefile.in b/src/plugins/mpi/none/Makefile.in
index 9ee48d99f77..771dae177a9 100644
--- a/src/plugins/mpi/none/Makefile.in
+++ b/src/plugins/mpi/none/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/mpi/openmpi/Makefile.in b/src/plugins/mpi/openmpi/Makefile.in
index 28cd748ed4a..c31023da45f 100644
--- a/src/plugins/mpi/openmpi/Makefile.in
+++ b/src/plugins/mpi/openmpi/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/proctrack/Makefile.in b/src/plugins/proctrack/Makefile.in
index 311aad5dc3f..dee6bec7fec 100644
--- a/src/plugins/proctrack/Makefile.in
+++ b/src/plugins/proctrack/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/proctrack/aix/Makefile.in b/src/plugins/proctrack/aix/Makefile.in
index 34f517798a0..e525df1a5bc 100644
--- a/src/plugins/proctrack/aix/Makefile.in
+++ b/src/plugins/proctrack/aix/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/proctrack/linuxproc/Makefile.in b/src/plugins/proctrack/linuxproc/Makefile.in
index 935c0fa28ff..74f7afdc6ed 100644
--- a/src/plugins/proctrack/linuxproc/Makefile.in
+++ b/src/plugins/proctrack/linuxproc/Makefile.in
@@ -202,6 +202,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/proctrack/pgid/Makefile.in b/src/plugins/proctrack/pgid/Makefile.in
index fa31f22b4c5..379540b3ad8 100644
--- a/src/plugins/proctrack/pgid/Makefile.in
+++ b/src/plugins/proctrack/pgid/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/proctrack/rms/Makefile.in b/src/plugins/proctrack/rms/Makefile.in
index c3f3327498f..955f1558098 100644
--- a/src/plugins/proctrack/rms/Makefile.in
+++ b/src/plugins/proctrack/rms/Makefile.in
@@ -202,6 +202,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/proctrack/sgi_job/Makefile.in b/src/plugins/proctrack/sgi_job/Makefile.in
index 05f2cae0e37..67c5c7df0fc 100644
--- a/src/plugins/proctrack/sgi_job/Makefile.in
+++ b/src/plugins/proctrack/sgi_job/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/sched/Makefile.in b/src/plugins/sched/Makefile.in
index 73a1bf1b2ed..2c5cd33833f 100644
--- a/src/plugins/sched/Makefile.in
+++ b/src/plugins/sched/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/sched/backfill/Makefile.in b/src/plugins/sched/backfill/Makefile.in
index 6cd8b89a9c2..419134d5db6 100644
--- a/src/plugins/sched/backfill/Makefile.in
+++ b/src/plugins/sched/backfill/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/sched/builtin/Makefile.in b/src/plugins/sched/builtin/Makefile.in
index 9d895dbbcd7..8eec73b4d2c 100644
--- a/src/plugins/sched/builtin/Makefile.in
+++ b/src/plugins/sched/builtin/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/sched/gang/Makefile.in b/src/plugins/sched/gang/Makefile.in
index 9d5a12bd5a8..36929f571a0 100644
--- a/src/plugins/sched/gang/Makefile.in
+++ b/src/plugins/sched/gang/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/sched/hold/Makefile.in b/src/plugins/sched/hold/Makefile.in
index 10aa5adfadc..63285ab1b70 100644
--- a/src/plugins/sched/hold/Makefile.in
+++ b/src/plugins/sched/hold/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/sched/wiki/Makefile.in b/src/plugins/sched/wiki/Makefile.in
index 261b4a6f496..8a217a1fadf 100644
--- a/src/plugins/sched/wiki/Makefile.in
+++ b/src/plugins/sched/wiki/Makefile.in
@@ -202,6 +202,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/sched/wiki2/Makefile.in b/src/plugins/sched/wiki2/Makefile.in
index bf078d881ab..5a5887459cc 100644
--- a/src/plugins/sched/wiki2/Makefile.in
+++ b/src/plugins/sched/wiki2/Makefile.in
@@ -205,6 +205,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/select/Makefile.in b/src/plugins/select/Makefile.in
index 3b406548f8c..b20721c52c2 100644
--- a/src/plugins/select/Makefile.in
+++ b/src/plugins/select/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/select/bluegene/Makefile.in b/src/plugins/select/bluegene/Makefile.in
index d8c2e9710bc..77573aef6cf 100644
--- a/src/plugins/select/bluegene/Makefile.in
+++ b/src/plugins/select/bluegene/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/select/bluegene/block_allocator/Makefile.in b/src/plugins/select/bluegene/block_allocator/Makefile.in
index 2892d8ad238..8ce3b560cad 100644
--- a/src/plugins/select/bluegene/block_allocator/Makefile.in
+++ b/src/plugins/select/bluegene/block_allocator/Makefile.in
@@ -195,6 +195,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/select/bluegene/plugin/Makefile.in b/src/plugins/select/bluegene/plugin/Makefile.in
index a93c5e5ade4..70b6b6cf9e0 100644
--- a/src/plugins/select/bluegene/plugin/Makefile.in
+++ b/src/plugins/select/bluegene/plugin/Makefile.in
@@ -241,6 +241,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/select/cons_res/Makefile.in b/src/plugins/select/cons_res/Makefile.in
index 54195c91631..a146f1a1067 100644
--- a/src/plugins/select/cons_res/Makefile.in
+++ b/src/plugins/select/cons_res/Makefile.in
@@ -202,6 +202,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/select/linear/Makefile.in b/src/plugins/select/linear/Makefile.in
index e8be013075f..d453bca3381 100644
--- a/src/plugins/select/linear/Makefile.in
+++ b/src/plugins/select/linear/Makefile.in
@@ -202,6 +202,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/switch/Makefile.in b/src/plugins/switch/Makefile.in
index bf13f075e0e..ca7f300b6f8 100644
--- a/src/plugins/switch/Makefile.in
+++ b/src/plugins/switch/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/switch/elan/Makefile.in b/src/plugins/switch/elan/Makefile.in
index 1f4ef48ee8f..e9a73e7b68c 100644
--- a/src/plugins/switch/elan/Makefile.in
+++ b/src/plugins/switch/elan/Makefile.in
@@ -207,6 +207,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/switch/federation/Makefile.in b/src/plugins/switch/federation/Makefile.in
index c6617f95cd2..8ce1fe873c4 100644
--- a/src/plugins/switch/federation/Makefile.in
+++ b/src/plugins/switch/federation/Makefile.in
@@ -211,6 +211,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/switch/none/Makefile.in b/src/plugins/switch/none/Makefile.in
index f618ee2020b..7dc117bc493 100644
--- a/src/plugins/switch/none/Makefile.in
+++ b/src/plugins/switch/none/Makefile.in
@@ -202,6 +202,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/task/Makefile.in b/src/plugins/task/Makefile.in
index e6de8c45db4..7b1ed11154d 100644
--- a/src/plugins/task/Makefile.in
+++ b/src/plugins/task/Makefile.in
@@ -183,6 +183,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/task/affinity/Makefile.in b/src/plugins/task/affinity/Makefile.in
index b12a2ab7060..5b77bbabdd8 100644
--- a/src/plugins/task/affinity/Makefile.in
+++ b/src/plugins/task/affinity/Makefile.in
@@ -213,6 +213,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/plugins/task/none/Makefile.in b/src/plugins/task/none/Makefile.in
index 235d3d11cc1..fa9f5b7a591 100644
--- a/src/plugins/task/none/Makefile.in
+++ b/src/plugins/task/none/Makefile.in
@@ -202,6 +202,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/sacct/Makefile.in b/src/sacct/Makefile.in
index 50934b87384..fd7083fd781 100644
--- a/src/sacct/Makefile.in
+++ b/src/sacct/Makefile.in
@@ -200,6 +200,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/salloc/Makefile.in b/src/salloc/Makefile.in
index a3800eff1ad..c294a5f8555 100644
--- a/src/salloc/Makefile.in
+++ b/src/salloc/Makefile.in
@@ -196,6 +196,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/sattach/Makefile.in b/src/sattach/Makefile.in
index 083ea47c1fb..b1b38fe47f8 100644
--- a/src/sattach/Makefile.in
+++ b/src/sattach/Makefile.in
@@ -197,6 +197,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/sbatch/Makefile.in b/src/sbatch/Makefile.in
index b4f6e1d77e7..f492475e1da 100644
--- a/src/sbatch/Makefile.in
+++ b/src/sbatch/Makefile.in
@@ -196,6 +196,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/sbcast/Makefile.in b/src/sbcast/Makefile.in
index 87e10db7872..fc2fcc566b8 100644
--- a/src/sbcast/Makefile.in
+++ b/src/sbcast/Makefile.in
@@ -200,6 +200,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/scancel/Makefile.in b/src/scancel/Makefile.in
index 6cf89a987b5..02a39a7d334 100644
--- a/src/scancel/Makefile.in
+++ b/src/scancel/Makefile.in
@@ -199,6 +199,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/scontrol/Makefile.in b/src/scontrol/Makefile.in
index 89d2f93f9fb..653eb01d867 100644
--- a/src/scontrol/Makefile.in
+++ b/src/scontrol/Makefile.in
@@ -199,6 +199,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/sinfo/Makefile.in b/src/sinfo/Makefile.in
index 5706e1d3efb..2a8160374b2 100644
--- a/src/sinfo/Makefile.in
+++ b/src/sinfo/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/slaunch/Makefile.in b/src/slaunch/Makefile.in
index d68ac077257..22826eb90a9 100644
--- a/src/slaunch/Makefile.in
+++ b/src/slaunch/Makefile.in
@@ -199,6 +199,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/slurmctld/Makefile.in b/src/slurmctld/Makefile.in
index 5c57787e007..07d9c042f14 100644
--- a/src/slurmctld/Makefile.in
+++ b/src/slurmctld/Makefile.in
@@ -204,6 +204,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/slurmd/Makefile.in b/src/slurmd/Makefile.in
index c17ffb0f6bc..57540b6b2a9 100644
--- a/src/slurmd/Makefile.in
+++ b/src/slurmd/Makefile.in
@@ -181,6 +181,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/slurmd/slurmd/Makefile.in b/src/slurmd/slurmd/Makefile.in
index b7136bae1d3..3aa0abe4d37 100644
--- a/src/slurmd/slurmd/Makefile.in
+++ b/src/slurmd/slurmd/Makefile.in
@@ -217,6 +217,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/slurmd/slurmstepd/Makefile.am b/src/slurmd/slurmstepd/Makefile.am
index c4a1f0ec24c..35165dc9b54 100644
--- a/src/slurmd/slurmstepd/Makefile.am
+++ b/src/slurmd/slurmstepd/Makefile.am
@@ -12,7 +12,7 @@ slurmstepd_LDADD = 				   \
 	$(top_builddir)/src/common/libdaemonize.la \
 	$(top_builddir)/src/common/libeio.la       \
 	$(top_builddir)/src/common/libspank.la     \
-	$(PLPA_LIBS) $(SSL_LIBS) $(PAM_LIBS) 
+	$(PLPA_LIBS) $(SSL_LIBS) $(PAM_LIBS) $(UTIL_LIBS) 
 
 slurmstepd_SOURCES = 	        	\
 	slurmstepd.c slurmstepd.h	\
diff --git a/src/slurmd/slurmstepd/Makefile.in b/src/slurmd/slurmstepd/Makefile.in
index afd61d974d1..7e972846036 100644
--- a/src/slurmd/slurmstepd/Makefile.in
+++ b/src/slurmd/slurmstepd/Makefile.in
@@ -83,7 +83,8 @@ slurmstepd_DEPENDENCIES = $(top_builddir)/src/common/libcommon.la \
 	$(top_builddir)/src/common/libdaemonize.la \
 	$(top_builddir)/src/common/libeio.la \
 	$(top_builddir)/src/common/libspank.la $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 slurmstepd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(slurmstepd_LDFLAGS) $(LDFLAGS) -o $@
@@ -208,6 +209,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
@@ -271,7 +273,7 @@ slurmstepd_LDADD = \
 	$(top_builddir)/src/common/libdaemonize.la \
 	$(top_builddir)/src/common/libeio.la       \
 	$(top_builddir)/src/common/libspank.la     \
-	$(PLPA_LIBS) $(SSL_LIBS) $(PAM_LIBS) 
+	$(PLPA_LIBS) $(SSL_LIBS) $(PAM_LIBS) $(UTIL_LIBS) 
 
 slurmstepd_SOURCES = \
 	slurmstepd.c slurmstepd.h	\
diff --git a/src/slurmd/slurmstepd/io.c b/src/slurmd/slurmstepd/io.c
index 4acd70b3241..fb128d695bf 100644
--- a/src/slurmd/slurmstepd/io.c
+++ b/src/slurmd/slurmstepd/io.c
@@ -52,6 +52,14 @@
 #  include <stdlib.h>
 #endif
 
+#ifdef HAVE_PTY_H
+#  include <pty.h>
+#endif
+
+#ifdef HAVE_UTMP_H
+#  include <utmp.h>
+#endif
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
@@ -69,6 +77,7 @@
 #include "src/common/read_config.h"
 #include "src/common/xmalloc.h"
 #include "src/common/xsignal.h"
+#include "src/common/xstring.h"
 
 #include "src/slurmd/slurmd/slurmd.h"
 #include "src/slurmd/slurmstepd/io.h"
@@ -301,7 +310,8 @@ _client_read(eio_obj_t *obj, List objs)
 	if (client->header.length == 0) { /* zero length is an eof message */
 		debug5("  got stdin eof message!");
 	} else {
-		buf = client->in_msg->data + (client->in_msg->length - client->in_remaining);
+		buf = client->in_msg->data + 
+			(client->in_msg->length - client->in_remaining);
 	again:
 		if ((n = read(obj->fd, buf, client->in_remaining)) < 0) {
 			if (errno == EINTR)
@@ -392,7 +402,8 @@ _client_write(eio_obj_t *obj, List objs)
 			debug5("_client_write: nothing in the queue");
 			return SLURM_SUCCESS;
 		}
-		debug5("  dequeue successful, client->out_msg->length = %d", client->out_msg->length);
+		debug5("  dequeue successful, client->out_msg->length = %d", 
+			client->out_msg->length);
 		client->out_remaining = client->out_msg->length;
 	}
 
@@ -673,7 +684,35 @@ _init_task_stdio_fds(slurmd_task_info_t *task, slurmd_job_t *job)
 	/*
 	 *  Initialize stdin
 	 */
-	if (task->ifname != NULL) {
+	if (job->pty) {
+		/* All of the stdin fails unless EVERY
+		 * task gets an eio object for stdin.
+		 * Its not clear why that is. */
+		if (task->gtid == 0) {
+			int amaster, aslave;
+			debug("  stdin uses a pty object");
+			if (openpty(&amaster, &aslave, NULL, NULL, NULL) < 0) {
+				error("stdin oepnpty: %m");
+				return SLURM_ERROR;
+			}
+			task->stdin_fd = aslave;
+			fd_set_close_on_exec(task->stdin_fd);
+			task->to_stdin = amaster;
+			fd_set_close_on_exec(task->to_stdin);
+			fd_set_nonblocking(task->to_stdin);
+			task->in = _create_task_in_eio(task->to_stdin, job);
+			eio_new_initial_obj(job->eio, (void *)task->in);
+		} else {
+			xfree(task->ifname);
+			task->ifname = xstrdup("/dev/null");
+			task->stdin_fd = open("/dev/null", O_RDWR);
+			fd_set_close_on_exec(task->stdin_fd);
+			task->to_stdin = dup(task->stdin_fd);
+			fd_set_nonblocking(task->to_stdin);
+			task->in = _create_task_in_eio(task->to_stdin, job);
+			eio_new_initial_obj(job->eio, (void *)task->in);
+		}
+	} else if (task->ifname != NULL) {
 		/* open file on task's stdin */
 		debug5("  stdin file name = %s", task->ifname);
 		if ((task->stdin_fd = open(task->ifname, O_RDONLY)) == -1) {
@@ -702,7 +741,25 @@ _init_task_stdio_fds(slurmd_task_info_t *task, slurmd_job_t *job)
 	/*
 	 *  Initialize stdout
 	 */
-	if (task->ofname != NULL) {
+	if (job->pty) {
+		if (task->gtid == 0) {
+			task->stdout_fd = dup(task->stdin_fd);
+			fd_set_close_on_exec(task->stdout_fd);
+			task->from_stdout = dup(task->to_stdin);
+			fd_set_close_on_exec(task->from_stdout);
+			fd_set_nonblocking(task->from_stdout);
+			task->out = _create_task_out_eio(task->from_stdout,
+						 SLURM_IO_STDOUT, job, task);
+			list_append(job->stdout_eio_objs, (void *)task->out);
+			eio_new_initial_obj(job->eio, (void *)task->out);
+		} else {
+			xfree(task->ofname);
+			task->ofname = xstrdup("/dev/null");
+			task->stdout_fd = open("/dev/null", O_RDWR);
+			fd_set_close_on_exec(task->stdout_fd);
+			task->from_stdout = -1;  /* not used */
+		}
+	} else if (task->ofname != NULL) {
 		/* open file on task's stdout */
 		debug5("  stdout file name = %s", task->ofname);
 		task->stdout_fd = open(task->ofname, file_flags, 0666);
@@ -710,8 +767,7 @@ _init_task_stdio_fds(slurmd_task_info_t *task, slurmd_job_t *job)
 			error("Could not open stdout file: %m");
 			xfree(task->ofname);
 			task->ofname = fname_create(job, "slurm-%J.out", 0);
-			task->stdout_fd = open(task->ofname, 
-				O_CREAT|O_WRONLY|O_TRUNC|O_APPEND, 0666);
+			task->stdout_fd = open(task->ofname, file_flags, 0666);
 			if (task->stdout_fd == -1)
 				return SLURM_ERROR;
 		}
@@ -739,7 +795,25 @@ _init_task_stdio_fds(slurmd_task_info_t *task, slurmd_job_t *job)
 	/*
 	 *  Initialize stderr
 	 */
-	if (task->efname != NULL) {
+	if (job->pty) {
+		if (task->gtid == 0) {
+			task->stderr_fd = dup(task->stdin_fd);
+			fd_set_close_on_exec(task->stderr_fd);
+			task->from_stderr = dup(task->to_stdin);
+			fd_set_close_on_exec(task->from_stderr);
+			fd_set_nonblocking(task->from_stderr);
+			task->err = _create_task_out_eio(task->from_stderr,
+						 SLURM_IO_STDERR, job, task);
+			list_append(job->stderr_eio_objs, (void *)task->err);
+			eio_new_initial_obj(job->eio, (void *)task->err);
+		} else {
+			xfree(task->efname);
+			task->efname = xstrdup("/dev/null");
+			task->stderr_fd = open("/dev/null", O_RDWR);
+			fd_set_close_on_exec(task->stderr_fd);
+			task->from_stderr = -1;  /* not used */
+		}
+	} else if (task->efname != NULL) {
 		/* open file on task's stdout */
 		debug5("  stderr file name = %s", task->efname);
 		task->stderr_fd = open(task->efname, file_flags, 0666);
@@ -747,8 +821,7 @@ _init_task_stdio_fds(slurmd_task_info_t *task, slurmd_job_t *job)
 			error("Could not open stderr file: %m");
 			xfree(task->efname);
 			task->efname = fname_create(job, "slurm-%J.err", 0);
-			task->stderr_fd = open(task->efname,
-				O_CREAT|O_WRONLY|O_TRUNC|O_APPEND, 0666);
+			task->stderr_fd = open(task->efname, file_flags, 0666);
 			if (task->stderr_fd == -1)
 				return SLURM_ERROR;
 		}
diff --git a/src/slurmd/slurmstepd/slurmstepd_job.c b/src/slurmd/slurmstepd/slurmstepd_job.c
index 0ac31962b8a..aed543c9732 100644
--- a/src/slurmd/slurmstepd/slurmstepd_job.c
+++ b/src/slurmd/slurmstepd/slurmstepd_job.c
@@ -259,7 +259,8 @@ job_create(launch_tasks_request_msg_t *msg)
 	job->multi_prog  = msg->multi_prog;
 	job->timelimit   = (time_t) -1;
 	job->task_flags  = msg->task_flags;
-	job->switch_job = msg->switch_job;
+	job->switch_job  = msg->switch_job;
+	job->pty         = msg->pty;
 
 	job->options =    msg->options;
 	
diff --git a/src/slurmd/slurmstepd/slurmstepd_job.h b/src/slurmd/slurmstepd/slurmstepd_job.h
index 4ac3948aed6..93c873eea18 100644
--- a/src/slurmd/slurmstepd/slurmstepd_job.h
+++ b/src/slurmd/slurmstepd/slurmstepd_job.h
@@ -188,7 +188,7 @@ typedef struct slurmd_job {
 
 	char          *batchdir;
 	jobacctinfo_t *jobacct;
-
+	uint8_t        pty;		/* set if creating pseudo tty       */
 	job_options_t  options;
 } slurmd_job_t;
 
diff --git a/src/smap/Makefile.in b/src/smap/Makefile.in
index bca8a24c9c2..fb571371ea4 100644
--- a/src/smap/Makefile.in
+++ b/src/smap/Makefile.in
@@ -214,6 +214,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/squeue/Makefile.in b/src/squeue/Makefile.in
index d3b4122cb39..3ca48cea3fa 100644
--- a/src/squeue/Makefile.in
+++ b/src/squeue/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/srun/Makefile.in b/src/srun/Makefile.in
index fb56f862113..47843ba2f51 100644
--- a/src/srun/Makefile.in
+++ b/src/srun/Makefile.in
@@ -200,6 +200,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/srun/launch.c b/src/srun/launch.c
index 6edd6c7652a..64c0b8379e6 100644
--- a/src/srun/launch.c
+++ b/src/srun/launch.c
@@ -153,7 +153,8 @@ launch(void *arg)
 	r.efname  = fname_remote_string (job->efname);
 	r.ifname  = fname_remote_string (job->ifname);
 	r.buffered_stdio = !opt.unbuffered;
-	
+	r.pty     = opt.pty;
+
 	r.task_flags = 0;
 	if (opt.parallel_debug)
 		r.task_flags |= TASK_PARALLEL_DEBUG;
@@ -187,8 +188,6 @@ launch(void *arg)
 	for (i = 0; i < r.num_io_port; i++) {
 		r.io_port[i] = job->client_io->listenport[i];
 	}
-
-	
 	
 	//hostlist = hostlist_create(job->nodelist);
 	debug("sending to list %s", job->step_layout->node_list);
diff --git a/src/srun/opt.c b/src/srun/opt.c
index b5b9717d283..3bf30bea54d 100644
--- a/src/srun/opt.c
+++ b/src/srun/opt.c
@@ -157,6 +157,7 @@
 #define LONG_OPT_RAMDISK_IMAGE   0x143
 #define LONG_OPT_REBOOT          0x144
 #define LONG_OPT_GET_USER_ENV    0x145
+#define LONG_OPT_PTY             0x146
 
 /*---- global variables, defined in opt.h ----*/
 int _verbose;
@@ -1032,6 +1033,7 @@ static void _opt_default()
 	}
 	
 	opt.get_user_env = false;
+	opt.pty = false;
 }
 
 /*---[ env var processing ]-----------------------------------------------*/
@@ -1403,6 +1405,7 @@ static void set_options(const int argc, char **argv)
 		{"ramdisk-image",    required_argument, 0, LONG_OPT_RAMDISK_IMAGE},
 		{"reboot",           no_argument,       0, LONG_OPT_REBOOT},            
 		{"get-user-env",     no_argument,       0, LONG_OPT_GET_USER_ENV},
+		{"pty",              no_argument,       0, LONG_OPT_PTY},
 		{NULL,               0,                 0, 0}
 	};
 	char *opt_string = "+aAbB:c:C:d:D:e:g:Hi:IjJ:kKlm:n:N:"
@@ -1478,6 +1481,8 @@ static void set_options(const int argc, char **argv)
 			opt.cwd = xstrdup(optarg);
 			break;
 		case (int)'e':
+			if (opt.pty)
+				fatal("--error incompatable with --pty option");
 			xfree(opt.efname);
 			if (strncasecmp(optarg, "none", (size_t) 4) == 0)
 				opt.efname = xstrdup("/dev/null");
@@ -1492,6 +1497,8 @@ static void set_options(const int argc, char **argv)
 			opt.hold = true;
 			break;
 		case (int)'i':
+			if (opt.pty)
+				fatal("--input incompatable with --pty option");
 			xfree(opt.ifname);
 			if (strncasecmp(optarg, "none", (size_t) 4) == 0)
 				opt.ifname = xstrdup("/dev/null");
@@ -1546,6 +1553,8 @@ static void set_options(const int argc, char **argv)
 			}
 			break;
 		case (int)'o':
+			if (opt.pty)
+				fatal("--output incompatable with --pty option");
 			xfree(opt.ofname);
 			if (strncasecmp(optarg, "none", (size_t) 4) == 0)
 				opt.ofname = xstrdup("/dev/null");
@@ -1867,6 +1876,16 @@ static void set_options(const int argc, char **argv)
 		case LONG_OPT_GET_USER_ENV:
 			opt.get_user_env = true;
 			break;
+		case LONG_OPT_PTY:
+			opt.pty = true;
+			opt.unbuffered = true;	/* implicit */
+			if (opt.ifname)
+				fatal("--input incompatable with --pty option");
+			if (opt.ofname)
+				fatal("--output incompatable with --pty option");
+			if (opt.efname)
+				fatal("--error incompatable with --pty option");
+			break;
 		default:
 			if (spank_process_option (opt_char, optarg) < 0) {
 				exit (1);
@@ -2670,6 +2689,7 @@ static void _help(void)
 "      --multi-prog            if set the program name specified is the\n"
 "                              configuration specification for multiple programs\n"
 "      --get-user-env          used by Moab.  See srun man page.\n"
+"      --pty                   run task zero in pseudo terminal\n"
 "\n"
 "Constraint options:\n"
 "      --mincpus=n             minimum number of cpus per node\n"
diff --git a/src/srun/opt.h b/src/srun/opt.h
index 4053916e878..df25aa10ae0 100644
--- a/src/srun/opt.h
+++ b/src/srun/opt.h
@@ -195,6 +195,7 @@ typedef struct srun_options {
 	char *mail_user;	/* --mail-user			*/
 	char *ctrl_comm_ifhn;	/* --ctrl-comm-ifhn		*/
 	bool get_user_env;	/* --get-user-env		*/
+	bool pty;		/* --pty			*/
 	int argc;		/* length of argv array		*/
 	char **argv;		/* left over on command line	*/
 } opt_t;
diff --git a/src/srun/srun.c b/src/srun/srun.c
index d89bb77a3bf..1cc5a97b6a2 100644
--- a/src/srun/srun.c
+++ b/src/srun/srun.c
@@ -65,6 +65,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
+#include <termios.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <grp.h>
@@ -99,6 +100,7 @@
 #define	TYPE_SCRIPT	2
 
 mpi_plugin_client_info_t mpi_job_info[1];
+static struct termios termdefaults;
 
 /*
  * forward declaration of static funcs
@@ -117,6 +119,7 @@ static int   _change_rlimit_rss(void);
 static int   _slurm_debug_env_val (void);
 static int   _call_spank_local_user (srun_job_t *job);
 static void  _define_symbols(void);
+static void  _pty_restore(void);
 
 int srun(int ac, char **av)
 {
@@ -304,11 +307,29 @@ int srun(int ac, char **av)
 	env_array_free(mpi_env);
 
 	srun_set_stdio_fds(job, &fds);
-	job->client_io = client_io_handler_create(fds,
-						  job->step_layout->task_cnt,
-						  job->step_layout->node_cnt,
-						  job->cred,
-						  opt.labelio);
+
+	if (opt.pty) {
+		struct termios term;
+		int fd = STDIN_FILENO;
+
+		job->client_io = client_io_handler_create(fds, 1, 1, 
+					job->cred, opt.labelio);
+		/* Save terminal settings for restore */
+		tcgetattr(fd, &termdefaults); 
+
+		atexit(&_pty_restore);
+
+		tcgetattr(fd, &term);
+		/* Set raw mode on local tty */
+		cfmakeraw(&term);
+		tcsetattr(fd, TCSANOW, &term);
+	} else {
+		 job->client_io = client_io_handler_create(fds,
+					job->step_layout->task_cnt,
+					job->step_layout->node_cnt,
+					job->cred, opt.labelio);
+	}
+
 	if (!job->client_io
 	    || (client_io_handler_start(job->client_io)	!= SLURM_SUCCESS))
 		job_fatal(job, "failed to start IO handler");
@@ -815,3 +836,10 @@ static void _define_symbols(void)
 {
 	slurm_signal_job_step(0,0,0);	/* needed by mvapich and mpichgm */
 }
+
+static void _pty_restore(void)
+{
+	/* STDIN is probably closed by now */
+	if (tcsetattr(STDOUT_FILENO, TCSANOW, &termdefaults) < 0)
+		fprintf(stderr, "tcsetattr: %s\n", strerror(errno));
+}
diff --git a/src/strigger/Makefile.in b/src/strigger/Makefile.in
index 3760d893d1e..03684767ba3 100644
--- a/src/strigger/Makefile.in
+++ b/src/strigger/Makefile.in
@@ -200,6 +200,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/src/sview/Makefile.in b/src/sview/Makefile.in
index 7d1e40962a5..10876512062 100644
--- a/src/sview/Makefile.in
+++ b/src/sview/Makefile.in
@@ -218,6 +218,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index d7ac89861f8..5d8054c1a84 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -188,6 +188,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/testsuite/expect/Makefile.in b/testsuite/expect/Makefile.in
index 63bfb56fdd7..1e6a2e74724 100644
--- a/testsuite/expect/Makefile.in
+++ b/testsuite/expect/Makefile.in
@@ -169,6 +169,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/testsuite/slurm_unit/Makefile.in b/testsuite/slurm_unit/Makefile.in
index 3862206062e..f2358145c5e 100644
--- a/testsuite/slurm_unit/Makefile.in
+++ b/testsuite/slurm_unit/Makefile.in
@@ -181,6 +181,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/testsuite/slurm_unit/api/Makefile.in b/testsuite/slurm_unit/api/Makefile.in
index 4d1a4d49b25..8782ea0c210 100644
--- a/testsuite/slurm_unit/api/Makefile.in
+++ b/testsuite/slurm_unit/api/Makefile.in
@@ -201,6 +201,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/testsuite/slurm_unit/api/manual/Makefile.in b/testsuite/slurm_unit/api/manual/Makefile.in
index 9c077286c33..d7a56e7d486 100644
--- a/testsuite/slurm_unit/api/manual/Makefile.in
+++ b/testsuite/slurm_unit/api/manual/Makefile.in
@@ -223,6 +223,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/testsuite/slurm_unit/common/Makefile.in b/testsuite/slurm_unit/common/Makefile.in
index 1666714de9a..734f65d93c1 100644
--- a/testsuite/slurm_unit/common/Makefile.in
+++ b/testsuite/slurm_unit/common/Makefile.in
@@ -209,6 +209,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/testsuite/slurm_unit/slurmctld/Makefile.in b/testsuite/slurm_unit/slurmctld/Makefile.in
index 3847ee1f416..116b82f129d 100644
--- a/testsuite/slurm_unit/slurmctld/Makefile.in
+++ b/testsuite/slurm_unit/slurmctld/Makefile.in
@@ -172,6 +172,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
diff --git a/testsuite/slurm_unit/slurmd/Makefile.in b/testsuite/slurm_unit/slurmd/Makefile.in
index 9e350b27016..e10a02640c9 100644
--- a/testsuite/slurm_unit/slurmd/Makefile.in
+++ b/testsuite/slurm_unit/slurmd/Makefile.in
@@ -172,6 +172,7 @@ SSL_CPPFLAGS = @SSL_CPPFLAGS@
 SSL_LDFLAGS = @SSL_LDFLAGS@
 SSL_LIBS = @SSL_LIBS@
 STRIP = @STRIP@
+UTIL_LIBS = @UTIL_LIBS@
 VERSION = @VERSION@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
-- 
GitLab