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
13prefix=@prefix@
14exec_prefix=@exec_prefix@
15includedir=@includedir@
16libdir=@libdir@
17isubdirafter="@GPG_ERROR_CONFIG_ISUBDIRAFTER@"
18
19output=""
20
21usage()
22{
23    cat <<EOF
24Usage: gpg-error-config [OPTIONS]
25Options:
26	[--prefix]
27	[--exec-prefix]
28	[--version]
29	[--libs]
30	[--cflags]
31EOF
32    exit $1
33}
34
35if test $# -eq 0; then
36    usage 1 1>&2
37fi
38
39while test $# -gt 0; do
40    case "$1" in
41	-*=*)
42	    optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
43	    ;;
44	*)
45	    optarg=
46	    ;;
47    esac
48
49    case $1 in
50        --prefix)
51	    output="$output $prefix"
52	    ;;
53        --exec-prefix)
54	    output="$output $exec_prefix"
55	    ;;
56        --version)
57            echo "@VERSION@"
58	    exit 0
59	    ;;
60        --cflags)
61	    if test "x$includedir" != "x/usr/include" -a "x$includedir" != "x/include"; then
62		output="$output -I$includedir"
63	    fi
64            # Note: -idirafter is a gcc extension.  It is only used on
65            #       systems where gcc is the only compiler we support.
66            for i in $isubdirafter; do
67                output="$output -idirafter ${includedir}/${i}"
68            done
69	    output="$output @GPG_ERROR_CONFIG_CFLAGS@"
70	    ;;
71	--libs)
72	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/lib"; then
73		output="$output -L$libdir"
74	    fi
75	    output="$output @GPG_ERROR_CONFIG_LIBS@"
76	    ;;
77	*)
78            usage 1 1>&2
79	    ;;
80    esac
81    shift
82done
83
84echo $output
85