David Turner | dc47784 | 2002-01-08 18:34:11 +0000 | [diff] [blame] | 1 | #!/bin/sh |
David Turner | dc47784 | 2002-01-08 18:34:11 +0000 | [diff] [blame] | 2 | # |
Werner Lemberg | b8f97f1 | 2009-06-28 00:37:53 +0200 | [diff] [blame] | 3 | # Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by |
Werner Lemberg | 60a04df | 2005-06-04 23:04:30 +0000 | [diff] [blame] | 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 | # |
Werner Lemberg | 67d546a | 2005-05-24 04:49:42 +0000 | [diff] [blame] | 13 | # Call the `configure' script located in `builds/unix'. |
Werner Lemberg | 3975e2e | 2002-01-09 21:01:18 +0000 | [diff] [blame] | 14 | # |
Werner Lemberg | 67d546a | 2005-05-24 04:49:42 +0000 | [diff] [blame] | 15 | |
| 16 | rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk |
David Turner | d15bc0d | 2002-04-12 09:31:48 +0000 | [diff] [blame] | 17 | |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 18 | if test "x$GNUMAKE" = x; then |
David Turner | d15bc0d | 2002-04-12 09:31:48 +0000 | [diff] [blame] | 19 | GNUMAKE=make |
| 20 | fi |
| 21 | |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 22 | if test -z "`$GNUMAKE -v 2>/dev/null | grep GNU`"; then |
Werner Lemberg | 26eccb4 | 2004-04-13 08:35:05 +0000 | [diff] [blame] | 23 | if test -z "`$GNUMAKE -v 2>/dev/null | grep makepp`"; then |
Werner Lemberg | 4e33f9e | 2008-07-05 06:35:28 +0000 | [diff] [blame] | 24 | echo "GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2." >&2 |
Werner Lemberg | 26eccb4 | 2004-04-13 08:35:05 +0000 | [diff] [blame] | 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 |
David Turner | d15bc0d | 2002-04-12 09:31:48 +0000 | [diff] [blame] | 31 | fi |
| 32 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 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). |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 35 | |
| 36 | if expr a : '\(a\)' >/dev/null 2>&1; then |
| 37 | ft_expr=expr |
| 38 | else |
| 39 | ft_expr=false |
| 40 | fi |
| 41 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 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'` |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 66 | |
| 67 | abs_curr_dir=`pwd` |
| 68 | abs_ft2_dir=`cd "$ft2_dir" && pwd` |
| 69 | |
Werner Lemberg | b8f97f1 | 2009-06-28 00:37:53 +0200 | [diff] [blame] | 70 | # `--srcdir=' option can override abs_ft2_dir |
suzuki toshiya | 66d308e | 2009-06-27 14:33:06 +0900 | [diff] [blame] | 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 | |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 81 | # build a dummy Makefile if we are not building in the source tree |
| 82 | |
| 83 | if test "$abs_curr_dir" != "$abs_ft2_dir"; then |
Werner Lemberg | 6aa35cd | 2003-07-09 15:20:32 +0000 | [diff] [blame] | 84 | mkdir reference |
suzuki toshiya | 912f039 | 2009-06-27 14:38:32 +0900 | [diff] [blame] | 85 | if test ! -r $abs_curr_dir/modules.cfg; then |
| 86 | echo "Copying \`modules.cfg'" |
| 87 | cp $abs_ft2_dir/modules.cfg $abs_curr_dir |
| 88 | fi |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 89 | echo "Generating \`Makefile'" |
Werner Lemberg | a33bd86 | 2005-02-13 05:46:50 +0000 | [diff] [blame] | 90 | echo "TOP_DIR := $abs_ft2_dir" > Makefile |
| 91 | echo "OBJ_DIR := $abs_curr_dir" >> Makefile |
| 92 | echo "OBJ_BUILD := \$(OBJ_DIR)" >> Makefile |
| 93 | echo "DOC_DIR := \$(OBJ_DIR)/reference" >> Makefile |
suzuki toshiya | fd0cdb7 | 2010-08-31 18:32:03 +0900 | [diff] [blame^] | 94 | echo "FT_LIBTOOL_DIR := \$(OBJ_DIR)" >> Makefile |
Werner Lemberg | a33bd86 | 2005-02-13 05:46:50 +0000 | [diff] [blame] | 95 | echo "ifndef FT2DEMOS" >> Makefile |
| 96 | echo " include \$(TOP_DIR)/Makefile" >> Makefile |
| 97 | echo "else" >> Makefile |
| 98 | echo " TOP_DIR_2 := \$(TOP_DIR)/../ft2demos" >> Makefile |
| 99 | echo " PROJECT := freetype" >> Makefile |
| 100 | echo " CONFIG_MK := \$(OBJ_DIR)/config.mk" >> Makefile |
| 101 | echo " include \$(TOP_DIR_2)/Makefile" >> Makefile |
| 102 | echo "endif" >> Makefile |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 103 | fi |
| 104 | |
| 105 | # call make |
| 106 | |
Werner Lemberg | d898aed | 2006-08-29 09:50:34 +0000 | [diff] [blame] | 107 | CFG= |
Werner Lemberg | 4e33f9e | 2008-07-05 06:35:28 +0000 | [diff] [blame] | 108 | # work around zsh bug which doesn't like `${1+"$@"}' |
| 109 | case $# in |
| 110 | 0) ;; |
| 111 | *) for x in "$@"; do |
suzuki toshiya | 66d308e | 2009-06-27 14:33:06 +0900 | [diff] [blame] | 112 | case x"$x" in |
| 113 | x--srcdir=* ) CFG="$CFG '$x'/builds/unix" ;; |
| 114 | *) CFG="$CFG '$x'" ;; |
| 115 | esac |
Werner Lemberg | 4e33f9e | 2008-07-05 06:35:28 +0000 | [diff] [blame] | 116 | done ;; |
| 117 | esac |
Werner Lemberg | d898aed | 2006-08-29 09:50:34 +0000 | [diff] [blame] | 118 | CFG=$CFG $GNUMAKE setup unix |
Werner Lemberg | f83ded0 | 2002-05-05 10:57:06 +0000 | [diff] [blame] | 119 | |
| 120 | # eof |