]> www.ginac.de Git - ginac.git/blob - cint/run_exams.cpp
- Lewis-Wester tests D and E now benchmark the time to expand the
[ginac.git] / cint / run_exams.cpp
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.) */
6
7 #include <unistd.h>
8 #include <stdlib.h>
9 #include <string>
10 #include <iostream>
11 #include "launch.h"
12
13 extern char **environ;
14
15 int main(int argc, char * *argv)
16 {
17         // what to start
18         std::string binprog = "./ginaccint.bin";
19         
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);
24         else
25                 setenv("LD_LIBRARY_PATH", (std::string(LD_LIBRARY_PATH)+':'+"../ginac/.libs").c_str(), 1);
26         
27         // hard-wire CINTSYSDIR, inherited from configure
28         setenv("CINTSYSDIR", CINTSYSDIR.c_str(), 1);
29         
30         // execute the real thing
31         int error = execve(binprog.c_str(), argv, environ);
32         
33         // only gets here on error
34         std::cerr << argv[0] << ": cannot exec " << binprog << std::endl;
35         return error;
36 }