Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df2aecb

Browse files
committed
- Issue #14327: Call AC_CANONICAL_HOST in configure.ac and check in
config.{guess,sub}. Don't use uname calls for cross builds.
1 parent abdb552 commit df2aecb

3 files changed

Lines changed: 57 additions & 27 deletions

File tree

Misc/NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Build
116116
- Issue #14324: Fix configure tests for cross builds.
117117

118118
- Issue #14327: Call AC_CANONICAL_HOST in configure.ac and check in
119-
config.{guess,sub}.
119+
config.{guess,sub}. Don't use uname calls for cross builds.
120120

121121
Extension Modules
122122
-----------------

configure

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3150,26 +3150,46 @@ fi
31503150
$as_echo_n "checking MACHDEP... " >&6; }
31513151
if test -z "$MACHDEP"
31523152
then
3153+
# avoid using uname for cross builds
3154+
if test "$cross_compiling" = yes; then
3155+
# ac_sys_system and ac_sys_release are only used for setting
3156+
# `define_xopen_source' in the case statement below. For the
3157+
# current supported cross builds, this macro is not adjusted.
3158+
case "$host" in
3159+
*-*-linux*)
3160+
ac_sys_system=Linux
3161+
;;
3162+
*-*-cygwin*)
3163+
ac_sys_system=Cygwin
3164+
;;
3165+
*)
3166+
# for now, limit cross builds to known configurations
3167+
MACHDEP="unknown"
3168+
as_fn_error $? "cross build not supported for $host" "$LINENO" 5
3169+
esac
3170+
ac_sys_release=
3171+
else
31533172
ac_sys_system=`uname -s`
31543173
if test "$ac_sys_system" = "AIX" \
31553174
-o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
31563175
ac_sys_release=`uname -v`
31573176
else
31583177
ac_sys_release=`uname -r`
31593178
fi
3160-
ac_md_system=`echo $ac_sys_system |
3161-
tr -d '/ ' | tr '[A-Z]' '[a-z]'`
3162-
ac_md_release=`echo $ac_sys_release |
3163-
tr -d '/ ' | sed 's/^[A-Z]\.//' | sed 's/\..*//'`
3164-
MACHDEP="$ac_md_system$ac_md_release"
3179+
fi
3180+
ac_md_system=`echo $ac_sys_system |
3181+
tr -d '/ ' | tr '[A-Z]' '[a-z]'`
3182+
ac_md_release=`echo $ac_sys_release |
3183+
tr -d '/ ' | sed 's/^[A-Z]\.//' | sed 's/\..*//'`
3184+
MACHDEP="$ac_md_system$ac_md_release"
31653185

3166-
case $MACHDEP in
3186+
case $MACHDEP in
31673187
linux*) MACHDEP="linux";;
31683188
cygwin*) MACHDEP="cygwin";;
31693189
darwin*) MACHDEP="darwin";;
31703190
irix646) MACHDEP="irix6";;
31713191
'') MACHDEP="unknown";;
3172-
esac
3192+
esac
31733193
fi
31743194

31753195
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
@@ -3305,12 +3325,6 @@ $as_echo "$MACHDEP" >&6; }
33053325
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
33063326
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
33073327

3308-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking machine type as reported by uname -m" >&5
3309-
$as_echo_n "checking machine type as reported by uname -m... " >&6; }
3310-
ac_sys_machine=`uname -m`
3311-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_sys_machine" >&5
3312-
$as_echo "$ac_sys_machine" >&6; }
3313-
33143328
# checks for alternative programs
33153329

33163330
# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
@@ -5733,7 +5747,7 @@ $as_echo "$ac_cv_disable_unused_result_warning" >&6; }
57335747
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
57345748
# support. Without this, treatment of subnormals doesn't follow
57355749
# the standard.
5736-
case $ac_sys_machine in
5750+
case $host in
57375751
alpha*)
57385752
BASECFLAGS="$BASECFLAGS -mieee"
57395753
;;

configure.ac

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -292,26 +292,46 @@ AC_SUBST(MACHDEP)
292292
AC_MSG_CHECKING(MACHDEP)
293293
if test -z "$MACHDEP"
294294
then
295+
# avoid using uname for cross builds
296+
if test "$cross_compiling" = yes; then
297+
# ac_sys_system and ac_sys_release are only used for setting
298+
# `define_xopen_source' in the case statement below. For the
299+
# current supported cross builds, this macro is not adjusted.
300+
case "$host" in
301+
*-*-linux*)
302+
ac_sys_system=Linux
303+
;;
304+
*-*-cygwin*)
305+
ac_sys_system=Cygwin
306+
;;
307+
*)
308+
# for now, limit cross builds to known configurations
309+
MACHDEP="unknown"
310+
AC_MSG_ERROR([cross build not supported for $host])
311+
esac
312+
ac_sys_release=
313+
else
295314
ac_sys_system=`uname -s`
296315
if test "$ac_sys_system" = "AIX" \
297316
-o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
298317
ac_sys_release=`uname -v`
299318
else
300319
ac_sys_release=`uname -r`
301320
fi
302-
ac_md_system=`echo $ac_sys_system |
303-
tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
304-
ac_md_release=`echo $ac_sys_release |
305-
tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
306-
MACHDEP="$ac_md_system$ac_md_release"
321+
fi
322+
ac_md_system=`echo $ac_sys_system |
323+
tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
324+
ac_md_release=`echo $ac_sys_release |
325+
tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
326+
MACHDEP="$ac_md_system$ac_md_release"
307327

308-
case $MACHDEP in
328+
case $MACHDEP in
309329
linux*) MACHDEP="linux";;
310330
cygwin*) MACHDEP="cygwin";;
311331
darwin*) MACHDEP="darwin";;
312332
irix646) MACHDEP="irix6";;
313333
'') MACHDEP="unknown";;
314-
esac
334+
esac
315335
fi
316336

317337
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
@@ -439,10 +459,6 @@ AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
439459
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
440460
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
441461

442-
AC_MSG_CHECKING(machine type as reported by uname -m)
443-
ac_sys_machine=`uname -m`
444-
AC_MSG_RESULT($ac_sys_machine)
445-
446462
# checks for alternative programs
447463

448464
# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
@@ -1010,7 +1026,7 @@ yes)
10101026
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
10111027
# support. Without this, treatment of subnormals doesn't follow
10121028
# the standard.
1013-
case $ac_sys_machine in
1029+
case $host in
10141030
alpha*)
10151031
BASECFLAGS="$BASECFLAGS -mieee"
10161032
;;

0 commit comments

Comments
 (0)