1 /* run_exams.cpp, a launcher that sets variables to start ginaccint.bin.
2 * This is necessary because Cint is not libtoolized and so may need to have
3 * LD_LIBRARY_PATH and CINTSYSDIR set. (This cannot be done by a shell-script
4 * because the #!-mechanism works only once and we want to enable the user to
5 * write scripts using that mechanism.) */
13 extern char **environ;
15 int main(int argc, char * *argv)
18 std::string binprog = "./ginaccint.bin";
20 // extend LD_LIBRARY_PATH by ../ginac/.libs, so ginaccint.bin really finds libginac
21 const char * LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
22 if (LD_LIBRARY_PATH == NULL)
23 setenv("LD_LIBRARY_PATH", "../ginac/.libs", 1);
25 setenv("LD_LIBRARY_PATH", (std::string(LD_LIBRARY_PATH)+':'+"../ginac/.libs").c_str(), 1);
27 // hard-wire CINTSYSDIR, inherited from configure, but only if it has
28 // been set therein (to allow for system-wide installations of cint).
29 if (CINTSYSDIR != "@CINTSYSDIR@")
30 setenv("CINTSYSDIR", CINTSYSDIR.c_str(), 1);
32 // execute the real thing
33 int error = execve(binprog.c_str(), argv, environ);
35 // only gets here on error
36 std::cerr << argv[0] << ": cannot exec " << binprog << std::endl;