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
6
7prefix=@prefix@
8
9major_version=@MOD_MAJOR_VERSION@
10minor_version=@MOD_MINOR_VERSION@
11patch_version=@MOD_PATCH_VERSION@
12
13usage()
14{
15	cat <<EOF
16Usage: nspr-config [OPTIONS] [LIBRARIES]
17Options:
18	[--prefix[=DIR]]
19	[--exec-prefix[=DIR]]
20	[--includedir[=DIR]]
21	[--libdir[=DIR]]
22	[--version]
23	[--libs]
24	[--cflags]
25Libraries:
26	nspr
27	plc
28	plds
29EOF
30	exit $1
31}
32
33if test $# -eq 0; then
34	usage 1 1>&2
35fi
36
37lib_nspr=yes
38lib_plc=yes
39lib_plds=yes
40
41while test $# -gt 0; do
42  case "$1" in
43  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
44  *) optarg= ;;
45  esac
46
47  case $1 in
48    --prefix=*)
49      prefix=$optarg
50      ;;
51    --prefix)
52      echo_prefix=yes
53      ;;
54    --exec-prefix=*)
55      exec_prefix=$optarg
56      ;;
57    --exec-prefix)
58      echo_exec_prefix=yes
59      ;;
60    --includedir=*)
61      includedir=$optarg
62      ;;
63    --includedir)
64      echo_includedir=yes
65      ;;
66    --libdir=*)
67      libdir=$optarg
68      ;;
69    --libdir)
70      echo_libdir=yes
71      ;;
72    --version)
73      echo ${major_version}.${minor_version}.${patch_version}
74      ;;
75    --cflags)
76      echo_cflags=yes
77      ;;
78    --libs)
79      echo_libs=yes
80      ;;
81    nspr)
82      lib_nspr=yes
83      ;;
84    plc)
85      lib_plc=yes
86      ;;
87    plds)
88      lib_plds=yes
89      ;;
90    *)
91      usage 1 1>&2
92      ;;
93  esac
94  shift
95done
96
97# Set variables that may be dependent upon other variables
98if test -z "$exec_prefix"; then
99    exec_prefix=@exec_prefix@
100fi
101if test -z "$includedir"; then
102    includedir=@includedir@
103fi
104if test -z "$libdir"; then
105    libdir=@libdir@
106fi
107
108if test "$echo_prefix" = "yes"; then
109    echo $prefix
110fi
111
112if test "$echo_exec_prefix" = "yes"; then
113    echo $exec_prefix
114fi
115
116if test "$echo_includedir" = "yes"; then
117    echo $includedir
118fi
119
120if test "$echo_libdir" = "yes"; then
121    echo $libdir
122fi
123
124if test "$echo_cflags" = "yes"; then
125    echo -I$includedir
126fi
127
128if test "$echo_libs" = "yes"; then
129      libdirs=-L$libdir
130      if test -n "$lib_plds"; then
131	libdirs="$libdirs -lplds${major_version}"
132      fi
133      if test -n "$lib_plc"; then
134	libdirs="$libdirs -lplc${major_version}"
135      fi
136      if test -n "$lib_nspr"; then
137	libdirs="$libdirs -lnspr${major_version}"
138      fi
139      os_ldflags="@LDFLAGS@"
140      for i in $os_ldflags ; do
141	if echo $i | grep \^-L >/dev/null; then
142	  libdirs="$libdirs $i"
143        fi
144      done
145      echo $libdirs @OS_LIBS@
146fi
147
148