Implement encoding of Z_FacetList into SOLR request
[yaz-moved-to-github.git] / yaz-config.in
1 #!/bin/sh
2 # This file is part of the YAZ toolkit.
3 # Copyright (C) 1995-2008 Index Data
4
5 yazprefix=@prefix@
6 yaz_echo_cflags=no
7 yaz_echo_libs=no
8 yaz_echo_help=no
9 yaz_echo_source=yes
10 yaz_echo_lalibs=no
11 yaz_echo_comp=no
12 yaz_src_root=@YAZ_SRC_ROOT@
13 yaz_build_root=@YAZ_BUILD_ROOT@
14 ICU_LIBS="@ICU_LIBS@"
15 ICU_CPPFLAGS="@ICU_CPPFLAGS@"
16 SSL_LIBS="@SSL_LIBS@"
17 LIBS="@LIBS@"
18 YAZVERSION=@VERSION@
19 VERSION_SHA1=@VERSION_SHA1@
20
21 usage()
22 {
23     cat <<EOF
24 Usage: yaz-config [OPTIONS] [LIBRARIES]
25 Options:
26         [--prefix[=DIR]]
27         [--version]
28         [--libs]
29         [--lalibs]
30         [--cflags]
31         [--comp]
32         [-V]
33 Libraries:
34         threads icu server static
35 EOF
36         exit $1
37 }
38
39 while test $# -gt 0; do
40     case "$1" in
41         -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
42         *) optarg= ;;
43     esac
44     
45     case $1 in
46         --prefix=*)
47             yazprefix=$optarg
48             ;;
49         --prefix)
50             echo $yazprefix
51             exit 0
52             ;;
53         -V)
54             echo "$YAZVERSION $VERSION_SHA1"
55             exit 0
56             ;;
57         --version)
58             echo $YAZVERSION
59             exit 0
60             ;;
61         --cflags)
62             yaz_echo_cflags=yes
63             ;;
64         --libs)
65             yaz_echo_libs=yes
66             ;;
67         --lalibs)
68             yaz_echo_lalibs=yes
69             ;;
70         --comp)
71             yaz_echo_comp=yes
72             ;;
73         threads)
74             lib_thread=yes
75             ;;
76         icu)
77             if test "$ICU_CPPFLAGS"; then
78                 lib_icu=yes
79             fi
80             ;;
81         ssl)
82             lib_ssl=yes
83             ;;
84         server)
85             lib_thread=yes
86             lib_server=yes
87             ;;
88         static)
89             lib_static=yes
90             ;;
91         -*)
92             yaz_echo_help=yes
93             ;;
94     esac
95     shift
96 done
97
98 YAZLIB="-lyaz"
99 if test "$lib_server" = "yes"; then
100     YAZLIB="-lyaz_server $YAZLIB"
101 fi
102
103 if test "$lib_icu" = "yes"; then
104     YAZLIB="-lyaz_icu $YAZLIB"
105 fi
106
107 if test "$lib_ssl" = "yes"; then
108     LIBS="${SSL_LIBS} $LIBS"
109 fi
110
111 YAZINC="@YAZ_CONFIG_CFLAGS@"
112
113 if test "$yaz_echo_source" = "yes"; then
114     YAZBIN=${yaz_build_root}/bin
115
116     if test "$lib_static" = "yes"; then
117         if test "$lib_ssl" != "yes"; then
118             LIBS="${SSL_LIBS} $LIBS"
119         fi
120         YAZLIB="${yaz_build_root}/src/.libs/libyaz.a"
121         if test "$lib_server" = "yes"; then
122             YAZLIB="${yaz_build_root}/src/.libs/libyaz_server.a $YAZLIB"
123         fi
124         if test "$lib_icu" = "yes"; then
125             YAZLIB="${yaz_build_root}/src/.libs/libyaz_icu.a $YAZLIB"
126         fi
127     else
128         YAZLIB="-L${yaz_build_root}/src/.libs $YAZLIB"
129     fi
130     YAZLIB="$YAZLIB $LIBS"
131
132     YAZLALIB="${yaz_build_root}/src/libyaz.la"
133     if test "$lib_server" = "yes"; then
134         YAZLALIB="${yaz_build_root}/src/libyaz_server.la $YAZLALIB"
135     fi
136     if test "$lib_icu" = "yes"; then
137         YAZLALIB="${yaz_build_root}/src/libyaz_icu.la $YAZLALIB"
138     fi
139     YAZLALIB="$YAZLALIB $LIBS"
140
141     YAZINC="-I${yaz_src_root}/include $YAZINC"
142     YAZCOMP=${yaz_src_root}/util/yaz-asncomp
143 else
144     YAZBIN=${yazprefix}/bin
145     YAZCOMP=${yazprefix}/bin/yaz-asncomp
146
147     if test "$yazprefix" != "/usr"; then
148         YAZLIB="-L$yazprefix/lib $YAZLIB"
149     fi
150     YAZLIB="$YAZLIB $LIBS"
151     YAZLALIB=$YAZLIB
152     if test "$yazprefix" != "/usr"; then
153         YAZINC="-I$yazprefix/include $YAZINC"
154     fi
155 fi
156
157 if test "$lib_thread" = "yes"; then
158     :
159 fi
160
161 if test "$lib_icu" = "yes"; then
162     YAZINC="$YAZINC $ICU_CPPFLAGS"
163     YAZLIB="$YAZLIB $ICU_LIBS"
164     YAZLALIB="$YAZLALIB $ICU_LIBS"
165 fi
166
167 if test "$yaz_echo_help" = "yes"; then
168     usage 1 1>&2
169 fi
170 if test "$yaz_echo_cflags" = "yes"; then
171     echo $YAZINC
172 fi
173 if test "$yaz_echo_libs" = "yes"; then
174     echo $YAZLIB
175 fi
176 if test "$yaz_echo_lalibs" = "yes"; then
177     echo $YAZLALIB
178 fi
179 if test "$yaz_echo_comp" = "yes"; then
180     echo $YAZCOMP
181 fi
182 # Local Variables:
183 # mode:shell-script
184 # sh-indentation: 2
185 # sh-basic-offset: 4
186 # End: