diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-05-28 12:45:31 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-05-28 12:45:31 -0500 |
commit | 2c992a0788536087bfd78da8f2c62b30a461d7e2 (patch) | |
tree | 5067a52fec2f27f77594b535cdc29672ee30d9f7 /configure.ac | |
parent | 78ba242403841104d40c330c3900912727ca0501 (diff) | |
download | cpython-git-2c992a0788536087bfd78da8f2c62b30a461d7e2.tar.gz |
backport computed gotos (#4753)
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 78fe3c785f..c2a183005b 100644 --- a/configure.ac +++ b/configure.ac @@ -4557,6 +4557,57 @@ for dir in $SRCDIRS; do mkdir $dir fi done + +# BEGIN_COMPUTED_GOTO +# Check for --with-computed-gotos +AC_MSG_CHECKING(for --with-computed-gotos) +AC_ARG_WITH(computed-gotos, + AS_HELP_STRING([--with(out)-computed-gotos], + [Use computed gotos in evaluation loop (enabled by default on supported compilers)]), +[ +if test "$withval" = yes +then + AC_DEFINE(USE_COMPUTED_GOTOS, 1, + [Define if you want to use computed gotos in ceval.c.]) + AC_MSG_RESULT(yes) +fi +if test "$withval" = no +then + AC_DEFINE(USE_COMPUTED_GOTOS, 0, + [Define if you want to use computed gotos in ceval.c.]) + AC_MSG_RESULT(no) +fi +], +[AC_MSG_RESULT(no value specified)]) + +AC_MSG_CHECKING(whether $CC supports computed gotos) +AC_CACHE_VAL(ac_cv_computed_gotos, +AC_RUN_IFELSE([AC_LANG_SOURCE([[[ +int main(int argc, char **argv) +{ + static void *targets[1] = { &&LABEL1 }; + goto LABEL2; +LABEL1: + return 0; +LABEL2: + goto *targets[0]; + return 1; +} +]]])], +[ac_cv_computed_gotos=yes], +[ac_cv_computed_gotos=no], +[if test "${with_computed_gotos+set}" = set; then + ac_cv_computed_gotos="$with_computed_gotos -- configured --with(out)-computed-gotos" + else + ac_cv_computed_gotos=no + fi])) +AC_MSG_RESULT($ac_cv_computed_gotos) +case "$ac_cv_computed_gotos" in yes*) + AC_DEFINE(HAVE_COMPUTED_GOTOS, 1, + [Define if the C compiler supports computed gotos.]) +esac +# END_COMPUTED_GOTO + AC_MSG_RESULT(done) # ensurepip option |