--tabs option no longer available
[yaz-moved-to-github.git] / yaz-config.in
1 #!/bin/sh
2 # $Id: yaz-config.in,v 1.14 2002-12-09 23:29:00 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         malloc
30         ssl
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     --lalibs)
64       yaz_echo_lalibs=yes
65       ;;
66     --comp)
67       yaz_echo_comp=yes
68       ;;
69     threads)
70       lib_thread=yes
71       ;;
72     malloc)
73       lib_malloc=yes
74       ;;
75     ssl)
76       lib_ssl=yes
77       ;;
78     -*)
79       yaz_echo_help=yes
80       ;;
81   esac
82   shift
83 done
84
85 lyaz="-lyaz"
86
87 if test "$lib_thread" = "yes" -a -n "@CFLAGSTHREADS@"; then
88     yazextralibs="@LIBTHREAD@ $yazextralibs"
89     lyaz="-lyazthread $lyaz"
90 fi 
91
92 if test "$lib_malloc" = "yes"; then
93     lyaz="-lyazmalloc $lyaz"
94 fi
95
96 if test "$lib_ssl" = "yes" -a -n "@SSL_LIBS@"; then
97     yazextralibs="@SSL_LIBS@ $yazextralibs"
98     lyaz="-lyazssl $lyaz"
99 fi
100
101 if test "$yaz_echo_source" = "yes"; then
102     YAZBIN=${yaz_build_root}/bin
103     YAZLIB="-L${yaz_build_root}/lib/.libs $lyaz $yazextralibs"
104     YAZLALIB="${yaz_build_root}/lib/libyaz.la $yazextralibs"
105     if test "$lib_ssl" = "yes" -a -n "$SSL_LIBS@"; then
106         YAZLALIB="${yaz_build_root}/lib/libyazssl.la"
107     fi
108     if test "$lib_thread" = "yes" -a -n "@CFLAGSTHREADS@"; then
109         YAZLALIB="${yaz_build_root}/lib/libyazthread.la $YAZLALIB"
110     fi
111     if test "$lib_malloc" = "yes"; then
112         YAZLALIB="${yaz_build_root}/lib/libyazmalloc.la $YAZLALIB"
113     fi
114     YAZINC="-I${yaz_src_root}/include"
115     YAZCOMP=${yaz_src_root}/util/yaz-comp
116 else
117     YAZBIN=${yazprefix}/bin
118     YAZCOMP=${yazprefix}/bin/yaz-comp
119
120     if test "$yazprefix" = "/usr"; then
121         YAZLIB="$lyaz $yazextralibs"
122     else
123         YAZLIB="-L$yazprefix/lib $lyaz $yazextralibs"
124     fi
125     YAZLALIB=$YAZLIB
126     if test "$yazprefix" = "/usr"; then
127         YAZINC=
128     else
129         YAZINC=-I$yazprefix/include
130     fi
131 fi
132
133 YAZINC="$YAZINC @YAZ_CONF_CFLAGS@"
134
135 if test "$lib_thread" = "yes"; then
136     YAZINC="$YAZINC @CFLAGSTHREADS@"
137 fi
138
139 if test "$lib_ssl" = "yes"; then
140     YAZINC="$YAZINC @SSL_CFLAGS@"
141 fi
142
143 if test "$yaz_echo_help" = "yes"; then
144         usage 1 1>&2
145 fi
146 if test "$yaz_echo_cflags" = "yes"; then
147         echo $YAZINC
148 fi
149 if test "$yaz_echo_libs" = "yes"; then
150         echo $YAZLIB
151 fi
152 if test "$yaz_echo_lalibs" = "yes"; then
153         echo $YAZLALIB
154 fi
155 if test "$yaz_echo_comp" = "yes"; then
156         echo $YAZCOMP
157 fi