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