diff --git a/configure b/configure
index cd8cd16..1da4956 100755
--- a/configure
+++ b/configure
@@ -1,13 +1,13 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for R 2.13.1.
+# Generated by GNU Autoconf 2.67 for R 2.13.1.
 #
 # Report bugs to <r-bugs@R-project.org>.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -319,7 +319,7 @@ $as_echo X"$as_dir" |
       test -d "$as_dir" && break
     done
     test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
 
 
 } # as_fn_mkdir_p
@@ -359,19 +359,19 @@ else
 fi # as_fn_arith
 
 
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
 as_fn_error ()
 {
-  as_status=$?; test $as_status -eq 0 && as_status=1
-  if test "$3"; then
-    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
-  $as_echo "$as_me: error: $1" >&2
+  $as_echo "$as_me: error: $2" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
@@ -682,7 +682,7 @@ test -n "$DJDIR" || exec 7<&0 </dev/null
 exec 6>&1
 
 # Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
@@ -1254,8 +1254,9 @@ do
   fi
 
   case $ac_option in
-  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *)	ac_optarg=yes ;;
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
   esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
@@ -1300,7 +1301,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error "invalid feature name: $ac_useropt"
+      as_fn_error $? "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1326,7 +1327,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error "invalid feature name: $ac_useropt"
+      as_fn_error $? "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1530,7 +1531,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error "invalid package name: $ac_useropt"
+      as_fn_error $? "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1546,7 +1547,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error "invalid package name: $ac_useropt"
+      as_fn_error $? "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1576,8 +1577,8 @@ do
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) as_fn_error "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information."
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
     ;;
 
   *=*)
@@ -1585,7 +1586,7 @@ Try \`$0 --help' for more information."
     # Reject names that are not valid shell variable names.
     case $ac_envvar in #(
       '' | [0-9]* | *[!_$as_cr_alnum]* )
-      as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
     esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
@@ -1603,13 +1604,13 @@ done
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  as_fn_error "missing argument to $ac_option"
+  as_fn_error $? "missing argument to $ac_option"
 fi
 
 if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
-    fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
     *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
@@ -1632,7 +1633,7 @@ do
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1646,8 +1647,8 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used." >&2
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1662,9 +1663,9 @@ test "$silent" = yes && exec 6>/dev/null
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
 ac_ls_di=`ls -di .` &&
 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  as_fn_error "working directory cannot be determined"
+  as_fn_error $? "working directory cannot be determined"
 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  as_fn_error "pwd does not report name of working directory"
+  as_fn_error $? "pwd does not report name of working directory"
 
 
 # Find the source files, if location was not specified.
@@ -1703,11 +1704,11 @@ else
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
 fi
 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
 ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
 	pwd)`
 # When building in place, set srcdir=.
 if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1747,7 +1748,7 @@ Configuration:
       --help=short        display options specific to this package
       --help=recursive    display the short help of all the included packages
   -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking...' messages
