Bug 785871 - Make config.status importable. r=gps

This commit is contained in:
Mike Hommey 2012-08-29 08:55:58 +02:00
parent 6f9fd5c1fe
commit 543e39518d
4 changed files with 58 additions and 54 deletions

View File

@ -69,7 +69,7 @@ endif
include $(topsrcdir)/config/config.mk
GARBAGE_DIRS += dist _javagen _profile _tests staticlib
DIST_GARBAGE = config.cache config.log config.status config-defs.h \
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
config/autoconf.mk \
unallmakefiles mozilla-config.h \
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \

View File

@ -13,7 +13,7 @@ define([AC_SUBST],
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
(''' $1 ''', r''' [$]$1 ''')
(''' $1 ''', r''' [$]$1 ''')
AC_DIVERT_POP()dnl
])])
@ -26,7 +26,7 @@ dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
define([AC_DEFINE],
[cat >> confdefs.pytmp <<\EOF
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
EOF
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
])
@ -36,7 +36,7 @@ dnl python.
define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
define([AC_DEFINE_UNQUOTED],
[cat >> confdefs.pytmp <<EOF
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
EOF
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
])
@ -80,24 +80,19 @@ cat > $CONFIG_STATUS <<EOF
#!${PYTHON}
# coding=$encoding
import os, sys
import os
dnl topsrcdir is the top source directory in native form, as opposed to a
dnl form suitable for make.
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
if not os.path.isabs(topsrcdir):
topsrcdir = os.path.normpath(os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir))
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
from ConfigStatus import config_status
args = {
'topsrcdir': topsrcdir,
'topobjdir': os.path.dirname(<<<__file__>>>),
topobjdir = os.path.dirname(<<<__file__>>>)
dnl All defines and substs are stored with an additional space at the beginning
dnl and at the end of the string, to avoid any problem with values starting or
dnl ending with quotes.
'defines': [(name[1:-1], value[1:-1]) for name, value in [
defines = [(name[1:-1], value[1:-1]) for name, value in [
EOF
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
@ -106,9 +101,9 @@ sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
rm confdefs.pytmp confdefs.h
cat >> $CONFIG_STATUS <<\EOF
] ],
] ]
'substs': [(name[1:-1], value[1:-1]) for name, value in [
substs = [(name[1:-1], value[1:-1]) for name, value in [
EOF
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
@ -118,51 +113,58 @@ undivert(MOZ_DIVERSION_SUBST)dnl
EOF
cat >> $CONFIG_STATUS <<\EOF
] ],
] ]
dnl List of files to apply AC_SUBSTs to. This is the list of files given
dnl as an argument to AC_OUTPUT ($1)
'files': [
files = [
EOF
for out in $1; do
echo " '$out'," >> $CONFIG_STATUS
echo " '$out'," >> $CONFIG_STATUS
done
cat >> $CONFIG_STATUS <<\EOF
],
]
dnl List of header files to apply AC_DEFINEs to. This is stored in the
dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
'headers': [
headers = [
EOF
ifdef(<<<AC_LIST_HEADER>>>, <<<
HEADERS="AC_LIST_HEADER"
for header in $HEADERS; do
echo " '$header'," >> $CONFIG_STATUS
echo " '$header'," >> $CONFIG_STATUS
done
>>>)dnl
cat >> $CONFIG_STATUS <<\EOF
],
]
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
'non_global_defines': [
non_global_defines = [
EOF
if test -n "$_NON_GLOBAL_ACDEFINES"; then
for var in $_NON_GLOBAL_ACDEFINES; do
echo " '$var'," >> $CONFIG_STATUS
echo " '$var'," >> $CONFIG_STATUS
done
fi
cat >> $CONFIG_STATUS <<\EOF
]
}
cat >> $CONFIG_STATUS <<EOF
]
__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs', 'files', 'headers']
dnl Do the actual work
config_status(**args)
if __name__ == '__main__':
args = dict([(name, globals()[name]) for name in __all__])
import sys
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
from ConfigStatus import config_status
config_status(**args)
EOF
changequote([, ])
chmod +x $CONFIG_STATUS

View File

