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 | nssutil |
---|
24 | ssl |
---|
25 | smime |
---|
26 | EOF |
---|
27 | exit $1 |
---|
28 | } |
---|
29 | |
---|
30 | if test $# -eq 0; then |
---|
31 | usage 1 1>&2 |
---|
32 | fi |
---|
33 | |
---|
34 | lib_ssl=yes |
---|
35 | lib_smime=yes |
---|
36 | lib_nss=yes |
---|
37 | lib_nssutil=yes |
---|
38 | |
---|
39 | while test $# -gt 0; do |
---|
40 | case "$1" in |
---|
41 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; |
---|
42 | *) optarg= ;; |
---|
43 | esac |
---|
44 | |
---|
45 | case $1 in |
---|
46 | --prefix=*) |
---|
47 | prefix=$optarg |
---|
48 | ;; |
---|
49 | --prefix) |
---|
50 | echo_prefix=yes |
---|
51 | ;; |
---|
52 | --exec-prefix=*) |
---|
53 | exec_prefix=$optarg |
---|
54 | ;; |
---|
55 | --exec-prefix) |
---|
56 | echo_exec_prefix=yes |
---|
57 | ;; |
---|
58 | --includedir=*) |
---|
59 | includedir=$optarg |
---|
60 | ;; |
---|
61 | --includedir) |
---|
62 | echo_includedir=yes |
---|
63 | ;; |
---|
64 | --libdir=*) |
---|
65 | libdir=$optarg |
---|
66 | ;; |
---|
67 | --libdir) |
---|
68 | echo_libdir=yes |
---|
69 | ;; |
---|
70 | --version) |
---|
71 | echo ${major_version}.${minor_version}.${patch_version} |
---|
72 | ;; |
---|
73 | --cflags) |
---|
74 | echo_cflags=yes |
---|
75 | ;; |
---|
76 | --libs) |
---|
77 | echo_libs=yes |
---|
78 | ;; |
---|
79 | ssl) |
---|
80 | lib_ssl=yes |
---|
81 | ;; |
---|
82 | smime) |
---|
83 | lib_smime=yes |
---|
84 | ;; |
---|
85 | nss) |
---|
86 | lib_nss=yes |
---|
87 | ;; |
---|
88 | nssutil) |
---|
89 | lib_nssutil=yes |
---|
90 | ;; |
---|
91 | *) |
---|
92 | usage 1 1>&2 |
---|
93 | ;; |
---|
94 | esac |
---|
95 | shift |
---|
96 | done |
---|
97 | |
---|
98 | # Set variables that may be dependent upon other variables |
---|
99 | if test -z "$exec_prefix"; then |
---|
100 | exec_prefix=`pkg-config --variable=exec_prefix nss` |
---|
101 | fi |
---|
102 | if test -z "$includedir"; then |
---|
103 | includedir=`pkg-config --variable=includedir nss` |
---|
104 | fi |
---|
105 | if test -z "$libdir"; then |
---|
106 | libdir=`pkg-config --variable=libdir nss` |
---|
107 | fi |
---|
108 | |
---|
109 | if test "$echo_prefix" = "yes"; then |
---|
110 | echo $prefix |
---|
111 | fi |
---|
112 | |
---|
113 | if test "$echo_exec_prefix" = "yes"; then |
---|
114 | echo $exec_prefix |
---|
115 | fi |
---|
116 | |
---|
117 | if test "$echo_includedir" = "yes"; then |
---|
118 | echo $includedir |
---|
119 | fi |
---|
120 | |
---|
121 | if test "$echo_libdir" = "yes"; then |
---|
122 | echo $libdir |
---|
123 | fi |
---|
124 | |
---|
125 | if test "$echo_cflags" = "yes"; then |
---|
126 | echo -I$includedir |
---|
127 | fi |
---|
128 | |
---|
129 | if test "$echo_libs" = "yes"; then |
---|
130 | libdirs="-Wl,-rpath-link,$libdir -L$libdir" |
---|
131 | if test -n "$lib_ssl"; then |
---|
132 | libdirs="$libdirs -lssl${major_version}" |
---|
133 | fi |
---|
134 | if test -n "$lib_smime"; then |
---|
135 | libdirs="$libdirs -lsmime${major_version}" |
---|
136 | fi |
---|
137 | if test -n "$lib_nss"; then |
---|
138 | libdirs="$libdirs -lnss${major_version}" |
---|
139 | fi |
---|
140 | if test -n "$lib_nssutil"; then |
---|
141 | libdirs="$libdirs -lnssutil${major_version}" |
---|
142 | fi |
---|
143 | echo $libdirs |
---|
144 | fi |
---|
145 | |
---|