ZOOM C refactor. Make helper ZOOM_send_GDU
[yaz-moved-to-github.git] / yaz-config.in
1 #!/bin/sh
2 # This file is part of the YAZ toolkit.
3 # Copyright (C) 1995-2012 Index Data
4
5 prefix=@prefix@
6 exec_prefix=@exec_prefix@
7 libdir=@libdir@
8 includedir=@includedir@
9 echo_cflags=no
10 echo_libs=no
11 echo_help=no
12 echo_include=no
13 echo_source=yes
14 echo_lalibs=no
15 echo_comp=no
16 src_root=@abs_top_srcdir@
17 build_root=@abs_top_builddir@
18 ICU_LIBS="@ICU_LIBS@"
19 ICU_CPPFLAGS="@ICU_CPPFLAGS@"
20 SSL_LIBS="@SSL_LIBS@"
21 LIBS="@LIBS@"
22 VERSION=@VERSION@
23 YAZVERSION=$VERSION
24 VERSION_SHA1=@VERSION_SHA1@
25
26 usage()
27 {
28     cat <<EOF
29 Usage: yaz-config [OPTIONS] [LIBRARIES]
30 Options:
31         [--prefix[=DIR]]
32         [--version]
33         [--libs]
34         [--lalibs]
35         [--cflags]
36         [--include]
37         [--comp]
38         [-V]
39 Libraries:
40         threads icu server static
41 EOF
42         exit $1
43 }
44
45 while test $# -gt 0; do
46     case "$1" in
47         -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
48         *) optarg= ;;
49     esac
50     
51     case $1 in
52         --prefix=*)
53             prefix=$optarg
54             ;;
55         --prefix)
56             echo $prefix
57             exit 0
58             ;;
59         -V)
60             echo "$VERSION $VERSION_SHA1"
61             exit 0
62             ;;
63         --version)
64             echo $VERSION
65             exit 0
66             ;;
67         --cflags)
68             echo_cflags=yes
69             ;;
70         --include)
71             echo_include=yes
72             ;;
73         --libs)
74             echo_libs=yes
75             ;;
76         --lalibs)
77             echo_lalibs=yes
78             ;;
79         --comp)
80             echo_comp=yes
81             ;;
82         threads)
83             lib_thread=yes
84             ;;
85         icu)
86             if test "$ICU_CPPFLAGS"; then
87                 lib_icu=yes
88             fi
89             ;;
90         ssl)
91             lib_ssl=yes
92             ;;
93         server)
94             lib_thread=yes
95             lib_server=yes
96             ;;
97         static)
98             lib_static=yes
99             ;;
100         -*)
101             echo_help=yes
102             ;;
103     esac
104     shift
105 done
106
107 YAZLIB="-lyaz"
108 if test "$lib_server" = "yes"; then
109     YAZLIB="-lyaz_server $YAZLIB"
110 fi
111
112 if test "$lib_icu" = "yes"; then
113     YAZLIB="-lyaz_icu $YAZLIB"
114 fi
115
116 if test "$lib_ssl" = "yes"; then
117     LIBS="${SSL_LIBS} $LIBS"
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         if test "$lib_ssl" != "yes"; then
127             LIBS="${SSL_LIBS} $LIBS"
128         fi
129         YAZLIB="${build_root}/src/.libs/libyaz.a"
130         if test "$lib_server" = "yes"; then
131             YAZLIB="${build_root}/src/.libs/libyaz_server.a $YAZLIB"
132         fi
133         if test "$lib_icu" = "yes"; then
134             YAZLIB="${build_root}/src/.libs/libyaz_icu.a $YAZLIB"
135         fi
136     else
137         YAZLIB="-L${build_root}/src/.libs $YAZLIB"
138     fi
139     YAZLIB="$YAZLIB $LIBS"
140
141     YAZLALIB="${build_root}/src/libyaz.la"
142     if test "$lib_server" = "yes"; then
143         YAZLALIB="${build_root}/src/libyaz_server.la $YAZLALIB"
144     fi
145     if test "$lib_icu" = "yes"; then
146         YAZLALIB="${build_root}/src/libyaz_icu.la $YAZLALIB"
147     fi
148     YAZLALIB="$YAZLALIB $LIBS"
149
150     YAZBINC="-I${src_root}/include"
151     YAZINC="$YAZBINC $YAZINC"
152     YAZCOMP=${src_root}/util/yaz-asncomp
153 else
154     YAZBIN=${prefix}/bin
155     YAZCOMP=${prefix}/bin/yaz-asncomp
156
157     if test "$prefix" != "/usr"; then
158         YAZLIB="-L$libdir $YAZLIB"
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: