1251875Speter#!/bin/sh 2251875Speter# Licensed to the Apache Software Foundation (ASF) under one or more 3251875Speter# contributor license agreements. See the NOTICE file distributed with 4251875Speter# this work for additional information regarding copyright ownership. 5251875Speter# The ASF licenses this file to You under the Apache License, Version 2.0 6251875Speter# (the "License"); you may not use this file except in compliance with 7251875Speter# the License. You may obtain a copy of the License at 8251875Speter# 9251875Speter# http://www.apache.org/licenses/LICENSE-2.0 10251875Speter# 11251875Speter# Unless required by applicable law or agreed to in writing, software 12251875Speter# distributed under the License is distributed on an "AS IS" BASIS, 13251875Speter# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14251875Speter# See the License for the specific language governing permissions and 15251875Speter# limitations under the License. 16251875Speter# 17251875Speter 18251875Speter# APR script designed to allow easy command line access to APR configuration 19251875Speter# parameters. 20251875Speter 21251875SpeterAPR_MAJOR_VERSION="@APR_MAJOR_VERSION@" 22251875SpeterAPR_DOTTED_VERSION="@APR_DOTTED_VERSION@" 23251875Speter 24251875Speterprefix="@prefix@" 25251875Speterexec_prefix="@exec_prefix@" 26251875Speterbindir="@bindir@" 27251875Speterlibdir="@libdir@" 28251875Speterdatarootdir="@datadir@" 29251875Speterdatadir="@datadir@" 30251875Speterinstallbuilddir="@installbuilddir@" 31251875Speterincludedir="@includedir@" 32251875Speter 33251875SpeterCC="@CC@" 34251875SpeterCPP="@CPP@" 35251875SpeterSHELL="@SHELL@" 36251875SpeterCPPFLAGS="@EXTRA_CPPFLAGS@" 37251875SpeterCFLAGS="@EXTRA_CFLAGS@" 38251875SpeterLDFLAGS="@EXTRA_LDFLAGS@" 39251875SpeterLIBS="@EXTRA_LIBS@" 40251875SpeterEXTRA_INCLUDES="@EXTRA_INCLUDES@" 41251875SpeterSHLIBPATH_VAR="@shlibpath_var@" 42251875SpeterAPR_SOURCE_DIR="@apr_srcdir@" 43251875SpeterAPR_BUILD_DIR="@apr_builddir@" 44251875SpeterAPR_SO_EXT="@so_ext@" 45251875SpeterAPR_LIB_TARGET="@export_lib_target@" 46251875SpeterAPR_LIBNAME="@APR_LIBNAME@" 47251875Speter 48251875Speter# NOTE: the following line is modified during 'make install': alter with care! 49251875Speterlocation=@APR_CONFIG_LOCATION@ 50251875Speter 51251875Spetershow_usage() 52251875Speter{ 53251875Speter cat << EOF 54251875SpeterUsage: apr-$APR_MAJOR_VERSION-config [OPTION] 55251875Speter 56251875SpeterKnown values for OPTION are: 57251875Speter --prefix[=DIR] change prefix to DIR 58251875Speter --bindir print location where binaries are installed 59251875Speter --includedir print location where headers are installed 60251875Speter --cc print C compiler name 61251875Speter --cpp print C preprocessor name and any required options 62251875Speter --cflags print C compiler flags 63251875Speter --cppflags print C preprocessor flags 64251875Speter --includes print include information 65251875Speter --ldflags print linker flags 66251875Speter --libs print additional libraries to link against 67251875Speter --srcdir print APR source directory 68251875Speter --installbuilddir print APR build helper directory 69251875Speter --link-ld print link switch(es) for linking to APR 70251875Speter --link-libtool print the libtool inputs for linking to APR 71251875Speter --shlib-path-var print the name of the shared library path env var 72251875Speter --apr-la-file print the path to the .la file, if available 73251875Speter --apr-so-ext print the extensions of shared objects on this platform 74251875Speter --apr-lib-target print the libtool target information 75251875Speter --apr-libtool print the path to APR's libtool 76251875Speter --version print the APR's version as a dotted triple 77251875Speter --help print this help 78251875Speter 79251875SpeterWhen linking with libtool, an application should do something like: 80251875Speter APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-libtool --libs\`" 81251875Speteror when linking directly: 82251875Speter APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-ld --libs\`" 83251875Speter 84251875SpeterAn application should use the results of --cflags, --cppflags, --includes, 85251875Speterand --ldflags in their build process. 86251875SpeterEOF 87251875Speter} 88251875Speter 89251875Speterif test $# -eq 0; then 90251875Speter show_usage 91251875Speter exit 1 92251875Speterfi 93251875Speter 94251875Speterif test "$location" = "installed"; then 95251875Speter LA_FILE="$libdir/lib${APR_LIBNAME}.la" 96251875Speterelse 97251875Speter LA_FILE="$APR_BUILD_DIR/lib${APR_LIBNAME}.la" 98251875Speterfi 99251875Speter 100251875Speterflags="" 101251875Speter 102251875Speterwhile test $# -gt 0; do 103251875Speter # Normalize the prefix. 104251875Speter case "$1" in 105251875Speter -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 106251875Speter *) optarg= ;; 107251875Speter esac 108251875Speter 109251875Speter case "$1" in 110251875Speter # It is possible for the user to override our prefix. 111251875Speter --prefix=*) 112251875Speter prefix=$optarg 113251875Speter ;; 114251875Speter --prefix) 115251875Speter echo $prefix 116251875Speter exit 0 117251875Speter ;; 118251875Speter --bindir) 119251875Speter echo $bindir 120251875Speter exit 0 121251875Speter ;; 122251875Speter --includedir) 123251875Speter if test "$location" = "installed"; then 124251875Speter flags="$includedir" 125251875Speter elif test "$location" = "source"; then 126251875Speter flags="$APR_SOURCE_DIR/include" 127251875Speter else 128251875Speter # this is for VPATH builds 129251875Speter flags="$APR_BUILD_DIR/include $APR_SOURCE_DIR/include" 130251875Speter fi 131251875Speter echo $flags 132251875Speter exit 0 133251875Speter ;; 134251875Speter --cc) 135251875Speter echo $CC 136251875Speter exit 0 137251875Speter ;; 138251875Speter --cpp) 139251875Speter echo $CPP 140251875Speter exit 0 141251875Speter ;; 142251875Speter --cflags) 143251875Speter flags="$flags $CFLAGS" 144251875Speter ;; 145251875Speter --cppflags) 146251875Speter flags="$flags $CPPFLAGS" 147251875Speter ;; 148251875Speter --libs) 149251875Speter flags="$flags $LIBS" 150251875Speter ;; 151251875Speter --ldflags) 152251875Speter flags="$flags $LDFLAGS" 153251875Speter ;; 154251875Speter --includes) 155251875Speter if test "$location" = "installed"; then 156251875Speter flags="$flags -I$includedir $EXTRA_INCLUDES" 157251875Speter elif test "$location" = "source"; then 158251875Speter flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES" 159251875Speter else 160251875Speter # this is for VPATH builds 161251875Speter flags="$flags -I$APR_BUILD_DIR/include -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES" 162251875Speter fi 163251875Speter ;; 164251875Speter --srcdir) 165251875Speter echo $APR_SOURCE_DIR 166251875Speter exit 0 167251875Speter ;; 168251875Speter --installbuilddir) 169251875Speter if test "$location" = "installed"; then 170251875Speter echo "${installbuilddir}" 171251875Speter elif test "$location" = "source"; then 172251875Speter echo "$APR_SOURCE_DIR/build" 173251875Speter else 174251875Speter # this is for VPATH builds 175251875Speter echo "$APR_BUILD_DIR/build" 176251875Speter fi 177251875Speter exit 0 178251875Speter ;; 179251875Speter --version) 180251875Speter echo $APR_DOTTED_VERSION 181251875Speter exit 0 182251875Speter ;; 183251875Speter --link-ld) 184251875Speter if test "$location" = "installed"; then 185251875Speter ### avoid using -L if libdir is a "standard" location like /usr/lib 186251875Speter flags="$flags -L$libdir -l${APR_LIBNAME}" 187251875Speter else 188251875Speter ### this surely can't work since the library is in .libs? 189251875Speter flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}" 190251875Speter fi 191251875Speter ;; 192251875Speter --link-libtool) 193251875Speter # If the LA_FILE exists where we think it should be, use it. If we're 194251875Speter # installed and the LA_FILE does not exist, assume to use -L/-l 195251875Speter # (the LA_FILE may not have been installed). If we're building ourselves, 196251875Speter # we'll assume that at some point the .la file be created. 197251875Speter if test -f "$LA_FILE"; then 198251875Speter flags="$flags $LA_FILE" 199251875Speter elif test "$location" = "installed"; then 200251875Speter ### avoid using -L if libdir is a "standard" location like /usr/lib 201251875Speter # Since the user is specifying they are linking with libtool, we 202251875Speter # *know* that -R will be recognized by libtool. 203251875Speter flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}" 204251875Speter else 205251875Speter flags="$flags $LA_FILE" 206251875Speter fi 207251875Speter ;; 208251875Speter --shlib-path-var) 209251875Speter echo "$SHLIBPATH_VAR" 210251875Speter exit 0 211251875Speter ;; 212251875Speter --apr-la-file) 213251875Speter if test -f "$LA_FILE"; then 214251875Speter flags="$flags $LA_FILE" 215251875Speter fi 216251875Speter ;; 217251875Speter --apr-so-ext) 218251875Speter echo "$APR_SO_EXT" 219251875Speter exit 0 220251875Speter ;; 221251875Speter --apr-lib-target) 222251875Speter echo "$APR_LIB_TARGET" 223251875Speter exit 0 224251875Speter ;; 225251875Speter --apr-libtool) 226251875Speter if test "$location" = "installed"; then 227251875Speter echo "${installbuilddir}/libtool" 228251875Speter else 229251875Speter echo "$APR_BUILD_DIR/libtool" 230251875Speter fi 231251875Speter exit 0 232251875Speter ;; 233251875Speter --help) 234251875Speter show_usage 235251875Speter exit 0 236251875Speter ;; 237251875Speter *) 238251875Speter show_usage 239251875Speter exit 1 240251875Speter ;; 241251875Speter esac 242251875Speter 243251875Speter # Next please. 244251875Speter shift 245251875Speterdone 246251875Speter 247251875Speterif test -n "$flags"; then 248251875Speter echo "$flags" 249251875Speterfi 250251875Speter 251251875Speterexit 0 252