2012-08-04 06:47:28 +00:00
|
|
|
dnl This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
dnl For use in AC_SUBST replacement
|
|
|
|
define([MOZ_DIVERSION_SUBST], 11)
|
|
|
|
|
|
|
|
dnl Replace AC_SUBST to store values in a format suitable for python.
|
|
|
|
dnl The necessary comma after the tuple can't be put here because it
|
|
|
|
dnl can mess around with things like:
|
|
|
|
dnl AC_SOMETHING(foo,AC_SUBST(),bar)
|
|
|
|
define([AC_SUBST],
|
2013-11-11 22:52:32 +00:00
|
|
|
[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
|
2014-03-20 01:55:00 +00:00
|
|
|
[ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
|
2012-08-04 06:47:28 +00:00
|
|
|
[ifdef([AC_SUBST_$1], ,
|
|
|
|
[define([AC_SUBST_$1], )dnl
|
|
|
|
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
2012-08-29 06:55:58 +00:00
|
|
|
(''' $1 ''', r''' [$]$1 ''')
|
2012-08-04 06:47:28 +00:00
|
|
|
AC_DIVERT_POP()dnl
|
2017-11-10 15:05:36 +00:00
|
|
|
])])])])])
|
2013-11-11 22:52:32 +00:00
|
|
|
|
|
|
|
dnl Like AC_SUBST, but makes the value available as a set in python,
|
|
|
|
dnl with values got from the value of the environment variable, split on
|
|
|
|
dnl whitespaces.
|
|
|
|
define([AC_SUBST_SET],
|
|
|
|
[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_SET on the same variable ($1)])],
|
2017-11-10 15:05:36 +00:00
|
|
|
[ifdef([AC_SUBST_LIST_$1], [m4_fatal([Cannot use AC_SUBST_LIST and AC_SUBST_SET on the same variable ($1)])],
|
2013-11-11 22:52:32 +00:00
|
|
|
[ifdef([AC_SUBST_SET_$1], ,
|
|
|
|
[define([AC_SUBST_SET_$1], )dnl
|
|
|
|
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
2017-10-25 22:10:04 +00:00
|
|
|
(''' $1 ''', unique_list(split(r''' [$]$1 ''')))
|
2013-11-11 22:52:32 +00:00
|
|
|
AC_DIVERT_POP()dnl
|
2017-11-10 15:05:36 +00:00
|
|
|
])])])])])
|
2014-03-20 01:55:00 +00:00
|
|
|
|
|
|
|
dnl Like AC_SUBST, but makes the value available as a list in python,
|
|
|
|
dnl with values got from the value of the environment variable, split on
|
|
|
|
dnl whitespaces.
|
|
|
|
define([AC_SUBST_LIST],
|
|
|
|
[ifdef([AC_SUBST_$1], [m4_fatal([Cannot use AC_SUBST and AC_SUBST_LIST on the same variable ($1)])],
|
|
|
|
[ifdef([AC_SUBST_SET_$1], [m4_fatal([Cannot use AC_SUBST_SET and AC_SUBST_LIST on the same variable ($1)])],
|
|
|
|
[ifdef([AC_SUBST_LIST_$1], ,
|
|
|
|
[define([AC_SUBST_LIST_$1], )dnl
|
|
|
|
AC_DIVERT_PUSH(MOZ_DIVERSION_SUBST)dnl
|
2017-10-25 22:10:04 +00:00
|
|
|
(''' $1 ''', list(split(r''' [$]$1 ''')))
|
2014-03-20 01:55:00 +00:00
|
|
|
AC_DIVERT_POP()dnl
|
2017-11-10 15:05:36 +00:00
|
|
|
])])])])])
|
|
|
|
|
2014-07-22 23:40:12 +00:00
|
|
|
dnl Ignore AC_SUBSTs for variables we don't have use for but that autoconf
|
|
|
|
dnl itself exports.
|
|
|
|
define([AC_SUBST_CFLAGS], )
|
|
|
|
define([AC_SUBST_CPPFLAGS], )
|
|
|
|
define([AC_SUBST_CXXFLAGS], )
|
|
|
|
define([AC_SUBST_FFLAGS], )
|
|
|
|
define([AC_SUBST_DEFS], )
|
|
|
|
define([AC_SUBST_LDFLAGS], )
|
|
|
|
define([AC_SUBST_LIBS], )
|
|
|
|
|
2012-08-04 06:47:28 +00:00
|
|
|
dnl Wrap AC_DEFINE to store values in a format suitable for python.
|
|
|
|
dnl autoconf's AC_DEFINE still needs to be used to fill confdefs.h,
|
|
|
|
dnl which is #included during some compile checks.
|
|
|
|
dnl The necessary comma after the tuple can't be put here because it
|
|
|
|
dnl can mess around with things like:
|
|
|
|
dnl AC_SOMETHING(foo,AC_DEFINE(),bar)
|
|
|
|
define([_MOZ_AC_DEFINE], defn([AC_DEFINE]))
|
|
|
|
define([AC_DEFINE],
|
|
|
|
[cat >> confdefs.pytmp <<\EOF
|
2012-08-29 06:55:58 +00:00
|
|
|
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
2012-08-04 06:47:28 +00:00
|
|
|
EOF
|
|
|
|
ifelse($#, 2, _MOZ_AC_DEFINE([$1], [$2]), $#, 3, _MOZ_AC_DEFINE([$1], [$2], [$3]),_MOZ_AC_DEFINE([$1]))dnl
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl Wrap AC_DEFINE_UNQUOTED to store values in a format suitable for
|
|
|
|
dnl python.
|
|
|
|
define([_MOZ_AC_DEFINE_UNQUOTED], defn([AC_DEFINE_UNQUOTED]))
|
|
|
|
define([AC_DEFINE_UNQUOTED],
|
|
|
|
[cat >> confdefs.pytmp <<EOF
|
2012-08-29 06:55:58 +00:00
|
|
|
(''' $1 ''', ifelse($#, 2, [r''' $2 '''], $#, 3, [r''' $2 '''], ' 1 '))
|
2012-08-04 06:47:28 +00:00
|
|
|
EOF
|
|
|
|
ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1, $2, $3),_MOZ_AC_DEFINE_UNQUOTED($1))dnl
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl Replace AC_OUTPUT to create and call a python config.status
|
2014-02-11 01:37:47 +00:00
|
|
|
define([MOZ_CREATE_CONFIG_STATUS],
|
2018-09-18 20:02:22 +00:00
|
|
|
[dnl Used in all Makefile.in files
|
2012-08-04 06:47:28 +00:00
|
|
|
top_srcdir=$srcdir
|
|
|
|
AC_SUBST(top_srcdir)
|
|
|
|
|
|
|
|
dnl Picked from autoconf 2.13
|
|
|
|
trap '' 1 2 15
|
|
|
|
AC_CACHE_SAVE
|
|
|
|
|
|
|
|
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
|
2016-02-25 19:59:53 +00:00
|
|
|
: ${CONFIG_STATUS=./config.data}
|
2012-08-04 06:47:28 +00:00
|
|
|
|
|
|
|
dnl We're going to need [ ] for python syntax.
|
|
|
|
changequote(<<<, >>>)dnl
|
|
|
|
echo creating $CONFIG_STATUS
|
|
|
|
|
|
|
|
cat > $CONFIG_STATUS <<EOF
|
2015-09-29 06:03:26 +00:00
|
|
|
|
2012-08-04 06:47:28 +00:00
|
|
|
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.
|
2016-02-25 19:59:53 +00:00
|
|
|
defines = [
|
2012-08-04 06:47:28 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
dnl confdefs.pytmp contains AC_DEFINEs, in the expected format, but
|
|
|
|
dnl lacks the final comma (see above).
|
|
|
|
sed 's/$/,/' confdefs.pytmp >> $CONFIG_STATUS
|
|
|
|
rm confdefs.pytmp confdefs.h
|
|
|
|
|
|
|
|
cat >> $CONFIG_STATUS <<\EOF
|
2016-02-25 19:59:53 +00:00
|
|
|
]
|
2012-08-04 06:47:28 +00:00
|
|
|
|
2016-02-25 19:59:53 +00:00
|
|
|
substs = [
|
2012-08-04 06:47:28 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
dnl The MOZ_DIVERSION_SUBST output diversion contains AC_SUBSTs, in the
|
|
|
|
dnl expected format, but lacks the final comma (see above).
|
|
|
|
sed 's/$/,/' >> $CONFIG_STATUS <<EOF
|
|
|
|
undivert(MOZ_DIVERSION_SUBST)dnl
|
|
|
|
EOF
|
|
|
|
|
2013-02-26 19:45:52 +00:00
|
|
|
dnl Add in the output from the subconfigure script
|
|
|
|
for ac_subst_arg in $_subconfigure_ac_subst_args; do
|
|
|
|
variable='$'$ac_subst_arg
|
|
|
|
echo " (''' $ac_subst_arg ''', r''' `eval echo $variable` ''')," >> $CONFIG_STATUS
|
|
|
|
done
|
|
|
|
|
2012-08-04 06:47:28 +00:00
|
|
|
cat >> $CONFIG_STATUS <<\EOF
|
2016-02-25 19:59:53 +00:00
|
|
|
]
|
2012-08-04 06:47:28 +00:00
|
|
|
|
2016-03-04 08:31:10 +00:00
|
|
|
flags = [
|
|
|
|
undivert(MOZ_DIVERSION_ARGS)dnl
|
|
|
|
]
|
2012-08-04 06:47:28 +00:00
|
|
|
EOF
|
2014-02-11 01:37:47 +00:00
|
|
|
|
2012-08-04 06:47:28 +00:00
|
|
|
changequote([, ])
|
|
|
|
])
|
2013-09-20 01:44:11 +00:00
|
|
|
|
2013-10-23 21:43:32 +00:00
|
|
|
define([m4_fatal],[
|
|
|
|
errprint([$1
|
|
|
|
])
|
|
|
|
m4exit(1)
|
|
|
|
])
|
|
|
|
|
2014-02-11 01:37:47 +00:00
|
|
|
define([AC_OUTPUT], [ifelse($#_$1, 1_, [MOZ_CREATE_CONFIG_STATUS()
|
|
|
|
MOZ_RUN_CONFIG_STATUS()],
|
2013-10-23 21:43:32 +00:00
|
|
|
[m4_fatal([Use CONFIGURE_SUBST_FILES in moz.build files to create substituted files.])]
|
|
|
|
)])
|
|
|
|
|
|
|
|
define([AC_CONFIG_HEADER],
|
|
|
|
[m4_fatal([Use CONFIGURE_DEFINE_FILES in moz.build files to produce header files.])
|
|
|
|
])
|