blob: f634e975c0747da39bae341d4530e6a4c82fe175 [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.12 2000/04/12 20:32:54 abagchi
# Included some more PTX changes
#
# Revision 1.11 2000/04/04 21:34:50 abagchi
# Added PTX support
#
# Revision 1.10 2000/04/03 19:27:38 abagchi
# Included changes for SGI IRIX 6.5
#
# Revision 1.9 2000/02/19 00:21:04 abagchi
# Changed AS400 to AS400-OS400
#
# Revision 1.8 2000/02/09 22:05:52 abagchi
# AS/400 change
#
# Revision 1.7 2000/02/06 07:47:16 rahulj
# Year 2K copyright swat.
#
# Revision 1.6 2000/02/05 01:07:29 rahulj
# Under Solaris for some unknown reason test -e did not work.
# Changed it to test -x.
#
# Revision 1.5 2000/02/01 18:49:08 aruna1
# updated instructions
#
# Revision 1.4 2000/01/05 20:52:16 abagchi
# Added a few echo statements to clarify what is actually happening
# inside runConfigure. There were a few questions on why we need this
# wrapper script. We don't, it's just a convenience.
# PR:
# Obtained from:
# Submitted by:
# Reviewed by:
#
# Revision 1.3 1999/12/02 18:10:51 dirkx
# Changed exit codes from -1 to '1'. Added indirection.
#
# Date: Thu, 2 Dec 1999 17:47:39 +0000
# From: Jonathan McDowell <noodles@earth.li>
# Reply-To: xerces-dev@xml.apache.org
# To: xerces-dev@xml.apache.org, rahulj@apache.org
# Subject: Re: runConfigure script & bash
#
#
# On Mon, Nov 29, 1999 at 10:29:13AM -0800, Rahul Jain wrote:
#
# > > I'm quite happy to produce a patch that makes it work under both
# > > FreeBSD's sh and bash - I would assume this would work under most sh
# > > like shells.
# > Please post the changes for FreeBSD and I will test the changes on
# > other unix's and do the integration.
#
# I sat down to do this today and found that it can be trivially fixed by
# changing all the "exit -1" instances to "exit 1" - it seems the /bin/sh
# with FreeBSD doesn't like negative result codes. It seems a bit
# pointless to submit a patch for this, so can someone with CVS access
# change this please?
#
# J.
#
# --
#
# PR:
# Obtained from:
# Submitted by:
# Reviewed by:
#
# Revision 1.2 1999/11/12 19:12:40 abagchi
# Changed instances of XML4CROOT to XERCESCROOT
#
# Revision 1.1.1.1 1999/11/09 01:09:26 twl
# Initial checkin
#
# Revision 1.4 1999/11/08 20:43:34 rahul
# Swat for adding in Product name and CVS comment log variable.
#
#
#
# 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', 'linux', 'solaris',
'hp-10', 'hp-11', 'os400', 'irix', 'ptx')"
echo " -c <C compiler name> (e.g. gcc, xlc or icc)"
echo " -x <C++ compiler name> (e.g. g++, xlC, or icc)"
echo " -d (specifies that you want to build debug version)"
echo " -h (get help on the above commands)"
echo " -z <extra compiler options>"
}
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
if test -x /usr/bin/getopt; then
set -- `getopt p:c:x:dm:n:t:r:l:z:h $*`
else
set -- `getopts p:c:x:dm:n:t:r:l:z:h `$*``
fi
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
compileroptions=""
for i in $*
do
case $i in
-p)
platform=$2; shift 2;;
-c)
ccompiler=$2; shift 2;;
-x)
cppcompiler=$2; shift 2;;
-d)
debug=on; shift;;
-z)
compileroptions="$compileroptions $2"; shift 2;;
-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"
if test $debug = "off"; then
echo "Debug is OFF"
if test $platform = "os400"; then
debugflag="-O";
else
debugflag="-w -O";
fi
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 | linux | solaris | hp-10 | hp-11 | os400 | irix | ptx)
# 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
CC=$ccompiler; export CC
CXX=$cppcompiler; export CXX
case $cppcompiler in
xlC | xlc | xlC_r | xlc_r)
LDFLAGS="-lC"; export LDFLAGS
LIBS="-L/usr/lpp/xlC/lib"; export LIBS ;;
g++ | c++)
LDFLAGS="-lc"; export LDFLAGS
if test $platform = "ptx"; then
if test -z $XMLINSTALL; then
XMLINSTALL=$ICUROOT
fi
LIBS="-L$XMLINSTALL/lib";
else
LIBS="-L/usr/local/lib";
fi
export LIBS ;;
cc | CC)
LDFLAGS="-lC"; export LDFLAGS
if test $platform = "irix"; then
LIBS=""; export LIBS
else
LIBS="-L/usr/lib -L/usr/ccs/lib"; export LIBS
fi ;;
acc | aCC)
LDFLAGS="-lC"; export LDFLAGS
LIBS="-L/usr/lib -L/opt/aCC/lib"; export LIBS ;;
icc | ICC)
;;
*)
echo "I do not recognize the C++ compiler '$cppcompiler'. Continuing anyway ..."
;;
esac
# Set the extra C and C++ compiler flags
CXXFLAGS="$compileroptions $debugflag $compileroption"; export CXXFLAGS
CFLAGS="$compileroptions $debugflag $compileroption"; export CFLAGS
echo
rm -f config.cache
rm -f config.log
rm -f config.status
if test $platform = "os400"; then
./configure --host AS400-OS400
elif test $platform = "ptx"; then
./configure --prefix=$XMLINSTALL
else
./configure
fi
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}/samples and type \"gmake\" to make the samples.
exit 0;