source: trunk/third/cyrus-sasl/cmulocal/mips-abi.m4 @ 17977

Revision 17977, 2.6 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17976, which included commits to RCS files with non-trunk default branches.
Line 
1dnl mips-abi.m4--Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext
2dnl to some value
3dnl Derrick Brashear
4dnl from KTH krb (from CMU)
5dnl $Id: mips-abi.m4,v 1.1.1.1 2002-10-13 18:01:01 ghudson Exp $
6
7AC_DEFUN(AC_MIPS_ABI, [
8AC_ARG_WITH(mips_abi,
9[  --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_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_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
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_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no)
54        CLAGS="$save_CFLAGS"
55        if test $ac_res = yes; then
56                # New GCC
57                AC_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_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_ERROR("Invalid ABI specified") ;;
83esac
84fi #if test -n "$GCC"; then
85;;
86esac
87
88dnl And then we munge variables to make things work
89CFLAGS="${CFLAGS} $abi"
90libdir=`echo $libdir | sed 's,/*$,$abilibdirext,'`
91LDFLAGS=`echo $LDFLAGS | sed -e "s,/lib$,/lib$abilibdirext," -e "s,\\\(/lib[^a-zA-Z]\\\),\\\1$abilibdirext,g"`
92
93])
Note: See TracBrowser for help on using the repository browser.