poco/configure
2012-07-10 00:51:54 +00:00

280 lines
5.9 KiB
Bash
Executable File

#! /bin/sh
#
# configure
#
# $Id: //poco/1.4/dist/configure#2 $
#
# Configuration script for POCO.
#
# Invoke configure --help for help.
#
showhelp()
{
cat << ENDHELP
usage: configure {options}
Configure the POCO C++ Libraries.
Options:
--help
Display this help screen.
--config=<config_name>
Use the given build configuration.
Available configurations are:
`ls -C $base/build/config/`
--prefix=<install_prefix>
Use the given install directory for make install.
Default is /usr/local.
--stdcxx-base=<apache_stdcxx_install_prefix>
If (and only if) the $base/build/config selected with --config
uses the Apache stdcxx library, then apache_stdcxx_install_prefix
specifies the base directory where stdcxx is installed.
--no-tests
Do not build testsuites.
--no-samples
Do not build samples.
--no-wstring
Compile with -DPOCO_NO_WSTRING.
Useful if your C++ compiler does not support std::wstring
(such as uClibc-based systems).
--no-fpenvironment
Compile with -DPOCO_NO_FPENVIRONMENT.
Useful if your C++ compiler has incomplete floating-point support
(such as uClibc-based systems).
--no-sharedmemory
Compile with -DPOCO_NO_SHAREDMEMORY.
For systems that don't support shared memory API's,
like uClibc-based Linux systems.
--no-sharedlibs
Compile with -DPOCO_NO_SHAREDLIBS.
For systems that don't support shared library loading.
--omit=<component>{,<component>}
Do not build the specified component(s).
Example: --omit=Data/MySQL,Data/ODBC,Zip
--include-path=<path>
Add search path for header files.
--library-path=<path>
Add search path for library files.
--cflags=<flags>
Pass additional flags to compiler.
Example: --cflags=-wall
--poquito
Omit a few features for smaller codesize when linking
statically for embedded targets.
--unbundled
Use system-provided zlib, pcre, expat and sqlite instead of
bundled ones.
--static
Build static libraries. Overrides default mode, which
depends upon target. Can be specified together
with --shared to build both.
--shared
Build shared libraries. Overrides default mode, which
depends upon target. Can be specified together
with --static to build both.
ENDHELP
}
# save cwd
build=`pwd`
# get directory where we are located
cd `dirname $0`
base=`pwd`
cd $build
tests="tests"
samples="samples"
flags=""
omit=""
includepath=""
librarypath=""
unbundled=""
static=""
shared=""
# parse arguments
while [ $# -ge 1 ]; do
case "$1" in
--config=*)
config="${1:9}" ;;
--prefix=*)
prefix="${1:9}" ;;
--stdcxx-base=*)
stdcxx_base="${1:14}" ;;
--omit=*)
omit="`echo ${1:7} | tr ',;' ' '`" ;;
--include-path=*)
includepath="`echo ${1:15} | tr ',;' ' '`" ;;
--library-path=*)
librarypath="`echo ${1:15} | tr ',;' ' '`" ;;
--cflags=*)
cflags="${1:9}" ;;
--no-samples)
samples="" ;;
--no-tests)
tests="" ;;
--no-wstring)
flags="$flags -DPOCO_NO_WSTRING" ;;
--no-fpenvironment)
flags="$flags -DPOCO_NO_FPENVIRONMENT" ;;
--no-sharedmemory)
flags="$flags -DPOCO_NO_SHAREDMEMORY" ;;
--no-sharedlibs)
flags="$flags -DPOCO_NO_SHAREDLIBS" ;;
--poquito)
flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION" ;;
--unbundled)
flags="$flags -DPOCO_UNBUNDLED"
unbundled=1
;;
--static)
static=1 ;;
--shared)
shared=1 ;;
--help)
showhelp
exit 0
;;
*)
showhelp
exit 1
;;
esac
shift
done
# autodetect build environment
# ...special cases for CYGWIN or MinGW
if [ "$config" = "" ] ; then
config=`uname`
case "$config" in
CYGWIN*)
config=CYGWIN ;;
MINGW*)
config=MinGW ;;
esac
fi
if [ ! -f "$base/build/config/$config" ] ; then
echo "Unknown configuration: $config"
echo "Please use the --config option to specify another build configuration"
echo "The following configurations are available:"
ls $base/build/config
exit 1
fi
if [ -z "$prefix" ] ; then
prefix=/usr/local
fi
# check for patches
if [ -d $base/patches/$config ] ; then
echo "NOTE: There are patches for your configuration available. Please apply them before compiling."
fi
# copy Makefile to build dir
if [ "$base" != "$build" ] ; then
cp $base/Makefile $build
fi
if [ -n "$static" -a -n "$shared" ] ; then
linkmode=BOTH
elif [ -n "$static" ] ; then
linkmode=STATIC
elif [ -n "$shared" ] ; then
linkmode=SHARED
else
linkmode=""
fi
# create config.make
echo '# config.make generated by configure script' >$build/config.make
echo "POCO_CONFIG = $config" >>$build/config.make
echo "POCO_BASE = $base" >>$build/config.make
echo "POCO_BUILD = $build" >>$build/config.make
echo "POCO_PREFIX = $prefix" >>$build/config.make
echo "POCO_FLAGS = $flags" >>$build/config.make
echo "OMIT = $omit" >>$build/config.make
if [ -n "$stdcxx_base" ] ; then
echo "STDCXX_BASE = $stdcxx_base" >>$build/config.make
fi
if [ -n "$includepath" ] ; then
echo "POCO_ADD_INCLUDE = $includepath" >>$build/config.make
fi
if [ -n "$librarypath" ] ; then
echo "POCO_ADD_LIBRARY = $librarypath" >>$build/config.make
fi
if [ -n "$unbundled" ] ; then
echo "POCO_UNBUNDLED = 1" >>$build/config.make
fi
if [ -n "$linkmode" ] ; then
echo "LINKMODE = $linkmode" >>$build/config.make
fi
cat <<__EOF__ >>$build/config.make
export POCO_CONFIG
export POCO_BASE
export POCO_BUILD
export POCO_PREFIX
export POCO_FLAGS
__EOF__
if [ -n "$stdcxx_base" ] ; then
echo "export STDCXX_BASE" >>$build/config.make
fi
if [ -n "$includepath" ] ; then
echo "export POCO_ADD_INCLUDE" >>$build/config.make
fi
if [ -n "$librarypath" ] ; then
echo "export POCO_ADD_LIBRARY" >>$build/config.make
fi
if [ -n "$unbundled" ] ; then
echo "export POCO_UNBUNDLED" >>$build/config.make
fi
if [ -n "$linkmode" ] ; then
echo "export LINKMODE" >>$build/config.make
fi
cat <<__EOF__ >>$build/config.make
.PHONY: poco
poco: libexecs $tests $samples
__EOF__
echo "Configured for $config"