summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac343
1 files changed, 324 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index 3394d84..56a73df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ dnl * Please run autoreconf to test your changes! *
dnl ***********************************************
# Set VERSION so we only need to edit in one place (i.e., here)
-m4_define(PYTHON_VERSION, 3.4)
+m4_define(PYTHON_VERSION, 3.5)
AC_PREREQ(2.65)
@@ -425,7 +425,7 @@ if test "$cross_compiling" = yes; then
esac
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
fi
-
+
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
# disable features if it is defined, without any means to access these
# features as extensions. For these systems, we skip the definition of
@@ -556,9 +556,6 @@ then
fi
AC_MSG_RESULT($MACHDEP)
-AC_SUBST(PLATDIR)
-PLATDIR=plat-$MACHDEP
-
# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
# it may influence the way we can build extensions, so distutils
# needs to check it
@@ -667,6 +664,8 @@ then
fi
fi
AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_GREP
AC_SUBST(CXX)
AC_SUBST(MAINCC)
@@ -724,6 +723,142 @@ then
fi
+MULTIARCH=$($CC --print-multiarch 2>/dev/null)
+AC_SUBST(MULTIARCH)
+
+AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
+cat >> conftest.c <<EOF
+#undef bfin
+#undef cris
+#undef fr30
+#undef linux
+#undef hppa
+#undef hpux
+#undef i386
+#undef mips
+#undef powerpc
+#undef sparc
+#undef unix
+#if defined(__linux__)
+# if defined(__x86_64__) && defined(__LP64__)
+ x86_64-linux-gnu
+# elif defined(__x86_64__) && defined(__ILP32__)
+ x86_64-linux-gnux32
+# elif defined(__i386__)
+ i386-linux-gnu
+# elif defined(__aarch64__) && defined(__AARCH64EL__)
+# if defined(__ILP32__)
+ aarch64_ilp32-linux-gnu
+# else
+ aarch64-linux-gnu
+# endif
+# elif defined(__aarch64__) && defined(__AARCH64EB__)
+# if defined(__ILP32__)
+ aarch64_be_ilp32-linux-gnu
+# else
+ aarch64_be-linux-gnu
+# endif
+# elif defined(__alpha__)
+ alpha-linux-gnu
+# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
+# if defined(__ARMEL__)
+ arm-linux-gnueabihf
+# else
+ armeb-linux-gnueabihf
+# endif
+# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
+# if defined(__ARMEL__)
+ arm-linux-gnueabi
+# else
+ armeb-linux-gnueabi
+# endif
+# elif defined(__hppa__)
+ hppa-linux-gnu
+# elif defined(__ia64__)
+ ia64-linux-gnu
+# elif defined(__m68k__) && !defined(__mcoldfire__)
+ m68k-linux-gnu
+# elif defined(__mips_hard_float) && defined(_MIPSEL)
+# if _MIPS_SIM == _ABIO32
+ mipsel-linux-gnu
+# elif _MIPS_SIM == _ABIN32
+ mips64el-linux-gnuabin32
+# elif _MIPS_SIM == _ABI64
+ mips64el-linux-gnuabi64
+# else
+# error unknown platform triplet
+# endif
+# elif defined(__mips_hard_float)
+# if _MIPS_SIM == _ABIO32
+ mips-linux-gnu
+# elif _MIPS_SIM == _ABIN32
+ mips64-linux-gnuabin32
+# elif _MIPS_SIM == _ABI64
+ mips64-linux-gnuabi64
+# else
+# error unknown platform triplet
+# endif
+# elif defined(__or1k__)
+ or1k-linux-gnu
+# elif defined(__powerpc__) && defined(__SPE__)
+ powerpc-linux-gnuspe
+# elif defined(__powerpc64__)
+# if defined(__LITTLE_ENDIAN__)
+ powerpc64le-linux-gnu
+# else
+ powerpc64-linux-gnu
+# endif
+# elif defined(__powerpc__)
+ powerpc-linux-gnu
+# elif defined(__s390x__)
+ s390x-linux-gnu
+# elif defined(__s390__)
+ s390-linux-gnu
+# elif defined(__sh__) && defined(__LITTLE_ENDIAN__)
+ sh4-linux-gnu
+# elif defined(__sparc__) && defined(__arch64__)
+ sparc64-linux-gnu
+# elif defined(__sparc__)
+ sparc-linux-gnu
+# else
+# error unknown platform triplet
+# endif
+#elif defined(__FreeBSD_kernel__)
+# if defined(__LP64__)
+ x86_64-kfreebsd-gnu
+# elif defined(__i386__)
+ i386-kfreebsd-gnu
+# else
+# error unknown platform triplet
+# endif
+#elif defined(__gnu_hurd__)
+ i386-gnu
+#elif defined(__APPLE__)
+ darwin
+#else
+# error unknown platform triplet
+#endif
+
+EOF
+
+if $CPP conftest.c >conftest.out 2>/dev/null; then
+ PLATFORM_TRIPLET=`grep -v '^#' conftest.out | grep -v '^ *$' | tr -d ' '`
+ AC_MSG_RESULT([$PLATFORM_TRIPLET])
+else
+ AC_MSG_RESULT([none])
+fi
+rm -f conftest.c conftest.out
+
+if test x$PLATFORM_TRIPLET != x && test x$MULTIARCH != x; then
+ if test x$PLATFORM_TRIPLET != x$MULTIARCH; then
+ AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report])
+ fi
+fi
+PLATDIR=plat-$MACHDEP
+AC_SUBST(PLATDIR)
+AC_SUBST(PLATFORM_TRIPLET)
+
+
AC_MSG_CHECKING([for -Wl,--no-as-needed])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
@@ -791,10 +926,6 @@ hp*|HP*)
esac;;
esac
-MULTIARCH=$($CC --print-multiarch 2>/dev/null)
-AC_SUBST(MULTIARCH)
-
-
AC_SUBST(LIBRARY)
AC_MSG_CHECKING(LIBRARY)
if test -z "$LIBRARY"
@@ -963,11 +1094,6 @@ if test $enable_shared = "yes"; then
LDLIBRARY='libpython$(LDVERSION).so'
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
- case $ac_sys_system in
- FreeBSD*)
- SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
- ;;
- esac
INSTSONAME="$LDLIBRARY".$SOVERSION
if test "$with_pydebug" != yes
then
@@ -1042,6 +1168,15 @@ else
ASDLGEN="$PYTHON"
fi
+AC_SUBST(OPCODEHGEN)
+AC_CHECK_PROGS(PYTHON, python$PACKAGE_VERSION python3 python, not-found)
+if test "$PYTHON" = not-found; then
+ OPCODEHGEN="@echo python: $PYTHON! cannot run Tools/scripts/generate_opcode_h.py"
+else
+ OPCODEHGEN="$PYTHON"
+fi
+
+
case $MACHDEP in
bsdos*|hp*|HP*)
@@ -1236,6 +1371,52 @@ yes)
CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement"
fi
+ AC_MSG_CHECKING(if we can turn on $CC mixed sign comparison warning)
+ ac_save_cc="$CC"
+ CC="$CC -Wsign-compare"
+ save_CFLAGS="$CFLAGS"
+ AC_CACHE_VAL(ac_cv_enable_sign_compare_warning,
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_PROGRAM([[]], [[]])
+ ],[
+ ac_cv_enable_sign_compare_warning=yes
+ ],[
+ ac_cv_enable_sign_compare_warning=no
+ ]))
+ CFLAGS="$save_CFLAGS"
+ CC="$ac_save_cc"
+ AC_MSG_RESULT($ac_cv_enable_sign_compare_warning)
+
+ if test $ac_cv_enable_sign_compare_warning = yes
+ then
+ BASECFLAGS="$BASECFLAGS -Wsign-compare"
+ fi
+
+ AC_MSG_CHECKING(if we can turn on $CC unreachable code warning)
+ ac_save_cc="$CC"
+ CC="$CC -Wunreachable-code"
+ save_CFLAGS="$CFLAGS"
+ AC_CACHE_VAL(ac_cv_enable_unreachable_code_warning,
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_PROGRAM([[]], [[]])
+ ],[
+ ac_cv_enable_unreachable_code_warning=yes
+ ],[
+ ac_cv_enable_unreachable_code_warning=no
+ ]))
+ CFLAGS="$save_CFLAGS"
+ CC="$ac_save_cc"
+ AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning)
+
+ # Don't enable unreachable code warning in debug mode, since it usually
+ # results in non-standard code paths.
+ if test $ac_cv_enable_unreachable_code_warning = yes && test "$Py_DEBUG" != "true"
+ then
+ BASECFLAGS="$BASECFLAGS -Wunreachable-code"
+ fi
+
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
# support. Without this, treatment of subnormals doesn't follow
# the standard.
@@ -2332,6 +2513,17 @@ esac
],
[AC_MSG_RESULT(default)])
+AC_MSG_CHECKING(for --with-address-sanitizer)
+AC_ARG_WITH(address_sanitizer,
+ AS_HELP_STRING([--with-address-sanitizer],
+ [enable AddressSanitizer]),
+[
+AC_MSG_RESULT($withval)
+BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS"
+LDFLAGS="-fsanitize=address $LDFLAGS"
+],
+[AC_MSG_RESULT(no)])
+
# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
@@ -2815,6 +3007,16 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
fi
fi
+AC_MSG_CHECKING(for CAN_RAW_FD_FRAMES)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ /* CAN_RAW_FD_FRAMES available check */
+#include <linux/can/raw.h>]],
+[[int can_raw_fd_frames = CAN_RAW_FD_FRAMES;]])],[
+ AC_DEFINE(HAVE_LINUX_CAN_RAW_FD_FRAMES, 1, [Define if compiling using Linux 3.6 or later.])
+ AC_MSG_RESULT(yes)
+],[
+ AC_MSG_RESULT(no)
+])
+
AC_MSG_CHECKING(for OSX 10.5 SDK or later)
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[#include <Carbon/Carbon.h>]], [[FSIORefNum fRef = 0]])
@@ -3263,6 +3465,7 @@ AC_CHECK_FUNCS(gettimeofday,
AC_CHECK_FUNCS(clock_gettime, [], [
AC_CHECK_LIB(rt, clock_gettime, [
+ LIBS="$LIBS -lrt"
AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
AC_DEFINE(TIMEMODULE_LIB, [rt],
[Library needed by timemodule.c: librt may be needed for clock_gettime()])
@@ -3707,7 +3910,7 @@ fi],
# **************************************
AC_MSG_CHECKING(for x64 gcc inline assembler)
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+AC_LINK_IFELSE( [AC_LANG_PROGRAM([[]], [[
__asm__ __volatile__ ("movq %rcx, %rax");
]])],[have_gcc_asm_for_x64=yes],[have_gcc_asm_for_x64=no])
AC_MSG_RESULT($have_gcc_asm_for_x64)
@@ -3805,7 +4008,7 @@ fi
# so we try it on all platforms.
AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+AC_LINK_IFELSE( [AC_LANG_PROGRAM([[]], [[
unsigned short cw;
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
__asm__ __volatile__ ("fldcw %0" : : "m" (cw));
@@ -3817,6 +4020,19 @@ then
[Define if we can use gcc inline assembler to get and set x87 control word])
fi
+AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set mc68881 fpcr)
+AC_LINK_IFELSE( [AC_LANG_PROGRAM([[]], [[
+ unsigned int fpcr;
+ __asm__ __volatile__ ("fmove.l %%fpcr,%0" : "=g" (fpcr));
+ __asm__ __volatile__ ("fmove.l %0,%%fpcr" : : "g" (fpcr));
+]])],[have_gcc_asm_for_mc68881=yes],[have_gcc_asm_for_mc68881=no])
+AC_MSG_RESULT($have_gcc_asm_for_mc68881)
+if test "$have_gcc_asm_for_mc68881" = yes
+then
+ AC_DEFINE(HAVE_GCC_ASM_FOR_MC68881, 1,
+ [Define if we can use gcc inline assembler to get and set mc68881 fpcr])
+fi
+
# Detect whether system arithmetic is subject to x87-style double
# rounding issues. The result of this test has little meaning on non
# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
@@ -4098,12 +4314,12 @@ AC_SUBST(SOABI)
AC_MSG_CHECKING(ABIFLAGS)
AC_MSG_RESULT($ABIFLAGS)
AC_MSG_CHECKING(SOABI)
-SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}
+SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET}
AC_MSG_RESULT($SOABI)
AC_SUBST(EXT_SUFFIX)
case $ac_sys_system in
- Linux*|GNU*)
+ Linux*|GNU*|Darwin)
EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX};;
*)
EXT_SUFFIX=${SHLIB_SUFFIX};;
@@ -4238,6 +4454,10 @@ then
[Define if you can turn off readline's signal handling.]), )
fi
+AC_CHECK_LIB(readline, append_history,
+ AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
+ [Define if readline supports append_history]), ,$READLINE_LIBS)
+
# End of readline checks: restore LIBS
LIBS=$LIBS_no_readline
@@ -4715,7 +4935,7 @@ do
done
AC_SUBST(SRCDIRS)
-SRCDIRS="Parser Grammar Objects Python Modules Mac"
+SRCDIRS="Parser Grammar Objects Python Modules Mac Programs"
AC_MSG_CHECKING(for build directories)
for dir in $SRCDIRS; do
if test ! -d $dir; then
@@ -4807,6 +5027,47 @@ if test "$have_gcc_asm_for_x87" = yes; then
esac
fi
+# Check for stdatomic.h
+AC_MSG_CHECKING(for stdatomic.h)
+AC_LINK_IFELSE(
+[
+ AC_LANG_SOURCE([[
+ #include <stdatomic.h>
+ atomic_int value = ATOMIC_VAR_INIT(1);
+ _Atomic void *py_atomic_address = (void*) &value;
+ int main() {
+ int loaded_value = atomic_load(&value);
+ return 0;
+ }
+ ]])
+],[have_stdatomic_h=yes],[have_stdatomic_h=no])
+
+AC_MSG_RESULT($have_stdatomic_h)
+
+if test "$have_stdatomic_h" = yes; then
+ AC_DEFINE(HAVE_STD_ATOMIC, 1,
+ [Has stdatomic.h, atomic_int and _Atomic void* types work])
+fi
+
+# Check for GCC >= 4.7 __atomic builtins
+AC_MSG_CHECKING(for GCC >= 4.7 __atomic builtins)
+AC_LINK_IFELSE(
+[
+ AC_LANG_SOURCE([[
+ volatile int val = 1;
+ int main() {
+ __atomic_load_n(&val, __ATOMIC_SEQ_CST);
+ return 0;
+ }
+ ]])
+],[have_builtin_atomic=yes],[have_builtin_atomic=no])
+
+AC_MSG_RESULT($have_builtin_atomic)
+
+if test "$have_builtin_atomic" = yes; then
+ AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Has builtin atomics])
+fi
+
# ensurepip option
AC_MSG_CHECKING(for ensurepip)
AC_ARG_WITH(ensurepip,
@@ -4822,6 +5083,50 @@ AS_CASE($with_ensurepip,
AC_MSG_RESULT($ENSUREPIP)
AC_SUBST(ENSUREPIP)
+# check if the dirent structure of a d_type field and DT_UNKNOWN is defined
+AC_MSG_CHECKING(if the dirent structure of a d_type field)
+AC_LINK_IFELSE(
+[
+ AC_LANG_SOURCE([[
+ #include <dirent.h>
+
+ int main() {
+ struct dirent entry;
+ return entry.d_type == DT_UNKNOWN;
+ }
+ ]])
+],[have_dirent_d_type=yes],[have_dirent_d_type=no])
+AC_MSG_RESULT($have_dirent_d_type)
+
+if test "$have_dirent_d_type" = yes; then
+ AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
+ [Define to 1 if the dirent structure has a d_type field])
+fi
+
+# check if the Linux getrandom() syscall is available
+AC_MSG_CHECKING(for the Linux getrandom() syscall)
+AC_LINK_IFELSE(
+[
+ AC_LANG_SOURCE([[
+ #include <sys/syscall.h>
+
+ int main() {
+ const int flags = 0;
+ char buffer[1];
+ int n;
+ /* ignore the result, Python checks for ENOSYS at runtime */
+ (void)syscall(SYS_getrandom, buffer, sizeof(buffer), flags);
+ return 0;
+ }
+ ]])
+],[have_getrandom_syscall=yes],[have_getrandom_syscall=no])
+AC_MSG_RESULT($have_getrandom_syscall)
+
+if test "$have_getrandom_syscall" = yes; then
+ AC_DEFINE(HAVE_GETRANDOM_SYSCALL, 1,
+ [Define to 1 if the Linux getrandom() syscall is available])
+fi
+
# generate output files
AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc Misc/python-config.sh)
AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])