]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/apr-util/apu-config.in
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / apr-util / apu-config.in
1 #!/bin/sh
2 # Licensed to the Apache Software Foundation (ASF) under one or more
3 # contributor license agreements.  See the NOTICE file distributed with
4 # this work for additional information regarding copyright ownership.
5 # The ASF licenses this file to You under the Apache License, Version 2.0
6 # (the "License"); you may not use this file except in compliance with
7 # the License.  You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17
18 # APR-util script designed to allow easy command line access to APR-util
19 # configuration parameters.
20
21 APRUTIL_MAJOR_VERSION="@APRUTIL_MAJOR_VERSION@"
22 APRUTIL_DOTTED_VERSION="@APRUTIL_DOTTED_VERSION@"
23
24 prefix="@prefix@"
25 exec_prefix="@exec_prefix@"
26 bindir="@bindir@"
27 libdir="@libdir@"
28 includedir="@includedir@"
29
30 LIBS="@APRUTIL_EXPORT_LIBS@"
31 INCLUDES="@APRUTIL_INCLUDES@"
32 LDFLAGS="@APRUTIL_LDFLAGS@"
33 LDAP_LIBS="@LDADD_ldap@"
34 DBM_LIBS="@LDADD_dbm_db@ @LDADD_dbm_gdbm@ @LDADD_dbm_ndbm@"
35
36 APRUTIL_LIBNAME="@APRUTIL_LIBNAME@"
37
38 APU_SOURCE_DIR="@abs_srcdir@"
39 APU_BUILD_DIR="@abs_builddir@"
40 APR_XML_EXPAT_OLD="@APR_XML_EXPAT_OLD@"
41 APU_DB_VERSION="@apu_db_version@"
42
43 # NOTE: the following line is modified during 'make install': alter with care!
44 location=@APU_CONFIG_LOCATION@
45
46 show_usage()
47 {
48     cat << EOF
49 Usage: apu-$APRUTIL_MAJOR_VERSION-config [OPTION]
50
51 Known values for OPTION are:
52   --prefix[=DIR]    change prefix to DIR
53   --bindir          print location where binaries are installed
54   --includes        print include information
55   --includedir      print location where headers are installed
56   --ldflags         print linker flags
57   --libs            print library information
58   --avoid-ldap      do not include ldap library information with --libs
59   --ldap-libs       print library information to link with ldap
60   --avoid-dbm       do not include DBM library information with --libs
61   --dbm-libs        print additional library information to link with DBM
62   --srcdir          print APR-util source directory
63   --link-ld         print link switch(es) for linking to APR-util
64   --link-libtool    print the libtool inputs for linking to APR-util
65   --apu-la-file     print the path to the .la file, if available
66   --old-expat       indicate if APR-util was built against an old expat
67   --db-version      print the DB version
68   --version         print APR-util's version as a dotted triple
69   --help            print this help
70
71 When linking with libtool, an application should do something like:
72   APU_LIBS="\`apu-$APRUTIL_MAJOR_VERSION-config --link-libtool --libs\`"
73 or when linking directly:
74   APU_LIBS="\`apu-$APRUTIL_MAJOR_VERSION-config --link-ld --libs\`"
75
76 An application should use the results of --includes, and --ldflags in
77 their build process.
78 EOF
79 }
80
81 if test $# -eq 0; then
82     show_usage
83     exit 1
84 fi
85
86 if test "$location" = "installed"; then
87     LA_FILE="$libdir/lib${APRUTIL_LIBNAME}.la"
88
89     LIBS=`echo "$LIBS" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g" -e "s $prefix/libexpat.la -lexpat g"`
90     LDFLAGS=`echo "$LDFLAGS" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g"`
91     INCLUDES=`echo "$INCLUDES" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g" -e "s -I$prefix/lib  g"`
92 else
93     LA_FILE="$APU_BUILD_DIR/lib${APRUTIL_LIBNAME}.la"
94 fi
95
96 flags=""
97
98 while test $# -gt 0; do
99     # Normalize the prefix.
100     case "$1" in
101     -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
102     *) optarg= ;;
103     esac
104
105     case "$1" in
106     # It is possible for the user to override our prefix.
107     --prefix=*)
108     prefix=$optarg
109     ;;
110     --prefix)
111     echo $prefix
112     exit 0
113     ;;
114     --bindir)
115     echo $bindir
116     exit 0
117     ;;
118     --avoid-ldap)
119     LDAP_LIBS=""
120     ;;
121     --avoid-dbm)
122     DBM_LIBS=""
123     ;;
124     --libs)
125     flags="$flags $LDAP_LIBS $DBM_LIBS $LIBS"
126     ;;
127     --ldap-libs)
128     flags="$flags $LDAP_LIBS"
129     ;;
130     --dbm-libs)
131     flags="$flags $DBM_LIBS"
132     ;;
133     --includedir)
134     if test "$location" = "installed"; then
135         flags="$includedir"
136     elif test "$location" = "source"; then
137         flags="$APU_SOURCE_DIR/include"
138     else
139         # this is for VPATH builds
140         flags="$APU_BUILD_DIR/include $APU_SOURCE_DIR/include"
141     fi
142     echo $flags
143     exit 0
144     ;;
145     --includes)
146     if test "$location" = "installed"; then
147         flags="$flags -I$includedir $INCLUDES"
148     elif test "$location" = "source"; then
149         flags="$flags -I$APU_SOURCE_DIR/include $INCLUDES"
150     else
151         # this is for VPATH builds
152         flags="$flags -I$APU_BUILD_DIR/include -I$APU_SOURCE_DIR/include $INCLUDES"
153     fi
154     ;;
155     --ldflags)
156     flags="$flags $LDFLAGS"
157     ;;
158     --srcdir)
159     echo $APU_SOURCE_DIR
160     exit 0
161     ;;
162     --version)
163     echo $APRUTIL_DOTTED_VERSION
164     exit 0
165     ;;
166     --link-ld)
167     if test "$location" = "installed"; then
168         ### avoid using -L if libdir is a "standard" location like /usr/lib
169         flags="$flags -L$libdir -l$APRUTIL_LIBNAME"
170     else
171         flags="$flags -L$APU_BUILD_DIR -l$APRUTIL_LIBNAME"
172     fi
173     ;;
174     --link-libtool)
175     # If the LA_FILE exists where we think it should be, use it.  If we're
176     # installed and the LA_FILE does not exist, assume to use -L/-l
177     # (the LA_FILE may not have been installed).  If we're building ourselves,
178     # we'll assume that at some point the .la file be created.
179     if test -f "$LA_FILE"; then
180         flags="$flags $LA_FILE"
181     elif test "$location" = "installed"; then
182         ### avoid using -L if libdir is a "standard" location like /usr/lib
183         # Since the user is specifying they are linking with libtool, we
184         # *know* that -R will be recognized by libtool.
185         flags="$flags -L$libdir -R$libdir -l$APRUTIL_LIBNAME"
186     else
187         flags="$flags $LA_FILE"
188     fi
189     ;;
190     --apu-la-file)
191     if test -f "$LA_FILE"; then
192         flags="$flags $LA_FILE"
193     fi
194     ;;
195     --old-expat)
196     if test ! -n "$APR_XML_EXPAT_OLD"; then
197         echo "no"
198     else
199         echo "$APR_XML_EXPAT_OLD"
200     fi
201     exit 0
202     ;;
203     --db-version)
204     echo $APU_DB_VERSION
205     exit 0
206     ;;
207     --help)
208     show_usage
209     exit 0
210     ;;
211     *)
212     show_usage
213     exit 1
214     ;;
215     esac
216
217     # Next please.
218     shift
219 done
220
221 if test -n "$flags"; then
222   echo "$flags"
223 fi
224
225 exit 0