summaryrefslogtreecommitdiff
path: root/www/firefox/patches/patch-aa
blob: 97706d2eebc675d859c22140ad5a4e4b2e737d72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
$NetBSD: patch-aa,v 1.26 2014/05/28 04:55:30 pho Exp $

* On Darwin the profiler only supports x86 and x86_64.

* Cocoa gamepad backend can only be used if the toolkit is cocoa too.

--- configure.in.orig	2014-05-06 22:55:16.000000000 +0000
+++ configure.in
@@ -1613,7 +1613,13 @@ Linux)
         MOZ_ENABLE_PROFILER_SPS=
     esac
     ;;
-WINNT|Darwin) ;;
+WINNT|Darwin)
+    case "${CPU_ARCH}" in
+    x86 | x86_64) ;;
+    *)
+        MOZ_ENABLE_PROFILER_SPS=
+    esac
+    ;;
 *)
     MOZ_ENABLE_PROFILER_SPS=
     ;;
@@ -2534,118 +2540,15 @@ MOZ_CXX11
 
 AC_LANG_C
 
-dnl Check for .hidden assembler directive and visibility attribute.
-dnl Borrowed from glibc configure.in
+dnl Setup default hidden visibility and wrapped system headers.
 dnl ===============================================================
 if test "$GNU_CC"; then
-  AC_CACHE_CHECK(for visibility(hidden) attribute,
-                 ac_cv_visibility_hidden,
-                 [cat > conftest.c <<EOF
-                  int foo __attribute__ ((visibility ("hidden"))) = 1;
-EOF
-                  ac_cv_visibility_hidden=no
-                  if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
-                    if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
-                      ac_cv_visibility_hidden=yes
-                    fi
-                  fi
-                  rm -f conftest.[cs]
-                 ])
-  if test "$ac_cv_visibility_hidden" = "yes"; then
-    AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
-
-    AC_CACHE_CHECK(for visibility(default) attribute,
-                   ac_cv_visibility_default,
-                   [cat > conftest.c <<EOF
-                    int foo __attribute__ ((visibility ("default"))) = 1;
-EOF
-                    ac_cv_visibility_default=no
-                    if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
-                      if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
-                        ac_cv_visibility_default=yes
-                      fi
-                    fi
-                    rm -f conftest.[cs]
-                   ])
-    if test "$ac_cv_visibility_default" = "yes"; then
-      AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
-
-      AC_CACHE_CHECK(for visibility pragma support,
-                     ac_cv_visibility_pragma,
-                     [cat > conftest.c <<EOF
-#pragma GCC visibility push(hidden)
-                      int foo_hidden = 1;
-#pragma GCC visibility push(default)
-                      int foo_default = 1;
-EOF
-                      ac_cv_visibility_pragma=no
-                      if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
-                        if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
-                          if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
-                            ac_cv_visibility_pragma=yes
-                          fi
-                        fi
-                      fi
-                      rm -f conftest.[cs]
-                    ])
-      if test "$ac_cv_visibility_pragma" = "yes"; then
-        AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
-                       ac_cv_have_visibility_class_bug,
-                       [cat > conftest.c <<EOF
-#pragma GCC visibility push(hidden)
-struct __attribute__ ((visibility ("default"))) TestStruct {
-  static void Init();
-};
-__attribute__ ((visibility ("default"))) void TestFunc() {
-  TestStruct::Init();
-}
-EOF
-                       ac_cv_have_visibility_class_bug=no
-                       if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
-                         ac_cv_have_visibility_class_bug=yes
-                       else
-                         if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
-                           ac_cv_have_visibility_class_bug=yes
-                         fi
-                       fi
-                       rm -rf conftest.{c,S}
-                       ])
-
-        AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
-                       ac_cv_have_visibility_builtin_bug,
-                       [cat > conftest.c <<EOF
-#pragma GCC visibility push(hidden)
-#pragma GCC visibility push(default)
-#include <string.h>
-#pragma GCC visibility pop
-
-__attribute__ ((visibility ("default"))) void Func() {
-  char c[[100]];
-  memset(c, 0, sizeof(c));
-}
-EOF
-                       ac_cv_have_visibility_builtin_bug=no
-                       if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
-                         ac_cv_have_visibility_builtin_bug=yes
-                       else
-                         if test `grep -c "@PLT" conftest.S` = 0; then
-                           ac_cv_visibility_builtin_bug=yes
-                         fi
-                       fi
-                       rm -f conftest.{c,S}
-                       ])
-        if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
-                "$ac_cv_have_visibility_class_bug" = "no"; then
-          VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
-          WRAP_SYSTEM_INCLUDES=1
-          STL_FLAGS='-I$(DIST)/stl_wrappers'
-          WRAP_STL_INCLUDES=1
-        else
-          VISIBILITY_FLAGS='-fvisibility=hidden'
-        fi # have visibility pragma bug
-      fi   # have visibility pragma
-    fi     # have visibility(default) attribute
-  fi       # have visibility(hidden) attribute
+  AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
+  AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
+  VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
+  WRAP_SYSTEM_INCLUDES=1
+  STL_FLAGS='-I$(DIST)/stl_wrappers'
+  WRAP_STL_INCLUDES=1
 fi         # GNU_CC
 
 # visibility hidden flag for Sun Studio on Solaris