+  -q, --quiet, --silent   do not print \`checking ...' messages
       --cache-file=FILE   cache test results in FILE [disabled]
   -C, --config-cache      alias for \`--cache-file=config.cache'
   -n, --no-create         do not create output files
@@ -2023,9 +2024,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 R configure 2.13.1
-generated by GNU Autoconf 2.65
+generated by GNU Autoconf 2.67
 
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -2095,7 +2096,7 @@ $as_echo "$ac_try_echo"; } >&5
     mv -f conftest.er1 conftest.err
   fi
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } >/dev/null && {
+  test $ac_status = 0; } > conftest.i && {
 	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
 	 test ! -s conftest.err
        }; then :
@@ -2208,7 +2209,7 @@ $as_echo "$ac_try_echo"; } >&5
     mv -f conftest.er1 conftest.err
   fi
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } >/dev/null && {
+  test $ac_status = 0; } > conftest.i && {
 	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
 	 test ! -s conftest.err
        }; then :
@@ -2232,10 +2233,10 @@ fi
 ac_fn_c_check_header_mongrel ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  if eval "test \"\${$3+set}\"" = set; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 fi
 eval ac_res=\$$3
@@ -2271,7 +2272,7 @@ if ac_fn_c_try_cpp "$LINENO"; then :
 else
   ac_header_preproc=no
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
 $as_echo "$ac_header_preproc" >&6; }
 
@@ -2294,17 +2295,15 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( cat <<\_ASBOX
-## ----------------------------------- ##
+( $as_echo "## ----------------------------------- ##
 ## Report this to r-bugs@R-project.org ##
-## ----------------------------------- ##
-_ASBOX
+## ----------------------------------- ##"
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=\$ac_header_compiler"
@@ -2368,7 +2367,7 @@ ac_fn_c_check_header_compile ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2482,7 +2481,7 @@ ac_fn_c_check_func ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2633,15 +2632,18 @@ fi
 
 } # ac_fn_f77_try_link
 
-# ac_fn_c_check_decl LINENO SYMBOL VAR
-# ------------------------------------
-# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
 ac_fn_c_check_decl ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
-$as_echo_n "checking whether $2 is declared... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  as_decl_name=`echo $2|sed 's/ *(.*//'`
+  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2650,8 +2652,12 @@ $4
 int
 main ()
 {
-#ifndef $2
-  (void) $2;
+#ifndef $as_decl_name
+#ifdef __cplusplus
+  (void) $as_decl_use;
+#else
+  (void) $as_decl_name;
+#endif
 #endif
 
   ;
@@ -2681,7 +2687,7 @@ ac_fn_c_check_type ()
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
 $as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$3+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   eval "$3=no"
@@ -3038,7 +3044,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by R $as_me 2.13.1, which was
-generated by GNU Autoconf 2.65.  Invocation command line was
+generated by GNU Autoconf 2.67.  Invocation command line was
 
   $ $0 $@
 
@@ -3148,11 +3154,9 @@ trap 'exit_status=$?
   {
     echo
 
-    cat <<\_ASBOX
-## ---------------- ##
+    $as_echo "## ---------------- ##
 ## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
     echo
     # The following way of writing the cache mishandles newlines in values,
 (
@@ -3186,11 +3190,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
 )
     echo
 
-    cat <<\_ASBOX
-## ----------------- ##
+    $as_echo "## ----------------- ##
 ## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
     echo
     for ac_var in $ac_subst_vars
     do
@@ -3203,11 +3205,9 @@ _ASBOX
     echo
 
     if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
+      $as_echo "## ------------------- ##
 ## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
       echo
       for ac_var in $ac_subst_files
       do
@@ -3221,11 +3221,9 @@ _ASBOX
     fi
 
     if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
+      $as_echo "## ----------- ##
 ## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
       echo
       cat confdefs.h
       echo
@@ -3280,7 +3278,12 @@ _ACEOF
 ac_site_file1=NONE
 ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  ac_site_file1=$CONFIG_SITE
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
 elif test "x$prefix" != xNONE; then
   ac_site_file1=$prefix/share/config.site
   ac_site_file2=$prefix/etc/config.site
@@ -3295,7 +3298,11 @@ do
     { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
 $as_echo "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5 ; }
   fi
 done
 
@@ -3375,7 +3382,7 @@ if $ac_cache_corrupted; then
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
   { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
 ## -------------------- ##
 ## Main body of script. ##
@@ -3391,16 +3398,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 ac_aux_dir=
 for ac_dir in tools "$srcdir"/tools; do
-  for ac_t in install-sh install.sh shtool; do
-    if test -f "$ac_dir/$ac_t"; then
-      ac_aux_dir=$ac_dir
-      ac_install_sh="$ac_aux_dir/$ac_t -c"
-      break 2
-    fi
-  done
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
 done
 if test -z "$ac_aux_dir"; then
-  as_fn_error "cannot find install-sh, install.sh, or shtool in tools \"$srcdir\"/tools" "$LINENO" 5
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in tools \"$srcdir\"/tools" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -3445,7 +3458,7 @@ MAJ_MIN_VERSION=`echo ${VERSION} | sed 's/\.[0-9]$//'`
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
@@ -3456,16 +3469,16 @@ else
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -3490,7 +3503,7 @@ else
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
@@ -3498,7 +3511,7 @@ fi
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -3541,14 +3554,14 @@ case "${host_os}" in
    ## with 11 being 10.7.  We no longer support < 10.4 (Tiger)
    ## http://en.wikipedia.org/wiki/Darwin_OS
    darwin1.*)
-     as_fn_error "The earliest supported MacOS X is 10.4.
+     as_fn_error $? "The earliest supported MacOS X is 10.4.
      ;;
   darwin567*" "$LINENO" 5
-     as_fn_error "The earliest supported MacOS X is 10.4.
+     as_fn_error $? "The earliest supported MacOS X is 10.4.
      ;;
   aix123*|aix4.01*" "$LINENO" 5
     ## These need a form of linking we no longer support
-    as_fn_error "AIX prior to 4.2 is not supported" "$LINENO" 5
+    as_fn_error $? "AIX prior to 4.2 is not supported" "$LINENO" 5
     ;;
 esac
 
@@ -5825,8 +5838,8 @@ fi
 
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "no acceptable C compiler found in \$PATH
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -5940,9 +5953,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "C compiler cannot create executables
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -5984,8 +5996,8 @@ done
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -6042,9 +6054,9 @@ $as_echo "$ac_try_echo"; } >&5
     else
 	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
+as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5 ; }
     fi
   fi
 fi
@@ -6095,8 +6107,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -6360,7 +6372,7 @@ else
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -6376,11 +6388,11 @@ else
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
   break
 fi
@@ -6419,7 +6431,7 @@ else
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -6435,18 +6447,18 @@ else
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
 
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=c
@@ -6507,7 +6519,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_GREP=$GREP
@@ -6573,7 +6585,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_EGREP=$EGREP
@@ -6670,7 +6682,7 @@ else
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -6686,11 +6698,11 @@ else
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
   break
 fi
@@ -6729,7 +6741,7 @@ else
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -6745,18 +6757,18 @@ else
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
 
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=c
@@ -6880,7 +6892,7 @@ ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
 ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_f77_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -6924,7 +6936,7 @@ fi
 fi
 if test -z "$F77"; then
   ac_ct_F77=$F77
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -7087,7 +7099,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 else
-  as_fn_error "No F77 compiler found" "$LINENO" 5
+  as_fn_error $? "No F77 compiler found" "$LINENO" 5
 fi
 
 ac_ext=cpp
@@ -7385,7 +7397,7 @@ else
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -7401,11 +7413,11 @@ else
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
   break
 fi
@@ -7444,7 +7456,7 @@ else
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -7460,18 +7472,18 @@ else
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
 
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=c
@@ -7721,8 +7733,7 @@ do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
 "
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -8343,7 +8354,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_SED"; then
-    as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
   fi
 else
   ac_cv_path_SED=$SED
@@ -8422,7 +8433,7 @@ esac
   done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_FGREP"; then
-    as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_FGREP=$FGREP
@@ -8531,7 +8542,7 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
 if test "${lt_cv_prog_gnu_ld+set}" = set; then :
@@ -8733,13 +8744,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:8736: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:8747: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:8739: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:8750: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:8742: output\"" >&5)
+  (eval echo "\"\$as_me:8753: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -10800,7 +10811,7 @@ else
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -10816,11 +10827,11 @@ else
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
   break
 fi
@@ -10859,7 +10870,7 @@ else
   # Broken: fails on valid input.
 continue
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
@@ -10875,11 +10886,11 @@ else
 ac_preproc_ok=:
 break
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then :
 
 else
@@ -10907,7 +10918,7 @@ ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
 ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_f77_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -10951,7 +10962,7 @@ fi
 fi
 if test -z "$F77"; then
   ac_ct_F77=$F77
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -11591,11 +11602,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:11594: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11605: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11598: \$? = $ac_status" >&5
+   echo "$as_me:11609: \$? = $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.
@@ -11930,11 +11941,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:11933: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11944: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11937: \$? = $ac_status" >&5
+   echo "$as_me:11948: \$? = $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.
@@ -12035,11 +12046,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:12038: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12049: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12042: \$? = $ac_status" >&5
+   echo "$as_me:12053: \$? = $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
@@ -12090,11 +12101,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:12093: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12104: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12097: \$? = $ac_status" >&5
+   echo "$as_me:12108: \$? = $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
@@ -14457,7 +14468,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 14460 "configure"
+#line 14471 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14553,7 +14564,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 14556 "configure"
+#line 14567 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14961,7 +14972,7 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
 if test "${lt_cv_prog_gnu_ld+set}" = set; then :
@@ -16502,11 +16513,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:16505: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16516: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16509: \$? = $ac_status" >&5
+   echo "$as_me:16520: \$? = $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.
@@ -16601,11 +16612,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:16604: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16615: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16608: \$? = $ac_status" >&5
+   echo "$as_me:16619: \$? = $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
@@ -16653,11 +16664,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:16656: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16667: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16660: \$? = $ac_status" >&5
+   echo "$as_me:16671: \$? = $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
@@ -18033,11 +18044,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:18036: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18047: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:18040: \$? = $ac_status" >&5
+   echo "$as_me:18051: \$? = $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.
@@ -18132,11 +18143,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:18135: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18146: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:18139: \$? = $ac_status" >&5
+   echo "$as_me:18150: \$? = $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
@@ -18184,11 +18195,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:18187: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18198: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:18191: \$? = $ac_status" >&5
+   echo "$as_me:18202: \$? = $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
@@ -20091,7 +20102,7 @@ $as_echo_n "checking for build C compiler... " >&6; }
   if test "${build_cc_works}" = no; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
 $as_echo "none" >&6; }
-    as_fn_error "Build C compiler doesn't work. Set BUILD_CC to a compiler capable of creating a binary native to the build machine." "$LINENO" 5
+    as_fn_error $? "Build C compiler doesn't work. Set BUILD_CC to a compiler capable of creating a binary native to the build machine." "$LINENO" 5
   fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${BUILD_CC}" >&5
 $as_echo "${BUILD_CC}" >&6; }
@@ -20104,7 +20115,7 @@ $as_echo "${BUILD_R}" >&6; }
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
 $as_echo "none" >&6; }
-    as_fn_error "Build R doesn't work. Set BUILD_R to a native build of the same R version that you want to cross-compile." "$LINENO" 5
+    as_fn_error $? "Build R doesn't work. Set BUILD_R to a native build of the same R version that you want to cross-compile." "$LINENO" 5
   fi
 fi
 
@@ -20416,7 +20427,7 @@ if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 else
-  as_fn_error "Your OS X is too old." "$LINENO" 5
+  as_fn_error $? "Your OS X is too old." "$LINENO" 5
 fi
 
     ## SI says we want '-lcc_dynamic' on Darwin, although currently
@@ -20523,8 +20534,7 @@ if test "${use_readline}" = yes; then
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -20765,14 +20775,14 @@ fi
 done
 
   if test "${use_readline}" = no; then
-    as_fn_error "--with-readline=yes (default) and headers/libs are not available" "$LINENO" 5
+    as_fn_error $? "--with-readline=yes (default) and headers/libs are not available" "$LINENO" 5
   else
     for ac_func in rl_completion_matches
 do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -20971,7 +20981,7 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
   as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Header+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -20998,8 +21008,7 @@ fi
 eval ac_res=\$$as_ac_Header
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
 _ACEOF
@@ -21126,7 +21135,7 @@ fi
 fi
 
 if test "${ac_cv_search_opendir}" = "no"; then
-   as_fn_error "Building R requires the 'opendir' system call" "$LINENO" 5
+   as_fn_error $? "Building R requires the 'opendir' system call" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
@@ -21176,12 +21185,11 @@ for ac_header in arpa/inet.h dl.h dlfcn.h elf.h fcntl.h floatingpoint.h \
   fpu_control.h glob.h grp.h locale.h \
   netdb.h netinet/in.h pwd.h strings.h \
   sys/param.h sys/select.h sys/socket.h sys/stat.h sys/resource.h \
-  sys/time.h sys/times.h sys/utsname.h time.h unistd.h
+  sys/time.h sys/times.h sys/utsname.h time.h unistd.h termios.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -21199,8 +21207,7 @@ for ac_header in errno.h inttypes.h limits.h stdarg.h stdbool.h \
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -21659,8 +21666,8 @@ $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
   no)
      ;;
   *)
-    as_fn_error "unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+    as_fn_error $? "unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5  ;;
 esac
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
@@ -22085,9 +22092,8 @@ else
   if test "$ac_cv_type_int" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (int)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (int)
+See \`config.log' for more details" "$LINENO" 5 ; }
    else
      ac_cv_sizeof_int=0
    fi
@@ -22127,9 +22133,8 @@ else
   if test "$ac_cv_type_long" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (long)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5 ; }
    else
      ac_cv_sizeof_long=0
    fi
@@ -22161,9 +22166,8 @@ else
   if test "$ac_cv_type_long_long" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (long long)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5 ; }
    else
      ac_cv_sizeof_long_long=0
    fi
@@ -22195,9 +22199,8 @@ else
   if test "$ac_cv_type_double" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (double)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (double)
+See \`config.log' for more details" "$LINENO" 5 ; }
    else
      ac_cv_sizeof_double=0
    fi
@@ -22229,9 +22232,8 @@ else
   if test "$ac_cv_type_long_double" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (long double)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (long double)
+See \`config.log' for more details" "$LINENO" 5 ; }
    else
      ac_cv_sizeof_long_double=0
    fi
@@ -22263,9 +22265,8 @@ else
   if test "$ac_cv_type_size_t" = yes; then
      { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (size_t)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (size_t)
+See \`config.log' for more details" "$LINENO" 5 ; }
    else
      ac_cv_sizeof_size_t=0
    fi
@@ -22688,7 +22689,7 @@ fi
 	  ;;
 	  # Ignore these flags.
 	-lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -little \
-	  |-LANG:=* | -LIST:* | -LNO:*)
+	  |-LANG:=* | -LIST:* | -LNO:* | -link)
 	  ;;
 	-lkernel32)
 	  test x"$CYGWIN" != xyes && ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg"
@@ -22824,7 +22825,7 @@ _ACEOF
 # flags.
 r_save_CFLAGS=$CFLAGS
 CFLAGS="$CFLAGS $r_verb"
-(eval echo $as_me:22827: \"$ac_link\") >&5
+(eval echo $as_me:22828: \"$ac_link\") >&5
 r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
 echo "$r_c_v_output" >&5
 CFLAGS=$r_save_CFLAGS
@@ -22899,7 +22900,7 @@ _ACEOF
 # flags.
 r_save_CFLAGS=$CFLAGS
 CFLAGS="$CFLAGS $r_cv_prog_c_v"
-(eval echo $as_me:22902: \"$ac_link\") >&5
+(eval echo $as_me:22903: \"$ac_link\") >&5
 r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
 echo "$r_c_v_output" >&5
 CFLAGS=$r_save_CFLAGS
@@ -23279,8 +23280,8 @@ fi
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "linking to Fortran libraries from C fails
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "linking to Fortran libraries from C fails
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=c
@@ -23441,8 +23442,8 @@ ac_compiler_gnu=$ac_cv_f77_compiler_gnu
 else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compile a simple Fortran program
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compile a simple Fortran program
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
@@ -23521,7 +23522,7 @@ case "${ac_cv_f77_mangling}" in
   "upper "*)
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Fortran compiler uses uppercase external names" >&5
 $as_echo "$as_me: WARNING: Fortran compiler uses uppercase external names" >&2;}
-    as_fn_error "cannot use Fortran" "$LINENO" 5
+    as_fn_error $? "cannot use Fortran" "$LINENO" 5
     ;;
 esac
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${F77} appends underscores to external names" >&5
@@ -23545,7 +23546,7 @@ $as_echo "${r_cv_prog_f77_append_underscore}" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
 $as_echo "unknown" >&6; }
-  as_fn_error "cannot use Fortran" "$LINENO" 5
+  as_fn_error $? "cannot use Fortran" "$LINENO" 5
 fi
 if test "${r_cv_prog_f77_append_underscore}" = yes; then
 
@@ -23573,7 +23574,7 @@ $as_echo "${r_cv_prog_f77_append_second_underscore}" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
 $as_echo "unknown" >&6; }
-  as_fn_error "cannot use Fortran" "$LINENO" 5
+  as_fn_error $? "cannot use Fortran" "$LINENO" 5
 fi
 if test "${r_cv_prog_f77_append_second_underscore}" = yes; then
 
@@ -23649,7 +23650,7 @@ $as_echo "don't know (cross-compiling)" >&6; }
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot run mixed C/Fortran code" >&5
 $as_echo "$as_me: WARNING: cannot run mixed C/Fortran code" >&2;}
-    as_fn_error "Maybe check LDFLAGS for paths to Fortran libraries?" "$LINENO" 5
+    as_fn_error $? "Maybe check LDFLAGS for paths to Fortran libraries?" "$LINENO" 5
   fi
 fi
 
@@ -23741,7 +23742,7 @@ $as_echo "don't know (cross-compiling)" >&6; }
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ${F77} and ${CC} disagree on int and double" >&5
 $as_echo "$as_me: WARNING: ${F77} and ${CC} disagree on int and double" >&2;}
-    as_fn_error "Maybe change CFLAGS or FFLAGS?" "$LINENO" 5
+    as_fn_error $? "Maybe change CFLAGS or FFLAGS?" "$LINENO" 5
   fi
 fi
 
@@ -24629,7 +24630,7 @@ fi
       ac_safe=_mieee_with_inexact
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} accepts -mieee-with-inexact" >&5
 $as_echo_n "checking whether ${CC} accepts -mieee-with-inexact... " >&6; }
-if { as_var=r_cv_prog_cc_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_cc_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -24695,7 +24696,7 @@ fi
       ac_safe=_ieee_with_inexact
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} accepts -ieee_with_inexact" >&5
 $as_echo_n "checking whether ${CC} accepts -ieee_with_inexact... " >&6; }
-if { as_var=r_cv_prog_cc_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_cc_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -24762,7 +24763,7 @@ fi
       ac_safe=_mieee
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${F77} accepts -mieee" >&5
 $as_echo_n "checking whether ${F77} accepts -mieee... " >&6; }
-if { as_var=r_cv_prog_f77_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_f77_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=f
@@ -24813,7 +24814,7 @@ fi
       ac_safe=_fpe3
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${F77} accepts -fpe3" >&5
 $as_echo_n "checking whether ${F77} accepts -fpe3... " >&6; }
-if { as_var=r_cv_prog_f77_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_f77_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=f
@@ -24865,7 +24866,7 @@ fi
       ac_safe=_mieee
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX-c++} accepts -mieee" >&5
 $as_echo_n "checking whether ${CXX-c++} accepts -mieee... " >&6; }
-if { as_var=r_cv_prog_cxx_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_cxx_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=cpp
@@ -24931,7 +24932,7 @@ fi
       ac_safe=_ieee
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX-c++} accepts -ieee" >&5
 $as_echo_n "checking whether ${CXX-c++} accepts -ieee... " >&6; }
-if { as_var=r_cv_prog_cxx_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_cxx_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=cpp
@@ -25009,7 +25010,7 @@ case "${host_os}" in
         ac_safe=_mminimal_toc
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} accepts -mminimal-toc" >&5
 $as_echo_n "checking whether ${CC} accepts -mminimal-toc... " >&6; }
-if { as_var=r_cv_prog_cc_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_cc_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -25075,7 +25076,7 @@ fi
         ac_safe=_mno_fp_in_toc
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} accepts -mno-fp-in-toc" >&5
 $as_echo_n "checking whether ${CC} accepts -mno-fp-in-toc... " >&6; }
-if { as_var=r_cv_prog_cc_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_cc_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=c
@@ -25263,10 +25264,10 @@ fi
     ## compilers *need* '-OPT:IEEE_NaN_inf=ON'.  Currently, all we do is
     ## check whether the non-GNU tools *accept* the flag.
     if test "${G77}" != yes; then
-      ac_safe=_OPT_IEEE_NaN_inf_ON
+      ac_safe=`$as_echo "-OPT:IEEE_NaN_inf=ON" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${F77} accepts -OPT:IEEE_NaN_inf=ON" >&5
 $as_echo_n "checking whether ${F77} accepts -OPT:IEEE_NaN_inf=ON... " >&6; }
