#!/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
# .
#
#
# $Log$
# Revision 1.22 2000/02/25 03:42:56 rahulj
# Changed xlC to xlC_r in the help message.
#
# Revision 1.21 2000/02/19 00:12:25 abagchi
# Corrected AS/400 platform description for configure
#
# Revision 1.20 2000/02/15 23:22:28 rahulj
# Added -L icu/data when ICU transcoding service is used. The data
# shared library file sits in the data directory and not in the usual
# lib directory.
#
# Revision 1.19 2000/02/09 22:14:15 abagchi
# AS/400 changes
#
# Revision 1.18 2000/02/08 02:37:42 abagchi
# Added Iconv390 as a transcoder option
#
# Revision 1.17 2000/02/06 07:47:26 rahulj
# Year 2K copyright swat.
#
# Revision 1.16 2000/02/05 01:07:30 rahulj
# Under Solaris for some unknown reason test -e did not work.
# Changed it to test -x.
#
# Revision 1.15 2000/02/01 23:43:03 abagchi
# AS/400 related change
#
# Revision 1.14 2000/01/20 18:37:42 aruna1
# Added compatible thread libray for AIX
#
# Revision 1.13 2000/01/05 20:52:44 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.12 1999/12/17 01:28:52 rahulj
# Merged in changes submitted for UnixWare 7 port. Platform
# specific files are still missing.
#
# Revision 1.11 1999/12/14 23:53:18 rahulj
# Removed the offending Ctrl-M's from the commit message
# logs which was giving packaging problems.
#
# Revision 1.10 1999/12/09 00:48:19 aruna1
# ICU library inclusion in ALLLIBS due to solaris failure
#
# Revision 1.9 1999/12/03 01:19:11 rahulj
# Split export statements into two. assignment and then export. Solaris is happy now
#
# Revision 1.8 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
# 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.
#
# --
# Revision 1.7 1999/12/01 17:16:16 rahulj
# Added support for IRIX 6.5.5 using SGI MIPSpro C++ 7.3 and 7.21 generating 32 bit objects. Changes submitted by Marc Stuessel
#
# Revision 1.6 1999/11/24 23:21:42 rahulj
# Now works under HPUX 10.20 with CC and aCC, with ICU and native
# distclean target now remove and remaining Makefile(s)
# clean target now removes the template repository directory
#
# Revision 1.5 1999/11/23 01:59:33 rahulj
# Code now works under HPUX 11. Tested inmemory message loader.
# Revamped makefiles. Builds with both DCE threads as well as pthread libraries.
#
# Revision 1.4 1999/11/17 22:36:33 rahulj
# Code works with ICU transcoding service
#
# Revision 1.3 1999/11/12 20:38:50 rahulj
# Replaced XML4CROOT with XERCESCROOT.
#
# Revision 1.1.1.1 1999/11/09 01:02:57 twl
# Initial checkin
#
# Revision 1.4 1999/11/08 20:44:09 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.
#
# The following variables are defined and exported at the end of this
# script.
#
# LIBS
# LDFLAGS
# CXXFLAGS
# TRANSCODER
#
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 (accepts 'aix', 'linux', 'solaris', 'hp-10', 'hp-11', 'unixware', 'os400' )"
echo " -c (e.g. gcc, cc, xlc_r, icc)"
echo " -x (e.g. g++, CC, xlC_r, icc)"
echo " -d (specifies that you want to build debug version)"
echo " -m can be 'inmem', 'icu', 'MsgFile' or 'iconv'"
echo " -n can be 'fileonly', 'libwww'"
echo " -t can be 'icu', 'Iconv400', 'Iconv390' or 'native'"
echo " -r can be 'pthread' or 'dce' (only used on HP-11)"
echo " -l "
echo " -z "
echo " -h (to 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
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=inmem # 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;;
-d)
debug=on; shift;;
-m)
msgloader=$2; shift 2;;
-n)
netaccessor=$2; shift 2;;
-t)
transcoder=$2; shift 2;;
-r)
thread=$2; shift 2;;
-l)
linkeroption=$2; shift 2;;
-z)
compileroption=$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"
echo "Extra compile options: $compileroption"
echo "Extra link options: $linkeroption"
echo "Message Loader: $msgloader"
echo "Net Accessor: $netaccessor"
echo "Transcoder: $transcoder"
echo "Thread option: $thread"
#
# Now check if the options are correct or not, bail out if incorrect
#
case $platform in
aix | linux | solaris | hp-10 | hp-11 | irix | unixware | os400)
# platform has been recognized
;;
*)
echo "I do not recognize the platform '$platform'. Please type '${0} -h' for help."
exit ${ERROR_EXIT_CODE};;
esac
#
# Enable debugging or not...
#
if test $debug = "off"; then
echo "Debug is OFF"
if test ${SYSOVR}o = "o"; then
if test $platform = "os400"; then
echo "NATIVE OS400 BUILD"
debugflag="";
else
debugflag="-O";
fi
else
echo "OVERRIDE FOR OS400 ON AIX"
debugflag="";
fi
else
echo "Debug is ON"
debugflag="-g";
fi
#
# 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
threadingLibs="-lpthreads_compat -lpthreads"
elif test $platform = "hp-10"; then
threadingLibs="-lcma"
threadingDefines="-DXML_USE_DCE"
fi
#
# Now check for what kind of transcoding service is desired.
#
transcodingDefines="-DXML_USE_NATIVE_TRANSCODER"
TRANSCODER=NATIVE
if test $transcoder; then
case $transcoder in
icu)
if test -z $ICUROOT; then
echo '***Error*** ICUROOT environment variable not defined. Exiting...';
exit ${ERROR_EXIT_CODE};
fi
transcodingDefines="-DXML_USE_ICU_TRANSCODER -I${ICUROOT}/include";
transcodingLibs="-L${ICUROOT}/lib -L${ICUROOT}/data";
TRANSCODER=ICU;;
Iconv400)
transcodingDefines="-DXML_USE_ICONV400_TRANSCODER" ;
TRANSCODER=Iconv400 ;;
Iconv390)
transcodingDefines="-DXML_USE_ICONV390_TRANSCODER" ;
TRANSCODER=Iconv390 ;;
native)
;;
*)
echo "I do not recognize the transcoder option '$transcoder'. Please type '${0} -h' for help."
exit ${ERROR_EXIT_CODE};;
esac
fi
export TRANSCODER
#
# Now check for the message loader
#
MESSAGELOADER=INMEM # By default use in-memory
msgloaderDefines="-DXML_USE_INMEM_MESSAGELOADER"
if test $msgloader ; then
case $msgloader in
icu)
if test -z $ICUROOT ; then
echo '***Error*** ICUROOT environment variable not defined. Exiting...';
exit ${ERROR_EXIT_CODE};
fi
MESSAGELOADER=ICU;
msgloaderDefines="-DXML_USE_ICU_MESSAGELOADER" ;;
inmem)
;;
MsgFile)
MESSAGELOADER=MSGFILE;
msgloaderDefines="-DXML_USE_MSGFILE_MESSAGELOADER" ;;
iconv)
MESSAGELOADER=ICONV;
msgloaderDefines="-DXML_USE_ICONV_MESSAGELOADER" ;;
*)
echo "I do not recognize the message loader option '$msgloader'. Please type '${0} -h' for help.";
exit ${ERROR_EXIT_CODE};;
esac
fi
export MESSAGELOADER
#
# Check for the type of net accessor
#
USELIBWWW=0; # By default use file-only
if test $netaccessor ; then
case $netaccessor in
fileonly)
netaccessorDefines="" ;;
libwww)
if test -z ${LIBWWWROOT} ; then
echo "You have not defined your LIBWWWROOT environment variable. Cannot proceed further ..."
exit ${ERROR_EXIT_CODE};
fi
netaccessorDefines="-DXML_USE_NETACCESSOR_LIBWWW -I${LIBWWWROOT}/include" ;
netaccessorLibs="-L${LIBWWWROOT}/lib -lwww";
USELIBWWW=1;;
*)
echo "I do not recognize the netaccessor option '$netaccessor'. Please type '${0} -h' for help."
exit ${ERROR_EXIT_CODE};;
esac
fi
export USELIBWWW
#
# Set the C compiler and C++ compiler environment variables
#
case $cppcompiler in
xlC | xlc | xlC_r | xlc_r | g++ | c++ | cc | CC | aCC | icc | ICC)
;;
*)
echo "I do not recognize the C++ compiler '$cppcompiler'. Continuing anyway ..."
;;
esac
CC="$ccompiler"
export CC
CXX="$cppcompiler"
export CXX
#
# Set the extra C and C++ compiler flags
#
CXXFLAGS="$debugflag $transcodingDefines $msgloaderDefines $threadingDefines $netaccessorDefines"
export CXXFLAGS
CFLAGS="$debugflag $transcodingDefines $msgloaderDefines $threadingDefines $netaccessorDefines"
export CFLAGS
LIBS="$transcodingLibs $threadingLibs $netaccessorLibs"
export LIBS
echo
rm -f config.cache
rm -f config.log
rm -f config.status
if test $platform = "os400"; then
./configure --host AS400-OS400
else
./configure
fi
echo
echo In future, you may also directly type the following commands to create the Makefiles.
echo
echo export TRANSCODER=$TRANSCODER
echo export MESSAGELOADER=$MESSAGELOADER
echo export USELIBWWW=$USELIBWWW
echo export CC=$CC
echo export CXX=$CXX
echo export CXXFLAGS=$CXXFLAGS
echo export CFLAGS=$CFLAGS
echo export LIBS=$LIBS
echo configure
echo
echo If the result of the above commands look OK to you, go to the directory
echo ${XERCESCROOT}/src and type \"gmake\" to make the XERCES-C system.
exit 0;