@@ -3711,6 +3614,14 @@ if test -n "$YASM"; then
   _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
 fi
 
+if test -n "${LIBXUL_SDK_DIR}"; then
+    AC_MSG_WARN([pkgsrc: LIBXUL_SDK_DIR is set; assuming we want nss and nspr from xulrunner.])
+    NSPR_CFLAGS="-I${prefix}/include/xulrunner/unstable `pkg-config --cflags nspr`"
+    NSPR_LIBS="`pkg-config --libs nspr`"
+    NSS_CFLAGS="`pkg-config --cflags nss`"
+    NSS_LIBS="`pkg-config --libs nss`"
+fi
+
 if test -z "$SKIP_LIBRARY_CHECKS"; then
 dnl system JPEG support
 dnl ========================================================
@@ -3738,11 +3649,7 @@ if test "$MOZ_NATIVE_JPEG" = 1; then
                      #include <jpeglib.h> ],
                    [ #if JPEG_LIB_VERSION < $MOZJPEG
                      #error "Insufficient JPEG library version ($MOZJPEG required)."
-                     #endif
-                     #ifndef JCS_EXTENSIONS
-                     #error "libjpeg-turbo JCS_EXTENSIONS required"
-                     #endif
-                     ],
+                     #endif ],
                    MOZ_NATIVE_JPEG=1,
                    AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
 fi
@@ -3940,6 +3847,22 @@ fi
 AC_SUBST(MOZ_NATIVE_ICU)
 
 dnl ========================================================
+dnl system icu support
+dnl ========================================================
+MOZ_NATIVE_ICU=
+MOZ_ARG_WITH_BOOL(system-icu,
+[  --with-system-icu
+                          Use system icu (located with pkgconfig)],
+    MOZ_NATIVE_ICU=1)
+
+if test -n "$MOZ_NATIVE_ICU"; then
+    PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
+    MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
+fi
+
+AC_SUBST(MOZ_NATIVE_ICU)
+
+dnl ========================================================
 dnl Java SDK support
 dnl ========================================================
 
@@ -3974,6 +3897,7 @@ MOZ_SAMPLE_TYPE_FLOAT32=
 MOZ_SAMPLE_TYPE_S16=
 MOZ_OPUS=1
 MOZ_WEBM=1
+MOZ_GSTREAMER=
 MOZ_DIRECTSHOW=
 MOZ_WMF=
 MOZ_FMP4=
@@ -5135,6 +5059,9 @@ if test -n "$MOZ_WEBRTC"; then
     MOZ_VPX=1
     MOZ_VPX_ERROR_CONCEALMENT=1
 
+    dnl with libv4l2 we can support more cameras
+    PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2)
+
 dnl enable once Signaling lands
     MOZ_WEBRTC_SIGNALING=1
     AC_DEFINE(MOZ_WEBRTC_SIGNALING)
@@ -5157,15 +5084,18 @@ AC_SUBST(MOZ_SRTP)
 
 dnl Use integers over floats for audio on B2G and Android, because audio
 dnl backends for those platforms don't support floats.
-if test "$OS_TARGET" = "Android"; then
+case "$OS_TARGET" in
+Android)
     MOZ_SAMPLE_TYPE_S16=1
     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
