Store Zebra libs in <prefix>/lib/idzebra<suffix> and modules in
[idzebra-moved-to-github.git] / idzebra-config.in
1 #!/bin/sh
2 # $Id: idzebra-config.in,v 1.10 2006-06-29 09:10:28 adam Exp $
3 version=@VERSION@
4 prefix=@prefix@
5 exec_prefix=@exec_prefix@
6 libdir=@libdir@
7 echo_cflags=no
8 echo_libs=no
9 echo_help=no
10 echo_tab=no
11 echo_source=yes
12 echo_lalibs=no
13 idzebra_src_root=@IDZEBRA_SRC_ROOT@
14 idzebra_build_root=@IDZEBRA_BUILD_ROOT@
15 package_suffix=@PACKAGE_SUFFIX@
16
17 extralibs="@YAZLIB@ @TCL_LIB@ @EXPAT_LIBS@ @XSLT_LIBS@ @LIBS@ "
18 extralalibs="@YAZLALIB@ @TCL_LIB@ @EXPAT_LIBS@ @XSLT_LIBS@ @LIBS@"
19
20 usage()
21 {
22     cat <<EOF
23 Usage: idzebra-config [OPTIONS] [LIBRARIES]
24 Options:
25         [--prefix[=DIR]]
26         [--version]
27         [--libs]
28         [--lalibs]
29         [--cflags]
30         [--tab]
31         [--modules]
32 EOF
33     exit $1
34 }
35
36 if test $# -eq 0; then
37     echo_help=yes
38 fi
39
40 modules=""
41 while test $# -gt 0; do
42     case "$1" in
43         -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
44         *) optarg= ;;
45     esac
46     
47     case $1 in
48         --prefix=*)
49             prefix=$optarg
50             exec_prefix=$prefix
51             libdir=${exec_prefix}/lib
52             ;;
53         --prefix)
54             echo $prefix
55             exit 0
56             ;;
57         --version)
58             echo $version
59             exit 0
60             ;;
61         --cflags)
62             echo_cflags=yes
63             ;;
64         --libs)
65             echo_libs=yes
66             ;;
67         --tab)
68             echo_tab=yes
69             ;;
70         --modules)
71             echo_modules=yes
72             ;;
73         --lalibs)
74             echo_lalibs=yes
75             ;;
76         -*)
77             echo_help=yes
78             ;;
79         *)
80             modules="$modules $1"
81             ;;
82     esac
83     shift
84 done
85
86 IDZEBRALIB=""
87 IDZEBRALALIB=""
88 IDZEBRAINC="@YAZINC@"
89
90 if test -z "$modules"; then
91     modules="api rset recctrl dict isams isamc isamb data1 bfile dfa util"
92 fi
93
94 for m in $modules; do
95     d=$m
96     if test "$m" = "api"; then
97         d="index"
98     fi
99     if test "$echo_source" = "yes"; then
100         IDZEBRALIB="$IDZEBRALIB -L${idzebra_build_root}/$d/.libs -lidzebra-$m"
101         IDZEBRALALIB="$IDZEBRALALIB ${idzebra_build_root}/$d/libidzebra-$m.la"
102     else
103         IDZEBRALIB="$IDZEBRALIB -lidzebra-$m"
104     fi
105 done
106
107 if test "$echo_source" = "yes"; then
108     IDZEBRALIB="$IDZEBRALIB $extralibs"
109     IDZEBRALALIB="$IDZEBRALALIB $extralalibs"
110     IDZEBRAINC="$IDZEBRAINC -I${idzebra_src_root}/include"
111     IDZEBRATAB="${idzebra_src_root}/tab"
112     IDZEBRAMOD="${idzebra_src_root}/recctrl"
113 else
114     IDZEBRALIB="-L${libdir}/idzebra${package_suffix} $IDZEBRALIB $extralibs"
115     IDZEBRALALIB="$IDZEBRALIB"
116     IDZEBRAINC="$IDZEBRAINC -I${prefix}/include/idzebra${package_suffix}"
117     IDZEBRATAB="@datarootdir@/idzebra${package_suffix}/tab"
118     IDZEBRAMOD="${libdir}/idzebra${package_suffix}/modules"
119 fi
120
121 if test "$echo_help" = "yes"; then
122     usage 1 1>&2
123 fi
124 if test "$echo_cflags" = "yes"; then
125     echo $IDZEBRAINC
126 fi
127 if test "$echo_libs" = "yes"; then
128     echo $IDZEBRALIB
129 fi
130 if test "$echo_lalibs" = "yes"; then
131     echo $IDZEBRALALIB
132 fi
133 if test "$echo_tab" = "yes"; then
134     echo $IDZEBRATAB
135 fi
136 if test "$echo_modules" = "yes"; then
137     echo $IDZEBRAMOD
138 fi
139 # Local Variables:
140 # mode:shell-script
141 # sh-indentation: 2
142 # sh-basic-offset: 4
143 # End: