changeset 17814:e50a3664bd45

make compilation of main.cc work again when not building GUI * main.in.cc: Fix preprocessor conditionals to allow compiling without GUI enabled.
author John W. Eaton <jwe@octave.org>
date Thu, 31 Oct 2013 03:58:26 -0400
parents 0a887758d1cc
children dbf67e6c256a
files src/main.in.cc
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.in.cc	Thu Oct 31 02:25:47 2013 -0400
+++ b/src/main.in.cc	Thu Oct 31 03:58:26 2013 -0400
@@ -102,7 +102,8 @@
 
 #endif
 
-#if ! defined (__WIN32__) || defined (__CYGWIN__)
+#if (defined (HAVE_OCTAVE_GUI) \
+     && ! defined (__WIN32__) || defined (__CYGWIN__))
 
 #include <signal.h>
 #include <fcntl.h>
@@ -398,7 +399,13 @@
 
   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];
 
@@ -415,7 +422,8 @@
           // require less memory.  Don't pass the --no-gui-libs option
           // on as that option is not recognized by Octave.
 
-#if ! defined (__WIN32__) || defined (__CYGWIN__)
+#if (defined (HAVE_OCTAVE_GUI) \
+     && ! defined (__WIN32__) || defined (__CYGWIN__))
           gui_libs = false;
 #endif
           file = octave_bindir + dir_sep_char + "octave-cli";
@@ -428,7 +436,8 @@
           // if the --no-gui option is given, we may be asked to do some
           // plotting or ui* calls.
 
-#if ! defined (__WIN32__) || defined (__CYGWIN__)
+#if (defined (HAVE_OCTAVE_GUI) \
+     && ! defined (__WIN32__) || defined (__CYGWIN__))
           start_gui = false;
 #endif
           new_argv[k++] = argv[i];
@@ -439,7 +448,8 @@
 
   new_argv[k] = 0;
 
-#if ! defined (__WIN32__) || defined (__CYGWIN__)
+#if (defined (HAVE_OCTAVE_GUI) \
+     && ! defined (__WIN32__) || defined (__CYGWIN__))
 
   if (gui_libs && start_gui && have_controlling_terminal ())
     {