-if { as_var=r_cv_prog_f77_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_f77_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=f
@@ -25315,10 +25316,10 @@ fi
 
     fi
     if test "${GXX}" != yes; then
-      ac_safe=_OPT_IEEE_NaN_inf_ON
+      ac_safe=`$as_echo "-OPT:IEEE_NaN_inf=ON" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX-c++} accepts -OPT:IEEE_NaN_inf=ON" >&5
 $as_echo_n "checking whether ${CXX-c++} accepts -OPT:IEEE_NaN_inf=ON... " >&6; }
-if { as_var=r_cv_prog_cxx_flag_${ac_safe}; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${r_cv_prog_cxx_flag_${ac_safe}+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_ext=cpp
@@ -25991,7 +25992,7 @@ if test -z "${CPICFLAGS}"; then
     *)
       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: I could not determine CPICFLAGS." >&5
 $as_echo "$as_me: WARNING: I could not determine CPICFLAGS." >&2;}
-      as_fn_error "See the file doc/html/R-admin.html for more information." "$LINENO" 5
+      as_fn_error $? "See the file doc/html/R-admin.html for more information." "$LINENO" 5
       ;;
   esac
 fi
@@ -26004,7 +26005,7 @@ if test -z "${FPICFLAGS}"; then
     *)
       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: I could not determine FPICFLAGS." >&5
 $as_echo "$as_me: WARNING: I could not determine FPICFLAGS." >&2;}
-      as_fn_error "See the file doc/html/R-admin.html for more information." "$LINENO" 5
+      as_fn_error $? "See the file doc/html/R-admin.html for more information." "$LINENO" 5
       ;;
   esac
 fi
@@ -26036,7 +26037,7 @@ fi
 if test -z "${SHLIB_LDFLAGS}"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: I could not determine SHLIB_LDFLAGS." >&5
 $as_echo "$as_me: WARNING: I could not determine SHLIB_LDFLAGS." >&2;}
-  as_fn_error "See the file doc/html/R-admin.html for more information." "$LINENO" 5
+  as_fn_error $? "See the file doc/html/R-admin.html for more information." "$LINENO" 5
 fi
 
 if test -z "${SHLIB_CXXLD}"; then
@@ -26410,8 +26411,7 @@ if test $ac_cv_os_cray = yes; then
   for ac_func in _getb67 GETB67 getb67; do
     as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
 
 cat >>confdefs.h <<_ACEOF
 #define CRAY_STACKSEG_END $ac_func
@@ -26501,7 +26501,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -26552,7 +26552,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -26598,7 +26598,7 @@ fi
 done
 
 if test "${ac_cv_have_decl_va_copy}" = "no"; then
-   as_fn_error "Building R requires the 'va_copy' system call" "$LINENO" 5
+   as_fn_error $? "Building R requires the 'va_copy' system call" "$LINENO" 5
 fi
 ## isblank should be a macro according to C99.  It was missing on Solaris 8
 for ac_func in isblank
@@ -26619,7 +26619,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -26671,8 +26671,7 @@ for ac_func in fseeko ftello matherr
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -26687,7 +26686,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -26737,7 +26736,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -26787,7 +26786,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -26837,7 +26836,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -26887,7 +26886,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -26933,7 +26932,7 @@ fi
 done
 
 if test "${ac_cv_have_decl_popen}" = "no"; then
-   as_fn_error "Building R requires the 'popen' system call" "$LINENO" 5
+   as_fn_error $? "Building R requires the 'popen' system call" "$LINENO" 5
 fi
 ## Windows has neither setenv nor unsetenv
 for ac_func in setenv unsetenv
@@ -26941,7 +26940,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -26991,7 +26990,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -27041,7 +27040,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -27087,14 +27086,14 @@ fi
 done
 
 if test "${ac_cv_have_decl_stat}" = "no"; then
-   as_fn_error "Building R requires the 'stat' system call" "$LINENO" 5
+   as_fn_error $? "Building R requires the 'stat' system call" "$LINENO" 5
 fi
 for ac_func in gettimeofday
 do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -27144,7 +27143,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -27194,7 +27193,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -27337,7 +27336,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -27391,16 +27390,16 @@ case "${host_os}" in
   ;;
   *)
     if test "${ac_cv_search_glob}" = "no"; then
-       as_fn_error "Building R requires the 'glob' system call" "$LINENO" 5
+       as_fn_error $? "Building R requires the 'glob' system call" "$LINENO" 5
     fi
     if test "${ac_cv_search_access}" = "no"; then
-       as_fn_error "Building R requires the 'access' system call" "$LINENO" 5
+       as_fn_error $? "Building R requires the 'access' system call" "$LINENO" 5
     fi
     if test "${ac_cv_search_getcwd}" = "no"; then
-       as_fn_error "Building R requires the 'getcwd' system call" "$LINENO" 5
+       as_fn_error $? "Building R requires the 'getcwd' system call" "$LINENO" 5
     fi
     if test "${ac_cv_search_chdir}" = "no"; then
-       as_fn_error "Building R requires the 'chdir' system call" "$LINENO" 5
+       as_fn_error $? "Building R requires the 'chdir' system call" "$LINENO" 5
     fi
   ;;
 esac
@@ -27472,7 +27471,7 @@ if test "${r_cv_ieee_754}" = yes; then
 $as_echo "#define IEEE_754 1" >>confdefs.h
 
 else
-  as_fn_error "IEEE 754 floating-point arithmetic is required" "$LINENO" 5
+  as_fn_error $? "IEEE 754 floating-point arithmetic is required" "$LINENO" 5
 fi
 
 
@@ -27652,25 +27651,109 @@ fi
 
 ## Do we need substitutes?
 ## mkdtemp is not on Solaris
-for ac_func in acosh asinh atanh mkdtemp snprintf strdup strncasecmp vsnprintf
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+ac_fn_c_check_func "$LINENO" "acosh" "ac_cv_func_acosh"
+if test "x$ac_cv_func_acosh" = x""yes; then :
+  $as_echo "#define HAVE_ACOSH 1" >>confdefs.h
 
 else
   case " $LIBOBJS " in
-  *" $ac_func.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
+  *" acosh.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS acosh.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "asinh" "ac_cv_func_asinh"
+if test "x$ac_cv_func_asinh" = x""yes; then :
+  $as_echo "#define HAVE_ASINH 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" asinh.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS asinh.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "atanh" "ac_cv_func_atanh"
+if test "x$ac_cv_func_atanh" = x""yes; then :
+  $as_echo "#define HAVE_ATANH 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" atanh.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS atanh.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp"
+if test "x$ac_cv_func_mkdtemp" = x""yes; then :
+  $as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" mkdtemp.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS mkdtemp.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
+if test "x$ac_cv_func_snprintf" = x""yes; then :
+  $as_echo "#define HAVE_SNPRINTF 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" snprintf.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS snprintf.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup"
+if test "x$ac_cv_func_strdup" = x""yes; then :
+  $as_echo "#define HAVE_STRDUP 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" strdup.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS strdup.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "strncasecmp" "ac_cv_func_strncasecmp"
+if test "x$ac_cv_func_strncasecmp" = x""yes; then :
+  $as_echo "#define HAVE_STRNCASECMP 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" strncasecmp.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS strncasecmp.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
+if test "x$ac_cv_func_vsnprintf" = x""yes; then :
+  $as_echo "#define HAVE_VSNPRINTF 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" vsnprintf.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS vsnprintf.$ac_objext"
  ;;
 esac
 
 fi
-done
 
 
 ## Enable declarations in Defn.h?
@@ -28308,7 +28391,7 @@ fi
 
   fi
     if test "${r_cv_c99_complex}" = "no"; then
-    as_fn_error "Support for C99 double complex type is required." "$LINENO" 5
+    as_fn_error $? "Support for C99 double complex type is required." "$LINENO" 5
   fi
 
 fi
@@ -28320,7 +28403,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -28502,8 +28585,7 @@ fi
 if test "${acx_blas_ok}" = no; then
   as_ac_var=`$as_echo "ac_cv_func_${dgemm}" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "${dgemm}" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   acx_blas_ok=yes
 fi
 
@@ -28559,7 +28641,7 @@ if test "x$ac_cv_lib_atlas_ATL_xerbla" = x""yes; then :
   as_ac_Lib=`$as_echo "ac_cv_lib_f77blas_${dgemm}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${dgemm} in -lf77blas" >&5
 $as_echo_n "checking for ${dgemm} in -lf77blas... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28602,8 +28684,7 @@ fi
 eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   acx_blas_ok=yes
                               BLAS_LIBS="-lf77blas -latlas"
 fi
@@ -28617,7 +28698,7 @@ if test "${acx_blas_ok}" = no; then
   as_ac_Lib=`$as_echo "ac_cv_lib_blas_${dgemm}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${dgemm} in -lblas" >&5
 $as_echo_n "checking for ${dgemm} in -lblas... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28660,12 +28741,11 @@ fi
 eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   as_ac_Lib=`$as_echo "ac_cv_lib_dgemm_$dgemm" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $dgemm in -ldgemm" >&5
 $as_echo_n "checking for $dgemm in -ldgemm... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28708,12 +28788,11 @@ fi
 eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   as_ac_Lib=`$as_echo "ac_cv_lib_sgemm_${sgemm}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${sgemm} in -lsgemm" >&5
 $as_echo_n "checking for ${sgemm} in -lsgemm... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28756,8 +28835,7 @@ fi
 eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   acx_blas_ok=yes
                                             BLAS_LIBS="-lsgemm -ldgemm -lblas"
 fi
@@ -28857,7 +28935,7 @@ if test "${acx_blas_ok}" = no; then
   as_ac_Lib=`$as_echo "ac_cv_lib_blas_${dgemm}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${dgemm} in -lblas" >&5
 $as_echo_n "checking for ${dgemm} in -lblas... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28900,12 +28978,11 @@ fi
 eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   as_ac_Lib=`$as_echo "ac_cv_lib_essl_${dgemm}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${dgemm} in -lessl" >&5
 $as_echo_n "checking for ${dgemm} in -lessl... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -28948,8 +29025,7 @@ fi
 eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   acx_blas_ok=yes
                               BLAS_LIBS="-lessl -lblas"
 fi
@@ -28963,7 +29039,7 @@ if test "${acx_blas_ok}" = no; then
   as_ac_Lib=`$as_echo "ac_cv_lib_blas_${dgemm}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${dgemm} in -lblas" >&5
 $as_echo_n "checking for ${dgemm} in -lblas... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -29006,8 +29082,7 @@ fi
 eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   acx_blas_ok=yes; BLAS_LIBS="-lblas"
 fi
 
@@ -29363,7 +29438,7 @@ BLAS_LIBS0="${BLAS_LIBS} ${ac_test_BLAS_LIBS}"
 else
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-as_fn_error "Cannot build Rblas shared library such that it makes external BLAS visible.
+as_fn_error $? "Cannot build Rblas shared library such that it makes external BLAS visible.
 An alternative is to use internal BLAS instead and replace
 libRblas.dylib with the external BLAS library after R is built." "$LINENO" 5
 fi
@@ -29432,8 +29507,7 @@ LIBS="${BLAS_LIBS} ${FLIBS} ${LIBS}"
 if test "${acx_lapack_ok}" = no; then
   as_ac_var=`$as_echo "ac_cv_func_${zgeev}" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "${zgeev}" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   acx_lapack_ok=yes
 fi
 
@@ -29492,7 +29566,7 @@ if test "${acx_lapack_ok}" = no; then
   as_ac_Lib=`$as_echo "ac_cv_lib_lapack_${zgeev}" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${zgeev} in -llapack" >&5
 $as_echo_n "checking for ${zgeev} in -llapack... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -29535,8 +29609,7 @@ fi
 eval ac_res=\$$as_ac_Lib
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   acx_lapack_ok=yes; LAPACK_LIBS="-llapack"
 fi
 
@@ -29746,7 +29819,7 @@ $as_echo "$r_cv_iconv_latin1" >&6; }
       ;;
   esac
   if test "$r_cv_iconv_latin1" != yes; then
-    as_fn_error "a suitable iconv is essential" "$LINENO" 5
+    as_fn_error $? "a suitable iconv is essential" "$LINENO" 5
   fi
 fi
 ## if the iconv we are using was in libiconv we have already included -liconv
@@ -29982,8 +30055,7 @@ for ac_header in wchar.h wctype.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -30007,7 +30079,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -30057,7 +30129,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -30107,7 +30179,7 @@ do
 as_ac_Symbol=`$as_echo "ac_cv_have_decl_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func exists and is declared" >&5
 $as_echo_n "checking whether $ac_func exists and is declared... " >&6; }
-if { as_var=$as_ac_Symbol; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$as_ac_Symbol+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -30198,7 +30270,7 @@ fi
   fi
 fi
 if test "x${want_mbcs_support}" != xyes; then
-as_fn_error "Support for MBCS locales is required." "$LINENO" 5
+as_fn_error $? "Support for MBCS locales is required." "$LINENO" 5
 fi
 
 
@@ -30318,7 +30390,7 @@ _ACEOF
   LIBS="-licucore $LIBS"
 
 else
-  as_fn_error "library 'icucore' is required for ICU" "$LINENO" 5
+  as_fn_error $? "library 'icucore' is required for ICU" "$LINENO" 5
 fi
 
 
@@ -30351,7 +30423,7 @@ if test "x$with_x" = xno; then
   have_x=disabled
 else
   case $x_includes,$x_libraries in #(
-    *\'*) as_fn_error "cannot use X directory names containing '" "$LINENO" 5;; #(
+    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5 ;; #(
     *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
@@ -30369,7 +30441,7 @@ libdir:
 	@echo libdir='${LIBDIR}'
 _ACEOF
   if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
-    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+    # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
     for ac_var in incroot usrlibdir libdir; do
       eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
     done
@@ -30455,7 +30527,7 @@ else
   fi
 done
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 fi # $ac_x_includes = no
 
 if test "$ac_x_libraries" = no; then
@@ -31190,7 +31262,7 @@ $as_echo "#define HAVE_X11 1" >>confdefs.h
   X_LIBS="${X_LIBS} -lX11 -lXt"
 else
   if test "x${with_x}" != "xno"; then
-    as_fn_error "--with-x=yes (default) and X11 headers/libs are not available" "$LINENO" 5
+    as_fn_error $? "--with-x=yes (default) and X11 headers/libs are not available" "$LINENO" 5
   fi
 fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: using X11 ... ${use_X11}" >&5
@@ -31833,8 +31905,7 @@ fi
 	    ${TCL_PREFIX}/include; do
 	  as_ac_Header=`$as_echo "ac_cv_header_${dir}/tcl.h" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "${dir}/tcl.h" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   TCLTK_CPPFLAGS="-I${dir}"
 			   found_tcl_h=yes
 			   break
@@ -31920,8 +31991,7 @@ fi
 	    ${TK_PREFIX}/include; do
 	  as_ac_Header=`$as_echo "ac_cv_header_${dir}/tk.h" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "${dir}/tk.h" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   TCLTK_CPPFLAGS="${TCLTK_CPPFLAGS} -I${dir}"
 			   found_tk_h=yes
 			   break
@@ -33143,8 +33213,7 @@ fi
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -34316,7 +34385,7 @@ else
 
     if test "${acx_java_uses_custom_flags}" = yes; then
       r_cv_jni=no
-      as_fn_error "Failed to compile a JNI program with custom JAVA_LIBS/JAVA_CPPFLAGS.
+      as_fn_error $? "Failed to compile a JNI program with custom JAVA_LIBS/JAVA_CPPFLAGS.
 See config.log for details.
 Do NOT set JAVA_LIBS/JAVA_CPPFLAGS unless you are sure they are correct!
 Java/JNI support is optional unless you set either JAVA_LIBS or JAVA_CPPFLAGS." "$LINENO" 5
@@ -34399,7 +34468,7 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -34443,7 +34512,7 @@ fi
 fi
 if test -z "$FC"; then
   ac_ct_FC=$FC
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -34606,7 +34675,7 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -34650,7 +34719,7 @@ fi
 fi
 if test -z "$FC"; then
   ac_ct_FC=$FC
-  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
+  for ac_prog in gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn xlf90 f90 pgf90 pghpf epcf90 g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -35386,11 +35455,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:35389: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:35458: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:35393: \$? = $ac_status" >&5
+   echo "$as_me:35462: \$? = $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.
@@ -35485,11 +35554,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:35488: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:35557: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:35492: \$? = $ac_status" >&5
+   echo "$as_me:35561: \$? = $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
@@ -35537,11 +35606,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:35540: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:35609: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:35544: \$? = $ac_status" >&5
+   echo "$as_me:35613: \$? = $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
@@ -37821,7 +37890,7 @@ fi
 $as_echo "$r_cv_misc_recommended_packages" >&6; }
 use_recommended_packages=${r_cv_misc_recommended_packages}
 if test "x${r_cv_misc_recommended_packages}" = xno; then
