isc-config.sh.in revision 234010
1#!/bin/sh
2#
3# Copyright (C) 2004, 2007  Internet Systems Consortium, Inc. ("ISC")
4# Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
5#
6# Permission to use, copy, modify, and/or distribute this software for any
7# purpose with or without fee is hereby granted, provided that the above
8# copyright notice and this permission notice appear in all copies.
9#
10# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16# PERFORMANCE OF THIS SOFTWARE.
17
18# $Id: isc-config.sh.in,v 1.17 2007/06/19 23:46:59 tbox Exp $
19
20prefix=@prefix@
21exec_prefix=@exec_prefix@
22exec_prefix_set=
23
24usage()
25{
26	cat << EOF
27Usage: isc-config [OPTIONS] [LIBRARIES]
28Options:
29	[--prefix[=DIR]]
30	[--exec-prefix[=DIR]]
31	[--version]
32	[--libs]
33	[--cflags]
34Libraries:
35	isc
36	isccc
37	isccfg
38	dns
39	lwres
40	bind9
41EOF
42	exit $1
43}
44
45if test $# -eq 0; then
46	usage 1 1>&2
47fi
48
49while test $# -gt 0; do
50	case "$1" in
51	-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
52	*) optarg= ;;
53	esac
54
55	case "$1" in
56	--prefix=*)
57		prefix=$optarg
58		if test "x$exec_prefix_set" = x ; then
59			exec_prefix=$prefix
60		fi
61		;;
62	--prefix)
63		echo_prefix=true
64		;;
65	--exec-prefix=*)
66		exec_prefix=$optarg
67		;;
68	--exec-prefix)
69		echo_exec_prefix=true
70		;;
71	--version)
72		echo @BIND9_VERSION@
73		exit 0
74		;;
75	--cflags)
76		echo_cflags=true
77		;;
78	--libs)
79		echo_libs=true;
80		;;
81	isc)
82		libisc=true;
83		;;
84	isccc)
85		libisccc=true;
86		libisc=true;
87		;;
88	isccfg)
89		libisccfg=true;
90		libisc=true;
91		;;
92	dns)
93		libdns=true;
94		libisc=true;
95		;;
96	lwres)
97		liblwres=true;
98		;;
99	bind9)
100		libdns=true;
101		libisc=true;
102		libisccfg=true;
103		libbind9=true;
104		;;
105	*)
106		usage 1 1>&2
107	esac
108	shift
109done
110
111if test x"$echo_prefix" = x"true" ; then
112	echo $prefix
113fi
114if test x"$echo_exec_prefix" = x"true" ; then
115	echo $exec_prefix
116fi
117if test x"$echo_cflags" = x"true"; then
118	includes="-I${exec_prefix}/include"
119	if test x"$libisc" = x"true"; then
120		includes="$includes @ALWAYS_DEFINES@ @STD_CINCLUDES@ @STD_CDEFINES@ @CCOPT@"
121	fi
122	echo $includes
123fi
124if test x"$echo_libs" = x"true"; then
125	libs=-L${exec_prefix}/lib
126	if test x"$liblwres" = x"true" ; then
127		libs="$libs -llwres"
128	fi
129	if test x"$libbind9" = x"true" ; then
130		libs="$libs -lbind9"
131	fi
132	if test x"$libdns" = x"true" ; then
133		libs="$libs -ldns @DNS_CRYPTO_LIBS@"
134	fi
135	if test x"$libisccfg" = x"true" ; then
136		libs="$libs -lisccfg"
137	fi
138	if test x"$libisccc" = x"true" ; then
139		libs="$libs -lisccc"
140	fi
141	if test x"$libisc" = x"true" ; then
142		libs="$libs -lisc"
143		needothers=true
144	fi
145	if test x"$needothers" = x"true" ; then
146		libs="$libs @CCOPT@ @LIBS@"
147	fi
148	echo $libs
149fi
150