beta-0.89.2
[luatex.git] / source / libs / cairo / cairo-src / build / aclocal.float.m4
blob8f85f0862ba624ff4b1204acabe50d5ce4b6d300
1 # AX_C_FLOAT_WORDS_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE],
2 #                             [ACTION-IF-UNKNOWN])
4 # Checks the ordering of words within a multi-word float. This check
5 # is necessary because on some systems (e.g. certain ARM systems), the
6 # float word ordering can be different from the byte ordering. In a
7 # multi-word float context, "big-endian" implies that the word containing
8 # the sign bit is found in the memory location with the lowest address.
9 # This implemenation was inspired by the AC_C_BIGENDIAN macro in autoconf.
10 # -------------------------------------------------------------------------
11 AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
12   [AC_CACHE_CHECK(whether float word ordering is bigendian,
13                   ax_cv_c_float_words_bigendian, [
15 # The endianess is detected by first compiling C code that contains a special
16 # double float value, then grepping the resulting object file for certain
17 # strings of ascii values. The double is specially crafted to have a
18 # binary representation that corresponds with a simple string. In this
19 # implementation, the string "noonsees" was selected because the individual
20 # word values ("noon" and "sees") are palindromes, thus making this test
21 # byte-order agnostic. If grep finds the string "noonsees" in the object
22 # file, the target platform stores float words in big-endian order. If grep
23 # finds "seesnoon", float words are in little-endian order. If neither value
24 # is found, the user is instructed to specify the ordering.
26 ax_cv_c_float_words_bigendian=unknown
27 AC_LINK_IFELSE([AC_LANG_SOURCE([[
29 double d __attribute__((used)) = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
30 int main() { return 0; }
32 ]])], [
34 if strings - conftest$ac_exeext | grep noonsees >/dev/null ; then
35   ax_cv_c_float_words_bigendian=yes
37 if strings - conftest$ac_exeext | grep seesnoon >/dev/null ; then
38   if test "$ax_cv_c_float_words_bigendian" = unknown; then
39     ax_cv_c_float_words_bigendian=no
40   else
41     ax_cv_c_float_words_bigendian=unknown
42   fi
45 ])])
47 case $ax_cv_c_float_words_bigendian in
48   yes)
49     m4_default([$1],
50       [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
51                  [Define to 1 if your system stores words within floats
52                   with the most significant word first])]) ;;
53   no)
54     $2 ;;
55   *)
56     m4_default([$3],
57       [AC_MSG_ERROR([
59 Unknown float word ordering. You need to manually preset
60 ax_cv_c_float_words_bigendian=no (or yes) according to your system.
62     ])]) ;;
63 esac
65 ])# AX_C_FLOAT_WORDS_BIGENDIAN