-else
+    ;;
+*)
     MOZ_SAMPLE_TYPE_FLOAT32=1
     AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
     AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
-fi
+    ;;
+esac
 
 dnl ========================================================
 dnl = Disable Speech API code
@@ -5229,6 +5159,57 @@ if test -n "$MOZ_OGG"; then
 fi
 
 dnl ========================================================
+dnl Check for libogg
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-ogg,
+[  --with-system-ogg       Use system libogg (located with pkgconfig)],
+MOZ_NATIVE_OGG=1,
+MOZ_NATIVE_OGG=)
+
+if test -n "$MOZ_NATIVE_OGG"; then
+    PKG_CHECK_MODULES(MOZ_OGG, ogg >= 1.2.1)
+fi
+
+AC_SUBST(MOZ_NATIVE_OGG)
+AC_SUBST(MOZ_OGG_CFLAGS)
+AC_SUBST(MOZ_OGG_LIBS)
+
+dnl ========================================================
+dnl Check for libvorbis
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-vorbis,
+[  --with-system-vorbis    Use system libvorbis (located with pkgconfig)],
+MOZ_NATIVE_VORBIS=1,
+MOZ_NATIVE_VORBIS=)
+
+if test -n "$MOZ_NATIVE_VORBIS"; then
+    PKG_CHECK_MODULES(MOZ_VORBIS, vorbis vorbisenc >= 1.3.4)
+fi
+
+AC_SUBST(MOZ_NATIVE_VORBIS)
+AC_SUBST(MOZ_VORBIS_CFLAGS)
+AC_SUBST(MOZ_VORBIS_LIBS)
+
+dnl ========================================================
+dnl Check for integer-only libvorbis aka tremor
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-tremor,
+[  --with-system-tremor    Use system libtremor (located with pkgconfig)],
+MOZ_NATIVE_TREMOR=1,
+MOZ_NATIVE_TREMOR=)
+
+if test -n "$MOZ_NATIVE_TREMOR"; then
+    PKG_CHECK_MODULES(MOZ_TREMOR, vorbisidec >= 1.2.1)
+fi
+
+AC_SUBST(MOZ_NATIVE_TREMOR)
+AC_SUBST(MOZ_TREMOR_CFLAGS)
+AC_SUBST(MOZ_TREMOR_LIBS)
+
+dnl ========================================================
 dnl = Disable Opus audio codec support
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(opus,
@@ -5237,6 +5218,76 @@ MOZ_ARG_DISABLE_BOOL(opus,
     MOZ_OPUS=1)
 
 dnl ========================================================
+dnl Check for libopus
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-opus,
+[  --with-system-opus      Use system libopus (located with pkgconfig)],
+MOZ_NATIVE_OPUS=1,
+MOZ_NATIVE_OPUS=)
+
+if test -n "$MOZ_NATIVE_OPUS"; then
+    PKG_CHECK_MODULES(MOZ_OPUS, opus >= 1.1)
+else
+    MOZ_OPUS_CFLAGS='-I$(topsrcdir)/media/libopus/include'
+fi
+
+AC_SUBST(MOZ_NATIVE_OPUS)
+AC_SUBST(MOZ_OPUS_CFLAGS)
+AC_SUBST(MOZ_OPUS_LIBS)
+
+dnl ========================================================
+dnl Check for libtheora
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-theora,
+[  --with-system-theora    Use system libtheora (located with pkgconfig)],
+MOZ_NATIVE_THEORA=1,
+MOZ_NATIVE_THEORA=)
+
+if test -n "$MOZ_NATIVE_THEORA"; then
+    PKG_CHECK_MODULES(MOZ_THEORA, theora >= 1.2)
+fi
+
+AC_SUBST(MOZ_NATIVE_THEORA)
+AC_SUBST(MOZ_THEORA_CFLAGS)
+AC_SUBST(MOZ_THEORA_LIBS)
+
+dnl ========================================================
+dnl Check for libspeex resampler
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-speex,
+[  --with-system-speex     Use system libspeex (located with pkgconfig)],
+MOZ_NATIVE_SPEEX=1,
+MOZ_NATIVE_SPEEX=)
+
+if test -n "$MOZ_NATIVE_SPEEX"; then
+    PKG_CHECK_MODULES(MOZ_SPEEX, speexdsp >= 1.2)
+fi
+
+AC_SUBST(MOZ_NATIVE_SPEEX)
+AC_SUBST(MOZ_SPEEX_CFLAGS)
+AC_SUBST(MOZ_SPEEX_LIBS)
+
+dnl ========================================================
+dnl Check for libsoundtouch
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-soundtouch,
+[  --with-system-soundtouch Use system libsoundtouch (located with pkgconfig)],
+MOZ_NATIVE_SOUNDTOUCH=1,
+MOZ_NATIVE_SOUNDTOUCH=)
+
+if test -n "$MOZ_NATIVE_SOUNDTOUCH"; then
+    PKG_CHECK_MODULES(MOZ_SOUNDTOUCH, soundtouch >= 1.7.0)
+fi
+
+AC_SUBST(MOZ_NATIVE_SOUNDTOUCH)
+AC_SUBST(MOZ_SOUNDTOUCH_CFLAGS)
+AC_SUBST(MOZ_SOUNDTOUCH_LIBS)
+
+dnl ========================================================
 dnl = Disable VP8 decoder support
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(webm,
@@ -5615,44 +5666,61 @@ WINNT|Darwin|Android)
     ;;
 *)
     MOZ_GSTREAMER=1
