Skip to content

Commit

Permalink
Don't invoke compilers when cross-configuring
Browse files Browse the repository at this point in the history
Rather than invoking the default compilers and
deriving pointless facts from them, simply skip
all compiler tests when the caller indicates
that the configure is not running on the actual
build machine.

Signed-off-by: Younes Manton <ymanton@ca.ibm.com>
  • Loading branch information
ymanton committed Jul 12, 2018
1 parent 8075224 commit 646e45d
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 117 deletions.
114 changes: 74 additions & 40 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -963,6 +964,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
Expand Down Expand Up @@ -1215,6 +1217,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1352,7 +1363,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1505,6 +1516,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -1634,6 +1646,7 @@ Optional Features:
--enable-OMR_ARCH_POWER
--enable-OMR_ARCH_ARM
--enable-OMR_ARCH_AARCH64
--enable-OMR_ARCH_X86
--enable-OMR_ARCH_S390
--enable-OMR_ENV_DATA64
Expand Down Expand Up @@ -2841,6 +2854,8 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
Expand Down Expand Up @@ -3041,22 +3056,14 @@ else
OMR_CROSS_COMPILE=0
fi
if test "$OMR_CROSS_CONFIGURE" = "yes"; then :
# If we are cross-configuring, clear CC so that the default platform compiler can be detected.
# Warn that compiler and feature detection tests will be invalid.
# The user must configure all options manually.
{ CC=; unset CC;}
$as_echo "## ------------------------------------------------------- ##"
$as_echo "## WARNING ##"
$as_echo "## The current machine cannot compile the target platform. ##"
$as_echo "## Compiler and feature detection tests will not be valid. ##"
$as_echo "## ------------------------------------------------------- ##"
fi
# If OMR_TARGET_DATASIZE is set, validate it and use it.
# Otherwise, detect it with a compiler test.
ac_ext=c
# If not cross-configuring and OMR_TARGET_DATASIZE is not set,
# detect it with a compiler test and validate it, otherwise
# just validate it.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OMR_TARGET_DATASIZE" >&5
$as_echo_n "checking OMR_TARGET_DATASIZE... " >&6; }
if test "x$OMR_CROSS_CONFIGURE" != "xyes"
then
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'
Expand Down Expand Up @@ -4244,7 +4251,8 @@ done
if test "x$OMR_TARGET_DATASIZE" = "x"; then :
# The cast to long int works around a bug in the HP C Compiler
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
Expand Down Expand Up @@ -4277,12 +4285,16 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
if test "$ac_cv_sizeof_void_p" = 8; then :
OMR_TARGET_DATASIZE=64
else
OMR_TARGET_DATASIZE=32
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OMR_TARGET_DATASIZE" >&5
$as_echo_n "checking OMR_TARGET_DATASIZE... " >&6; }
if test "x$OMR_TARGET_DATASIZE" != "x"; then :
case $OMR_TARGET_DATASIZE in #(
fi
fi
case $OMR_TARGET_DATASIZE in #(
31) :
;; #(
32) :
Expand All @@ -4291,23 +4303,16 @@ if test "x$OMR_TARGET_DATASIZE" != "x"; then :
;; #(
*) :
as_fn_error $? "An invalid value was provided for OMR_TARGET_DATASIZE: $OMR_TARGET_DATASIZE" "$LINENO" 5
;;
;;
esac
else
if test "$ac_cv_sizeof_void_p" = 8; then :
OMR_TARGET_DATASIZE=64
else
OMR_TARGET_DATASIZE=32
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OMR_TARGET_DATASIZE" >&5
$as_echo "$OMR_TARGET_DATASIZE" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking OMR_TOOLCHAIN" >&5
$as_echo_n "checking OMR_TOOLCHAIN... " >&6; }
if test "x$OMR_TOOLCHAIN" = "x"; then :
if test "x$OMR_CROSS_CONFIGURE" != "xyes"
then
if test "x$OMR_TOOLCHAIN" = "x"; then :
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Expand Down Expand Up @@ -4362,6 +4367,7 @@ fi
fi
fi
fi
case $OMR_TOOLCHAIN in #(
gcc) :
Expand Down Expand Up @@ -6499,6 +6505,7 @@ else
fi
# Check whether --enable-OMR_ENV_LITTLE_ENDIAN was given.
if test "${enable_OMR_ENV_LITTLE_ENDIAN+set}" = set; then :
enableval=$enable_OMR_ENV_LITTLE_ENDIAN; if test "x${enableval}" = xyes; then :
Expand All @@ -6514,7 +6521,10 @@ else
if test "x${enable_auto_build_flag}" = xyes; then :
if test "3" -gt 2; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
if test "x$OMR_CROSS_CONFIGURE" != "xyes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
if ${ac_cv_c_bigendian+:} false; then :
$as_echo_n "(cached) " >&6
Expand Down Expand Up @@ -6734,13 +6744,14 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
universal)
OMR_ENV_LITTLE_ENDIAN=0
;; #(
*)
as_fn_error $? "unknown endianness
presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
esac
fi
:
Expand Down Expand Up @@ -6857,6 +6868,14 @@ else
if test "3" -gt 2; then :
if test "x$OMR_CROSS_CONFIGURE" != "xyes"
then
# The no-op ":" prevents this if-then from being left empty
# if AC_CHECK_HEADERS_ONCE has already been evaluated.
:
fi
:
Expand All @@ -6875,8 +6894,12 @@ fi
if test "$OMR_CROSS_CONFIGURE" != yes -a "$OMR_PORT_NUMA_SUPPORT" = 1 -a "$OMR_HOST_OS" = linux; then :
if test "x$OMR_CROSS_CONFIGURE" != "xyes"
then
if test "$OMR_PORT_NUMA_SUPPORT" = 1 -a "$OMR_HOST_OS" = linux; then :
fi
fi
# Check whether --enable-OMR_OPT_CUDA was given.
Expand Down Expand Up @@ -7221,7 +7244,9 @@ fi
*) :
# other host types: look for DWARF support
for ac_header in dwarf.h libdwarf/dwarf.h libdwarf.h libdwarf/libdwarf.h
if test "x$OMR_CROSS_CONFIGURE" != "xyes"
then
for ac_header in dwarf.h libdwarf/dwarf.h libdwarf.h libdwarf/libdwarf.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
Expand All @@ -7234,7 +7259,7 @@ fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dwarf_init" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dwarf_init" >&5
$as_echo_n "checking for library containing dwarf_init... " >&6; }
if ${ac_cv_search_dwarf_init+:} false; then :
$as_echo_n "(cached) " >&6
Expand Down Expand Up @@ -7290,7 +7315,7 @@ if test "$ac_res" != no; then :
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dwarf_init" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dwarf_init" >&5
$as_echo_n "checking for library containing dwarf_init... " >&6; }
if ${ac_cv_search_dwarf_init+:} false; then :
$as_echo_n "(cached) " >&6
Expand Down Expand Up @@ -7346,7 +7371,7 @@ if test "$ac_res" != no; then :
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing elf_begin" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing elf_begin" >&5
$as_echo_n "checking for library containing elf_begin... " >&6; }
if ${ac_cv_search_elf_begin+:} false; then :
$as_echo_n "(cached) " >&6
Expand Down Expand Up @@ -7402,6 +7427,15 @@ if test "$ac_res" != no; then :
fi
else
# Can't run AC_CHECK_HEADERS when cross-configuring.
# If DDR is enabled set these flags and hope for the best,
# otherwise the build will fail even if the headers are available.
$as_echo "#define HAVE_DWARF_H 1" >>confdefs.h
$as_echo "#define HAVE_LIBDWARF_H 1" >>confdefs.h
fi
;;
esac
Expand Down
Loading

0 comments on commit 646e45d

Please sign in to comment.