Mercurial > octave-antonio
changeset 17784:7ae9bc04ec07
allow octave binary to work if building GUI is disabled (bug #40395)
* src/Makefile.in: If building GUI, compile main.cc with
-DHAVE_OCTAVE_GUI.
* main.in.cc (main): If HAVE_OCTAVE_GUI is not defined, then simply
exec octave-cli.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 28 Oct 2013 16:38:46 -0400 |
parents | eca761671f16 |
children | 2a9114104271 |
files | src/Makefile.am src/main.in.cc |
diffstat | 2 files changed, 24 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Makefile.am Mon Oct 28 21:11:45 2013 +0100 +++ b/src/Makefile.am Mon Oct 28 16:38:46 2013 -0400 @@ -69,6 +69,14 @@ $(NO_UNDEFINED_LDFLAG) \ $(OCTAVE_LINK_OPTS) +if AMCOND_BUILD_GUI + OCTAVE_CPPFLAGS = -DHAVE_OCTAVE_GUI +endif + +octave_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(OCTAVE_CPPFLGAS) + octave_cli_SOURCES = main-cli.cc octave_cli_LDADD = \
--- a/src/main.in.cc Mon Oct 28 21:11:45 2013 +0100 +++ b/src/main.in.cc Mon Oct 28 16:38:46 2013 -0400 @@ -102,7 +102,8 @@ #endif -#if ! defined (__WIN32__) && ! defined (__CYGWIN__) +#if (defined (HAVE_OCTAVE_GUI) \ + && ! defined (__WIN32__) && ! defined (__CYGWIN__)) #include <sys/types.h> #include <signal.h> @@ -395,12 +396,20 @@ { int retval = 0; +#if defined (HAVE_OCTAVE_GUI) bool start_gui = true; bool cli_only = false; +#endif std::string octave_bindir = get_octave_bindir (); - std::string file = octave_bindir + dir_sep_char + "octave-gui"; + std::string file = octave_bindir + dir_sep_char; + +#if defined (HAVE_OCTAVE_GUI) + file += "octave-gui"; +#else + file += "octave-cli"; +#endif char **new_argv = new char * [argc + 1]; @@ -417,7 +426,9 @@ // require less memory. Don't pass the --no-gui-libs option // on as that option is not recognized by Octave. +#if defined (HAVE_OCTAVE_GUI) cli_only = true; +#endif file = octave_bindir + dir_sep_char + "octave-cli"; } else if (! strcmp (argv[i], "--no-gui")) @@ -428,7 +439,9 @@ // if the --no-gui option is given, we may be asked to do some // plotting or ui* calls. +#if defined (HAVE_OCTAVE_GUI) start_gui = false; +#endif new_argv[k++] = argv[i]; } else @@ -437,7 +450,7 @@ new_argv[k] = 0; -#if defined (__WIN32__) || defined (__CYGWIN__) +#if ! defined (HAVE_OCTAVE_GUI) || defined (__WIN32__) || defined (__CYGWIN__) retval = octave_exec (file, new_argv);