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