28 #if defined (HAVE_CONFIG_H)
38 #if defined (OCTAVE_USE_WINDOWS_API)
44 #if ! defined (OCTAVE_PREFIX)
45 # define OCTAVE_PREFIX "/usr/local"
48 #if ! defined (OCTAVE_EXEC_PREFIX)
49 # define OCTAVE_EXEC_PREFIX "/usr/local"
53 # define OCTAVE_UNUSED
58 static std::map<std::string, std::string> vars;
60 static std::string usage_msg =
"usage: octave-config [options]";
62 static std::string help_msg =
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"
106 vars[
"OCTAVE_HOME"] = Voctave_home;
107 vars[
"OCTAVE_EXEC_HOME"] = Voctave_exec_home;
109 vars[
"API_VERSION"] =
"api-v59";
110 vars[
"CANONICAL_HOST_TYPE"] =
"x86_64-pc-linux-gnu";
111 vars[
"DEFAULT_PAGER"] =
"less";
113 vars[
"MAN1EXT"] =
".1";
114 vars[
"VERSION"] =
"9.1.0";
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;
175 std::cout << usage_msg << std::endl;
179 for (
int i = 1; i < argc; i++)
181 std::string arg (argv[i]);
183 if (arg ==
"-h" || arg ==
"-?" || arg ==
"--help")
185 std::cout << usage_msg << std::endl;
186 std::cout << help_msg;
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
std::string prepend_octave_home(const std::string &s)
std::string prepend_octave_exec_home(const std::string &s)
int main(int argc, char **argv)