Mercurial > hg > octave-nkf
changeset 15756:ea1a1fb00744
Make the path to the shell interpreter configuable
* configure.ac: Add --with-shell option and define SHELL_PATH.
* libinterp/interp-core/oct-procbuf.cc (octave_procbuf::open),
libinterp/interpfcn/toplev.cc (Fsystem): Use it.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Sat, 08 Dec 2012 16:08:09 -0500 |
parents | 3216dafbbd48 |
children | 534a2c881f45 |
files | configure.ac libinterp/interp-core/oct-procbuf.cc libinterp/interpfcn/toplev.cc |
diffstat | 3 files changed, 31 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac +++ b/configure.ac @@ -124,6 +124,27 @@ config_opts=$ac_configure_args AC_SUBST(config_opts) +### Define the path to the shell on the host system. Most systems will +### ensure /bin/sh is the default shell so this can be safely ignored by +### almost everyone. However, when building for Android, for example, +### this will need to be set. +SHELL_PATH=/bin/sh +AC_ARG_WITH([shell], + [AS_HELP_STRING([--with-shell=SHELL], + [use SHELL as the shell interpreter (default: /bin/sh)])]) +case $with_shell in + no) + AC_MSG_ERROR([A shell interpreter is required]) + ;; + yes | "") + ;; + *) + SHELL_PATH=$with_shell + ;; +esac +AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL_PATH"], + [Define this to be the path to the shell command interpreter.]) + ### Enable bounds checking on element references within Octave's array and ### matrix classes. This slows down some operations a bit, so it is turned off ### by default.
--- a/libinterp/interp-core/oct-procbuf.cc +++ b/libinterp/interp-core/oct-procbuf.cc @@ -42,6 +42,10 @@ #include "gripes.h" #include "utils.h" +#ifndef SHELL_PATH +#define SHELL_PATH "/bin/sh" +#endif + // This class is based on the procbuf class from libg++, written by // Per Bothner, Copyright (C) 1993 Free Software Foundation. @@ -125,7 +129,7 @@ octave_procbuf_list = octave_procbuf_list->next; } - execl ("/bin/sh", "sh", "-c", command, static_cast<void *> (0)); + execl (SHELL_PATH, "sh", "-c", command, static_cast<void *> (0)); exit (127); }
--- a/libinterp/interpfcn/toplev.cc +++ b/libinterp/interpfcn/toplev.cc @@ -77,6 +77,10 @@ #include "variables.h" #include "version.h" +#ifndef SHELL_PATH +#define SHELL_PATH "/bin/sh" +#endif + void (*octave_exit) (int) = ::exit; // TRUE means the quit() call is allowed. @@ -950,7 +954,7 @@ // FIXME -- should probably replace this // call with something portable. - execl ("/bin/sh", "sh", "-c", cmd_str.c_str (), + execl (SHELL_PATH, "sh", "-c", cmd_str.c_str (), static_cast<void *> (0)); panic_impossible ();