misc/libfreetype/autogen.sh
author nemo
Mon, 08 Oct 2012 21:07:18 -0400
changeset 7733 a1476c09403f
parent 5172 88f2e05288ba
permissions -rw-r--r--
Knife is still broken, but so koda can fix it...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
#!/bin/sh
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
# Copyright 2005, 2006, 2007, 2008, 2009, 2010 by
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
# David Turner, Robert Wilhelm, and Werner Lemberg.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
#
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
# This file is part of the FreeType project, and may only be used, modified,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
# and distributed under the terms of the FreeType project license,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
# LICENSE.TXT.  By continuing to use, modify, or distribute this file you
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
# indicate that you have read the license and understand and accept it
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
# fully.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
run ()
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
{
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
  echo "running \`$*'"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
  eval $*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
  if test $? != 0 ; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
    echo "error while running \`$*'"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
    exit 1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
  fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
}
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
get_major_version ()
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
{
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
  echo $1 | sed -e 's/\([0-9][0-9]*\)\..*/\1/g'
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
}
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
get_minor_version ()
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
{
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
  echo $1 | sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
}
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
get_patch_version ()
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
{
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
  # tricky: some version numbers don't include a patch
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
  # separated with a point, but something like 1.4-p6
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
  patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/g'`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
  if test "$patch" = "$1"; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
    patch=`echo $1 | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\-p\([0-9][0-9]*\).*/\1/g'`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
    # if there isn't any patch number, default to 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
    if test "$patch" = "$1"; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
      patch=0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
    fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
  fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
  echo $patch
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
}
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
# $1: version to check
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
# $2: minimum version
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
compare_to_minimum_version ()
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
{
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
  MAJOR1=`get_major_version $1`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
  MAJOR2=`get_major_version $2`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
  if test $MAJOR1 -lt $MAJOR2; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
    echo 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
    return
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
  else 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
    if test $MAJOR1 -gt $MAJOR2; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
      echo 1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
      return
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
  fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
  MINOR1=`get_minor_version $1`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
  MINOR2=`get_minor_version $2`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
  if test $MINOR1 -lt $MINOR2; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
    echo 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    return
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
  else 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
    if test $MINOR1 -gt $MINOR2; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
      echo 1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
      return
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
    fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
  fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  PATCH1=`get_patch_version $1`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
  PATCH2=`get_patch_version $2`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
  if test $PATCH1 -lt $PATCH2; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    echo 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
  else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    echo 1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
  fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
}
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
# check the version of a given tool against a minimum version number
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
#
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
# $1: tool path
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
# $2: tool usual name (e.g. `aclocal')
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
# $3: tool variable  (e.g. `ACLOCAL')
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
# $4: minimum version to check against
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
# $5: option field index used to extract the tool version from the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
#     output of --version
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
check_tool_version ()
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
{
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  field=$5
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
  # assume the output of "[TOOL] --version" is "toolname (GNU toolname foo bar) version"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
  if test "$field"x = x; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
    field=3  # default to 3 for all GNU autotools, after filtering enclosed string
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
  fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
  version=`$1 --version | head -1 | sed 's/([^)]*)/()/g' | cut -d ' ' -f $field`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
  version_check=`compare_to_minimum_version $version $4`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
  if test "$version_check"x = 0x; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
    echo "ERROR: Your version of the \`$2' tool is too old."
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
    echo "       Minimum version $4 is required (yours is version $version)."
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
    echo "       Please upgrade or use the $3 variable to point to a more recent one."
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
    echo ""
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
    exit 1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
  fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
}
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
if test ! -f ./builds/unix/configure.raw; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
  echo "You must be in the same directory as \`autogen.sh'."
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
  echo "Bootstrapping doesn't work if srcdir != builddir."
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
  exit 1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
# On MacOS X, the GNU libtool is named `glibtool'.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
HOSTOS=`uname`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
LIBTOOLIZE=libtoolize
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
if test "$HOSTOS"x = Darwinx; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
  LIBTOOLIZE=glibtoolize
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
if test "$ACLOCAL"x = x; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
  ACLOCAL=aclocal
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
if test "$AUTOCONF"x = x; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
  AUTOCONF=autoconf
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
check_tool_version $ACLOCAL    aclocal    ACLOCAL    1.10.1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
check_tool_version $LIBTOOLIZE libtoolize LIBTOOLIZE 2.2.4
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
check_tool_version $AUTOCONF   autoconf   AUTOCONF   2.62
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
# This sets freetype_major, freetype_minor, and freetype_patch.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
eval `sed -nf version.sed include/freetype/freetype.h`
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
# We set freetype-patch to an empty value if it is zero.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
if test "$freetype_patch" = ".0"; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
  freetype_patch=
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
cd builds/unix
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
echo "generating \`configure.ac'"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
sed -e "s;@VERSION@;$freetype_major$freetype_minor$freetype_patch;" \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
  < configure.raw > configure.ac
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
run aclocal -I . --force
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
run $LIBTOOLIZE --force --copy --install
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
run autoconf --force
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
chmod +x mkinstalldirs
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
chmod +x install-sh
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
cd ../..
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
chmod +x ./configure
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
# EOF