Split OPT make variable into OPT and BASECFLAGS. The latter contains those
compiler flags which are necessary to get a clean compile. The former is for user-specified optimizer, debug, trace fiddling. See patch 640843. Add /sw/lib and /sw/include to setup.py search paths on Darwin to take advantage of fink goodies. Add scriptsinstall target to Makefile to install certain scripts from Tools/scripts directory.
This commit is contained in:
parent
dc392e3143
commit
decc6a47df
|
@ -54,7 +54,8 @@ MAKESETUP= $(srcdir)/Modules/makesetup
|
||||||
|
|
||||||
# Compiler options
|
# Compiler options
|
||||||
OPT= @OPT@
|
OPT= @OPT@
|
||||||
CFLAGS= $(OPT)
|
BASECFLAGS= @BASECFLAGS@
|
||||||
|
CFLAGS= $(BASECFLAGS) $(OPT)
|
||||||
CPPFLAGS= -I. -I$(srcdir)/Include
|
CPPFLAGS= -I. -I$(srcdir)/Include
|
||||||
LDFLAGS= @LDFLAGS@
|
LDFLAGS= @LDFLAGS@
|
||||||
LDLAST= @LDLAST@
|
LDLAST= @LDLAST@
|
||||||
|
@ -844,6 +845,13 @@ idleinstall:
|
||||||
--install-scripts=$(BINDIR) \
|
--install-scripts=$(BINDIR) \
|
||||||
--install-platlib=$(DESTSHARED)
|
--install-platlib=$(DESTSHARED)
|
||||||
|
|
||||||
|
# This installs a few of the useful scripts in Tools/scripts
|
||||||
|
scriptsinstall:
|
||||||
|
SRCDIR=$(srcdir) \
|
||||||
|
./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
|
||||||
|
--prefix=$(prefix) \
|
||||||
|
--install-scripts=$(BINDIR)
|
||||||
|
|
||||||
# Build the toplevel Makefile
|
# Build the toplevel Makefile
|
||||||
Makefile.pre: Makefile.pre.in config.status
|
Makefile.pre: Makefile.pre.in config.status
|
||||||
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
|
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
|
||||||
|
|
18
Misc/NEWS
18
Misc/NEWS
|
@ -26,6 +26,24 @@ Tools/Demos
|
||||||
Build
|
Build
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- On systems which build using the configure script, compiler flags which
|
||||||
|
used to be lumped together using the OPT flag have been split into two
|
||||||
|
groups, OPT and BASECFLAGS. OPT is meant to carry just optimization- and
|
||||||
|
debug-related flags like "-g" and "-O3". BASECFLAGS is meant to carry
|
||||||
|
compiler flags that are required to get a clean compile. On some
|
||||||
|
platforms (many Linux flavors in particular) BASECFLAGS will be empty by
|
||||||
|
default. On others, such as Mac OS X and SCO, it will contain required
|
||||||
|
flags. This change allows people building Python to override OPT without
|
||||||
|
fear of clobbering compiler flags which are required to get a clean build.
|
||||||
|
|
||||||
|
- On Darwin/Mac OS X platforms, /sw/lib and /sw/include are added to the
|
||||||
|
relevant search lists in setup.py. This allows users building Python to
|
||||||
|
take advantage of the many packages available from the fink project
|
||||||
|
<http://fink.sf.net/>.
|
||||||
|
|
||||||
|
- A new Makefile target, scriptsinstall, installs a number of useful scripts
|
||||||
|
from the Tools/scripts directory.
|
||||||
|
|
||||||
C API
|
C API
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|
120
configure.in
120
configure.in
|
@ -168,6 +168,15 @@ fi
|
||||||
AC_MSG_RESULT($EXTRAPLATDIR)
|
AC_MSG_RESULT($EXTRAPLATDIR)
|
||||||
|
|
||||||
# checks for alternative programs
|
# checks for alternative programs
|
||||||
|
|
||||||
|
# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
|
||||||
|
# for debug/optimization stuff. BASECFLAGS is for flags that are required
|
||||||
|
# just to get things to compile and link. Users are free to override OPT
|
||||||
|
# when running configure or make. The build should not break if they do.
|
||||||
|
# BASECFLAGS should generally not be messed with, however.
|
||||||
|
|
||||||
|
# XXX shouldn't some/most/all of this code be merged with the stuff later
|
||||||
|
# on that fiddles with OPT and BASECFLAGS?
|
||||||
AC_MSG_CHECKING(for --without-gcc)
|
AC_MSG_CHECKING(for --without-gcc)
|
||||||
AC_ARG_WITH(gcc,
|
AC_ARG_WITH(gcc,
|
||||||
AC_HELP_STRING(--without-gcc,never use gcc),
|
AC_HELP_STRING(--without-gcc,never use gcc),
|
||||||
|
@ -188,13 +197,14 @@ AC_ARG_WITH(gcc,
|
||||||
ppc)
|
ppc)
|
||||||
CC=mwcc
|
CC=mwcc
|
||||||
without_gcc=yes
|
without_gcc=yes
|
||||||
OPT="-O -export pragma"
|
BASECFLAGS="$BASECFLAGS -export pragma"
|
||||||
|
OPT="$OPT -O"
|
||||||
LDFLAGS="$LDFLAGS -nodup"
|
LDFLAGS="$LDFLAGS -nodup"
|
||||||
;;
|
;;
|
||||||
x86)
|
x86)
|
||||||
CC=gcc
|
CC=gcc
|
||||||
without_gcc=no
|
without_gcc=no
|
||||||
OPT=-O
|
OPT="$OPT -O"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
|
AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
|
||||||
|
@ -484,7 +494,7 @@ if test $enable_shared = "yes"; then
|
||||||
case $MACHDEP in
|
case $MACHDEP in
|
||||||
dguxR4)
|
dguxR4)
|
||||||
LDLIBRARY='libpython$(VERSION).so'
|
LDLIBRARY='libpython$(VERSION).so'
|
||||||
OPT="$OPT -pic"
|
BASECFLAGS="$BASECFLAGS -pic"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
@ -531,13 +541,27 @@ else AC_MSG_RESULT(no); Py_DEBUG='false'
|
||||||
fi],
|
fi],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
|
|
||||||
|
# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
|
||||||
|
# merged with this chunk of code?
|
||||||
|
|
||||||
# Optimizer/debugger flags
|
# Optimizer/debugger flags
|
||||||
|
# ------------------------
|
||||||
|
# (The following bit of code is complicated enough - please keep things
|
||||||
|
# indented properly. Just pretend you're editing Python code. ;-)
|
||||||
|
|
||||||
|
# There are two parallel sets of case statements below, one that checks to
|
||||||
|
# see if OPT was set and one that does BASECFLAGS setting based upon
|
||||||
|
# compiler and platform. BASECFLAGS tweaks need to be made even if the
|
||||||
|
# user set OPT.
|
||||||
|
|
||||||
|
# tweak OPT based on compiler and platform, only if the user didn't set
|
||||||
|
# it on the command line
|
||||||
AC_SUBST(OPT)
|
AC_SUBST(OPT)
|
||||||
if test -z "$OPT"
|
if test -z "$OPT"
|
||||||
then
|
then
|
||||||
case $GCC in
|
case $GCC in
|
||||||
yes)
|
yes)
|
||||||
case $ac_cv_prog_cc_g in
|
case $ac_cv_prog_cc_g in
|
||||||
yes)
|
yes)
|
||||||
if test "$Py_DEBUG" = 'true' ; then
|
if test "$Py_DEBUG" = 'true' ; then
|
||||||
# Optimization messes up debuggers, so turn it off for
|
# Optimization messes up debuggers, so turn it off for
|
||||||
|
@ -545,45 +569,69 @@ then
|
||||||
OPT="-g -Wall -Wstrict-prototypes"
|
OPT="-g -Wall -Wstrict-prototypes"
|
||||||
else
|
else
|
||||||
OPT="-g -O3 -Wall -Wstrict-prototypes"
|
OPT="-g -O3 -Wall -Wstrict-prototypes"
|
||||||
fi;;
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
OPT="-O3 -Wall -Wstrict-prototypes";;
|
OPT="-O3 -Wall -Wstrict-prototypes"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
SCO_SV*) OPT="$OPT -m486 -DSCO5";;
|
SCO_SV*) OPT="$OPT -m486 -DSCO5"
|
||||||
esac
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
case $ac_sys_system in
|
OPT="-O"
|
||||||
OpenUNIX*|UnixWare*)
|
;;
|
||||||
OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
|
|
||||||
SCO_SV*)
|
|
||||||
CFLAGS="$CFLAGS -belf"
|
|
||||||
OPT="-belf -O -Ki486 -DSCO5";;
|
|
||||||
*)
|
|
||||||
OPT="-O";;
|
|
||||||
esac
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# The current (beta) Monterey compiler dies with optimizations
|
||||||
|
# XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
Darwin*)
|
Monterey*)
|
||||||
OPT="$OPT -Wno-long-double -no-cpp-precomp";;
|
OPT=""
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(BASECFLAGS)
|
||||||
|
# tweak BASECFLAGS based on compiler and platform
|
||||||
|
case $GCC in
|
||||||
|
yes)
|
||||||
|
case $ac_sys_system in
|
||||||
|
SCO_SV*)
|
||||||
|
BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
|
||||||
|
;;
|
||||||
|
# is there any other compiler on Darwin besides gcc?
|
||||||
|
Darwin*)
|
||||||
|
BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
case $ac_sys_system in
|
||||||
|
OpenUNIX*|UnixWare*)
|
||||||
|
BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
|
||||||
|
;;
|
||||||
|
SCO_SV*)
|
||||||
|
BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if test "$Py_DEBUG" = 'true'; then
|
if test "$Py_DEBUG" = 'true'; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
OPT="-DNDEBUG $OPT"
|
OPT="-DNDEBUG $OPT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The current (beta) Monterey compiler dies with optimizations
|
|
||||||
case $ac_sys_system in
|
|
||||||
Monterey*) OPT="";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test "$ac_arch_flags"
|
if test "$ac_arch_flags"
|
||||||
then
|
then
|
||||||
OPT="$OPT $ac_arch_flags"
|
BASECFLAGS="$BASECFLAGS $ac_arch_flags"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
|
AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
|
||||||
|
@ -598,8 +646,14 @@ CC="$ac_save_cc"])
|
||||||
AC_MSG_RESULT($ac_cv_opt_olimit_ok)
|
AC_MSG_RESULT($ac_cv_opt_olimit_ok)
|
||||||
if test $ac_cv_opt_olimit_ok = yes; then
|
if test $ac_cv_opt_olimit_ok = yes; then
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
Darwin*) OPT="$OPT" ;;
|
# XXX is this branch needed? On MacOSX 10.2.2 the result of the
|
||||||
*) OPT="$OPT -OPT:Olimit=0";;
|
# olimit_ok test is "no". Is it "yes" in some other Darwin-esque
|
||||||
|
# environment?
|
||||||
|
Darwin*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
|
AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
|
||||||
|
@ -613,7 +667,7 @@ else
|
||||||
CC="$ac_save_cc"])
|
CC="$ac_save_cc"])
|
||||||
AC_MSG_RESULT($ac_cv_olimit_ok)
|
AC_MSG_RESULT($ac_cv_olimit_ok)
|
||||||
if test $ac_cv_olimit_ok = yes; then
|
if test $ac_cv_olimit_ok = yes; then
|
||||||
OPT="$OPT -Olimit 1500"
|
BASECFLAGS="$BASECFLAGS -Olimit 1500"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -939,7 +993,7 @@ esac
|
||||||
AC_MSG_CHECKING(for --enable-framework)
|
AC_MSG_CHECKING(for --enable-framework)
|
||||||
if test "$enable_framework"
|
if test "$enable_framework"
|
||||||
then
|
then
|
||||||
OPT="$OPT -fno-common -dynamic"
|
BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
|
||||||
# -F. is needed to allow linking to the framework while
|
# -F. is needed to allow linking to the framework while
|
||||||
# in the build location.
|
# in the build location.
|
||||||
LDFLAGS="$LDFLAGS -Wl,-F."
|
LDFLAGS="$LDFLAGS -Wl,-F."
|
||||||
|
@ -1545,7 +1599,7 @@ yes
|
||||||
ipv6type=$i
|
ipv6type=$i
|
||||||
ipv6lib=inet6
|
ipv6lib=inet6
|
||||||
ipv6libdir=/usr/inet6/lib
|
ipv6libdir=/usr/inet6/lib
|
||||||
OPT="-I/usr/inet6/include $OPT"
|
BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
solaris)
|
solaris)
|
||||||
|
@ -1575,7 +1629,7 @@ yes
|
||||||
[ipv6type=$i;
|
[ipv6type=$i;
|
||||||
ipv6lib=v6;
|
ipv6lib=v6;
|
||||||
ipv6libdir=/usr/local/v6/lib;
|
ipv6libdir=/usr/local/v6/lib;
|
||||||
OPT="-I/usr/local/v6/include $OPT"])
|
BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
|
||||||
;;
|
;;
|
||||||
zeta)
|
zeta)
|
||||||
AC_EGREP_CPP(yes, [
|
AC_EGREP_CPP(yes, [
|
||||||
|
|
10
setup.py
10
setup.py
|
@ -173,8 +173,8 @@ class PyBuildExt(build_ext):
|
||||||
# unfortunately, distutils doesn't let us provide separate C and C++
|
# unfortunately, distutils doesn't let us provide separate C and C++
|
||||||
# compilers
|
# compilers
|
||||||
if compiler is not None:
|
if compiler is not None:
|
||||||
(ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT')
|
(ccshared,opt,base) = sysconfig.get_config_vars('CCSHARED','OPT','BASECFLAGS')
|
||||||
args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared
|
args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared + ' ' + base
|
||||||
if linker_so is not None:
|
if linker_so is not None:
|
||||||
args['linker_so'] = linker_so
|
args['linker_so'] = linker_so
|
||||||
self.compiler.set_executables(**args)
|
self.compiler.set_executables(**args)
|
||||||
|
@ -252,6 +252,12 @@ class PyBuildExt(build_ext):
|
||||||
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
|
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
|
||||||
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
||||||
|
|
||||||
|
# fink installs lots of goodies in /sw/... - make sure we
|
||||||
|
# check there
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
add_dir_to_list(self.compiler.library_dirs, '/sw/lib')
|
||||||
|
add_dir_to_list(self.compiler.include_dirs, '/sw/include')
|
||||||
|
|
||||||
if os.path.normpath(sys.prefix) != '/usr':
|
if os.path.normpath(sys.prefix) != '/usr':
|
||||||
add_dir_to_list(self.compiler.library_dirs,
|
add_dir_to_list(self.compiler.library_dirs,
|
||||||
sysconfig.get_config_var("LIBDIR"))
|
sysconfig.get_config_var("LIBDIR"))
|
||||||
|
|
Loading…
Reference in New Issue