24 #if defined (HAVE_CONFIG_H)
35 #define OCTAVE_PREFIX "/usr/local"
40 static std::map<std::string,std::string>
vars;
42 static std::string
usage_msg =
"usage: octave-config [options]";
48 " -h, -?, --help Print this message.\n"
50 " --m-site-dir Print the name of the directory where Octave\n"
51 " expects to find locally installed .m files.\n"
53 " --oct-site-dir Print the name of the directory where Octave\n"
54 " expects to find locally installed .oct files.\n"
56 " -p VAR, --print VAR Print the value of the given configuration\n"
57 " variable VAR. Recognized variables are:\n"
59 " API_VERSION LOCALARCHLIBDIR\n"
60 " ARCHLIBDIR LOCALFCNFILEDIR\n"
61 " BINDIR LOCALOCTFILEDIR\n"
62 " CANONICAL_HOST_TYPE LOCALSTARTUPFILEDIR\n"
63 " DATADIR LOCALVERARCHLIBDIR\n"
64 " DATAROOTDIR LOCALVERFCNFILEDIR\n"
65 " DEFAULT_PAGER LOCALVEROCTFILEDIR\n"
66 " EXEC_PREFIX MAN1DIR\n"
68 " FCNFILEDIR MANDIR\n"
69 " IMAGEDIR OCTDATADIR\n"
70 " INCLUDEDIR OCTFILEDIR\n"
71 " INFODIR OCTINCLUDEDIR\n"
72 " INFOFILE OCTLIBDIR\n"
74 " LIBEXECDIR SHLEXT\n"
75 " LOCALAPIARCHLIBDIR STARTUPFILEDIR\n"
76 " LOCALAPIFCNFILEDIR VERSION\n"
77 " LOCALAPIOCTFILEDIR\n"
79 " -v, --version Print the Octave version number.\n"
88 vars[
"API_VERSION"] =
"api-v50+";
89 vars[
"CANONICAL_HOST_TYPE"] =
"x86_64-unknown-linux-gnu";
90 vars[
"DEFAULT_PAGER"] =
"less";
91 vars[
"MAN1EXT"] =
".1";
92 vars[
"VERSION"] =
"4.0.0";
94 vars[
"ARCHLIBDIR"] =
subst_octave_home (
"/usr/local/libexec/octave/4.0.0/exec/x86_64-unknown-linux-gnu");
107 vars[
"LOCALAPIARCHLIBDIR"] =
subst_octave_home (
"/usr/local/libexec/octave/api-v50+/site/exec/x86_64-unknown-linux-gnu");
108 vars[
"LOCALAPIFCNFILEDIR"] =
subst_octave_home (
"/usr/local/share/octave/site/api-v50+/m");
109 vars[
"LOCALAPIOCTFILEDIR"] =
subst_octave_home (
"/usr/local/lib/octave/site/oct/api-v50+/x86_64-unknown-linux-gnu");
110 vars[
"LOCALARCHLIBDIR"] =
subst_octave_home (
"/usr/local/libexec/octave/site/exec/x86_64-unknown-linux-gnu");
112 vars[
"LOCALOCTFILEDIR"] =
subst_octave_home (
"/usr/local/lib/octave/site/oct/x86_64-unknown-linux-gnu");
113 vars[
"LOCALSTARTUPFILEDIR"] =
subst_octave_home (
"/usr/local/share/octave/site/m/startup");
114 vars[
"LOCALVERARCHLIBDIR"] =
subst_octave_home (
"/usr/local/libexec/octave/4.0.0/site/exec/x86_64-unknown-linux-gnu");
115 vars[
"LOCALVERFCNFILEDIR"] =
subst_octave_home (
"/usr/local/share/octave/4.0.0/site/m");
116 vars[
"LOCALVEROCTFILEDIR"] =
subst_octave_home (
"/usr/local/lib/octave/4.0.0/site/oct/x86_64-unknown-linux-gnu");
120 vars[
"OCTFILEDIR"] =
subst_octave_home (
"/usr/local/lib/octave/4.0.0/oct/x86_64-unknown-linux-gnu");
121 vars[
"OCTINCLUDEDIR"] =
subst_octave_home (
"/usr/local/include/octave-4.0.0/octave");
124 vars[
"STARTUPFILEDIR"] =
subst_octave_home (
"/usr/local/share/octave/4.0.0/m/startup");
138 for (
int i = 1; i < argc; i++)
140 std::string
arg (argv[i]);
142 if (arg ==
"-h" || arg ==
"-?" || arg ==
"--help")
148 else if (arg ==
"--m-site-dir")
149 std::cout << vars[
"LOCALVERFCNFILEDIR"] << std::endl;
150 else if (arg ==
"--oct-site-dir")
151 std::cout << vars[
"LOCALVEROCTFILEDIR"] << std::endl;
152 else if (arg ==
"-v" || arg ==
"--version")
153 std::cout << vars[
"VERSION"] << std::endl;
154 else if (arg ==
"-p" || arg ==
"--print")
159 std::cout << vars[
arg] << std::endl;
163 std::cerr <<
"octave-config: " << arg
164 <<
" options requires argument" << std::endl;
170 std::cerr <<
"octave-config: unrecognized argument " << arg
static std::string get_octave_home(void)
static std::string subst_octave_home(const std::string &s)
static std::string usage_msg
static void initialize(void)
int main(int argc, char **argv)
static std::string help_msg
static std::map< std::string, std::string > vars