1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/autoconf/mozconfig2client-mk Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +#! /bin/sh 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 +# mozconfig2client-mk - Translates .mozconfig into options for client.mk. 1.11 +# Prints defines to stdout. 1.12 +# 1.13 +# See mozconfig2configure for more details 1.14 + 1.15 +print_header() { 1.16 + cat <<EOF 1.17 +# gmake 1.18 +# This file is automatically generated for client.mk. 1.19 +# Do not edit. Edit $FOUND_MOZCONFIG instead. 1.20 + 1.21 +EOF 1.22 +} 1.23 + 1.24 +ac_add_options() { 1.25 + for _opt 1.26 + do 1.27 + case "$_opt" in 1.28 + --target=*) 1.29 + echo $_opt | sed s/--target/CONFIG_GUESS/ 1.30 + ;; 1.31 + *) 1.32 + echo "# $_opt is used by configure (not client.mk)" 1.33 + ;; 1.34 + esac 1.35 + done 1.36 +} 1.37 + 1.38 +ac_add_app_options() { 1.39 + echo "# $* is used by configure (not client.mk)" 1.40 +} 1.41 + 1.42 +mk_add_options() { 1.43 + for _opt 1.44 + do 1.45 + # Escape shell characters, space, tab, dollar, quote, backslash, 1.46 + # and substitute '@<word>@' with '$(<word>)'. 1.47 + _opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'` 1.48 + echo $_opt; 1.49 + done 1.50 +} 1.51 + 1.52 +# Main 1.53 +#-------------------------------------------------- 1.54 + 1.55 +scriptdir=`dirname $0` 1.56 +topsrcdir=$1 1.57 + 1.58 +# If the path changes, configure should be rerun 1.59 +echo "# PATH=$PATH" 1.60 + 1.61 +# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out 1.62 +isfoundset=${FOUND_MOZCONFIG+yes} 1.63 +if [ -z $isfoundset ]; then 1.64 + FOUND_MOZCONFIG=`$scriptdir/mozconfig-find $topsrcdir` 1.65 + if [ $? -ne 0 ]; then 1.66 + echo '$(error Fix above errors before continuing.)' 1.67 + else 1.68 + isfoundset=yes 1.69 + fi 1.70 +fi 1.71 + 1.72 +if [ -n $isfoundset ]; then 1.73 + if [ "$FOUND_MOZCONFIG" ] 1.74 + then 1.75 + print_header 1.76 + . "$FOUND_MOZCONFIG" 1.77 + echo "FOUND_MOZCONFIG := $FOUND_MOZCONFIG" 1.78 + fi 1.79 +fi