Fixed bug in tcpip_set_blocking.
[yaz-moved-to-github.git] / yaz-config.in
1 #!/bin/sh
2 # $Id: yaz-config.in,v 1.7 2001-04-05 13:08:48 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 EOF
32         exit $1
33 }
34
35 #if test $# -eq 0; then
36 #       yaz_echo_help=yes
37 #fi
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     --version)
54       echo $YAZVERSION
55       exit 0
56       ;;
57     --cflags)
58       yaz_echo_cflags=yes
59       ;;
60     --libs)
61       yaz_echo_libs=yes
62       ;;
63     --tabs)
64       yaz_echo_tabs=yes
65       ;;
66     --lalibs)
67       yaz_echo_lalibs=yes
68       ;;
69     --comp)
70       yaz_echo_comp=yes
71       ;;
72     threads)
73       lib_thread=yes
74       ;;
75     -*)
76       yaz_echo_help=yes
77       ;;
78   esac
79   shift
80 done
81
82 if test "$lib_thread" = "yes"; then
83     yazextralibs="@LIBTHREAD@ $yazextralibs"
84     lyaz="-lyazthread -lyaz"
85 else
86     lyaz="-lyaz"
87 fi 
88 if test "$yaz_echo_source" = "yes"; then
89     YAZTAB=${yaz_src_root}/tab
90     YAZBIN=${yaz_build_root}/bin
91     YAZLIB="-L${yaz_build_root}/lib/.libs $lyaz $yazextralibs"
92     if test "$lib_thread" = "yes"; then
93         YAZLALIB="${yaz_build_root}/lib/libyazthread.la ${yaz_build_root}/lib/libyaz.la $yazextralibs"
94     else
95         YAZLALIB="${yaz_build_root}/lib/libyaz.la $yazextralibs"
96     fi
97     YAZINC="-I${yaz_src_root}/include"
98     YAZCOMP=${yaz_src_root}/util/yaz-comp
99 else
100     YAZTAB=${yazprefix}/share/yaz/tab
101     YAZBIN=${yazprefix}/bin
102     YAZCOMP=${yazprefix}/bin/yaz-comp
103
104     if test "$yazprefix" = "/usr"; then
105         YAZLIB="$lyaz $yazextralibs"
106     else
107         YAZLIB="-L$yazprefix/lib $lyaz $yazextralibs"
108     fi
109     YAZLALIB=$YAZLIB
110     if test "$yazprefix" = "/usr"; then
111         YAZINC=
112     else
113         YAZINC=-I$yazprefix/include
114     fi
115 fi
116
117 if test "$lib_thread" = "yes"; then
118     YAZINC="$YAZINC -D_REENTRANT"
119 fi
120
121 if test "$yaz_echo_help" = "yes"; then
122         usage 1 1>&2
123 fi
124 if test "$yaz_echo_cflags" = "yes"; then
125         echo $YAZINC
126 fi
127 if test "$yaz_echo_libs" = "yes"; then
128         echo $YAZLIB
129 fi
130 if test "$yaz_echo_tabs" = "yes"; then
131         echo $YAZTAB
132 fi
133 if test "$yaz_echo_lalibs" = "yes"; then
134         echo $YAZLALIB
135 fi
136 if test "$yaz_echo_comp" = "yes"; then
137         echo $YAZCOMP
138 fi