yazpp-config daels with zoom for in-source
[yazpp-moved-to-github.git] / yazpp-config.in
1 #!/bin/sh
2 prefix=@prefix@
3 exec_prefix=@exec_prefix@
4 libdir=@libdir@
5 includedir=@includedir@
6 echo_cflags=no
7 echo_libs=no
8 echo_help=no
9 echo_tabs=no
10 echo_source=yes
11 echo_lalibs=no
12 echo_zoom=no
13 src_root=@abs_top_srcdir@
14 build_root=@abs_top_builddir@
15 yazlibs="@YAZLIB@ @LIBS@"
16 yazlalibs="@YAZLALIB@ @LIBS@"
17 VERSION=@VERSION@
18
19 usage()
20 {
21         cat <<EOF
22 Usage: yazpp-config [OPTIONS] [LIBRARIES]
23 Options:
24         [--prefix[=DIR]]
25         [--version]
26         [--libs]
27         [--lalibs]
28         [--cflags]
29 EOF
30         exit $1
31 }
32
33 if test $# -eq 0; then
34     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     case $1 in
43         --prefix=*)
44         prefix=$optarg
45         ;;
46         --prefix)
47             echo $prefix
48             exit 0
49             ;;
50         --version)
51             echo $VERSION
52             exit 0
53             ;;
54         --cflags)
55             echo_cflags=yes
56             ;;
57         --libs)
58             echo_libs=yes
59             ;;
60         --tabs)
61             echo_tabs=yes
62             ;;
63         --lalibs)
64             echo_lalibs=yes
65             ;;
66         zoom)
67             echo_zoom=yes
68             ;;
69         -*)
70             echo_help=yes
71             ;;
72     esac
73     shift
74 done
75
76 YAZPPINC="@YAZINC@"
77 YAZPPLALIB="$yazlalibs"
78 YAZPPLIB="$yazlibs"
79
80 if test "$echo_source" = "yes"; then
81     if test "$echo_zoom" = "yes"; then
82         YAZPPLIB="-L${build_root}/zoom/.libs -lzoomzpp $YAZPPLIB"
83         YAZPPLALIB="${build_root}/zoom/libzoompp.la $YAZPPLALIB"
84     else
85         YAZPPLIB="-L${build_root}/src/.libs -lyazpp $YAZPPLIB"
86         YAZPPLALIB="${build_root}/src/libyazpp.la $YAZPPLALIB"
87     fi
88     YAZPPINC="$YAZPPINC -I${src_root}/include"
89 else
90     if test "$echo_zoom" = "yes"; then
91         libs_short="-lzoompp"
92     else
93         libs_short="-lyazpp"
94     fi
95     if test "$prefix" = "/usr"; then
96         YAZPPLIB="${libs_short} $YAZPPLIB"
97     else
98         YAZPPLIB="-L${libdir} ${libs_short} $YAZPPLIB"
99     fi
100     YAZPPLALIB=$YAZPPLIB
101     if test "$prefix" != "/usr"; then
102         YAZPPINC="$YAZPPINC -I${includedir}"
103     fi
104 fi
105
106 if test "$echo_help" = "yes"; then
107     usage 1 1>&2
108 fi
109 if test "$echo_cflags" = "yes"; then
110     echo $YAZPPINC
111 fi
112 if test "$echo_libs" = "yes"; then
113     echo $YAZPPLIB
114 fi
115 if test "$echo_lalibs" = "yes"; then
116     echo $YAZPPLALIB
117 fi
118 # Local Variables:
119 # mode:shell-script
120 # sh-indentation: 2
121 # sh-basic-offset: 4
122 # End: