Skip multiple of ($, in MARC-8 ESC sequence
[yaz-moved-to-github.git] / yaz-config.in
1 #!/bin/sh
2 # $Id: yaz-config.in,v 1.19 2004-01-05 09:45:49 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_ssl" = "yes" -a -n "@SSL_LIBS@"; then
93     yazextralibs="@SSL_LIBS@ $yazextralibs"
94     lyaz="-lyazssl $lyaz"
95 fi
96
97 if test "$yaz_echo_source" = "yes"; then
98     YAZBIN=${yaz_build_root}/bin
99     YAZLIB="-L${yaz_build_root}/src/.libs $lyaz $yazextralibs"
100     YAZLALIB="${yaz_build_root}/src/libyaz.la $yazextralibs"
101     if test "$lib_ssl" = "yes" -a -n "$SSL_LIBS@"; then
102         YAZLALIB="${yaz_build_root}/src/libyazssl.la"
103     fi
104     if test "$lib_thread" = "yes" -a -n "@CFLAGSTHREADS@"; then
105         YAZLALIB="${yaz_build_root}/src/libyazthread.la $YAZLALIB"
106     fi
107     YAZINC="-I${yaz_src_root}/include"
108     YAZCOMP=${yaz_src_root}/util/yaz-comp
109 else
110     YAZBIN=${yazprefix}/bin
111     YAZCOMP=${yazprefix}/bin/yaz-comp
112
113     if test "$yazprefix" = "/usr"; then
114         YAZLIB="$lyaz $yazextralibs"
115     else
116         YAZLIB="-L$yazprefix/lib $lyaz $yazextralibs"
117     fi
118     YAZLALIB=$YAZLIB
119     if test "$yazprefix" = "/usr"; then
120         YAZINC=
121     else
122         YAZINC=-I$yazprefix/include
123     fi
124 fi
125
126 YAZINC="$YAZINC @YAZ_CONF_CFLAGS@"
127
128 if test "$lib_thread" = "yes"; then
129     YAZINC="$YAZINC @CFLAGSTHREADS@"
130 fi
131
132 if test "$lib_ssl" = "yes"; then
133     YAZINC="$YAZINC @SSL_CFLAGS@"
134 fi
135
136 if test "$yaz_echo_help" = "yes"; then
137         usage 1 1>&2
138 fi
139 if test "$yaz_echo_cflags" = "yes"; then
140         echo $YAZINC
141 fi
142 if test "$yaz_echo_libs" = "yes"; then
143         echo $YAZLIB
144 fi
145 if test "$yaz_echo_lalibs" = "yes"; then
146         echo $YAZLALIB
147 fi
148 if test "$yaz_echo_comp" = "yes"; then
149         echo $YAZCOMP
150 fi