# HG changeset patch # User John W. Eaton # Date 1383206306 14400 # Node ID e50a3664bd45e65693e19365e22439aee1f29637 # Parent 0a887758d1ccaf78fd32ca4670fb7ac937955ac6 make compilation of main.cc work again when not building GUI * main.in.cc: Fix preprocessor conditionals to allow compiling without GUI enabled. diff -r 0a887758d1cc -r e50a3664bd45 src/main.in.cc --- 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 #include @@ -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 ()) {