poco/configure

247 lines
6.0 KiB
Bash
Executable File

#! /bin/sh
#
# configure
#
# $Id: //poco/Main/dist/configure#8 $
#
# Configuration script for POCO.
#
# Usage:
# configure [<options>...]
#
# Specify --help to display supported options.
#
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).
--exclude-XML
Disable building of Poco::XML component support
--exclude-Util
Disable building of Poco::Util component support
--exclude-Net
Disable building of Poco::Net component support
--exclude-NetSSL
Disable building of Poco::NetSSL component support
--exclude-Data
Disable building of Poco::Data component support
--exclude-ODBC
Disable building of Poco::Data::ODBC component support
--exclude-SQLite
Disable building of Poco::Data::SQLite component support
--exclude-MySQL
Disable building of Poco::Data::MySQL component support
ENDHELP
}
# save cwd
build=`pwd`
# get directory where we are located
cd `dirname $0`
base=`pwd`
cd $build
tests="tests"
samples="samples"
flags=""
poco_xml_support="include"
poco_util_support="include"
poco_net_support="include"
poco_netssl_support="include"
poco_data_support="include"
poco_data_odbc_support="include"
poco_data_sqlite_support="include"
poco_data_mysql_support="include"
# parse arguments
while [ "$1" != "" ] ; do
val=`expr $1 : '--config=\(.*\)'`
if [ "$val" != "" ] ; then
config=$val;
fi
val=`expr $1 : '--prefix=\(.*\)'`
if [ "$val" != "" ] ; then
prefix=$val
fi
val=`expr $1 : '--stdcxx-base=\(.*\)'`
if [ "$val" != "" ] ; then
stdcxx_base=$val
fi
if [ "$1" = "--no-samples" ] ; then
samples=""
fi
if [ "$1" = "--no-tests" ] ; then
tests=""
fi
if [ "$1" = "--no-wstring" ] ; then
flags="$flags -DPOCO_NO_WSTRING"
fi
if [ "$1" = "--no-fpenvironment" ] ; then
flags="$flags -DPOCO_NO_FPENVIRONMENT"
fi
if [ "$1" = "--exclude-XML" ] ; then
poco_xml_support="exclude"
fi
if [ "$1" = "--exclude-Util" ] ; then
poco_util_support="exclude"
fi
if [ "$1" = "--exclude-Net" ] ; then
poco_net_support="exclude"
fi
if [ "$1" = "--exclude-NetSSL" ] ; then
poco_netssl_support="exclude"
fi
if [ "$1" = "--exclude-Data" ] ; then
poco_data_support="exclude"
fi
if [ "$1" = "--exclude-ODBC" ] ; then
poco_data_odbc_support="exclude"
fi
if [ "$1" = "--exclude-SQLite" ] ; then
poco_data_sqlite_support="exclude"
fi
if [ "$1" = "--exclude-MySQL" ] ; then
poco_data_mysql_support="exclude"
fi
if [ "$1" = "--help" ] ; then
showhelp
exit 0
fi
shift
done
# autodetect build environment
# ...special cases for CYGWIN or MinGW
if [ "$config" = "" ] ; then
config=`uname`
cyg=`expr $config : '\(CYGWIN\).*'`
if [ "$cyg" = "CYGWIN" ] ; then
config=CYGWIN
else
ming=`expr $config : '\(MINGW\).*'`
if [ "$ming" = "MINGW" ] ; then
config=MinGW
fi
fi
fi
if [ ! -f "$base/build/config/$config" ] ; then
echo "Unknown configuration: $config"
echo "Please use the --config=<config_name> option."
echo "The <config_name> can be one of the following:"
echo ""
echo "`ls -C $base/build/config/`"
echo ""
exit 1
fi
if [ "$prefix" = "" ] ; then
prefix=/usr/local
fi
# copy Makefile to build dir
if [ "$base" != "$build" ] ; then
cp $base/Makefile $build
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 "POCO_XML_SUPPORT = $poco_xml_support" >>$build/config.make
echo "POCO_NET_SUPPORT = $poco_net_support" >>$build/config.make
echo "POCO_UTIL_SUPPORT = $poco_util_support" >>$build/config.make
echo "POCO_NETSSL_SUPPORT = $poco_netssl_support" >>$build/config.make
echo "POCO_DATA_SUPPORT = $poco_data_support" >>$build/config.make
echo "POCO_DATA_ODBC_SUPPORT = $poco_data_odbc_support" >>$build/config.make
echo "POCO_DATA_SQLITE_SUPPORT = $poco_data_sqlite_support" >>$build/config.make
echo "POCO_DATA_MYSQL_SUPPORT = $poco_data_mysql_support" >>$build/config.make
if [ "$stdcxx_base" != "" ] ; then
echo "STDCXX_BASE = $stdcxx_base" >>$build/config.make
fi
echo "export POCO_CONFIG" >>$build/config.make
echo "export POCO_BASE" >>$build/config.make
echo "export POCO_BUILD" >>$build/config.make
echo "export POCO_PREFIX" >>$build/config.make
echo "export POCO_FLAGS" >>$build/config.make
echo "export POCO_XML_SUPPORT" >>$build/config.make
echo "export POCO_NET_SUPPORT" >>$build/config.make
echo "export POCO_UTIL_SUPPORT" >>$build/config.make
echo "export POCO_NETSSL_SUPPORT" >>$build/config.make
echo "export POCO_DATA_SUPPORT" >>$build/config.make
echo "export POCO_DATA_ODBC_SUPPORT" >>$build/config.make
echo "export POCO_DATA_SQLITE_SUPPORT" >>$build/config.make
echo "export POCO_DATA_MYSQL_SUPPORT" >>$build/config.make
if [ "$stdcxx_base" != "" ] ; then
echo "export STDCXX_BASE" >>$build/config.make
fi
echo ".PHONY: poco" >>$build/config.make
echo "poco: libexecs $tests $samples" >>$build/config.make
echo "Configured for $config"