Version 1.1.3 (Debian)
[yazpp-moved-to-github.git] / yazpp-config.in
1 #!/bin/sh
2 yazppprefix=@prefix@
3 yaz_echo_cflags=no
4 yaz_echo_libs=no
5 yaz_echo_help=no
6 yaz_echo_tabs=no
7 yaz_echo_source=yes
8 yaz_echo_lalibs=no
9 yazpp_src_root=@YAZPP_SRC_ROOT@
10 yazpp_build_root=@YAZPP_BUILD_ROOT@
11
12 yazlibs="@YAZLIB@ @LIBS@"
13 yazlalibs="@YAZLALIB@ @LIBS@"
14 YAZPPVERSION=@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 EOF
27         exit $1
28 }
29
30 if test $# -eq 0; then
31         yaz_echo_help=yes
32 fi
33
34 while test $# -gt 0; do
35   case "$1" in
36   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
37   *) optarg= ;;
38   esac
39
40   case $1 in
41     --prefix=*)
42       yazppprefix=$optarg
43       ;;
44     --prefix)
45       echo $yazppprefix
46       exit 0
47       ;;
48     --version)
49       echo $YAZPPVERSION
50       exit 0
51       ;;
52     --cflags)
53       yaz_echo_cflags=yes
54       ;;
55     --libs)
56       yaz_echo_libs=yes
57       ;;
58     --tabs)
59       yaz_echo_tabs=yes
60       ;;
61     --lalibs)
62       yaz_echo_lalibs=yes
63       ;;
64     -*)
65       yaz_echo_help=yes
66       ;;
67   esac
68   shift
69 done
70
71 libs_short="-lyazpp -lzoompp"
72
73 YAZPPINC="@YAZINC@"
74
75 if test "$yaz_echo_source" = "yes"; then
76     YAZPPLIB="-L${yazpp_build_root}/src/.libs -lyazpp"
77     YAZPPLIB="$YAZPPLIB -L${yazpp_build_root}/zoom/.libs -lzoompp"
78     YAZPPLIB="$YAZPPLIB $yazlibs"
79     YAZPPLALIB="${yazpp_build_root}/src/libyazpp.la $yazlalibs"
80     YAZPPINC="-I${yazpp_src_root}/include $YAZPPINC"
81 else
82
83     if test "$yazppprefix" = "/usr"; then
84         YAZPPLIB="${libs_short} $yazlibs"
85     else
86         YAZPPLIB="-L${yazppprefix}/lib ${libs_short} $yazlibs"
87     fi
88     YAZPPLALIB=$YAZPPLIB
89     if test "$yazppprefix" != "/usr"; then
90         YAZPPINC="-I${yazppprefix}/include $YAZPPINC"
91     fi
92 fi
93
94 if test "$yaz_echo_help" = "yes"; then
95         usage 1 1>&2
96 fi
97 if test "$yaz_echo_cflags" = "yes"; then
98         echo $YAZPPINC
99 fi
100 if test "$yaz_echo_libs" = "yes"; then
101         echo $YAZPPLIB
102 fi
103 if test "$yaz_echo_lalibs" = "yes"; then
104         echo $YAZPPLALIB
105 fi