-  as_fn_error "Some of the recommended packages are missing
+  as_fn_error $? "Some of the recommended packages are missing
   Use --without-recommended-packages if this was intentional" "$LINENO" 5
 fi
 
@@ -37859,7 +37928,7 @@ if test "${USE_NLS}" = "yes"; then
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -37867,7 +37936,7 @@ SHELL = /bin/sh
 all:
 	@echo '@@@%%%=$(MAKE)=@@@%%%'
 _ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
 case `${MAKE-make} -f conftest.make 2>/dev/null` in
   *@@@%%%=?*=@@@%%%*)
     eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -38492,8 +38561,7 @@ do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
 "
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -39908,8 +39976,7 @@ rm -f core conftest.err conftest.$ac_objext \
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -39924,8 +39991,7 @@ done
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -40875,8 +40941,7 @@ fi
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -40889,8 +40954,7 @@ done
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -41363,7 +41427,7 @@ typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
 
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5
 $as_echo_n "checking for GNU gettext in libc... " >&6; }
-if { as_var=$gt_func_gnugettext_libc; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$gt_func_gnugettext_libc+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -41783,7 +41847,7 @@ fi
 
           { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5
 $as_echo_n "checking for GNU gettext in libintl... " >&6; }
-if { as_var=$gt_func_gnugettext_libintl; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval "test \"\${$gt_func_gnugettext_libintl+set}\"" = set; then :
   $as_echo_n "(cached) " >&6
 else
   gt_save_CPPFLAGS="$CPPFLAGS"
@@ -42215,6 +42279,7 @@ DEFS=-DHAVE_CONFIG_H
 
 ac_libobjs=
 ac_ltlibobjs=
+U=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
@@ -42230,111 +42295,111 @@ LTLIBOBJS=$ac_ltlibobjs
 
 
 if test -z "${WANT_R_FRAMEWORK_TRUE}" && test -z "${WANT_R_FRAMEWORK_FALSE}"; then
-  as_fn_error "conditional \"WANT_R_FRAMEWORK\" was never defined.
+  as_fn_error $? "conditional \"WANT_R_FRAMEWORK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WANT_R_SHLIB_TRUE}" && test -z "${WANT_R_SHLIB_FALSE}"; then
-  as_fn_error "conditional \"WANT_R_SHLIB\" was never defined.
+  as_fn_error $? "conditional \"WANT_R_SHLIB\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${WANT_R_STATIC_TRUE}" && test -z "${WANT_R_STATIC_FALSE}"; then
-  as_fn_error "conditional \"WANT_R_STATIC\" was never defined.
+  as_fn_error $? "conditional \"WANT_R_STATIC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
-  as_fn_error "conditional \"MAINTAINER_MODE\" was never defined.
+  as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_HTML_TRUE}" && test -z "${BUILD_HTML_FALSE}"; then
-  as_fn_error "conditional \"BUILD_HTML\" was never defined.
+  as_fn_error $? "conditional \"BUILD_HTML\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BYTE_COMPILE_PACKAGES_TRUE}" && test -z "${BYTE_COMPILE_PACKAGES_FALSE}"; then
-  as_fn_error "conditional \"BYTE_COMPILE_PACKAGES\" was never defined.
+  as_fn_error $? "conditional \"BYTE_COMPILE_PACKAGES\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${CROSS_COMPILING_TRUE}" && test -z "${CROSS_COMPILING_FALSE}"; then
-  as_fn_error "conditional \"CROSS_COMPILING\" was never defined.
+  as_fn_error $? "conditional \"CROSS_COMPILING\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${COMPILE_FORTRAN_DOUBLE_COMPLEX_TRUE}" && test -z "${COMPILE_FORTRAN_DOUBLE_COMPLEX_FALSE}"; then
-  as_fn_error "conditional \"COMPILE_FORTRAN_DOUBLE_COMPLEX\" was never defined.
+  as_fn_error $? "conditional \"COMPILE_FORTRAN_DOUBLE_COMPLEX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${DYLIB_UNDEFINED_ALLOWED_TRUE}" && test -z "${DYLIB_UNDEFINED_ALLOWED_FALSE}"; then
-  as_fn_error "conditional \"DYLIB_UNDEFINED_ALLOWED\" was never defined.
+  as_fn_error $? "conditional \"DYLIB_UNDEFINED_ALLOWED\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_CYGWIN_TRUE}" && test -z "${BUILD_CYGWIN_FALSE}"; then
-  as_fn_error "conditional \"BUILD_CYGWIN\" was never defined.
+  as_fn_error $? "conditional \"BUILD_CYGWIN\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${USE_EXPORTFILES_TRUE}" && test -z "${USE_EXPORTFILES_FALSE}"; then
-  as_fn_error "conditional \"USE_EXPORTFILES\" was never defined.
+  as_fn_error $? "conditional \"USE_EXPORTFILES\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BLAS_SHLIB_TRUE}" && test -z "${BLAS_SHLIB_FALSE}"; then
-  as_fn_error "conditional \"BLAS_SHLIB\" was never defined.
+  as_fn_error $? "conditional \"BLAS_SHLIB\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${USE_VECLIB_G95FIX_TRUE}" && test -z "${USE_VECLIB_G95FIX_FALSE}"; then
-  as_fn_error "conditional \"USE_VECLIB_G95FIX\" was never defined.
+  as_fn_error $? "conditional \"USE_VECLIB_G95FIX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${USE_EXTERNAL_BLAS_TRUE}" && test -z "${USE_EXTERNAL_BLAS_FALSE}"; then
-  as_fn_error "conditional \"USE_EXTERNAL_BLAS\" was never defined.
+  as_fn_error $? "conditional \"USE_EXTERNAL_BLAS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${USE_EXTERNAL_LAPACK_TRUE}" && test -z "${USE_EXTERNAL_LAPACK_FALSE}"; then
-  as_fn_error "conditional \"USE_EXTERNAL_LAPACK\" was never defined.
+  as_fn_error $? "conditional \"USE_EXTERNAL_LAPACK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_X11_TRUE}" && test -z "${BUILD_X11_FALSE}"; then
-  as_fn_error "conditional \"BUILD_X11\" was never defined.
+  as_fn_error $? "conditional \"BUILD_X11\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_AQUA_TRUE}" && test -z "${BUILD_AQUA_FALSE}"; then
-  as_fn_error "conditional \"BUILD_AQUA\" was never defined.
+  as_fn_error $? "conditional \"BUILD_AQUA\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_XDR_TRUE}" && test -z "${BUILD_XDR_FALSE}"; then
-  as_fn_error "conditional \"BUILD_XDR\" was never defined.
+  as_fn_error $? "conditional \"BUILD_XDR\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_ZLIB_TRUE}" && test -z "${BUILD_ZLIB_FALSE}"; then
-  as_fn_error "conditional \"BUILD_ZLIB\" was never defined.
+  as_fn_error $? "conditional \"BUILD_ZLIB\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${USE_MMAP_ZLIB_TRUE}" && test -z "${USE_MMAP_ZLIB_FALSE}"; then
-  as_fn_error "conditional \"USE_MMAP_ZLIB\" was never defined.
+  as_fn_error $? "conditional \"USE_MMAP_ZLIB\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_BZLIB_TRUE}" && test -z "${BUILD_BZLIB_FALSE}"; then
-  as_fn_error "conditional \"BUILD_BZLIB\" was never defined.
+  as_fn_error $? "conditional \"BUILD_BZLIB\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_XZ_TRUE}" && test -z "${BUILD_XZ_FALSE}"; then
-  as_fn_error "conditional \"BUILD_XZ\" was never defined.
+  as_fn_error $? "conditional \"BUILD_XZ\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_PCRE_TRUE}" && test -z "${BUILD_PCRE_FALSE}"; then
-  as_fn_error "conditional \"BUILD_PCRE\" was never defined.
+  as_fn_error $? "conditional \"BUILD_PCRE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_JAVA14_TRUE}" && test -z "${BUILD_JAVA14_FALSE}"; then
-  as_fn_error "conditional \"BUILD_JAVA14\" was never defined.
+  as_fn_error $? "conditional \"BUILD_JAVA14\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${USE_RECOMMENDED_PACKAGES_TRUE}" && test -z "${USE_RECOMMENDED_PACKAGES_FALSE}"; then
-  as_fn_error "conditional \"USE_RECOMMENDED_PACKAGES\" was never defined.
+  as_fn_error $? "conditional \"USE_RECOMMENDED_PACKAGES\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${USE_NLS_TRUE}" && test -z "${USE_NLS_FALSE}"; then
-  as_fn_error "conditional \"USE_NLS\" was never defined.
+  as_fn_error $? "conditional \"USE_NLS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${BUILD_LIBINTL_TRUE}" && test -z "${BUILD_LIBINTL_FALSE}"; then
-  as_fn_error "conditional \"BUILD_LIBINTL\" was never defined.
+  as_fn_error $? "conditional \"BUILD_LIBINTL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
@@ -42484,19 +42549,19 @@ export LANGUAGE
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
 as_fn_error ()
 {
-  as_status=$?; test $as_status -eq 0 && as_status=1
-  if test "$3"; then
-    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   fi
-  $as_echo "$as_me: error: $1" >&2
+  $as_echo "$as_me: error: $2" >&2
   as_fn_exit $as_status
 } # as_fn_error
 
@@ -42692,7 +42757,7 @@ $as_echo X"$as_dir" |
       test -d "$as_dir" && break
     done
     test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
 
 
 } # as_fn_mkdir_p
@@ -42746,7 +42811,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by R $as_me 2.13.1, which was
-generated by GNU Autoconf 2.65.  Invocation command line was
+generated by GNU Autoconf 2.67.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -42812,10 +42877,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 R config.status 2.13.1
-configured by $0, generated by GNU Autoconf 2.65,
+configured by $0, generated by GNU Autoconf 2.67,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -42833,11 +42898,16 @@ ac_need_defaults=:
 while test $# != 0
 do
   case $1 in
-  --*=*)
+  --*=?*)
     ac_option=`expr "X$1" : 'X\([^=]*\)='`
     ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
     ac_shift=:
     ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
   *)
     ac_option=$1
     ac_optarg=$2
@@ -42859,6 +42929,7 @@ do
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
     esac
     as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
