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
|
||||
OPT= @OPT@
|
||||
CFLAGS= $(OPT)
|
||||
BASECFLAGS= @BASECFLAGS@
|
||||
CFLAGS= $(BASECFLAGS) $(OPT)
|
||||
CPPFLAGS= -I. -I$(srcdir)/Include
|
||||
LDFLAGS= @LDFLAGS@
|
||||
LDLAST= @LDLAST@
|
||||
|
@ -844,6 +845,13 @@ idleinstall:
|
|||
--install-scripts=$(BINDIR) \
|
||||
--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
|
||||
Makefile.pre: Makefile.pre.in config.status
|
||||
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
|
||||
|
|
18
Misc/NEWS
18
Misc/NEWS
|
@ -26,6 +26,24 @@ Tools/Demos
|
|||
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
|
||||
-----
|
||||
|
||||
|
|
110
configure.in
110
configure.in
|
@ -168,6 +168,15 @@ fi
|
|||
AC_MSG_RESULT($EXTRAPLATDIR)
|
||||
|
||||
# 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_ARG_WITH(gcc,
|
||||
AC_HELP_STRING(--without-gcc,never use gcc),
|
||||
|
@ -188,13 +197,14 @@ AC_ARG_WITH(gcc,
|
|||
ppc)
|
||||
CC=mwcc
|
||||
without_gcc=yes
|
||||
OPT="-O -export pragma"
|
||||
BASECFLAGS="$BASECFLAGS -export pragma"
|
||||
OPT="$OPT -O"
|
||||
LDFLAGS="$LDFLAGS -nodup"
|
||||
;;
|
||||
x86)
|
||||
CC=gcc
|
||||
without_gcc=no
|
||||
OPT=-O
|
||||
OPT="$OPT -O"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
|
||||
|
@ -484,7 +494,7 @@ if test $enable_shared = "yes"; then
|
|||
case $MACHDEP in
|
||||
dguxR4)
|
||||
LDLIBRARY='libpython$(VERSION).so'
|
||||
OPT="$OPT -pic"
|
||||
BASECFLAGS="$BASECFLAGS -pic"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
@ -531,7 +541,21 @@ else AC_MSG_RESULT(no); Py_DEBUG='false'
|
|||
fi],
|
||||
[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
|
||||
# ------------------------
|
||||
# (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)
|
||||
if test -z "$OPT"
|
||||
then
|
||||
|
@ -545,30 +569,59 @@ then
|
|||
OPT="-g -Wall -Wstrict-prototypes"
|
||||
else
|
||||
OPT="-g -O3 -Wall -Wstrict-prototypes"
|
||||
fi;;
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
OPT="-O3 -Wall -Wstrict-prototypes";;
|
||||
OPT="-O3 -Wall -Wstrict-prototypes"
|
||||
;;
|
||||
esac
|
||||
case $ac_sys_system in
|
||||
SCO_SV*) OPT="$OPT -m486 -DSCO5";;
|
||||
SCO_SV*) OPT="$OPT -m486 -DSCO5"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*)
|
||||
OPT="-O"
|
||||
;;
|
||||
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
|
||||
Monterey*)
|
||||
OPT=""
|
||||
;;
|
||||
esac
|
||||
|
||||
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*)
|
||||
OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
|
||||
BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
|
||||
;;
|
||||
SCO_SV*)
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
OPT="-belf -O -Ki486 -DSCO5";;
|
||||
*)
|
||||
OPT="-O";;
|
||||
BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
case $ac_sys_system in
|
||||
Darwin*)
|
||||
OPT="$OPT -Wno-long-double -no-cpp-precomp";;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "$Py_DEBUG" = 'true'; then
|
||||
:
|
||||
|
@ -576,14 +629,9 @@ else
|
|||
OPT="-DNDEBUG $OPT"
|
||||
fi
|
||||
|
||||
# The current (beta) Monterey compiler dies with optimizations
|
||||
case $ac_sys_system in
|
||||
Monterey*) OPT="";;
|
||||
esac
|
||||
|
||||
if test "$ac_arch_flags"
|
||||
then
|
||||
OPT="$OPT $ac_arch_flags"
|
||||
BASECFLAGS="$BASECFLAGS $ac_arch_flags"
|
||||
fi
|
||||
|
||||
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)
|
||||
if test $ac_cv_opt_olimit_ok = yes; then
|
||||
case $ac_sys_system in
|
||||
Darwin*) OPT="$OPT" ;;
|
||||
*) OPT="$OPT -OPT:Olimit=0";;
|
||||
# XXX is this branch needed? On MacOSX 10.2.2 the result of the
|
||||
# olimit_ok test is "no". Is it "yes" in some other Darwin-esque
|
||||
# environment?
|
||||
Darwin*)
|
||||
;;
|
||||
*)
|
||||
BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
|
||||
|
@ -613,7 +667,7 @@ else
|
|||
CC="$ac_save_cc"])
|
||||
AC_MSG_RESULT($ac_cv_olimit_ok)
|
||||
if test $ac_cv_olimit_ok = yes; then
|
||||
OPT="$OPT -Olimit 1500"
|
||||
BASECFLAGS="$BASECFLAGS -Olimit 1500"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -939,7 +993,7 @@ esac
|
|||
AC_MSG_CHECKING(for --enable-framework)
|
||||
if test "$enable_framework"
|
||||
then
|
||||
OPT="$OPT -fno-common -dynamic"
|
||||
BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
|
||||
# -F. is needed to allow linking to the framework while
|
||||
# in the build location.
|
||||
LDFLAGS="$LDFLAGS -Wl,-F."
|
||||
|
@ -1545,7 +1599,7 @@ yes
|
|||
ipv6type=$i
|
||||
ipv6lib=inet6
|
||||
ipv6libdir=/usr/inet6/lib
|
||||
OPT="-I/usr/inet6/include $OPT"
|
||||
BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
|
||||
fi
|
||||
;;
|
||||
solaris)
|
||||
|
@ -1575,7 +1629,7 @@ yes
|
|||
[ipv6type=$i;
|
||||
ipv6lib=v6;
|
||||
ipv6libdir=/usr/local/v6/lib;
|
||||
OPT="-I/usr/local/v6/include $OPT"])
|
||||
BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
|
||||
;;
|
||||
zeta)
|
||||
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++
|
||||
# compilers
|
||||
if compiler is not None:
|
||||
(ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT')
|
||||
args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared
|
||||
(ccshared,opt,base) = sysconfig.get_config_vars('CCSHARED','OPT','BASECFLAGS')
|
||||
args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared + ' ' + base
|
||||
if linker_so is not None:
|
||||
args['linker_so'] = linker_so
|
||||
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.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':
|
||||
add_dir_to_list(self.compiler.library_dirs,
|
||||
sysconfig.get_config_var("LIBDIR"))
|
||||
|
|
Loading…
Reference in New Issue