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 script designed to allow easy command line access to APR configuration
21 APR_MAJOR_VERSION="@APR_MAJOR_VERSION@"
22 APR_DOTTED_VERSION="@APR_DOTTED_VERSION@"
25 exec_prefix="@exec_prefix@"
28 datarootdir="@datadir@"
30 installbuilddir="@installbuilddir@"
31 includedir="@includedir@"
36 CPPFLAGS="@EXTRA_CPPFLAGS@"
37 CFLAGS="@EXTRA_CFLAGS@"
38 LDFLAGS="@EXTRA_LDFLAGS@"
40 EXTRA_INCLUDES="@EXTRA_INCLUDES@"
41 SHLIBPATH_VAR="@shlibpath_var@"
42 APR_SOURCE_DIR="@apr_srcdir@"
43 APR_BUILD_DIR="@apr_builddir@"
45 APR_LIB_TARGET="@export_lib_target@"
46 APR_LIBNAME="@APR_LIBNAME@"
48 # NOTE: the following line is modified during 'make install': alter with care!
49 location=@APR_CONFIG_LOCATION@
54 Usage: apr-$APR_MAJOR_VERSION-config [OPTION]
56 Known values for OPTION are:
57 --prefix[=DIR] change prefix to DIR
58 --bindir print location where binaries are installed
59 --includedir print location where headers are installed
60 --cc print C compiler name
61 --cpp print C preprocessor name and any required options
62 --cflags print C compiler flags
63 --cppflags print C preprocessor flags
64 --includes print include information
65 --ldflags print linker flags
66 --libs print additional libraries to link against
67 --srcdir print APR source directory
68 --installbuilddir print APR build helper directory
69 --link-ld print link switch(es) for linking to APR
70 --link-libtool print the libtool inputs for linking to APR
71 --shlib-path-var print the name of the shared library path env var
72 --apr-la-file print the path to the .la file, if available
73 --apr-so-ext print the extensions of shared objects on this platform
74 --apr-lib-target print the libtool target information
75 --apr-libtool print the path to APR's libtool
76 --version print the APR's version as a dotted triple
77 --help print this help
79 When linking with libtool, an application should do something like:
80 APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-libtool --libs\`"
81 or when linking directly:
82 APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-ld --libs\`"
84 An application should use the results of --cflags, --cppflags, --includes,
85 and --ldflags in their build process.
89 if test $# -eq 0; then
94 if test "$location" = "installed"; then
95 LA_FILE="$libdir/lib${APR_LIBNAME}.la"
97 LA_FILE="$APR_BUILD_DIR/lib${APR_LIBNAME}.la"
102 while test $# -gt 0; do
103 # Normalize the prefix.
105 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
110 # It is possible for the user to override our prefix.
123 if test "$location" = "installed"; then
125 elif test "$location" = "source"; then
126 flags="$APR_SOURCE_DIR/include"
128 # this is for VPATH builds
129 flags="$APR_BUILD_DIR/include $APR_SOURCE_DIR/include"
143 flags="$flags $CFLAGS"
146 flags="$flags $CPPFLAGS"
152 flags="$flags $LDFLAGS"
155 if test "$location" = "installed"; then
156 flags="$flags -I$includedir $EXTRA_INCLUDES"
157 elif test "$location" = "source"; then
158 flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
160 # this is for VPATH builds
161 flags="$flags -I$APR_BUILD_DIR/include -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
169 if test "$location" = "installed"; then
170 echo "${installbuilddir}"
171 elif test "$location" = "source"; then
172 echo "$APR_SOURCE_DIR/build"
174 # this is for VPATH builds
175 echo "$APR_BUILD_DIR/build"
180 echo $APR_DOTTED_VERSION
184 if test "$location" = "installed"; then
185 ### avoid using -L if libdir is a "standard" location like /usr/lib
186 flags="$flags -L$libdir -l${APR_LIBNAME}"
188 ### this surely can't work since the library is in .libs?
189 flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}"
193 # If the LA_FILE exists where we think it should be, use it. If we're
194 # installed and the LA_FILE does not exist, assume to use -L/-l
195 # (the LA_FILE may not have been installed). If we're building ourselves,
196 # we'll assume that at some point the .la file be created.
197 if test -f "$LA_FILE"; then
198 flags="$flags $LA_FILE"
199 elif test "$location" = "installed"; then
200 ### avoid using -L if libdir is a "standard" location like /usr/lib
201 # Since the user is specifying they are linking with libtool, we
202 # *know* that -R will be recognized by libtool.
203 flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}"
205 flags="$flags $LA_FILE"
209 echo "$SHLIBPATH_VAR"
213 if test -f "$LA_FILE"; then
214 flags="$flags $LA_FILE"
222 echo "$APR_LIB_TARGET"
226 if test "$location" = "installed"; then
227 echo "${installbuilddir}/libtool"
229 echo "$APR_BUILD_DIR/libtool"
247 if test -n "$flags"; then