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]";
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;
112 vars[
"EXEEXT"] = %OCTAVE_EXEEXT%;
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
#define OCTAVE_LOCALSTARTUPFILEDIR
#define OCTAVE_LOCALVERFCNFILEDIR
#define OCTAVE_OCTINCLUDEDIR
#define OCTAVE_LOCALAPIOCTFILEDIR
#define OCTAVE_LIBEXECDIR
#define OCTAVE_LOCALVEROCTFILEDIR
#define OCTAVE_OCTFONTSDIR
#define OCTAVE_OCTDATADIR
#define OCTAVE_FCNFILEDIR
#define OCTAVE_LOCALOCTFILEDIR
#define OCTAVE_LOCALAPIARCHLIBDIR
#define OCTAVE_STARTUPFILEDIR
#define OCTAVE_INCLUDEDIR
#define OCTAVE_DEFAULT_PAGER
#define OCTAVE_OCTFILEDIR
#define OCTAVE_LOCALARCHLIBDIR
#define OCTAVE_LOCALVERARCHLIBDIR
#define OCTAVE_LOCALFCNFILEDIR
#define OCTAVE_LOCALAPIFCNFILEDIR
#define OCTAVE_DATAROOTDIR
std::string prepend_octave_home(const std::string &s)
std::string prepend_octave_exec_home(const std::string &s)
#define OCTAVE_ARCHLIBDIR
int main(int argc, char **argv)
#define OCTAVE_CANONICAL_HOST_TYPE
#define OCTAVE_API_VERSION