* primegen.c (check_prime): New args CB_FUNC and CB_ARG; call them
[libgcrypt.git] / src / libgcrypt-config.in
1 #!/bin/sh
2 #    Copyright (C) 1999, 2002, 2003 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 thread_module=""
16 version="@VERSION@"
17 gpg_error_libs="@GPG_ERROR_LIBS@"
18 gpg_error_cflags="@GPG_ERROR_CFLAGS@"
19
20 # LIBS values.
21 libs="@LIBGCRYPT_CONFIG_LIBS@"
22 libs_pthread="@LIBGCRYPT_CONFIG_LIBS_PTHREAD@"
23 libs_pth="@LIBGCRYPT_CONFIG_LIBS_PTH@"
24
25 # CFLAGS values.
26 cflags="@LIBGCRYPT_CONFIG_CFLAGS@"
27 cflags_pthread="@LIBGCRYPT_CONFIG_CFLAGS_PTHREAD@"
28 cflags_pth="@LIBGCRYPT_CONFIG_CFLAGS_PTH@"
29
30 # Misc information.
31 symmetric_ciphers="@LIBGCRYPT_CIPHERS@"
32 asymmetric_ciphers="@LIBGCRYPT_PUBKEY_CIPHERS@"
33 digests="@LIBGCRYPT_DIGESTS@"
34 thread_modules="@LIBGCRYPT_THREAD_MODULES@"
35
36 # State variables.
37 echo_libs=no
38 echo_cflags=no
39 echo_prefix=no
40 echo_algorithms=no
41 echo_exec_prefix=no
42 echo_version=no
43
44 # Prints usage information.
45 usage()
46 {
47     cat <<EOF
48 Usage: $0 [OPTIONS]
49 Options:
50         [--thread={${thread_modules}}]
51         [--prefix]
52         [--exec-prefix]
53         [--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             for thread_mod in $thread_modules; do
80                 if test "$thread_mod" = "$optarg"; then
81                     thread_module="$optarg";
82                 fi
83             done
84             if test "x$thread_module" = "x"; then
85                 usage 1 1>&2
86             fi
87             ;;
88         --prefix=*)
89             # For compatibility reasons with old M4 macros, we ignore
90             # setting of prefix.
91             ;;
92         --prefix)
93             echo_prefix=yes
94             ;;
95         --exec-prefix=*)
96             ;;
97         --exec-prefix)
98             echo_exec_prefix=yes
99             ;;
100         --version)
101             echo_version=yes
102             ;;
103         --cflags)
104             echo_cflags=yes
105             ;;
106         --libs)
107             echo_libs=yes
108             ;;
109         --algorithms)
110             echo_algorithms=yes
111             ;;
112         *)
113             usage 1 1>&2
114             ;;
115     esac
116     shift
117 done
118
119 if test "$echo_prefix" = "yes"; then
120     echo "$prefix"
121 fi
122
123 if test "$echo_exec_prefix" = "yes"; then
124     echo "$exec_prefix"
125 fi
126
127 if test "$echo_cflags" = "yes"; then
128     includes=""
129     cflags_final="$cflags"
130
131     # Set up `includes'.
132     if test "@includedir@" != "/usr/include" ; then
133         includes="-I@includedir@"
134         for i in $cflags ; do
135             if test "$i" = "-I@includedir@" ; then
136                 includes=""
137             fi
138         done
139     fi
140
141     # Set up `cflags_final'.
142     case "$thread_module" in
143         pthread)
144             cflags_final=$cflags_pthread
145             ;;
146         pth)
147             cflags_final=$cflags_pth
148             ;;
149     esac
150     cflags_final="$cflags_final @GPG_ERROR_CFLAGS@"
151
152     echo "$includes $cflags_final"
153 fi
154
155 if test "$echo_libs" = "yes"; then
156     libdirs=""
157     libs_final="$libs"
158
159     # Set up `libdirs'.
160     if test "@libdir@" != "/usr/lib" ; then
161         libdirs="-L@libdir@"
162         for i in $libs ; do
163             if test "$i" = "-L@libdir@" ; then
164                 libdirs=""
165             fi
166         done
167     fi
168
169     # Set up `libs_final'.
170     case "$thread_module" in
171         pthread)
172             libs_final=$libs_pthread
173             ;;
174         pth)
175             libs_final=$libs_pth
176             ;;
177     esac
178     libs_final="$libs_final @GPG_ERROR_LIBS@"
179
180     echo "$libdirs $libs_final"
181 fi
182
183 if test "$echo_version" = "yes"; then
184     echo "$version"
185 fi
186
187 if test "$echo_algorithms" = "yes"; then
188     echo "Symmetric cipher algorithms: $symmetric_ciphers"
189     echo "Public-key cipher algorithms: $asymmetric_ciphers"
190     echo "Message digest algorithms: $digests"
191 fi