[Python-Dev] Why is python linked with c++?

Neil Schemenauer nas-python@python.ca
Tue, 8 Jul 2003 15:22:23 -0700


Skip Montanaro wrote:
> I was just doinking around with the configure script to add an
> --enable-profiling flag.  I notice that "c++" is used to link my python.exe
> (this on Mac OS X):

I remember this used to be the case on Linux bug I made a change that
undid it:

    revision 1.199
    date: 2001/01/27 21:39:17;  author: nascheme;  state: Exp;  lines: +9 -6
    - Remove Guido's LINKCC=CXX experiment.
    - Cygwin doesn't want CCSHARED flag when bulding the interpreter DLL.

The current configure script sets LINKCC to CXX if CXX is set.  CXX gets
set if you provide --with-cxx=<path>.  It looks like CXX may also get
automatically set:

    dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
    ifdef([AC_PROG_CXX_WORKS],[],
          [AC_DEFUN([AC_PROG_CXX_WORKS],
          [AC_LANG_PUSH(C++)dnl
           _AC_COMPILER_EXEEXT
           AC_LANG_POP()
          ]
    )])

    if test "$check_cxx" = "yes" 
    then
            AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
            if test "$CXX" = "notfound"
            then
                    CXX=
            else
                    AC_PROG_CXX_WORKS
            fi
    fi

You should be able to explicitly disable C++ using --without-cxx.  In
any case, I would say the behavior is intentional.

  Neil