summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2022-03-31 10:19:08 (GMT)
committerGitHub <noreply@github.com>2022-03-31 10:19:08 (GMT)
commitb36d222110d0d6d84dc8e973ca87d976c2423f5d (patch)
tree400ef6d69aad09d5e95ad89b64f56c60959bf175 /configure
parent7fc39a21cb85163a456eab91b52e5fe85e7f7e3e (diff)
downloadcpython-b36d222110d0d6d84dc8e973ca87d976c2423f5d.zip
cpython-b36d222110d0d6d84dc8e973ca87d976c2423f5d.tar.gz
cpython-b36d222110d0d6d84dc8e973ca87d976c2423f5d.tar.bz2
bpo-45847: Port _tkinter to PY_STDLIB_MOD (GH-31698)
- Remove ``--with-tclk-*`` options from `configure` - Use pkg-config to detect `_tkinter` dependencies (Tcl/Tk, X11) - Manual override via environment variables `TCLTK_CFLAGS` and `TCLTK_LIBS`
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure383
1 files changed, 314 insertions, 69 deletions
diff --git a/configure b/configure
index 17f5299..f261a86 100755
--- a/configure
+++ b/configure
@@ -654,6 +654,8 @@ MODULE_BINASCII_FALSE
MODULE_BINASCII_TRUE
MODULE_ZLIB_FALSE
MODULE_ZLIB_TRUE
+MODULE__TKINTER_FALSE
+MODULE__TKINTER_TRUE
MODULE__UUID_FALSE
MODULE__UUID_TRUE
MODULE__SQLITE3_FALSE
@@ -821,8 +823,10 @@ DFLAGS
DTRACE
GDBM_LIBS
GDBM_CFLAGS
+X11_LIBS
+X11_CFLAGS
TCLTK_LIBS
-TCLTK_INCLUDES
+TCLTK_CFLAGS
LIBSQLITE3_LIBS
LIBSQLITE3_CFLAGS
LIBNSL_LIBS
@@ -1032,8 +1036,6 @@ with_system_ffi
with_system_libmpdec
with_decimal_contextvar
enable_loadable_sqlite_extensions
-with_tcltk_includes
-with_tcltk_libs
with_dbmliborder
enable_ipv6
with_doc_strings
@@ -1077,6 +1079,10 @@ LIBNSL_CFLAGS
LIBNSL_LIBS
LIBSQLITE3_CFLAGS
LIBSQLITE3_LIBS
+TCLTK_CFLAGS
+TCLTK_LIBS
+X11_CFLAGS
+X11_LIBS
GDBM_CFLAGS
GDBM_LIBS
ZLIB_CFLAGS
@@ -1801,10 +1807,6 @@ Optional Packages:
--with-decimal-contextvar
build _decimal module using a coroutine-local rather
than a thread-local context (default is yes)
- --with-tcltk-includes='-I...'
- override search for Tcl and Tk include files
- --with-tcltk-libs='-L...'
- override search for Tcl and Tk libs
--with-dbmliborder=db1:db2:...
override order to check db backends for dbm; a valid
value is a colon separated string with the backend
@@ -1880,6 +1882,11 @@ Some influential environment variables:
C compiler flags for LIBSQLITE3, overriding pkg-config
LIBSQLITE3_LIBS
linker flags for LIBSQLITE3, overriding pkg-config
+ TCLTK_CFLAGS
+ C compiler flags for TCLTK, overriding pkg-config
+ TCLTK_LIBS linker flags for TCLTK, overriding pkg-config
+ X11_CFLAGS C compiler flags for X11, overriding pkg-config
+ X11_LIBS linker flags for X11, overriding pkg-config
GDBM_CFLAGS C compiler flags for gdbm
GDBM_LIBS additional linker flags for gdbm
ZLIB_CFLAGS C compiler flags for ZLIB, overriding pkg-config
@@ -12334,50 +12341,280 @@ $as_echo "#define PY_SQLITE_ENABLE_LOAD_EXTENSION 1" >>confdefs.h
fi
-# Check for --with-tcltk-includes=path and --with-tcltk-libs=path
+found_tcltk=no
+for _QUERY in \
+ "tcl >= 8.5.12 tk >= 8.5.12" \
+ "tcl8.6 tk8.6" \
+ "tcl86 tk86" \
+ "tcl8.5 >= 8.5.12 tk8.5 >= 8.5.12" \
+ "tcl85 >= 8.5.12 tk85 >= 8.5.12" \
+; do
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$_QUERY\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "$_QUERY") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-tcltk-includes" >&5
-$as_echo_n "checking for --with-tcltk-includes... " >&6; }
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TCLTK" >&5
+$as_echo_n "checking for TCLTK... " >&6; }
-# Check whether --with-tcltk-includes was given.
-if test "${with_tcltk_includes+set}" = set; then :
- withval=$with_tcltk_includes;
+if test -n "$TCLTK_CFLAGS"; then
+ pkg_cv_TCLTK_CFLAGS="$TCLTK_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$_QUERY\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "$_QUERY") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_TCLTK_CFLAGS=`$PKG_CONFIG --cflags "$_QUERY" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
else
- with_tcltk_includes="default"
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$TCLTK_LIBS"; then
+ pkg_cv_TCLTK_LIBS="$TCLTK_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$_QUERY\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "$_QUERY") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_TCLTK_LIBS=`$PKG_CONFIG --libs "$_QUERY" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_tcltk_includes" >&5
-$as_echo "$with_tcltk_includes" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-tcltk-libs" >&5
-$as_echo_n "checking for --with-tcltk-libs... " >&6; }
-# Check whether --with-tcltk-libs was given.
-if test "${with_tcltk_libs+set}" = set; then :
- withval=$with_tcltk_libs;
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
else
- with_tcltk_libs="default"
+ _pkg_short_errors_supported=no
fi
+ if test $_pkg_short_errors_supported = yes; then
+ TCLTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$_QUERY" 2>&1`
+ else
+ TCLTK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$_QUERY" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$TCLTK_PKG_ERRORS" >&5
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_tcltk_libs" >&5
-$as_echo "$with_tcltk_libs" >&6; }
-if test "x$with_tcltk_includes" = xdefault || test "x$with_tcltk_libs" = xdefault
-then
- if test "x$with_tcltk_includes" != "x$with_tcltk_libs"
- then
- as_fn_error $? "use both --with-tcltk-includes='...' and --with-tcltk-libs='...' or neither" "$LINENO" 5
- fi
- if test -n "$PKG_CONFIG" && "$PKG_CONFIG" --exists tcl tk; then
- TCLTK_INCLUDES="`"$PKG_CONFIG" tcl tk --cflags-only-I 2>/dev/null`"
- TCLTK_LIBS="`"$PKG_CONFIG" tcl tk --libs 2>/dev/null`"
- else
- TCLTK_INCLUDES=""
- TCLTK_LIBS=""
- fi
+ found_tcltk=no
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ found_tcltk=no
+else
+ TCLTK_CFLAGS=$pkg_cv_TCLTK_CFLAGS
+ TCLTK_LIBS=$pkg_cv_TCLTK_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ found_tcltk=yes
+fi
+
+fi
+ if test "x$found_tcltk" = xyes; then :
+ break
+fi
+done
+
+if test "x$found_tcltk" = xno; then :
+
+ TCLTK_CFLAGS=${TCLTK_CFLAGS-""}
+ TCLTK_LIBS=${TCLTK_LIBS-""}
+
+fi
+
+case $ac_sys_system in #(
+ FreeBSD*) :
+
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "x11") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X11" >&5
+$as_echo_n "checking for X11... " >&6; }
+
+if test -n "$X11_CFLAGS"; then
+ pkg_cv_X11_CFLAGS="$X11_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "x11") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_X11_CFLAGS=`$PKG_CONFIG --cflags "x11" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$X11_LIBS"; then
+ pkg_cv_X11_LIBS="$X11_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "x11") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_X11_LIBS=`$PKG_CONFIG --libs "x11" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
else
- TCLTK_INCLUDES="$with_tcltk_includes"
- TCLTK_LIBS="$with_tcltk_libs"
+ pkg_failed=yes
fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ X11_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "x11" 2>&1`
+ else
+ X11_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "x11" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$X11_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (x11) were not met:
+
+$X11_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables X11_CFLAGS
+and X11_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables X11_CFLAGS
+and X11_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ X11_CFLAGS=$pkg_cv_X11_CFLAGS
+ X11_LIBS=$pkg_cv_X11_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+ TCLTK_CFLAGS="$TCLTK_CFLAGS $X11_CFLAGS"
+ TCLTK_LIBS="$TCLTK_LIBS $X11_LIBS"
+
+fi
+
+fi
+
+ ;; #(
+ *) :
+ ;;
+esac
+
+save_CFLAGS=$CFLAGS
+save_CPPFLAGS=$CPPFLAGS
+save_LDFLAGS=$LDFLAGS
+save_LIBS=$LIBS
+
+
+ CPPFLAGS="$TCLTK_CFLAGS $CFLAGS"
+ LIBS="$TCLTK_LIBS $LDFLAGS"
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+ #include <tcl.h>
+ #include <tk.h>
+ #if defined(TK_HEX_VERSION)
+ # if TK_HEX_VERSION < 0x0805020c
+ # error "Tk older than 8.5.12 not supported"
+ # endif
+ #endif
+ #if (TCL_MAJOR_VERSION < 8) || \
+ ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 5)) || \
+ ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION == 5) && (TCL_RELEASE_SERIAL < 12))
+ # error "Tcl older than 8.5.12 not supported"
+ #endif
+ #if (TK_MAJOR_VERSION < 8) || \
+ ((TK_MAJOR_VERSION == 8) && (TK_MINOR_VERSION < 5)) || \
+ ((TK_MAJOR_VERSION == 8) && (TK_MINOR_VERSION == 5) && (TK_RELEASE_SERIAL < 12))
+ # error "Tk older than 8.5.12 not supported"
+ #endif
+
+int
+main ()
+{
+
+ void *x1 = Tcl_Init;
+ void *x2 = Tk_Init;
+
+ ;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ have_tcltk=yes
+ as_fn_append TCLTK_CFLAGS " -Wno-strict-prototypes -DWITH_APPINIT=1"
+
+else
+
+ have_tcltk=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+CFLAGS=$save_CFLAGS
+CPPFLAGS=$save_CPPFLAGS
+LDFLAGS=$save_LDFLAGS
+LIBS=$save_LIBS
+
+
@@ -18312,36 +18549,6 @@ _ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UCS-4 tcl" >&5
-$as_echo_n "checking for UCS-4 tcl... " >&6; }
-have_ucs4_tcl=no
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <tcl.h>
-#if TCL_UTF_MAX != 6
-# error "NOT UCS4_TCL"
-#endif
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-
-$as_echo "#define HAVE_UCS4_TCL 1" >>confdefs.h
-
- have_ucs4_tcl=yes
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ucs4_tcl" >&5
-$as_echo "$have_ucs4_tcl" >&6; }
-
# check whether wchar_t is signed or not
if test "$wchar_h" = yes
then
@@ -23224,6 +23431,40 @@ fi
$as_echo "$py_cv_module__uuid" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _tkinter" >&5
+$as_echo_n "checking for stdlib extension module _tkinter... " >&6; }
+ if test "$py_cv_module__tkinter" != "n/a"; then :
+
+ if true; then :
+ if test "$have_tcltk" = "yes"; then :
+ py_cv_module__tkinter=yes
+else
+ py_cv_module__tkinter=missing
+fi
+else
+ py_cv_module__tkinter=disabled
+fi
+
+fi
+ as_fn_append MODULE_BLOCK "MODULE__TKINTER=$py_cv_module__tkinter$as_nl"
+ if test "x$py_cv_module__tkinter" = xyes; then :
+
+ as_fn_append MODULE_BLOCK "MODULE__TKINTER_CFLAGS=$TCLTK_CFLAGS$as_nl"
+ as_fn_append MODULE_BLOCK "MODULE__TKINTER_LDFLAGS=$TCLTK_LIBS$as_nl"
+
+fi
+ if test "$py_cv_module__tkinter" = yes; then
+ MODULE__TKINTER_TRUE=
+ MODULE__TKINTER_FALSE='#'
+else
+ MODULE__TKINTER_TRUE='#'
+ MODULE__TKINTER_FALSE=
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__tkinter" >&5
+$as_echo "$py_cv_module__tkinter" >&6; }
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module zlib" >&5
$as_echo_n "checking for stdlib extension module zlib... " >&6; }
@@ -24084,6 +24325,10 @@ if test -z "${MODULE__UUID_TRUE}" && test -z "${MODULE__UUID_FALSE}"; then
as_fn_error $? "conditional \"MODULE__UUID\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${MODULE__TKINTER_TRUE}" && test -z "${MODULE__TKINTER_FALSE}"; then
+ as_fn_error $? "conditional \"MODULE__TKINTER\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${MODULE_ZLIB_TRUE}" && test -z "${MODULE_ZLIB_FALSE}"; then
as_fn_error $? "conditional \"MODULE_ZLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5