3
# This Source Code Form is subject to the terms of the Mozilla Public
4
# License, v. 2.0. If a copy of the MPL was not distributed with this
5
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
# mozconfigfind - Loads options from .mozconfig onto configure's
8
# command-line. The .mozconfig file is searched for in the
10
# If $MOZCONFIG is set, use that.
11
# If one of $TOPSRCDIR/.mozconfig or $TOPSRCDIR/mozconfig exists, use it.
12
# If both exist, or if various legacy locations contain a mozconfig, error.
13
# Otherwise, use the default build options.
18
if uname -s | grep -q MINGW; then
19
# We have no way to figure out whether we're in gmake or pymake right
20
# now. gmake gives us Unix-style paths while pymake gives us Windows-style
21
# paths, so attempt to handle both.
22
regexes='^\([A-Za-z]:\|\\\\\|\/\) ^\/'
27
for regex in $regexes; do
28
if echo $1 | grep -q $regex; then
34
# If we're at this point, we have a relative path
38
if [ -n "$MOZCONFIG" ] && ! [ -f "$MOZCONFIG" ]; then
39
echo "Specified MOZCONFIG \"$MOZCONFIG\" does not exist!" 1>&2
43
if [ -n "$MOZ_MYCONFIG" ]; then
44
echo "Your environment currently has the MOZ_MYCONFIG variable set to \"$MOZ_MYCONFIG\". MOZ_MYCONFIG is no longer supported. Please use MOZCONFIG instead." 1>&2
48
if [ -z "$MOZCONFIG" ] && [ -f "$topsrcdir/.mozconfig" ] && [ -f "$topsrcdir/mozconfig" ]; then
49
echo "Both \$topsrcdir/.mozconfig and \$topsrcdir/mozconfig are supported, but you must choose only one. Please remove the other." 1>&2
53
for _config in "$MOZCONFIG" \
54
"$topsrcdir/.mozconfig" \
55
"$topsrcdir/mozconfig"
57
if test -f "$_config"; then
63
# We used to support a number of other implicit .mozconfig locations. We now
64
# detect if we were about to use any of these locations and issue an error if we
66
for _config in "$topsrcdir/mozconfig.sh" \
67
"$topsrcdir/myconfig.sh" \
69
"$HOME/.mozconfig.sh" \
70
"$HOME/.mozmyconfig.sh"
72
if test -f "$_config"; then
73
echo "You currently have a mozconfig at \"$_config\". This implicit location is no longer supported. Please move it to $topsrcdir/.mozconfig or specify it explicitly via \$MOZCONFIG." 1>&2