bpo-26317: Support OBJC and OBJCXX configure command line variables (GH-20176)

Add support to the configure script for OBJC and OBJCXX command line options so that the macOS builds can use the clang compiler for the macOS-specific Objective C source files. This allows third-party compilers, like GNU gcc, to be used to build the rest of the project since some of the Objective C system header files are not compilable by GNU gcc.

Co-authored-by: Jeffrey Kintscher <websurfer@surf2c.net>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
Ned Deily 2020-05-18 09:17:22 -04:00 committed by GitHub
parent c444108dd6
commit 0da5466650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 670 additions and 15 deletions

View File

@ -892,6 +892,14 @@ Build Changes
functions are now required to build Python. functions are now required to build Python.
(Contributed by Victor Stinner in :issue:`39395`.) (Contributed by Victor Stinner in :issue:`39395`.)
* The ``OBJC`` and ``OBJCXX`` standard command line options for the configure
script are now supported. This allows building fot macOS with a third-party
compiler, like GNU `gcc`, for everything except for the several
system-specific source files that need system headers that require the
Apple-supplied compile chain (e.g. the ``_scproxy`` helper module and
``PythonLauncher.app``).
(Contributed by Jeffrey Kintscher in :issue:`26317`.)
C API Changes C API Changes
============= =============

View File

@ -21,6 +21,7 @@ PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@ PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@ LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
CC=@CC@ CC=@CC@
OBJC=@OBJC@
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
export MACOSX_DEPLOYMENT_TARGET export MACOSX_DEPLOYMENT_TARGET

View File

