1#! /bin/sh
2#
3# $Id$
4#
5# Copyright 2011-2014, Juniper Networks, Inc.
6# All rights reserved.
7# This SOFTWARE is licensed under the LICENSE provided in the
8# ../Copyright file. By downloading, installing, copying, or otherwise
9# using the SOFTWARE, you agree to be bound by the terms of that
10# LICENSE.
11
12prefix=@prefix@
13exec_prefix=@exec_prefix@
14includedir=@includedir@
15libdir=@libdir@
16
17usage()
18{
19    cat <<EOF
20Usage: libxo-config [OPTION]
21
22Known values for OPTION are:
23
24  --prefix=DIR		change libxo prefix [default $prefix]
25  --exec-prefix=DIR	change libxo exec prefix [default $exec_prefix]
26  --libs		print library linking information
27  --bindir              print the bin directory
28  --cflags		print pre-processor and compiler flags
29  --share		print share directory
30  --help		display this help and exit
31  --version		output version information
32EOF
33
34    exit $1
35}
36
37if test $# -eq 0; then
38    usage 1
39fi
40
41cflags=false
42libs=false
43
44while test $# -gt 0; do
45    case "$1" in
46    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
47    *) optarg= ;;
48    esac
49
50    case "$1" in
51    --prefix=*)
52	prefix=$optarg
53	includedir=$prefix/include
54	libdir=$prefix/lib
55	;;
56
57    --prefix)
58	echo $prefix
59	;;
60
61    --exec-prefix=*)
62      exec_prefix=$optarg
63      libdir=$exec_prefix/lib
64      ;;
65
66    --exec-prefix)
67      echo $exec_prefix
68      ;;
69
70    --version)
71	echo @VERSION@
72	exit 0
73	;;
74
75    --help)
76	usage 0
77	;;
78
79    --cflags)
80       	echo -I@XO_INCLUDEDIR@ @XO_CFLAGS@
81       	;;
82
83
84    --share)
85       	echo @XO_SHAREDIR@
86       	;;
87
88    --bindir)
89       	echo @XO_BINDIR@
90       	;;
91
92    --libdir)
93       	echo @XO_LIBDIR@
94       	;;
95
96
97    --libs)
98        if [ "`uname`" = "Linux" ]
99	then
100	    if [ "@XO_LIBDIR@" = "-L/usr/lib" -o "@XO_LIBDIR@" = "-L/usr/lib64" ]
101	    then
102		echo @XO_LIBS@ 
103	    else
104		echo -L@XO_LIBDIR@ @XO_LIBS@ 
105	    fi
106	else
107	    echo -L@XO_LIBDIR@ @XO_LIBS@
108	fi
109       	;;
110
111    *)
112	usage
113	exit 1
114	;;
115    esac
116    shift
117done
118
119exit 0
120