(_gcry_module_release): Don't act if module is NULL.
[libgcrypt.git] / src / libgcrypt-config.in
1 #!/bin/sh
2 #    Copyright (C) 1999, 2002 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=libgcrypt-config
13 libs="@LIBGCRYPT_CONFIG_LIBS@"
14 cflags="@LIBGCRYPT_CONFIG_CFLAGS@"
15 ciphers="@LIBGCRYPT_CIPHERS@"
16 pubkey_ciphers="@LIBGCRYPT_PUBKEY_CIPHERS@"
17 digests="@LIBGCRYPT_DIGESTS@"
18
19 prefix=@prefix@
20 exec_prefix=@exec_prefix@
21 includes=""
22 libdirs=""
23 exec_prefix_set=no
24 echo_libs=no
25 echo_cflags=no
26 echo_prefix=no
27 echo_algorithms=no
28 echo_exec_prefix=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         [--libs]
40         [--cflags]
41         [--algorithms]
42 EOF
43         exit $1
44 }
45
46 if test $# -eq 0; then
47         usage 1 1>&2
48 fi
49
50 while test $# -gt 0; do
51   case "$1" in
52   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
53   *) optarg= ;;
54   esac
55
56   case $1 in
57     --prefix=*)
58       prefix=$optarg
59       if test $exec_prefix_set = no ; then
60         exec_prefix=$optarg
61       fi
62       ;;
63     --prefix)
64       echo_prefix=yes
65       ;;
66     --exec-prefix=*)
67       exec_prefix=$optarg
68       exec_prefix_set=yes
69       ;;
70     --exec-prefix)
71       echo_exec_prefix=yes
72       ;;
73     --version)
74       echo "@VERSION@"
75       exit 0
76       ;;
77     --cflags)
78       echo_cflags=yes
79       ;;
80     --libs)
81       echo_libs=yes
82       ;;
83     --algorithms)
84       echo_algorithms=yes
85       ;;
86     *)
87       usage 1 1>&2
88       ;;
89   esac
90   shift
91 done
92
93 if test "$echo_prefix" = "yes"; then
94     echo $prefix
95 fi
96
97 if test "$echo_exec_prefix" = "yes"; then
98     echo $exec_prefix
99 fi
100
101 if test "$echo_cflags" = "yes"; then
102     if test "@includedir@" != "/usr/include" ; then
103       includes="-I@includedir@"
104       for i in $cflags ; do
105         if test "$i" = "-I@includedir@" ; then
106           includes=""
107         fi
108       done
109     fi
110     echo $includes $cflags
111 fi
112
113 if test "$echo_libs" = "yes"; then
114     if test "@libdir@" != "/usr/lib" ; then
115       libdirs="-L@libdir@"
116       for i in $libs ; do
117         if test "$i" = "-L@libdir@" ; then
118           libdirs=""
119         fi
120       done
121     fi
122     echo $libdirs $libs
123 fi
124
125 if test "$echo_algorithms" = "yes"; then
126     echo "Symmetric cipher algorithms: $ciphers"
127     echo "Public-key cipher algorithms: $pubkey_ciphers"
128     echo "Message digest algorithms: $digests"
129 fi