mips-abi.m4 revision 267654
1dnl $Id: mips-abi.m4 14166 2004-08-26 12:35:42Z joda $ 2dnl 3dnl 4dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some 5dnl value. 6 7AC_DEFUN([AC_MIPS_ABI], [ 8AC_ARG_WITH(mips_abi, 9 AS_HELP_STRING([--with-mips-abi=abi],[ABI to use for IRIX (32, n32, or 64)])) 10 11case "$host_os" in 12irix*) 13with_mips_abi="${with_mips_abi:-yes}" 14if test -n "$GCC"; then 15 16# GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select 17# which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs. 18# 19# Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old 20# GCC and revert back to O32. The same goes if O32 is asked for - old 21# GCCs doesn't like the -mabi option, and new GCCs can't output O32. 22# 23# Don't you just love *all* the different SGI ABIs? 24 25case "${with_mips_abi}" in 26 32|o32) abi='-mabi=32'; abilibdirext='' ;; 27 n32|yes) abi='-mabi=n32'; abilibdirext='32' ;; 28 64) abi='-mabi=64'; abilibdirext='64' ;; 29 no) abi=''; abilibdirext='';; 30 *) AC_MSG_ERROR("Invalid ABI specified") ;; 31esac 32if test -n "$abi" ; then 33ac_foo=krb_cv_gcc_`echo $abi | tr =- __` 34dnl 35dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to 36dnl AC_MSG_RESULT 37dnl 38AC_MSG_CHECKING([if $CC supports the $abi option]) 39AC_CACHE_VAL($ac_foo, [ 40save_CFLAGS="$CFLAGS" 41CFLAGS="$CFLAGS $abi" 42AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int x;]])],[eval $ac_foo=yes], [eval $ac_foo=no])dnl 43CFLAGS="$save_CFLAGS" 44]) 45ac_res=`eval echo \\\$$ac_foo` 46AC_MSG_RESULT($ac_res) 47if test $ac_res = no; then 48# Try to figure out why that failed... 49case $abi in 50 -mabi=32) 51 save_CFLAGS="$CFLAGS" 52 CFLAGS="$CFLAGS -mabi=n32" 53 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int x;]])],[ac_res=yes],[ac_res=no])dnl 54 CLAGS="$save_CFLAGS" 55 if test $ac_res = yes; then 56 # New GCC 57 AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI]) 58 fi 59 # Old GCC 60 abi='' 61 abilibdirext='' 62 ;; 63 -mabi=n32|-mabi=64) 64 if test $with_mips_abi = yes; then 65 # Old GCC, default to O32 66 abi='' 67 abilibdirext='' 68 else 69 # Some broken GCC 70 AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI]) 71 fi 72 ;; 73esac 74fi #if test $ac_res = no; then 75fi #if test -n "$abi" ; then 76else 77case "${with_mips_abi}" in 78 32|o32) abi='-32'; abilibdirext='' ;; 79 n32|yes) abi='-n32'; abilibdirext='32' ;; 80 64) abi='-64'; abilibdirext='64' ;; 81 no) abi=''; abilibdirext='';; 82 *) AC_MSG_ERROR("Invalid ABI specified") ;; 83esac 84fi #if test -n "$GCC"; then 85;; 86esac 87]) 88