misc/libfreetype/configure
changeset 5172 88f2e05288ba
equal deleted inserted replaced
5171:f9283dc4860d 5172:88f2e05288ba
       
     1 #!/bin/sh
       
     2 #
       
     3 # Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 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 #
       
    13 # Call the `configure' script located in `builds/unix'.
       
    14 #
       
    15 
       
    16 rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk
       
    17 
       
    18 if test "x$GNUMAKE" = x; then
       
    19   GNUMAKE=make
       
    20 fi
       
    21 
       
    22 if test -z "`$GNUMAKE -v 2>/dev/null | grep GNU`"; then
       
    23   if test -z "`$GNUMAKE -v 2>/dev/null | grep makepp`"; then
       
    24     echo "GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2." >&2
       
    25     echo "Please try" >&2
       
    26     echo "  \`GNUMAKE=<GNU make command name> $0'." >&2
       
    27     echo "or >&2"
       
    28     echo "  \`GNUMAKE=\"makepp --norc-substitution\" $0'." >&2
       
    29     exit 1
       
    30   fi
       
    31 fi
       
    32 
       
    33 # Get `dirname' functionality.  This is taken and adapted from autoconf's
       
    34 # m4sh.m4 (_AS_EXPR_PREPARE, AS_DIRNAME_EXPR, and AS_DIRNAME_SED).
       
    35 
       
    36 if expr a : '\(a\)' >/dev/null 2>&1; then
       
    37   ft_expr=expr
       
    38 else
       
    39   ft_expr=false
       
    40 fi
       
    41 
       
    42 ft2_dir=`(dirname "$0") 2>/dev/null                         ||
       
    43          $ft_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
       
    44                   X"$0" : 'X\(//\)[^/]' \| \
       
    45                   X"$0" : 'X\(//\)$' \| \
       
    46                   X"$0" : 'X\(/\)' \| \
       
    47                   .     : '\(.\)' 2>/dev/null               ||
       
    48          echo X"$0" |
       
    49            sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
       
    50                   s//\1/
       
    51                   q
       
    52                 }
       
    53                 /^X\(\/\/\)[^/].*/{
       
    54                   s//\1/
       
    55                   q
       
    56                 }
       
    57                 /^X\(\/\/\)$/{
       
    58                   s//\1/
       
    59                   q
       
    60                 }
       
    61                 /^X\(\/\).*/{
       
    62                   s//\1/
       
    63                   q
       
    64                 }
       
    65                 s/.*/./; q'`
       
    66 
       
    67 abs_curr_dir=`pwd`
       
    68 abs_ft2_dir=`cd "$ft2_dir" && pwd`
       
    69 
       
    70 # `--srcdir=' option can override abs_ft2_dir
       
    71 
       
    72 if test $# -gt 0; then
       
    73   for x in "$@"; do
       
    74     case x"$x" in
       
    75     x--srcdir=*)
       
    76       abs_ft2_dir=`echo $x | sed 's/^--srcdir=//'` ;;
       
    77     esac
       
    78   done
       
    79 fi
       
    80 
       
    81 # build a dummy Makefile if we are not building in the source tree;
       
    82 # we use inodes to avoid issues with symbolic links
       
    83 inode_src=`ls -id $abs_ft2_dir | awk '{print $1}'`
       
    84 inode_dst=`ls -id $abs_curr_dir | awk '{print $1}'`
       
    85 
       
    86 if test $inode_src -ne $inode_dst; then
       
    87   if test ! -d reference; then
       
    88     mkdir reference
       
    89   fi
       
    90   if test ! -r $abs_curr_dir/modules.cfg; then
       
    91     echo "Copying \`modules.cfg'"
       
    92     cp $abs_ft2_dir/modules.cfg $abs_curr_dir
       
    93   fi
       
    94   echo "Generating \`Makefile'"
       
    95   echo "TOP_DIR   := $abs_ft2_dir"               > Makefile
       
    96   echo "OBJ_DIR   := $abs_curr_dir"             >> Makefile
       
    97   echo "OBJ_BUILD := \$(OBJ_DIR)"               >> Makefile
       
    98   echo "DOC_DIR   := \$(OBJ_DIR)/reference"     >> Makefile
       
    99   echo "FT_LIBTOOL_DIR   := \$(OBJ_DIR)"        >> Makefile
       
   100   echo "ifndef FT2DEMOS"                        >> Makefile
       
   101   echo "  include \$(TOP_DIR)/Makefile"         >> Makefile
       
   102   echo "else"                                   >> Makefile
       
   103   echo "  TOP_DIR_2 := \$(TOP_DIR)/../ft2demos" >> Makefile
       
   104   echo "  PROJECT   := freetype"                >> Makefile
       
   105   echo "  CONFIG_MK := \$(OBJ_DIR)/config.mk"   >> Makefile
       
   106   echo "  include \$(TOP_DIR_2)/Makefile"       >> Makefile
       
   107   echo "endif"                                  >> Makefile
       
   108 fi
       
   109 
       
   110 # call make
       
   111 
       
   112 CFG=
       
   113 # work around zsh bug which doesn't like `${1+"$@"}'
       
   114 case $# in
       
   115 0) ;;
       
   116 *) for x in "$@"; do
       
   117      case x"$x" in
       
   118      x--srcdir=* ) CFG="$CFG '$x'/builds/unix" ;;
       
   119      *) CFG="$CFG '$x'" ;;
       
   120      esac
       
   121    done ;;
       
   122 esac
       
   123 CFG=$CFG $GNUMAKE setup unix
       
   124 
       
   125 # eof