michael@0: #!/bin/sh michael@0: # michael@0: # Copyright 2002-2006, 2008-2010, 2013 by michael@0: # David Turner, Robert Wilhelm, and Werner Lemberg. michael@0: # michael@0: # This file is part of the FreeType project, and may only be used, modified, michael@0: # and distributed under the terms of the FreeType project license, michael@0: # LICENSE.TXT. By continuing to use, modify, or distribute this file you michael@0: # indicate that you have read the license and understand and accept it michael@0: # fully. michael@0: # michael@0: # michael@0: # Call the `configure' script located in `builds/unix'. michael@0: # michael@0: michael@0: rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk michael@0: michael@0: # respect GNUMAKE environment variable for backwards compatibility michael@0: if test "x$GNUMAKE" = x; then michael@0: if test "x$MAKE" = x; then michael@0: if test "x`make -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then michael@0: MAKE=gmake michael@0: else michael@0: MAKE=make michael@0: fi michael@0: fi michael@0: else michael@0: MAKE=$GNUMAKE michael@0: fi michael@0: michael@0: if test "x`$MAKE -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then michael@0: echo "GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2." >&2 michael@0: echo "Please try" >&2 michael@0: echo >&2 michael@0: echo " MAKE= $0" >&2 michael@0: echo >&2 michael@0: echo "or" >&2 michael@0: echo >&2 michael@0: echo " MAKE=\"makepp --norc-substitution\" $0" >&2 michael@0: exit 1 michael@0: fi michael@0: michael@0: # Get `dirname' functionality. This is taken and adapted from autoconf's michael@0: # m4sh.m4 (_AS_EXPR_PREPARE, AS_DIRNAME_EXPR, and AS_DIRNAME_SED). michael@0: michael@0: if expr a : '\(a\)' >/dev/null 2>&1; then michael@0: ft_expr=expr michael@0: else michael@0: ft_expr=false michael@0: fi michael@0: michael@0: ft2_dir=`(dirname "$0") 2>/dev/null || michael@0: $ft_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ michael@0: X"$0" : 'X\(//\)[^/]' \| \ michael@0: X"$0" : 'X\(//\)$' \| \ michael@0: X"$0" : 'X\(/\)' \| \ michael@0: . : '\(.\)' 2>/dev/null || michael@0: echo X"$0" | michael@0: sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ michael@0: s//\1/ michael@0: q michael@0: } michael@0: /^X\(\/\/\)[^/].*/{ michael@0: s//\1/ michael@0: q michael@0: } michael@0: /^X\(\/\/\)$/{ michael@0: s//\1/ michael@0: q michael@0: } michael@0: /^X\(\/\).*/{ michael@0: s//\1/ michael@0: q michael@0: } michael@0: s/.*/./; q'` michael@0: michael@0: abs_curr_dir=`pwd` michael@0: abs_ft2_dir=`cd "$ft2_dir" && pwd` michael@0: michael@0: # `--srcdir=' option can override abs_ft2_dir michael@0: michael@0: if test $# -gt 0; then michael@0: for x in "$@"; do michael@0: case x"$x" in michael@0: x--srcdir=*) michael@0: abs_ft2_dir=`echo $x | sed 's/^--srcdir=//'` ;; michael@0: esac michael@0: done michael@0: fi michael@0: michael@0: # build a dummy Makefile if we are not building in the source tree; michael@0: # we use inodes to avoid issues with symbolic links michael@0: inode_src=`ls -id $abs_ft2_dir | awk '{print $1}'` michael@0: inode_dst=`ls -id $abs_curr_dir | awk '{print $1}'` michael@0: michael@0: if test $inode_src -ne $inode_dst; then michael@0: if test ! -d reference; then michael@0: mkdir reference michael@0: fi michael@0: if test ! -r $abs_curr_dir/modules.cfg; then michael@0: echo "Copying \`modules.cfg'" michael@0: cp $abs_ft2_dir/modules.cfg $abs_curr_dir michael@0: fi michael@0: echo "Generating \`Makefile'" michael@0: echo "TOP_DIR := $abs_ft2_dir" > Makefile michael@0: echo "OBJ_DIR := $abs_curr_dir" >> Makefile michael@0: echo "OBJ_BUILD := \$(OBJ_DIR)" >> Makefile michael@0: echo "DOC_DIR := \$(OBJ_DIR)/reference" >> Makefile michael@0: echo "FT_LIBTOOL_DIR := \$(OBJ_DIR)" >> Makefile michael@0: echo "ifndef FT2DEMOS" >> Makefile michael@0: echo " include \$(TOP_DIR)/Makefile" >> Makefile michael@0: echo "else" >> Makefile michael@0: echo " TOP_DIR_2 := \$(TOP_DIR)/../ft2demos" >> Makefile michael@0: echo " PROJECT := freetype" >> Makefile michael@0: echo " CONFIG_MK := \$(OBJ_DIR)/config.mk" >> Makefile michael@0: echo " include \$(TOP_DIR_2)/Makefile" >> Makefile michael@0: echo "endif" >> Makefile michael@0: fi michael@0: michael@0: # call make michael@0: michael@0: CFG= michael@0: # work around zsh bug which doesn't like `${1+"$@"}' michael@0: case $# in michael@0: 0) ;; michael@0: *) for x in "$@"; do michael@0: case x"$x" in michael@0: x--srcdir=* ) CFG="$CFG '$x'/builds/unix" ;; michael@0: *) CFG="$CFG '$x'" ;; michael@0: esac michael@0: done ;; michael@0: esac michael@0: CFG=$CFG $MAKE setup unix michael@0: michael@0: # eof