/modules/freetype2/configure

http://github.com/zpao/v8monkey · Shell · 125 lines · 89 code · 14 blank · 22 comment · 11 complexity · f8b94f975dbcb5d079ae75f3ef60e85f MD5 · raw file

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