Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / common / m4 / gst-arch.m4
1 dnl AG_GST_ARCH
2 dnl sets up defines and automake conditionals for host architecture
3 dnl checks endianness
4 dnl defines HOST_CPU
5
6 AC_DEFUN([AG_GST_ARCH],
7 [
8   AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use host_ variables
9
10   dnl Determine CPU
11   case "x${host_cpu}" in
12     xi?86 | xk? | xi?86_64)
13       case $host_os in
14          solaris*)
15             AC_CHECK_DECL([__i386],     [I386_ABI="yes"], [I386_ABI="no"])
16             AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
17
18             if test "x$I386_ABI" = "xyes" ; then
19                HAVE_CPU_I386=yes
20                AC_DEFINE(HAVE_CPU_I386, 1, [Define if the host CPU is an x86])
21             fi
22             if test "x$AMD64_ABI" = "xyes" ; then
23                 HAVE_CPU_X86_64=yes
24                 AC_DEFINE(HAVE_CPU_X86_64, 1, [Define if the host CPU is a x86_64])
25             fi
26             ;;
27          *)
28             HAVE_CPU_I386=yes
29             AC_DEFINE(HAVE_CPU_I386, 1, [Define if the host CPU is an x86])
30
31             dnl FIXME could use some better detection
32             dnl (ie CPUID)
33             case "x${host_cpu}" in
34               xi386 | xi486) ;;
35             *)
36               AC_DEFINE(HAVE_RDTSC, 1, [Define if RDTSC is available]) ;;
37             esac
38             ;;
39       esac
40       ;;
41     xpowerpc)
42       HAVE_CPU_PPC=yes
43       AC_DEFINE(HAVE_CPU_PPC, 1, [Define if the host CPU is a PowerPC]) ;;
44     xpowerpc64)
45       HAVE_CPU_PPC64=yes
46       AC_DEFINE(HAVE_CPU_PPC64, 1, [Define if the host CPU is a 64 bit PowerPC]) ;;
47     xalpha*)
48       HAVE_CPU_ALPHA=yes
49       AC_DEFINE(HAVE_CPU_ALPHA, 1, [Define if the host CPU is an Alpha]) ;;
50     xarm*)
51       HAVE_CPU_ARM=yes
52       AC_DEFINE(HAVE_CPU_ARM, 1, [Define if the host CPU is an ARM]) ;;
53     xsparc*)
54       HAVE_CPU_SPARC=yes
55       AC_DEFINE(HAVE_CPU_SPARC, 1, [Define if the host CPU is a SPARC]) ;;
56     xmips*)
57       HAVE_CPU_MIPS=yes
58       AC_DEFINE(HAVE_CPU_MIPS, 1, [Define if the host CPU is a MIPS]) ;;
59     xhppa*)
60       HAVE_CPU_HPPA=yes
61       AC_DEFINE(HAVE_CPU_HPPA, 1, [Define if the host CPU is a HPPA]) ;;
62     xs390*)
63       HAVE_CPU_S390=yes
64       AC_DEFINE(HAVE_CPU_S390, 1, [Define if the host CPU is a S390]) ;;
65     xia64*)
66       HAVE_CPU_IA64=yes
67       AC_DEFINE(HAVE_CPU_IA64, 1, [Define if the host CPU is a IA64]) ;;
68     xm68k*)
69       HAVE_CPU_M68K=yes
70       AC_DEFINE(HAVE_CPU_M68K, 1, [Define if the host CPU is a M68K]) ;;
71     xx86_64)
72       HAVE_CPU_X86_64=yes
73       AC_DEFINE(HAVE_CPU_X86_64, 1, [Define if the host CPU is a x86_64]) ;;
74     xcris)
75       HAVE_CPU_CRIS=yes
76       AC_DEFINE(HAVE_CPU_CRIS, 1, [Define if the host CPU is a CRIS]) ;;
77     xcrisv32)
78       HAVE_CPU_CRISV32=yes
79       AC_DEFINE(HAVE_CPU_CRISV32, 1, [Define if the host CPU is a CRISv32]) ;;
80   esac
81
82   dnl Determine endianness
83   AC_C_BIGENDIAN
84
85   AM_CONDITIONAL(HAVE_CPU_I386,       test "x$HAVE_CPU_I386" = "xyes")
86   AM_CONDITIONAL(HAVE_CPU_PPC,        test "x$HAVE_CPU_PPC" = "xyes")
87   AM_CONDITIONAL(HAVE_CPU_PPC64,      test "x$HAVE_CPU_PPC64" = "xyes")
88   AM_CONDITIONAL(HAVE_CPU_ALPHA,      test "x$HAVE_CPU_ALPHA" = "xyes")
89   AM_CONDITIONAL(HAVE_CPU_ARM,        test "x$HAVE_CPU_ARM" = "xyes")
90   AM_CONDITIONAL(HAVE_CPU_SPARC,      test "x$HAVE_CPU_SPARC" = "xyes")
91   AM_CONDITIONAL(HAVE_CPU_HPPA,       test "x$HAVE_CPU_HPPA" = "xyes")
92   AM_CONDITIONAL(HAVE_CPU_MIPS,       test "x$HAVE_CPU_MIPS" = "xyes")
93   AM_CONDITIONAL(HAVE_CPU_S390,       test "x$HAVE_CPU_S390" = "xyes")
94   AM_CONDITIONAL(HAVE_CPU_IA64,       test "x$HAVE_CPU_IA64" = "xyes")
95   AM_CONDITIONAL(HAVE_CPU_M68K,       test "x$HAVE_CPU_M68K" = "xyes")
96   AM_CONDITIONAL(HAVE_CPU_X86_64,     test "x$HAVE_CPU_X86_64" = "xyes")
97   AM_CONDITIONAL(HAVE_CPU_CRIS,       test "x$HAVE_CPU_CRIS" = "xyes")
98   AM_CONDITIONAL(HAVE_CPU_CRISV32,    test "x$HAVE_CPU_CRISV32" = "xyes")
99
100   AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu", [the host CPU])
101 ])
102
103 dnl check if unaligned memory access works correctly
104 AC_DEFUN([AG_GST_UNALIGNED_ACCESS], [
105   AC_MSG_CHECKING([if unaligned memory access works correctly])
106   if test x"$as_cv_unaligned_access" = x ; then
107     case $host in
108       alpha*|arm*|hp*|mips*|sh*|sparc*|ia64*)
109         _AS_ECHO_N([(blacklisted) ])
110         as_cv_unaligned_access=no
111         ;;
112       i?86*|x86_64*|amd64*|powerpc*|m68k*|cris*)
113         _AS_ECHO_N([(whitelisted) ])
114         as_cv_unaligned_access=yes
115         ;;
116     esac
117   else
118     _AS_ECHO_N([(cached) ])
119   fi
120   if test x"$as_cv_unaligned_access" = x ; then
121     AC_TRY_RUN([
122 int main(int argc, char **argv)
123 {
124   char array[] = "ABCDEFGH";
125   unsigned int iarray[2];
126   memcpy(iarray,array,8);
127 #define GET(x) (*(unsigned int *)((char *)iarray + (x)))
128   if(GET(0) != 0x41424344 && GET(0) != 0x44434241) return 1;
129   if(GET(1) != 0x42434445 && GET(1) != 0x45444342) return 1;
130   if(GET(2) != 0x43444546 && GET(2) != 0x46454443) return 1;
131   if(GET(3) != 0x44454647 && GET(3) != 0x47464544) return 1;
132   return 0;
133 }
134     ], as_cv_unaligned_access="yes", as_cv_unaligned_access="no")
135   fi
136   AC_MSG_RESULT($as_cv_unaligned_access)
137   if test "$as_cv_unaligned_access" = "yes"; then
138     AC_DEFINE_UNQUOTED(HAVE_UNALIGNED_ACCESS, 1,
139       [defined if unaligned memory access works correctly])
140   fi
141 ])