yaz-config: don't list SSL/GNUTLS libs by default
[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         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 lyaz="-lyaz"
99 if test "$lib_server" = "yes"; then
100     lyaz="-lyaz_server $lyaz"
101 fi
102
103 if test "$lib_icu" = "yes"; then
104     lyaz="-lyaz_icu $lyaz"
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         YAZLIB="${yaz_build_root}/src/.libs/libyaz.a"
118         if test "$lib_server" = "yes"; then
119             YAZLIB="${yaz_build_root}/src/.libs/libyaz_server.a $YAZLIB"
120         fi
121         if test "$lib_icu" = "yes"; then
122             YAZLIB="${yaz_build_root}/src/.libs/libyaz_icu.a $YAZLIB"
123         fi
124     else
125         YAZLIB="-L${yaz_build_root}/src/.libs $lyaz"
126     fi
127     YAZLIB="$YAZLIB $LIBS"
128
129     YAZLALIB="${yaz_build_root}/src/libyaz.la"
130     if test "$lib_server" = "yes"; then
131         YAZLALIB="${yaz_build_root}/src/libyaz_server.la $YAZLALIB"
132     fi
133     if test "$lib_icu" = "yes"; then
134         YAZLALIB="${yaz_build_root}/src/libyaz_icu.la $YAZLALIB"
135     fi
136     YAZLALIB="$YAZLALIB $LIBS"
137
138     YAZINC="-I${yaz_src_root}/include $YAZINC"
139     YAZCOMP=${yaz_src_root}/util/yaz-asncomp
140 else
141     YAZBIN=${yazprefix}/bin
142     YAZCOMP=${yazprefix}/bin/yaz-asncomp
143
144     if test "$yazprefix" != "/usr"; then
145         YAZLIB="-L$yazprefix/lib"
146     fi
147     YAZLIB="$YAZLIB $lyaz $LIBS"
148     YAZLALIB=$YAZLIB
149     if test "$yazprefix" != "/usr"; then
150         YAZINC="-I$yazprefix/include $YAZINC"
151     fi
152 fi
153
154 if test "$lib_thread" = "yes"; then
155     :
156 fi
157
158 if test "$lib_icu" = "yes"; then
159     YAZINC="$YAZINC $ICU_CPPFLAGS"
160     YAZLIB="$YAZLIB $ICU_LIBS"
161     YAZLALIB="$YAZLALIB $ICU_LIBS"
162 fi
163
164 if test "$yaz_echo_help" = "yes"; then
165     usage 1 1>&2
166 fi
167 if test "$yaz_echo_cflags" = "yes"; then
168     echo $YAZINC
169 fi
170 if test "$yaz_echo_libs" = "yes"; then
171     echo $YAZLIB
172 fi
173 if test "$yaz_echo_lalibs" = "yes"; then
174     echo $YAZLALIB
175 fi
176 if test "$yaz_echo_comp" = "yes"; then
177     echo $YAZCOMP
178 fi
179 # Local Variables:
180 # mode:shell-script
181 # sh-indentation: 2
182 # sh-basic-offset: 4
183 # End: