Home | History | Annotate | Download | only in unix
      1 #! /bin/sh
      2 #
      3 # Copyright 2000-2015 by
      4 # David Turner, Robert Wilhelm, and Werner Lemberg.
      5 #
      6 # This file is part of the FreeType project, and may only be used, modified,
      7 # and distributed under the terms of the FreeType project license,
      8 # LICENSE.TXT.  By continuing to use, modify, or distribute this file you
      9 # indicate that you have read the license and understand and accept it
     10 # fully.
     11 
     12 LC_ALL=C
     13 export LC_ALL
     14 
     15 prefix="%prefix%"
     16 exec_prefix="%exec_prefix%"
     17 exec_prefix_set="no"
     18 includedir="%includedir%"
     19 libdir="%libdir%"
     20 
     21 usage()
     22 {
     23   cat <<EOF
     24 Usage: freetype-config [OPTION]...
     25 Get FreeType compilation and linking information.
     26 
     27 Options:
     28   --prefix               display \`--prefix' value used for building the
     29                          FreeType library
     30   --prefix=PREFIX        override \`--prefix' value with PREFIX
     31   --exec-prefix          display \`--exec-prefix' value used for building
     32                          the FreeType library
     33   --exec-prefix=EPREFIX  override \`--exec-prefix' value with EPREFIX
     34   --version              display libtool version of the FreeType library
     35   --ftversion            display FreeType version number
     36   --libs                 display flags for linking with the FreeType library
     37   --libtool              display library name for linking with libtool
     38   --cflags               display flags for compiling with the FreeType
     39                          library
     40   --static               make command line options display flags
     41                          for static linking
     42 EOF
     43   exit $1
     44 }
     45 
     46 if test $# -eq 0 ; then
     47   usage 1 1>&2
     48 fi
     49 
     50 while test $# -gt 0 ; do
     51   case "$1" in
     52   -*=*)
     53     optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
     54     ;;
     55   *)
     56     optarg=
     57     ;;
     58   esac
     59 
     60   case $1 in
     61   --prefix=*)
     62     prefix=$optarg
     63     local_prefix=yes
     64     ;;
     65   --prefix)
     66     echo_prefix=yes
     67     ;;
     68   --exec-prefix=*)
     69     exec_prefix=$optarg
     70     exec_prefix_set=yes
     71     local_prefix=yes
     72     ;;
     73   --exec-prefix)
     74     echo_exec_prefix=yes
     75     ;;
     76   --version)
     77     echo %ft_version%
     78     exit 0
     79     ;;
     80   --ftversion)
     81     echo_ft_version=yes
     82     ;;
     83   --cflags)
     84     echo_cflags=yes
     85     ;;
     86   --libs)
     87     echo_libs=yes
     88     ;;
     89   --libtool)
     90     echo_libtool=yes
     91     ;;
     92   --static)
     93     show_static=yes
     94     ;;
     95   *)
     96     usage 1 1>&2
     97     ;;
     98   esac
     99   shift
    100 done
    101 
    102 if test "$local_prefix" = "yes" ; then
    103   if test "$exec_prefix_set" != "yes" ; then
    104     exec_prefix=$prefix
    105   fi
    106 fi
    107 
    108 if test "$echo_prefix" = "yes" ; then
    109   echo ${SYSROOT}$prefix
    110 fi
    111 
    112 if test "$echo_exec_prefix" = "yes" ; then
    113   echo ${SYSROOT}$exec_prefix
    114 fi
    115 
    116 if test "$exec_prefix_set" = "yes" ; then
    117   libdir=$exec_prefix/lib
    118 else
    119   if test "$local_prefix" = "yes" ; then
    120     includedir=$prefix/include
    121     libdir=$prefix/lib
    122   fi
    123 fi
    124 
    125 if test "$echo_ft_version" = "yes" ; then
    126   major=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \
    127          | grep FREETYPE_MAJOR \
    128          | sed 's/.*[ 	]\([0-9][0-9]*\).*/\1/'`
    129   minor=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \
    130          | grep FREETYPE_MINOR \
    131          | sed 's/.*[ 	]\([0-9][0-9]*\).*/\1/'`
    132   patch=`grep define ${SYSROOT}$includedir/freetype2/freetype/freetype.h \
    133          | grep FREETYPE_PATCH \
    134          | sed 's/.*[ 	]\([0-9][0-9]*\).*/\1/'`
    135   echo $major.$minor.$patch
    136 fi
    137 
    138 if test "$echo_cflags" = "yes" ; then
    139   echo -I${SYSROOT}$includedir/freetype2
    140 fi
    141 
    142 if test "$echo_libs" = "yes" ; then
    143   libs="-lfreetype"
    144   staticlibs="%LIBSSTATIC_CONFIG%"
    145   if test "$show_static" = "yes" ; then
    146     libs="$staticlibs"
    147   fi
    148   if test "${SYSROOT}$libdir" != "/usr/lib"  &&
    149      test "${SYSROOT}$libdir" != "/usr/lib64"; then
    150     echo -L${SYSROOT}$libdir $libs
    151   else
    152     echo $libs
    153   fi
    154 fi
    155 
    156 if test "$echo_libtool" = "yes" ; then
    157   convlib="libfreetype.la"
    158   echo ${SYSROOT}$libdir/$convlib
    159 fi
    160 
    161 # EOF
    162