mips-abi.m4 revision 72445
1214503Srpaulodnl $Id: mips-abi.m4,v 1.5 2000/07/18 15:01:42 joda Exp $ 2214503Srpaulodnl 3214503Srpaulodnl 4214503Srpaulodnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some 5214503Srpaulodnl value. 6214503Srpaulo 7214503SrpauloAC_DEFUN(AC_MIPS_ABI, [ 8214503SrpauloAC_ARG_WITH(mips_abi, 9214503Srpaulo[ --with-mips-abi=abi ABI to use for IRIX (32, n32, or 64)]) 10214503Srpaulo 11214503Srpaulocase "$host_os" in 12214503Srpauloirix*) 13214503Srpaulowith_mips_abi="${with_mips_abi:-yes}" 14214503Srpauloif test -n "$GCC"; then 15214503Srpaulo 16214503Srpaulo# GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select 17214503Srpaulo# which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs. 18214503Srpaulo# 19214503Srpaulo# Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old 20214503Srpaulo# GCC and revert back to O32. The same goes if O32 is asked for - old 21214503Srpaulo# GCCs doesn't like the -mabi option, and new GCCs can't output O32. 22214503Srpaulo# 23214503Srpaulo# Don't you just love *all* the different SGI ABIs? 24214503Srpaulo 25214503Srpaulocase "${with_mips_abi}" in 26214503Srpaulo 32|o32) abi='-mabi=32'; abilibdirext='' ;; 27214503Srpaulo n32|yes) abi='-mabi=n32'; abilibdirext='32' ;; 28214503Srpaulo 64) abi='-mabi=64'; abilibdirext='64' ;; 29214503Srpaulo no) abi=''; abilibdirext='';; 30214503Srpaulo *) AC_MSG_ERROR("Invalid ABI specified") ;; 31214503Srpauloesac 32214503Srpauloif test -n "$abi" ; then 33214503Srpauloac_foo=krb_cv_gcc_`echo $abi | tr =- __` 34214503Srpaulodnl 35214503Srpaulodnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to 36214503Srpaulodnl AC_MSG_RESULT 37214503Srpaulodnl 38214503SrpauloAC_MSG_CHECKING([if $CC supports the $abi option]) 39214503SrpauloAC_CACHE_VAL($ac_foo, [ 40214503Srpaulosave_CFLAGS="$CFLAGS" 41214503SrpauloCFLAGS="$CFLAGS $abi" 42214503SrpauloAC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no) 43214503SrpauloCFLAGS="$save_CFLAGS" 44214503Srpaulo]) 45214503Srpauloac_res=`eval echo \\\$$ac_foo` 46214503SrpauloAC_MSG_RESULT($ac_res) 47214503Srpauloif test $ac_res = no; then 48214503Srpaulo# Try to figure out why that failed... 49214503Srpaulocase $abi in 50214503Srpaulo -mabi=32) 51214503Srpaulo save_CFLAGS="$CFLAGS" 52214503Srpaulo CFLAGS="$CFLAGS -mabi=n32" 53214503Srpaulo AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no) 54214503Srpaulo CLAGS="$save_CFLAGS" 55214503Srpaulo if test $ac_res = yes; then 56214503Srpaulo # New GCC 57214503Srpaulo AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI]) 58214503Srpaulo fi 59214503Srpaulo # Old GCC 60214503Srpaulo abi='' 61214503Srpaulo abilibdirext='' 62214503Srpaulo ;; 63214503Srpaulo -mabi=n32|-mabi=64) 64214503Srpaulo if test $with_mips_abi = yes; then 65214503Srpaulo # Old GCC, default to O32 66214503Srpaulo abi='' 67214503Srpaulo abilibdirext='' 68214503Srpaulo else 69214503Srpaulo # Some broken GCC 70214503Srpaulo AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI]) 71214503Srpaulo fi 72214503Srpaulo ;; 73214503Srpauloesac 74214503Srpaulofi #if test $ac_res = no; then 75214503Srpaulofi #if test -n "$abi" ; then 76214503Srpauloelse 77214503Srpaulocase "${with_mips_abi}" in 78214503Srpaulo 32|o32) abi='-32'; abilibdirext='' ;; 79214503Srpaulo n32|yes) abi='-n32'; abilibdirext='32' ;; 80214503Srpaulo 64) abi='-64'; abilibdirext='64' ;; 81214503Srpaulo no) abi=''; abilibdirext='';; 82214503Srpaulo *) AC_MSG_ERROR("Invalid ABI specified") ;; 83214503Srpauloesac 84214503Srpaulofi #if test -n "$GCC"; then 85214503Srpaulo;; 86214503Srpauloesac 87214503Srpaulo]) 88214503Srpaulo