@ -1,5 +1,7 @@
CC=@CC@ CC=@CC@
LD=@CC@ LD=@CC@
OBJC=@OBJC@
OBJCFLAFS=@OBJCFLAGS@
BASECFLAGS=@BASECFLAGS@ BASECFLAGS=@BASECFLAGS@
OPT=@OPT@ OPT=@OPT@
CFLAGS=@CFLAGS@ $(BASECFLAGS) $(OPT) CFLAGS=@CFLAGS@ $(BASECFLAGS) $(OPT)
@ -52,25 +54,25 @@ Python\ Launcher.app: Info.plist \
cp -R $(srcdir)/English.lproj "Python Launcher.app/Contents/Resources" cp -R $(srcdir)/English.lproj "Python Launcher.app/Contents/Resources"
FileSettings.o: $(srcdir)/FileSettings.m FileSettings.o: $(srcdir)/FileSettings.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/FileSettings.m $(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/FileSettings.m
MyAppDelegate.o: $(srcdir)/MyAppDelegate.m MyAppDelegate.o: $(srcdir)/MyAppDelegate.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyAppDelegate.m $(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/MyAppDelegate.m
MyDocument.o: $(srcdir)/MyDocument.m MyDocument.o: $(srcdir)/MyDocument.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyDocument.m $(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/MyDocument.m
PreferencesWindowController.o: $(srcdir)/PreferencesWindowController.m PreferencesWindowController.o: $(srcdir)/PreferencesWindowController.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/PreferencesWindowController.m $(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/PreferencesWindowController.m
doscript.o: $(srcdir)/doscript.m doscript.o: $(srcdir)/doscript.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/doscript.m $(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/doscript.m
main.o: $(srcdir)/main.m main.o: $(srcdir)/main.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/main.m $(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/main.m
Python\ Launcher: $(OBJECTS) Python\ Launcher: $(OBJECTS)
$(CC) $(LDFLAGS) -o "Python Launcher" $(OBJECTS) -framework AppKit -framework Carbon $(OBJC) $(LDFLAGS) -o "Python Launcher" $(OBJECTS) -framework AppKit -framework Carbon
Info.plist: $(srcdir)/Info.plist.in Info.plist: $(srcdir)/Info.plist.in
sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(srcdir)/Info.plist.in > Info.plist sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(srcdir)/Info.plist.in > Info.plist

View File

@ -35,6 +35,7 @@ abs_builddir= @abs_builddir@
CC= @CC@ CC= @CC@
CXX= @CXX@ CXX= @CXX@
OBJC= @OBJC@
MAINCC= @MAINCC@ MAINCC= @MAINCC@
LINKCC= @LINKCC@ LINKCC= @LINKCC@
AR= @AR@ AR= @AR@
@ -613,12 +614,22 @@ $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl
$(PYTHON_FOR_REGEN) $(srcdir)/Modules/_blake2/blake2b2s.py $(PYTHON_FOR_REGEN) $(srcdir)/Modules/_blake2/blake2b2s.py
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $@ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $@
# _scproxy.o needs to be built outside of setup.py so that we can force
# the use of the OBJC compiler when the CC compiler is different. For
# example, it allows _scproxy.c to be compiled using the clang compiler
# while the rest of the project uses the GNU C compiler.
#
# see issue #26317 for details
@SCPROXY@Modules/_scproxy.o: $(srcdir)/Modules/_scproxy.c $(srcdir)/Include/Python.h
@SCPROXY@ $(OBJC) -c $(CCSHARED) $(PY_CORE_CFLAGS) -o $@ $<
@NOSCPROXY@.PHONY: Modules/_scproxy.o
# Build the shared modules # Build the shared modules
# Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
# -s, --silent or --quiet is always the first char. # -s, --silent or --quiet is always the first char.
# Under BSD make, MAKEFLAGS might be " -s -v x=y". # Under BSD make, MAKEFLAGS might be " -s -v x=y".
# Ignore macros passed by GNU make, passed after -- # Ignore macros passed by GNU make, passed after --
sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o Modules/_scproxy.o
@case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \ @case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \
*\ -s*|s*) quiet="-q";; \ *\ -s*|s*) quiet="-q";; \
*) quiet="";; \ *) quiet="";; \

View File

@ -882,6 +882,7 @@ Sam Kimbrel
Tomohiko Kinebuchi Tomohiko Kinebuchi
James King James King
W. Trevor King W. Trevor King
Jeffrey Kintscher
Paul Kippes Paul Kippes
Steve Kirsch Steve Kirsch
Sebastian Kirsche Sebastian Kirsche

View File

@ -0,0 +1 @@
The OBJC and OBJCXX standard command line options for the configure script are now supported. This allows building fot macOS with a third-party compiler, like GNU gcc, for everything except for the several system-specific source files that need system headers that require the Apple-supplied compile chain (e.g. the _scproxy helper module and PythonLauncher.app). Patch by Jeffrey Kintscher.

10
aclocal.m4 vendored
View File

@ -55,7 +55,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require. dnl of the macros you require.
m4_defun([PKG_PREREQ], m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.1]) [m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ ])dnl PKG_PREREQ
@ -156,7 +156,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no pkg_failed=no
AC_MSG_CHECKING([for $1]) AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2])
@ -166,11 +166,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.]) See the pkg-config man page for more details.])
if test $pkg_failed = yes; then if test $pkg_failed = yes; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED _PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi fi
# Put the nasty error message in config.log where it belongs # Put the nasty error message in config.log where it belongs
@ -187,7 +187,7 @@ installed software in a non-standard prefix.
_PKG_TEXT])[]dnl _PKG_TEXT])[]dnl
]) ])
elif test $pkg_failed = untried; then elif test $pkg_failed = untried; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE( m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it [The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full is in your PATH or set the PKG_CONFIG environment variable to the full

611
configure vendored
View File

@ -716,6 +716,14 @@ MULTIARCH_CPPFLAGS
PLATFORM_TRIPLET PLATFORM_TRIPLET
MULTIARCH MULTIARCH
ac_ct_CXX ac_ct_CXX
NOSCPROXY
SCPROXY
ac_ct_OBJCXX
OBJCXXFLAGS
OBJCXX
ac_ct_OBJC
OBJCFLAGS
OBJC
MAINCC MAINCC
CXX CXX
SED SED
@ -860,6 +868,10 @@ LDFLAGS
LIBS LIBS
CPPFLAGS CPPFLAGS
CPP CPP
OBJC
OBJCFLAGS
OBJCXX
OBJCXXFLAGS
PROFILE_TASK PROFILE_TASK
PKG_CONFIG PKG_CONFIG
PKG_CONFIG_PATH PKG_CONFIG_PATH
@ -1599,6 +1611,10 @@ Some influential environment variables:
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir> you have headers in a nonstandard directory <include dir>
CPP C preprocessor CPP C preprocessor
OBJC Objective C compiler command
OBJCFLAGS Objective C compiler flags
OBJCXX Objective C++ compiler command
OBJCXXFLAGS Objective C++ compiler flags
PROFILE_TASK PROFILE_TASK
Python args for PGO generation task Python args for PGO generation task
PKG_CONFIG path to pkg-config utility PKG_CONFIG path to pkg-config utility
@ -1762,6 +1778,82 @@ fi
} # ac_fn_c_try_cpp } # ac_fn_c_try_cpp
# ac_fn_objc_try_compile LINENO
# -----------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_objc_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_objc_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_objc_try_compile
# ac_fn_objcxx_try_compile LINENO
# -------------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_objcxx_try_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
rm -f conftest.$ac_objext
if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
grep -v '^ *+' conftest.err >conftest.er1
cat conftest.er1 >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && {
test -z "$ac_objcxx_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then :
ac_retval=0
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_objcxx_try_compile
# ac_fn_c_try_link LINENO # ac_fn_c_try_link LINENO
# ----------------------- # -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. # Try to link conftest.$ac_ext, and return whether this succeeded.
@ -4641,6 +4733,525 @@ $as_echo "$ac_cv_path_SED" >&6; }
if test "$ac_sys_system" = "Darwin"
then
# MacOSX requires an Objective C compiler to
# build some Mac-specific code.
ac_ext=m
ac_cpp='$OBJCPP $CPPFLAGS'
ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_objc_compiler_gnu
if test -n "$ac_tool_prefix"; then
for ac_prog in gcc objcc objc cc CC
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_OBJC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OBJC"; then
ac_cv_prog_OBJC="$OBJC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OBJC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
OBJC=$ac_cv_prog_OBJC
if test -n "$OBJC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJC" >&5
$as_echo "$OBJC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$OBJC" && break
done
fi
if test -z "$OBJC"; then
ac_ct_OBJC=$OBJC
for ac_prog in gcc objcc objc cc CC
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_OBJC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OBJC"; then
ac_cv_prog_ac_ct_OBJC="$ac_ct_OBJC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OBJC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_OBJC=$ac_cv_prog_ac_ct_OBJC
if test -n "$ac_ct_OBJC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJC" >&5
$as_echo "$ac_ct_OBJC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_OBJC" && break
done
if test "x$ac_ct_OBJC" = x; then
OBJC="gcc"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
OBJC=$ac_ct_OBJC
fi
fi
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for Objective C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Objective C compiler" >&5
$as_echo_n "checking whether we are using the GNU Objective C compiler... " >&6; }
if ${ac_cv_objc_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_objc_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_objc_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objc_compiler_gnu" >&5
$as_echo "$ac_cv_objc_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GOBJC=yes
else
GOBJC=
fi
ac_test_OBJCFLAGS=${OBJCFLAGS+set}
ac_save_OBJCFLAGS=$OBJCFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $OBJC accepts -g" >&5
$as_echo_n "checking whether $OBJC accepts -g... " >&6; }
if ${ac_cv_prog_objc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_objc_werror_flag=$ac_objc_werror_flag
ac_objc_werror_flag=yes
ac_cv_prog_objc_g=no
OBJCFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_objc_try_compile "$LINENO"; then :
ac_cv_prog_objc_g=yes
else
OBJCFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_objc_try_compile "$LINENO"; then :
else
ac_objc_werror_flag=$ac_save_objc_werror_flag
OBJCFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_objc_try_compile "$LINENO"; then :
ac_cv_prog_objc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_objc_werror_flag=$ac_save_objc_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_objc_g" >&5
$as_echo "$ac_cv_prog_objc_g" >&6; }
if test "$ac_test_OBJCFLAGS" = set; then
OBJCFLAGS=$ac_save_OBJCFLAGS
elif test $ac_cv_prog_objc_g = yes; then
if test "$GOBJC" = yes; then
OBJCFLAGS="-g -O2"
else
OBJCFLAGS="-g"
fi
else
if test "$GOBJC" = yes; then
OBJCFLAGS="-O2"
else
OBJCFLAGS=
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_ext=mm
ac_cpp='$OBJCXXCPP $CPPFLAGS'
ac_compile='$OBJCXX -c $OBJCXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$OBJCXX -o conftest$ac_exeext $OBJCXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_objcxx_compiler_gnu
if test -n "$ac_tool_prefix"; then
for ac_prog in g++ objc++ objcxx c++ CXX
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_OBJCXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$OBJCXX"; then
ac_cv_prog_OBJCXX="$OBJCXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OBJCXX="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
OBJCXX=$ac_cv_prog_OBJCXX
if test -n "$OBJCXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJCXX" >&5
$as_echo "$OBJCXX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$OBJCXX" && break
done
fi
if test -z "$OBJCXX"; then
ac_ct_OBJCXX=$OBJCXX
for ac_prog in g++ objc++ objcxx c++ CXX
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_OBJCXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_OBJCXX"; then
ac_cv_prog_ac_ct_OBJCXX="$ac_ct_OBJCXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OBJCXX="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_OBJCXX=$ac_cv_prog_ac_ct_OBJCXX
if test -n "$ac_ct_OBJCXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJCXX" >&5
$as_echo "$ac_ct_OBJCXX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_OBJCXX" && break
done
if test "x$ac_ct_OBJCXX" = x; then
OBJCXX="g++"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
OBJCXX=$ac_ct_OBJCXX
fi
fi
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for Objective C++ compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
{ { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
if test -s conftest.err; then
sed '10a\
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
fi
rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Objective C++ compiler" >&5
$as_echo_n "checking whether we are using the GNU Objective C++ compiler... " >&6; }
if ${ac_cv_objcxx_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
if ac_fn_objcxx_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_objcxx_compiler_gnu=$ac_compiler_gnu
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objcxx_compiler_gnu" >&5
$as_echo "$ac_cv_objcxx_compiler_gnu" >&6; }
if test $ac_compiler_gnu = yes; then
GOBJCXX=yes
else
GOBJCXX=
fi
ac_test_OBJCXXFLAGS=${OBJCXXFLAGS+set}
ac_save_OBJCXXFLAGS=$OBJCXXFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $OBJCXX accepts -g" >&5
$as_echo_n "checking whether $OBJCXX accepts -g... " >&6; }
if ${ac_cv_prog_objcxx_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_objcxx_werror_flag=$ac_objcxx_werror_flag
ac_objcxx_werror_flag=yes
ac_cv_prog_objcxx_g=no
OBJCXXFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_objcxx_try_compile "$LINENO"; then :
ac_cv_prog_objcxx_g=yes
else
OBJCXXFLAGS=""
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_objcxx_try_compile "$LINENO"; then :
else
ac_objcxx_werror_flag=$ac_save_objcxx_werror_flag
OBJCXXFLAGS="-g"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_objcxx_try_compile "$LINENO"; then :
ac_cv_prog_objcxx_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_objcxx_werror_flag=$ac_save_objcx_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_objcxx_g" >&5
$as_echo "$ac_cv_prog_objcxx_g" >&6; }
if test "$ac_test_OBJCXXFLAGS" = set; then
OBJCXXFLAGS=$ac_save_OBJCXXFLAGS
elif test $ac_cv_prog_objcxx_g = yes; then
if test "$GOBJCXX" = yes; then
OBJCXXFLAGS="-g -O2"
else
OBJCXXFLAGS="-g"
fi
else
if test "$GOBJCXX" = yes; then
OBJCXXFLAGS="-O2"
else
OBJCXXFLAGS=
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
SCPROXY=
NOSCPROXY=#
else
SCPROXY=#
NOSCPROXY=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-cxx-main=<compiler>" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-cxx-main=<compiler>" >&5
$as_echo_n "checking for --with-cxx-main=<compiler>... " >&6; } $as_echo_n "checking for --with-cxx-main=<compiler>... " >&6; }

