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