Fix locale problem, e.g. for et_ET.
[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 includedir=@includedir@
15 libdir=@libdir@
16
17 # Make sure that no weird locale setting messes up our sed regexps etc.
18 LC_COLLATE=C
19 LC_ALL=C
20 LANG=C
21
22 # Network libraries.
23 netlibs="@NETLIBS@"
24
25 # Configure libgpg-error.
26 gpg_error_cflags="@GPG_ERROR_CFLAGS@"
27 gpg_error_libs="@GPG_ERROR_LIBS@"
28
29 # Configure thread packages.
30 thread_modules=""
31
32 @HAVE_PTH_TRUE@thread_modules="$thread_modules pth"
33 libs_pth="@PTH_LDFLAGS@ @PTH_LIBS@"
34 cflags_pth="@PTH_CFLAGS@"
35
36 @HAVE_PTHREAD_TRUE@thread_modules="$thread_modules pthread"
37 libs_pthread="-lpthread"
38 cflags_pthread=""
39
40 # Configure glib.
41 libs_glib="@GLIB_LIBS@"
42 cflags_glib="@GLIB_CFLAGS@"
43 with_glib=
44
45 output=""
46
47 usage()
48 {
49     cat <<EOF
50 Usage: gpgme-config [OPTIONS]
51 Options:
52         [--thread={${thread_modules}}]
53         [--prefix]
54         [--exec-prefix]
55         [--version]
56         [--api-version]
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         --cflags)
104             if test "x$includedir" != "x/usr/include" -a "x$includedir" != "x/include"; then
105                 output="$output -I$includedir"
106             fi
107             case "$thread_module" in
108                 pthread)
109                     output="$output $cflags_pthread"
110                     ;;
111                 pth)
112                     output="$output $cflags_pth"
113                     ;;
114             esac
115             output="$output $gpg_error_cflags"
116             if test "x$with_glib" = "xyes"; then
117                 output="$output $glib_cflags"
118             fi
119             ;;
120         --libs)
121             if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/lib"; then
122                 output="$output -L$libdir"
123             fi
124             case "$thread_module" in
125                 pthread)
126                     output="$output -lgpgme-pthread $libs_pthread"
127                     ;;
128                 pth)
129                     output="$output -lgpgme-pth $libs_pth"
130                     ;;
131                 *)
132                     if test "x$with_glib" = "xyes"; then
133                         output="$output -lgpgme-glib"
134                     else
135                         output="$output -lgpgme"
136                     fi
137                     ;;
138             esac
139             output="$output $gpg_error_libs $netlibs"
140             if test "x$with_glib" = "xyes"; then
141                 output="$output $glib_cflags"
142             fi
143             ;;
144         --thread=*)
145             for thread_mod in $thread_modules; do
146             if test "$thread_mod" = "$optarg"; then
147                 thread_module="$optarg";
148             fi
149             done
150             if test "x$thread_module" = "x"; then
151                 usage 1 1>&2
152             fi
153             ;;
154         --get-gpg)
155             output="$output @GPG@"
156             ;;
157         --get-gpgsm)
158             output="$output @GPGSM@"
159             ;;
160         *)
161             usage 1 1>&2
162             ;;
163     esac
164     shift
165 done
166
167 echo $output