Ticket #45733: pure-0.64-ats-hotfixes.diff

File pure-0.64-ats-hotfixes.diff, 3.7 KB (added by agraef (Albert Graef), 10 years ago)

Additional patch file

  • interpreter.cc

    diff -r 0606383af4b0 pure/interpreter.cc
     
    25862586     Fortran.
    25872587
    25882588   - "-*- ats -*-" selects ATS (PURE_ATSCC environment variable, patscc by
    2589      default). Contributed by Barry Schwartz <sortsmill@crudfactory.com>, see
    2590      http://www.ats-lang.org/.
     2589     default). You can also set the C compiler to be used by patscc with the
     2590     PURE_ATSCCOMP environment variable (either clang or gcc by default,
     2591     depending on the value of PURE_ATSCC). Contributed by Barry Schwartz
     2592     <sortsmill@crudfactory.com>, see http://www.ats-lang.org/.
    25912593
    25922594   - "-*- dsp:name -*-" selects Faust (PURE_FAUST environment variable, faust
    25932595     by default), where 'name' denotes the name of the Faust dsp, which is
     
    26852687  } else if (tag == "ats") {
    26862688    env = "PURE_ATSCC";
    26872689    // The default command is for ATS2-Postiats, which uses gcc as its C
    2688     // compiler by default. We prefer to use clang instead (set by means of
    2689     // the PATSCCOMP environment variable). If you have a working dragonegg
    2690     // plugin installed, you can still override this by setting the PURE_ATSCC
    2691     // variable to 'patscc -fplugin=dragonegg'. NOTE: In any case you should
    2692     // set the PATSHOME environment variable as explained in the ATS2
    2693     // installation instructions.
     2690    // compiler by default. We prefer to use clang instead. If you have a
     2691    // working dragonegg plugin installed, you can still override this by
     2692    // setting the PURE_ATSCC variable to 'patscc -fplugin=dragonegg'. NOTE:
     2693    // In any case you should set the PATSHOME environment variable as
     2694    // explained in the ATS2 installation instructions.
    26942695    drv = "patscc";
    2695     args = " -emit-llvm -c ";
    26962696    ext = ".dats";
    26972697    intermediate_ext = "_dats.c";
    26982698    remove_intermediate = true;
    2699     // We only override patscc's default C compiler if neither PURE_ATSCC nor
    2700     // PATSCCOMP has been set, so that the user still has full control over
    2701     // which AST and C compilers will be used.
    2702     if (!getenv("PURE_ATSCC") && !getenv("PATSCCOMP")) {
    2703       static char *patsccomp = NULL;
    2704       if (!patsccomp) {
    2705         string ccomp = string("PATSCCOMP=") + clang + " -emit-llvm -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime";
    2706         patsccomp = strdup(ccomp.c_str());
    2707         putenv(patsccomp);
    2708       }
    2709       args = " -c ";
     2699    // Unless dragonegg is being used or PURE_ATSCCOMP has been set
     2700    // explicitly, we override patscc's default C compiler so that clang is
     2701    // used to generate bitcode. If needed, this gives the user full control
     2702    // over which AST and C compilers will be used, and the options they
     2703    // should be invoked with. The options needed for bitcode compilation are
     2704    // always added, however.
     2705    char *atscc = getenv(env);
     2706    char *atsccomp = getenv("PURE_ATSCCOMP");
     2707    // Figure out the default C compiler to use and set up command line
     2708    // arguments accordingly.
     2709    string cc = clang+ " -emit-llvm";
     2710    args = " -atsccomp \"${PURE_ATSCCOMP}\" -c ";
     2711    if (atscc && strstr(atscc, "dragonegg")) {
     2712      // Use dragonegg instead.
     2713      cc = "gcc";
     2714      args = " -atsccomp \"${PURE_ATSCCOMP}\" -emit-llvm -c ";
     2715    }
     2716    if (!atsccomp) {
     2717      // Set up a reasonable default for the PURE_ATSCCOMP variable.
     2718      string ccomp = string("PURE_ATSCCOMP=") + cc + " -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime";
     2719      atsccomp = strdup(ccomp.c_str());
     2720      putenv(atsccomp);
     2721      bool vflag = (verbose&verbosity::compiler) != 0;
     2722      if (vflag) std::cerr << atsccomp << '\n';
    27102723    }
    27112724  } else if (tag == "dsp") {
    27122725    env = "PURE_FAUST"; drv = "faust -double";