1 |
#!/bin/sh |
2 |
## |
3 |
## OSSP js - JavaScript Engine |
4 |
## Copyright (c) 1998-2006 Mozilla <http://www.mozilla.org/> |
5 |
## |
6 |
## This file is part of OSSP js, a distribution of the Mozilla JavaScript |
7 |
## reference implementation, which can found at http://www.ossp.org/pkg/lib/js/ |
8 |
## |
9 |
## Permission to use, copy, modify, and distribute this software for |
10 |
## any purpose with or without fee is hereby granted, provided that |
11 |
## the above copyright notice and this permission notice appear in all |
12 |
## copies. |
13 |
## |
14 |
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
15 |
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
16 |
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
17 |
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
18 |
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
19 |
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
20 |
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
21 |
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
22 |
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
23 |
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
24 |
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 |
## SUCH DAMAGE. |
26 |
## |
27 |
## js-config.in: library build utility |
28 |
## |
29 |
|
30 |
DIFS=' |
31 |
' |
32 |
|
33 |
prefix="@prefix@" |
34 |
exec_prefix="@exec_prefix@" |
35 |
|
36 |
js_prefix="$prefix" |
37 |
js_exec_prefix="$exec_prefix" |
38 |
js_datarootdir="@datarootdir@" |
39 |
js_bindir="@bindir@" |
40 |
js_libdir="@libdir@" |
41 |
js_includedir="@includedir@" |
42 |
js_mandir="@mandir@" |
43 |
js_datadir="@datadir@" |
44 |
js_acdir="@datadir@/aclocal" |
45 |
js_libs="@LIBS@" |
46 |
js_version="@JS_VERSION@" |
47 |
|
48 |
help=no |
49 |
version=no |
50 |
|
51 |
usage="js-config" |
52 |
usage="$usage [--help] [--version]" |
53 |
usage="$usage [--prefix] [--exec-prefix] [--bindir] [--libdir] [--includedir] [--mandir] [--datadir] [--acdir]" |
54 |
usage="$usage [--cppflags] [--cflags] [--ldflags] [--libs]" |
55 |
if [ $# -eq 0 ]; then |
56 |
echo "js-config:Error: Invalid option" 1>&2 |
57 |
echo "js-config:Usage: $usage" 1>&2 |
58 |
exit 1 |
59 |
fi |
60 |
output='' |
61 |
all=no |
62 |
prev='' |
63 |
OIFS="$IFS" IFS="$DIFS" |
64 |
for option |
65 |
do |
66 |
if [ ".$prev" != . ]; then |
67 |
eval "$prev=\$option" |
68 |
prev='' |
69 |
continue |
70 |
fi |
71 |
case "$option" in |
72 |
-*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; |
73 |
*) optarg='' ;; |
74 |
esac |
75 |
case "$option" in |
76 |
--help|-h) |
77 |
echo "Usage: $usage" |
78 |
exit 0 |
79 |
;; |
80 |
--version|-v) |
81 |
echo "OSSP js $js_version" |
82 |
exit 0 |
83 |
;; |
84 |
--all) |
85 |
all=yes |
86 |
;; |
87 |
--prefix) |
88 |
output="$output $js_prefix" |
89 |
;; |
90 |
--exec-prefix) |
91 |
output="$output $js_exec_prefix" |
92 |
;; |
93 |
--bindir) |
94 |
output="$output $js_bindir" |
95 |
;; |
96 |
--libdir) |
97 |
output="$output $js_libdir" |
98 |
;; |
99 |
--includedir) |
100 |
output="$output $js_includedir" |
101 |
;; |
102 |
--mandir) |
103 |
output="$output $js_mandir" |
104 |
;; |
105 |
--datadir) |
106 |
output="$output $js_datadir" |
107 |
;; |
108 |
--acdir) |
109 |
output="$output $js_acdir" |
110 |
;; |
111 |
--cppflags) |
112 |
output="$output -DOSSP -DXP_UNIX -I$js_includedir/js" |
113 |
;; |
114 |
--cflags) |
115 |
: # none |
116 |
;; |
117 |
--ldflags) |
118 |
output="$output -L$js_libdir" |
119 |
;; |
120 |
--libs) |
121 |
output="$output -ljs $js_libs" |
122 |
;; |
123 |
* ) |
124 |
echo "js-config:Error: Invalid option" 1>&2 |
125 |
echo "js-config:Usage: $usage" 1>&2 |
126 |
exit 1; |
127 |
;; |
128 |
esac |
129 |
done |
130 |
IFS="$OIFS" |
131 |
if [ ".$prev" != . ]; then |
132 |
echo "js-config:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2 |
133 |
exit 1 |
134 |
fi |
135 |
if [ ".$output" != . ]; then |
136 |
echo $output |
137 |
fi |
138 |
|