The configure script for Python 4.2.2 add the compiler
flags -Wno-long-double and -no-cpp-precomp when using
the Gnu gcc compiler on Darwin. This causes the build
to fail when using versions of GCC build directly from
Gnu source (for example gcc-4.0.2 and gcc-4.1). These
options are only available when using the "native" gcc
compilers supplied with the Darwin OS. In particular I
am using OS X 8.5.0. There is a simple correction to
this problem that involves using autoconf tests for the
appropriateness of these options before adding them to
the BASECFLAGS environment variable. In particular the
following works:
Replace the line
BASECFLAGS="$BASECFLAGS -Wno-long-double
-no-cpp-precomp -mno-fused-madd"
at or near line 3165 under the Darwin case in configure.in
with the following test
AC_LANG_SAVE
AC_LANG_C
ac_save_cc="$CC"
for arg in -Wno-long-double -no-cpp-precomp
-mno-fused-madd ; do
CC="$ac_save_cc $arg"
AC_COMPILE_IFELSE([
AC_LANG_SOURCE([[
#include <stdlib.h>
#include <stdio.h>
int main(int argc,char**argv)
{
return 0;
}
]])],[BASECFLAGS="$BASECFLAGS $arg"],[])
done
CC="$ac_save_cc"
AC_LANG_RESTORE
in other words test to see if the option works with the
chosen compiler before adding it blindly to BASECFLAGS.
I am attaching this version of configure.in for your
convenience. I tested my build of Python-2.4.2 on both
Linux and Darwin using the apple version of gcc 3.3 as
well as Gnu versions gcc 4.0.2 and 4.1 that I built
from source. The build and install worked properly and
the python executable was runable in all cases. I did
not perform more extensive regression tests, but I
believe this change has no effect for compilations
using previously support configurations, and only
applies for new currently unsupported compilers.
|