
"which sicstus" will tell you where it is on linux if it is in your path.
From the manual:
In addition the following environment variables are set automatically on startup. SP_APP_DIR The absolute path to the directory that contains the executable. Also available as the application file search path. SP_RT_DIR The full path to the directory that contains the SICStus run-time. If the application has linked statically to the SICStus run-time then SP_RT_DIR is the same as SP_APP_DIR. Also available as the runtime file search path. SP_LIBRARY_DIR The absolute path to the directory that contains the SICStus library files. Also available as the initial value of the library file search path Walter -----Original Message----- From: owner-sicstus-users@sics.se [mailto:owner-sicstus-users@sics.se] On Behalf Of Roberto Bagnara Sent: Friday, October 21, 2005 4:10 AM To: sicstus-users@sics.se Cc: The Parma Polyhedra Library developers' list Subject: [sicstus-users] Locating sicstus.h
Most people installing SICStus onto some non-standard place, will set their PATH environment variable so that the command `sicstus' does the right thing. Exploiting this fact, I would like to know where is sicstus.h located. In other words, I need something like what is offered by SWI-Prolog as follows:
$ pl -dump-runtime-variables CC="gcc"; PLBASE="/usr/local/lib/pl-5.4.7"; PLARCH="i686-linux"; PLLIBS="-ldl -lreadline -lncurses -lm -lrt "; PLLIB="-lpl"; PLLDFLAGS="-export-dynamic -O3 -pthread"; PLSOEXT="so"; PLVERSION="50407"; PLSHARED="yes"; PLTHREADS="yes";
Here, PLBASE tells me the installation path, and from there I can retrieve everything. Notice that I rely on the fact that PATH has been set so that `pl' works.
What is the simplest way to achieve this effect for SICStus? Many thanks,
Roberto
-- Prof. Roberto Bagnara Computer Science Group Department of Mathematics, University of Parma, Italy http://www.cs.unipr.it/~bagnara/ mailto:bagnara@cs.unipr.it The information in this electronic mail message is sender's business Confidential and may be legally privileged. It is intended solely for the addressee(s). Access to this Internet electronic mail message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. The sender believes that this E-mail and any attachments were free of any virus, worm, Trojan horse, and/or malicious code when sent. This message and its attachments could have been infected during transmission. By reading the message and opening any attachments, the recipient accepts full responsibility for taking protective and remedial action about viruses and other defects. Cendant is not liable for any loss or damage arising in any way from this message or its attachments.

Wilson, Walter wrote:
"which sicstus" will tell you where it is on linux if it is in your path.
Dear Walter,
so the idea would be that once you know where `sicstus' is you also know where `sicstus.h' is. This would not work in case `sicstus' is a symbolic link. Say someone installs SICStus in /opt/sicstus-3.12 and then places a link to /opt/sicstus-3.12/bin/sicstus into $HOME/bin, which is in PATH.
Anyway, while I keep looking for a more robust solution, I have implemented an Autoconf macro that assumes `sicstus.h' is at a fixed relative path from `sicstus':
http://www.cs.unipr.it/cgi-bin/cvsweb.cgi/~checkout~/ppl/m4/ac_check_sicstus...
From the manual:
In addition the following environment variables are set automatically on startup.
On startup of what? Of SICStus? So the idea would be to write a little SICStus program that inspects the environment variables and prints them out?
SP_APP_DIR The absolute path to the directory that contains the executable. Also available as the application file search path. SP_RT_DIR The full path to the directory that contains the SICStus run-time. If the application has linked statically to the SICStus run-time then SP_RT_DIR is the same as SP_APP_DIR. Also available as the runtime file search path. SP_LIBRARY_DIR The absolute path to the directory that contains the SICStus library files. Also available as the initial value of the library file search path
Thanks for the input,
Roberto

so the idea would be that once you know where `sicstus' is you also know where `sicstus.h' is.
Once you've run sicstus you can use the following sicstus code to get the relevant environment variables:
:- use_module(library(system)).
environ('SP_RT_DIR',D1) environ('SP_LIBRARY_DIR',D2) environ('SP_APP_DIR',D3)
it does not directly give you the path to sicstus.h, but it can be (always??) recovered from the value SP_APP_DIR or SP_RT_DIR I guess.
Best,

Samir Genaim wrote:
so the idea would be that once you know where `sicstus' is you also know where `sicstus.h' is.
Once you've run sicstus you can use the following sicstus code to get the relevant environment variables:
:- use_module(library(system)).
environ('SP_RT_DIR',D1) environ('SP_LIBRARY_DIR',D2) environ('SP_APP_DIR',D3)
it does not directly give you the path to sicstus.h, but it can be (always??) recovered from the value SP_APP_DIR or SP_RT_DIR I guess.
Thanks Samir. The solution
sicstus_prolog_base=$(dirname $(sicstus -f --goal "use_module(library(system)), environ('SP_APP_DIR', X), write(X), nl, halt."))
seems indeed the most reliable one. Best wishes,
Roberto
participants (3)
-
Roberto Bagnara
-
Samir Genaim
-
Wilson, Walter