Tweaks for W32
[libgcrypt.git] / src / libgcrypt-config.in
1 #!/bin/sh
2 # Copyright (C) 1999, 2002, 2003, 2004 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 # File: @configure_input@
13
14 # General.
15 prefix="@prefix@"
16 exec_prefix="@exec_prefix@"
17 version="@VERSION@"
18 includedir="@includedir@"
19 libdir="@libdir@"
20 gpg_error_libs="@GPG_ERROR_LIBS@"
21 gpg_error_cflags="@GPG_ERROR_CFLAGS@"
22
23 # libgcrypt values.
24 libs="@LIBGCRYPT_CONFIG_LIBS@"
25 cflags="@LIBGCRYPT_CONFIG_CFLAGS@"
26
27 # API info
28 api_version="@LIBGCRYPT_CONFIG_API_VERSION@"
29
30 # Misc information.
31 symmetric_ciphers="@LIBGCRYPT_CIPHERS@"
32 asymmetric_ciphers="@LIBGCRYPT_PUBKEY_CIPHERS@"
33 digests="@LIBGCRYPT_DIGESTS@"
34
35 # State variables.
36 echo_libs=no
37 echo_cflags=no
38 echo_prefix=no
39 echo_algorithms=no
40 echo_exec_prefix=no
41 echo_version=no
42 echo_api_version=no
43
44 # Prints usage information.
45 usage()
46 {
47     cat <<EOF
48 Usage: $0 [OPTIONS]
49 Options:
50         [--prefix]
51         [--exec-prefix]
52         [--version]
53         [--api-version]
54         [--libs]
55         [--cflags]
56         [--algorithms]
57 EOF
58     exit $1
59 }
60
61 if test $# -eq 0; then
62     # Nothing to do.
63     usage 1 1>&2
64 fi
65
66 while test $# -gt 0; do
67     case "$1" in
68         # Set up `optarg'.
69         --*=*)
70             optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
71             ;;
72         *)
73             optarg=""
74             ;;
75     esac
76
77     case $1 in
78         --thread=*)
79             echo "$0: --thread option obsolete: use the thread callback interface" 1>&2
80             exit 1
81             ;;
82         --prefix=*)
83             # For compatibility reasons with old M4 macros, we ignore
84             # setting of prefix.
85             ;;
86         --prefix)
87             echo_prefix=yes
88             ;;
89         --exec-prefix=*)
90             ;;
91         --exec-prefix)
92             echo_exec_prefix=yes
93             ;;
94         --version)
95             echo_version=yes
96             ;;
97         --api-version)
98             echo_api_version=yes
99             ;;
100         --cflags)
101             echo_cflags=yes
102             ;;
103         --libs)
104             echo_libs=yes
105             ;;
106         --algorithms)
107             echo_algorithms=yes
108             ;;
109         *)
110             usage 1 1>&2
111             ;;
112     esac
113     shift
114 done
115
116 if test "$echo_prefix" = "yes"; then
117     echo "$prefix"
118 fi
119
120 if test "$echo_exec_prefix" = "yes"; then
121     echo "$exec_prefix"
122 fi
123
124 if test "$echo_cflags" = "yes"; then
125     includes=""
126     cflags_final="$cflags"
127
128     # Set up `includes'.
129     if test "x$includedir" != "x/usr/include" -a "x$includedir" != "x/include"; then
130         includes="-I$includedir"
131     fi
132     # Set up `cflags_final'.
133     cflags_final="$cflags_final $gpg_error_cflags"
134
135     tmp=""
136     for i in $includes $cflags_final; do
137        if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
138            tmp="$tmp $i"
139        fi
140     done
141     echo $tmp
142 fi
143
144 if test "$echo_libs" = "yes"; then
145     libdirs=""
146     libs_final="$libs"
147
148     # Set up `libdirs'.
149     if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/lib"; then
150         libdirs="-L$libdir"
151     fi
152
153     # Set up `libs_final'.
154     libs_final="$libs_final $gpg_error_libs"
155
156     tmp=""
157     for i in $libdirs $libs_final; do
158        if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
159            tmp="$tmp $i"
160        fi
161     done
162     echo $tmp
163 fi
164
165 if test "$echo_version" = "yes"; then
166     echo "$version"
167 fi
168
169 if test "$echo_api_version" = "yes"; then
170     echo "$api_version"
171 fi
172
173 if test "$echo_algorithms" = "yes"; then
174     echo "Symmetric cipher algorithms: $symmetric_ciphers"
175     echo "Public-key cipher algorithms: $asymmetric_ciphers"
176     echo "Message digest algorithms: $digests"
177 fi