Do not include the removed file status-table.h
[gpgme.git] / src / gpgme-config.in
1 #!/bin/sh
2 # Copyright (C) 1999, 2002, 2003 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 prefix=@prefix@
13 exec_prefix=@exec_prefix@
14
15 # Make sure that no weird locale setting messes up our sed regexps etc.
16 LC_COLLATE=C
17 LC_ALL=C
18 LANG=C
19
20 # GPGME's own cflags and libs
21 cflags="-I@includedir@"
22 libs="-L@libdir@"
23
24 # Network libraries.
25 assuan_cflags="@LIBASSUAN_CFLAGS@"
26 assuan_libs="@LIBASSUAN_LIBS@"
27
28 # Configure libgpg-error.
29 gpg_error_cflags="@GPG_ERROR_CFLAGS@"
30 gpg_error_libs="@GPG_ERROR_LIBS@"
31
32 # Configure thread packages.
33 thread_modules=""
34
35 @HAVE_PTHREAD_TRUE@thread_modules="$thread_modules pthread"
36 libs_pthread="-lpthread"
37 cflags_pthread=""
38
39 # Configure glib.
40 libs_glib="@GLIB_LIBS@"
41 cflags_glib="@GLIB_CFLAGS@"
42 with_glib=
43
44 output=""
45
46 usage()
47 {
48     cat <<EOF
49 Usage: gpgme-config [OPTIONS]
50 Options:
51         [--thread={${thread_modules}}]
52         [--prefix]
53         [--exec-prefix]
54         [--version]
55         [--api-version]
56         [--host]
57         [--libs]
58         [--cflags]
59         [--get-gpg]
60         [--get-gpgsm]
61 EOF
62     exit $1
63 }
64
65 if test $# -eq 0; then
66     usage 1 1>&2
67 fi
68
69 while test $# -gt 0; do
70     case "$1" in
71         -*=*)
72             optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
73             ;;
74         *)
75             optarg=
76             ;;
77     esac
78
79     case $1 in
80         --prefix=*)
81             # For compatibility reasons with old M4 macros, we ignore
82             # setting of prefix.
83             ;;
84         --prefix)
85             output="$output $prefix"
86             ;;
87         --exec-prefix=*)
88             ;;
89         --exec-prefix)
90             output="$output $exec_prefix"
91             ;;
92         --glib)
93             with_glib=yes
94             ;;
95         --version)
96             echo "@VERSION@"
97             exit 0
98             ;;
99         --api-version)
100             echo "@GPGME_CONFIG_API_VERSION@"
101             exit 0
102             ;;
103         --host)
104             echo "@GPGME_CONFIG_HOST@"
105             exit 0
106             ;;
107         --cflags)
108             result=
109             tmp_c=
110             tmp_g=
111             case "$thread_module" in
112                 pthread) tmp_c="$cflags_pthread" ;;
113             esac
114             test "x$with_glib" = "xyes" && tmp_g="$cflags_glib"
115             for i in $cflags $tmp_c $assuan_cflags $gpg_error_cflags $tmp_g ; do
116               skip=no
117               case $i in
118                   -I/usr/include|-I/include)
119                       skip=yes
120                       ;;
121                   -I*)
122                       for j in $result ; do
123                           if test x"$j" = x"$i" ; then
124                               skip=yes
125                               break;
126                           fi
127                       done
128                       ;;
129               esac
130               if test $skip = no ; then
131                   result="$result $i"
132               fi
133             done
134             output="$output $result"
135             ;;
136         --libs)
137             result=
138             tmp_x=
139             case "$thread_module" in
140                 pthread) tmp_l="-lgpgme-pthread"; tmp_x="$libs_pthread" ;;
141                 *)
142                     if test "x$with_glib" = "xyes" ; then
143                          tmp_l="-lgpgme-glib"
144                          tmp_x="$libs_glib"
145                     else
146                          tmp_l="-lgpgme"
147                     fi
148                     ;;
149             esac
150             for i in $libs $tmp_l $assuan_libs $gpg_error_libs $tmp_x; do
151               skip=no
152               case $i in
153                   -L/usr/lib|-L/lib)
154                       skip=yes
155                       ;;
156                   -L*|-l*)
157                       for j in $result ; do
158                           if test x"$j" = x"$i" ; then
159                               skip=yes
160                               break;
161                           fi
162                       done
163                       ;;
164               esac
165               if test $skip = no ; then
166                   result="$result $i"
167               fi
168             done
169             output="$output $result"
170             ;;
171         --thread=*)
172             for thread_mod in $thread_modules; do
173             if test "$thread_mod" = "$optarg"; then
174                 thread_module="$optarg";
175             fi
176             done
177             if test "x$thread_module" = "x"; then
178                 usage 1 1>&2
179             fi
180             ;;
181         --get-gpg)
182             output="$output @GPG@"
183             ;;
184         --get-gpgsm)
185             output="$output @GPGSM@"
186             ;;
187         *)
188             usage 1 1>&2
189             ;;
190     esac
191     shift
192 done
193
194 echo $output