Directive s=pw sets structure to phrase if term includes blank(s).
[yaz-moved-to-github.git] / yaz-config.in
1 #!/bin/sh
2 # $Id: yaz-config.in,v 1.6 2001-03-20 15:58:24 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_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         [--tabs]
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     --tabs)
62       yaz_echo_tabs=yes
63       ;;
64     --lalibs)
65       yaz_echo_lalibs=yes
66       ;;
67     threads)
68       lib_thread=yes
69       ;;
70     -*)
71       yaz_echo_help=yes
72       ;;
73   esac
74   shift
75 done
76
77 if test "$lib_thread" = "yes"; then
78     yazextralibs="@LIBTHREAD@ $yazextralibs"
79     lyaz="-lyazthread -lyaz"
80 else
81     lyaz="-lyaz"
82 fi 
83 if test "$yaz_echo_source" = "yes"; then
84     YAZTAB=${yaz_src_root}/tab
85     YAZBIN=${yaz_build_root}/bin
86     YAZLIB="-L${yaz_build_root}/lib/.libs $lyaz $yazextralibs"
87     if test "$lib_thread" = "yes"; then
88         YAZLALIB="${yaz_build_root}/lib/libyazthread.la ${yaz_build_root}/lib/libyaz.la $yazextralibs"
89     else
90         YAZLALIB="${yaz_build_root}/lib/libyaz.la $yazextralibs"
91     fi
92     YAZINC="-I${yaz_src_root}/include"
93 else
94     YAZTAB=$yazprefix/share/yaz/tab
95     YAZBIN=$yazprefix/bin
96
97     if test "$yazprefix" = "/usr"; then
98         YAZLIB="$lyaz $yazextralibs"
99     else
100         YAZLIB="-L$yazprefix/lib $lyaz $yazextralibs"
101     fi
102     YAZLALIB=$YAZLIB
103     if test "$yazprefix" = "/usr"; then
104         YAZINC=
105     else
106         YAZINC=-I$yazprefix/include
107     fi
108 fi
109
110 if test "$lib_thread" = "yes"; then
111     YAZINC="$YAZINC -D_REENTRANT"
112 fi
113
114 if test "$yaz_echo_help" = "yes"; then
115         usage 1 1>&2
116 fi
117 if test "$yaz_echo_cflags" = "yes"; then
118         echo $YAZINC
119 fi
120 if test "$yaz_echo_libs" = "yes"; then
121         echo $YAZLIB
122 fi
123 if test "$yaz_echo_tabs" = "yes"; then
124         echo $YAZTAB
125 fi
126 if test "$yaz_echo_lalibs" = "yes"; then
127         echo $YAZLALIB
128 fi