1 dnl $Heimdal: mips-abi.m4 14166 2004-08-26 12:35:42Z joda $
5 dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some
8 AC_DEFUN([AC_MIPS_ABI], [
10 AS_HELP_STRING([--with-mips-abi=abi],[ABI to use for IRIX (32, n32, or 64)]))
14 with_mips_abi="${with_mips_abi:-yes}"
15 if test -n "$GCC"; then
17 # GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select
18 # which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs.
20 # Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old
21 # GCC and revert back to O32. The same goes if O32 is asked for - old
22 # GCCs doesn't like the -mabi option, and new GCCs can't output O32.
24 # Don't you just love *all* the different SGI ABIs?
26 case "${with_mips_abi}" in
27 32|o32) abi='-mabi=32'; abilibdirext='' ;;
28 n32|yes) abi='-mabi=n32'; abilibdirext='32' ;;
29 64) abi='-mabi=64'; abilibdirext='64' ;;
30 no) abi=''; abilibdirext='';;
31 *) AC_MSG_ERROR("Invalid ABI specified") ;;
33 if test -n "$abi" ; then
34 ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
36 dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to
39 AC_MSG_CHECKING([if $CC supports the $abi option])
40 AC_CACHE_VAL($ac_foo, [
43 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int x;]])],[eval $ac_foo=yes], [eval $ac_foo=no])dnl
46 ac_res=`eval echo \\\$$ac_foo`
47 AC_MSG_RESULT($ac_res)
48 if test $ac_res = no; then
49 # Try to figure out why that failed...
53 CFLAGS="$CFLAGS -mabi=n32"
54 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int x;]])],[ac_res=yes],[ac_res=no])dnl
56 if test $ac_res = yes; then
58 AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI])
65 if test $with_mips_abi = yes; then
66 # Old GCC, default to O32
71 AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI])
75 fi #if test $ac_res = no; then
76 fi #if test -n "$abi" ; then
78 case "${with_mips_abi}" in
79 32|o32) abi='-32'; abilibdirext='' ;;
80 n32|yes) abi='-n32'; abilibdirext='32' ;;
81 64) abi='-64'; abilibdirext='64' ;;
82 no) abi=''; abilibdirext='';;
83 *) AC_MSG_ERROR("Invalid ABI specified") ;;
85 fi #if test -n "$GCC"; then