* engine-gpgsm.c (gpgsm_export_ext): Properly insert a space
[gpgme.git] / gpgme / 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 # Configure libgpg-error.
18 gpg_error_cflags="@GPG_ERROR_CFLAGS@"
19 gpg_error_libs="@GPG_ERROR_LIBS@"
20
21 # Configure thread packages.
22 thread_modules=""
23
24 @HAVE_PTH_TRUE@thread_modules="$thread_modules pth"
25 libs_pth="@PTH_LDFLAGS@ @PTH_LIBS@"
26 cflags_pth="@PTH_CFLAGS@"
27
28 @HAVE_PTHREAD_TRUE@thread_modules="$thread_modules pthread"
29 libs_pthread="-lpthread"
30 cflags_pthread=""
31
32 output=""
33
34 usage()
35 {
36     cat <<EOF
37 Usage: gpgme-config [OPTIONS]
38 Options:
39         [--thread={${thread_modules}}]
40         [--prefix]
41         [--exec-prefix]
42         [--version]
43         [--libs]
44         [--cflags]
45 EOF
46     exit $1
47 }
48
49 if test $# -eq 0; then
50     usage 1 1>&2
51 fi
52
53 while test $# -gt 0; do
54     case "$1" in
55         -*=*)
56             optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
57             ;;
58         *)
59             optarg=
60             ;;
61     esac
62
63     case $1 in
64         --prefix=*)
65             # For compatibility reasons with old M4 macros, we ignore
66             # setting of prefix.
67             ;;
68         --prefix)
69             output="$output $prefix"
70             ;;
71         --exec-prefix=*)
72             ;;
73         --exec-prefix)
74             output="$output $exec_prefix"
75             ;;
76         --version)
77             echo "@VERSION@"
78             exit 0
79             ;;
80         --cflags)
81             output="$output -I$includedir"
82             case "$thread_module" in
83                 pthread)
84                     output="$output $cflags_pthread"
85                     ;;
86                 pth)
87                     output="$output $cflags_pth"
88                     ;;
89             esac
90             output="$output $gpg_error_cflags"
91             ;;
92         --libs)
93             output="$output -L$libdir"
94             case "$thread_module" in
95                 pthread)
96                     output="$output -lgpgme-pthread $libs_pthread"
97                     ;;
98                 pth)
99                     output="$output -lgpgme-pth $libs_pth"
100                     ;;
101                 *)
102                     output="$output -lgpgme"
103             esac
104             output="$output $gpg_error_libs"
105             ;;
106         --thread=*)
107             for thread_mod in $thread_modules; do
108             if test "$thread_mod" = "$optarg"; then
109                 thread_module="$optarg";
110             fi
111             done
112             if test "x$thread_module" = "x"; then
113                 usage 1 1>&2
114             fi
115             ;;
116         *)
117             usage 1 1>&2
118             ;;
119     esac
120     shift
121 done
122
123 echo $output