home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 March / PCWELT_3_2006.ISO / base / 05_common.mo / usr / bin / libwmf-config < prev    next >
Encoding:
Text File  |  2005-06-09  |  2.3 KB  |  139 lines

  1. #!/bin/sh
  2.  
  3. exec_prefix_set=no
  4.  
  5. case `uname` in
  6.   CYGWIN*)
  7.     prefix=`bash -c "type -p libwmf-config"`
  8.     prefix=`dirname $prefix`
  9.     prefix=`dirname $prefix`
  10.     prefix=`cygpath -m "$prefix"`
  11.     exec_prefix="$prefix"
  12.   ;;
  13.   *)
  14.     prefix=/usr
  15.     exec_prefix=${prefix}
  16.   ;;
  17. esac
  18.  
  19. usage()
  20. {
  21.     cat <<EOF
  22. Usage: libwmf-config [OPTIONS] [LIBRARIES]
  23. Options:
  24.     [--prefix[=DIR]]
  25.     [--exec-prefix[=DIR]]
  26.     [--version]
  27.     [--libs]
  28.     [--cflags]
  29. Libraries/Headers:
  30.     gd
  31.     wmf
  32. EOF
  33.     exit $1
  34. }
  35.  
  36. if test $# -eq 0; then
  37.     usage 1 1>&2
  38. fi
  39.  
  40. lib_gd=no
  41. lib_wmf=yes
  42.  
  43. while test $# -gt 0; do
  44.   case "$1" in
  45.   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  46.   *) optarg= ;;
  47.   esac
  48.  
  49.   case $1 in
  50.     --prefix=*)
  51.       prefix=$optarg
  52.       if test $exec_prefix_set = no ; then
  53.         exec_prefix=$optarg
  54.       fi
  55.       ;;
  56.     --prefix)
  57.       echo_prefix=yes
  58.       ;;
  59.     --exec-prefix=*)
  60.       exec_prefix=$optarg
  61.       exec_prefix_set=yes
  62.       ;;
  63.     --exec-prefix)
  64.       echo_exec_prefix=yes
  65.       ;;
  66.     --version)
  67.       echo 0.2.8
  68.       ;;
  69.     --cflags)
  70.       echo_cflags=yes
  71.       ;;
  72.     --libs)
  73.       echo_libs=yes
  74.       ;;
  75.     gd)
  76.       lib_gd=yes
  77.       ;;
  78.     wmf)
  79.       lib_wmf=yes
  80.       ;;
  81.     *)
  82.       usage 1 1>&2
  83.       ;;
  84.   esac
  85.   shift
  86. done
  87.  
  88. if test "$echo_prefix" = "yes"; then
  89.     echo $prefix
  90. fi
  91.  
  92. if test "$echo_exec_prefix" = "yes"; then
  93.     echo $exec_prefix
  94. fi
  95.  
  96. wmf_cflags="-I/usr/include/freetype2   -I/usr/X11R6/include"
  97. wmf_liblflags="  -lfreetype -lz  -L/usr/X11R6/lib  -lSM -lICE -lX11  -lexpat -ljpeg -lpng -lz -lm"
  98.  
  99. case `uname` in
  100.   CYGWIN*)
  101.     wmf_cflags=`echo $wmf_cflags | sed -e "s%/usr%$prefix%"`
  102.     wmf_liblflags=`echo $wmf_liblflags | sed -e "s%/usr%$prefix%"`
  103.   ;;
  104. esac
  105.  
  106. libwmf_buildstyle=heavy
  107. if test $libwmf_buildstyle = heavy; then
  108.     wmf_libs="-lwmf -lwmflite $wmf_liblflags"
  109. else
  110.     wmf_libs="-lwmflite"
  111. fi
  112.  
  113. if test "$echo_cflags" = "yes"; then
  114.     includes="$wmf_cflags"
  115.     if test "$lib_gd" = "yes"; then
  116.         includes="$includes -I${prefix}/include/libwmf/gd"
  117.     fi
  118.     if test "$lib_wmf" = "yes"; then
  119.         includes="$includes -I${prefix}/include"
  120.     fi
  121.     echo $includes
  122. fi
  123.  
  124. if test "$echo_libs" = "yes"; then
  125.     libdirs=-L${exec_prefix}/lib
  126.     my_wmf_libs=
  127.     for i in $wmf_libs ; do
  128.         if test "x$i" != "x-L${exec_prefix}/lib" ; then
  129.             if test -z "$my_wmf_libs" ; then
  130.                 my_wmf_libs="$i"
  131.             else
  132.                 my_wmf_libs="$my_wmf_libs $i"
  133.             fi
  134.         fi
  135.     done
  136.  
  137.     echo $libdirs $my_wmf_libs
  138. fi      
  139.