Reformat. Add Emacs local variables
[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     case $1 in
42         --prefix=*)
43         prefix=$optarg
44         ;;
45         --prefix)
46             echo $prefix
47             exit 0
48             ;;
49         --version)
50             echo $VERSION
51             exit 0
52             ;;
53         --cflags)
54             echo_cflags=yes
55             ;;
56         --libs)
57             echo_libs=yes
58             ;;
59         --tabs)
60             echo_tabs=yes
61             ;;
62         --lalibs)
63             echo_lalibs=yes
64             ;;
65         -*)
66             echo_help=yes
67             ;;
68     esac
69     shift
70 done
71
72 libs_short="-lyazpp -lzoompp"
73
74 YAZPPINC="@YAZINC@"
75
76 if test "$echo_source" = "yes"; then
77     YAZPPLIB="-L${build_root}/src/.libs -lyazpp"
78     YAZPPLIB="$YAZPPLIB -L${build_root}/zoom/.libs -lzoompp"
79     YAZPPLIB="$YAZPPLIB $yazlibs"
80     YAZPPLALIB="${build_root}/src/libyazpp.la $yazlalibs"
81     YAZPPINC="-I${src_root}/include $YAZPPINC"
82 else
83     if test "$prefix" = "/usr"; then
84         YAZPPLIB="${libs_short} $yazlibs"
85     else
86         YAZPPLIB="-L${libdir} ${libs_short} $yazlibs"
87     fi
88     YAZPPLALIB=$YAZPPLIB
89     if test "$prefix" != "/usr"; then
90         YAZPPINC="-I${includedir} $YAZPPINC"
91     fi
92 fi
93
94 if test "$echo_help" = "yes"; then
95     usage 1 1>&2
96 fi
97 if test "$echo_cflags" = "yes"; then
98     echo $YAZPPINC
99 fi
100 if test "$echo_libs" = "yes"; then
101     echo $YAZPPLIB
102 fi
103 if test "$echo_lalibs" = "yes"; then
104     echo $YAZPPLALIB
105 fi
106 # Local Variables:
107 # mode:shell-script
108 # sh-indentation: 2
109 # sh-basic-offset: 4
110 # End: