Reintroduced the bit "defines for those log bits that are deprecated and
[yaz-moved-to-github.git] / yaz-config.in
1 #!/bin/sh
2 # $Id: yaz-config.in,v 1.22 2004-10-27 08:18:55 adam Exp $
3 yazprefix=@prefix@
4 yaz_echo_cflags=no
5 yaz_echo_libs=no
6 yaz_echo_help=no
7 yaz_echo_source=yes
8 yaz_echo_lalibs=no
9 yaz_echo_comp=no
10 yaz_src_root=@YAZ_SRC_ROOT@
11 yaz_build_root=@YAZ_BUILD_ROOT@
12
13 yazextralibs="@LIBS@"
14 YAZVERSION=@VERSION@
15
16 usage()
17 {
18         cat <<EOF
19 Usage: yaz-config [OPTIONS] [LIBRARIES]
20 Options:
21         [--prefix[=DIR]]
22         [--version]
23         [--libs]
24         [--lalibs]
25         [--cflags]
26         [--comp]
27 Libraries:
28         threads
29 EOF
30         exit $1
31 }
32
33 #if test $# -eq 0; then
34 #       yaz_echo_help=yes
35 #fi
36
37 while test $# -gt 0; do
38   case "$1" in
39   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
40   *) optarg= ;;
41   esac
42
43   case $1 in
44     --prefix=*)
45       yazprefix=$optarg
46       ;;
47     --prefix)
48       echo $yazprefix
49       exit 0
50       ;;
51     --version)
52       echo $YAZVERSION
53       exit 0
54       ;;
55     --cflags)
56       yaz_echo_cflags=yes
57       ;;
58     --libs)
59       yaz_echo_libs=yes
60       ;;
61     --lalibs)
62       yaz_echo_lalibs=yes
63       ;;
64     --comp)
65       yaz_echo_comp=yes
66       ;;
67     threads)
68       lib_thread=yes
69       ;;
70     malloc)
71       lib_malloc=yes
72       ;;
73     -*)
74       yaz_echo_help=yes
75       ;;
76   esac
77   shift
78 done
79
80 lyaz="-lyaz"
81
82 if test "$lib_thread" = "yes" -a -n "@CFLAGSTHREADS@"; then
83     yazextralibs="@LIBTHREAD@ $yazextralibs"
84     lyaz="-lyazthread $lyaz"
85 fi 
86
87 if test "$yaz_echo_source" = "yes"; then
88     YAZBIN=${yaz_build_root}/bin
89     YAZLIB="-L${yaz_build_root}/src/.libs $lyaz $yazextralibs"
90     YAZLALIB="${yaz_build_root}/src/libyaz.la $yazextralibs"
91     if test "$lib_thread" = "yes" -a -n "@CFLAGSTHREADS@"; then
92         YAZLALIB="${yaz_build_root}/src/libyazthread.la $YAZLALIB"
93     fi
94     YAZINC="-I${yaz_src_root}/include"
95     YAZCOMP=${yaz_src_root}/util/yaz-asncomp
96 else
97     YAZBIN=${yazprefix}/bin
98     YAZCOMP=${yazprefix}/bin/yaz-asncomp
99
100     if test "$yazprefix" = "/usr"; then
101         YAZLIB="$lyaz $yazextralibs"
102     else
103         YAZLIB="-L$yazprefix/lib $lyaz $yazextralibs"
104     fi
105     YAZLALIB=$YAZLIB
106     if test "$yazprefix" = "/usr"; then
107         YAZINC=
108     else
109         YAZINC=-I$yazprefix/include
110     fi
111 fi
112
113 YAZINC="$YAZINC @YAZ_CONF_CFLAGS@"
114
115 if test "$lib_thread" = "yes"; then
116     YAZINC="$YAZINC @CFLAGSTHREADS@"
117 fi
118
119 if test "$yaz_echo_help" = "yes"; then
120         usage 1 1>&2
121 fi
122 if test "$yaz_echo_cflags" = "yes"; then
123         echo $YAZINC
124 fi
125 if test "$yaz_echo_libs" = "yes"; then
126         echo $YAZLIB
127 fi
128 if test "$yaz_echo_lalibs" = "yes"; then
129         echo $YAZLALIB
130 fi
131 if test "$yaz_echo_comp" = "yes"; then
132         echo $YAZCOMP
133 fi