diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 188 |
1 files changed, 180 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac index d06d7742fb..69f7b7dd11 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) @@ -963,11 +963,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 +1037,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 +1240,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 +2382,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 @@ -3263,6 +3324,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()]) @@ -3817,6 +3879,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_COMPILE_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,7 +4173,15 @@ AC_SUBST(SOABI) AC_MSG_CHECKING(ABIFLAGS) AC_MSG_RESULT($ABIFLAGS) AC_MSG_CHECKING(SOABI) -SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS} + +case $ac_sys_system in + Linux*|GNU*) + BITNESS_SUFFIX=-$(($ac_cv_sizeof_void_p * 8))b;; + *) + BITNESS_SUFFIX=;; +esac +SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${BITNESS_SUFFIX} + AC_MSG_RESULT($SOABI) AC_SUBST(EXT_SUFFIX) @@ -4238,6 +4321,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 +4802,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 +4894,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 +4950,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]) |