Debian Codegraph @

src/ksba-config.in

raw
1 #!/bin/sh
2 # Copyright (C) 1999, 2002, 2011 Free Software Foundation, Inc.
3 #
4 # This file is free software; as a special exception the author gives
5 # unlimited permission to copy and/or distribute it, with or without
6 # modifications, as long as this notice is preserved.
7 #
8 # This file is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
12 PGM=ksba-config
13 libs="@KSBA_CONFIG_LIBS@ @GPG_ERROR_LIBS@"
14 cflags="@KSBA_CONFIG_CFLAGS@ @GPG_ERROR_CFLAGS@"
15 prefix=@prefix@
16 exec_prefix=@exec_prefix@
17 api_version="@KSBA_CONFIG_API_VERSION@"
18 my_host="@KSBA_CONFIG_HOST@"
19
20 includes=""
21 libdirs=""
22 exec_prefix_set=no
23 echo_libs=no
24 echo_cflags=no
25 echo_prefix=no
26 echo_exec_prefix=no
27 echo_api_version=no
28 echo_host=no
29
30
31 usage()
32 {
33 cat <<EOF
34 Usage: $PGM [OPTIONS]
35 Options:
36 [--prefix[=DIR]]
37 [--exec-prefix[=DIR]]
38 [--version]
39 [--api-version]
40 [--libs]
41 [--cflags]
42 [--host]
43 EOF
44 exit $1
45 }
46
47 if test $# -eq 0; then
48 usage 1 1>&2
49 fi
50
51 while test $# -gt 0; do
52 case "$1" in
53 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
54 *) optarg= ;;
55 esac
56
57 case $1 in
58 --prefix=*)
59 prefix=$optarg
60 if test $exec_prefix_set = no ; then
61 exec_prefix=$optarg
62 fi
63 ;;
64 --prefix)
65 echo_prefix=yes
66 ;;
67 --exec-prefix=*)
68 exec_prefix=$optarg
69 exec_prefix_set=yes
70 ;;
71 --exec-prefix)
72 echo_exec_prefix=yes
73 ;;
74 --variable=*)
75 case "${1#*=}" in
76 prefix) echo "$prefix" ;;
77 exec_prefix) echo "$exec_prefix" ;;
78 host) echo "$my_host" ;;
79 api_version) echo "$api_version" ;;
80 esac
81 exit 0
82 ;;
83 --modversion|--version)
84 echo "@PACKAGE_VERSION@"
85 exit 0
86 ;;
87 --api-version)
88 echo_api_version=yes
89 ;;
90 --cflags)
91 echo_cflags=yes
92 ;;
93 --libs)
94 echo_libs=yes
95 ;;
96 --host)
97 echo_host=yes
98 ;;
99 *)
100 usage 1 1>&2
101 ;;
102 esac
103 shift
104 done
105
106 if test "$echo_prefix" = "yes"; then
107 echo $prefix
108 fi
109
110 if test "$echo_exec_prefix" = "yes"; then
111 echo $exec_prefix
112 fi
113
114 if test "$echo_api_version" = "yes"; then
115 echo "$api_version"
116 fi
117
118 if test "$echo_host" = "yes"; then
119 echo "$my_host"
120 fi
121
122 if test "$echo_cflags" = "yes"; then
123 includes=""
124 if test "@includedir@" != "/usr/include" ; then
125 includes="-I@includedir@"
126 fi
127 tmp=""
128 for i in $includes $cflags; do
129 if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
130 tmp="$tmp $i"
131 fi
132 done
133 echo $tmp
134 fi
135
136 if test "$echo_libs" = "yes"; then
137 libdirs=""
138 if test "@libdir@" != "/usr/lib" ; then
139 libdirs="-L@libdir@"
140 fi
141 tmp=""
142 for i in $libdirs $libs; do
143 if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
144 tmp="$tmp $i"
145 fi
146 done
147 echo $tmp
148 fi