28 #if defined (HAVE_CONFIG_H)
38 #if defined (OCTAVE_USE_WINDOWS_API)
44 #if ! defined (OCTAVE_PREFIX)
45 # define OCTAVE_PREFIX %OCTAVE_PREFIX%
48 #if ! defined (OCTAVE_EXEC_PREFIX)
49 # define OCTAVE_EXEC_PREFIX %OCTAVE_EXEC_PREFIX%
53 # define OCTAVE_UNUSED
58 static std::map<std::string, std::string>
vars;
60 static std::string
usage_msg =
"usage: octave-config [options]";
66 " -h, -?, --help Print this message.\n"
68 " --m-site-dir Print the name of the directory where Octave\n"
69 " expects to find locally installed .m files.\n"
71 " --oct-site-dir Print the name of the directory where Octave\n"
72 " expects to find locally installed .oct files.\n"
74 " -p VAR, --print VAR Print the value of the given configuration\n"
75 " variable VAR. Recognized variables are:\n"
77 " API_VERSION LOCALFCNFILEDIR\n"
78 " ARCHLIBDIR LOCALOCTFILEDIR\n"
79 " BINDIR LOCALSTARTUPFILEDIR\n"
80 " CANONICAL_HOST_TYPE LOCALVERARCHLIBDIR\n"
81 " DATADIR LOCALVERFCNFILEDIR\n"
82 " DATAROOTDIR LOCALVEROCTFILEDIR\n"
83 " DEFAULT_PAGER MAN1DIR\n"
84 " EXEC_PREFIX MAN1EXT\n"
86 " FCNFILEDIR OCTAVE_EXEC_HOME\n"
87 " IMAGEDIR OCTAVE_HOME\n"
88 " INCLUDEDIR OCTDATADIR\n"
89 " INFODIR OCTDOCDIR\n"
90 " INFOFILE OCTFILEDIR\n"
91 " LIBDIR OCTFONTSDIR\n"
92 " LIBEXECDIR OCTINCLUDEDIR\n"
93 " LOCALAPIARCHLIBDIR OCTLIBDIR\n"
94 " LOCALAPIFCNFILEDIR STARTUPFILEDIR\n"
95 " LOCALAPIOCTFILEDIR VERSION\n"
98 " -v, --version Print the Octave version number.\n"
109 vars[
"API_VERSION"] = %OCTAVE_API_VERSION%;
110 vars[
"CANONICAL_HOST_TYPE"] = %OCTAVE_CANONICAL_HOST_TYPE%;
111 vars[
"DEFAULT_PAGER"] = %OCTAVE_DEFAULT_PAGER%;
112 vars[
"EXEEXT"] = %OCTAVE_EXEEXT%;
113 vars[
"MAN1EXT"] = %OCTAVE_MAN1EXT%;
148 #if defined (OCTAVE_USE_WINDOWS_API) && defined (_UNICODE)
151 wmain (
int argc,
wchar_t **wargv)
153 static char **argv =
new char * [argc + 1];
154 std::vector<std::string> argv_str;
157 std::wstring_convert<std::codecvt_utf8<wchar_t>,
wchar_t> wchar_conv;
158 for (
int i_arg = 0; i_arg < argc; i_arg++)
159 argv_str.push_back (wchar_conv.to_bytes (wargv[i_arg]));
162 for (
int i_arg = 0; i_arg < argc; i_arg++)
163 argv[i_arg] = &argv_str[i_arg][0];
164 argv[argc] =
nullptr;
179 for (
int i = 1; i < argc; i++)
181 std::string arg (argv[i]);
183 if (arg ==
"-h" || arg ==
"-?" || arg ==
"--help")
189 else if (arg ==
"--m-site-dir")
190 std::cout <<
vars[
"LOCALVERFCNFILEDIR"] << std::endl;
191 else if (arg ==
"--oct-site-dir")
192 std::cout <<
vars[
"LOCALVEROCTFILEDIR"] << std::endl;
193 else if (arg ==
"-v" || arg ==
"--version")
194 std::cout <<
vars[
"VERSION"] << std::endl;
195 else if (arg ==
"-p" || arg ==
"--print")
200 std::cout <<
vars[arg] << std::endl;
204 std::cerr <<
"octave-config: " << arg
205 <<
" options requires argument" << std::endl;
211 std::cerr <<
"octave-config: unrecognized argument " << arg
#define OCTAVE_ARCHLIBDIR
static std::string help_msg
int main(int argc, char **argv)
static void initialize(void)
static std::string usage_msg
static std::map< std::string, std::string > vars
static std::string Voctave_home
static void set_octave_home(void)
static std::string prepend_octave_exec_home(const std::string &s)
static std::string Voctave_exec_home
static OCTAVE_UNUSED std::string prepend_octave_home(const std::string &s)