@ -595,7 +595,7 @@ ifndef HAVE_DTRACE
endif
endif
DIST_GARBAGE = config.cache config.log config.status \
DIST_GARBAGE = config.cache config.log config.status* \
config/autoconf.mk \
unallmakefiles js-config js-config.h js-confdefs.h

View File

@ -13,7 +13,7 @@ define([AC_SUBST],
[ifdef([AC_SUBST_$1], ,
[define([AC_SUBST_$1], )dnl
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
(''' $1 ''', r''' [$]$1 ''')
(''' $1 ''', r''' [$]$1 ''')
AC_DIVERT_POP()dnl
])])
@ -26,7 +26,7 @@ dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
define([AC_DEFINE],
[cat >> confdefs.pytmp <<\EOF
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
EOF
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
])
@ -36,7 +36,7 @@ dnl python.
define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
define([AC_DEFINE_UNQUOTED],
[cat >> confdefs.pytmp <<EOF
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
EOF
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
])
@ -80,24 +80,19 @@ cat > $CONFIG_STATUS <<EOF
#!${PYTHON}
# coding=$encoding
import os, sys
import os
dnl topsrcdir is the top source directory in native form, as opposed to a
dnl form suitable for make.
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
if not os.path.isabs(topsrcdir):
topsrcdir = os.path.normpath(os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir))
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
from ConfigStatus import config_status
args = {
'topsrcdir': topsrcdir,
'topobjdir': os.path.dirname(<<<__file__>>>),
topobjdir = os.path.dirname(<<<__file__>>>)
dnl All defines and substs are stored with an additional space at the beginning
dnl and at the end of the string, to avoid any problem with values starting or
dnl ending with quotes.
'defines': [(name[1:-1], value[1:-1]) for name, value in [
defines = [(name[1:-1], value[1:-1]) for name, value in [
EOF
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
@ -106,9 +101,9 @@ sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
rm confdefs.pytmp confdefs.h
cat >> $CONFIG_STATUS <<\EOF
] ],
] ]
'substs': [(name[1:-1], value[1:-1]) for name, value in [
substs = [(name[1:-1], value[1:-1]) for name, value in [
EOF
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
@ -118,51 +113,58 @@ undivert(MOZ_DIVERSION_SUBST)dnl
EOF
cat >> $CONFIG_STATUS <<\EOF
] ],
] ]
dnl List of files to apply AC_SUBSTs to. This is the list of files given
dnl as an argument to AC_OUTPUT ($1)
'files': [
files = [
EOF
for out in $1; do
echo " '$out'," >> $CONFIG_STATUS
echo " '$out'," >> $CONFIG_STATUS
done
cat >> $CONFIG_STATUS <<\EOF
],
]
dnl List of header files to apply AC_DEFINEs to. This is stored in the
dnl AC_LIST_HEADER m4 macro by AC_CONFIG_HEADER.
'headers': [
headers = [
EOF
ifdef(<<<AC_LIST_HEADER>>>, <<<
HEADERS="AC_LIST_HEADER"
for header in $HEADERS; do
echo " '$header'," >> $CONFIG_STATUS
echo " '$header'," >> $CONFIG_STATUS
done
>>>)dnl
cat >> $CONFIG_STATUS <<\EOF
],
]
dnl List of AC_DEFINEs that aren't to be exposed in ALLDEFINES
'non_global_defines': [
non_global_defines = [
EOF
if test -n "$_NON_GLOBAL_ACDEFINES"; then
for var in $_NON_GLOBAL_ACDEFINES; do
echo " '$var'," >> $CONFIG_STATUS
echo " '$var'," >> $CONFIG_STATUS
done
fi
cat >> $CONFIG_STATUS <<\EOF
]
}
cat >> $CONFIG_STATUS <<EOF
]
__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs', 'files', 'headers']
dnl Do the actual work
config_status(**args)
if __name__ == '__main__':
args = dict([(name, globals()[name]) for name in __all__])
import sys
dnl Don't rely on virtualenv here. Standalone js doesn't use it.
sys.path.append(os.path.join(topsrcdir, ${extra_python_path}'build'))
from ConfigStatus import config_status
config_status(**args)
EOF
changequote([, ])
chmod +x $CONFIG_STATUS