1 |
johnpye |
683 |
#!@PYTHON@ |
2 |
|
|
from optparse import OptionParser |
3 |
|
|
import sys |
4 |
|
|
|
5 |
|
|
#--------------------- |
6 |
|
|
# This file is generated automatically by SCons and installed in at INSTALL_BIN. |
7 |
|
|
# Use it to query for local configuration of ASCEND on your system for example |
8 |
|
|
# when building external 'plugins' such as external computations and external |
9 |
|
|
# solvers etc. |
10 |
|
|
# |
11 |
|
|
# It's written in python since (because of SCons) we know we have Python on |
12 |
johnpye |
692 |
# this system already but we don't know that about unix shell (eg on Windows). |
13 |
johnpye |
683 |
# |
14 |
|
|
# Note that SCons supports reading of the output from this script, using |
15 |
|
|
# features offered since version 0.96.91 |
16 |
|
|
# |
17 |
|
|
# This file inspired by other software that uses the same approach, eg |
18 |
|
|
# ginac-config, xft-config, cppunit-config. |
19 |
|
|
# |
20 |
|
|
# Type ascend-config --help for usage. |
21 |
|
|
#--------------------- |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
# here are the values passed to us from SCons: |
25 |
|
|
LIB="@INSTALL_LIB@" |
26 |
|
|
BIN="@INSTALL_BIN@" |
27 |
|
|
INCLUDE="@INSTALL_INCLUDE@" |
28 |
|
|
ASCDATA="@INSTALL_ASCDATA@" |
29 |
johnpye |
721 |
MODELS="@INSTALL_MODELS@" |
30 |
johnpye |
683 |
|
31 |
|
|
usage = "usage: %prog [--help,...]" |
32 |
|
|
# the rest of this script is about returning those values in the standard way |
33 |
|
|
parser = OptionParser(usage=usage, version="@VERSION@") |
34 |
|
|
|
35 |
|
|
parser.add_option("--libs", action="store_true", dest="libs", help="show linker flags (for ASCEND libraries)") |
36 |
|
|
parser.add_option("--cppflags", action="store_true", dest="cppflags", help="show C pre-processor flags (for ASCEND header files)") |
37 |
|
|
parser.add_option("--data", action="store_true", dest="data", help="show location of ASCEND data files") |
38 |
johnpye |
721 |
parser.add_option("--models", action="store_true", dest="models", help="show location of ASCEND model library") |
39 |
johnpye |
683 |
|
40 |
|
|
(options, args) = parser.parse_args() |
41 |
|
|
|
42 |
|
|
ok = False |
43 |
|
|
|
44 |
|
|
if options.cppflags: |
45 |
|
|
include = "" |
46 |
|
|
if INCLUDE!="/usr/include": |
47 |
|
|
include=INCLUDE |
48 |
|
|
print "-I"+include |
49 |
|
|
ok = True |
50 |
|
|
|
51 |
|
|
if options.libs: |
52 |
|
|
libs = "" |
53 |
|
|
if LIB!="/usr/lib": |
54 |
|
|
libs = LIB |
55 |
|
|
print "-L"+libs+" -lascend" |
56 |
|
|
ok = True |
57 |
|
|
|
58 |
|
|
if options.data: |
59 |
|
|
print ASCDATA |
60 |
|
|
ok = True |
61 |
|
|
|
62 |
johnpye |
721 |
if options.models: |
63 |
|
|
print MODELS |
64 |
|
|
ok = True |
65 |
|
|
|
66 |
johnpye |
683 |
if not ok: |
67 |
johnpye |
721 |
sys.stderr.write("invalid option '%s' (use --help for more info)\n" % args) |
68 |
johnpye |
683 |
sys.exit(1) |