dialog-config.in revision 251843
1#!@SHELL@
2# $Id: dialog-config.in,v 1.6 2012/10/06 14:29:45 tom Exp $
3##############################################################################
4# Copyright (c) 2007-2011,2012 Thomas E. Dickey                              #
5#                                                                            #
6# Permission is hereby granted, free of charge, to any person obtaining a    #
7# copy of this software and associated documentation files (the "Software"), #
8# to deal in the Software without restriction, including without limitation  #
9# the rights to use, copy, modify, merge, publish, distribute, distribute    #
10# with modifications, sublicense, and/or sell copies of the Software, and to #
11# permit persons to whom the Software is furnished to do so, subject to the  #
12# following conditions:                                                      #
13#                                                                            #
14# The above copyright notice and this permission notice shall be included in #
15# all copies or substantial portions of the Software.                        #
16#                                                                            #
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
20# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
22# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
23# DEALINGS IN THE SOFTWARE.                                                  #
24#                                                                            #
25# Except as contained in this notice, the name(s) of the above copyright     #
26# holders shall not be used in advertising or otherwise to promote the sale, #
27# use or other dealings in this Software without prior written               #
28# authorization.                                                             #
29##############################################################################
30
31prefix="@prefix@"
32exec_prefix="@exec_prefix@"
33datarootdir="@datarootdir@"
34
35bindir="@bindir@"
36libdir="@libdir@"
37datadir="@datadir@"
38mandir="@mandir@"
39
40THIS="@PACKAGE@"
41
42test $# = 0 && exec @SHELL@ $0 --error
43
44while test $# -gt 0; do
45	case "$1" in
46	-*=*)
47		ARG=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
48		;;
49	*)
50		ARG=
51		;;
52	esac
53
54	case "$1" in
55	# basic configuration
56	--prefix=*)
57		prefix="$ARG"
58		test -z "$exec_prefix" && exec_prefix="$ARG"
59		;;
60	--prefix)
61		echo "$prefix"
62		;;
63	--exec-prefix=*)
64		exec_prefix="$ARG"
65		;;
66	--exec-prefix)
67		echo "$exec_prefix"
68		;;
69	# compile/link
70	--cflags)
71		INCS=
72		if test "${prefix}/include" != /usr/include ; then
73			INCS="-I${prefix}/include"
74		fi
75		sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
76			$INCS
77ENDECHO
78		;;
79	--libs)
80		sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
81			-L${exec_prefix}/lib -l${THIS} @LIBS@
82ENDECHO
83		;;
84	# identification
85	--version)
86		echo "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"
87		;;
88	--abi-version)
89		echo "@VERSION@" | sed -e 's/:/./g'
90		;;
91	# locations
92	--bindir)
93		echo "${bindir}"
94		;;
95	--datadir)
96		echo "${datadir}"
97		;;
98	--libdir)
99		echo "${libdir}"
100		;;
101	--mandir)
102		echo "${mandir}"
103		;;
104	# general info
105	--help)
106		cat <<ENDHELP
107Usage: ${THIS}-config [options]
108
109Options:
110  --prefix           echos the package-prefix of ${THIS}
111  --prefix=ARG       sets the package-prefix of ${THIS}
112  --exec-prefix      echos the executable-prefix of ${THIS}
113  --exec-prefix=ARG  sets the executable-prefix of ${THIS}
114
115  --cflags           echos the C compiler flags needed to compile with ${THIS}
116  --libs             echos the libraries needed to link with ${THIS}
117
118  --version          echos the release+patchdate version of ${THIS}
119  --abi-version      echos the ABI version of ${THIS}
120
121  --bindir           echos the directory containing ${THIS} programs
122  --datadir          echos the directory containing ${THIS} data
123  --libdir           echos the directory containing ${THIS} libraries
124  --mandir           echos the directory containing ${THIS} manpages
125
126  --help             prints this message
127ENDHELP
128		;;
129	--error|*)
130		@SHELL@ $0 --help 1>&2
131		exit 1
132		;;
133	esac
134	shift
135done
136# vile:shmode
137