blob: c28aae19492f7e662890fa7575b373e5a348188a [file] [log] [blame]
#!/bin/sh
#
# The Apache Software License, Version 1.1
#
# Copyright (c) 1999-2000 The Apache Software Foundation. All rights
# reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. The end-user documentation included with the redistribution,
# if any, must include the following acknowledgment:
# "This product includes software developed by the
# Apache Software Foundation (http://www.apache.org/)."
# Alternately, this acknowledgment may appear in the software itself,
# if and wherever such third-party acknowledgments normally appear.
#
# 4. The names "Xerces" and "Apache Software Foundation" must
# not be used to endorse or promote products derived from this
# software without prior written permission. For written
# permission, please contact apache\@apache.org.
#
# 5. Products derived from this software may not be called "Apache",
# nor may "Apache" appear in their name, without prior written
# permission of the Apache Software Foundation.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# ====================================================================
#
# This software consists of voluntary contributions made by many
# individuals on behalf of the Apache Software Foundation, and was
# originally based on software copyright (c) 1999, International
# Business Machines, Inc., http://www.ibm.com . For more information
# on the Apache Software Foundation, please see
# <http://www.apache.org/>.
#
#
# $Log$
# Revision 1.9 2001/06/09 18:06:50 jberry
# Add MacOS build support for tests
#
# Revision 1.8 2001/02/13 13:10:50 tng
# Update samples/tests files for on UnixWare 7.1.1 with gcc 2.95. Add UNIXWARE platform defines to Makefile.incl, add recognition of sysv5uw7 to configure.in, and add unixware as recognized platform to runConfigure. Updated by Hiram Clawson.
#
# Revision 1.7 2000/05/10 01:13:52 abagchi
# Now detects AIX version and introduces -lpthreads_compat accordingly
#
# Revision 1.6 2000/04/12 20:33:08 abagchi
# Included some more PTX changes
#
# Revision 1.5 2000/04/04 20:10:16 abagchi
# Added PTX support
#
# Revision 1.4 2000/02/29 02:19:11 rahulj
# No more compilation errors under HPUX 11.0. We do not build
# DOMMemTest as it crashes the aCC compiler.
#
# Revision 1.3 2000/02/26 07:20:18 rahulj
# - The threading tests now work on HPUX.
# - Under HPUX 10.20 we do no build DOMMemTest and DOMTest.
# It crashes the compiler.
# - One could not write more worse makefiles than what exists for the
# tests. Hopefully, I will get bugged enough to fix them oneday.
#
# Revision 1.2 2000/02/06 07:48:34 rahulj
# Year 2K copyright swat.
#
# Revision 1.1 2000/01/31 22:21:53 aruna1
# initial checkin
#
#
# runConfigure : This script will run the "configure" script for the appropriate platform
# Only supported platforms are recognized
usage()
{
echo "runConfigure: Helper script to run \"configure\" for one of the supported platforms"
echo "Usage: runConfigure \"options\""
echo " where options may be any of the following:"
echo " -p <platform> (accepts 'aix', 'unixware', 'linux', 'solaris', 'hp-10', 'hp-11', 'ptx', 'macosx')"
echo " -c <C compiler name> (e.g. gcc or xlc_r)"
echo " -x <C++ compiler name> (e.g. g++ or xlC_r)"
echo " -d (specifies that you want to build debug version)"
echo " -r <thread option> can be 'pthread' or 'dce' (only used on HP-11)"
echo " -h (get help on the above commands)"
}
ERROR_EXIT_CODE=1
if test ${1}o = "o"; then
usage
exit ${ERROR_EXIT_CODE}
fi
if test ${XERCESCROOT}o = "o"; then
echo ERROR : You have not set your XERCESCROOT environment variable
echo Though this environment variable has nothing to do with creating makefiles,
echo this is just a general warning to prevent you from pitfalls in future. Please
echo set an environment variable called XERCESCROOT to indicate where you installed
echo the XERCES-C files, and run this command again to proceed. See the documentation
echo for an example if you are still confused.
exit ${ERROR_EXIT_CODE}
fi
if test $1 = "-h"; then
usage
exit ${ERROR_EXIT_CODE}
fi
# Get the command line parameters
set -- `getopt p:c:x:dm:n:t:r:l:z:h $*`
if [ $? != 0 ]
then
usage
exit ${ERROR_EXIT_CODE}
fi
# Set up the default values for each parameter
debug=off # by default debug is off
transcoder=native # by default use native transcoder
msgloader=iconv # by default use native transcoder
netaccessor=fileonly # by default use fileonly
for i in $*
do
case $i in
-p)
platform=$2; shift 2;;
-c)
ccompiler=$2; shift 2;;
-x)
cppcompiler=$2; shift 2;;
-r)
thread=$2; shift 2;;
-d)
debug=on; shift;;
-h)
usage
exit ${ERROR_EXIT_CODE};;
--)
shift; break;;
esac
done
echo "Generating makefiles with the following options ..."
echo "Platform: $platform"
echo "C Compiler: $ccompiler"
echo "C++ Compiler: $cppcompiler"
echo "Thread option: $thread"
if test $debug = "off"; then
echo "Debug is OFF"
debugflag="-O";
else
echo "Debug is ON"
debugflag="-g";
fi
# Now check if the options are correct or not, bail out if incorrect
case $platform in
aix | unixware | linux | solaris | hp-10 | hp-11 | ptx | macosx)
# platform has been recognized
;;
*)
echo "I do not recognize the platform '$platform'. Please type '${0} -h' for help."
exit ${ERROR_EXIT_CODE};;
esac
# Set the C compiler and C++ compiler environment variables
case $cppcompiler in
xlC | xlc | xlC_r | xlc_r)
standardLibFlags="-L/usr/lpp/xlC/lib -lC";;
g++ | c++)
if test $platform = "ptx"; then
if test -z $XMLINSTALL; then
XMLINSTALL=$ICUROOT
fi
standardLibFlags="-L${XMLINSTALL}/lib -lc";
else
standardLibFlags="-L/usr/local/lib -lc";
fi
;;
cc | CC)
standardLibFlags="-L/usr/lib -L/usr/ccs/lib -lC";;
acc | aCC)
standardLibFlags="";;
*)
echo "I do not recognize the C++ compiler '$cppcompiler'. Continuing anyway ..."
;;
esac
CC=$ccompiler
export CC
CXX=$cppcompiler
export CXX
#
# Check for the threading option only for hp-11
#
threadingLibs="-lpthread"
if test $platform = "hp-11"; then
if test $thread; then
case $thread in
pthread)
;;
dce)
threadingLibs="-lcma";
threadingDefines="-D_PTHREADS_DRAFT4 -DXML_USE_DCE" ;;
*)
echo "I do not recognize the thread option '$thread'. Please type '${0} -h' for help."
exit ${ERROR_EXIT_CODE};;
esac
fi
elif test $platform = "aix"; then
aix_version=`./config.guess`;
echo Found host system to be $aix_version
case $aix_version in
*4.3*)
threadingLibs="-lpthreads_compat -lpthreads";;
*)
threadingLibs="-lpthreads";;
esac
elif test $platform = "ptx"; then
threadingLibs=" "
elif test $platform = "hp-10"; then
threadingLibs="-lcma"
threadingDefines="-DXML_USE_DCE"
elif test $platform = "unixware"; then
threadingLibs="-pthread"
threadingDefines="-pthread"
fi
#
# Set the extra C and C++ compiler flags before invoking configure.
#
CXXFLAGS="$debugflag $compileroption $threadingDefines"
export CXXFLAGS
CFLAGS="$debugflag $compileroption $threadingDefines"
export CFLAGS
LIBS="$threadingLibs $standardLibFlags"
export LIBS
if test $platform = "ptx"; then
if test ${XMLINSTALL}o = "o"; then
XMLINSTALL = /usr/local; export XMLINSTALL
fi
fi
echo
rm -f config.cache
rm -f config.log
rm -f config.status
./configure
echo
echo In future, you may also directly type the following commands to create the Makefiles.
echo
echo export CC=$CC
echo export CXX=$CXX
echo export CXXFLAGS=$CXXFLAGS
echo export CFLAGS=$CFLAGS
echo export LIBS=$LIBS
echo export LDFLAGS=$LDFLAGS
echo configure
echo
echo If the result of the above commands look OK to you, go to the directory
echo ${XERCESCROOT}/tests and type \"gmake\" to make the XERCES-C system.
exit 0;