~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to mozilla/build/autoconf/arch.m4

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl This Source Code Form is subject to the terms of the Mozilla Public
 
2
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
 
3
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
4
 
 
5
AC_DEFUN([MOZ_ARCH_OPTS],
 
6
[
 
7
 
 
8
dnl ========================================================
 
9
dnl = ARM toolchain tweaks
 
10
dnl ========================================================
 
11
 
 
12
MOZ_THUMB=toolchain-default
 
13
MOZ_THUMB_INTERWORK=toolchain-default
 
14
MOZ_FPU=toolchain-default
 
15
MOZ_FLOAT_ABI=toolchain-default
 
16
MOZ_SOFT_FLOAT=toolchain-default
 
17
 
 
18
MOZ_ARG_WITH_STRING(arch,
 
19
[  --with-arch=[[type|toolchain-default]]
 
20
                           Use specific CPU features (-march=type). Resets
 
21
                           thumb, fpu, float-abi, etc. defaults when set],
 
22
    if test -z "$GNU_CC"; then
 
23
        AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
 
24
    fi
 
25
    MOZ_ARCH=$withval)
 
26
 
 
27
if test -z "$MOZ_ARCH"; then
 
28
    dnl Defaults
 
29
    case "${CPU_ARCH}-${OS_TARGET}" in
 
30
    arm-Android)
 
31
        MOZ_THUMB=yes
 
32
        MOZ_ARCH=armv7-a
 
33
        MOZ_FPU=vfp
 
34
        MOZ_FLOAT_ABI=softfp
 
35
        ;;
 
36
    arm-Darwin)
 
37
        MOZ_ARCH=toolchain-default
 
38
        MOZ_THUMB=yes
 
39
        ;;
 
40
    arm-*)
 
41
        if test -n "$MOZ_PLATFORM_MAEMO"; then
 
42
            MOZ_THUMB=no
 
43
            MOZ_ARCH=armv7-a
 
44
            MOZ_FLOAT_ABI=softfp
 
45
        fi
 
46
        if test "$MOZ_PLATFORM_MAEMO" = 6; then
 
47
            MOZ_THUMB=yes
 
48
        fi
 
49
        ;;
 
50
    esac
 
51
fi
 
52
 
 
53
if test "$MOZ_ARCH" = "armv6" -a "$OS_TARGET" = "Android"; then
 
54
   MOZ_FPU=vfp
 
55
fi
 
56
 
 
57
MOZ_ARG_WITH_STRING(thumb,
 
58
[  --with-thumb[[=yes|no|toolchain-default]]]
 
59
[                          Use Thumb instruction set (-mthumb)],
 
60
    if test -z "$GNU_CC"; then
 
61
        AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
 
62
    fi
 
63
    MOZ_THUMB=$withval)
 
64
 
 
65
MOZ_ARG_WITH_STRING(thumb-interwork,
 
66
[  --with-thumb-interwork[[=yes|no|toolchain-default]]
 
67
                           Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
 
68
    if test -z "$GNU_CC"; then
 
69
        AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
 
70
    fi
 
71
    MOZ_THUMB_INTERWORK=$withval)
 
72
 
 
73
MOZ_ARG_WITH_STRING(fpu,
 
74
[  --with-fpu=[[type|toolchain-default]]
 
75
                           Use specific FPU type (-mfpu=type)],
 
76
    if test -z "$GNU_CC"; then
 
77
        AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
 
78
    fi
 
79
    MOZ_FPU=$withval)
 
80
 
 
81
MOZ_ARG_WITH_STRING(float-abi,
 
82
[  --with-float-abi=[[type|toolchain-default]]
 
83
                           Use specific arm float ABI (-mfloat-abi=type)],
 
84
    if test -z "$GNU_CC"; then
 
85
        AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
 
86
    fi
 
87
    MOZ_FLOAT_ABI=$withval)
 
88
 
 
89
MOZ_ARG_WITH_STRING(soft-float,
 
90
[  --with-soft-float[[=yes|no|toolchain-default]]
 
91
                           Use soft float library (-msoft-float)],
 
92
    if test -z "$GNU_CC"; then
 
93
        AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
 
94
    fi
 
95
    MOZ_SOFT_FLOAT=$withval)
 
96
 
 
97
case "$MOZ_ARCH" in
 
98
toolchain-default|"")
 
99
    arch_flag=""
 
100
    ;;
 
101
*)
 
102
    arch_flag="-march=$MOZ_ARCH"
 
103
    ;;
 
104
esac
 
105
 
 
106
case "$MOZ_THUMB" in
 
107
yes)
 
108
    MOZ_THUMB2=1
 
109
    thumb_flag="-mthumb"
 
110
    ;;
 
111
no)
 
112
    MOZ_THUMB2=
 
113
    thumb_flag="-marm"
 
