isc-config.sh.in revision 267654
1#!/bin/sh
2#
3# Copyright (C) 2004, 2007, 2012, 2013  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=
23includedir=@includedir@
24libdir=@libdir@
25
26usage()
27{
28	cat << EOF
29Usage: isc-config [OPTIONS] [LIBRARIES]
30Options:
31	[--prefix[=DIR]]
32	[--exec-prefix[=DIR]]
33	[--version]
34	[--libs]
35	[--cflags]
36Libraries:
37	isc
38	isccc
39	isccfg
40	dns
41	lwres
42	bind9
43EOF
44	exit $1
45}
46
47if test $# -eq 0; then
48	usage 1 1>&2
49fi
50
51while test $# -gt 0; do
52	case "$1" in
53	-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
54	*) optarg= ;;
55	esac
56
57	case "$1" in
58	--prefix=*)
59		prefix=$optarg
60		if test "x$exec_prefix_set" = x ; then
61			exec_prefix=$prefix
62			exec_prefix_set=true
63		fi
64		;;
65	--prefix)
66		echo_prefix=true
67		;;
68	--exec-prefix=*)
69		exec_prefix=$optarg
70		exec_prefix_set=true
71		;;
72	--exec-prefix)
73		echo_exec_prefix=true
74		;;
75	--version)
76		echo @BIND9_VERSION@
77		exit 0
78		;;
79	--cflags)
80		echo_cflags=true
81		;;
82	--libs)
83		echo_libs=true;
84		;;
85	isc)
86		libisc=true;
87		;;
88	isccc)
89		libisccc=true;
90		libisc=true;
91		;;
92	isccfg)
93		libisccfg=true;
94		libisc=true;
95		;;
96	dns)
97		libdns=true;
98		libisc=true;
99		;;
100	lwres)
101		liblwres=true;
102		;;
103	bind9)
104		libdns=true;
105		libisc=true;
106		libisccfg=true;
107		libbind9=true;
108		;;
109	*)
110		usage 1 1>&2
111	esac
112	shift
113done
114
115if test x"$echo_prefix" = x"true" ; then
116	echo $prefix
117fi
118if test x"$echo_exec_prefix" = x"true" ; then
119	echo $exec_prefix
120fi
121if test x"$echo_cflags" = x"true"; then
122	if test x"${exec_prefix_set}" = x"true"; then
123		includes="-I${exec_prefix}/include"
124	else
125		includes="-I${includedir}"
126	fi
127	if test x"$libisc" = x"true"; then
128		includes="$includes @ALWAYS_DEFINES@ @STD_CINCLUDES@ @STD_CDEFINES@ @CCOPT@"
129	fi
130	echo $includes
131fi
132if test x"$echo_libs" = x"true"; then
133	if test x"${exec_prefix_set}" = x"true"; then
134		includes="-L${exec_prefix}/lib"
135	else
136		libs="-L${libdir}"
137	fi
138	if test x"$liblwres" = x"true" ; then
139		libs="$libs -llwres"
140	fi
141	if test x"$libbind9" = x"true" ; then
142		libs="$libs -lbind9"
143	fi
144	if test x"$libdns" = x"true" ; then
145		libs="$libs -ldns @DNS_CRYPTO_LIBS@"
146	fi
147	if test x"$libisccfg" = x"true" ; then
148		libs="$libs -lisccfg"
149	fi
150	if test x"$libisccc" = x"true" ; then
151		libs="$libs -lisccc"
152	fi
153	if test x"$libisc" = x"true" ; then
154		libs="$libs -lisc"
155		needothers=true
156	fi
157	if test x"$needothers" = x"true" ; then
158		libs="$libs @CCOPT@ @LIBS@"
159	fi
160	echo $libs
161fi
162