+    GST_API_VERSION=0.10
     ;;
 esac
 
-MOZ_ARG_ENABLE_BOOL(gstreamer,
-[  --enable-gstreamer           Enable GStreamer support],
-MOZ_GSTREAMER=1,
-MOZ_GSTREAMER=)
-
-if test "$MOZ_GSTREAMER"; then
-    # API version, eg 0.10, 1.0 etc
+MOZ_ARG_ENABLE_STRING(gstreamer,
+[  --enable-gstreamer[=0.10]           Enable GStreamer support],
+[ MOZ_GSTREAMER=1
+  # API version, eg 0.10, 1.0 etc
+  if test -z "$enableval" -o "$enableval" = "yes"; then
     GST_API_VERSION=0.10
+  elif test "$enableval" = "no"; then
+    MOZ_GSTREAMER=
+  else
+    GST_API_VERSION=$enableval
+  fi],
+)
+
+if test -n "$MOZ_GSTREAMER"; then
     # core/base release number
-    GST_VERSION=0.10.25
+    if test "$GST_API_VERSION" = "1.0"; then
+      GST_VERSION=1.0
+    else
+      GST_VERSION=0.10.25
+    fi
+
     PKG_CHECK_MODULES(GSTREAMER,
                       gstreamer-$GST_API_VERSION >= $GST_VERSION
                       gstreamer-app-$GST_API_VERSION
-                      gstreamer-plugins-base-$GST_API_VERSION, ,
-                      AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer]))
-    if test -n "$GSTREAMER_LIBS"; then
-       _SAVE_LDFLAGS=$LDFLAGS
-       LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
-       AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
-       if test -n "$_HAVE_LIBGSTVIDEO" ; then
-          GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
-       else
-          AC_MSG_ERROR([gstreamer-plugins-base found, but no libgstvideo. Something has gone terribly wrong. Try reinstalling gstreamer-plugins-base; failing that, disable the gstreamer backend with --disable-gstreamer.])
-       fi
-       LDFLAGS=$_SAVE_LDFLAGS
+                      gstreamer-plugins-base-$GST_API_VERSION,
+                      [_HAVE_GSTREAMER=1],
+                      [_HAVE_GSTREAMER=])
+    if test -z "$_HAVE_GSTREAMER"; then
+        AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer])
+    fi
+
+    _SAVE_LDFLAGS=$LDFLAGS
+    LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
+    AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
+    if test -n "$_HAVE_LIBGSTVIDEO" ; then
+        GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
     else
-       AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer])
+        AC_MSG_ERROR([gstreamer-plugins-base found, but no libgstvideo. Something has gone terribly wrong. Try reinstalling gstreamer-plugins-base; failing that, disable the gstreamer backend with --disable-gstreamer.])
     fi
+    LDFLAGS=$_SAVE_LDFLAGS
+
+    AC_SUBST(GSTREAMER_CFLAGS)
+    AC_SUBST(GSTREAMER_LIBS)
 fi
