Skip to content

Commit 398ed84

Browse files
authored
pythongh-93744: Remove configure --with-cxx-main option (python#95651)
Remove the "configure --with-cxx-main" build option: it didn't work for many years. Remove the MAINCC variable from configure and Makefile. The MAINCC variable was added by the issue pythongh-42471: commit 0f48d98. Previously, --with-cxx-main was named --with-cxx. Keep CXX and LDCXXSHARED variables, even if they are no longer used by Python build system.
1 parent 3a9e1fd commit 398ed84

File tree

5 files changed

+8
-81
lines changed

5 files changed

+8
-81
lines changed

Doc/using/configure.rst

+1-19
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ General Options
4141

4242
See :data:`sys.int_info.bits_per_digit <sys.int_info>`.
4343

44-
.. cmdoption:: --with-cxx-main
45-
.. cmdoption:: --with-cxx-main=COMPILER
46-
47-
Compile the Python ``main()`` function and link Python executable with C++
48-
compiler: ``$CXX``, or *COMPILER* if specified.
49-
5044
.. cmdoption:: --with-suffix=SUFFIX
5145

5246
Set the Python executable suffix to *SUFFIX*.
@@ -721,22 +715,10 @@ Compiler flags
721715

722716
Example: ``gcc -pthread``.
723717

724-
.. envvar:: MAINCC
725-
726-
C compiler command used to build the ``main()`` function of programs like
727-
``python``.
728-
729-
Variable set by the :option:`--with-cxx-main` option of the configure
730-
script.
731-
732-
Default: ``$(CC)``.
733-
734718
.. envvar:: CXX
735719

736720
C++ compiler command.
737721

738-
Used if the :option:`--with-cxx-main` option is used.
739-
740722
Example: ``g++ -pthread``.
741723

742724
.. envvar:: CFLAGS
@@ -854,7 +836,7 @@ Linker flags
854836

855837
Linker command used to build programs like ``python`` and ``_testembed``.
856838

857-
Default: ``$(PURIFY) $(MAINCC)``.
839+
Default: ``$(PURIFY) $(CC)``.
858840

859841
.. envvar:: CONFIGURE_LDFLAGS
860842

Makefile.pre.in

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ abs_builddir= @abs_builddir@
3636

3737
CC= @CC@
3838
CXX= @CXX@
39-
MAINCC= @MAINCC@
4039
LINKCC= @LINKCC@
4140
AR= @AR@
4241
READELF= @READELF@
@@ -1222,10 +1221,10 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h M
12221221
-o $@ $(srcdir)/Modules/getpath.c
12231222

12241223
Programs/python.o: $(srcdir)/Programs/python.c
1225-
$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/python.c
1224+
$(CC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/python.c
12261225

12271226
Programs/_testembed.o: $(srcdir)/Programs/_testembed.c Programs/test_frozenmain.h
1228-
$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/_testembed.c
1227+
$(CC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/_testembed.c
12291228

12301229
Modules/_sre/sre.o: $(srcdir)/Modules/_sre/sre.c $(srcdir)/Modules/_sre/sre.h $(srcdir)/Modules/_sre/sre_constants.h $(srcdir)/Modules/_sre/sre_lib.h
12311230

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Remove the ``configure --with-cxx-main`` build option: it didn't work for
2+
many years. Remove the ``MAINCC`` variable from ``configure`` and
3+
``Makefile``. Patch by Victor Stinner.

configure

+1-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+1-24
Original file line numberDiff line numberDiff line change
@@ -865,29 +865,6 @@ rm -f conftest.c conftest.out
865865
AC_USE_SYSTEM_EXTENSIONS
866866

867867
AC_SUBST(CXX)
868-
AC_SUBST(MAINCC)
869-
AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
870-
AC_ARG_WITH(cxx_main,
871-
AS_HELP_STRING([--with-cxx-main@<:@=COMPILER@:>@],
872-
[compile main() and link Python executable with C++ compiler specified in COMPILER (default is $CXX)]),
873-
[
874-
875-
case $withval in
876-
no) with_cxx_main=no
877-
MAINCC='$(CC)';;
878-
yes) with_cxx_main=yes
879-
MAINCC='$(CXX)';;
880-
*) with_cxx_main=yes
881-
MAINCC=$withval
882-
if test -z "$CXX"
883-
then
884-
CXX=$withval
885-
fi;;
886-
esac], [
887-
with_cxx_main=no
888-
MAINCC='$(CC)'
889-
])
890-
AC_MSG_RESULT($with_cxx_main)
891868

892869
preset_cxx="$CXX"
893870
if test -z "$CXX"
@@ -1358,7 +1335,7 @@ AC_SUBST(LINKCC)
13581335
AC_MSG_CHECKING(LINKCC)
13591336
if test -z "$LINKCC"
13601337
then
1361-
LINKCC='$(PURIFY) $(MAINCC)'
1338+
LINKCC='$(PURIFY) $(CC)'
13621339
case $ac_sys_system in
13631340
QNX*)
13641341
# qcc must be used because the other compilers do not

0 commit comments

Comments
 (0)