]>
Commit | Line | Data |
---|---|---|
a91d5515 ER |
1 | #!/bin/sh |
2 | ||
3 | prefix=@prefix@ | |
4 | ||
5 | major_version=@MOD_MAJOR_VERSION@ | |
6 | minor_version=@MOD_MINOR_VERSION@ | |
7 | patch_version=@MOD_PATCH_VERSION@ | |
8 | ||
9 | usage() | |
10 | { | |
11 | cat <<EOF | |
12 | Usage: nss-config [OPTIONS] [LIBRARIES] | |
13 | Options: | |
14 | [--prefix[=DIR]] | |
15 | [--exec-prefix[=DIR]] | |
16 | [--includedir[=DIR]] | |
17 | [--libdir[=DIR]] | |
18 | [--version] | |
19 | [--libs] | |
20 | [--cflags] | |
21 | Dynamic Libraries: | |
22 | nss | |
23 | ssl | |
24 | smime | |
25 | EOF | |
26 | exit $1 | |
27 | } | |
28 | ||
29 | if test $# -eq 0; then | |
30 | usage 1 1>&2 | |
31 | fi | |
32 | ||
33 | lib_ssl=yes | |
34 | lib_smime=yes | |
35 | lib_nss=yes | |
36 | ||
37 | while test $# -gt 0; do | |
38 | case "$1" in | |
39 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; | |
40 | *) optarg= ;; | |
41 | esac | |
42 | ||
43 | case $1 in | |
44 | --prefix=*) | |
45 | prefix=$optarg | |
46 | ;; | |
47 | --prefix) | |
48 | echo_prefix=yes | |
49 | ;; | |
50 | --exec-prefix=*) | |
51 | exec_prefix=$optarg | |
52 | ;; | |
53 | --exec-prefix) | |
54 | echo_exec_prefix=yes | |
55 | ;; | |
56 | --includedir=*) | |
57 | includedir=$optarg | |
58 | ;; | |
59 | --includedir) | |
60 | echo_includedir=yes | |
61 | ;; | |
62 | --libdir=*) | |
63 | libdir=$optarg | |
64 | ;; | |
65 | --libdir) | |
66 | echo_libdir=yes | |
67 | ;; | |
68 | --version) | |
69 | echo ${major_version}.${minor_version}.${patch_version} | |
70 | ;; | |
71 | --cflags) | |
72 | echo_cflags=yes | |
73 | ;; | |
74 | --libs) | |
75 | echo_libs=yes | |
76 | ;; | |
77 | ssl) | |
78 | lib_ssl=yes | |
79 | ;; | |
80 | smime) | |
81 | lib_smime=yes | |
82 | ;; | |
83 | nss) | |
84 | lib_nss=yes | |
85 | ;; | |
86 | *) | |
87 | usage 1 1>&2 | |
88 | ;; | |
89 | esac | |
90 | shift | |
91 | done | |
92 | ||
93 | # Set variables that may be dependent upon other variables | |
94 | if test -z "$exec_prefix"; then | |
95 | exec_prefix=`pkg-config --variable=exec_prefix nss` | |
96 | fi | |
97 | if test -z "$includedir"; then | |
98 | includedir=`pkg-config --variable=includedir nss` | |
99 | fi | |
100 | if test -z "$libdir"; then | |
101 | libdir=`pkg-config --variable=libdir nss` | |
102 | fi | |
103 | ||
104 | if test "$echo_prefix" = "yes"; then | |
105 | echo $prefix | |
106 | fi | |
107 | ||
108 | if test "$echo_exec_prefix" = "yes"; then | |
109 | echo $exec_prefix | |
110 | fi | |
111 | ||
112 | if test "$echo_includedir" = "yes"; then | |
113 | echo $includedir | |
114 | fi | |
115 | ||
116 | if test "$echo_libdir" = "yes"; then | |
117 | echo $libdir | |
118 | fi | |
119 | ||
120 | if test "$echo_cflags" = "yes"; then | |
121 | echo -I$includedir | |
122 | fi | |
123 | ||
124 | if test "$echo_libs" = "yes"; then | |
125 | libdirs="-Wl,-rpath-link,$libdir -L$libdir" | |
126 | if test -n "$lib_ssl"; then | |
127 | libdirs="$libdirs -lssl${major_version}" | |
128 | fi | |
129 | if test -n "$lib_smime"; then | |
130 | libdirs="$libdirs -lsmime${major_version}" | |
131 | fi | |
132 | if test -n "$lib_nss"; then | |
133 | libdirs="$libdirs -lnss${major_version}" | |
134 | fi | |
135 | echo $libdirs | |
136 | fi | |
137 |