@@ -42871,7 +42942,7 @@ do
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    as_fn_error "ambiguous option: \`$1'
+    as_fn_error $? "ambiguous option: \`$1'
 Try \`$0 --help' for more information.";;
   --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
@@ -42880,7 +42951,7 @@ Try \`$0 --help' for more information.";;
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) as_fn_error "unrecognized option: \`$1'
+  -*) as_fn_error $? "unrecognized option: \`$1'
 Try \`$0 --help' for more information." ;;
 
   *) as_fn_append ac_config_targets " $1"
@@ -43546,7 +43617,7 @@ do
     "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
     "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;;
 
-  *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
   esac
 done
 
@@ -43584,7 +43655,7 @@ $debug ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -43618,7 +43689,7 @@ if test "x$ac_cr" = x; then
 fi
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\r'
+  ac_cs_awk_cr='\\r'
 else
   ac_cs_awk_cr=$ac_cr
 fi
@@ -43635,7 +43706,7 @@ _ACEOF
   echo "_ACEOF"
 } >conf$$files.sh &&
 . ./conf$$files.sh ||
-  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 rm -f conf$$files.sh
 
 {
@@ -43643,18 +43714,18 @@ rm -f conf$$files.sh
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -43749,20 +43820,28 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
 else
   cat
 fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || as_fn_error "could not setup config files machinery" "$LINENO" 5
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
 # trailing colons and then remove the whole line if VPATH becomes empty
 # (actually we leave an empty line to preserve line numbers).
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[	 ]*\):*/\1/
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=[	 ]*/{
+h
+s///
+s/^/:/
+s/[	 ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
 s/:*$//
+x
+s/\(=[	 ]*\).*/\1/
+G
+s/\n//
 s/^[^=]*=[	 ]*$//
 }'
 fi
@@ -43790,7 +43869,7 @@ for ac_last_try in false false :; do
   if test -z "$ac_t"; then
     break
   elif $ac_last_try; then
-    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -43875,7 +43954,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  as_fn_error "could not setup config headers machinery" "$LINENO" 5
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -43888,7 +43967,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -43916,7 +43995,7 @@ do
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -43943,7 +44022,7 @@ $as_echo "$as_me: creating $ac_file" >&6;}
 
     case $ac_tag in
     *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
     esac
     ;;
   esac
@@ -44085,22 +44164,22 @@ if $ac_cs_awk_getline; then
 else
   $AWK -f "$tmp/subs.awk" | $SHELL
 fi >$tmp/out \
-  || as_fn_error "could not create $ac_file" "$LINENO" 5
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
   { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
+which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
+which seems to be undefined.  Please make sure it is defined" >&2;}
 
   rm -f "$tmp/stdin"
   case $ac_file in
   -) cat "$tmp/out" && rm -f "$tmp/out";;
   *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
   esac \
-  || as_fn_error "could not create $ac_file" "$LINENO" 5
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -44111,19 +44190,19 @@ which seems to be undefined.  Please make sure it is defined." >&2;}
       $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
     } >"$tmp/config.h" \
-      || as_fn_error "could not create $ac_file" "$LINENO" 5
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
     if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
       mv "$tmp/config.h" "$ac_file" \
-	|| as_fn_error "could not create $ac_file" "$LINENO" 5
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || as_fn_error "could not create -" "$LINENO" 5
+      || as_fn_error $? "could not create -" "$LINENO" 5
   fi
  ;;
 
@@ -45366,7 +45445,7 @@ _ACEOF
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
@@ -45387,7 +45466,7 @@ if test "$no_create" != yes; then
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || as_fn_exit $?
+  $ac_cs_success || as_fn_exit 1
 fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
diff --git a/configure.ac b/configure.ac
index 07b5f27..a062188 100644
--- a/configure.ac
+++ b/configure.ac
@@ -753,7 +753,7 @@ AC_CHECK_HEADERS(arpa/inet.h dl.h dlfcn.h elf.h fcntl.h floatingpoint.h \
   fpu_control.h glob.h grp.h locale.h \
   netdb.h netinet/in.h pwd.h strings.h \
   sys/param.h sys/select.h sys/socket.h sys/stat.h sys/resource.h \
-  sys/time.h sys/times.h sys/utsname.h time.h unistd.h)
+  sys/time.h sys/times.h sys/utsname.h time.h unistd.h termios.h)
 ## </NOTE>
 ## <NOTE>
 ## These are C99 headers but some C code (written to work also
diff --git a/src/include/Internal.h b/src/include/Internal.h
index c960db9..6092e3a 100644
--- a/src/include/Internal.h
+++ b/src/include/Internal.h
@@ -566,6 +566,7 @@ SEXP do_isseekable(SEXP, SEXP, SEXP, SEXP);
 SEXP do_close(SEXP, SEXP, SEXP, SEXP);
 SEXP do_fifo(SEXP, SEXP, SEXP, SEXP);
 SEXP do_pipe(SEXP, SEXP, SEXP, SEXP);
+SEXP do_tty(SEXP, SEXP, SEXP, SEXP);
 SEXP do_url(SEXP, SEXP, SEXP, SEXP);
 SEXP do_gzfile(SEXP, SEXP, SEXP, SEXP);
 SEXP do_unz(SEXP, SEXP, SEXP, SEXP);
diff --git a/src/include/config.h.in b/src/include/config.h.in
index 7e7a46b..5a3fb58 100644
--- a/src/include/config.h.in
+++ b/src/include/config.h.in
@@ -716,6 +716,9 @@
    to be built. */
 #undef HAVE_TCLTK
 
+/* Define to 1 if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
 /* Define this if libtiff is available. */
 #undef HAVE_TIFF
 
diff --git a/src/library/base/R/connections.R b/src/library/base/R/connections.R
index 8bfaa7e..1364aa4 100644
--- a/src/library/base/R/connections.R
+++ b/src/library/base/R/connections.R
@@ -81,6 +81,12 @@ file <- function(description = "", open = "", blocking = TRUE,
 pipe <- function(description, open = "", encoding = getOption("encoding"))
     .Internal(pipe(description, open, encoding))
 
+tty <- function(description, open = "", blocking = TRUE, baudrate = NULL,
+                input = NULL, output = NULL, control = NULL, local = NULL,
+                chars = NULL)
+    .Internal(tty(description, open, blocking, baudrate, input,
+                  output, control, local, chars))
+
 fifo <- function(description, open = "", blocking = FALSE,
                  encoding = getOption("encoding"))
     .Internal(fifo(description, open, blocking, encoding))
diff --git a/src/library/base/man/connections.Rd b/src/library/base/man/connections.Rd
index 1995421..46b82c5 100644
--- a/src/library/base/man/connections.Rd
+++ b/src/library/base/man/connections.Rd
@@ -15,6 +15,7 @@
 \alias{bzfile}
 \alias{xzfile}
 \alias{url}
+\alias{tty}
 \alias{socketConnection}
 \alias{open}
 \alias{open.connection}
@@ -61,10 +62,15 @@ pipe(description, open = "", encoding = getOption("encoding"))
 fifo(description, open = "", blocking = FALSE,
      encoding = getOption("encoding"))
 
+tty(description, open = "", blocking = TRUE, baudrate = NULL, 
+    input = NULL, output = NULL, control = NULL, local = NULL,
+    chars = NULL)
+
 socketConnection(host = "localhost", port, server = FALSE,
                  blocking = FALSE, open = "a+",
                  encoding = getOption("encoding"))
 
+
 open(con, \dots)
 \method{open}{connection}(con, open = "r", blocking = TRUE, \dots)
 
@@ -95,6 +101,12 @@ isIncomplete(con)
     \code{xzfile} can also be negative: see the \sQuote{Compression}
     section.}
   \item{filename}{a filename within a zip file.}
+  \item{baudrate}{integer. Baud rate.}
+  \item{input}{list. input flags.}
+  \item{output}{list. output flags.}
+  \item{control}{list. control flags.}
+  \item{local}{list. local flags.}
+  \item{chars}{list. special characters.}
   \item{host}{character.  Host name for port.}
   \item{port}{integer.  The TCP port number.}
   \item{server}{logical.  Should the socket be a client or a server?}
@@ -105,7 +117,7 @@ isIncomplete(con)
   \item{\dots}{arguments passed to or from other methods.}
 }
 \details{
-  The first nine functions create connections.  By default the
+  The first ten functions create connections.  By default the
   connection is not opened (except for \code{socketConnection}), but may
   be opened by setting a non-empty value of argument \code{open}.
 
@@ -155,6 +167,10 @@ isIncomplete(con)
   2.10.0, but \code{raw=TRUE} is now required for reading, and
   \code{fifo} was always the documented interface.) % PR#14366
 
+  For \code{tty} the description is the path or name of a tty
+  terminal interface (e.g. \code{"/dev/ttyS0"}).
+ 
+
   All platforms support \code{file}, \code{pipe}, \code{gzfile},
   \code{bzfile}, \code{xzfile}, \code{unz} and \code{url("file://")}
   connections.  The other connections may be partially implemented or
@@ -236,9 +252,9 @@ isIncomplete(con)
 
 \value{
   \code{file}, \code{pipe}, \code{fifo}, \code{url}, \code{gzfile},
-  \code{bzfile}, \code{xzfile}, \code{unz} and \code{socketConnection}
-  return a connection object which inherits from class
-  \code{"connection"} and has a first more specific class.
+  \code{bzfile}, \code{xzfile}, \code{unz}, \code{tty}, 
+  and \code{socketConnection} return a connection object which inherits
+  from class \code{"connection"} and has a first more specific class.
 
   \code{isOpen} returns a logical value, whether the connection is
   currently open.
@@ -289,12 +305,11 @@ isIncomplete(con)
   deferred if \code{open = ""} is given (the default for all but socket
   connections).  An explicit call to \code{open} can specify the mode,
   but otherwise the mode will be \code{"r"}.  (\code{gzfile},
-  \code{bzfile} and \code{xzfile} connections are exceptions, as the
-  compressed file always has to be opened in binary mode and no
-  conversion of line-endings is done even on Windows, so the default
-  mode is interpreted as \code{"rb"}.)  Most operations that need write
-  access or text-only or binary-only mode will override the default mode
-  of a non-yet-open connection.
+  \code{bzfile}, \code{xzfile}, and \code{tty} connections must be opened 
+  in binary mode and no conversion of line-endings is done even on Windows,
+  so the default mode is interpreted as \code{"rb"}.)  Most operations that
+  need write access or text-only or binary-only mode will override the 
+  default mode of a non-yet-open connection.
 
   Append modes need to be considered carefully for compressed-file
   connections.  They do \strong{not} produce a single compressed stream
@@ -386,8 +401,8 @@ isIncomplete(con)
 }
 
 \section{Blocking}{
-  Whether or not the connection blocks can be specified for file, url
-  (default yes) fifo and socket connections (default not).
+  Whether or not the connection blocks can be specified for file, url,
+  and tty (default yes) fifo, and socket connections (default not).
 
   In blocking mode, functions using the connection do not return to the
   \R evaluator until the read/write is complete.  In non-blocking mode,
@@ -409,6 +424,8 @@ isIncomplete(con)
   the time the connection is opened (more precisely, when the last
   connection of that type -- \samp{http:}, \samp{ftp:} or socket -- was
   opened).
+
+  See TTY for blocking in \code{tty} connections.
 }
 
 \section{Fifos}{
@@ -422,6 +439,34 @@ isIncomplete(con)
   and provides an similar facility to \code{file()}.
 }
 
+\section{TTY}{
+  The input, output, control, local, and chars parameters of the
+  tty connection correspond directly to the flags and special
+  characters described in the Low-Level Terminal Interface
+  chapter (chapter 17) in the GNU libc manual
+  (http://www.gnu.org/s/libc/manual/)
+
+  When the tty represents a serial device, the baudrate argument
+  may be used to set the input and output baud rates for the 
+  device.
+
+  The input, output, control, and local arguments are each lists
+  of named logical values, for instance \samp{ICANON=FALSE}.
+  Each named logical value represents a terminal interface 
+  setting. The collection of settings is system dependent, but
+  most are standardized (see the Low-Level Terminal Interface
+  documentation).
+
+  The chars argument is a list of named _raw_ values, for instance
+  \samp{VMIN = as.raw(0)}. Special characters are used, for examle, 
+  to indicate which character should be considered the end of file
+  (EOF) character. In addition, the special characters VMIN and 
+  VTIME are used to control the blocking properties of the terminal.
+
+  \code{tty} connections are only supported on POSIX compliant 
+  systems (e.g. GNU Linux, BSD, Mac OS X) .
+}
+
 \section{Clipboard}{
   \code{file} can be used with \code{description = "clipboard"}
 #ifdef windows
@@ -462,7 +507,7 @@ isIncomplete(con)
 \note{
   \R's connections are modelled on those in S version 4 (see Chambers,
   1998).  However \R goes well beyond the S model, for example in output
-  text connections and URL, compressed and socket connections.
+  text connections and URL, compressed, tty, and socket connections.
 
   The default open mode in \R is \code{"r"} except for socket connections.
   This differs from S, where it is the equivalent of \code{"r+"},
diff --git a/src/main/connections.c b/src/main/connections.c
index df5487a..e897f99 100644
--- a/src/main/connections.c
+++ b/src/main/connections.c
@@ -2105,6 +2105,846 @@ static Rconnection newclp(const char *url, const char *inmode)
     return new;
 }
 
+/* -------------------- tty connections --------------------- */
+
+#if defined(HAVE_TERMIOS_H) && defined(HAVE_FCNTL_H)\
+                            && defined(HAVE_FDOPEN)
+#define HAVE_TTY_POSIX 1
+#include <termios.h>
+
+/* strategy:
+   tty(description, open, blocking, baudrate, input, output, 
+       control, local, chars)
+  
+   description - name of tty device
+   open        - file read/write mode
+   blocking    - should read/writes block
+   baudrate    - integer baudrate
+   input       - list of named logical input flags
+   output      - list of named logical output flags
+   control     - list of named logical control flags
+   local       - list of named logical local flags
+   chars       - list of named raw special characters
+   
+   baudrate, input, output, control, local, and chars 
+   correspond to the flags and other items used to control
+   POSIX terminals. These are described in the header
+   termios.h and the Low-Level Terminal Interface chapter
+   (chapter 17) of the GNU libc manual.
+   http://www.gnu.org/s/libc/manual/
+
+   do_tty opens the tty, checks that the device is a tty, 
+   reads the terminal properties (struct termios), and closes
+   the device. The input, output, control, local, and chars 
+   arguments are parsed as _changes_ to the current tty 
+   settings.  
+*/
+
+#define SET_FLAG(flag, mask, valu)\
+    {if(*valu) flag |=  mask;\
+     else      flag &= ~mask;}
+
+/* The parse[iolc]flags series of functions convert a string (name)
+   into a bitmask, and sets the appropriate bit in an instance of 
+   struct termios (tio) according to a logical value (valu). Each
+   return 0 on success, -1 on failure. #ifdefs are applied liberally
+   in order to accommodate various, system dependent extensions to 
+   the termios interface.
+*/
+static int parseiflag(const char *name, int *valu, struct termios *tio)
+{
+    if(strcmp(name, "BRKINT") == 0) {
+        SET_FLAG(tio->c_iflag, BRKINT, valu);
+    } else if(strcmp(name, "ICRNL") == 0) {
+        SET_FLAG(tio->c_iflag, ICRNL, valu);
+    } else if(strcmp(name, "IGNBRK") == 0) {
+        SET_FLAG(tio->c_iflag, IGNBRK, valu);
+    } else if(strcmp(name, "IGNCR") == 0) {
+        SET_FLAG(tio->c_iflag, IGNCR, valu);
+    } else if(strcmp(name, "IGNPAR") == 0) {
+        SET_FLAG(tio->c_iflag, IGNPAR, valu);
+    } else if(strcmp(name, "INLCR") == 0) {
+        SET_FLAG(tio->c_iflag, INLCR, valu);
+    } else if(strcmp(name, "INPCK") == 0) {
+        SET_FLAG(tio->c_iflag, INPCK, valu);
+    } else if(strcmp(name, "ISTRIP") == 0) {
+        SET_FLAG(tio->c_iflag, ISTRIP, valu);
+#ifdef IUCLC
+    } else if(strcmp(name, "IUCLC") == 0) {
+        SET_FLAG(tio->c_iflag, IUCLC, valu);
+#endif
+    } else if(strcmp(name, "IXOFF") == 0) {
+        SET_FLAG(tio->c_iflag, IXOFF, valu);
+    } else if(strcmp(name, "IXON") == 0) {
+        SET_FLAG(tio->c_iflag, IXON, valu);
+    } else if(strcmp(name, "PARMRK") == 0) {
+        SET_FLAG(tio->c_iflag, PARMRK, valu);
+#ifdef IXANY /* BSD extension */
+    } else if(strcmp(name, "IXANY") == 0) {
+        SET_FLAG(tio->c_iflag, IXANY, valu);
+#endif
+#ifdef IMAXBEL /* BSD extension */
+    } else if(strcmp(name, "IMAXBEL") == 0) {
+        SET_FLAG(tio->c_iflag, IMAXBEL, valu);
+#endif
+#ifdef IUTF8
+    } else if(strcmp(name, "IUTF8") == 0) {
+        SET_FLAG(tio->c_iflag, IUTF8, valu);
+#endif
+    } else return -1;
+    return 0;
+}
+
+static int parseoflag(const char *name, int *valu, struct termios *tio)
+{
+    if(strcmp(name, "OPOST") == 0) {
+        SET_FLAG(tio->c_oflag, OPOST, valu);
+#ifdef OLCUC
+    } else if(strcmp(name, "OLCUC") == 0) {
+        SET_FLAG(tio->c_oflag, OLCUC, valu);
+#endif
+#ifdef ONLCR /* BSD extension */
+    } else if(strcmp(name, "ONLCR") == 0) {
+        SET_FLAG(tio->c_oflag, ONLCR, valu);
+#endif
+#ifdef OXTABS /* BSD extension */
+    } else if(strcmp(name, "OXTABS") == 0) {
+        SET_FLAG(tio->c_oflag, OXTABS, valu);
+#endif
+#ifdef ONOEOT /* BSD extension */
+    } else if(strcmp(name, "ONOEOT") == 0) {
+        SET_FLAG(tio->c_oflag, ONOEOT, valu);
+#endif
+#ifdef OCRNL
+    } else if(strcmp(name, "OCRNL") == 0) {
+        SET_FLAG(tio->c_oflag, OCRNL, valu);
+#endif
+#ifdef ONOCR
+    } else if(strcmp(name, "ONOCR") == 0) {
+        SET_FLAG(tio->c_oflag, ONOCR, valu);
+#endif
+#ifdef ONLRET
+    } else if(strcmp(name, "ONLRET") == 0) {
+        SET_FLAG(tio->c_oflag, ONLRET, valu);
+#endif
+#ifdef OFILL
+    } else if(strcmp(name, "OFILL") == 0) {
+        SET_FLAG(tio->c_oflag, OFILL, valu);
+#endif
+#ifdef OFDEL
+    } else if(strcmp(name, "OFDEL") == 0) {
+        SET_FLAG(tio->c_oflag, OFDEL, valu);
+#endif
+#ifdef NLDLY
+    } else if(strcmp(name, "NLDLY") == 0) {
+        warning(_("%s is a bitmask, use %s instead"),\
+                "NLDLY", "NL#");
+    } else if(strcmp(name, "NL0") == 0) {
+        tio->c_oflag &= ~NLDLY;
+        SET_FLAG(tio->c_oflag, NL0, valu);
+    } else if(strcmp(name, "NL1") == 0) {
+        tio->c_oflag &= ~NLDLY;
+        SET_FLAG(tio->c_oflag, NL1, valu);
+#endif
+#ifdef CRDLY
+    } else if(strcmp(name, "CRDLY") == 0) {
+        warning(_("%s is a bitmask, use %s instead"),\
+                "CRDLY", "CR[0-3]");
+    } else if(strcmp(name, "CR0") == 0) {
+        tio->c_oflag &= ~CRDLY;
+        SET_FLAG(tio->c_oflag, CR0, valu);
+    } else if(strcmp(name, "CR1") == 0) {
+        tio->c_oflag &= ~CRDLY;
+        SET_FLAG(tio->c_oflag, CR1, valu);
+    } else if(strcmp(name, "CR2") == 0) {
+        tio->c_oflag &= ~CRDLY;
+        SET_FLAG(tio->c_oflag, CR2, valu);
+    } else if(strcmp(name, "CR3") == 0) {
+        tio->c_oflag &= ~CRDLY;
+        SET_FLAG(tio->c_oflag, CR3, valu);
+#endif
+#ifdef TABDLY
+    } else if(strcmp(name, "TABDLY") == 0) {
+        warning(_("%s is a bitmask, use %s instead"),\
+                "TABDLY", "TAB[0-3]");
+    } else if(strcmp(name, "TAB0") == 0) {
+        tio->c_oflag &= ~TABDLY;
+        SET_FLAG(tio->c_oflag, TAB0, valu);
+    } else if(strcmp(name, "TAB1") == 0) {
+        tio->c_oflag &= ~TABDLY;
+        SET_FLAG(tio->c_oflag, TAB1, valu);
+    } else if(strcmp(name, "TAB2") == 0) {
+        tio->c_oflag &= ~TABDLY;
+        SET_FLAG(tio->c_oflag, TAB2, valu);
+    } else if(strcmp(name, "TAB3") == 0) {
+        tio->c_oflag &= ~TABDLY;
+        SET_FLAG(tio->c_oflag, TAB3, valu);
+#endif
+#ifdef BSDLY
+    } else if(strcmp(name, "BSDLY") == 0) {
+        warning(_("%s is a bitmask, use %s instead"),\
+                "BSDLY", "BS[0-1]");
+    } else if(strcmp(name, "BS0") == 0) {
+        tio->c_oflag &= ~BSDLY;
+        SET_FLAG(tio->c_oflag, BS0, valu);
+    } else if(strcmp(name, "BS1") == 0) {
+        tio->c_oflag &= ~BSDLY;
+        SET_FLAG(tio->c_oflag, BS1, valu);
+#endif
+#ifdef VTDLY
+    } else if(strcmp(name, "VTDLY") == 0) {
+        warning(_("%s is a bitmask, use %s instead"),\
+                "VTDLY", "VT[0-1]");
+    } else if(strcmp(name, "VT0") == 0) {
+        tio->c_oflag &= ~VTDLY;
+        SET_FLAG(tio->c_oflag, VT0, valu);
+    } else if(strcmp(name, "VT1") == 0) {
+        tio->c_oflag &= ~VTDLY;
+        SET_FLAG(tio->c_oflag, VT1, valu);
+#endif
+#ifdef FFDLY
+    } else if(strcmp(name, "FFDLY") == 0) {
+        warning(_("%s is a bitmask, use %s instead"),\
+                "FFDLY", "FF[0-1]");
+    } else if(strcmp(name, "FF0") == 0) {
+        tio->c_oflag &= ~FFDLY;
+        SET_FLAG(tio->c_oflag, FF0, valu);
+    } else if(strcmp(name, "FF1") == 0) {
+        tio->c_oflag &= ~FFDLY;
+        SET_FLAG(tio->c_oflag, FF1, valu);
+#endif
+    } else return -1;
+    return 0;
+}
+
+static int parsecflag(const char *name, int *valu, struct termios *tio)
+{
+    if(strcmp(name, "CSIZE") == 0) {
+        warning(_("%s is a bitmask, use %s instead"),\
+                "CSIZE", "CS[5-8]");
+    } else if(strcmp(name, "CS5") == 0) {
+        tio->c_cflag &= ~CSIZE;
+        SET_FLAG(tio->c_cflag, CS5, valu);
+    } else if(strcmp(name, "CS6") == 0) {
+        tio->c_cflag &= ~CSIZE;
+        SET_FLAG(tio->c_cflag, CS6, valu);
+    } else if(strcmp(name, "CS7") == 0) {
+        tio->c_cflag &= ~CSIZE;
+        SET_FLAG(tio->c_cflag, CS7, valu);
+    } else if(strcmp(name, "CS8") == 0) {
+        tio->c_cflag &= ~CSIZE;
+        SET_FLAG(tio->c_cflag, CS8, valu);
+    } else if(strcmp(name, "CSTOPB") == 0) {
+        SET_FLAG(tio->c_cflag, CSTOPB, valu);
+    } else if(strcmp(name, "CREAD") == 0) {
+        SET_FLAG(tio->c_cflag, CREAD, valu);
+    } else if(strcmp(name, "PARENB") == 0) {
+        SET_FLAG(tio->c_cflag, PARENB, valu);
+    } else if(strcmp(name, "PARODD") == 0) {
+        SET_FLAG(tio->c_cflag, PARODD, valu);
+    } else if(strcmp(name, "HUPCL") == 0) {
+        SET_FLAG(tio->c_cflag, HUPCL, valu);
+    } else if(strcmp(name, "CLOCAL") == 0) {
+        SET_FLAG(tio->c_cflag, CLOCAL, valu);
+#ifdef CCTS_OFLOW /* BSD extension */
+    } else if(strcmp(name, "CCTS_OFLOW") == 0) {
+        SET_FLAG(tio->c_cflag, CCTS_OFLOW, valu);
+#endif
+#ifdef CRTS_IFLOW /* BSD extension */
+    } else if(strcmp(name, "CRTS_IFLOW") == 0) {
+        SET_FLAG(tio->c_cflag, CRTS_IFLOW, valu);
+#endif
+#ifdef MDMBUF /* BSD estension */
+    } else if(strcmp(name, "MDMBUF") == 0) {
+        SET_FLAG(tio->c_cflag, MDMBUF, valu);
+#endif
+#ifdef CIGNORE /* BSD extension */
+    } else if(strcmp(name, "CIGNORE") == 0) {
+        SET_FLAG(tio->c_cflag, CIGNORE, valu);
+#endif
+#ifdef CMSPAR
+    } else if(strcmp(name, "CMSPAR") == 0) {
+        SET_FLAG(tio->c_cflag, CMSPAR, valu);
+#endif
+#ifdef CRTSCTS
+    } else if(strcmp(name, "CRTSCTS") == 0) {
+        SET_FLAG(tio->c_cflag, CRTSCTS, valu);
+#endif
+    } else return -1;
+    return 0;
+}
+
+static int parselflag(const char *name, int *valu, struct termios *tio)
+{
+    if(strcmp(name, "ECHO") == 0) {
+        SET_FLAG(tio->c_lflag, ECHO, valu);
+    } else if(strcmp(name, "ECHOE") == 0) {
+        SET_FLAG(tio->c_lflag, ECHOE, valu);
+    } else if(strcmp(name, "ECHOK") == 0) {
+        SET_FLAG(tio->c_lflag, ECHOK, valu);
+    } else if(strcmp(name, "ECHONL") == 0) {
+        SET_FLAG(tio->c_lflag, ECHONL, valu);
+#ifdef ECHOKE /* BSD extension */
+    } else if(strcmp(name, "ECHOKE") == 0) {
+        SET_FLAG(tio->c_lflag, ECHOKE, valu);
+#endif
+#ifdef ECHOPRT /* BSD extension */
+    } else if(strcmp(name, "ECHOPRT") == 0) {
+        SET_FLAG(tio->c_lflag, ECHOPRT, valu);
+#endif
+#ifdef ECHOCTL /* BSD extension */
+    } else if(strcmp(name, "ECHOCTL") == 0) {
+        SET_FLAG(tio->c_lflag, ECHOCTL, valu);
+#endif
+    } else if(strcmp(name, "ICANON") == 0) {
+        SET_FLAG(tio->c_lflag, ICANON, valu);
+    } else if(strcmp(name, "IEXTEN") == 0) {
+        SET_FLAG(tio->c_lflag, IEXTEN, valu);
+    } else if(strcmp(name, "ISIG") == 0) {
+        SET_FLAG(tio->c_lflag, ISIG, valu);
+    } else if(strcmp(name, "NOFLSH") == 0) {
+        SET_FLAG(tio->c_lflag, NOFLSH, valu);
+    } else if(strcmp(name, "TOSTOP") == 0) {
+        SET_FLAG(tio->c_lflag, TOSTOP, valu);
+#ifdef XCASE
+    } else if(strcmp(name, "XCASE") == 0) {
+        SET_FLAG(tio->c_lflag, XCASE, valu);
+#endif
+#ifdef ALTWERASE /* BSD extension */
+    } else if(strcmp(name, "ALTWERASE") == 0) {
+        SET_FLAG(tio->c_lflag, ALTWERASE, valu);
+#endif
+#ifdef FLUSHO /* BSD extension */
+    } else if(strcmp(name, "FLUSHO") == 0) {
+        SET_FLAG(tio->c_lflag, FLUSHO, valu);
+#endif
+#ifdef NOKERNINFO /* BSD extension */
+    } else if(strcmp(name, "NOKERNINFO") == 0) {
+        SET_FLAG(tio->c_lflag, NOKERNINFO, valu);
+#endif
+#ifdef PENDIN /* BSD extension */
+    } else if(strcmp(name, "PENDIN") == 0) {
+        SET_FLAG(tio->c_lflag, PENDIN, valu);
+#endif
+#ifdef EXTPROC
+    } else if(strcmp(name, "EXTPROC") == 0) {
+        SET_FLAG(tio->c_lflag, EXTPROC, valu);
+#endif
+    } else return -1;
+    return 0; 
+}
+
+/* The parsechars function converts a character string (name)
+   to an index in the c_cc array of an instance of
+   struct termios (tio), and sets the corresponding character
+   to a value (valu). parsechars returns 0 on success, -1 on failure
+*/
+int parsechars(const char *name, const char *valu, struct termios *tio)
+{
+    if(strcmp(name, "VEOF") == 0) {
+        tio->c_cc[VEOF] = *valu;
+    } else if(strcmp(name, "VEOL") == 0) {
+        tio->c_cc[VEOL] = *valu;
+    } else if(strcmp(name, "VERASE") == 0) {
+        tio->c_cc[VERASE] = *valu;
+    } else if(strcmp(name, "VINTR") == 0) {
+        tio->c_cc[VINTR] = *valu;
+    } else if(strcmp(name, "VKILL") == 0) {
+        tio->c_cc[VKILL] = *valu;
+    } else if(strcmp(name, "VMIN") == 0) {
+        tio->c_cc[VMIN] = *valu;
+    } else if(strcmp(name, "VQUIT") == 0) {
+        tio->c_cc[VQUIT] = *valu;
+    } else if(strcmp(name, "VSTART") == 0) {
+        tio->c_cc[VSTART] = *valu;
+    } else if(strcmp(name, "VSTOP") == 0) {
+        tio->c_cc[VSTOP] = *valu;
+    } else if(strcmp(name, "VSUSP") == 0) {
+        tio->c_cc[VSUSP] = *valu;
+    } else if(strcmp(name, "VTIME") == 0) {
+        tio->c_cc[VTIME] = *valu;
+#ifdef VLNEXT /* BSD extension */
+    } else if(strcmp(name, "VLNEXT") == 0) {
+        tio->c_cc[VLNEXT] = *valu;
+#endif
+#ifdef VDISCARD /* BSD extension */
+    } else if(strcmp(name, "VDISCARD") == 0) {
+        tio->c_cc[VDISCARD] = *valu;
+#endif
+#ifdef VSTATUS /* BSD extension */
+    } else if(strcmp(name, "VSTATUS") == 0) {
+        tio->c_cc[VSTATUS] = *valu;
+#endif
+#ifdef VSWTC
+    } else if(strcmp(name, "VSWTC") == 0) {
+        tio->c_cc[VSWTC] = *valu;
+#endif
+#ifdef VREPRINT
+    } else if(strcmp(name, "VREPRINT") == 0) {
+        tio->c_cc[VREPRINT] = *valu;
+#endif
+#ifdef VWERASE
+    } else if(strcmp(name, "VWERASE") == 0) {
+        tio->c_cc[VWERASE] = *valu;
+#endif
+#ifdef VEOL2
+    } else if(strcmp(name, "VEOL2") == 0) {
+        tio->c_cc[VEOL2] = *valu;
+#endif
+#ifdef VDSUSP
+    } else if(strcmp(name, "VDSUSP") == 0) {
+        tio->c_cc[VDSUSP] = *valu;
+#endif
+
+    } else return -1;
+    return 0;
+}
+
+/* The parsebaud function converts an integer (valu)
+   to a baudrate, and sets the input or output baudrate
+   of an instace of struct termios (tio). Whether parsebaud
+   sets the input or output baudrate is determined by an 
+   integer (io), where 0 indicates output, and nonzero
+   indicates input. parsebaud returns 0 on success, -1 on 
+   failure
+*/
+#define SET_BAUD(tio, io, baud)\
+    {if(io) cfsetispeed(tio, baud);\
+     else cfsetospeed(tio, baud);}
+int parsebaud(int io, int *valu, struct termios *tio)
+{
+    if(*valu==0) { SET_BAUD(tio, io, B0); }
+    else if(*valu==50) { SET_BAUD(tio, io, B50); }
+    else if(*valu==75) { SET_BAUD(tio, io, B75); }
+    else if(*valu==110) { SET_BAUD(tio, io, B110); }
+    else if(*valu==134) { SET_BAUD(tio, io, B134); }
+    else if(*valu==150) { SET_BAUD(tio, io, B150); }
+    else if(*valu==200) { SET_BAUD(tio, io, B200); }
+    else if(*valu==300) { SET_BAUD(tio, io, B300); }
+    else if(*valu==600) { SET_BAUD(tio, io, B600); }
+    else if(*valu==1200) { SET_BAUD(tio, io, B1200); }
+    else if(*valu==1800) { SET_BAUD(tio, io, B1800); }
+    else if(*valu==2400) { SET_BAUD(tio, io, B2400); }
+    else if(*valu==4800) { SET_BAUD(tio, io, B4800); }
+    else if(*valu==9600) { SET_BAUD(tio, io, B9600); }
+    else if(*valu==19200) { SET_BAUD(tio, io, B19200); }
+    else if(*valu==38400) { SET_BAUD(tio, io, B38400); }
+#ifdef B57600
+    else if(*valu==57600) { SET_BAUD(tio, io, B57600); }
+#endif
+#ifdef B115300
+    else if(*valu==115200) { SET_BAUD(tio, io, B115200); }
+#endif
+#ifdef B230400
+    else if(*valu==230400) { SET_BAUD(tio, io, B230400); }
+#endif
+#ifdef B460800
+    else if(*valu==460800) { SET_BAUD(tio, io, B460800); }
+#endif
+#ifdef B500000
+    else if(*valu==500000) { SET_BAUD(tio, io, B500000); }
+#endif
+#ifdef B576000
+    else if(*valu==576000) { SET_BAUD(tio, io, B576000); }
+#endif
+#ifdef B921600
+    else if(*valu==921600) { SET_BAUD(tio, io, B921600); }
+#endif
+#ifdef B1000000
+    else if(*valu==1000000) { SET_BAUD(tio, io, B1000000); }
+#endif
+#ifdef B1152000
+    else if(*valu==1152000) { SET_BAUD(tio, io, B1152000); }
+#endif
+#ifdef B1500000
+    else if(*valu==1500000) { SET_BAUD(tio, io, B1500000); }
+#endif
+#ifdef B2000000
+    else if(*valu==2000000) { SET_BAUD(tio, io, B2000000); }
+#endif
+#ifdef B2500000
+    else if(*valu==2500000) { SET_BAUD(tio, io, B2500000); }
+#endif
+#ifdef B3000000
+    else if(*valu==3000000) { SET_BAUD(tio, io, B3000000); }
+#endif
+#ifdef B3500000
+    else if(*valu==3500000) { SET_BAUD(tio, io, B3500000); }
+#endif
+#ifdef B4000000
+    else if(*valu==4000000) { SET_BAUD(tio, io, B4000000); }
+#endif
+    else return -1;
+    return 0;
+}
+
+typedef struct ttyconn {
+    FILE * fp;
+    struct termios initio; // initial settings 
+    struct termios curtio; // current settings
+} *Rttyconn;
+
+static void tty_close(Rconnection con)
+{
+    Rttyconn tty = (Rttyconn)con->private;
+    int fd = fileno(tty->fp);
+
+    /* restore initial tty attributes */
+    if(tcsetattr(fd, TCSANOW, &tty->initio) < 0) {
+        warning(_("failed to restore tty attributes %s: %s"),\
+          con->description, strerror(errno));
+    }
+    fclose(tty->fp);
+    con->isopen = FALSE;
+}
+
+static Rboolean tty_open(Rconnection con)
+{
+    Rttyconn tty = (Rttyconn)con->private;
+    int fd, omode;
+    FILE *fp;
+    char *ma, *mr, *mw, *mp; 
+    speed_t inbaud, outbaud;
+
+    /* open in binary mode only */
+    ma = strchr(con->mode, 'a');
+    mr = strchr(con->mode, 'r');
+    mw = strchr(con->mode, 'w');
+    mp = strchr(con->mode, '+');
+    omode = (mp || (mr && mw) || (mr && ma))? O_RDWR:\
+            (mw || ma)? O_WRONLY : O_RDONLY;
+    strcpy(con->mode, (mp || (mr && mw) || (mr && ma))? "r+b":\
+                      (mw || ma) ? "wb" : "rb" );
+
+    /* initially open with O_NONBLOCK, clear later */
+    fd = open(con->description, omode|O_NONBLOCK|O_NOCTTY);
+    if(fd < 0) {
+	warning(_("cannot open %s in mode %s: %s"),\
+            con->description, con->mode, strerror(errno));
+	return FALSE;
+    }
+    tty->fp = fdopen(fd, con->mode);
+    if(!tty->fp) {
+	warning(_("cannot open %s in mode %s: %s"),\
+            con->description, con->mode, strerror(errno));
+	return FALSE;
+    }
+
+    /* save initial tty attributes */
+    if(tcgetattr(fd, &tty->initio) < 0) {
+        warning(_("failed to get tty attributes %s: %s"),\
+            con->description, strerror(errno));
+        fclose(fp);
+        return FALSE;
+    }
+ 
+    /* set current tty attributes */
+    if(tcsetattr(fd, TCSANOW, &tty->curtio) < 0) {
+        warning(_("failed to set tty attributes %s: %s\n"),\
+            con->description, strerror(errno));
+        tty_close(con);
+        return FALSE;
+    }
+
+    /* clear O_NONBLOCK so that VMIN & VTIME take effect */
+    omode = fcntl(fd, F_GETFL);
+    if(omode < 0) {
+        warning(_("failed to get tty attributes %s: %s\n"),\
+            con->description, strerror(errno));
+        tty_close(con);
+        return FALSE;
+    }
+    omode &= ~O_NONBLOCK;
+    if(fcntl(fd, F_SETFL, omode) < 0) {
+        warning(_("failed to set tty attributes %s: %s\n"),\
+            con->description, strerror(errno));
+        tty_close(con);
+        return FALSE;
+    }
+
+    con->isopen = TRUE;
+    con->canwrite = mp || mw || ma;
+    con->canread = mp || mr;
+
+    /* set_iconv(con); // doesn't do anything (yet?) */
+    return TRUE;
+}
+
+static int tty_fflush(Rconnection con)
+{
+    Rttyconn tty = (Rttyconn)con->private;
+    return fflush(tty->fp);
+}
+
+static size_t 
+tty_read(void *ptr, size_t size, size_t nitems, Rconnection con)
+{
+    Rttyconn tty = (Rttyconn)con->private;
+    return fread(ptr, size, nitems, tty->fp);
+}
+
+static int tty_fgetc_internal(Rconnection con)
+{
+    char buf[1];
+    size_t size = tty_read(buf, 1, 1, con);
+    return (size < 1) ? R_EOF : (buf[0] % 256);
+}
+
+static int tty_fgetc(Rconnection con)
+{
+    return tty_fgetc_internal(con);
+}
+
+static size_t 
+tty_write(const void *ptr, size_t size, size_t nitems, Rconnection con)
+{
+    Rttyconn tty = (Rttyconn)con->private;
+    return fwrite(ptr, size, nitems, tty->fp);
+}
+
+static int tty_vfprintf(Rconnection con, const char *format, va_list ap)
+{
+    Rttyconn tty = con->private;
+    return vfprintf(tty->fp, format, ap);
+}
+
+static Rconnection
+newtty(const char *device, const char *open, struct termios *tio)
+{
+    Rconnection con;
+    Rttyconn tty;
+
+    con = (Rconnection) malloc(sizeof(struct Rconn));
+    if(!con) error(_("allocation of %s connection failed"), "tty");
+    con->class = (char *) malloc(strlen("tty") + 1);
+    if(!con->class) {
+	free(con);
+	error(_("allocation of %s connection failed"), "tty");
+    }
+    strcpy(con->class, "tty");
+
+    con->description = (char *) malloc(strlen(device) + 1);
+    if(!con->description) {
+	free(con->class); free(con);
+	error(_("allocation of tty connection failed"), "tty");
+    }
+    init_con(con, device, CE_NATIVE, open);
+
+    con->text = FALSE;
+    con->open = &tty_open;
+    con->close = &tty_close;
+    con->fflush = &tty_fflush;
+    con->read = &tty_read; 
+    con->write = &tty_write;
+    con->fgetc_internal = &tty_fgetc_internal; 
+    con->fgetc = &tty_fgetc;
+    con->vfprintf = &tty_vfprintf;
+
+    tty = (Rttyconn) malloc(sizeof(struct ttyconn));
+    if(!tty) {
+	free(con->description); free(con->class); free(con);
+	error(_("allocation of tty connection failed"));
+    }
+    con->private = (void *)tty;
+    memcpy(&tty->curtio, tio, sizeof(struct termios));
+
+    if(tty->curtio.c_lflag & ICANON) {
+        con->blocking = TRUE;
+    } else if(tty->curtio.c_cc[VMIN]  > 0 ||\
+              tty->curtio.c_cc[VTIME] > 0) {
+        con->blocking = TRUE;
+    } else con->blocking = FALSE;
+        
+    return con;
+}
+#endif /* HAVE_TTY_POSIX */
+
+SEXP attribute_hidden do_tty(SEXP call, SEXP op, SEXP args, SEXP env)
+{
+#ifdef HAVE_TTY_POSIX
+    SEXP elmt, name, names, sarg, down, class, ans;
+    struct termios tio;
+    const char *device, *mode;
+    int i, fd, ncon, block;
+    Rconnection con;
+
+    checkArity(op, args);
+
+    /* description */
+    down = args;
+    sarg = CAR(down);
+    if(!isString(sarg) || length(sarg) != 1)
+	error(_("invalid '%s' argument"), "description");
+    device = translateChar(STRING_ELT(sarg, 0));
+
+    /* mode */
+    down = CDR(down);
+    sarg = CAR(down);
+    if(!isString(sarg) || length(sarg) != 1)
+	error(_("invalid '%s' argument"), "open");
+    mode = CHAR(STRING_ELT(sarg, 0));
+
+    /* blocking */
+    down = CDR(down);
+    sarg = CAR(down);
+    if(!isLogical(sarg) || length(sarg) < 1)
+        error(_("invalid '%s' argument"), "blocking");
+    if(LOGICAL(sarg)[0] == NA_LOGICAL)
+        error(_("invalid '%a' argument"), "blocking");
+    block = LOGICAL(sarg)[0];
+
+
+    /* open, check isatty, get termios info, close */
+    fd = open(device, O_RDONLY|O_NONBLOCK|O_NOCTTY);
+    if(fd < 0) error(_("cannot open %s: %s"), device, strerror(errno));
+    if(!isatty(fd)) error("%s is not a tty", device);
+    if(tcgetattr(fd, &tio) < 0) {
+        close(fd);
+        error(_("failed to get serial attributes %s: %s"),\
+            con->description, strerror(errno));
+    }
+    close(fd);
+
+    /* if blocking FALSE, clear ICANON flag, set VMIN, VTIME. If blocking
+       TRUE, set ICANON flag. This is a design decision that should be 
+       documented. */
+    if(!block) {
+        tio.c_lflag &= ~ICANON;
+        tio.c_cc[VMIN] = 0;
+        tio.c_cc[VTIME] = 0;
+    } else {
+        tio.c_lflag |= ICANON;
+    }
+
+    /* baudrate */
+    down = CDR(down);
+    sarg = CAR(down);
+    if(sarg != R_NilValue) {
+        if(!isInteger(sarg) || length(sarg) != 1)
+            error(_("invalid %s argument"), "baudrate");
+        elmt = sarg;
+        if(parsebaud(0, INTEGER(elmt), &tio))
+            error("invalid baudrate %d", INTEGER(elmt)[0]);
+        if(parsebaud(1, INTEGER(elmt), &tio))
+            error("invalid baudrate %d", INTEGER(elmt)[0]);
+    }
+     
+    /* input list */
+    down = CDR(down);
+    sarg = CAR(down);
+    if(sarg != R_NilValue) {
+        if(!isNewList(sarg) || length(sarg) < 1)
+            error(_("invalid %s argument"), "input");
+        names = getAttrib(sarg, R_NamesSymbol);
+        for(i = 0; i < length(sarg); i++) {
+            elmt = VECTOR_ELT(sarg, i);
+            name = STRING_ELT(names, i);
+            if(!isLogical(elmt) || length(elmt) != 1)
+                error(_("invalid %s flag %s"), "input", CHAR(name));
+            if(parseiflag(CHAR(name), LOGICAL(elmt), &tio))
+                error(_("invalid %s flag %s"), "input", CHAR(name));
+        }
+    }
+
+    /* output list */
+    down = CDR(down);
+    sarg = CAR(down);
+    if(sarg != R_NilValue) {
+        if(!isNewList(sarg) || length(sarg) < 1)
+            error(_("invalid %s argument"), "output");
+        names = getAttrib(sarg, R_NamesSymbol);
+        for(i = 0; i < length(sarg); i++) {
+            elmt = VECTOR_ELT(sarg, i);
+            name = STRING_ELT(names, i);
+            if(!isLogical(elmt) || length(elmt) != 1)
+                error(_("invalid %s flag %s"), "output", CHAR(name));
+            if(parseoflag(CHAR(name), LOGICAL(elmt), &tio))
+                error(_("invalid %s flag %s"), "output", CHAR(name));
+        }
+    }
+
+    /* control list */
+    down = CDR(down);
+    sarg = CAR(down);
+    if(sarg != R_NilValue) {
+        if(!isNewList(sarg) || length(sarg) < 1)
+            error(_("invalid %s argument"), "control");
+        names = getAttrib(sarg, R_NamesSymbol);
+        for(i = 0; i < length(sarg); i++) {
+            elmt = VECTOR_ELT(sarg, i);
+            name = STRING_ELT(names, i);
+            if(!isLogical(elmt) || length(elmt) != 1)
+                error(_("invalid %s flag %s"), "control", CHAR(name));
+            if(parsecflag(CHAR(name), LOGICAL(elmt), &tio))
+                error(_("invalid %s flag %s"), "control", CHAR(name));
+        }
+    }
+
+    /* local list */
+    down = CDR(down);
+    sarg = CAR(down);
+    if(sarg != R_NilValue) {
+        if(!isNewList(sarg) || length(sarg) < 1)
+            error(_("invalid %s argument"), "local");
+        names = getAttrib(sarg, R_NamesSymbol);
+        for(i = 0; i < length(sarg); i++) {
+            elmt = VECTOR_ELT(sarg, i);
+            name = STRING_ELT(names, i);
+            if(!isLogical(elmt) || length(elmt) != 1)
+                error(_("invalid %s flag %s"), "local", CHAR(name));
+            if(parselflag(CHAR(name), LOGICAL(elmt), &tio))
+                error(_("invalid %s flag %s"), "local", CHAR(name));
+        }
+    }
+
+    /* chars list */
+    down = CDR(down);
+    sarg = CAR(down);
+    if(sarg != R_NilValue) {
+        if(!isNewList(sarg) || length(sarg) < 1)
+            error(_("invalid %s argument"), "chars");
+        names = getAttrib(sarg, R_NamesSymbol);
+        for(i = 0; i < length(sarg); i++) {
+            elmt = VECTOR_ELT(sarg, i);
+            name = STRING_ELT(names, i);
+            if(TYPEOF(elmt) != RAWSXP || length(elmt) != 1)
+                error(_("invalid %s argument %s"), "chars", CHAR(name));
+            if(parsechars(CHAR(name), RAW(elmt), &tio))
+                error(_("invalid %s argument %s"), "chars", CHAR(name));
+        }
+    }
+
+    ncon = NextConnection();
+    con  = newtty(device, strlen(mode)?mode:"rb", &tio);
+    Connections[ncon] = con;
+    
+    /* open if requested */
+    if(strlen(mode)) {
+        if(!con->open(con)) {
+            con_destroy(ncon);
+            error(_("cannot open the connection"));
+        }
+    }
+
+    PROTECT(ans = ScalarInteger(ncon));
+    PROTECT(class = allocVector(STRSXP, 2));
+    SET_STRING_ELT(class, 0, mkChar("tty"));
+    SET_STRING_ELT(class, 1, mkChar("connection"));
+    classgets(ans, class);
+    con->ex_ptr = R_MakeExternalPtr(con->id, install("connection"),
+				    R_NilValue);
+    setAttrib(ans, install("conn_id"), con->ex_ptr);
+    R_RegisterCFinalizerEx(con->ex_ptr, conFinalizer, FALSE);
+    UNPROTECT(2);
+
+    return ans; 
+#else
+    error(_("tty connections are not supported on this platform"));
+    return R_NilValue;
+#endif 
+}
+
+
 /* ------------------- terminal connections --------------------- */
 
 static unsigned char  ConsoleBuf[CONSOLE_BUFFER_SIZE+1];
diff --git a/src/main/names.c b/src/main/names.c
index db74eb2..25e477b 100644
--- a/src/main/names.c
+++ b/src/main/names.c
@@ -966,6 +966,7 @@ attribute_hidden FUNTAB R_FunTab[] =
 {"bzfile",	do_gzfile,	1,      11,     4,      {PP_FUNCALL, PREC_FN,	0}},
 {"xzfile",	do_gzfile,	2,      11,     4,      {PP_FUNCALL, PREC_FN,	0}},
 {"unz",		do_unz,		0,      11,     3,      {PP_FUNCALL, PREC_FN,	0}},
+{"tty",		do_tty,		0,	11,	9,	{PP_FUNCALL, PREC_FN,	0}},
 {"seek",	do_seek,	0,      11,     4,      {PP_FUNCALL, PREC_FN,	0}},
 {"truncate",	do_truncate,	0,      11,     1,      {PP_FUNCALL, PREC_FN,	0}},
 {"pushBack",	do_pushback,	0,      11,     3,      {PP_FUNCALL, PREC_FN,	0}},
diff --git a/tools/ltmain.sh b/tools/ltmain.sh
old mode 100644
new mode 100755
index b36c4ad..fa4b1e1
--- a/tools/ltmain.sh
+++ b/tools/ltmain.sh
@@ -1,6 +1,6 @@
 # Generated from ltmain.m4sh.
 
-# ltmain.sh (GNU libtool) 2.2.6
+# ltmain.sh (GNU libtool) 2.2.6b
 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
@@ -65,7 +65,7 @@
 #       compiler:		$LTCC
 #       compiler flags:		$LTCFLAGS
 #       linker:		$LD (gnu? $with_gnu_ld)
-#       $progname:		(GNU libtool) 2.2.6
+#       $progname:		(GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu3
 #       automake:		$automake_version
 #       autoconf:		$autoconf_version
 #
@@ -73,9 +73,9 @@
 
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION=2.2.6
+VERSION="2.2.6b Debian-2.2.6b-2ubuntu3"
 TIMESTAMP=""
-package_revision=1.3012
+package_revision=1.3017
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -116,15 +116,15 @@ $lt_unset CDPATH
 
 : ${CP="cp -f"}
 : ${ECHO="echo"}
-: ${EGREP="/usr/bin/grep -E"}
-: ${FGREP="/usr/bin/grep -F"}
-: ${GREP="/usr/bin/grep"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
 : ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
-: ${SED="/opt/local/bin/gsed"}
+: ${SED="/bin/sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -5033,7 +5033,10 @@ func_mode_link ()
 	case $pass in
 	dlopen) libs="$dlfiles" ;;
 	dlpreopen) libs="$dlprefiles" ;;
-	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+	link)
+	  libs="$deplibs %DEPLIBS%"
+	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+	  ;;
 	esac
       fi
       if test "$linkmode,$pass" = "lib,dlpreopen"; then
@@ -5344,19 +5347,19 @@ func_mode_link ()
 	    # It is a libtool convenience library, so add in its objects.
 	    convenience="$convenience $ladir/$objdir/$old_library"
 	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+	      if $opt_duplicate_deps ; then
+		case "$tmp_libs " in
+		*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+		esac
+	      fi
+	      tmp_libs="$tmp_libs $deplib"
+	    done
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
 	    func_fatal_error "\`$lib' is not a convenience library"
 	  fi
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    deplibs="$deplib $deplibs"
-	    if $opt_duplicate_deps ; then
-	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	      esac
-	    fi
-	    tmp_libs="$tmp_libs $deplib"
-	  done
 	  continue
 	fi # $pass = conv
 
@@ -5893,6 +5896,7 @@ func_mode_link ()
 	  if test "$link_all_deplibs" != no; then
 	    # Add the search paths of all dependency libraries
 	    for deplib in $dependency_libs; do
+	      path=
 	      case $deplib in
 	      -L*) path="$deplib" ;;
 	      *.la)
@@ -6206,6 +6210,9 @@ func_mode_link ()
 	    revision="$number_minor"
 	    lt_irix_increment=no
 	    ;;
+	  *)
+	    func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+	    ;;
 	  esac
 	  ;;
 	no)
