1#!/bin/sh
2#    Copyright (C) 1999 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
12version="0.11.13"
13
14prefix="/usr"
15exec_prefix="/usr"
16exec_prefix_set=no
17
18libdir=""
19includedir="@abs_top_srcdir@"
20opensc_cflags=""
21opensc_libs=""
22
23usage()
24{
25	cat <<EOF
26Usage: opensc-config [OPTIONS]
27Options:
28	[--prefix[=DIR]]
29	[--exec-prefix[=DIR]]
30	[--version]
31	[--libs]
32	[--cflags]
33EOF
34	exit $1
35}
36
37if test $# -eq 0; then
38	usage 1 1>&2
39fi
40
41while test $# -gt 0; do
42  case "$1" in
43  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
44  *) optarg= ;;
45  esac
46
47  case $1 in
48    --prefix=*)
49      prefix=$optarg
50      if test $exec_prefix_set = no ; then
51	exec_prefix=$optarg
52      fi
53      ;;
54    --prefix)
55      echo_prefix=yes
56      ;;
57    --exec-prefix=*)
58      exec_prefix=$optarg
59      exec_prefix_set=yes
60      ;;
61    --exec-prefix)
62      echo_exec_prefix=yes
63      ;;
64    --version)
65      echo "${version}"
66      exit 0
67      ;;
68    --cflags)
69      echo_cflags=yes
70      ;;
71    --libs)
72      echo_libs=yes
73      ;;
74    *)
75      usage 1 1>&2
76      ;;
77  esac
78  shift
79done
80
81if test "$echo_prefix" = "yes"; then
82    echo $prefix
83fi
84
85if test "$echo_exec_prefix" = "yes"; then
86    echo $exec_prefix
87fi
88
89if test "$echo_cflags" = "yes"; then
90    if test "${includedir}" != "/usr/include" ; then
91      includes="-I${includedir}"
92      for i in ${opensc_cflags} ; do
93	if test "$i" = "-I${includedir}" ; then
94	  includes=""
95	fi
96      done
97    fi
98    echo $includes $opensc_cflags
99fi
100
101if test "$echo_libs" = "yes"; then
102    echo ${opensc_libs}
103fi
104