1#!/bin/sh
2# This Source Code Form is subject to the terms of the Mozilla Public
3# License, v. 2.0. If a copy of the MPL was not distributed with this
4# file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
6prefix='@prefix@'
7mozilla_version='@MOZILLA_VERSION@'
8JS_LIBRARY_NAME='@JS_LIBRARY_NAME@'
9NSPR_CFLAGS='@NSPR_CFLAGS@'
10JS_CONFIG_LIBS='@JS_CONFIG_LIBS@'
11MOZ_JS_LIBS='@JS_CONFIG_MOZ_JS_LIBS@'
12
13FILENAME=`basename "$0"`
14
15usage()
16{
17	cat <<EOF
18Usage: $FILENAME [OPTIONS]
19Options:
20	[--prefix[=DIR]]
21	[--exec-prefix[=DIR]]
22	[--includedir[=DIR]]
23	[--libdir[=DIR]]
24	[--version]
25	[--libs]
26	[--cflags]
27	[--lib-filenames]
28EOF
29	exit $1
30}
31
32if test $# -eq 0; then
33	usage 1 1>&2
34fi
35
36while test $# -gt 0; do
37  case "$1" in
38  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
39  *) optarg= ;;
40  esac
41
42  case $1 in
43    --prefix=*)
44      prefix=$optarg
45      ;;
46    --prefix)
47      echo_prefix=yes
48      ;;
49    --exec-prefix=*)
50      exec_prefix=$optarg
51      ;;
52    --exec-prefix)
53      echo_exec_prefix=yes
54      ;;
55    --includedir=*)
56      includedir=$optarg
57      ;;
58    --includedir)
59      echo_includedir=yes
60      ;;
61    --libdir=*)
62      libdir=$optarg
63      ;;
64    --libdir)
65      echo_libdir=yes
66      ;;
67    --version)
68      echo "$mozilla_version"
69      ;;
70    --cflags)
71      echo_cflags=yes
72      ;;
73    --libs)
74      echo_libs=yes
75      ;;
76    *)
77      usage 1 1>&2
78      ;;
79  esac
80  shift
81done
82
83# Set variables that may be dependent upon other variables
84if test -z "$exec_prefix"; then
85    exec_prefix=@exec_prefix@
86fi
87if test -z "$includedir"; then
88    includedir=@includedir@
89fi
90if test -z "$libdir"; then
91    libdir=@libdir@
92fi
93
94if test "$echo_prefix" = "yes"; then
95    echo $prefix
96fi
97
98if test "$echo_exec_prefix" = "yes"; then
99    echo $exec_prefix
100fi
101
102if test "$echo_includedir" = "yes"; then
103    echo $includedir
104fi
105
106if test "$echo_libdir" = "yes"; then
107    echo $libdir
108fi
109
110if test "$echo_cflags" = "yes"; then
111    echo "-std=gnu++0x -include $includedir/$JS_LIBRARY_NAME/js/RequiredDefines.h -I$includedir/$JS_LIBRARY_NAME $NSPR_CFLAGS"
112fi
113
114if test "$echo_libs" = "yes"; then
115    echo "$MOZ_JS_LIBS $JS_CONFIG_LIBS"
116fi
117