• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AC_DEFUN([utrace_CC_m32], [dnl
2AC_CACHE_CHECK([$CC option for 32-bit word size], utrace_cv_CC_m32, [dnl
3save_CC="$CC"
4utrace_cv_CC_m32=none
5for 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
10done
11CC="$save_CC"])])
12
13AC_DEFUN([utrace_HOST64], [AC_REQUIRE([utrace_CC_m32])
14AS_IF([test x$utrace_cv_CC_m32 != xnone], [dnl
15AC_CACHE_CHECK([for 64-bit host], utrace_cv_host64, [dnl
16AC_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)])
21AS_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
25biarch_CC=`echo "$CC" | sed "s/ *${utrace_thisarch}//"`
26biarch_CC="$biarch_CC $utrace_biarch"])])
27
28AC_DEFUN([utrace_BIARCH], [AC_REQUIRE([utrace_HOST64])
29utrace_biarch_forced=no
30AC_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])])
34AS_IF([test $utrace_biarch_forced = yes], [dnl
35utrace_cv_cc_biarch=yes
36AC_MSG_NOTICE([enabling biarch tests regardless using $biarch_CC])], [dnl
37AS_IF([test x$utrace_cv_CC_m32 != xnone], [dnl
38AC_CACHE_CHECK([whether $biarch_CC makes executables we can run],
39	       utrace_cv_cc_biarch, [dnl
40save_CC="$CC"
41CC="$biarch_CC"
42AC_RUN_IFELSE([AC_LANG_PROGRAM([], [])],
43	      utrace_cv_cc_biarch=yes, utrace_cv_cc_biarch=no, utrace_cv_cc_biarch=no)
44CC="$save_CC"])], [utrace_cv_cc_biarch=no])
45AS_IF([test $utrace_cv_cc_biarch != yes], [dnl
46AC_MSG_WARN([not running biarch tests, $biarch_CC does not work])])])
47AM_CONDITIONAL(BIARCH, [test $utrace_cv_cc_biarch = yes])])
48