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