This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: configure should attempt to find a default C++ compiler.
Type: Stage:
Components: Build Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: gvanrossum, loewis
Priority: low Keywords:

Created on 2000-12-06 23:50 by gvanrossum, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (7)
msg2581 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-12-06 23:50
It's annoying that C++ isn't better supported by default. Currently, you must specify the C++ compiler with the --with-gxx=... flag.

The configure script could easily set CXX to g++ if that exists and if we are using GCC, for example.

(But why does using the --with-gxx flag automatically create a main program compiled with C++?)
msg2582 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-12-11 20:47
Martin, do you happen to be a C++ user?  Maybe you have an idea what to do with this?  If not, assign it back to me or to Nobody.
msg2583 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2000-12-13 14:17
The --with-cxx flag is designed to support extension modules written in C++. In some compilation systems, compiling any object file with C++ requires that the main function is compiled and linked with the C++ compiler. For example, on an a.out system, with g++, g++ will generate a call to __main as the first thing in main(), to allow for construction of global objects. On an advanced compilation system (e.g. ELF, or Win32), this is not necessary - global objects will be constructed even if main was not compiled with a C++ compiler.

I believe the sole purpose of --with-cxx flag is to support that case; I can't emagine any other reason to use it. Since  such requirement of the C++ compiler is becoming rare, I don't think there is a need to change the behaviour of the Python configure.in. 

So the real bug is that --with-cxx was not documented; that is corrected in README 1.107.
msg2584 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-12-13 14:27
Reopening, because of one remaining issue.  I just checked in changes to Modules/makesetup and Misc/Makefile.pre.in to use $(CXX) instead of $(CCC) for the C++ compiler, since CCC doesn't seem to be defined.  However this only works if --with-cxx is used; otherwise CXX is not defined either.  There was a bug report about this, #124478.

The problem is, CXX extensions using the Makefile.pre.in mechanism don't work out of the box unless --with-cxx is used.  I don't care if the --with-cxx option is changed (probably better not), but even if it isn't, the CXX variable should be given a default value if a C++ compiler can be guessed (I bet trying g++ when we're using GCC would take care of 90% of the problem :-).
msg2585 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2000-12-13 15:27
I've uploaded patch 102817, which runs something like AC_PROG_CXX. We can't use that directly, as it fails if no C++ compiler is found. Also, if -with-cxx is given, no attempt to autodetermine a C++ compiler is made.
msg2586 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2000-12-13 15:54
Closed again. Thanks!
msg2587 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2000-12-13 17:37
Fixed in configure.in 1.181.
History
Date User Action Args
2022-04-10 16:03:32adminsetgithub: 33559
2000-12-06 23:50:23gvanrossumcreate