Removed --source option from yaz-config.
[yaz-moved-to-github.git] / yaz-config.in
1 #!/bin/sh
2 # $Id: yaz-config.in,v 1.3 2000-10-11 12:24:58 adam Exp $
3 yazprefix=@prefix@
4 yaz_echo_cflags=no
5 yaz_echo_libs=no
6 yaz_echo_help=no
7 yaz_echo_tabs=no
8 yaz_echo_source=yes
9 yaz_echo_lalibs=no
10 yaz_src_root=@YAZ_SRC_ROOT@
11
12 yazlibs="@LIBS@"
13 YAZVERSION=@VERSION@
14
15 usage()
16 {
17         cat <<EOF
18 Usage: yaz-config [OPTIONS] [LIBRARIES]
19 Options:
20         [--prefix[=DIR]]
21         [--version]
22         [--libs]
23         [--lalibs]
24         [--cflags]
25         [--tabs]
26 EOF
27         exit $1
28 }
29
30 #if test $# -eq 0; then
31 #       yaz_echo_help=yes
32 #fi
33
34 while test $# -gt 0; do
35   case "$1" in
36   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
37   *) optarg= ;;
38   esac
39
40   case $1 in
41     --prefix=*)
42       yazprefix=$optarg
43       ;;
44     --prefix)
45       echo $yazprefix
46       exit 0
47       ;;
48     --version)
49       echo $YAZVERSION
50       exit 0
51       ;;
52     --cflags)
53       yaz_echo_cflags=yes
54       ;;
55     --libs)
56       yaz_echo_libs=yes
57       ;;
58     --tabs)
59       yaz_echo_tabs=yes
60       ;;
61     --lalibs)
62       yaz_echo_lalibs=yes
63       ;;
64     -*)
65       yaz_echo_help=yes
66       ;;
67   esac
68   shift
69 done
70
71 if test "$yaz_echo_source" = "yes"; then
72     YAZTAB=${yaz_src_root}/tab
73     YAZBIN=${yaz_src_root}/bin
74     YAZLIB="-L${yaz_src_root}/lib/.libs -lyaz $yazlibs"
75     YAZLALIB="${yaz_src_root}/lib/libyaz.la $yazlibs"
76     YAZINC="-I${yaz_src_root}/include"
77 else
78     YAZTAB=$yazprefix/share/yaz/tab
79     YAZBIN=$yazprefix/bin
80
81     if test "$yazprefix" = "/usr"; then
82         YAZLIB="-lyaz $yazlibs"
83     else
84         YAZLIB="-L$yazprefix/lib -lyaz $yazlibs"
85     fi
86     YAZLALIB=$YAZLIB
87     if test "$yazprefix" = "/usr"; then
88         YAZINC=
89     else
90         YAZINC=-I$yazprefix/include
91     fi
92 fi
93
94 if test "$yaz_echo_help" = "yes"; then
95         usage 1 1>&2
96 fi
97 if test "$yaz_echo_cflags" = "yes"; then
98         echo $YAZINC
99 fi
100 if test "$yaz_echo_libs" = "yes"; then
101         echo $YAZLIB
102 fi
103 if test "$yaz_echo_tabs" = "yes"; then
104         echo $YAZTAB
105 fi
106 if test "$yaz_echo_lalibs" = "yes"; then
107         echo $YAZLALIB
108 fi