runConfigure
上传用户:huihehuasu
上传日期:2007-01-10
资源大小:6948k
文件大小:16k
源码类别:

xml/soap/webservice

开发平台:

C/C++

  1. #!/bin/sh
  2. #
  3. # The Apache Software License, Version 1.1
  4. #
  5. # Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  6. # reserved.
  7. #
  8. # Redistribution and use in source and binary forms, with or without
  9. # modification, are permitted provided that the following conditions
  10. # are met:
  11. #
  12. # 1. Redistributions of source code must retain the above copyright
  13. #    notice, this list of conditions and the following disclaimer.
  14. #
  15. # 2. Redistributions in binary form must reproduce the above copyright
  16. #    notice, this list of conditions and the following disclaimer in
  17. #    the documentation and/or other materials provided with the
  18. #    distribution.
  19. #
  20. # 3. The end-user documentation included with the redistribution,
  21. #    if any, must include the following acknowledgment:
  22. #       "This product includes software developed by the
  23. #        Apache Software Foundation (http://www.apache.org/)."
  24. #    Alternately, this acknowledgment may appear in the software itself,
  25. #    if and wherever such third-party acknowledgments normally appear.
  26. #
  27. # 4. The names "Xerces" and "Apache Software Foundation" must
  28. #    not be used to endorse or promote products derived from this
  29. #    software without prior written permission. For written
  30. #    permission, please contact apache@apache.org.
  31. #
  32. # 5. Products derived from this software may not be called "Apache",
  33. #    nor may "Apache" appear in their name, without prior written
  34. #    permission of the Apache Software Foundation.
  35. #
  36. # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  37. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  38. # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. # DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  40. # ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  43. # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  44. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  45. # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  46. # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  47. # SUCH DAMAGE.
  48. # ====================================================================
  49. #
  50. # This software consists of voluntary contributions made by many
  51. # individuals on behalf of the Apache Software Foundation, and was
  52. # originally based on software copyright (c) 1999, International
  53. # Business Machines, Inc., http://www.ibm.com .  For more information
  54. # on the Apache Software Foundation, please see
  55. # <http://www.apache.org/>.
  56. #
  57. #
  58. # $Id: runConfigure,v 1.49 2001/12/06 14:35:26 tng Exp $
  59. #
  60. #
  61. #
  62. # runConfigure:
  63. #    This script will run the "configure" script for the appropriate
  64. #    platform. Only supported platforms are recognized.
  65. #
  66. # The following variables are defined and exported at the end of this
  67. # script.
  68. #
  69. # LIBS
  70. # LDFLAGS
  71. # CXXFLAGS
  72. # TRANSCODER
  73. #
  74. usage()
  75. {
  76.     echo "runConfigure: Helper script to run "configure" for one of the supported platforms"
  77.     echo "Usage: runConfigure "options""
  78.     echo "       where options may be any of the following:"
  79.     echo "       -p <platform> (accepts 'aix', 'linux', 'freebsd', 'solaris',
  80.             'hp-10', 'hp-11', 'unixware', 'os400', 'irix', 'ptx', 'tru64', 'macosx' )"
  81.     echo "       -c <C compiler name> (e.g. gcc, cc, xlc_r, icc)"
  82.     echo "       -x <C++ compiler name> (e.g. g++, CC, xlC_r, icc, c++)"
  83.     echo "       -d (specifies that you want to build debug version)"
  84.     echo "       -m <message loader> can be 'inmem', 'icu', 'MsgFile' or 'iconv'"
  85.     echo "       -n <net accessor> can be 'fileonly', 'libwww', 'socket' or 'native'"
  86.     echo "       -t <transcoder> can be 'icu', 'Iconv400', 'Iconv390', 'IconvFBSD' or 'native'"
  87.     echo "       -r <thread option> can be 'pthread' or 'dce' (only used on aix, HP-11 and solaris) or 'sproc' (only on IRIX) or 'none'"
  88.     echo "       -l <extra linker options>"
  89.     echo "       -z <extra compiler options>"
  90.     echo "       -P <install-prefix>"
  91.     echo "       -C <any one extra configure options>"
  92.     echo "       -h (to get help on the above commands)"
  93. }
  94. ERROR_EXIT_CODE=1
  95. if test ${1}o = "o"; then
  96.    usage
  97.    exit ${ERROR_EXIT_CODE}
  98. fi
  99. if test ${XERCESCROOT}o = "o"; then
  100.    echo ERROR : You have not set your XERCESCROOT environment variable
  101.    echo Though this environment variable has nothing to do with creating makefiles,
  102.    echo this is just a general warning to prevent you from pitfalls in future. Please
  103.    echo set an environment variable called XERCESCROOT to indicate where you installed
  104.    echo the XERCES-C files, and run this command again to proceed. See the documentation
  105.    echo for an example if you are still confused.
  106.    exit ${ERROR_EXIT_CODE}
  107. fi
  108. if test $1 = "-h"; then
  109.    usage
  110.    exit ${ERROR_EXIT_CODE}
  111. fi
  112. # Check the command line parameters
  113. if test -x /usr/bin/getopt; then
  114. getoptErr=`getopt p:c:x:dm:n:t:r:l:z:P:C:h $*`
  115. else
  116. getoptErr=`getopts p:c:x:dm:n:t:r:l:z:P:C:h `$*``
  117. fi
  118. if [ $? != 0 ]
  119.    then
  120.    usage
  121.    exit ${ERROR_EXIT_CODE}
  122. fi
  123. # Now get the command line parameters
  124. if test -x /usr/bin/getopt; then
  125. set -- `getopt p:c:x:dm:n:t:r:l:z:P:C:h $*`
  126. else
  127. set -- `getopts p:c:x:dm:n:t:r:l:z:P:C:h `$*``
  128. fi
  129. # Set up the default values for each parameter
  130. debug=off                # by default debug is off
  131. transcoder=native        # by default use native transcoder
  132. msgloader=inmem          # by default use inmem message loader
  133. netaccessor=socket       # by default use socket (can do HTTP URL's)
  134. thread=pthread           # by default use POSIX threads
  135. configureoptions=""
  136. while [ $# -gt 0 ]
  137.    do
  138.    case $1 in
  139.    -p)
  140.         platform=$2; shift 2;;
  141.    -c)
  142.         ccompiler=$2; shift 2;;
  143.    -x)
  144.         cppcompiler=$2; shift 2;;
  145.    -d)
  146.         debug=on; shift;;
  147.    -m)
  148.         msgloader=$2; shift 2;;
  149.    -n)
  150.         netaccessor=$2; shift 2;;
  151.    -t)
  152.         transcoder=$2; shift 2;;
  153.    -r)
  154.         thread=$2; shift 2;;
  155.    -l)
  156.         linkeroptions="$linkeroptions $2"; shift 2;;
  157.    -z)
  158.         compileroptions="$compileroptions $2"; shift 2;;
  159.    -P)
  160.         configureoptions="$configureoptions --prefix=$2"; shift 2;;
  161.    -C)
  162.         configureoptions="$configureoptions $2"; shift 2;;
  163.    -h)
  164.         usage
  165.         exit ${ERROR_EXIT_CODE};;
  166.    --)
  167.         shift; break;;
  168.    *)
  169.        echo "unknown option $1"
  170.        usage
  171.        exit ${ERROR_EXIT_CODE};;
  172.    esac
  173. done
  174. echo "Generating makefiles with the following options ..."
  175. echo "Platform: $platform"
  176. echo "C Compiler: $ccompiler"
  177. echo "C++ Compiler: $cppcompiler"
  178. echo "Extra compile options: $compileroptions"
  179. echo "Extra link options: $linkeroptions"
  180. echo "Message Loader: $msgloader"
  181. echo "Net Accessor: $netaccessor"
  182. echo "Transcoder: $transcoder"
  183. echo "Thread option: $thread"
  184. echo "Extra configure options: $configureoptions"
  185. #
  186. # Now check if the options are correct or not, bail out if incorrect
  187. #
  188. case $platform in
  189.    aix | linux | freebsd | solaris | hp-10 | hp-11 | irix | unixware | os400 | ptx | tru64 | macosx)
  190.        # platform has been recognized
  191.        ;;
  192.    *)
  193.       echo "I do not recognize the platform '$platform'. Please type '${0} -h' for help."
  194.       exit ${ERROR_EXIT_CODE};;
  195. esac
  196. #
  197. # Enable debugging or not...
  198. #
  199. if test $debug = "off"; then
  200.     echo "Debug is OFF"
  201.     if test ${SYSOVR}o = "o"; then
  202.       if test $platform = "os400"; then
  203.          echo "NATIVE OS400 BUILD"
  204.          debugflag="";
  205.       elif test $platform = "irix"; then
  206.          debugflag="-O2";
  207.       elif test $platform = "aix"; then
  208.          debugflag="-O2";
  209.       else
  210.          debugflag="-O";
  211.       fi
  212.     else
  213.       echo "OVERRIDE FOR OS400 ON AIX"
  214.       debugflag="";
  215.     fi
  216. else
  217.     echo "Debug is ON"
  218.     debugflag="-g";
  219. fi
  220. #
  221. # Check for the threading option
  222. #
  223. if test $thread = "none"; then
  224.     THREADS=none
  225.     threadingLibs=""
  226.     threadingDefines="-DAPP_NO_THREADS -DXML_USE_NO_THREADS"
  227. else
  228.     THREADS=pthread
  229.     threadingDefines="-DXML_USE_PTHREADS"
  230.     threadingLibs="-lpthread"
  231.     if test $platform = "hp-11"; then
  232.         if test $thread; then
  233.         case $thread in
  234.            pthread)
  235.                ;;
  236.            dce)
  237.                THREADS=dce ;
  238.                threadingLibs="-lcma" ;
  239.                threadingDefines="-D_PTHREADS_DRAFT4 -D_THREAD_SAFE -DXML_USE_DCE" ;;
  240.            *)
  241.                echo "I do not recognize the thread option '$thread'. Please type '${0} -h' for help." ;
  242.                exit ${ERROR_EXIT_CODE};;
  243.         esac
  244.         fi
  245.     elif test $platform = "freebsd"; then
  246. threadingLibs="-pthread -lc_r"
  247. threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
  248.     elif test $platform = "aix"; then
  249.         aix_version=`./config.guess`;
  250.         echo Found host system to be $aix_version
  251.         case $aix_version in
  252.            *4.3*)
  253.               ## Linkflags control the use of libpthreads on AIX
  254.               threadingLibs="-lpthreads_compat";;
  255.            *)
  256.               threadingLibs="-lpthreads";;
  257.         esac
  258.         if test $thread; then
  259.         case $thread in
  260.            pthread)
  261.                ;;
  262.            dce)
  263.                THREADS=dce ;
  264.                threadingDefines="-DXML_USE_DCE"
  265.                case $aix_version in
  266.                   *4.3*)
  267.                      ## Linkflags control the use of libpthreads on AIX
  268.                      threadingLibs="-ldcelibc_r -ldcepthreads -lpthreads_compat";;
  269.                   *)
  270.                      threadingLibs="-lC_r -lC -ldcelibc_r -ldcepthreads";;
  271.                esac
  272.                ;;
  273.            *)
  274.                echo "I do not recognize the thread option '$thread'. Please type '${0} -h' for help." ;
  275.                exit ${ERROR_EXIT_CODE};;
  276.         esac
  277.         fi
  278.     elif test $platform = "ptx"; then
  279.         threadingLibs=" "
  280.         if test -z $XMLINSTALL; then
  281.             XMLINSTALL=$ICUROOT         ## use either the -C or the -P option now.
  282.         fi
  283.     elif test $platform = "hp-10"; then
  284.         THREADS=dce
  285.         threadingLibs="-lcma"
  286.         threadingDefines="-DXML_USE_DCE"
  287.     elif test $platform = "unixware"; then
  288.         threadingLibs="" ## Linkflags control the use of threads on UnixWare
  289.     elif test $platform = "solaris"; then
  290.         if test $thread; then
  291.         case $thread in
  292.            pthread)
  293.                ;;
  294.            dce)
  295.                THREADS=dce ;
  296.                threadingLibs="-ldce";
  297.                threadingDefines="-DXML_USE_DCE";;
  298.            *)
  299.                echo "I do not recognize the thread option '$thread'. Please type '${0} -h' for help."
  300.                exit ${ERROR_EXIT_CODE};;
  301.         esac
  302.         fi
  303.     elif test $platform = "irix"; then
  304.         if test $thread; then
  305.         case $thread in
  306.         pthread)
  307.             ;;
  308.         sproc)
  309.             threadingLibs=" ";
  310.             threadingDefines="-DXML_USE_SPROC" ;;
  311.         *)
  312.            echo "I do not recognize the thread option '$thread'. Please type '${0} -h' for help."
  313.             exit ${ERROR_EXIT_CODE};;
  314.         esac
  315.         fi
  316.     fi
  317. fi
  318. export THREADS
  319. #
  320. # Now check for what kind of transcoding service is desired.
  321. #
  322. transcodingDefines="-DXML_USE_NATIVE_TRANSCODER"
  323. TRANSCODER=NATIVE
  324. if test $transcoder; then
  325. case $transcoder in
  326.    icu)
  327.        if test ${ICUROOT}o = "o"; then
  328.            echo '***Error*** ICUROOT environment variable not defined. Exiting...';
  329.            exit ${ERROR_EXIT_CODE};
  330.        fi
  331.        transcodingDefines="-DXML_USE_ICU_TRANSCODER -I${ICUROOT}/include";
  332.        transcodingLibs="-L${ICUROOT} -L${ICUROOT}/lib -L${ICUROOT}/data";
  333.        TRANSCODER=ICU;;
  334.    Iconv400)
  335.        transcodingDefines="-DXML_USE_ICONV400_TRANSCODER" ;
  336.        TRANSCODER=Iconv400 ;;
  337.    Iconv390)
  338.        transcodingDefines="-DXML_USE_ICONV390_TRANSCODER" ;
  339.        TRANSCODER=Iconv390 ;;
  340.    IconvFBSD)
  341.        TRANSCODER=IconvFBSD ;;
  342.    native)
  343.        ;;
  344.    *)
  345.       echo "I do not recognize the transcoder option '$transcoder'. Please type '${0} -h' for help."
  346.       exit ${ERROR_EXIT_CODE};;
  347. esac
  348. fi
  349. export TRANSCODER
  350. #
  351. # Now check for the message loader
  352. #
  353. MESSAGELOADER=INMEM         # By default use in-memory
  354. msgloaderDefines="-DXML_USE_INMEM_MESSAGELOADER"
  355. if test $msgloader ; then
  356. case $msgloader in
  357.    icu)
  358.        if test ${ICUROOT}o = "o" ; then
  359.            echo '***Error*** ICUROOT environment variable not defined. Exiting...';
  360.            exit ${ERROR_EXIT_CODE};
  361.        fi
  362.        MESSAGELOADER=ICU;
  363.        msgloaderDefines="-DXML_USE_ICU_MESSAGELOADER" ;;
  364.    inmem)
  365.        ;;
  366.    MsgFile)
  367.        MESSAGELOADER=MSGFILE;
  368.        msgloaderDefines="-DXML_USE_MSGFILE_MESSAGELOADER" ;;
  369.    iconv)
  370.        MESSAGELOADER=ICONV;
  371.        msgloaderDefines="-DXML_USE_ICONV_MESSAGELOADER" ;;
  372.    *)
  373.       echo "I do not recognize the message loader option '$msgloader'. Please type '${0} -h' for help.";
  374.       exit ${ERROR_EXIT_CODE};;
  375. esac
  376. fi
  377. export MESSAGELOADER
  378. #
  379. # Check for the type of net accessor
  380. #
  381. NETACCESSOR=Socket               # By default use socket (does HTTP URL's)
  382. if test $netaccessor ; then
  383. case $netaccessor in
  384.    fileonly)
  385.        NETACCESSOR=FileOnly
  386.        netaccessorDefines="" ;;
  387.    socket)
  388.        NETACCESSOR=Socket
  389.        netaccessorDefines="-DXML_USE_NETACCESSOR_SOCKET"
  390.        case $platform in
  391.            unixware)
  392.                netaccessorLibs="-lnsl -lsocket";;
  393.            hp-11)
  394.                netaccessorLibs="-lnsl";;
  395.            aix)
  396.                netaccessorLibs="-lbsd";;
  397.            solaris)
  398.                netaccessorLibs="-lnsl -lsocket"
  399.              if test $thread = "dce"; then
  400.                  netaccessorLibs=""
  401.              fi
  402.              ;;
  403.            *)
  404.                ;;
  405.        esac;;
  406.    libwww)
  407.        NETACCESSOR=LibWWW
  408.        if test -z "`libwww-config --libs 2>/dev/null`" ; then
  409.            echo "Netaccessor is libwww, but libwww-config is not found. Cannot proceed further."
  410.            exit ${ERROR_EXIT_CODE};
  411.        fi
  412.        netaccessorDefines="-DXML_USE_NETACCESSOR_LIBWWW `libwww-config --cflags`"
  413.        netaccessorLibs="`libwww-config --libs`"
  414.        USELIBWWW=1;;
  415.    native)
  416.        NETACCESSOR=NATIVE
  417.        netaccessorDefines="-DXML_USE_NETACCESSOR_NATIVE"
  418.        netaccessorLibs=""
  419.        ;;
  420.    *)
  421.        echo "I do not recognize the netaccessor option '$netaccessor'. Please type '${0} -h' for help."
  422.        exit ${ERROR_EXIT_CODE};;
  423. esac
  424. fi
  425. export NETACCESSOR
  426. #
  427. # Set the C compiler and C++ compiler environment variables
  428. #
  429. case $cppcompiler in
  430.    xlC* | xlc* | g++ | c++ | cc | CC | aCC | icc | ICC | cxx)
  431.       ;;
  432.    *)
  433.       echo "I do not recognize the C++ compiler '$cppcompiler'. Continuing anyway ..."
  434.       ;;
  435. esac
  436. CC="$ccompiler"
  437. export CC
  438. CXX="$cppcompiler"
  439. export CXX
  440. #
  441. # Set the extra C and C++ compiler flags
  442. #
  443. CXXFLAGS="$compileroptions $debugflag $transcodingDefines $msgloaderDefines $threadingDefines $netaccessorDefines"
  444. export CXXFLAGS
  445. CFLAGS="$compileroptions $debugflag $transcodingDefines $msgloaderDefines $threadingDefines $netaccessorDefines"
  446. export CFLAGS
  447. # gcc crashes if optimisation is turned on in a Tru64 environment
  448. if [ $platform = "tru64" -a $CXX = "g++" ]; then
  449.     CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]*//g'`
  450.     CFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]*//g'`
  451.     export CXXFLAGS CFLAGS
  452. fi
  453. LDFLAGS="$linkeroptions"
  454. export LDFLAGS
  455. LIBS="$transcodingLibs $threadingLibs $netaccessorLibs"
  456. export LIBS
  457. echo
  458. rm -f config.cache
  459. rm -f config.log
  460. rm -f config.status
  461. if test $platform = "os400"; then
  462. ./configure --host AS400-OS400 $configureoptions
  463. elif test $platform = "ptx"; then
  464. ./configure --prefix=$XMLINSTALL
  465. else
  466. sh ./configure $configureoptions
  467. fi
  468. # exit if configure failed
  469. if test $? != 0; then
  470.   exit 1
  471. fi
  472. echo
  473. echo In future, you may also directly type the following commands to create the Makefiles.
  474. echo
  475. echo export TRANSCODER="$TRANSCODER"
  476. echo export MESSAGELOADER="$MESSAGELOADER"
  477. echo export NETACCESSOR="$NETACCESSOR"
  478. echo export THREADS="$THREADS"
  479. echo export CC="$CC"
  480. echo export CXX="$CXX"
  481. echo export CXXFLAGS="$CXXFLAGS"
  482. echo export CFLAGS="$CFLAGS"
  483. echo export LDFLAGS="$LDFLAGS"
  484. echo export LIBS="$LIBS"
  485. echo configure $configureoptions
  486. echo
  487. echo If the result of the above commands look OK to you, go to the directory
  488. echo ${XERCESCROOT}/src and type "gmake" to make the XERCES-C system.
  489. exit  0;