diff --git a/configure b/configure index 3c2a9cf0a249dd..fe625488592198 100755 --- a/configure +++ b/configure @@ -3770,91 +3770,97 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking MACHDEP" >&5 $as_echo_n "checking MACHDEP... " >&6; } -if test -z "$MACHDEP" -then - # avoid using uname for cross builds - if test "$cross_compiling" = yes; then - # ac_sys_system and ac_sys_release are used for setting - # a lot of different things including 'define_xopen_source' - # in the case statement below. - case "$host" in - *-*-linux-android*) - ac_sys_system=Linux-android - ;; - *-*-linux*) - ac_sys_system=Linux - ;; - *-*-cygwin*) - ac_sys_system=Cygwin - ;; - *-*-vxworks*) - ac_sys_system=VxWorks - ;; - *-*-emscripten) - ac_sys_system=Emscripten - ;; - *-*-wasi) - ac_sys_system=WASI - ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" - as_fn_error $? "cross build not supported for $host" "$LINENO" 5 - esac - ac_sys_release= - else - ac_sys_system=`uname -s` - if test "$ac_sys_system" = "AIX" \ - -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then - ac_sys_release=`uname -v` - else - ac_sys_release=`uname -r` - fi - fi - ac_md_system=`echo $ac_sys_system | - tr -d '/ ' | tr '[A-Z]' '[a-z]'` - ac_md_release=`echo $ac_sys_release | - tr -d '/ ' | sed 's/^[A-Z]\.//' | sed 's/\..*//'` - MACHDEP="$ac_md_system$ac_md_release" - - case $MACHDEP in - aix*) MACHDEP="aix";; - linux*) MACHDEP="linux";; - cygwin*) MACHDEP="cygwin";; - darwin*) MACHDEP="darwin";; - '') MACHDEP="unknown";; - esac +if ${MACHDEP+:} false; then : + +else + + if test "x$cross_compiling" = xyes; then : + + case $host in #( + *-*-linux-android*) : + ac_sys_system=Linux-android ;; #( + *-*-linux*) : + ac_sys_system=Linux ;; #( + *-*-cygwin*) : + ac_sys_system=Cygwin ;; #( + *-*-vxworks*) : + ac_sys_system=VxWorks ;; #( + *-*-emscripten) : + ac_sys_system=Emscripten ;; #( + *-*-wasi) : + ac_sys_system=WASI ;; #( + *) : + MACHDEP="unknown" + as_fn_error $? "cross build not supported for $host" "$LINENO" 5 + + ;; +esac + ac_sys_release= + +else + + ac_sys_system=$(uname -s) + case $ac_sys_system in #( + AIX|UnixWare|OpenUNIX) : + ac_sys_release=$(uname -v) ;; #( + *) : + ac_sys_release=$(uname -r) + ;; +esac + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$MACHDEP\"" >&5 -$as_echo "\"$MACHDEP\"" >&6; } + ac_md_system=$(echo $ac_sys_system | tr -d '/ ' | tr '[A-Z]' '[a-z]') + ac_md_release=$(echo $ac_sys_release | tr -d '/ ' | sed 's/^[A-Z]\.//' | sed 's/\..*//') + MACHDEP="$ac_md_system$ac_md_release" + + case $MACHDEP in #( + aix*) : + MACHDEP="aix" ;; #( + linux*) : + MACHDEP="linux" ;; #( + cygwin*) : + MACHDEP="cygwin" ;; #( + darwin*) : + MACHDEP="darwin" ;; #( + '') : + MACHDEP="unknown" + ;; #( + *) : + ;; +esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACHDEP" >&5 +$as_echo "$MACHDEP" >&6; } + + +if test "x$cross_compiling" = xyes; then : + + case $host in #( + *-*-linux*) : + + case $host_cpu in #( + arm*) : + _host_cpu=arm ;; #( + *) : + _host_cpu=$host_cpu + ;; +esac + ;; #( + *-*-cygwin*) : + _host_cpu= ;; #( + *-*-vxworks*) : + _host_cpu=$host_cpu ;; #( + wasm32-*-*|wasm64-*-*) : + _host_cpu=$host_cpu ;; #( + *) : + MACHDEP="unknown" + as_fn_error $? "cross build not supported for $host" "$LINENO" 5 + + ;; +esac + _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" -if test "$cross_compiling" = yes; then - case "$host" in - *-*-linux*) - case "$host_cpu" in - arm*) - _host_cpu=arm - ;; - *) - _host_cpu=$host_cpu - esac - ;; - *-*-cygwin*) - _host_cpu= - ;; - *-*-vxworks*) - _host_cpu=$host_cpu - ;; - wasm32-*-* | wasm64-*-*) - _host_cpu=$host_cpu - ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" - as_fn_error $? "cross build not supported for $host" "$LINENO" 5 - esac - _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" fi # Some systems cannot stand _XOPEN_SOURCE being defined at all; they @@ -6169,7 +6175,7 @@ if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANDROID_API_LEVEL" >&5 $as_echo "$ANDROID_API_LEVEL" >&6; } if test -z "$ANDROID_API_LEVEL"; then - as_fn_error $? "Fatal: you must define __ANDROID_API__" "$LINENO" 5 + as_fn_error $? "you must define __ANDROID_API__" "$LINENO" 5 fi cat >>confdefs.h <<_ACEOF diff --git a/configure.ac b/configure.ac index fa5e63cf5c3f98..0a1e07ed7e1a6e 100644 --- a/configure.ac +++ b/configure.ac @@ -487,92 +487,66 @@ AC_DEFINE_UNQUOTED(_PYTHONFRAMEWORK, "${PYTHONFRAMEWORK}", [framework name]) # Set name for machine-dependent library files AC_ARG_VAR([MACHDEP], [name for machine-dependent library files]) -AC_MSG_CHECKING(MACHDEP) -if test -z "$MACHDEP" -then - # avoid using uname for cross builds - if test "$cross_compiling" = yes; then - # ac_sys_system and ac_sys_release are used for setting - # a lot of different things including 'define_xopen_source' - # in the case statement below. - case "$host" in - *-*-linux-android*) - ac_sys_system=Linux-android - ;; - *-*-linux*) - ac_sys_system=Linux - ;; - *-*-cygwin*) - ac_sys_system=Cygwin - ;; - *-*-vxworks*) - ac_sys_system=VxWorks - ;; - *-*-emscripten) - ac_sys_system=Emscripten - ;; - *-*-wasi) - ac_sys_system=WASI - ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" - AC_MSG_ERROR([cross build not supported for $host]) - esac - ac_sys_release= - else - ac_sys_system=`uname -s` - if test "$ac_sys_system" = "AIX" \ - -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then - ac_sys_release=`uname -v` - else - ac_sys_release=`uname -r` - fi - fi - ac_md_system=`echo $ac_sys_system | - tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'` - ac_md_release=`echo $ac_sys_release | - tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'` - MACHDEP="$ac_md_system$ac_md_release" - - case $MACHDEP in - aix*) MACHDEP="aix";; - linux*) MACHDEP="linux";; - cygwin*) MACHDEP="cygwin";; - darwin*) MACHDEP="darwin";; - '') MACHDEP="unknown";; - esac -fi -AC_MSG_RESULT("$MACHDEP") +AC_MSG_CHECKING([MACHDEP]) +AS_VAR_SET_IF([MACHDEP], [], [ + dnl Avoid using uname for cross builds. + AS_VAR_IF([cross_compiling], [yes], [ + dnl ac_sys_system and ac_sys_release are used for setting + dnl a lot of different things including 'define_xopen_source' + dnl in the case statement below. + AS_CASE([$host], + [*-*-linux-android*], [ac_sys_system=Linux-android], + [*-*-linux*], [ac_sys_system=Linux], + [*-*-cygwin*], [ac_sys_system=Cygwin], + [*-*-vxworks*], [ac_sys_system=VxWorks], + [*-*-emscripten], [ac_sys_system=Emscripten], + [*-*-wasi], [ac_sys_system=WASI], + [dnl For now, limit cross builds to known configurations. + MACHDEP="unknown" + AC_MSG_ERROR([cross build not supported for $host]) + ] + ) + ac_sys_release= + ], [ + ac_sys_system=$(uname -s) + AS_CASE([$ac_sys_system], + [AIX|UnixWare|OpenUNIX], [ac_sys_release=$(uname -v)], + [ac_sys_release=$(uname -r)] + ) + ]) + ac_md_system=$(echo $ac_sys_system | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]') + ac_md_release=$(echo $ac_sys_release | tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//') + MACHDEP="$ac_md_system$ac_md_release" + + AS_CASE([$MACHDEP], + [aix*], [MACHDEP="aix"], + [linux*], [MACHDEP="linux"], + [cygwin*], [MACHDEP="cygwin"], + [darwin*], [MACHDEP="darwin"], + [''], [MACHDEP="unknown"] + ) +]) +AC_MSG_RESULT([$MACHDEP]) AC_SUBST(_PYTHON_HOST_PLATFORM) -if test "$cross_compiling" = yes; then - case "$host" in - *-*-linux*) - case "$host_cpu" in - arm*) - _host_cpu=arm - ;; - *) - _host_cpu=$host_cpu - esac - ;; - *-*-cygwin*) - _host_cpu= - ;; - *-*-vxworks*) - _host_cpu=$host_cpu - ;; - wasm32-*-* | wasm64-*-*) - _host_cpu=$host_cpu - ;; - *) - # for now, limit cross builds to known configurations - MACHDEP="unknown" - AC_MSG_ERROR([cross build not supported for $host]) - esac - _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" -fi +AS_VAR_IF([cross_compiling], [yes], [ + AS_CASE([$host], + [*-*-linux*], [ + AS_CASE([$host_cpu], + [arm*], [_host_cpu=arm], + [_host_cpu=$host_cpu] + ) + ], + [*-*-cygwin*], [_host_cpu=], + [*-*-vxworks*], [_host_cpu=$host_cpu], + [wasm32-*-*|wasm64-*-*], [_host_cpu=$host_cpu], + [dnl For now, limit cross builds to known configurations. + MACHDEP="unknown" + AC_MSG_ERROR([cross build not supported for $host]) + ] + ) + _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}" +]) # Some systems cannot stand _XOPEN_SOURCE being defined at all; they # disable features if it is defined, without any means to access these @@ -1037,7 +1011,7 @@ if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then _arm_arch=`sed -n -e '/__ARM_ARCH/d' -e 's/^arm_arch = //p' conftest.out` AC_MSG_RESULT([$ANDROID_API_LEVEL]) if test -z "$ANDROID_API_LEVEL"; then - AC_MSG_ERROR([Fatal: you must define __ANDROID_API__]) + AC_MSG_ERROR([you must define __ANDROID_API__]) fi AC_DEFINE_UNQUOTED(ANDROID_API_LEVEL, $ANDROID_API_LEVEL, [The Android API level.])