aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-11-01 05:50:30 +0000
committerdos-reis <gdr@axiomatics.org>2008-11-01 05:50:30 +0000
commitb9495611c4ec4ae6adc2aef08f9a08aaf5df6f1c (patch)
tree2eb882ea95fa1b1e32156d7e881e109a97e13d3e
parentad6ac4dc3c9662098ad38ca99cbf46d6315af52b (diff)
downloadopen-axiom-b9495611c4ec4ae6adc2aef08f9a08aaf5df6f1c.tar.gz
* sman/sman.c (ptsPath): Remove.
* sman/Makefile.in: Add additional C runtimes for link. * lib/openpty.c: Include <pty.h> and <util.h> where available. (ptyopen): Lose third parameter. Tidy. (makeNextPtyNames): Now static. * clef/edible.c (controllerPath): Remove. Adjust call to ptyopen. * clef/Makefile.in (clef_LDADD): Add extra C runtimes.
-rw-r--r--ChangeLog6
-rw-r--r--config/openaxiom-c-macros.h.in10
-rw-r--r--config/var-def.mk2
-rwxr-xr-xconfigure387
-rw-r--r--configure.ac19
-rw-r--r--configure.ac.pamphlet19
-rw-r--r--src/ChangeLog11
-rw-r--r--src/clef/Makefile.in2
-rw-r--r--src/clef/edible.c3
-rw-r--r--src/include/openpty.H13
-rw-r--r--src/lib/openpty.c66
-rw-r--r--src/sman/Makefile.in6
-rw-r--r--src/sman/sman.c4
13 files changed, 467 insertions, 71 deletions
diff --git a/ChangeLog b/ChangeLog
index a4758d0b..c9b5fd75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-01 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * config/var-def.mk (oa_c_runtime_extra): Add @LIBS@.
+ * configure.ac.pamphlet: Check for <pty.h> and <util.h>. Check
+ for openpty.
+
2008-10-26 Gabriel Dos Reis <gdr@cs.tamu.edu>
* configure.ac.pamphlet: Look for path to `awk'.
diff --git a/config/openaxiom-c-macros.h.in b/config/openaxiom-c-macros.h.in
index 195250b1..d98239d6 100644
--- a/config/openaxiom-c-macros.h.in
+++ b/config/openaxiom-c-macros.h.in
@@ -33,6 +33,10 @@
*/
#undef HAVE_DECL_KILL
+/* Define to 1 if you have the declaration of `openpty', and to 0 if you
+ don't. */
+#undef HAVE_DECL_OPENPTY
+
/* Define to 1 if you have the declaration of `sigaction', and to 0 if you
don't. */
#undef HAVE_DECL_SIGACTION
@@ -53,6 +57,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the <pty.h> header file. */
+#undef HAVE_PTY_H
+
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
@@ -83,6 +90,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the <util.h> header file. */
+#undef HAVE_UTIL_H
+
/* Define to 1 if you have the <winsock2.h> header file. */
#undef HAVE_WINSOCK2_H
diff --git a/config/var-def.mk b/config/var-def.mk
index c1b88d2f..73b95dd6 100644
--- a/config/var-def.mk
+++ b/config/var-def.mk
@@ -200,7 +200,7 @@ PLF=@PLF@
CCF=@CCF@
LDF=@LDF@ -lm
LISP=@LISP@
-oa_c_runtime_extra = @axiom_c_runtime_extra@ -lm
+oa_c_runtime_extra = @LIBS@ @axiom_c_runtime_extra@ -lm
axiom_use_x = @axiom_use_x@
AXIOM_X11_CFLAGS = @X_CFLAGS@
diff --git a/configure b/configure
index df7350c5..bb4730a8 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.60 for OpenAxiom 1.3.0-2008-10-29.
+# Generated by GNU Autoconf 2.60 for OpenAxiom 1.3.0-2008-10-31.
#
# Report bugs to <open-axiom-bugs@lists.sf.net>.
#
@@ -713,8 +713,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='OpenAxiom'
PACKAGE_TARNAME='openaxiom'
-PACKAGE_VERSION='1.3.0-2008-10-29'
-PACKAGE_STRING='OpenAxiom 1.3.0-2008-10-29'
+PACKAGE_VERSION='1.3.0-2008-10-31'
+PACKAGE_STRING='OpenAxiom 1.3.0-2008-10-31'
PACKAGE_BUGREPORT='open-axiom-bugs@lists.sf.net'
ac_unique_file="src/Makefile.pamphlet"
@@ -1405,7 +1405,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures OpenAxiom 1.3.0-2008-10-29 to adapt to many kinds of systems.
+\`configure' configures OpenAxiom 1.3.0-2008-10-31 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1475,7 +1475,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of OpenAxiom 1.3.0-2008-10-29:";;
+ short | recursive ) echo "Configuration of OpenAxiom 1.3.0-2008-10-31:";;
esac
cat <<\_ACEOF
@@ -1579,7 +1579,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-OpenAxiom configure 1.3.0-2008-10-29
+OpenAxiom configure 1.3.0-2008-10-31
generated by GNU Autoconf 2.60
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1593,7 +1593,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by OpenAxiom $as_me 1.3.0-2008-10-29, which was
+It was created by OpenAxiom $as_me 1.3.0-2008-10-31, which was
generated by GNU Autoconf 2.60. Invocation command line was
$ $0 $@
@@ -23461,8 +23461,375 @@ fi
+## Does this system have openpty or shall we emulate?
+
+
+for ac_header in pty.h util.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------------- ##
+## Report this to open-axiom-bugs@lists.sf.net ##
+## ------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ echo "$as_me:$LINENO: checking whether openpty is declared" >&5
+echo $ECHO_N "checking whether openpty is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_openpty+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if HAVE_PTY_H
+ # include <pty.h>
+ #endif
+ #if HAVE_UTIL_H
+ # include <util.h>
+ #endif
+
+
+int
+main ()
+{
+#ifndef openpty
+ char *p = (char *) openpty;
+ return !p;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_openpty=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_openpty=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_openpty" >&5
+echo "${ECHO_T}$ac_cv_have_decl_openpty" >&6; }
+if test $ac_cv_have_decl_openpty = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_OPENPTY 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_OPENPTY 0
+_ACEOF
+
+
+fi
+
+
+if test x"$ac_cv_have_decl_openpty" = xyes; then \
+ { echo "$as_me:$LINENO: checking for library containing openpty" >&5
+echo $ECHO_N "checking for library containing openpty... $ECHO_C" >&6; }
+if test "${ac_cv_search_openpty+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char openpty ();
+int
+main ()
+{
+return openpty ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' util; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_search_openpty=$ac_res
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if test "${ac_cv_search_openpty+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_openpty+set}" = set; then
+ :
+else
+ ac_cv_search_openpty=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_openpty" >&5
+echo "${ECHO_T}$ac_cv_search_openpty" >&6; }
+ac_res=$ac_cv_search_openpty
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
axiom_use_sman=1
-if test x"$ac_cv_have_decl_fork" = xyes \
+if test x"$ac_cv_header_pty_h" = xyes \
+ -a x"$ac_cv_have_decl_fork" = xyes \
-a x"$ac_cv_have_decl_wait" = xyes; then \
axiom_c_runtime="$axiom_c_runtime terminal_io"
axiom_src_all="$axiom_src_all all-sman all-clef"
@@ -26058,7 +26425,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by OpenAxiom $as_me 1.3.0-2008-10-29, which was
+This file was extended by OpenAxiom $as_me 1.3.0-2008-10-31, which was
generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -26107,7 +26474,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-OpenAxiom config.status 1.3.0-2008-10-29
+OpenAxiom config.status 1.3.0-2008-10-31
configured by $0, generated by GNU Autoconf 2.60,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index b270895d..08df2a22 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
sinclude(config/open-axiom.m4)
sinclude(config/aclocal.m4)
-AC_INIT([OpenAxiom], [1.3.0-2008-10-29],
+AC_INIT([OpenAxiom], [1.3.0-2008-10-31],
[open-axiom-bugs@lists.sf.net])
AC_CONFIG_AUX_DIR(config)
@@ -451,8 +451,23 @@ AC_CHECK_DECLS([fork],
[],
[#include <unistd.h>])
+## Does this system have openpty or shall we emulate?
+AC_CHECK_HEADERS([pty.h util.h])
+AC_CHECK_DECLS([openpty],[],[],
+ [#if HAVE_PTY_H
+ # include <pty.h>
+ #endif
+ #if HAVE_UTIL_H
+ # include <util.h>
+ #endif
+ ])
+if test x"$ac_cv_have_decl_openpty" = xyes; then \
+ AC_SEARCH_LIBS([openpty],[util])
+fi
+
axiom_use_sman=1
-if test x"$ac_cv_have_decl_fork" = xyes \
+if test x"$ac_cv_header_pty_h" = xyes \
+ -a x"$ac_cv_have_decl_fork" = xyes \
-a x"$ac_cv_have_decl_wait" = xyes; then \
axiom_c_runtime="$axiom_c_runtime terminal_io"
axiom_src_all="$axiom_src_all all-sman all-clef"
diff --git a/configure.ac.pamphlet b/configure.ac.pamphlet
index 6d9c0d52..d6b30bea 100644
--- a/configure.ac.pamphlet
+++ b/configure.ac.pamphlet
@@ -328,8 +328,23 @@ AC_CHECK_DECLS([fork],
[],
[#include <unistd.h>])
+## Does this system have openpty or shall we emulate?
+AC_CHECK_HEADERS([pty.h util.h])
+AC_CHECK_DECLS([openpty],[],[],
+ [#if HAVE_PTY_H
+ # include <pty.h>
+ #endif
+ #if HAVE_UTIL_H
+ # include <util.h>
+ #endif
+ ])
+if test x"$ac_cv_have_decl_openpty" = xyes; then \
+ AC_SEARCH_LIBS([openpty],[util])
+fi
+
axiom_use_sman=1
-if test x"$ac_cv_have_decl_fork" = xyes \
+if test x"$ac_cv_header_pty_h" = xyes \
+ -a x"$ac_cv_have_decl_fork" = xyes \
-a x"$ac_cv_have_decl_wait" = xyes; then \
axiom_c_runtime="$axiom_c_runtime terminal_io"
axiom_src_all="$axiom_src_all all-sman all-clef"
@@ -1112,7 +1127,7 @@ information:
<<Autoconf init>>=
sinclude(config/open-axiom.m4)
sinclude(config/aclocal.m4)
-AC_INIT([OpenAxiom], [1.3.0-2008-10-29],
+AC_INIT([OpenAxiom], [1.3.0-2008-10-31],
[open-axiom-bugs@lists.sf.net])
@
diff --git a/src/ChangeLog b/src/ChangeLog
index c3a50351..d0b3f19d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2008-11-01 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * sman/sman.c (ptsPath): Remove.
+ * sman/Makefile.in: Add additional C runtimes for link.
+ * lib/openpty.c: Include <pty.h> and <util.h> where available.
+ (ptyopen): Lose third parameter. Tidy.
+ (makeNextPtyNames): Now static.
+ * clef/edible.c (controllerPath): Remove.
+ Adjust call to ptyopen.
+ * clef/Makefile.in (clef_LDADD): Add extra C runtimes.
+
2008-10-31 Gabriel Dos Reis <gdr@cs.tamu.edu>
* boot/ast.boot (genECLnativeTranslation): Fix thinko.
diff --git a/src/clef/Makefile.in b/src/clef/Makefile.in
index 42a233e4..764df763 100644
--- a/src/clef/Makefile.in
+++ b/src/clef/Makefile.in
@@ -41,7 +41,7 @@ clef_objects = $(clef_SOURCES:.c=.lo)
build_libdir = $(top_builddir)/src/lib
-clef_LDADD = -L$(build_libdir) -lspad -lopen-axiom-core
+clef_LDADD = -L$(build_libdir) -lspad -lopen-axiom-core $(oa_c_runtime_extra)
clef_DEPENDENCIES =
diff --git a/src/clef/edible.c b/src/clef/edible.c
index 069ff8f7..0e7b9756 100644
--- a/src/clef/edible.c
+++ b/src/clef/edible.c
@@ -101,7 +101,6 @@ int buff_flag[MAXLINE]; /** flags for whether buff chars
or non-printing **/
-char controllerPath[20]; /* path name for opening the controller side */
char serverPath[20]; /* path name for opening the server side */
int contNum, serverNum; /* file descriptors for pty's */
@@ -130,7 +129,7 @@ main(int argc, char *argv[])
/* try to get a pseudoterminal to play with */
- if (ptyopen(&contNum, &serverNum, controllerPath, serverPath) == -1) {
+ if (ptyopen(&contNum, &serverNum, serverPath) == -1) {
perror("ptyopen failed");
exit(-1);
}
diff --git a/src/include/openpty.H1 b/src/include/openpty.H1
index dc46a190..95f9192b 100644
--- a/src/include/openpty.H1
+++ b/src/include/openpty.H1
@@ -1,2 +1 @@
-extern void makeNextPtyNames(char * , char * );
-extern int ptyopen(int * , int * , char * , char * );
+extern int ptyopen(int*, int*, char*);
diff --git a/src/lib/openpty.c b/src/lib/openpty.c
index 94f76735..eee46d04 100644
--- a/src/lib/openpty.c
+++ b/src/lib/openpty.c
@@ -38,8 +38,17 @@
#include <fcntl.h>
#include <string.h>
+#ifdef HAVE_PTY_H
+# include <pty.h>
+#endif
+#ifdef HAVE_UTIL_H
+# include <util.h>
+#endif
+
#include "openpty.H1"
+static void makeNextPtyNames(char * , char * );
+
/*
* The main function is ptyopen. It simply opens up both sides of a
@@ -52,8 +61,6 @@
* ptyopen(controller, server, controllerPath, serverPath)
* int *controller; The file descriptor for controller side of the pty
* int *server; The file descriptor for the server side
- * char *controllerPath; actually , this is not used anywhere on return
- and can be taken out of the call sequence
* char *serverPath;
*
* The path name vars should be declared of size 11 or more
@@ -61,11 +68,15 @@
int
-ptyopen(int *controller,int * server, char *controllerPath,char * serverPath)
+ptyopen(int *controller,int * server,char * serverPath)
{
-#if defined(SUNplatform) || defined (HP9platform) || defined(RTplatform) ||defined(AIX370platform) || defined(BSDplatform)
+#if HAVE_DECL_OPENPTY
+ return openpty(controller,server, serverPath, NULL, NULL);
+#else
+#if defined(SUNplatform)
int looking = 1, i;
int oflag = O_RDWR; /* flag for opening the pty */
+ char controllerPath[128];
for (i = 0; looking && i < 1000; i++) {
makeNextPtyNames(controllerPath, serverPath);
@@ -85,28 +96,7 @@ ptyopen(int *controller,int * server, char *controllerPath,char * serverPath)
}
return (*controller);
#endif
-#if defined RIOSplatform
- int fdm,fds;
- char *slavename;
-
- /* open master */
- if ((fdm=open("/dev/ptc",O_RDWR))<0)
- perror("ptyopen failed to open /dev/ptc");
- else {
- /* get slave name */
- if((slavename = ttyname(fdm))==0)
- perror("ptyopen failed to get the slave device name");
- /* open slave */
- if ((fds = open(slavename, O_RDWR)) < 0 )
- perror("ptyopen: Failed to open slave");
- strcpy(serverPath,slavename);
- *controller=fdm;
- *server=fds;
- }
- return(fdm);
-#endif
-
-#if defined(SUN4OS5platform) ||defined(ALPHAplatform) || defined(HP10platform) || defined(LINUXplatform) || defined(MACOSXplatform) || defined(BSDplatform)
+#if defined(SUN4OS5platform)
extern int grantpt(int);
extern int unlockpt(int);
extern char* ptsname(int);
@@ -130,7 +120,7 @@ extern char* ptsname(int);
if ((fds = open(slavename, O_RDWR)) < 0 )
perror("ptyopen: Failed to open slave");
else {
-#if defined(SUN4OS5platform) || defined(HP10platform)
+#if defined(SUN4OS5platform)
/* push ptem */
if (ioctl(fds, I_PUSH, "ptem") < 0)
perror("ptyopen: Failed to push ptem");
@@ -145,32 +135,16 @@ extern char* ptsname(int);
}
return(fdm);
#endif
-#if defined SGIplatform
- char *fds;
- fds = _getpty(controller, O_RDWR|O_NDELAY, 0600, 0);
- strcpy(serverPath,fds);
- if (0 == serverPath)
- return(-1);
- if (0 > (*server = open(serverPath,O_RDWR))) {
- (void) close(*controller);
- return(-1);
- }
- return (*controller);
+# error "don't know open to open a pty"
#endif
}
-void
+static void
makeNextPtyNames(char *cont,char * serv)
{
-#ifdef AIX370platform
- static int channelNo = 0;
- sprintf(cont, "/dev/ptyp%02x", channelNo);
- sprintf(serv, "/dev/ttyp%02x", channelNo);
- channelNo++;
-#endif
-#if defined(SUNplatform) || defined(HP9platform) || defined(LINUXplatform) || defined(MACOSXplatform) || defined(BSDplatform)
+#if defined(SUNplatform)
static int channelNo = 0;
static char group[] = "pqrstuvwxyzPQRST";
static int groupNo = 0;
diff --git a/src/sman/Makefile.in b/src/sman/Makefile.in
index 53bb15c3..e87ff546 100644
--- a/src/sman/Makefile.in
+++ b/src/sman/Makefile.in
@@ -49,19 +49,19 @@ libspad_la = $(build_libdir)/libspad.$(LIBEXT)
session_SOURCES = session.c
session_objects = $(session_SOURCES:.c=.lo)
-session_LDADD = $(libspad_la) @axiom_c_runtime_extra@ \
+session_LDADD = $(libspad_la) $(oa_c_runtime_extra) \
-L$(build_libdir) -lopen-axiom-core
session_DEPENDENCIES =
spadclient_SOURCES = spadclient.c
spadclient_objects = $(spadclient_SOURCES:.c=.lo)
-spadclient_LDADD = $(libspad_la) @axiom_c_runtime_extra@ \
+spadclient_LDADD = $(libspad_la) $(oa_c_runtime_extra) \
-L$(build_libdir) -lopen-axiom-core
spadclient_DEPENDENCIES =
sman_SOURCES = sman.c
sman_objects = $(sman_SOURCES:.c=.lo) $(top_builddir)/src/driver/utils.lo
-sman_LDADD = $(libspad_la) @axiom_c_runtime_extra@ \
+sman_LDADD = $(libspad_la) $(oa_c_runtime_extra) \
-L$(build_libdir) -lopen-axiom-core
sman_DEPENDENCIES =
diff --git a/src/sman/sman.c b/src/sman/sman.c
index 8fa71a67..4488948a 100644
--- a/src/sman/sman.c
+++ b/src/sman/sman.c
@@ -137,7 +137,7 @@ unsigned char _INTR, _QUIT, _ERASE, _KILL, _EOF, _EOL, _RES1, _RES2;
/*************************************/
int ptsNum, ptcNum;
-char ptsPath[20], ptcPath[20];
+char ptsPath[20];
char **new_envp; /* new environment for the core executable */
int child_pid; /* child's process id */
@@ -556,7 +556,7 @@ start_the_Axiom(char **envp)
fprintf(stderr, "could not get an OpenAxiom server number\n");
exit(-1);
}
- if (ptyopen(&ptcNum, &ptsNum, ptcPath, ptsPath) == -1) {
+ if (ptyopen(&ptcNum, &ptsNum, ptsPath) == -1) {
perror("start_the_Axiom: ptyopen failed");
exit(-1);
}