* gpgsm/t-encrypt.c (main): Add a simple option parser and allow
[gpgme.git] / gpgme / gpgme-config.in
1 #!/bin/sh
2
3 prefix=@prefix@
4 exec_prefix=@exec_prefix@
5 exec_prefix_set=no
6
7 gpgme_libs="@GPGME_LIBS@"
8 gpgme_cflags="@GPGME_CFLAGS@"
9
10
11 usage()
12 {
13         cat <<EOF
14 Usage: gpgme-config [OPTIONS]
15 Options:
16         [--prefix[=DIR]]
17         [--exec-prefix[=DIR]]
18         [--version]
19         [--libs]
20         [--cflags]
21 EOF
22         exit $1
23 }
24
25 if test $# -eq 0; then
26         usage 1 1>&2
27 fi
28
29 while test $# -gt 0; do
30   case "$1" in
31   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
32   *) optarg= ;;
33   esac
34
35   case $1 in
36     --prefix=*)
37       prefix=$optarg
38       if test $exec_prefix_set = no ; then
39         exec_prefix=$optarg
40       fi
41       ;;
42     --prefix)
43       echo_prefix=yes
44       ;;
45     --exec-prefix=*)
46       exec_prefix=$optarg
47       exec_prefix_set=yes
48       ;;
49     --exec-prefix)
50       echo_exec_prefix=yes
51       ;;
52     --version)
53       echo "@VERSION@"
54       exit 0
55       ;;
56     --cflags)
57       echo_cflags=yes
58       ;;
59     --libs)
60       echo_libs=yes
61       ;;
62     *)
63       usage 1 1>&2
64       ;;
65   esac
66   shift
67 done
68
69 if test "$echo_prefix" = "yes"; then
70     echo $prefix
71 fi
72
73 if test "$echo_exec_prefix" = "yes"; then
74     echo $exec_prefix
75 fi
76
77 if test "$echo_cflags" = "yes"; then
78     if test "@includedir@" != "/usr/include" ; then
79       includes="-I@includedir@"
80       for i in $gpgme_cflags ; do
81         if test "$i" = "-I@includedir@" ; then
82           includes=""
83         fi
84       done
85     fi
86     echo $includes $gpgme_cflags
87 fi
88
89 if test "$echo_libs" = "yes"; then
90     echo ${gpgme_libs}
91 fi
92
93