modules/freetype2/autogen.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/freetype2/autogen.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,166 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +# Copyright 2005-2010, 2013 by
     1.7 +# David Turner, Robert Wilhelm, and Werner Lemberg.
     1.8 +#
     1.9 +# This file is part of the FreeType project, and may only be used, modified,
    1.10 +# and distributed under the terms of the FreeType project license,
    1.11 +# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
    1.12 +# indicate that you have read the license and understand and accept it
    1.13 +# fully.
    1.14 +
    1.15 +run ()
    1.16 +{
    1.17 +  echo "running \`$*'"
    1.18 +  eval $*
    1.19 +
    1.20 +  if test $? != 0 ; then
    1.21 +    echo "error while running \`$*'"
    1.22 +    exit 1
    1.23 +  fi
    1.24 +}
    1.25 +
    1.26 +get_major_version ()
    1.27 +{
    1.28 +  echo $1 | sed -e 's/\([0-9][0-9]*\)\..*/\1/g'
    1.29 +}
    1.30 +
    1.31 +get_minor_version ()
    1.32 +{
    1.33 +  echo $1 | sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'
    1.34 +}
    1.35 +
    1.36 +get_patch_version ()
    1.37 +{
    1.38 +  # tricky: some version numbers don't include a patch
    1.39 +  # separated with a point, but something like 1.4-p6
    1.40 +  patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'`
    1.41 +  if test "$patch" = "$1"; then
    1.42 +    patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\-p\([0-9][0-9]*\).*/\1/g'`
    1.43 +    # if there isn't any patch number, default to 0
    1.44 +    if test "$patch" = "$1"; then
    1.45 +      patch=0
    1.46 +    fi
    1.47 +  fi
    1.48 +  echo $patch
    1.49 +}
    1.50 +
    1.51 +# $1: version to check
    1.52 +# $2: minimum version
    1.53 +
    1.54 +compare_to_minimum_version ()
    1.55 +{
    1.56 +  MAJOR1=`get_major_version $1`
    1.57 +  MAJOR2=`get_major_version $2`
    1.58 +  if test $MAJOR1 -lt $MAJOR2; then
    1.59 +    echo 0
    1.60 +    return
    1.61 +  else
    1.62 +    if test $MAJOR1 -gt $MAJOR2; then
    1.63 +      echo 1
    1.64 +      return
    1.65 +    fi
    1.66 +  fi
    1.67 +
    1.68 +  MINOR1=`get_minor_version $1`
    1.69 +  MINOR2=`get_minor_version $2`
    1.70 +  if test $MINOR1 -lt $MINOR2; then
    1.71 +    echo 0
    1.72 +    return
    1.73 +  else
    1.74 +    if test $MINOR1 -gt $MINOR2; then
    1.75 +      echo 1
    1.76 +      return
    1.77 +    fi
    1.78 +  fi
    1.79 +
    1.80 +  PATCH1=`get_patch_version $1`
    1.81 +  PATCH2=`get_patch_version $2`
    1.82 +  if test $PATCH1 -lt $PATCH2; then
    1.83 +    echo 0
    1.84 +  else
    1.85 +    echo 1
    1.86 +  fi
    1.87 +}
    1.88 +
    1.89 +# check the version of a given tool against a minimum version number
    1.90 +#
    1.91 +# $1: tool path
    1.92 +# $2: tool usual name (e.g. `aclocal')
    1.93 +# $3: tool variable  (e.g. `ACLOCAL')
    1.94 +# $4: minimum version to check against
    1.95 +# $5: option field index used to extract the tool version from the
    1.96 +#     output of --version
    1.97 +
    1.98 +check_tool_version ()
    1.99 +{
   1.100 +  field=$5
   1.101 +  # assume the output of "[TOOL] --version" is "toolname (GNU toolname foo bar) version"
   1.102 +  if test "$field"x = x; then
   1.103 +    field=3  # default to 3 for all GNU autotools, after filtering enclosed string
   1.104 +  fi
   1.105 +  version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | cut -d ' ' -f $field`
   1.106 +  version_check=`compare_to_minimum_version $version $4`
   1.107 +  if test "$version_check"x = 0x; then
   1.108 +    echo "ERROR: Your version of the \`$2' tool is too old."
   1.109 +    echo "       Minimum version $4 is required (yours is version $version)."
   1.110 +    echo "       Please upgrade or use the $3 variable to point to a more recent one."
   1.111 +    echo ""
   1.112 +    exit 1
   1.113 +  fi
   1.114 +}
   1.115 +
   1.116 +if test ! -f ./builds/unix/configure.raw; then
   1.117 +  echo "You must be in the same directory as \`autogen.sh'."
   1.118 +  echo "Bootstrapping doesn't work if srcdir != builddir."
   1.119 +  exit 1
   1.120 +fi
   1.121 +
   1.122 +# On MacOS X, the GNU libtool is named `glibtool'.
   1.123 +HOSTOS=`uname`
   1.124 +if test "$LIBTOOLIZE"x != x; then
   1.125 +  :
   1.126 +elif test "$HOSTOS"x = Darwinx; then
   1.127 +  LIBTOOLIZE=glibtoolize
   1.128 +else
   1.129 +  LIBTOOLIZE=libtoolize
   1.130 +fi
   1.131 +
   1.132 +if test "$ACLOCAL"x = x; then
   1.133 +  ACLOCAL=aclocal
   1.134 +fi
   1.135 +
   1.136 +if test "$AUTOCONF"x = x; then
   1.137 +  AUTOCONF=autoconf
   1.138 +fi
   1.139 +
   1.140 +check_tool_version $ACLOCAL    aclocal    ACLOCAL    1.10.1
   1.141 +check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
   1.142 +check_tool_version $AUTOCONF   autoconf   AUTOCONF   2.62
   1.143 +
   1.144 +# This sets freetype_major, freetype_minor, and freetype_patch.
   1.145 +eval `sed -nf version.sed include/freetype.h`
   1.146 +
   1.147 +# We set freetype-patch to an empty value if it is zero.
   1.148 +if test "$freetype_patch" = ".0"; then
   1.149 +  freetype_patch=
   1.150 +fi
   1.151 +
   1.152 +cd builds/unix
   1.153 +
   1.154 +echo "generating \`configure.ac'"
   1.155 +sed -e "s;@VERSION@;$freetype_major$freetype_minor$freetype_patch;" \
   1.156 +  < configure.raw > configure.ac
   1.157 +
   1.158 +run aclocal -I . --force
   1.159 +run $LIBTOOLIZE --force --copy --install
   1.160 +run autoconf --force
   1.161 +
   1.162 +chmod +x mkinstalldirs
   1.163 +chmod +x install-sh
   1.164 +
   1.165 +cd ../..
   1.166 +
   1.167 +chmod +x ./configure
   1.168 +
   1.169 +# EOF

mercurial