Fix build failure when --disable-util-dso is used.
[apr-util.git] / apu-config.in
blob87c00efa69cf0809f908052324cf57f658ffa084
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 # APR-util script designed to allow easy command line access to APR-util
19 # configuration parameters.
21 APRUTIL_MAJOR_VERSION="@APRUTIL_MAJOR_VERSION@"
22 APRUTIL_DOTTED_VERSION="@APRUTIL_DOTTED_VERSION@"
24 prefix="@prefix@"
25 exec_prefix="@exec_prefix@"
26 bindir="@bindir@"
27 libdir="@libdir@"
28 includedir="@includedir@"
30 LIBS="@APRUTIL_EXPORT_LIBS@"
31 INCLUDES="@APRUTIL_INCLUDES@"
32 LDFLAGS="@APRUTIL_LDFLAGS@"
33 LDAP_LIBS="@LDADD_ldap@"
35 APRUTIL_LIBNAME="@APRUTIL_LIBNAME@"
37 APU_SOURCE_DIR="@abs_srcdir@"
38 APU_BUILD_DIR="@abs_builddir@"
39 APR_XML_EXPAT_OLD="@APR_XML_EXPAT_OLD@"
40 APU_DB_VERSION="@apu_db_version@"
42 # NOTE: the following line is modified during 'make install': alter with care!
43 location=@APU_CONFIG_LOCATION@
45 show_usage()
47 cat << EOF
48 Usage: apu-$APRUTIL_MAJOR_VERSION-config [OPTION]
50 Known values for OPTION are:
51 --prefix[=DIR] change prefix to DIR
52 --bindir print location where binaries are installed
53 --includes print include information
54 --includedir print location where headers are installed
55 --ldflags print linker flags
56 --libs print library information
57 --avoid-ldap do not include ldap library information with --libs
58 --ldap-libs print library information to link with ldap
59 --srcdir print APR-util source directory
60 --link-ld print link switch(es) for linking to APR-util
61 --link-libtool print the libtool inputs for linking to APR-util
62 --apu-la-file print the path to the .la file, if available
63 --old-expat indicate if APR-util was built against an old expat
64 --db-version print the DB version
65 --version print APR-util's version as a dotted triple
66 --help print this help
68 When linking with libtool, an application should do something like:
69 APU_LIBS="\`apu-$APRUTIL_MAJOR_VERSION-config --link-libtool --libs\`"
70 or when linking directly:
71 APU_LIBS="\`apu-$APRUTIL_MAJOR_VERSION-config --link-ld --libs\`"
73 An application should use the results of --includes, and --ldflags in
74 their build process.
75 EOF
78 if test $# -eq 0; then
79 show_usage
80 exit 1
83 if test "$location" = "installed"; then
84 LA_FILE="$libdir/lib${APRUTIL_LIBNAME}.la"
86 LIBS=`echo "$LIBS" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g" -e "s $prefix/lib/libexpat.la -lexpat g"`
87 LDFLAGS=`echo "$LDFLAGS" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g"`
88 INCLUDES=`echo "$INCLUDES" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g" -e "s -I$prefix/lib g"`
89 else
90 LA_FILE="$APU_BUILD_DIR/lib${APRUTIL_LIBNAME}.la"
93 flags=""
95 while test $# -gt 0; do
96 # Normalize the prefix.
97 case "$1" in
98 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
99 *) optarg= ;;
100 esac
102 case "$1" in
103 # It is possible for the user to override our prefix.
104 --prefix=*)
105 prefix=$optarg
107 --prefix)
108 echo $prefix
109 exit 0
111 --bindir)
112 echo $bindir
113 exit 0
115 --avoid-ldap)
116 LDAP_LIBS=""
118 --libs)
119 flags="$flags $LDAP_LIBS $LIBS"
121 --ldap-libs)
122 flags="$flags $LDAP_LIBS"
124 --includedir)
125 if test "$location" = "installed"; then
126 flags="$includedir"
127 elif test "$location" = "source"; then
128 flags="$APU_SOURCE_DIR/include"
129 else
130 # this is for VPATH builds
131 flags="$APU_BUILD_DIR/include $APU_SOURCE_DIR/include"
133 echo $flags
134 exit 0
136 --includes)
137 if test "$location" = "installed"; then
138 flags="$flags -I$includedir $INCLUDES"
139 elif test "$location" = "source"; then
140 flags="$flags -I$APU_SOURCE_DIR/include $INCLUDES"
141 else
142 # this is for VPATH builds
143 flags="$flags -I$APU_BUILD_DIR/include -I$APU_SOURCE_DIR/include $INCLUDES"
146 --ldflags)
147 flags="$flags $LDFLAGS"
149 --srcdir)
150 echo $APU_SOURCE_DIR
151 exit 0
153 --version)
154 echo $APRUTIL_DOTTED_VERSION
155 exit 0
157 --link-ld)
158 if test "$location" = "installed"; then
159 ### avoid using -L if libdir is a "standard" location like /usr/lib
160 flags="$flags -L$libdir -l$APRUTIL_LIBNAME"
161 else
162 flags="$flags -L$APU_BUILD_DIR -l$APRUTIL_LIBNAME"
165 --link-libtool)
166 # If the LA_FILE exists where we think it should be, use it. If we're
167 # installed and the LA_FILE does not exist, assume to use -L/-l
168 # (the LA_FILE may not have been installed). If we're building ourselves,
169 # we'll assume that at some point the .la file be created.
170 if test -f "$LA_FILE"; then
171 flags="$flags $LA_FILE"
172 elif test "$location" = "installed"; then
173 ### avoid using -L if libdir is a "standard" location like /usr/lib
174 # Since the user is specifying they are linking with libtool, we
175 # *know* that -R will be recognized by libtool.
176 flags="$flags -L$libdir -R$libdir -l$APRUTIL_LIBNAME"
177 else
178 flags="$flags $LA_FILE"
181 --apu-la-file)
182 if test -f "$LA_FILE"; then
183 flags="$flags $LA_FILE"
186 --old-expat)
187 if test ! -n "$APR_XML_EXPAT_OLD"; then
188 echo "no"
189 else
190 echo "$APR_XML_EXPAT_OLD"
192 exit 0
194 --db-version)
195 echo $APU_DB_VERSION
196 exit 0
198 --help)
199 show_usage
200 exit 0
203 show_usage
204 exit 1
206 esac
208 # Next please.
209 shift
210 done
212 if test -n "$flags"; then
213 echo "$flags"
216 exit 0