Fix SAH_SELECT_BITNESS logic

This commit is contained in:
Jia Yuan Lo 2021-01-21 23:56:57 +08:00 committed by GitHub
parent ac8c5fc3c8
commit 6e46649c21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 17 deletions

View File

@ -39,25 +39,27 @@ AC_DEFUN([SAH_DEFAULT_BITNESS],[
AC_DEFUN([SAH_SELECT_BITNESS],[ AC_DEFUN([SAH_SELECT_BITNESS],[
SAH_DEFAULT_BITNESS SAH_DEFAULT_BITNESS
AC_LANG_PUSH(C)
AC_MSG_CHECKING(Selecting $1 bit model) AC_LANG_PUSH([C])
echo "int main() { return 0; }" >conftest.$ac_ext AC_MSG_CHECKING([if C compiler can use -m$1])
if test "$1" != "${COMPILER_MODEL_BITS}" if test "$1" != "${COMPILER_MODEL_BITS}"; then
then echo "int main() { return 0; }" >conftest.$ac_ext
${CC} ${CFLAGS} ${CPPFLAGS} -m$1 -c conftest.$ac_ext >&5 AC_REQUIRE_CPP
if test -f conftest.${OBJEXT} ; then ${CC} ${CFLAGS} ${CPPFLAGS} -m$1 -fno-lto -c conftest.$ac_ext 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
if test -n "`file conftest.${OBJEXT} | grep -i $1-bit`" if test -f conftest.${OBJEXT}; then
then if test -n "$(file conftest.${OBJEXT} | grep -i ${1}-bit)"; then
CFLAGS="${CFLAGS} -m$1" CFLAGS="${CFLAGS} -m$1"
AC_MSG_RESULT(-m$1) AC_MSG_RESULT([ok use $1])
COMPILER_MODEL_BITS=$1 else
AC_MSG_ERROR([failed still $COMPILER_MODEL_BITS])
fi
fi fi
AC_MSG_RESULT(failed) /bin/rm conftest.$ac_ext conftest.${OBJEXT}
fi fi
else AC_MSG_RESULT([ok use $1])
AC_MSG_RESULT(ok) AC_LANG_POP([C])
fi
AC_LANG_POP(C) COMPILER_MODEL_BITS=$1
]) ])
AC_DEFUN([SAH_OPTION_BITNESS],[ AC_DEFUN([SAH_OPTION_BITNESS],[