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