yazpp-config: Use exec_prefix, libdir, includedir
[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 src_root=@abs_top_srcdir@
13 build_root=@abs_top_builddir@
14 yazlibs="@YAZLIB@ @LIBS@"
15 yazlalibs="@YAZLALIB@ @LIBS@"
16 VERSION=@VERSION@
17
18 usage()
19 {
20         cat <<EOF
21 Usage: yazpp-config [OPTIONS] [LIBRARIES]
22 Options:
23         [--prefix[=DIR]]
24         [--version]
25         [--libs]
26         [--lalibs]
27         [--cflags]
28 EOF
29         exit $1
30 }
31
32 if test $# -eq 0; then
33         echo_help=yes
34 fi
35
36 while test $# -gt 0; do
37   case "$1" in
38   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
39   *) optarg= ;;
40   esac
41
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     -*)
67       echo_help=yes
68       ;;
69   esac
70   shift
71 done
72
73 libs_short="-lyazpp -lzoompp"
74
75 YAZPPINC="@YAZINC@"
76
77 if test "$echo_source" = "yes"; then
78     YAZPPLIB="-L${build_root}/src/.libs -lyazpp"
79     YAZPPLIB="$YAZPPLIB -L${build_root}/zoom/.libs -lzoompp"
80     YAZPPLIB="$YAZPPLIB $yazlibs"
81     YAZPPLALIB="${build_root}/src/libyazpp.la $yazlalibs"
82     YAZPPINC="-I${src_root}/include $YAZPPINC"
83 else
84
85     if test "$prefix" = "/usr"; then
86         YAZPPLIB="${libs_short} $yazlibs"
87     else
88         YAZPPLIB="-L${libdir} ${libs_short} $yazlibs"
89     fi
90     YAZPPLALIB=$YAZPPLIB
91     if test "$prefix" != "/usr"; then
92         YAZPPINC="-I${includedir} $YAZPPINC"
93     fi
94 fi
95
96 if test "$echo_help" = "yes"; then
97         usage 1 1>&2
98 fi
99 if test "$echo_cflags" = "yes"; then
100         echo $YAZPPINC
101 fi
102 if test "$echo_libs" = "yes"; then
103         echo $YAZPPLIB
104 fi
105 if test "$echo_lalibs" = "yes"; then
106         echo $YAZPPLALIB
107 fi