libyaz.la (whole source) is compiled with threads
[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
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         server)
82             lib_thread=yes
83             lib_server=yes
84             ;;
85         static)
86             lib_static=yes
87             ;;
88         -*)
89             yaz_echo_help=yes
90             ;;
91     esac
92     shift
93 done
94
95 lyaz="-lyaz"
96 if test "$lib_server" = "yes"; then
97     lyaz="-lyaz_server $lyaz"
98 fi
99
100 if test "$lib_icu" = "yes"; then
101     lyaz="-lyaz_icu $lyaz"
102 fi
103
104 YAZINC="@YAZ_CONFIG_CFLAGS@"
105
106 if test "$yaz_echo_source" = "yes"; then
107     YAZBIN=${yaz_build_root}/bin
108
109     if test "$lib_static" = "yes"; then
110         YAZLIB="${yaz_build_root}/src/.libs/libyaz.a"
111         if test "$lib_server" = "yes"; then
112             YAZLIB="${yaz_build_root}/src/.libs/libyaz_server.a $YAZLIB"
113         fi
114         if test "$lib_icu" = "yes"; then
115             YAZLIB="${yaz_build_root}/src/.libs/libyaz_icu.a $YAZLIB"
116         fi
117     else
118         YAZLIB="-L${yaz_build_root}/src/.libs $lyaz"
119     fi
120     YAZLIB="$YAZLIB ${SSL_LIBS} $LIBS"
121
122     YAZLALIB="${yaz_build_root}/src/libyaz.la"
123     if test "$lib_server" = "yes"; then
124         YAZLALIB="${yaz_build_root}/src/libyaz_server.la $YAZLALIB"
125     fi
126     if test "$lib_icu" = "yes"; then
127         YAZLALIB="${yaz_build_root}/src/libyaz_icu.la $YAZLALIB"
128     fi
129     YAZLALIB="$YAZLALIB $LIBS"
130
131     YAZINC="-I${yaz_src_root}/include $YAZINC"
132     YAZCOMP=${yaz_src_root}/util/yaz-asncomp
133 else
134     YAZBIN=${yazprefix}/bin
135     YAZCOMP=${yazprefix}/bin/yaz-asncomp
136
137     if test "$yazprefix" != "/usr"; then
138         YAZLIB="-L$yazprefix/lib"
139     fi
140     YAZLIB="$YAZLIB $lyaz ${SSL_LIBS} $LIBS"
141     YAZLALIB=$YAZLIB
142     if test "$yazprefix" != "/usr"; then
143         YAZINC="-I$yazprefix/include $YAZINC"
144     fi
145 fi
146
147 if test "$lib_thread" = "yes"; then
148     :
149 fi
150
151 if test "$lib_icu" = "yes"; then
152     YAZINC="$YAZINC $ICU_CPPFLAGS"
153     YAZLIB="$YAZLIB $ICU_LIBS"
154     YAZLALIB="$YAZLALIB $ICU_LIBS"
155 fi
156
157 if test "$yaz_echo_help" = "yes"; then
158     usage 1 1>&2
159 fi
160 if test "$yaz_echo_cflags" = "yes"; then
161     echo $YAZINC
162 fi
163 if test "$yaz_echo_libs" = "yes"; then
164     echo $YAZLIB
165 fi
166 if test "$yaz_echo_lalibs" = "yes"; then
167     echo $YAZLALIB
168 fi
169 if test "$yaz_echo_comp" = "yes"; then
170     echo $YAZCOMP
171 fi
172 # Local Variables:
173 # mode:shell-script
174 # sh-indentation: 2
175 # sh-basic-offset: 4
176 # End: