home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2240.zip / wxWindows-2.4.0 / wx-config.in < prev    next >
Text File  |  2002-09-24  |  5KB  |  178 lines

  1. #!/bin/sh
  2.  
  3. prefix=@prefix@
  4. exec_prefix=@exec_prefix@
  5. exec_prefix_set=no
  6. CC="@CC@"
  7. GCC="@GCC@"
  8. CXX="@CXX@"
  9. LD="@SHARED_LD@"
  10. cross_compiling=@cross_compiling@
  11. target=@host_alias@
  12. static_flag=@STATIC_FLAG@
  13. inplace_flag=no
  14.  
  15. usage()
  16. {
  17.     cat <<EOF
  18. Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--static]
  19.                  [--libs] [--gl-libs]
  20.                  [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags]
  21.                  [--cc] [--cxx] [--ld]
  22.                  [--inplace]
  23.  
  24. wx-config returns configuration information about the installed
  25. version of wxWindows. It may be used to query its version and
  26. installation directories and also retrieve the C and C++ compilers
  27. and linker which were used for its building and the corresponding
  28. flags.
  29.  
  30. The --inplace flag allows wx-config to be used from the wxWindows
  31. build directory and output flags to use the uninstalled version of
  32. the headers and libs in the build directory.  (Currently configure
  33. must be invoked via a full path name for this to work correctly.)
  34. EOF
  35.  
  36.     exit $1
  37. }
  38.  
  39. cppflags()
  40. {
  41.     # we should never specify -I/usr/include on the compiler command line: this
  42.     # is at best useless and at worst breaks compilation on the systems where
  43.     # the system headers are non-ANSI because gcc works around this by storing
  44.     # the ANSI-fied versions of them in its private directory which is searched
  45.     # after all the directories on the cmd line.
  46.     #
  47.     # the situation is a bit more complicated with -I/usr/local/include: again,
  48.     # it shouldn't be specified with gcc which looks there by default anyhow
  49.     # and gives warnings (at least 3.1 does) if it is specified explicitly --
  50.     # but this -I switch *is* needed for the other compilers
  51.     #
  52.     # note that we assume that if we use GNU cc we also use GNU c++ and vice
  53.     # versa, i.e. this won't work (either for --cflags or --cxxflags) if GNU C
  54.     # compiler and non-GNU C++ compiler are used or vice versa -- we'll fix
  55.     # this when/if anybody complains about it
  56.     if test "@includedir@" != "/usr/include" \
  57.             -a "@includedir@" != "/usr/include/c++" \
  58.             -a \( "${GCC}" != "yes" \
  59.                   -o "@includedir@" != "/usr/local/include" \) \
  60.             -a \( "${cross_compiling}" != "yes" \
  61.                   -o "@includedir@" != "/usr/${target}/include" \) ;
  62.     then
  63.         includes=" -I@includedir@"
  64.     fi
  65.  
  66.     if test $inplace_flag = yes ; then
  67.     includes="-I$inplace_builddir/lib/wx/include/@TOOLCHAIN_NAME@ -I$inplace_include"
  68.     else
  69.     includes="-I@libdir@/wx/include/@TOOLCHAIN_NAME@$includes"
  70.     fi
  71.  
  72.     if test $static_flag = yes ; then
  73.         echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@
  74.     else
  75.         echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @TOOLCHAIN_DLL_DEFS@ @WXCONFIG_INCLUDE@ @WX_LARGEFILE_FLAGS@
  76.     fi
  77. }
  78.  
  79. if test $# -eq 0; then
  80.     usage 1 1>&2
  81. fi
  82.  
  83. while test $# -gt 0; do
  84.   case "$1" in
  85.   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  86.   *) optarg= ;;
  87.   esac
  88.  
  89.   case $1 in
  90.     --prefix=*)
  91.       prefix=$optarg
  92.       if test $exec_prefix_set = no ; then
  93.         exec_prefix=$optarg
  94.       fi
  95.       ;;
  96.     --prefix)
  97.       echo $prefix
  98.       ;;
  99.     --exec-prefix=*)
  100.       exec_prefix=$optarg
  101.       exec_prefix_set=yes
  102.       ;;
  103.     --exec-prefix)
  104.       echo $exec_prefix
  105.       ;;
  106.     --version)
  107.       echo @WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@.@WX_RELEASE_NUMBER@
  108.       ;;
  109.     --static)
  110.       static_flag=yes
  111.       ;;
  112.     --cppflags)
  113.       cppflags
  114.       ;;
  115.     --cflags)
  116.       echo `cppflags` @CODE_GEN_FLAGS@
  117.       ;;
  118.     --cxxflags)
  119.       echo `cppflags` @CODE_GEN_FLAGS@ @CODE_GEN_FLAGS_CXX@
  120.       ;;
  121.     --ldflags)
  122.       echo @LDFLAGS_EXE@
  123.       ;;
  124.     --rezflags)
  125.       echo @LIBWXMACRESWXCONFIG@
  126.       ;;
  127.     --libs)
  128.       if test "@libdir@" != "/usr/lib" \
  129.               -a \( "${cross_compiling}" != "yes" \
  130.                     -o "@libdir@" != "/usr/${target}/lib" \) ;
  131.       then
  132.           libs="-L@libdir@"
  133.       fi
  134.  
  135.       if test $inplace_flag = yes ; then
  136.       libs="-L$inplace_builddir/lib"
  137.       fi
  138.  
  139.       if test $static_flag = yes ; then
  140.           echo "$libs @LDFLAGS@ @WXCONFIG_RPATH@ @libdir@/@WXCONFIG_LIBS_STATIC@ @LIBS@ @DMALLOC_LIBS@"
  141.       else
  142.           echo $libs @LDFLAGS@ @WXCONFIG_RPATH@ @WXCONFIG_LIBS@ @DMALLOC_LIBS@
  143.       fi
  144.  
  145.       ;;
  146.     --gl-libs)
  147.       if test $static_flag = yes -a "x" != "x@WXCONFIG_LIBS_STATIC_GL@" ; then
  148.           gllibs="@libdir@/@WXCONFIG_LIBS_STATIC_GL@"
  149.       else
  150.           gllibs="@WXCONFIG_LIBS_GL@"
  151.       fi
  152.       if test $inplace_flag = yes ; then
  153.       libdir="-L$inplace_builddir/lib"
  154.       fi
  155.       echo @LDFLAGS_GL@ $libdir $gllibs
  156.       ;;
  157.     --cc)
  158.       echo $CC
  159.       ;;
  160.     --cxx)
  161.       echo $CXX
  162.       ;;
  163.     --ld)
  164.       echo $LD
  165.       ;;
  166.     --inplace)
  167.       inplace_flag=yes
  168.       inplace_builddir=`dirname $0`
  169.       inplace_include=@top_srcdir@/include
  170.       ;;
  171.     *)
  172.       usage 1 1>&2
  173.       ;;
  174.   esac
  175.   shift
  176. done
  177.  
  178.