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.
15prefix="@prefix@"
16exec_prefix="@exec_prefix@"
17version="@PACKAGE_VERSION@"
18includedir="@includedir@"
19libdir="@libdir@"
20gpg_error_libs="@GPG_ERROR_LIBS@"
21gpg_error_cflags="@GPG_ERROR_CFLAGS@"
22
23# libgcrypt values.
24libs="@LIBGCRYPT_CONFIG_LIBS@"
25cflags="@LIBGCRYPT_CONFIG_CFLAGS@"
26
27# API info
28api_version="@LIBGCRYPT_CONFIG_API_VERSION@"
29
30# Configured for host
31my_host="@LIBGCRYPT_CONFIG_HOST@"
32
33# Misc information.
34symmetric_ciphers="@LIBGCRYPT_CIPHERS@"
35asymmetric_ciphers="@LIBGCRYPT_PUBKEY_CIPHERS@"
36digests="@LIBGCRYPT_DIGESTS@"
37
38# State variables.
39echo_libs=no
40echo_cflags=no
41echo_prefix=no
42echo_algorithms=no
43echo_exec_prefix=no
44echo_version=no
45echo_api_version=no
46echo_host=no
47
48# Prints usage information.
49usage()
50{
51    cat <<EOF
52Usage: $0 [OPTIONS]
53Options:
54	[--prefix]
55	[--exec-prefix]
56	[--version]
57        [--api-version]
58	[--libs]
59	[--cflags]
60	[--algorithms]
61        [--host]
62EOF
63    exit $1
64}
65
66if test $# -eq 0; then
67    # Nothing to do.
68    usage 1 1>&2
69fi
70
71while 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        --variable=*)
100            case "${1#*=}" in
101                prefix) echo "$prefix" ;;
102                exec_prefix) echo "$exec_prefix" ;;
103                host) echo "$my_host" ;;
104                api_version) echo "$api_version" ;;
105		symmetric_ciphers) echo "$symmetric_ciphers" ;;
106		asymmetric_ciphers) echo "$asymmetric_ciphers" ;;
107		digests) echo "$digests" ;;
108            esac
109            exit 0
110            ;;
111	--modversion|--version)
112	    echo_version=yes
113	    ;;
114        --api-version)
115            echo_api_version=yes
116            ;;
117	--cflags)
118	    echo_cflags=yes
119	    ;;
120	--libs)
121	    echo_libs=yes
122	    ;;
123	--algorithms)
124	    echo_algorithms=yes
125	    ;;
126        --host)
127            echo_host=yes
128            ;;
129	*)
130	    usage 1 1>&2
131	    ;;
132    esac
133    shift
134done
135
136if test "$echo_prefix" = "yes"; then
137    echo "$prefix"
138fi
139
140if test "$echo_exec_prefix" = "yes"; then
141    echo "$exec_prefix"
142fi
143
144if test "$echo_cflags" = "yes"; then
145    includes=""
146    cflags_final="$cflags"
147
148    # Set up `includes'.
149    if test "x$includedir" != "x/usr/include" -a "x$includedir" != "x/include"; then
150	includes="-I$includedir"
151    fi
152    # Set up `cflags_final'.
153    cflags_final="$cflags_final $gpg_error_cflags"
154
155    tmp=""
156    for i in $includes $cflags_final; do
157       if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
158           tmp="$tmp $i"
159       fi
160    done
161    echo $tmp
162fi
163
164if test "$echo_libs" = "yes"; then
165    libdirs=""
166    libs_final="$libs"
167
168    # Set up `libdirs'.
169    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/lib"; then
170	libdirs="-L$libdir"
171    fi
172
173    # Set up `libs_final'.
174    libs_final="$libs_final $gpg_error_libs"
175
176    tmp=""
177    for i in $libdirs $libs_final; do
178       if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
179           tmp="$tmp $i"
180       fi
181    done
182    echo $tmp
183fi
184
185if test "$echo_version" = "yes"; then
186    echo "$version"
187fi
188
189if test "$echo_api_version" = "yes"; then
190    echo "$api_version"
191fi
192
193if test "$echo_host" = "yes"; then
194    echo "$my_host"
195fi
196
197if test "$echo_algorithms" = "yes"; then
198    echo "Symmetric cipher algorithms: $symmetric_ciphers"
199    echo "Public-key cipher algorithms: $asymmetric_ciphers"
200    echo "Message digest algorithms: $digests"
201fi
202