14 kx #!/bin/sh
14 kx # Licensed to the Apache Software Foundation (ASF) under one or more
14 kx # contributor license agreements. See the NOTICE file distributed with
14 kx # this work for additional information regarding copyright ownership.
14 kx # The ASF licenses this file to You under the Apache License, Version 2.0
14 kx # (the "License"); you may not use this file except in compliance with
14 kx # the License. You may obtain a copy of the License at
14 kx #
14 kx # http://www.apache.org/licenses/LICENSE-2.0
14 kx #
14 kx # Unless required by applicable law or agreed to in writing, software
14 kx # distributed under the License is distributed on an "AS IS" BASIS,
14 kx # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 kx # See the License for the specific language governing permissions and
14 kx # limitations under the License.
14 kx #
14 kx
14 kx # APR script designed to allow easy command line access to APR configuration
14 kx # parameters.
14 kx
14 kx APR_MAJOR_VERSION="@APR_MAJOR_VERSION@"
14 kx APR_DOTTED_VERSION="@APR_DOTTED_VERSION@"
14 kx
14 kx prefix="@prefix@"
14 kx exec_prefix="@exec_prefix@"
14 kx bindir="@bindir@"
14 kx libdir="@libdir@"
14 kx datarootdir="@datadir@"
14 kx datadir="@datadir@"
14 kx installbuilddir="@installbuilddir@"
14 kx includedir="@includedir@"
14 kx
14 kx CC="@CC@"
14 kx CPP="@CPP@"
14 kx SHELL="@SHELL@"
14 kx CPPFLAGS="@EXTRA_CPPFLAGS@"
14 kx CFLAGS="@EXTRA_CFLAGS@"
14 kx LDFLAGS="@EXTRA_LDFLAGS@"
14 kx LIBS="@EXTRA_LIBS@"
14 kx EXTRA_INCLUDES="@EXTRA_INCLUDES@"
14 kx SHLIBPATH_VAR="@shlibpath_var@"
14 kx APR_SOURCE_DIR="@apr_srcdir@"
14 kx APR_BUILD_DIR="@apr_builddir@"
14 kx APR_SO_EXT="@so_ext@"
14 kx APR_LIB_TARGET="@export_lib_target@"
14 kx APR_LIBNAME="@APR_LIBNAME@"
14 kx
14 kx # NOTE: the following line is modified during 'make install': alter with care!
14 kx location=@APR_CONFIG_LOCATION@
14 kx
14 kx show_usage()
14 kx {
14 kx cat << EOF
14 kx Usage: apr-$APR_MAJOR_VERSION-config [OPTION]
14 kx
14 kx Known values for OPTION are:
14 kx --prefix[=DIR] change prefix to DIR
14 kx --bindir print location where binaries are installed
14 kx --includedir print location where headers are installed
14 kx --cc print C compiler name
14 kx --cpp print C preprocessor name and any required options
14 kx --cflags print C compiler flags
14 kx --cppflags print C preprocessor flags
14 kx --includes print include information
14 kx --ldflags print linker flags
14 kx --libs print additional libraries to link against
14 kx --srcdir print APR source directory
14 kx --installbuilddir print APR build helper directory
14 kx --link-ld print link switch(es) for linking to APR
14 kx --link-libtool print the libtool inputs for linking to APR
14 kx --shlib-path-var print the name of the shared library path env var
14 kx --apr-la-file print the path to the .la file, if available
14 kx --apr-so-ext print the extensions of shared objects on this platform
14 kx --apr-lib-target print the libtool target information
14 kx --apr-libtool print the path to APR's libtool
14 kx --version print the APR's version as a dotted triple
14 kx --help print this help
14 kx
14 kx When linking with libtool, an application should do something like:
14 kx APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-libtool --libs\`"
14 kx or when linking directly:
14 kx APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-ld --libs\`"
14 kx
14 kx An application should use the results of --cflags, --cppflags, --includes,
14 kx and --ldflags in their build process.
14 kx EOF
14 kx }
14 kx
14 kx if test $# -eq 0; then
14 kx show_usage
14 kx exit 1
14 kx fi
14 kx
14 kx if test "$location" = "installed"; then
14 kx LA_FILE="$libdir/lib${APR_LIBNAME}.la"
14 kx else
14 kx LA_FILE="$APR_BUILD_DIR/lib${APR_LIBNAME}.la"
14 kx fi
14 kx
14 kx flags=""
14 kx
14 kx while test $# -gt 0; do
14 kx # Normalize the prefix.
14 kx case "$1" in
14 kx -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
14 kx *) optarg= ;;
14 kx esac
14 kx
14 kx case "$1" in
14 kx # It is possible for the user to override our prefix.
14 kx --prefix=*)
14 kx prefix=$optarg
14 kx ;;
14 kx --prefix)
14 kx echo $prefix
14 kx exit 0
14 kx ;;
14 kx --bindir)
14 kx echo $bindir
14 kx exit 0
14 kx ;;
14 kx --includedir)
14 kx if test "$location" = "installed"; then
14 kx flags="$includedir"
14 kx elif test "$location" = "source"; then
14 kx flags="$APR_SOURCE_DIR/include"
14 kx else
14 kx # this is for VPATH builds
14 kx flags="$APR_BUILD_DIR/include $APR_SOURCE_DIR/include"
14 kx fi
14 kx echo $flags
14 kx exit 0
14 kx ;;
14 kx --cc)
14 kx echo $CC
14 kx exit 0
14 kx ;;
14 kx --cpp)
14 kx echo $CPP
14 kx exit 0
14 kx ;;
14 kx --cflags)
14 kx flags="$flags $CFLAGS"
14 kx ;;
14 kx --cppflags)
14 kx flags="$flags $CPPFLAGS"
14 kx ;;
14 kx --libs)
14 kx flags="$flags $LIBS"
14 kx ;;
14 kx --ldflags)
14 kx flags="$flags $LDFLAGS"
14 kx ;;
14 kx --includes)
14 kx if test "$location" = "installed"; then
14 kx flags="$flags -I$includedir $EXTRA_INCLUDES"
14 kx elif test "$location" = "source"; then
14 kx flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
14 kx else
14 kx # this is for VPATH builds
14 kx flags="$flags -I$APR_BUILD_DIR/include -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
14 kx fi
14 kx ;;
14 kx --srcdir)
14 kx echo $APR_SOURCE_DIR
14 kx exit 0
14 kx ;;
14 kx --installbuilddir)
14 kx if test "$location" = "installed"; then
14 kx echo "${installbuilddir}"
14 kx elif test "$location" = "source"; then
14 kx echo "$APR_SOURCE_DIR/build"
14 kx else
14 kx # this is for VPATH builds
14 kx echo "$APR_BUILD_DIR/build"
14 kx fi
14 kx exit 0
14 kx ;;
14 kx --version)
14 kx echo $APR_DOTTED_VERSION
14 kx exit 0
14 kx ;;
14 kx --link-ld)
14 kx if test "$location" = "installed"; then
14 kx ### avoid using -L if libdir is a "standard" location like /usr/lib
14 kx flags="$flags -L$libdir -l${APR_LIBNAME}"
14 kx else
14 kx ### this surely can't work since the library is in .libs?
14 kx flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}"
14 kx fi
14 kx ;;
14 kx --link-libtool)
14 kx # If the LA_FILE exists where we think it should be, use it. If we're
14 kx # installed and the LA_FILE does not exist, assume to use -L/-l
14 kx # (the LA_FILE may not have been installed). If we're building ourselves,
14 kx # we'll assume that at some point the .la file be created.
14 kx if test -f "$LA_FILE"; then
14 kx flags="$flags $LA_FILE"
14 kx elif test "$location" = "installed"; then
14 kx ### avoid using -L if libdir is a "standard" location like /usr/lib
14 kx # Since the user is specifying they are linking with libtool, we
14 kx # *know* that -R will be recognized by libtool.
14 kx flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}"
14 kx else
14 kx flags="$flags $LA_FILE"
14 kx fi
14 kx ;;
14 kx --shlib-path-var)
14 kx echo "$SHLIBPATH_VAR"
14 kx exit 0
14 kx ;;
14 kx --apr-la-file)
14 kx if test -f "$LA_FILE"; then
14 kx flags="$flags $LA_FILE"
14 kx fi
14 kx ;;
14 kx --apr-so-ext)
14 kx echo "$APR_SO_EXT"
14 kx exit 0
14 kx ;;
14 kx --apr-lib-target)
14 kx echo "$APR_LIB_TARGET"
14 kx exit 0
14 kx ;;
14 kx --apr-libtool)
14 kx if test "$location" = "installed"; then
14 kx echo "${installbuilddir}/libtool"
14 kx else
14 kx echo "$APR_BUILD_DIR/libtool"
14 kx fi
14 kx exit 0
14 kx ;;
14 kx --help)
14 kx show_usage
14 kx exit 0
14 kx ;;
14 kx *)
14 kx show_usage
14 kx exit 1
14 kx ;;
14 kx esac
14 kx
14 kx # Next please.
14 kx shift
14 kx done
14 kx
14 kx if test -n "$flags"; then
14 kx echo "$flags"
14 kx fi
14 kx
14 kx exit 0