1 | % (c) 2009-2024 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, | |
2 | % Heinrich Heine Universitaet Duesseldorf | |
3 | % This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) | |
4 | ||
5 | :- module(compile_time_flags, | |
6 | [compile_time_flag/1, | |
7 | compile_time_flags/1, | |
8 | relevant_prolog_flags/1 | |
9 | ]). | |
10 | ||
11 | % compile time flags can be set from the command line for SICStus Prolog | |
12 | % e.g., -Dprob_safe_mode=true when starting ProB from source or when generating the .sav file in the Makefile | |
13 | ||
14 | :- use_module(module_information,[module_info/2]). | |
15 | ||
16 | :- module_info(group,infrastructure). | |
17 | :- module_info(description,'This module describes the possible compile-time flags of ProB.'). | |
18 | ||
19 | compile_time_flags(list(Flags)) :- % list wrapper for Tcl | |
20 | findall(Flag, compile_time_flag(Flag), Flags). | |
21 | ||
22 | ||
23 | :- load_files(library(system), [when(compile_time), imports([environ/2])]). | |
24 | :- if(environ(prob_release,true)). | |
25 | compile_time_flag(prob_release). | |
26 | % set when building an official build of probcli or ProB Tcl/Tk | |
27 | % excludes Tcl benchmarks, unit tests | |
28 | :- endif. | |
29 | :- if(environ(prob_safe_mode,true)). | |
30 | compile_time_flag(prob_safe_mode). | |
31 | % perform additional checks | |
32 | % check_ast: check AST ground, check used_id infos for quantifiers...) | |
33 | % check typing in equal_object, variable clashes in comprehension_set, call_residue check in my_findall,... | |
34 | :- endif. | |
35 | :- if(environ(prob_core_only,true)). | |
36 | compile_time_flag(prob_core_only). | |
37 | % probcli only contains core modules, many extensions are not included | |
38 | :- endif. | |
39 | :- if(environ(plspec_patch_libraries,true)). | |
40 | compile_time_flag(plspec_patch_libraries). | |
41 | % use plspec to check calls to ordsets, avl and lists libraries | |
42 | :- endif. | |
43 | :- if(environ(prob_data_validation_mode,true)). | |
44 | compile_time_flag(prob_data_validation_mode). | |
45 | % prevent certain instantiations of sets on the assumption that we do not need powerful constraint solving | |
46 | :- endif. | |
47 | :- if(environ(no_wd_checking,true)). | |
48 | compile_time_flag(no_wd_checking). | |
49 | % disable Well-Definedness checking for function applications | |
50 | :- endif. | |
51 | :- if(environ(prob_profile,true)). | |
52 | compile_time_flag(prob_profile). | |
53 | % store profile information for operations and invariant checking | |
54 | :- endif. | |
55 | :- if(environ(prob_logging_mode,true)). | |
56 | compile_time_flag(prob_logging_mode). | |
57 | % automatically log probcli (add -ll command-line switch) | |
58 | :- endif. | |
59 | :- if(environ(no_terminal_colors,true)). | |
60 | compile_time_flag(no_terminal_colors). | |
61 | % disable terminal colors, can also be influence by setting NO_COLOR environment variable | |
62 | :- endif. | |
63 | :- if(environ(partially_evaluate,true)). | |
64 | compile_time_flag(partially_evaluate). | |
65 | :- endif. | |
66 | :- if(environ(partially_evaluate_compile,true)). | |
67 | compile_time_flag(partially_evaluate_compile). | |
68 | :- endif. | |
69 | :- if(environ(no_interrupts,true)). | |
70 | compile_time_flag(no_interrupts). | |
71 | % do not treat CTRL-C user_interrupts | |
72 | :- endif. | |
73 | :- if(environ(prob_noopt_mode,true)). | |
74 | compile_time_flag(prob_noopt_mode). | |
75 | % now While Loop optimisation | |
76 | :- endif. | |
77 | :- if(environ(prob_debug_flag,true)). | |
78 | compile_time_flag(prob_debug_flag). | |
79 | % additional debugging performed/enabled and checking of performance issues at the B Level | |
80 | :- endif. | |
81 | :- if(environ(prob_debug_watch_flag,true)). | |
82 | compile_time_flag(prob_debug_watch_flag). | |
83 | % watch certain predicate/expression computations precisely and report if they take too long | |
84 | % performs monitoring at a lower level closer to Prolog than prob_debug_flag | |
85 | :- endif. | |
86 | :- if(environ(prob_enter_debugger_upon_error,true)). | |
87 | compile_time_flag(prob_enter_debugger_upon_error). | |
88 | % enter SICStus debugger when exception/error occurs | |
89 | :- endif. | |
90 | :- if(environ(prob_use_timer,true)). | |
91 | compile_time_flag(prob_use_timer). | |
92 | % use microsecond timer | |
93 | :- endif. | |
94 | :- if(environ(prob_src_profile,true)). | |
95 | compile_time_flag(prob_src_profile). | |
96 | % perform profiling at B source level in source_profiler.pl | |
97 | :- endif. | |
98 | :- if(environ(prob_myheap,false)). | |
99 | compile_time_flag(prob_myheap_false). | |
100 | % do not use C++ priority queue | |
101 | :- endif. | |
102 | :- if(environ(prob_c_counter,false)). | |
103 | compile_time_flag(prob_c_counter_false). | |
104 | % do not use C++ counter | |
105 | :- endif. | |
106 | :- if(environ(disable_chr,true)). | |
107 | compile_time_flag(disable_chr). % do not include CHR library at all | |
108 | :- endif. | |
109 | :- if(environ(enable_time_out_for_constraints,true)). | |
110 | compile_time_flag(enable_time_out_for_constraints). % use time_out for posting constraints | |
111 | :- endif. | |
112 | :- if(environ('SP_JIT',disabled)). | |
113 | compile_time_flag('SP_JIT=disabled'). | |
114 | :- endif. | |
115 | :- if(environ('SP_JIT',yes)). | |
116 | compile_time_flag('SP_JIT=yes'). % this is the default | |
117 | :- endif. | |
118 | :- if(environ('SP_JIT',no)). | |
119 | compile_time_flag('SP_JIT=no'). | |
120 | :- endif. | |
121 | :- if(environ('SP_JIT_COUNTER_LIMIT',_)). | |
122 | compile_time_flag('SP_JIT_COUNTER_LIMIT_SET'). % default is 0 | |
123 | :- endif. | |
124 | :- if(environ('SP_JIT_CLAUSE_LIMIT',_)). | |
125 | compile_time_flag('SP_JIT_CLAUSE_LIMIT_SET'). % default is 1024 | |
126 | :- endif. | |
127 | :- if(environ('SP_SPTI_PATH',verbose)). | |
128 | compile_time_flag('SP_SPTI_PATH=verbose'). % can be set to verbose | |
129 | :- endif. | |
130 | :- if(environ('SP_TIMEOUT_IMPLEMENTATON',legacy)). | |
131 | % Needed with SICStus 4.4.0 to work around an issue with nested timeouts. | |
132 | % Should have no effect on any other SICStus version. | |
133 | % This is not actually a compile-time flag - it only takes effect when set at runtime. | |
134 | compile_time_flag('SP_TIMEOUT_IMPLEMENTATON=legacy'). | |
135 | :- endif. | |
136 | ||
137 | compile_time_flag(_) :- fail. | |
138 | ||
139 | ||
140 | relevant_prolog_flags(Flags) :- | |
141 | findall(Flag/Val, (relevant_flag(Flag),current_prolog_flag(Flag,Val)), Flags). | |
142 | ||
143 | relevant_flag(dialect). | |
144 | relevant_flag(version_data). | |
145 | relevant_flag(platform_data). | |
146 | relevant_flag(profiling). | |
147 | relevant_flag(system_type). | |
148 | relevant_flag(host_type). | |
149 |