isc-config.sh.in revision 245163
1127563Sdes#!/bin/sh
2127208Sdes#
3139824Simp# Copyright (C) 2004, 2007, 2012  Internet Systems Consortium, Inc. ("ISC")
4139824Simp# Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
5139824Simp#
698679Sdes# Permission to use, copy, modify, and/or distribute this software for any
798679Sdes# purpose with or without fee is hereby granted, provided that the above
898679Sdes# copyright notice and this permission notice appear in all copies.
998679Sdes#
1098679Sdes# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
1198679Sdes# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1298679Sdes# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
1398679Sdes# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1498679Sdes# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
1598679Sdes# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1698679Sdes# PERFORMANCE OF THIS SOFTWARE.
1798679Sdes
1898679Sdes# $Id: isc-config.sh.in,v 1.17 2007/06/19 23:46:59 tbox Exp $
1998679Sdes
2098679Sdesprefix=@prefix@
2198679Sdesexec_prefix=@exec_prefix@
2298679Sdesexec_prefix_set=
2398679Sdes
2498679Sdesusage()
2598679Sdes{
2698679Sdes	cat << EOF
2798679SdesUsage: isc-config [OPTIONS] [LIBRARIES]
2898679SdesOptions:
2998679Sdes	[--prefix[=DIR]]
3098679Sdes	[--exec-prefix[=DIR]]
3198679Sdes	[--version]
3298679Sdes	[--libs]
33154548Sjasone	[--cflags]
34154548SjasoneLibraries:
3598679Sdes	isc
3698679Sdes	isccc
3798679Sdes	isccfg
3898679Sdes	dns
3998679Sdes	lwres
4098679Sdes	bind9
4198679SdesEOF
4298679Sdes	exit $1
4398679Sdes}
4498679Sdes
4598679Sdesif test $# -eq 0; then
4698679Sdes	usage 1 1>&2
4798679Sdesfi
4898679Sdes
4998679Sdeswhile test $# -gt 0; do
5098679Sdes	case "$1" in
5198679Sdes	-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
5298679Sdes	*) optarg= ;;
5398679Sdes	esac
5498679Sdes
5598679Sdes	case "$1" in
5698679Sdes	--prefix=*)
5798679Sdes		prefix=$optarg
5898679Sdes		if test "x$exec_prefix_set" = x ; then
5998679Sdes			exec_prefix=$prefix
6098679Sdes		fi
6198679Sdes		;;
6298679Sdes	--prefix)
6398679Sdes		echo_prefix=true
6498679Sdes		;;
6598679Sdes	--exec-prefix=*)
6698679Sdes		exec_prefix=$optarg
6798679Sdes		;;
6898679Sdes	--exec-prefix)
6998679Sdes		echo_exec_prefix=true
7098679Sdes		;;
7198679Sdes	--version)
72127403Sdes		echo @BIND9_VERSION@
7398679Sdes		exit 0
7498679Sdes		;;
7598679Sdes	--cflags)
7698679Sdes		echo_cflags=true
7798679Sdes		;;
7898679Sdes	--libs)
7998679Sdes		echo_libs=true;
8098679Sdes		;;
8198679Sdes	isc)
8298679Sdes		libisc=true;
8398679Sdes		;;
8498679Sdes	isccc)
8598679Sdes		libisccc=true;
8698679Sdes		libisc=true;
8798679Sdes		;;
8898679Sdes	isccfg)
8998679Sdes		libisccfg=true;
90127403Sdes		libisc=true;
9198679Sdes		;;
9298679Sdes	dns)
9398679Sdes		libdns=true;
9498679Sdes		libisc=true;
9598679Sdes		;;
96127403Sdes	lwres)
9798679Sdes		liblwres=true;
9898679Sdes		;;
9998679Sdes	bind9)
10098679Sdes		libdns=true;
10198679Sdes		libisc=true;
102127403Sdes		libisccfg=true;
10398679Sdes		libbind9=true;
10498679Sdes		;;
10598679Sdes	*)
10698679Sdes		usage 1 1>&2
10798679Sdes	esac
108127403Sdes	shift
10998679Sdesdone
11098679Sdes
11198679Sdesif test x"$echo_prefix" = x"true" ; then
11298679Sdes	echo $prefix
11398679Sdesfi
11498679Sdesif test x"$echo_exec_prefix" = x"true" ; then
115127403Sdes	echo $exec_prefix
11698679Sdesfi
11798679Sdesif test x"$echo_cflags" = x"true"; then
11898679Sdes	includes="-I${exec_prefix}/include"
11998679Sdes	if test x"$libisc" = x"true"; then
12098679Sdes		includes="$includes @ALWAYS_DEFINES@ @STD_CINCLUDES@ @STD_CDEFINES@ @CCOPT@"
12198679Sdes	fi
12298679Sdes	echo $includes
12398679Sdesfi
12498679Sdesif test x"$echo_libs" = x"true"; then
12598679Sdes	libs=-L${exec_prefix}/lib
12698679Sdes	if test x"$liblwres" = x"true" ; then
12798679Sdes		libs="$libs -llwres"
12898679Sdes	fi
12998679Sdes	if test x"$libbind9" = x"true" ; then
13098679Sdes		libs="$libs -lbind9"
13198679Sdes	fi
13298679Sdes	if test x"$libdns" = x"true" ; then
13398679Sdes		libs="$libs -ldns @DNS_CRYPTO_LIBS@"
13498679Sdes	fi
13598679Sdes	if test x"$libisccfg" = x"true" ; then
13698679Sdes		libs="$libs -lisccfg"
13798679Sdes	fi
13898679Sdes	if test x"$libisccc" = x"true" ; then
13998679Sdes		libs="$libs -lisccc"
14098679Sdes	fi
14198679Sdes	if test x"$libisc" = x"true" ; then
14298679Sdes		libs="$libs -lisc"
14398679Sdes		needothers=true
14498679Sdes	fi
14598679Sdes	if test x"$needothers" = x"true" ; then
14698679Sdes		libs="$libs @CCOPT@ @LIBS@"
14798679Sdes	fi
14898679Sdes	echo $libs
14998679Sdesfi
15098679Sdes