configure 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/bin/sh
  2. #
  3. # Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 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. if test "$abs_curr_dir" != "$abs_ft2_dir"; then
  73. mkdir reference
  74. if test ! -r $abs_curr_dir/modules.cfg; then
  75. echo "Copying \`modules.cfg'"
  76. cp $abs_ft2_dir/modules.cfg $abs_curr_dir
  77. fi
  78. echo "Generating \`Makefile'"
  79. echo "TOP_DIR := $abs_ft2_dir" > Makefile
  80. echo "OBJ_DIR := $abs_curr_dir" >> Makefile
  81. echo "OBJ_BUILD := \$(OBJ_DIR)" >> Makefile
  82. echo "DOC_DIR := \$(OBJ_DIR)/reference" >> Makefile
  83. echo "LIBTOOL := \$(OBJ_DIR)/libtool" >> Makefile
  84. echo "ifndef FT2DEMOS" >> Makefile
  85. echo " include \$(TOP_DIR)/Makefile" >> Makefile
  86. echo "else" >> Makefile
  87. echo " TOP_DIR_2 := \$(TOP_DIR)/../ft2demos" >> Makefile
  88. echo " PROJECT := freetype" >> Makefile
  89. echo " CONFIG_MK := \$(OBJ_DIR)/config.mk" >> Makefile
  90. echo " include \$(TOP_DIR_2)/Makefile" >> Makefile
  91. echo "endif" >> Makefile
  92. fi
  93. # call make
  94. CFG=
  95. # work around zsh bug which doesn't like `${1+"$@"}'
  96. case $# in
  97. 0) ;;
  98. *) for x in "$@"; do
  99. case x"$x" in
  100. x--srcdir=* ) CFG="$CFG '$x'/builds/unix" ;;
  101. *) CFG="$CFG '$x'" ;;
  102. esac
  103. done ;;
  104. esac
  105. CFG=$CFG $GNUMAKE setup unix
  106. # eof