1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/autoconf/mozconfig2configure Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,103 @@ 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 +# mozconfig2configure - Loads options from .mozconfig onto configure's 1.11 +# command-line. See mozconfig-find for how the config file is 1.12 +# found 1.13 +# 1.14 +# The options from .mozconfig are inserted into the command-line 1.15 +# before the real command-line options. This way the real options 1.16 +# will override any .mozconfig options. 1.17 +# 1.18 +# .mozconfig is a shell script. To add an option to configure's 1.19 +# command-line use the pre-defined function, ac_add_options, 1.20 +# 1.21 +# ac_add_options <configure-option> [<configure-option> ... ] 1.22 +# 1.23 +# For example, 1.24 +# 1.25 +# ac_add_options --with-pthreads --enable-debug 1.26 +# 1.27 +# ac_add_options can be called multiple times in .mozconfig. 1.28 +# Each call adds more options to configure's command-line. 1.29 + 1.30 +# Note: $_AUTOCONF_TOOLS_DIR must be defined in the script that includes this. 1.31 + 1.32 +ac_add_options() { 1.33 + for _opt 1.34 + do 1.35 + # Escape shell characters, space, tab, dollar, quote, backslash, parentheses. 1.36 + _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\\(\)]\)/\\\\\1/g;s/@\([^@]*\)@/\$\1/g;'` 1.37 + _opt=`echo $_opt | sed -e 's/@\([^@]*\)@/\$(\1)/g'` 1.38 + 1.39 + # Avoid adding duplicates 1.40 + case "$ac_options" in 1.41 + # Note that all options in $ac_options are enclosed in quotes, 1.42 + # so there will always be a last character to match [^-A-Za-z0-9_] 1.43 + *"\"$_opt[^-A-Za-z0-9_]"* ) ;; 1.44 + * ) mozconfig_ac_options="$mozconfig_ac_options $_opt" ;; 1.45 + esac 1.46 + done 1.47 +} 1.48 + 1.49 +ac_add_app_options() { 1.50 + APP=$1 1.51 + shift; 1.52 + if [ "$APP" = "$MOZ_BUILD_APP" ]; then 1.53 + ac_add_options "$*"; 1.54 + fi 1.55 +} 1.56 + 1.57 +mk_add_options() { 1.58 + # These options are for client.mk 1.59 + # configure can safely ignore them. 1.60 + : 1.61 +} 1.62 + 1.63 +ac_echo_options() { 1.64 + echo "Adding configure options from $FOUND_MOZCONFIG:" 1.65 + eval "set -- $mozconfig_ac_options" 1.66 + for _opt 1.67 + do 1.68 + echo " $_opt" 1.69 + done 1.70 +} 1.71 + 1.72 +# Main 1.73 +#-------------------------------------------------- 1.74 +topsrcdir=$(cd `dirname $0`; pwd -W 2>/dev/null || pwd) 1.75 +ac_options= 1.76 +mozconfig_ac_options= 1.77 + 1.78 +# Save the real command-line options 1.79 +for _opt 1.80 +do 1.81 + # Escape shell characters, space, tab, dollar, quote, backslash. 1.82 + _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;'` 1.83 + ac_options="$ac_options \"$_opt\"" 1.84 +done 1.85 + 1.86 + 1.87 +# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out 1.88 +isfoundset=${FOUND_MOZCONFIG+yes} 1.89 +if [ -z $isfoundset ]; then 1.90 + FOUND_MOZCONFIG=`$_AUTOCONF_TOOLS_DIR/mozconfig-find $topsrcdir` 1.91 + if [ $? -ne 0 ]; then 1.92 + echo "Fix above errors before continuing." 1>&2 1.93 + exit 1 1.94 + fi 1.95 +fi 1.96 + 1.97 +if [ "$FOUND_MOZCONFIG" ]; then 1.98 + . "$FOUND_MOZCONFIG" 1.99 +fi 1.100 +export FOUND_MOZCONFIG 1.101 + 1.102 +if [ "$mozconfig_ac_options" ]; then 1.103 + ac_echo_options 1>&2 1.104 +fi 1.105 + 1.106 +eval "set -- $mozconfig_ac_options $ac_options"