Home | History | Annotate | Download | only in m4
      1 AC_DEFUN([utrace_CC_m32], [dnl
      2 AC_CACHE_CHECK([$CC option for 32-bit word size], utrace_cv_CC_m32, [dnl
      3 save_CC="$CC"
      4 utrace_cv_CC_m32=none
      5 for ut_try in -m32 -m31; do
      6   [CC=`echo "$save_CC" | sed 's/ -m[36][241]//'`" $ut_try"]
      7   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int foo (void) { return 1; }]])],
      8 		    [utrace_cv_CC_m32=$ut_try])
      9   test x$utrace_cv_CC_m32 = xnone || break
     10 done
     11 CC="$save_CC"])])
     12 
     13 AC_DEFUN([utrace_HOST64], [AC_REQUIRE([utrace_CC_m32])
     14 AS_IF([test x$utrace_cv_CC_m32 != xnone], [dnl
     15 AC_CACHE_CHECK([for 64-bit host], utrace_cv_host64, [dnl
     16 AC_EGREP_CPP([@utrace_host64@], [#include <stdint.h>
     17 #if (UINTPTR_MAX > 0xffffffffUL)
     18 @utrace_host64@
     19 #endif],
     20              utrace_cv_host64=yes, utrace_cv_host64=no)])
     21 AS_IF([test $utrace_cv_host64 = no],
     22       [utrace_biarch=-m64 utrace_thisarch=$utrace_cv_CC_m32],
     23       [utrace_biarch=$utrace_cv_CC_m32 utrace_thisarch=-m64])
     24 
     25 biarch_CC=`echo "$CC" | sed "s/ *${utrace_thisarch}//"`
     26 biarch_CC="$biarch_CC $utrace_biarch"])])
     27 
     28 AC_DEFUN([utrace_BIARCH], [AC_REQUIRE([utrace_HOST64])
     29 utrace_biarch_forced=no
     30 AC_ARG_WITH([biarch],
     31 	    AC_HELP_STRING([--with-biarch],
     32 			   [enable biarch tests despite build problems]),
     33 	    [AS_IF([test "x$with_biarch" != xno], [utrace_biarch_forced=yes])])
     34 AS_IF([test $utrace_biarch_forced = yes], [dnl
     35 utrace_cv_cc_biarch=yes
     36 AC_MSG_NOTICE([enabling biarch tests regardless using $biarch_CC])], [dnl
     37 AS_IF([test x$utrace_cv_CC_m32 != xnone], [dnl
     38 AC_CACHE_CHECK([whether $biarch_CC makes executables we can run],
     39 	       utrace_cv_cc_biarch, [dnl
     40 save_CC="$CC"
     41 CC="$biarch_CC"
     42 AC_RUN_IFELSE([AC_LANG_PROGRAM([], [])],
     43 	      utrace_cv_cc_biarch=yes, utrace_cv_cc_biarch=no, utrace_cv_cc_biarch=no)
     44 CC="$save_CC"])], [utrace_cv_cc_biarch=no])
     45 AS_IF([test $utrace_cv_cc_biarch != yes], [dnl
     46 AC_MSG_WARN([not running biarch tests, $biarch_CC does not work])])])
     47 AM_CONDITIONAL(BIARCH, [test $utrace_cv_cc_biarch = yes])])
     48