1 | dnl $Id$
|
---|
2 | dnl
|
---|
3 | dnl
|
---|
4 | dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some
|
---|
5 | dnl value.
|
---|
6 |
|
---|
7 | AC_DEFUN([AC_MIPS_ABI], [
|
---|
8 | AC_ARG_WITH(mips_abi,
|
---|
9 | AS_HELP_STRING([--with-mips-abi=abi],[ABI to use for IRIX (32, n32, or 64)]))
|
---|
10 |
|
---|
11 | case "$host_os" in
|
---|
12 | irix*)
|
---|
13 | with_mips_abi="${with_mips_abi:-yes}"
|
---|
14 | if 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 |
|
---|
25 | case "${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") ;;
|
---|
31 | esac
|
---|
32 | if test -n "$abi" ; then
|
---|
33 | ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
|
---|
34 | dnl
|
---|
35 | dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to
|
---|
36 | dnl AC_MSG_RESULT
|
---|
37 | dnl
|
---|
38 | AC_MSG_CHECKING([if $CC supports the $abi option])
|
---|
39 | AC_CACHE_VAL($ac_foo, [
|
---|
40 | save_CFLAGS="$CFLAGS"
|
---|
41 | CFLAGS="$CFLAGS $abi"
|
---|
42 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int x;]])],[eval $ac_foo=yes], [eval $ac_foo=no])dnl
|
---|
43 | CFLAGS="$save_CFLAGS"
|
---|
44 | ])
|
---|
45 | ac_res=`eval echo \\\$$ac_foo`
|
---|
46 | AC_MSG_RESULT($ac_res)
|
---|
47 | if test $ac_res = no; then
|
---|
48 | # Try to figure out why that failed...
|
---|
49 | case $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 | ;;
|
---|
73 | esac
|
---|
74 | fi #if test $ac_res = no; then
|
---|
75 | fi #if test -n "$abi" ; then
|
---|
76 | else
|
---|
77 | case "${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") ;;
|
---|
83 | esac
|
---|
84 | fi #if test -n "$GCC"; then
|
---|
85 | ;;
|
---|
86 | esac
|
---|
87 | ])
|
---|