-AC_SUBST(GSTREAMER_CFLAGS)
-AC_SUBST(GSTREAMER_LIBS)
+
 AC_SUBST(MOZ_GSTREAMER)
+AC_SUBST(GST_API_VERSION)
 
 if test -n "$MOZ_GSTREAMER"; then
-   AC_DEFINE(MOZ_GSTREAMER)
+     AC_DEFINE(MOZ_GSTREAMER)
+     AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
 fi
 
 
@@ -5866,7 +5934,9 @@ MOZ_ARG_DISABLE_BOOL(gamepad,
 if test "$MOZ_GAMEPAD"; then
     case "$OS_TARGET" in
     Darwin)
-        MOZ_GAMEPAD_BACKEND=cocoa
+        if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
+            MOZ_GAMEPAD_BACKEND=cocoa
+        fi
         ;;
     WINNT)
         if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
@@ -7939,6 +8009,52 @@ if test "$USE_FC_FREETYPE"; then
 fi
 
 dnl ========================================================
+dnl Check for harfbuzz
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-harfbuzz,
+[  --with-system-harfbuzz  Use system harfbuzz (located with pkgconfig)],
+MOZ_NATIVE_HARFBUZZ=1,
+MOZ_NATIVE_HARFBUZZ=)
+
+if test -n "$MOZ_NATIVE_HARFBUZZ"; then
+    PKG_CHECK_MODULES(MOZ_HARFBUZZ, harfbuzz >= 0.9.25)
+fi
+
+AC_SUBST(MOZ_NATIVE_HARFBUZZ)
+AC_SUBST(MOZ_HARFBUZZ_CFLAGS)
+AC_SUBST(MOZ_HARFBUZZ_LIBS)
+
+dnl ========================================================
+dnl Check for graphite2
+dnl ========================================================
+MOZ_ARG_WITH_BOOL(system-graphite2,
+[  --with-system-graphite2 Use system graphite2 (located with pkgconfig)],
+MOZ_NATIVE_GRAPHITE2=1,
+MOZ_NATIVE_GRAPHITE2=)
+
+if test -n "$MOZ_NATIVE_GRAPHITE2"; then
+    PKG_CHECK_MODULES(MOZ_GRAPHITE2, graphite2)
+
+    dnl graphite2.pc has bogus version, check manually
+    AC_TRY_COMPILE([ #include <graphite2/Font.h>
+                     #define GR2_VERSION_REQUIRE(major,minor,bugfix)  \
+                             ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
+                               * 100 + GR2_VERSION_BUGFIX >= \
+                               (major) * 10000 + (minor) * 100 + (bugfix) )
+                   ], [
+                     #if !GR2_VERSION_REQUIRE(1,2,4)
+                     #error "Insufficient graphite2 version."
+                     #endif
+                   ], [],
+                   [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
+fi
+
+AC_SUBST(MOZ_NATIVE_GRAPHITE2)
+AC_SUBST(MOZ_GRAPHITE2_CFLAGS)
+AC_SUBST(MOZ_GRAPHITE2_LIBS)
+
+dnl ========================================================
 dnl Check for pixman and cairo
 dnl ========================================================
 
@@ -8189,7 +8305,7 @@ case "$OS_TARGET" in
       NECKO_WIFI=1
     fi
     ;;
-  Darwin|SunOS|WINNT)
+  Darwin|FreeBSD|SunOS|WINNT)
     NECKO_WIFI=1
     ;;
   Linux)
@@ -8736,6 +8852,20 @@ AC_SUBST(MOZ_ENABLE_SZIP)
 AC_SUBST(MOZ_SZIP_FLAGS)
 
 if test -n "$COMPILE_ENVIRONMENT"; then
+AC_MSG_CHECKING([for posix_fadvise])
+AC_TRY_LINK([#define _XOPEN_SOURCE 600
+  #include <fcntl.h>],
+                 [posix_fadvise(0, 0, 0, 0);],
+                 [ac_cv___posix_fadvise=true],
+                 [ac_cv___posix_fadvise=false])
+
+if test "$ac_cv___posix_fadvise" = true ; then
+  AC_DEFINE(HAVE_POSIX_FADVISE)
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+
 AC_MSG_CHECKING([for posix_fallocate])
 AC_TRY_LINK([#define _XOPEN_SOURCE 600
   #include <fcntl.h>],