View File

@ -663,6 +663,25 @@ AC_PROG_SED
AC_SUBST(CXX) AC_SUBST(CXX)
AC_SUBST(MAINCC) AC_SUBST(MAINCC)
if test "$ac_sys_system" = "Darwin"
then
# MacOSX requires an Objective C compiler to
# build some Mac-specific code.
AC_PROG_OBJC
AC_PROG_OBJCXX
AC_SUBST(OBJC)
AC_SUBST(OBJCXX)
SCPROXY=
NOSCPROXY=#
else
SCPROXY=#
NOSCPROXY=
fi
AC_SUBST(SCPROXY)
AC_SUBST(NOSCPROXY)
AC_MSG_CHECKING(for --with-cxx-main=<compiler>) AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
AC_ARG_WITH(cxx_main, AC_ARG_WITH(cxx_main,
AS_HELP_STRING([--with-cxx-main@<:@=COMPILER@:>@], AS_HELP_STRING([--with-cxx-main@<:@=COMPILER@:>@],

View File

@ -1583,10 +1583,11 @@ class PyBuildExt(build_ext):
self.missing.append('ossaudiodev') self.missing.append('ossaudiodev')
if MACOS: if MACOS:
self.add(Extension('_scproxy', ['_scproxy.c'], self.add(Extension('_scproxy', [],
extra_link_args=[ extra_link_args=[
'-framework', 'SystemConfiguration', '-framework', 'SystemConfiguration',
'-framework', 'CoreFoundation'])) '-framework', 'CoreFoundation'],
extra_objects=['Modules/_scproxy.o']))
def detect_compress_exts(self): def detect_compress_exts(self):
# Andrew Kuchling's zlib module. Note that some versions of zlib # Andrew Kuchling's zlib module. Note that some versions of zlib