|
33 | 33 | */ |
34 | 34 |
|
35 | 35 | :- module(test_saved_states, |
36 | | - [ test_saved_states/0 |
| 36 | + [ test_saved_states/0, |
| 37 | + build_test_shlibs/0 |
37 | 38 | ]). |
38 | 39 |
|
39 | 40 | :- prolog_load_context(directory, Here), |
|
197 | 198 | remove_state(State) :- |
198 | 199 | catch(delete_file(State), _, true). |
199 | 200 |
|
| 201 | +swipl_ld(SwiplLd) :- |
| 202 | + current_prolog_flag(executable,SwiplExe), |
| 203 | + file_directory_name(SwiplExe, Dir), |
| 204 | + format(atom(SwiplLd0), "~w/swipl-ld",[Dir]), |
| 205 | + prolog_to_os_filename(SwiplLd0,SwiplLd). |
| 206 | + |
200 | 207 | build_shlib(Name) :- |
201 | | - format(atom(Cmd), "swipl-ld -shared -fPIC -o input/~w.so input/~w.c",[Name, Name]), |
202 | | - shell(Cmd). |
| 208 | + swipl_ld(SwiplLd), |
| 209 | + format(atom(Cmd), |
| 210 | + "~w -shared -fPIC -o input/~w.so input/~w.c", |
| 211 | + [SwiplLd,Name, Name]), |
| 212 | + shell(Cmd). |
203 | 213 |
|
204 | 214 | build_shlib(Name, Dep, DepDir) :- |
205 | | - format(atom(Cmd), "swipl-ld -shared -fPIC -L~w -l~w -o input/~w.so input/~w.c ",[DepDir, Dep, Name, Name]), |
206 | | - format(user_error, '~w~n', Cmd), |
207 | | - shell(Cmd). |
| 215 | + swipl_ld(SwiplLd), |
| 216 | + format(atom(Cmd), |
| 217 | + "~w -shared -fPIC -L~w -l~w -o input/~w.so input/~w.c ", |
| 218 | + [SwiplLd, DepDir, Dep, Name, Name]), |
| 219 | + shell(Cmd). |
208 | 220 |
|
209 | 221 | build_test_shlibs :- |
210 | | - build_shlib("shlib_no_deps"), |
211 | | - build_shlib("libdep"), |
212 | | - build_shlib("shlib_with_dep", "dep", "input"). |
| 222 | + build_shlib("shlib_no_deps"), |
| 223 | + build_shlib("libdep"), |
| 224 | + build_shlib("shlib_with_dep", "dep", "input"). |
213 | 225 |
|
214 | 226 | %% read_terms(+In:stream, -Data:list) |
215 | 227 | % |
|
0 commit comments