test for mips abi
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4882 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
81
cf/mips-abi.m4
Normal file
81
cf/mips-abi.m4
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
dnl $Id$
|
||||||
|
dnl
|
||||||
|
dnl
|
||||||
|
dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some
|
||||||
|
dnl value.
|
||||||
|
|
||||||
|
AC_DEFUN(AC_MIPS_ABI, [
|
||||||
|
AC_ARG_WITH(mips_abi,
|
||||||
|
[ --with-mips-abi=abi ABI to use for IRIX (32, n32, or 64)])
|
||||||
|
|
||||||
|
case "$host_os" in
|
||||||
|
irix*)
|
||||||
|
with_mips_abi="${with_mips_abi:-default}"
|
||||||
|
if test -n "$GCC"; then
|
||||||
|
|
||||||
|
# GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select
|
||||||
|
# which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs.
|
||||||
|
#
|
||||||
|
# Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old
|
||||||
|
# GCC and revert back to O32. The same goes if O32 is asked for - old
|
||||||
|
# GCCs doesn't like the -mabi option, and new GCCs can't output O32.
|
||||||
|
#
|
||||||
|
# Don't you just love *all* the different SGI ABIs?
|
||||||
|
|
||||||
|
case "${with_mips_abi}" in
|
||||||
|
32|o32) abi='-mabi=32'; abilibdirext='' ;;
|
||||||
|
n32|yes) abi='-mabi=n32'; abilibdirext='32' ;;
|
||||||
|
64) abi='-mabi=64'; abilibdirext='64' ;;
|
||||||
|
no) abi=''; abilibdirext='';;
|
||||||
|
*) AC_ERROR("Invalid ABI specified") ;;
|
||||||
|
esac
|
||||||
|
if test -n "$abi" ; then
|
||||||
|
ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
|
||||||
|
AC_CACHE_CHECK([if $CC supports the $abi option], $ac_foo, [
|
||||||
|
save_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $abi"
|
||||||
|
AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
|
||||||
|
CFLAGS="$save_CFLAGS"
|
||||||
|
])
|
||||||
|
ac_res=`eval echo \\\$$ac_foo`
|
||||||
|
if test $ac_res = no; then
|
||||||
|
# Try to figure out why that failed...
|
||||||
|
case $abi in
|
||||||
|
-mabi=32)
|
||||||
|
save_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS -mabi=n32"
|
||||||
|
AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no)
|
||||||
|
CLAGS="$save_CFLAGS"
|
||||||
|
if test $ac_res = yes; then
|
||||||
|
# New GCC
|
||||||
|
AC_ERROR([$CC does not support the $with_mips_abi ABI])
|
||||||
|
fi
|
||||||
|
# Old GCC
|
||||||
|
abi=''
|
||||||
|
;;
|
||||||
|
-mabi=n32|-mabi=64)
|
||||||
|
if test $with_mips_abi = default; then
|
||||||
|
# Old GCC, default to O32
|
||||||
|
abi=32
|
||||||
|
abilibdirext=''
|
||||||
|
else
|
||||||
|
# Some broken GCC
|
||||||
|
AC_ERROR([$CC does not support the $with_mips_abi ABI])
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi #if test $ac_res = no; then
|
||||||
|
fi #if test -n "$abi" ; then
|
||||||
|
else
|
||||||
|
case "${with_mips_abi}" in
|
||||||
|
32|o32) abi='-32'; abilibdirext='' ;;
|
||||||
|
n32|default|yes) abi='-n32'; abilibdirext='32' ;;
|
||||||
|
64) abi='-64'; abilibdirext='64' ;;
|
||||||
|
no) abi=''; abilibdirext='';;
|
||||||
|
*) AC_ERROR("Invalid ABI specified") ;;
|
||||||
|
esac
|
||||||
|
fi #if test -n "$GCC"; then
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
exit
|
||||||
|
])
|
Reference in New Issue
Block a user