114
    ;;
 
115
*)
 
116
    _SAVE_CFLAGS="$CFLAGS"
 
117
    CFLAGS="$arch_flag"
 
118
    AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
 
119
        MOZ_THUMB2=1,
 
120
        MOZ_THUMB2=)
 
121
    CFLAGS="$_SAVE_CFLAGS"
 
122
    thumb_flag=""
 
123
    ;;
 
124
esac
 
125
 
 
126
if test "$MOZ_THUMB2" = 1; then
 
127
    AC_DEFINE(MOZ_THUMB2)
 
128
fi
 
129
 
 
130
case "$MOZ_THUMB_INTERWORK" in
 
131
yes)
 
132
    thumb_interwork_flag="-mthumb-interwork"
 
133
    ;;
 
134
no)
 
135
    thumb_interwork_flag="-mno-thumb-interwork"
 
136
    ;;
 
137
*) # toolchain-default
 
138
    thumb_interwork_flag=""
 
139
    ;;
 
140
esac
 
141
 
 
142
case "$MOZ_FPU" in
 
143
toolchain-default|"")
 
144
    fpu_flag=""
 
145
    ;;
 
146
*)
 
147
    fpu_flag="-mfpu=$MOZ_FPU"
 
148
    ;;
 
149
esac
 
150
 
 
151
case "$MOZ_FLOAT_ABI" in
 
152
toolchain-default|"")
 
153
    float_abi_flag=""
 
154
    ;;
 
155
*)
 
156
    float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
 
157
    ;;
 
158
esac
 
159
 
 
160
case "$MOZ_SOFT_FLOAT" in
 
161
yes)
 
162
    soft_float_flag="-msoft-float"
 
163
    ;;
 
164
no)
 
165
    soft_float_flag="-mno-soft-float"
 
166
    ;;
 
167
*) # toolchain-default
 
168
    soft_float_flag=""
 
169
    ;;
 
170
esac
 
171
 
 
172
dnl Use echo to avoid accumulating space characters
 
173
all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
 
174
if test -n "$all_flags"; then
 
175
    _SAVE_CFLAGS="$CFLAGS"
 
176
    CFLAGS="$all_flags"
 
177
    AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
 
178
    AC_TRY_COMPILE([],[return 0;],
 
179
        AC_MSG_RESULT([yes]),
 
180
        AC_MSG_ERROR([no]))
 
181
 
 
182
    CFLAGS="$_SAVE_CFLAGS $all_flags"
 
183
    CXXFLAGS="$CXXFLAGS $all_flags"
 
184
    ASFLAGS="$ASFLAGS $all_flags"
 
185
    if test -n "$thumb_flag"; then
 
186
        LDFLAGS="$LDFLAGS $thumb_flag"
 
187
    fi
 
188
fi
 
189
 
 
190
AC_SUBST(MOZ_THUMB2)
 
191
 
 
192
if test "$CPU_ARCH" = "arm"; then
 
193
  AC_MSG_CHECKING(for ARM SIMD support in compiler)
 
194
  # We try to link so that this also fails when
 
195
  # building with LTO.
 
196
  AC_TRY_LINK([],
 
197
                 [asm("uqadd8 r1, r1, r2");],
 
198
                 result="yes", result="no")
 
199
  AC_MSG_RESULT("$result")
 
200
  if test "$result" = "yes"; then
 
201
      AC_DEFINE(HAVE_ARM_SIMD)
 
202
      HAVE_ARM_SIMD=1
 
203
  fi
 
204
 
 
205
  AC_MSG_CHECKING(for ARM NEON support in compiler)
 
206
  # We try to link so that this also fails when
 
207
  # building with LTO.
 
208
  AC_TRY_LINK([],
 
209
                 [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
 
210
                 result="yes", result="no")
 
211
  AC_MSG_RESULT("$result")
 
212
  if test "$result" = "yes"; then
 
213
      AC_DEFINE(HAVE_ARM_NEON)
 
214
      HAVE_ARM_NEON=1
 
215
  fi
 
216
fi # CPU_ARCH = arm
 
217
 
 
218
AC_SUBST(HAVE_ARM_SIMD)
 
219
AC_SUBST(HAVE_ARM_NEON)
 
220
 
 
221
if test -n "$MOZ_ARCH"; then
 
222
  NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-arch=$MOZ_ARCH"
 
223
  NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb=$MOZ_THUMB"
 
224
  NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-thumb-interwork=$MOZ_THUMB_INTERWORK"
 
225
  NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-fpu=$MOZ_FPU"
 
226
  NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-float-abi=$MOZ_FLOAT_ABI"
 
227
  NSPR_CONFIGURE_ARGS="$NSPR_CONFIGURE_ARGS --with-soft-float=$MOZ_SOFT_FLOAT"
 
228
fi
 
229
 
 
230
])