Added log level flag LOG_MALLOC, moved malloc entries there.
[yaz-moved-to-github.git] / yaz-config.in
1 #!/bin/sh
2 # $Id: yaz-config.in,v 1.12 2002-03-18 12:22:00 adam Exp $
3 yazprefix=@prefix@
4 yaz_echo_cflags=no
5 yaz_echo_libs=no
6 yaz_echo_help=no
7 yaz_echo_tabs=no
8 yaz_echo_source=yes
9 yaz_echo_lalibs=no
10 yaz_echo_comp=no
11 yaz_src_root=@YAZ_SRC_ROOT@
12 yaz_build_root=@YAZ_BUILD_ROOT@
13
14 yazextralibs="@LIBS@"
15 YAZVERSION=@VERSION@
16
17 usage()
18 {
19         cat <<EOF
20 Usage: yaz-config [OPTIONS] [LIBRARIES]
21 Options:
22         [--prefix[=DIR]]
23         [--version]
24         [--libs]
25         [--lalibs]
26         [--cflags]
27         [--tabs]
28         [--comp]
29 Libraries:
30         threads
31         malloc
32         ssl
33 EOF
34         exit $1
35 }
36
37 #if test $# -eq 0; then
38 #       yaz_echo_help=yes
39 #fi
40
41 while test $# -gt 0; do
42   case "$1" in
43   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
44   *) optarg= ;;
45   esac
46
47   case $1 in
48     --prefix=*)
49       yazprefix=$optarg
50       ;;
51     --prefix)
52       echo $yazprefix
53       exit 0
54       ;;
55     --version)
56       echo $YAZVERSION
57       exit 0
58       ;;
59     --cflags)
60       yaz_echo_cflags=yes
61       ;;
62     --libs)
63       yaz_echo_libs=yes
64       ;;
65     --tabs)
66       yaz_echo_tabs=yes
67       ;;
68     --lalibs)
69       yaz_echo_lalibs=yes
70       ;;
71     --comp)
72       yaz_echo_comp=yes
73       ;;
74     threads)
75       lib_thread=yes
76       ;;
77     malloc)
78       lib_malloc=yes
79       ;;
80     ssl)
81       lib_ssl=yes
82       ;;
83     -*)
84       yaz_echo_help=yes
85       ;;
86   esac
87   shift
88 done
89
90 lyaz="-lyaz"
91
92 if test "$lib_thread" = "yes" -a -n "@CFLAGSTHREADS@"; then
93     yazextralibs="@LIBTHREAD@ $yazextralibs"
94     lyaz="-lyazthread $lyaz"
95 fi 
96
97 if test "$lib_malloc" = "yes"; then
98     lyaz="-lyazmalloc $lyaz"
99 fi
100
101 if test "$lib_ssl" = "yes" -a -n "@SSL_LIBS@"; then
102     yazextralibs="@SSL_LIBS@ $yazextralibs"
103     lyaz="-lyazssl $lyaz"
104 fi
105
106 if test "$yaz_echo_source" = "yes"; then
107     YAZTAB=${yaz_src_root}/tab
108     YAZBIN=${yaz_build_root}/bin
109     YAZLIB="-L${yaz_build_root}/lib/.libs $lyaz $yazextralibs"
110     YAZLALIB="${yaz_build_root}/lib/libyaz.la $yazextralibs"
111     if test "$lib_ssl" = "yes" -a -n "$SSL_LIBS@"; then
112         YAZLALIB="${yaz_build_root}/lib/libyazssl.la"
113     fi
114     if test "$lib_thread" = "yes" -a -n "@CFLAGSTHREADS@"; then
115         YAZLALIB="${yaz_build_root}/lib/libyazthread.la $YAZLALIB"
116     fi
117     if test "$lib_malloc" = "yes"; then
118         YAZLALIB="${yaz_build_root}/lib/libyazmalloc.la $YAZLALIB"
119     fi
120     YAZINC="-I${yaz_src_root}/include"
121     YAZCOMP=${yaz_src_root}/util/yaz-comp
122 else
123     YAZTAB=${yazprefix}/share/yaz/tab
124     YAZBIN=${yazprefix}/bin
125     YAZCOMP=${yazprefix}/bin/yaz-comp
126
127     if test "$yazprefix" = "/usr"; then
128         YAZLIB="$lyaz $yazextralibs"
129     else
130         YAZLIB="-L$yazprefix/lib $lyaz $yazextralibs"
131     fi
132     YAZLALIB=$YAZLIB
133     if test "$yazprefix" = "/usr"; then
134         YAZINC=
135     else
136         YAZINC=-I$yazprefix/include
137     fi
138 fi
139
140 if test "$lib_thread" = "yes"; then
141     YAZINC="$YAZINC @CFLAGSTHREADS@"
142 fi
143
144 if test "$lib_ssl" = "yes"; then
145     YAZINC="$YAZINC @SSL_CFLAGS@"
146 fi
147
148 if test "$yaz_echo_help" = "yes"; then
149         usage 1 1>&2
150 fi
151 if test "$yaz_echo_cflags" = "yes"; then
152         echo $YAZINC
153 fi
154 if test "$yaz_echo_libs" = "yes"; then
155         echo $YAZLIB
156 fi
157 if test "$yaz_echo_tabs" = "yes"; then
158         echo $YAZTAB
159 fi
160 if test "$yaz_echo_lalibs" = "yes"; then
161         echo $YAZLALIB
162 fi
163 if test "$yaz_echo_comp" = "yes"; then
164         echo $YAZCOMP
165 fi