Source code

Revision control

Other Tools

1
dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2
dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3
dnl This Source Code Form is subject to the terms of the Mozilla Public
4
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7
dnl Process this file with autoconf to produce a configure script.
8
dnl ========================================================
9
AC_PREREQ(2.13)
10
AC_INIT(config/config.mk)
11
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
12
AC_CANONICAL_SYSTEM
13
14
dnl ========================================================
15
dnl =
16
dnl = Don't change the following lines. Doing so breaks:
17
dnl =
18
dnl = CFLAGS="-foo" ./configure
19
dnl =
20
dnl ========================================================
21
CFLAGS="${CFLAGS=}"
22
CPPFLAGS="${CPPFLAGS=}"
23
CXXFLAGS="${CXXFLAGS=}"
24
LDFLAGS="${LDFLAGS=}"
25
HOST_CFLAGS="${HOST_CFLAGS=}"
26
HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
27
HOST_LDFLAGS="${HOST_LDFLAGS=}"
28
29
dnl ========================================================
30
dnl = Preserve certain environment flags passed to configure
31
dnl = We want sub projects to receive the same flags
32
dnl = untainted by this configure script
33
dnl ========================================================
34
_SUBDIR_CC="$CC"
35
_SUBDIR_CXX="$CXX"
36
_SUBDIR_CFLAGS="$CFLAGS"
37
_SUBDIR_CPPFLAGS="$CPPFLAGS"
38
_SUBDIR_CXXFLAGS="$CXXFLAGS"
39
_SUBDIR_LDFLAGS="$LDFLAGS"
40
_SUBDIR_HOST_CC="$HOST_CC"
41
_SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
42
_SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
43
_SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
44
_SUBDIR_CONFIG_ARGS="$ac_configure_args"
45
46
dnl Set the version number of the libs included with mozilla
47
dnl ========================================================
48
MOZPNG=10635
49
NSPR_VERSION=4
50
NSPR_MINVER=4.25
51
NSS_VERSION=3
52
53
dnl Set the minimum version of toolkit libs used by mozilla
54
dnl ========================================================
55
GLIB_VERSION=2.22
56
# 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
57
# The macro won't be used when compiling with earlier versions anyway.
58
GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
59
CAIRO_VERSION=1.10
60
GTK2_VERSION=2.18.0
61
GTK3_VERSION=3.4.0
62
GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
63
W32API_VERSION=3.14
64
DBUS_VERSION=0.60
65
66
dnl Set various checks
67
dnl ========================================================
68
MISSING_X=
69
70
dnl Initialize the Pthread test variables early so they can be
71
dnl overridden by each platform.
72
dnl ========================================================
73
MOZ_USE_PTHREADS=
74
_PTHREAD_LDFLAGS=""
75
76
LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
77
78
if test "$COMPILE_ENVIRONMENT"; then
79
MOZ_ANDROID_NDK
80
fi # COMPILE_ENVIRONMENT
81
82
case "$target" in
83
*-android*|*-linuxandroid*)
84
;;
85
*-linux*)
86
AC_PATH_PROG(OBJCOPY,objcopy)
87
;;
88
esac
89
90
case "$target" in
91
*-apple-darwin*)
92
MOZ_IOS_SDK
93
;;
94
esac
95
96
AC_SUBST(ANDROID_PACKAGE_NAME)
97
AC_SUBST(OBJCOPY)
98
99
dnl ========================================================
100
dnl Checks for compilers.
101
dnl ========================================================
102
103
if test "$COMPILE_ENVIRONMENT"; then
104
105
if test "$target" != "$host"; then
106
MOZ_CROSS_COMPILER
107
else
108
AC_PROG_CC
109
case "$target" in
110
*-mingw*)
111
# Work around the conftest.exe access problem on Windows
112
sleep 2
113
esac
114
AC_PROG_CXX
115
AC_PROG_RANLIB
116
MOZ_PATH_PROGS(AS, $AS as, $CC)
117
AC_CHECK_PROGS(STRIP, strip, :)
118
AC_CHECK_PROGS(OTOOL, otool, :)
119
fi
120
121
if test -n "$MOZ_WINCONSOLE"; then
122
AC_DEFINE(MOZ_WINCONSOLE)
123
fi
124
125
MOZ_TOOL_VARIABLES
126
127
dnl ========================================================
128
dnl Special win32 checks
129
dnl ========================================================
130
131
WINVER=601
132
133
case "$target" in
134
*-mingw*)
135
if test "$GCC" != "yes"; then
136
# Check to see if we are really running in a msvc environemnt
137
_WIN32_MSVC=1
138
139
# Make sure compilers are valid
140
CXXFLAGS="$CXXFLAGS -TP"
141
AC_LANG_SAVE
142
AC_LANG_C
143
AC_TRY_COMPILE([#include <stdio.h>],
144
[ printf("Hello World\n"); ],,
145
AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
146
147
AC_LANG_CPLUSPLUS
148
AC_TRY_COMPILE([#include <new.h>],
149
[ unsigned *test = new unsigned(42); ],,
150
AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
151
AC_LANG_RESTORE
152
153
changequote(,)
154
_MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
155
changequote([,])
156
157
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
158
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
159
AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
160
161
_CC_SUITE=14
162
MSVC_C_RUNTIME_DLL=vcruntime140.dll
163
MSVC_CXX_RUNTIME_DLL=msvcp140.dll
164
165
# -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
166
CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
167
168
if test -n "$WIN_UCRT_REDIST_DIR"; then
169
if test ! -d "$WIN_UCRT_REDIST_DIR"; then
170
AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
171
fi
172
WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
173
fi
174
175
AC_SUBST(MSVC_C_RUNTIME_DLL)
176
AC_SUBST(MSVC_CXX_RUNTIME_DLL)
177
178
AC_DEFINE(HAVE_SEH_EXCEPTIONS)
179
180
if test -n "$WIN32_REDIST_DIR"; then
181
if test ! -d "$WIN32_REDIST_DIR"; then
182
AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
183
fi
184
WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
185
fi
186
187
# Check linker version, except in lld builds
188
case "$LINKER" in
189
*lld*)
190
;;
191
*)
192
_LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
193
_LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
194
if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
195
AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
196
fi
197
;;
198
esac
199
200
INCREMENTAL_LINKER=1
201
202
unset _MSVC_VER_FILTER
203
204
WRAP_STL_INCLUDES=1
205
STL_FLAGS="-I${DIST}/stl_wrappers"
206
else
207
# Check w32api version
208
_W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
209
_W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
210
AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
211
AC_TRY_COMPILE([#include <w32api.h>],
212
#if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
213
(__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
214
__W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
215
#error "test failed."
216
#endif
217
, [ res=yes ], [ res=no ])
218
AC_MSG_RESULT([$res])
219
if test "$res" != "yes"; then
220
AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
221
fi
222
# strsafe.h on mingw uses macros for function deprecation that pollutes namespace
223
# causing problems with local implementations with the same name.
224
AC_DEFINE(STRSAFE_NO_DEPRECATE)
225
fi # !GNU_CC
226
227
CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
228
CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
229
230
AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
231
AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
232
# Require OS features provided by IE 8.0 (Win7)
233
AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
234
235
;;
236
esac
237
238
if test -n "$_WIN32_MSVC"; then
239
SKIP_PATH_CHECKS=1
240
SKIP_COMPILER_CHECKS=1
241
SKIP_LIBRARY_CHECKS=1
242
243
# Since we're skipping compiler and library checks, hard-code
244
# some facts here.
245
AC_DEFINE(HAVE_IO_H)
246
AC_DEFINE(HAVE_ISATTY)
247
fi
248
249
fi # COMPILE_ENVIRONMENT
250
251
AC_SUBST(GNU_CC)
252
AC_SUBST(GNU_CXX)
253
254
AC_SUBST_LIST(STL_FLAGS)
255
AC_SUBST(WRAP_STL_INCLUDES)
256
257
dnl ========================================================
258
dnl Checks for programs.
259
dnl ========================================================
260
if test "$COMPILE_ENVIRONMENT"; then
261
262
AC_PATH_XTRA
263
264
XCFLAGS="$X_CFLAGS"
265
266
fi # COMPILE_ENVIRONMENT
267
268
dnl ========================================================
269
dnl set the defaults first
270
dnl ========================================================
271
MOZ_USER_DIR=".mozilla"
272
273
MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
274
275
MOZ_FS_LAYOUT=unix
276
277
dnl Configure platform-specific CPU architecture compiler options.
278
dnl ==============================================================
279
if test "$COMPILE_ENVIRONMENT"; then
280
MOZ_ARCH_OPTS
281
fi # COMPILE_ENVIRONMENT
282
283
dnl ========================================================
284
dnl Android libstdc++
285
dnl ========================================================
286
287
MOZ_ANDROID_CPU_ARCH
288
if test "$COMPILE_ENVIRONMENT"; then
289
MOZ_ANDROID_STLPORT
290
fi # COMPILE_ENVIRONMENT
291
292
dnl ========================================================
293
dnl Suppress Clang Argument Warnings
294
dnl ========================================================
295
WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
296
if test -n "${CLANG_CC}${CLANG_CL}"; then
297
WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
298
CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
299
fi
300
if test -n "${CLANG_CXX}${CLANG_CL}"; then
301
_WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
302
fi
303
304
if test -n "$COMPILE_ENVIRONMENT"; then
305
MOZ_CONFIG_SANITIZE
306
fi
307
308
dnl ========================================================
309
dnl GNU specific defaults
310
dnl ========================================================
311
if test "$GNU_CC"; then
312
MMX_FLAGS="-mmmx"
313
SSE_FLAGS="-msse"
314
SSE2_FLAGS="-msse2"
315
SSSE3_FLAGS="-mssse3"
316
CFLAGS="$CFLAGS -fno-strict-aliasing"
317
DSO_CFLAGS=''
318
319
if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
320
DSO_PIC_CFLAGS='-fPIC'
321
ASFLAGS="$ASFLAGS -fPIC"
322
fi
323
324
AC_MSG_CHECKING([for --noexecstack option to as])
325
_SAVE_CFLAGS=$CFLAGS
326
CFLAGS="$CFLAGS -Wa,--noexecstack"
327
AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
328
[ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
329
AC_MSG_RESULT([no]))
330
CFLAGS=$_SAVE_CFLAGS
331
AC_MSG_CHECKING([for -z noexecstack option to ld])
332
_SAVE_LDFLAGS=$LDFLAGS
333
LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
334
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
335
AC_MSG_RESULT([no])
336
LDFLAGS=$_SAVE_LDFLAGS)
337
338
AC_MSG_CHECKING([for -z text option to ld])
339
_SAVE_LDFLAGS=$LDFLAGS
340
LDFLAGS="$LDFLAGS -Wl,-z,text"
341
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
342
AC_MSG_RESULT([no])
343
LDFLAGS=$_SAVE_LDFLAGS)
344
345
AC_MSG_CHECKING([for -z relro option to ld])
346
_SAVE_LDFLAGS=$LDFLAGS
347
LDFLAGS="$LDFLAGS -Wl,-z,relro"
348
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
349
AC_MSG_RESULT([no])
350
LDFLAGS=$_SAVE_LDFLAGS)
351
352
AC_MSG_CHECKING([for -z nocopyreloc option to ld])
353
_SAVE_LDFLAGS=$LDFLAGS
354
LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
355
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
356
AC_MSG_RESULT([no])
357
LDFLAGS=$_SAVE_LDFLAGS)
358
359
AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
360
_SAVE_LDFLAGS=$LDFLAGS
361
LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
362
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
363
AC_MSG_RESULT([no])
364
LDFLAGS=$_SAVE_LDFLAGS)
365
366
AC_MSG_CHECKING([for --build-id=sha1 option to ld])
367
_SAVE_LDFLAGS=$LDFLAGS
368
LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
369
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
370
AC_MSG_RESULT([no])
371
LDFLAGS=$_SAVE_LDFLAGS)
372
373
AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
374
HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
375
_SAVE_LDFLAGS=$LDFLAGS
376
LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
377
AC_TRY_LINK(,,AC_MSG_RESULT([yes])
378
[HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
379
AC_MSG_RESULT([no]))
380
LDFLAGS=$_SAVE_LDFLAGS
381
382
# Check for -mssse3 on $CC
383
AC_MSG_CHECKING([if toolchain supports -mssse3 option])
384
HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
385
_SAVE_CFLAGS=$CFLAGS
386
CFLAGS="$CFLAGS -mssse3"
387
AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
388
[HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
389
AC_MSG_RESULT([no]))
390
CFLAGS=$_SAVE_CFLAGS
391
392
# Check for -msse4.1 on $CC
393
AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
394
HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
395
_SAVE_CFLAGS=$CFLAGS
396
CFLAGS="$CFLAGS -msse4.1"
397
AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
398
[HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
399
AC_MSG_RESULT([no]))
400
CFLAGS=$_SAVE_CFLAGS
401
402
case "${CPU_ARCH}" in
403
x86 | x86_64)
404
AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
405
AC_TRY_COMPILE([],
406
[asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
407
result="yes", result="no")
408
AC_MSG_RESULT("$result")
409
if test "$result" = "yes"; then
410
HAVE_X86_AVX2=1
411
fi
412
;;
413
414
ppc*)
415
AC_MSG_CHECKING([whether we can enable AltiVec support])
416
HAVE_ALTIVEC=
417
_SAVE_CFLAGS=$CFLAGS
418
CFLAGS="$CFLAGS -maltivec"
419
AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
420
[HAVE_ALTIVEC=1],
421
AC_MSG_RESULT([no]))
422
CFLAGS=$_SAVE_CFLAGS
423
;;
424
esac
425
426
DSO_LDOPTS='-shared'
427
if test "$GCC_USE_GNU_LD"; then
428
# Some tools like ASan use a runtime library that is only
429
# linked against executables, so we must allow undefined
430
# symbols for shared objects in some cases.
431
if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
432
# Don't allow undefined symbols in libraries
433
DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
434
435
# BSDs need `environ' exposed for posix_spawn (bug 753046)
436
case "$OS_TARGET" in
437
DragonFly|FreeBSD|NetBSD|OpenBSD)
438
if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
439
DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
440
else
441
DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
442
fi
443
;;
444
esac
445
fi
446
fi
447
448
_DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
449
_USE_CPP_INCLUDE_FLAG=1
450
451
ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
452
fi
453
454
if test "$GNU_CXX"; then
455
CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
456
457
_DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
458
_USE_CPP_INCLUDE_FLAG=1
459
fi
460
461
# For profiling builds keep the symbol information
462
if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
463
case "$OS_TARGET" in
464
Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
465
STRIP_FLAGS="--strip-debug"
466
;;
467
esac
468
fi
469
470
dnl ========================================================
471
dnl = Enable DMD
472
dnl ========================================================
473
474
if test "$MOZ_DMD"; then
475
if test "${CPU_ARCH}" = "arm"; then
476
CFLAGS="$CFLAGS -funwind-tables"
477
CXXFLAGS="$CXXFLAGS -funwind-tables"
478
fi
479
fi
480
481
dnl ========================================================
482
dnl System overrides of the defaults for host
483
dnl ========================================================
484
case "$host" in
485
*mingw*)
486
if test -n "$_WIN32_MSVC"; then
487
HOST_CFLAGS="$HOST_CFLAGS"
488
else
489
HOST_CFLAGS="$HOST_CFLAGS -mwindows"
490
fi
491
HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
492
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
493
HOST_BIN_SUFFIX=.exe
494
495
case "${host_cpu}" in
496
i*86)
497
if test -n "$_WIN32_MSVC"; then
498
HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
499
fi
500
;;
501
x86_64)
502
if test -n "$_WIN32_MSVC"; then
503
HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
504
fi
505
HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
506
;;
507
esac
508
;;
509
510
*-darwin*)
511
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
512
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
513
;;
514
515
*-linux*|*-kfreebsd*-gnu|*-gnu*)
516
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
517
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
518
;;
519
520
*)
521
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
522
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
523
;;
524
esac
525
526
dnl ========================================================
527
dnl System overrides of the defaults for target
528
dnl ========================================================
529
530
case "$target" in
531
*-darwin*)
532
MOZ_OPTIMIZE_FLAGS="-O3"
533
CXXFLAGS="$CXXFLAGS -stdlib=libc++"
534
DSO_LDOPTS=''
535
STRIP_FLAGS="$STRIP_FLAGS -x -S"
536
# Ensure that if we're targeting iOS an SDK was provided.
537
AC_CACHE_CHECK(for iOS target,
538
ac_cv_ios_target,
539
[AC_TRY_COMPILE([#include <TargetConditionals.h>
540
#if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
541
#error not iOS
542
#endif],
543
[],
544
ac_cv_ios_target="yes",
545
ac_cv_ios_target="no")])
546
if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
547
AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
548
fi
549
if test -z "$MOZ_IOS"; then
550
# The ExceptionHandling framework is needed for Objective-C exception
551
# logging code in nsObjCExceptions.h. Currently we only use that in debug
552
# builds.
553
MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
554
fi
555
556
dnl DTrace and -dead_strip don't interact well. See bug 403132.
557
dnl ===================================================================
558
if test "x$enable_dtrace" = "xyes"; then
559
echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
560
else
561
dnl check for the presence of the -dead_strip linker flag
562
AC_MSG_CHECKING([for -dead_strip option to ld])
563
_SAVE_LDFLAGS=$LDFLAGS
564
LDFLAGS="$LDFLAGS -Wl,-dead_strip"
565
AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
566
if test -n "$_HAVE_DEAD_STRIP" ; then
567
AC_MSG_RESULT([yes])
568
MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
569
else
570
AC_MSG_RESULT([no])
571
fi
572
573
LDFLAGS=$_SAVE_LDFLAGS
574
fi
575
576
MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
577
;;
578
579
*-android*|*-linuxandroid*)
580
if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
581
MOZ_LINKER=1
582
fi
583
584
MOZ_GFX_OPTIMIZE_MOBILE=1
585
if test -z "$CLANG_CC"; then
586
MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
587
elif test -n "$RELEASE_OR_BETA"; then
589
# -Oz is smaller than -Os on clang.
590
MOZ_OPTIMIZE_FLAGS="-Oz"
591
# Disable the outliner, which causes performance regressions, and is
592
# enabled on some platforms at -Oz.
593
if test -z "$MOZ_LTO"; then
594
DISABLE_OUTLINER="-mno-outline"
595
_SAVE_CFLAGS=$CFLAGS
596
CFLAGS="$CFLAGS $DISABLE_OUTLINER"
597
AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
598
CFLAGS="$_SAVE_CFLAGS"
599
else
600
DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
601
_SAVE_LDFLAGS=$LDFLAGS
602
LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
603
AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
604
LDFLAGS="$_SAVE_LDFLAGS"
605
fi
606
else
607
MOZ_OPTIMIZE_FLAGS="-O2"
608
fi
609
;;
610
611
*-*linux*)
612
if test "$GNU_CC" -o "$GNU_CXX"; then
613
MOZ_PGO_OPTIMIZE_FLAGS="-O3"
614
if test -n "$MOZ_DEBUG"; then
615
MOZ_OPTIMIZE_FLAGS="-Os"
616
else
617
MOZ_OPTIMIZE_FLAGS="-O2"
618
fi
619
if test -z "$CLANG_CC"; then
620
MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
621
fi
622
fi
623
624
case "${target_cpu}" in
625
alpha*)
626
CFLAGS="$CFLAGS -mieee"
627
CXXFLAGS="$CXXFLAGS -mieee"
628
;;
629
esac
630
;;
631
*-mingw*)
632
DSO_CFLAGS=
633
DSO_PIC_CFLAGS=
634
# certain versions of cygwin's makedepend barf on the
635
# #include <string> vs -I./dist/include/string issue so don't use it
636
if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
637
# $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
638
if test -z "$CLANG_CC"; then
639
AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
640
fi
641
642
DSO_LDOPTS='-shared'
643
# Use temp file for windres (bug 213281)
644
RCFLAGS='-O coff --use-temp-file'
645
# mingw doesn't require kernel32, user32, and advapi32 explicitly
646
LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
647
MOZ_FIX_LINK_PATHS=
648
649
MOZ_OPTIMIZE_FLAGS="-O2"
650
651
WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
652
WIN32_GUI_EXE_LDFLAGS=-mwindows
653
654
# Silence problematic clang warnings
655
CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
656
LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
657
else
658
TARGET_COMPILER_ABI=msvc
659
RANLIB='echo not_ranlib'
660
STRIP='echo not_strip'
661
PKG_SKIP_STRIP=1
662
# aarch64 doesn't support subsystems below 6.02
663
if test "$CPU_ARCH" = "aarch64"; then
664
WIN32_SUBSYSTEM_VERSION=6.02
665
else
666
WIN32_SUBSYSTEM_VERSION=6.01
667
fi
668
WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
669
WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
670
DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
671
_USE_CPP_INCLUDE_FLAG=1
672
_DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
673
_DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
674
CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
675
CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
676
if test -z "$CLANG_CL"; then
677
CPPFLAGS="$CPPFLAGS -utf-8"
678
fi
679
if test "$CPU_ARCH" = "x86"; then
680
dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
681
dnl more recent, so set that explicitly here unless another
682
dnl target arch has already been set.
683
changequote(,)
684
if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
685
CFLAGS="$CFLAGS -arch:SSE2"
686
fi
687
if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
688
CXXFLAGS="$CXXFLAGS -arch:SSE2"
689
fi
690
changequote([,])
691
SSE_FLAGS="-arch:SSE"
692
SSE2_FLAGS="-arch:SSE2"
693
dnl MSVC allows the use of intrinsics without any flags
694
dnl and doesn't have a separate arch for SSSE3
695
SSSE3_FLAGS="-arch:SSE2"
696
fi
697
dnl clang-cl requires appropriate flags to enable SSSE3 support
698
dnl on all architectures.
699
if test -n "$CLANG_CL"; then
700
SSSE3_FLAGS="-mssse3"
701
fi
702
dnl VS2013+ supports -Gw for better linker optimizations.
704
dnl Disabled on ASan because it causes false-positive ODR violations.
705
if test -z "$MOZ_ASAN"; then
706
CFLAGS="$CFLAGS -Gw"
707
CXXFLAGS="$CXXFLAGS -Gw"
708
else
709
# String tail merging doesn't play nice with ASan's ODR checker.
710
LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
711
fi
712
if test -n "$CLANG_CL"; then
713
# XXX We should combine some of these with our generic GCC-style
714
# warning checks.
715
#
716
# Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
717
CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
718
# We use offsetof on non-POD objects all the time.
719
# We also suppress this warning on other platforms.
720
CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
721
# This warns for reasonable things like:
722
# enum { X = 0xffffffffU };
723
# which is annoying for IDL headers.
724
CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
725
# This warns for cases that would be reached by the Microsoft
726
# #include rules, but also currently warns on cases that would
727
# *also* be reached by standard C++ include rules. That
728
# behavior doesn't seem useful, so we turn it off.
729
CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
730
# We normally error out on unknown pragmas, but since clang-cl
731
# claims to be MSVC, it would be difficult to add
732
# #if defined(_MSC_VER) && !defined(__clang__) everywhere we
733
# use such pragmas, so just ignore them.
734
CFLAGS="$CFLAGS -Wno-unknown-pragmas"
735
CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
736
# We get errors about various #pragma intrinsic directives from
737
# clang-cl, and we don't need to hear about those.
738
CFLAGS="$CFLAGS -Wno-ignored-pragmas"
739
CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
740
# clang-cl's Intrin.h marks things like _ReadWriteBarrier
741
# as __attribute((__deprecated__)). This is nice to know,
742
# but since we don't get the equivalent warning from MSVC,
743
# let's just ignore it.
744
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
745
CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
746
# We use a function like:
747
# __declspec(noreturn) __inline void f() {}
748
# which -Winvalid-noreturn complains about. Again, MSVC seems
749
# OK with it, so let's silence the warning.
750
CFLAGS="$CFLAGS -Wno-invalid-noreturn"
751
CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
752
# Missing |override| on virtual function declarations isn't
753
# something that MSVC currently warns about.
754
CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
755
# We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
756
# declaration on |operator delete(void*)|. However, clang-cl
757
# must internally declare |operator delete(void*)| differently,
758
# which causes this warning for virtually every file in the
759
# tree. clang-cl doesn't support -fno-exceptions or equivalent,
760
# so there doesn't seem to be any way to convince clang-cl to
761
# declare |delete| differently. Therefore, suppress this
762
# warning.
763
CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
764
# Macros like STDMETHOD() and IFACEMETHOD() can declare
765
# __attribute__((nothrow)) on their respective method declarations,
766
# while the definitions are left without the matching attribute.
767
CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
768
# At least one MSVC header and several headers in-tree have
769
# unused typedefs, so turn this on.
770
CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
771
# jemalloc uses __declspec(allocator) as a profiler hint,
772
# which clang-cl doesn't understand.
773
CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
774
# __attribute__((unused)) really means "might be unused" and
775
# we use it to avoid warnings about things that are unused
776
# in some compilation units, but used in many others. This
777
# warning insists on complaining about the latter case, which
778
# is annoying, and rather noisy.
779
CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
780
fi
781
# Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
782
CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
783
LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
784
MOZ_DEBUG_LDFLAGS='-DEBUG'
785
# Use a higher optimization level for clang-cl, so we can come closer
786
# to MSVC's performance numbers (see bug 1443590).
787
if test -n "$CLANG_CL"; then
788
MOZ_OPTIMIZE_FLAGS='-O2'
789
else
790
MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
791
fi
792
MOZ_FIX_LINK_PATHS=
793
LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
794
if test -z "$DEVELOPER_OPTIONS"; then
795
LDFLAGS="$LDFLAGS -RELEASE"
796
fi
797
RCFLAGS="-nologo"
798
dnl Minimum reqiurement of Gecko is VS2015 or later which supports
799
dnl both SSSE3 and SSE4.1.
800
HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
801
HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
802
dnl allow AVX2 code from VS2015
803
HAVE_X86_AVX2=1
804
fi
805
AC_DEFINE(WIN32_LEAN_AND_MEAN)
807
AC_DEFINE(NOMINMAX)
808
BIN_SUFFIX='.exe'
809
MOZ_USER_DIR="Mozilla"
810
811
case "$host_os" in
812
cygwin*|msvc*|mks*)
813
AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
814
;;
815
esac
816
817
case "$target" in
818
i*86-*)
819
if test -n "$GNU_CC"; then
820
CFLAGS="$CFLAGS -mstackrealign"
821
CXXFLAGS="$CXXFLAGS -mstackrealign"
822
LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
823
else
824
DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
825
LDFLAGS="$LDFLAGS -SAFESEH"
826
fi
827
828
AC_DEFINE(_X86_)
829
;;
830
x86_64-*)
831
if test -n "$_WIN32_MSVC"; then
832
DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
833
fi
834
AC_DEFINE(_AMD64_)
835
;;
836
aarch64-*)
837
if test -n "$_WIN32_MSVC"; then
838
DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
839
fi
840
AC_DEFINE(_ARM64_)
841
;;
842
*)
843
AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
844
;;
845
esac
846
;;
847
848
*-netbsd*)
849
DSO_CFLAGS=''
850
CFLAGS="$CFLAGS -Dunix"
851
CXXFLAGS="$CXXFLAGS -Dunix"
852
if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
853
DSO_PIC_CFLAGS='-fPIC -DPIC'
854
DSO_LDOPTS='-shared'
855
MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
856
else
857
DSO_PIC_CFLAGS='-fPIC -DPIC'
858
DSO_LDOPTS='-shared'
859
fi
860
# This will fail on a.out systems prior to 1.5.1_ALPHA.
861
if test "$LIBRUNPATH"; then
862
DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
863
fi
864
;;
865
866
*-openbsd*)
867
if test -z "$X11BASE"; then
868
X11BASE=/usr/X11R6
869
fi
870
MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
871
DSO_CFLAGS=''
872
DSO_PIC_CFLAGS='-fPIC'
873
DSO_LDOPTS='-shared -fPIC'
874
if test "$LIBRUNPATH"; then
875
DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
876
fi
877
;;
878
879
*-solaris*)
880
MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
881
;;
882
883
esac
884
885
if test -z "$MOZ_OPTIMIZE_FLAGS"; then
886
MOZ_OPTIMIZE_FLAGS="-O"
887
fi
888
889
AC_SUBST_LIST(MMX_FLAGS)
890
AC_SUBST_LIST(SSE_FLAGS)
891
AC_SUBST_LIST(SSE2_FLAGS)
892
AC_SUBST_LIST(SSSE3_FLAGS)
893
894
AC_SUBST(MOZ_LINKER)
895
if test -n "$MOZ_LINKER"; then
896
AC_DEFINE(MOZ_LINKER)
897
MOZ_LINKER_EXTRACT=1
898
AC_CHECK_PROGS(XZ, xz)
899
fi
900
901
if test -z "$COMPILE_ENVIRONMENT"; then
902
SKIP_COMPILER_CHECKS=1
903
SKIP_LIBRARY_CHECKS=1
904
PKG_SKIP_STRIP=1
905
MOZ_DEBUGGING_OPTS
906
else
907
MOZ_COMPILER_OPTS
908
fi # COMPILE_ENVIRONMENT
909
910
if test -z "$SKIP_COMPILER_CHECKS"; then
911
dnl Checks for typedefs, structures, and compiler characteristics.
912
dnl ========================================================
913
AC_C_CONST
914
AC_TYPE_MODE_T
915
AC_TYPE_OFF_T
916
AC_TYPE_PID_T
917
AC_TYPE_SIZE_T
918
AC_LANG_CPLUSPLUS
919
AC_LANG_C
920
921
AC_LANG_CPLUSPLUS
922
923
MOZ_CXX11
924
925
AC_LANG_C
926
927
case "${OS_TARGET}" in
928
Darwin)
929
;;
930
*)
931
STL_FLAGS="-I${DIST}/stl_wrappers"
932
WRAP_STL_INCLUDES=1
933
;;
934
esac
935
936
if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
937
WRAP_STL_INCLUDES=
938
fi
939
940
dnl Checks for header files.
941
dnl ========================================================
942
AC_HEADER_DIRENT
943
case "$target_os" in
944
bitrig*|dragonfly*|freebsd*|openbsd*)
945
# for stuff like -lXshm
946
CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
947
;;
948
esac
949
950
dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
951
AC_CACHE_CHECK(for sockaddr_in.sin_len,
952
ac_cv_sockaddr_in_sin_len,
953
[AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
954
#include <sys/types.h>
955
#endif
956
#include <netinet/in.h>
957
struct sockaddr_in x;
958
void *foo = (void*) &x.sin_len;],
959
[],
960
[ac_cv_sockaddr_in_sin_len=true],
961
[ac_cv_sockaddr_in_sin_len=false])])
962
if test "$ac_cv_sockaddr_in_sin_len" = true ; then
963
AC_DEFINE(HAVE_SIN_LEN)
964
dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
965
AC_DEFINE(HAVE_SCONN_LEN)
966
fi
967
968
AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
969
ac_cv_sockaddr_in6_sin6_len,
970
[AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
971
#include <sys/types.h>
972
#endif
973
#include <netinet/in.h>
974
struct sockaddr_in6 x;
975
void *foo = (void*) &x.sin6_len;],
976
[],
977
[ac_cv_sockaddr_in6_sin6_len=true],
978
[ac_cv_sockaddr_in6_sin6_len=false])])
979
if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
980
AC_DEFINE(HAVE_SIN6_LEN)
981
fi
982
983
AC_CACHE_CHECK(for sockaddr.sa_len,
984
ac_cv_sockaddr_sa_len,
985
[AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
986
#include <sys/types.h>
987
#endif
988
#include <sys/socket.h>
989
struct sockaddr x;
990
void *foo = (void*) &x.sa_len;],
991
[],
992
[ac_cv_sockaddr_sa_len=true],
993
[ac_cv_sockaddr_sa_len=false])])
994
if test "$ac_cv_sockaddr_sa_len" = true ; then
995
AC_DEFINE(HAVE_SA_LEN)
996
fi
997
998
MOZ_ARG_ENABLE_BOOL(dtrace,
999
[ --enable-dtrace build with dtrace support if available (default=no)],
1000
[enable_dtrace="yes"],)
1001
if test "x$enable_dtrace" = "xyes"; then
1002
MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1003
if test -n "$HAVE_DTRACE"; then
1004
AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1005
else
1006
AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1007
fi
1008
fi
1009
AC_SUBST(HAVE_DTRACE)
1010
1011
dnl Checks for libraries.
1012
dnl ========================================================
1013
AC_CHECK_LIB(c_r, gethostbyname_r)
1014
1015
dnl We don't want to link with libdl even if it's present on OS X, since
1016
dnl it's not used and not part of the default installation. OS/2 has dlfcn
1017
dnl in libc.
1018
dnl We don't want to link against libm or libpthread on Darwin since
1019
dnl they both are just symlinks to libSystem and explicitly linking
1020
dnl against libSystem causes issues when debugging (see bug 299601).
1021
case $target in
1022
*-darwin*)
1023
;;
1024
*)
1025
AC_SEARCH_LIBS(dlopen, dl,
1026
MOZ_CHECK_HEADER(dlfcn.h,
1027
AC_DEFINE(HAVE_DLOPEN)))
1028
;;
1029
esac
1030
1031
_SAVE_CFLAGS="$CFLAGS"
1032
CFLAGS="$CFLAGS -D_GNU_SOURCE"
1033
AC_CHECK_FUNCS(dladdr memmem)
1034
CFLAGS="$_SAVE_CFLAGS"
1035
1036
if test ! "$GNU_CXX"; then
1037
AC_CHECK_LIB(C, demangle)
1038
fi
1039
1040
AC_CHECK_LIB(socket, socket)
1041
1042
XLDFLAGS="$X_LIBS"
1043
XLIBS="$X_EXTRA_LIBS"
1044
1045
dnl ========================================================
1046
dnl Checks for X libraries.
1047
dnl Ordering is important.
1048
dnl Xt is dependent upon SM as of X11R6
1049
dnl ========================================================
1050
if test -n "$MOZ_X11"; then
1051
AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1052
_SAVE_LDFLAGS="$LDFLAGS"
1053
_SAVE_LIBS="$LIBS"
1054
LDFLAGS="$XLDFLAGS $LDFLAGS"
1055
AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1056
[MISSING_X="$MISSING_X -lX11"], $XLIBS)
1057
AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1058
[MISSING_X="$MISSING_X -lXext"], $XLIBS)
1059
1060
AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1061
unset ac_cv_lib_Xt_XtFree
1062
AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1063
AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1064
AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1065
[MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1066
])
1067
1068
dnl ========================================================
1069
dnl = Check for xcb
1070
dnl ========================================================
1071
AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1072
[MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1073
AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1074
[MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1075
AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1076
[MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1077
1078
LDFLAGS="$_SAVE_LDFLAGS"
1079
LIBS="$_SAVE_LIBS"
1080
fi # $MOZ_X11
1081
1082
AC_SUBST_LIST(XCFLAGS)
1083
AC_SUBST_LIST(XLDFLAGS)
1084
AC_SUBST_LIST(XLIBS)
1085
AC_SUBST_LIST(XEXT_LIBS)
1086
AC_SUBST_LIST(XT_LIBS)
1087
1088
dnl ========================================================
1089
dnl = pthread support
1090
dnl = Start by checking whether the system support pthreads
1091
dnl ========================================================
1092
case "$target_os" in
1093
darwin*)
1094
MOZ_USE_PTHREADS=1
1095
;;
1096
*)
1097
AC_CHECK_LIB(pthreads, pthread_create,
1098
MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1099
AC_CHECK_LIB(pthread, pthread_create,
1100
MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1101
AC_CHECK_LIB(c_r, pthread_create,
1102
MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1103
AC_CHECK_LIB(c, pthread_create,
1104
MOZ_USE_PTHREADS=1
1105
)
1106
)
1107
)
1108
)
1109
;;
1110
esac
1111
1112
dnl ========================================================
1113
dnl Do the platform specific pthread hackery
1114
dnl ========================================================
1115
if test "$MOZ_USE_PTHREADS"x != x
1116
then
1117
dnl
1118
dnl See if -pthread is supported.
1119
dnl
1120
rm -f conftest*
1121
ac_cv_have_dash_pthread=no
1122
AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1123
echo 'int main() { return 0; }' | cat > conftest.c
1124
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1125
if test $? -eq 0; then
1126
if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1127
ac_cv_have_dash_pthread=yes
1128
case "$target_os" in
1129
freebsd*)
1130
# Freebsd doesn't use -pthread for compiles, it uses them for linking
1131
;;
1132
*)
1133
CFLAGS="$CFLAGS -pthread"
1134
CXXFLAGS="$CXXFLAGS -pthread"
1135
;;
1136
esac
1137
fi
1138
fi
1139
rm -f conftest*
1140
AC_MSG_RESULT($ac_cv_have_dash_pthread)
1141
1142
dnl
1143
dnl See if -pthreads is supported.
1144
dnl
1145
ac_cv_have_dash_pthreads=no
1146
if test "$ac_cv_have_dash_pthread" = "no"; then
1147
AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1148
echo 'int main() { return 0; }' | cat > conftest.c
1149
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1150
if test $? -eq 0; then
1151
if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1152
ac_cv_have_dash_pthreads=yes
1153
CFLAGS="$CFLAGS -pthreads"
1154
CXXFLAGS="$CXXFLAGS -pthreads"
1155
fi
1156
fi
1157
rm -f conftest*
1158
AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1159
fi
1160
1161
case "$target" in
1162
*-*-freebsd*)
1163
AC_DEFINE(_REENTRANT)
1164
AC_DEFINE(_THREAD_SAFE)
1165
dnl -pthread links in -lpthread, so don't specify it explicitly.
1166
if test "$ac_cv_have_dash_pthread" = "yes"; then
1167
_PTHREAD_LDFLAGS="-pthread"
1168
fi
1169
;;
1170
1171
*-*-openbsd*|*-*-bsdi*)
1172
AC_DEFINE(_REENTRANT)
1173
AC_DEFINE(_THREAD_SAFE)
1174
dnl -pthread links in -lc_r, so don't specify it explicitly.
1175
if test "$ac_cv_have_dash_pthread" = "yes"; then
1176
_PTHREAD_LDFLAGS="-pthread"
1177
fi
1178
;;
1179
1180
*-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1181
AC_DEFINE(_REENTRANT)
1182
;;
1183
1184
esac
1185
LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1186
AC_SUBST(MOZ_USE_PTHREADS)
1187
MOZ_CHECK_HEADERS(pthread.h)
1188
fi
1189
1190
1191
dnl Checks for library functions.
1192
dnl ========================================================
1193
AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1194
1195
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1196
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1197
ac_cv_clock_monotonic,
1198
[for libs in "" -lrt; do
1199
_SAVE_LIBS="$LIBS"
1200
_SAVE_CFLAGS="$CFLAGS"
1201
LIBS="$LIBS $libs"
1202
CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1203
dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1204
dnl we should or not be able to use it. To detect if we can, we need to make the
1205
dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1206
AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1207
#include <time.h>],
1208
[ struct timespec ts;
1209
clock_gettime(CLOCK_MONOTONIC, &ts); ],
1210
ac_cv_clock_monotonic=$libs
1211
LIBS="$_SAVE_LIBS"
1212
break,
1213
ac_cv_clock_monotonic=no)
1214
LIBS="$_SAVE_LIBS"
1215
CFLAGS="$_SAVE_CFLAGS"
1216
done])
1217
if test "$ac_cv_clock_monotonic" != "no"; then
1218
HAVE_CLOCK_MONOTONIC=1
1219
REALTIME_LIBS=$ac_cv_clock_monotonic
1220
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1221
AC_SUBST(HAVE_CLOCK_MONOTONIC)
1222
AC_SUBST_LIST(REALTIME_LIBS)
1223
fi
1224
1225
dnl Turn on warnings-as-errors to prevent implicit declaration of
1226
dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1227
dnl inadvertently pass even if the function does not really exist.
1228
_SAVE_CFLAGS="$CFLAGS"
1229
CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1230
AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1231
ac_cv_pthread_cond_timedwait_monotonic_np,
1232
AC_TRY_LINK([#include <pthread.h>],
1233
[pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1234
ac_cv_pthread_cond_timewait_monotonic_np=yes,
1235
ac_cv_pthread_cond_timewait_monotonic_np=no))
1236
if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1237
AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1238
fi
1239
CFLAGS=$_SAVE_CFLAGS
1240
1241
AC_CACHE_CHECK(
1242
[for res_ninit()],
1243
ac_cv_func_res_ninit,
1244
[if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1245
dnl no need for res_ninit() on NetBSD and OpenBSD
1246
ac_cv_func_res_ninit=no
1247
else
1248
AC_TRY_LINK([
1249
#ifdef linux
1250
#define _BSD_SOURCE 1
1251
#endif
1252
#include <sys/types.h>
1253
#include <netinet/in.h>
1254
#include <arpa/nameser.h>
1255
#include <resolv.h>
1256
],
1257
[int foo = res_ninit(&_res);],
1258
[ac_cv_func_res_ninit=yes],
1259
[ac_cv_func_res_ninit=no])
1260
fi
1261
])
1262
1263
if test "$ac_cv_func_res_ninit" = "yes"; then
1264
AC_DEFINE(HAVE_RES_NINIT)
1265
dnl must add the link line we do something as foolish as this... dougt
1266
dnl else
1267
dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1268
dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1269
fi
1270
1271
AC_LANG_C
1272
1273
dnl **********************
1274
dnl *** va_copy checks ***
1275
AC_CACHE_CHECK([for an implementation of va_copy()],
1276
ac_cv_va_copy,
1277
[AC_TRY_COMPILE([#include <stdarg.h>
1278
#include <stdlib.h>
1279
void f (int i, ...) {
1280
va_list args1, args2;
1281
va_start (args1, i);
1282
va_copy (args2, args1);
1283
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1284
exit (1);
1285
va_end (args1); va_end (args2);
1286
}],
1287
[f(0, 42); return 0],
1288
[ac_cv_va_copy=yes],
1289
[ac_cv_va_copy=no]
1290
)]
1291
)
1292
AC_CACHE_CHECK([whether va_list can be copied by value],
1293
ac_cv_va_val_copy,
1294
[AC_TRY_COMPILE([#include <stdarg.h>
1295
#include <stdlib.h>
1296
void f (int i, ...) {
1297
va_list args1, args2;
1298
va_start (args1, i);
1299
args2 = args1;
1300
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1301
exit (1);
1302
va_end (args1); va_end (args2);
1303
}],
1304
[f(0, 42); return 0],
1305
[ac_cv_va_val_copy=yes],
1306
[ac_cv_va_val_copy=no],
1307
)]
1308
)
1309
if test "x$ac_cv_va_copy" = "xyes"; then
1310
AC_DEFINE(VA_COPY, va_copy)
1311
AC_DEFINE(HAVE_VA_COPY)
1312
fi
1313
1314
if test "x$ac_cv_va_val_copy" = "xno"; then
1315
AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1316
fi
1317
1318
dnl ===================================================================
1319
dnl ========================================================
1320
dnl Put your C++ language/feature checks below
1321
dnl ========================================================
1322
AC_LANG_CPLUSPLUS
1323
1324
ARM_ABI_PREFIX=
1325
if test "$GNU_CC"; then
1326
if test "$CPU_ARCH" = "arm" ; then
1327
AC_CACHE_CHECK(for ARM EABI,
1328
ac_cv_gcc_arm_eabi,
1329
[AC_TRY_COMPILE([],
1330
[
1331
#if defined(__ARM_EABI__)
1332
return 0;
1333
#else
1334
#error Not ARM EABI.
1335
#endif
1336
],
1337
ac_cv_gcc_arm_eabi="yes",
1338
ac_cv_gcc_arm_eabi="no")])
1339
if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1340
HAVE_ARM_EABI=1
1341
ARM_ABI_PREFIX=eabi-
1342
else
1343
ARM_ABI_PREFIX=oabi-
1344
fi
1345
fi
1346
1347
TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1348
fi
1349
1350
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
1351
# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1352
# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1353
# linking XUL.
1354
_SAVE_LDFLAGS=$LDFLAGS
1355
LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1356
AC_CACHE_CHECK(for __thread keyword for TLS variables,
1357
ac_cv_thread_keyword,
1358
[AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1359
[return tlsIsMainThread;],
1360
ac_cv_thread_keyword=yes,
1361
ac_cv_thread_keyword=no)])
1362
LDFLAGS=$_SAVE_LDFLAGS
1363
# The custom dynamic linker doesn't support TLS variables
1364
MOZ_TLS=
1365
if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1366
# mips builds fail with TLS variables because of a binutils bug.
1367
# See bug 528687
1368
# OpenBSD doesn't have TLS support, and the test succeeds with clang++
1369
case "${target}" in
1370
mips*-*)
1371
:
1372
;;
1373
*-android*|*-linuxandroid*)
1374
:
1375
;;
1376
*-openbsd*)
1377
:
1378
;;
1379
*)
1380
AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1381
MOZ_TLS=1
1382
;;
1383
esac
1384
fi
1385
1386
dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1387
if test -n "$MOZ_LINKER"; then
1388
if test "$CPU_ARCH" = arm; then
1389
dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1390
if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1391
LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1392
_SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1393
fi
1394
fi
1395
1396
dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1398
dnl Since the linker only understands the sysv ones, no need to build the
1399
dnl gnu style tables anyways.
1400
LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1401
fi
1402
1403
dnl End of C++ language/feature checks
1404
AC_LANG_C
1405
1406
dnl ========================================================
1407
dnl = Internationalization checks
1408
dnl ========================================================
1409
dnl
1410
dnl Internationalization and Locale support is different
1411
dnl on various UNIX platforms. Checks for specific i18n
1412
dnl features go here.
1413
1414
AC_HAVE_FUNCS(localeconv)
1415
1416
fi # ! SKIP_COMPILER_CHECKS
1417
1418
if test -n "${COMPILE_ENVIRONMENT}"; then
1419
MOZ_CHECK_ALLOCATOR
1420
fi
1421
1422
TARGET_XPCOM_ABI=
1423
if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1424
TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1425
AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1426
fi
1427
1428
dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1429
dnl features that Windows actually does support.
1430
1431
if test -n "$SKIP_COMPILER_CHECKS"; then
1432
dnl Windows has malloc.h
1433
AC_DEFINE(MALLOC_H, [<malloc.h>])
1434
AC_DEFINE(HAVE_FORCEINLINE)
1435
AC_DEFINE(HAVE_LOCALECONV)
1436
fi # SKIP_COMPILER_CHECKS
1437
1438
dnl Mozilla specific options
1439
dnl ========================================================
1440
dnl The macros used for command line options
1441
dnl are defined in build/autoconf/altoptions.m4.
1442
1443
dnl ========================================================
1444
dnl =
1445
dnl = Check for external package dependencies
1446
dnl =
1447
dnl ========================================================
1448
MOZ_ARG_HEADER(External Packages)
1449
1450
case "$OS_TARGET" in
1451
WINNT|Darwin|Android)
1452
MOZ_FOLD_LIBS=1
1453
;;
1454
*)
1455
MOZ_FOLD_LIBS=
1456
;;
1457
esac
1458
1459
MOZ_CONFIG_NSPR()
1460
1461
dnl ========================================================
1462
dnl system libevent Support
1463
dnl ========================================================
1464
MOZ_ARG_WITH_STRING(system-libevent,
1465
[ --with-system-libevent[=PFX]
1466
Use system libevent [installed at prefix PFX]],
1467
LIBEVENT_DIR=$withval)
1468
1469
_SAVE_CFLAGS=$CFLAGS
1470
_SAVE_LDFLAGS=$LDFLAGS
1471
_SAVE_LIBS=$LIBS
1472
if test "$LIBEVENT_DIR" = yes; then
1473
PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1474
MOZ_SYSTEM_LIBEVENT=1,
1475
LIBEVENT_DIR=/usr)
1476
fi
1477
if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1478
MOZ_SYSTEM_LIBEVENT=
1479
elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1480
CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1481
LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1482
MOZ_CHECK_HEADER(event.h,
1483
[if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1484
AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1485
fi],
1486
AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1487
AC_CHECK_LIB(event, event_init,
1488
[MOZ_SYSTEM_LIBEVENT=1
1489
MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1490
MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1491
[MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1492
fi
1493
CFLAGS=$_SAVE_CFLAGS
1494
LDFLAGS=$_SAVE_LDFLAGS
1495
LIBS=$_SAVE_LIBS
1496
1497
AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1498
1499
dnl ========================================================
1500
dnl = If NSS was not detected in the system,
1501
dnl = use the one in the source tree (mozilla/security/nss)
1502
dnl ========================================================
1503
1504
MOZ_ARG_WITH_BOOL(system-nss,
1505
[ --with-system-nss Use system installed NSS],
1506
_USE_SYSTEM_NSS=1 )
1507
1508
if test -n "$_USE_SYSTEM_NSS"; then
1509
AM_PATH_NSS(3.51.1, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1510
fi
1511
1512
NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1513
if test -z "$MOZ_SYSTEM_NSS"; then
1514
case "${OS_ARCH}" in
1515
# Only few platforms have been tested with GYP
1516
WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1517
;;
1518
*)
1519
AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1520
;;
1521
esac
1522
fi
1523
1524
dnl system ZLIB support
1525
dnl ========================================================
1526
MOZ_ZLIB_CHECK([1.2.3])
1527
1528
if test -z "$SKIP_LIBRARY_CHECKS"; then
1529
1530
dnl ========================================================
1531
dnl system PNG Support
1532
dnl ========================================================
1533
MOZ_ARG_WITH_STRING(system-png,
1534
[ --with-system-png[=PFX]
1535
Use system libpng [installed at prefix PFX]],
1536
PNG_DIR=$withval)
1537
1538
_SAVE_CFLAGS=$CFLAGS
1539
_SAVE_LDFLAGS=$LDFLAGS
1540
_SAVE_LIBS=$LIBS
1541
if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1542
CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1543
LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1544
fi
1545
if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1546
MOZ_SYSTEM_PNG=
1547
else
1548
AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1549
AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1550
AC_CHECK_LIB(png, png_get_acTL, ,
1551
AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1552
fi
1553
if test "$MOZ_SYSTEM_PNG" = 1; then
1554
AC_TRY_COMPILE([ #include <stdio.h>
1555
#include <sys/types.h>
1556
#include <png.h> ],
1557
[ #if PNG_LIBPNG_VER < $MOZPNG
1558
#error "Insufficient libpng version ($MOZPNG required)."
1559
#endif
1560
#ifndef PNG_UINT_31_MAX
1561
#error "Insufficient libpng version."
1562
#endif ],
1563
MOZ_SYSTEM_PNG=1,
1564
AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1565
fi
1566
CFLAGS=$_SAVE_CFLAGS
1567
LDFLAGS=$_SAVE_LDFLAGS
1568
LIBS=$_SAVE_LIBS
1569
1570
if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1571
MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1572
MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1573
fi
1574
1575
fi # SKIP_LIBRARY_CHECKS
1576
1577
dnl ========================================================
1578
dnl =
1579
dnl = Application
1580
dnl =
1581
dnl ========================================================
1582
1583
MOZ_ARG_HEADER(Application)
1584
1585
ENABLE_SYSTEM_EXTENSION_DIRS=1
1586
MOZ_BRANDING_DIRECTORY=
1587
MOZ_OFFICIAL_BRANDING=
1588
MOZ_AUTH_EXTENSION=1
1589
if test "$MOZ_IOS"; then
1590
MOZ_AUTH_EXTENSION=
1591
fi
1592
MOZ_PREF_EXTENSIONS=1
1593
MOZ_SPELLCHECK=1
1594
MOZ_UNIVERSALCHARDET=1
1595
MOZ_XUL=1
1596
MOZ_ZIPWRITER=1
1597
MOZ_NO_SMART_CARDS=
1598
MOZ_USE_NATIVE_POPUP_WINDOWS=
1599
MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1600
MOZ_SANDBOX=1
1601
MOZ_BINARY_EXTENSIONS=
1602
MOZ_DEVTOOLS=server
1603
1604
case "$target_os" in
1605
mingw*)
1606
NS_ENABLE_TSF=1
1607
AC_DEFINE(NS_ENABLE_TSF)
1608
;;
1609
esac
1610
1611
# Optional Firefox for Android partner distribution directory.
1612
MOZ_ARG_WITH_STRING(android-distribution-directory,
1613
[ --with-android-distribution-directory=dir
1614
Optional Firefox for Android partner distribution directory.],
1615
MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1616
1617
if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1618
# A distribution directory must have an assets/distribution directory.
1620
if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1621
AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1622
(looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1623
fi
1624
fi
1625
AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1626
1627
dnl ========================================================
1628
dnl = Trademarked Branding
1629
dnl ========================================================
1630
MOZ_ARG_ENABLE_BOOL(official-branding,
1631
[ --enable-official-branding
1632
Enable Official mozilla.org Branding
1633
Do not distribute builds with
1634
--enable-official-branding unless you have
1635
permission to use trademarks per
1637
MOZ_OFFICIAL_BRANDING=1,
1638
MOZ_OFFICIAL_BRANDING=)
1639
1640
# Allow the application to influence configure with a confvars.sh script.
1641
AC_MSG_CHECKING([if app-specific confvars.sh exists])
1642
if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1643
AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1644
. "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1645
else
1646
AC_MSG_RESULT([no])
1647
fi
1648
1649
# Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1650
MOZ_ARG_WITH_STRING(app-name,
1651
[--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1652
WITH_APP_NAME=$withval,
1653
)
1654
1655
if test -n "$WITH_APP_NAME" ; then
1656
MOZ_APP_NAME="$WITH_APP_NAME"
1657
fi
1658
1659
MOZ_ARG_WITH_STRING(app-basename,
1660
[--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1661
WITH_APP_BASENAME=$withval,
1662
)
1663
1664
if test -n "$WITH_APP_BASENAME" ; then
1665
MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1666
fi
1667
1668
dnl ========================================================
1669
dnl Ensure Android SDK and build-tools versions depending on
1670
dnl mobile target.
1671
dnl ========================================================
1672
1673
case "$MOZ_BUILD_APP" in
1674
mobile/android)
1675
MOZ_ANDROID_SDK
1676
;;
1677
esac
1678
1679
dnl ========================================================
1680
dnl =
1681
dnl = Toolkit Options
1682
dnl =
1683
dnl ========================================================
1684
MOZ_ARG_HEADER(Toolkit Options)
1685
1686
dnl ========================================================
1687
dnl = Enable the toolkit as needed =
1688
dnl ========================================================
1689
1690
case "$MOZ_WIDGET_TOOLKIT" in
1691
1692
cocoa)
1693
LDFLAGS="$LDFLAGS -framework Cocoa"
1694
# Use -Wl as a trick to avoid -framework and framework names from
1695
# being separated by AC_SUBST_LIST.
1696
TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,CoreVideo -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL -Wl,-framework,Security -Wl,-framework,ServiceManagement -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices -Wl,-framework,AppKit'
1697
TK_CFLAGS=""
1698
CFLAGS="$CFLAGS $TK_CFLAGS"
1699
CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1700
MOZ_USER_DIR="Mozilla"
1701
MOZ_FS_LAYOUT=bundle
1702
;;
1703
1704
uikit)
1705
LDFLAGS="$LDFLAGS -framework UIKit"
1706
TK_CFLAGS=""
1707
TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText -Wl,-framework,AVFoundation -Wl,-framework,AudioToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo -Wl,-framework,OpenGLES -Wl,-framework,QuartzCore'
1708
CFLAGS="$CFLAGS $TK_CFLAGS"
1709
CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1710
MOZ_USER_DIR="Mozilla"
1711
MOZ_FS_LAYOUT=bundle
1712
;;
1713
1714
esac
1715
1716
if test "$OS_TARGET" = Darwin; then
1717
LDFLAGS="$LDFLAGS -lobjc"
1718
fi
1719
1720
dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1721
dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1722
case "$MOZ_WIDGET_TOOLKIT" in
1723
gtk*)
1724
MOZ_ENABLE_GTK=1
1725
;;
1726
esac
1727
1728
if test "$COMPILE_ENVIRONMENT"; then
1729
if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1730
PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
1731
MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1732
TK_CFLAGS=$MOZ_GTK3_CFLAGS
1733
TK_LIBS=$MOZ_GTK3_LIBS
1734
dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1735
dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1736
AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1737
GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1738
fi
1739
if test "$MOZ_ENABLE_GTK"; then
1740
if test "$MOZ_X11"; then
1741
GDK_PACKAGES=gdk-x11-2.0
1742
fi
1743
AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1744
AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1745
1746
PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
1747
MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1748
fi
1749
fi # COMPILE_ENVIRONMENT
1750
1751
AC_SUBST(MOZ_FS_LAYOUT)
1752
1753
AC_SUBST_LIST(TK_CFLAGS)
1754
AC_SUBST_LIST(TK_LIBS)
1755
1756
dnl ========================================================
1757
dnl =
1758
dnl = Components & Features
1759
dnl =
1760
dnl ========================================================
1761
MOZ_ARG_HEADER(Components and Features)
1762
1763
AC_SUBST(MOZ_OFFICIAL_BRANDING)
1764
if test -n "$MOZ_OFFICIAL_BRANDING"; then
1765
if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1766
AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1767
else
1768
MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1769
AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1770
fi
1771
fi
1772
1773
MOZ_ARG_WITH_STRING(branding,
1774
[ --with-branding=dir Use branding from the specified directory.],
1775
MOZ_BRANDING_DIRECTORY=$withval)
1776
1777
REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1778
if test -z "$REAL_BRANDING_DIRECTORY"; then
1779
REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1780
fi
1781
1782
if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1783
. "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1784
elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1785
. "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1786
fi
1787
1788
AC_SUBST(MOZ_BRANDING_DIRECTORY)
1789
1790
dnl ========================================================
1791
dnl = Distribution ID
1792
dnl ========================================================
1793
MOZ_ARG_WITH_STRING(distribution-id,
1794
[ --with-distribution-id=ID
1795
Set distribution-specific id (default=org.mozilla)],
1796
[ val=`echo $withval`
1797
MOZ_DISTRIBUTION_ID="$val"])
1798
1799
if test -z "$MOZ_DISTRIBUTION_ID"; then
1800
MOZ_DISTRIBUTION_ID="org.mozilla"
1801
fi
1802
1803
AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1804
AC_SUBST(MOZ_DISTRIBUTION_ID)
1805
1806
dnl ========================================================
1807
dnl = libproxy support
1808
dnl ========================================================
1809
1810
if test "$MOZ_ENABLE_GTK"
1811
then
1812
MOZ_ENABLE_LIBPROXY=
1813
1814
MOZ_ARG_ENABLE_BOOL(libproxy,
1815
[ --enable-libproxy Enable libproxy support ],
1816
MOZ_ENABLE_LIBPROXY=1,
1817
MOZ_ENABLE_LIBPROXY=)
1818
1819
if test "$MOZ_ENABLE_LIBPROXY"
1820
then
1821
PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1822
AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1823
fi
1824
fi
1825
AC_SUBST(MOZ_ENABLE_LIBPROXY)
1826
1827
dnl ========================================================
1828
dnl = dbus support
1829
dnl ========================================================
1830
1831
if test "$MOZ_ENABLE_GTK"
1832
then
1833
MOZ_ENABLE_DBUS=1
1834
1835
MOZ_ARG_DISABLE_BOOL(dbus,
1836
[ --disable-dbus Disable dbus support ],
1837
MOZ_ENABLE_DBUS=,
1838
MOZ_ENABLE_DBUS=1)
1839
1840
if test "$MOZ_ENABLE_DBUS"
1841
then
1842
PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1843
PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1844
AC_DEFINE(MOZ_ENABLE_DBUS)
1845
fi
1846
fi
1847
AC_SUBST(MOZ_ENABLE_DBUS)
1848
1849
dnl =========================================================
1850
dnl = Whether to exclude hyphenations files in the build
1851
dnl =========================================================
1852
if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1853
AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1854
fi
1855
1856
AC_TRY_COMPILE([#include <linux/ethtool.h>],
1857
[ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1858
MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1859
1860
AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1861
1862
if test -n "$MOZ_WEBRTC"; then
1863
if test -n "$MOZ_X11"; then
1864
MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1865
fi
1866
fi
1867
1868
AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1869
1870
dnl ========================================================
1871
dnl = Apple platform decoder support
1872
dnl ========================================================
1873
if test "$COMPILE_ENVIRONMENT"; then
1874
if test -n "$MOZ_APPLEMEDIA"; then
1875
# hack in frameworks for fmp4 - see bug 1029974
1876
# We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1877
LDFLAGS="$LDFLAGS -framework AudioToolbox"
1878
dnl Verify CoreMedia is available.
1879
AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1880
[AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1881
fi
1882
fi # COMPILE_ENVIRONMENT
1883
1884
dnl ========================================================
1885
dnl = Handle dependent MEDIA defines
1886
dnl ========================================================
1887
1888
MOZ_WEBM_ENCODER=1
1889
AC_DEFINE(MOZ_WEBM_ENCODER)
1890
AC_SUBST(MOZ_WEBM_ENCODER)
1891
1892
dnl ========================================================
1893
dnl NegotiateAuth
1894
dnl ========================================================
1895
1896
MOZ_ARG_DISABLE_BOOL(negotiateauth,
1897
[ --disable-negotiateauth Disable GSS-API negotiation ],
1898
MOZ_AUTH_EXTENSION=,
1899
MOZ_AUTH_EXTENSION=1 )
1900
1901
if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1902
AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1903
fi
1904
1905
dnl ========================================================
1906
dnl Pref extensions (autoconfig)
1907
dnl ========================================================
1908
MOZ_ARG_DISABLE_BOOL(pref-extensions,
1909
[ --disable-pref-extensions
1910
Disable pref extensions such as autoconfig],
1911
MOZ_PREF_EXTENSIONS=,
1912
MOZ_PREF_EXTENSIONS=1 )
1913
1914
dnl ========================================================
1915
dnl Searching of system directories for extensions.
1916
dnl Note: this switch is meant to be used for test builds
1917
dnl whose behavior should not depend on what happens to be
1918
dnl installed on the local machine.
1919
dnl ========================================================
1920
MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1921
[ --disable-system-extension-dirs
1922
Disable searching system- and account-global
1923
directories for extensions of any kind; use
1924
only profile-specific extension directories],
1925
ENABLE_SYSTEM_EXTENSION_DIRS=,
1926
ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1927
if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1928
AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1929
fi
1930
1931
dnl ========================================================
1932
dnl = Universalchardet
1933
dnl ========================================================
1934
MOZ_ARG_DISABLE_BOOL(universalchardet,
1935
[ --disable-universalchardet
1936
Disable universal encoding detection],
1937
MOZ_UNIVERSALCHARDET=,
1938
MOZ_UNIVERSALCHARDET=1 )
1939
1940
dnl ========================================================
1941
dnl Gamepad support
1942
dnl ========================================================
1943
1944
if test "$COMPILE_ENVIRONMENT" ; then
1945
1946
dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1947
if test "$OS_TARGET" = "Linux"; then
1948
MOZ_CHECK_HEADER([linux/joystick.h])
1949
if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1950
AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1951
fi
1952
fi
1953
1954
fi # COMPILE_ENVIRONMENT
1955
1956
1957
dnl ========================================================
1958
dnl = Breakpad crash reporting (on by default on supported platforms)
1959
dnl ========================================================
1960
1961
case $target in
1962
i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1963
MOZ_CRASHREPORTER=1
1964
;;
1965
i?86-apple-darwin*|x86_64-apple-darwin*)
1966
if test -z "$MOZ_IOS"; then
1967
MOZ_CRASHREPORTER=1
1968
fi
1969
;;
1970
*-android*|*-linuxandroid*)
1971
dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1972
dnl be before Linux condition
1973
MOZ_CRASHREPORTER=1
1974
;;
1975
i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1976
if test "$MOZ_ENABLE_GTK"; then
1977
MOZ_CRASHREPORTER=1
1978
fi
1979
;;
1980
esac
1981
1982
MOZ_ARG_DISABLE_BOOL(crashreporter,
1983
[ --disable-crashreporter Disable breakpad crash reporting],
1984
[MOZ_CRASHREPORTER=],
1985
[MOZ_CRASHREPORTER=F # Force enable breakpad])
1986
1987
if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1988
if test "$MOZ_CRASHREPORTER" = F; then
1989
AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1990
fi
1991
MOZ_CRASHREPORTER=
1992
fi
1993
1994
if test -n "$MOZ_CRASHREPORTER"; then
1995
AC_DEFINE(MOZ_CRASHREPORTER)
1996
1997
if test "$OS_TARGET" = "Linux" && \
1998
test -z "$SKIP_LIBRARY_CHECKS"; then
1999
PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2000
fi
2001
2002
if test "$OS_ARCH" = "WINNT"; then
2003
if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2004
MOZ_CRASHREPORTER_INJECTOR=1
2005
AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2006
fi
2007
fi
2008
fi
2009
2010
dnl ========================================================
2011
dnl = Enable compilation of specific extension modules
2012
dnl ========================================================
2013
2014
MOZ_ARG_ENABLE_STRING(extensions,
2015
[ --enable-extensions Enable extensions],
2016
[ for option in `echo $enableval | sed 's/,/ /g'`; do
2017
if test "$option" = "yes" -o "$option" = "all"; then
2018
AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2019
elif test "$option" = "no" -o "$option" = "none"; then
2020
MOZ_EXTENSIONS=""
2021
elif test "$option" = "default"; then
2022
MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2023
elif test `echo "$option" | grep -c \^-` != 0; then
2024
option=`echo $option | sed 's/^-//'`
2025
MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2026
else
2027
MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2028
fi
2029
done],
2030
MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2031
2032
dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2033
dnl when trying to build a nonexistent extension.
2034
for extension in $MOZ_EXTENSIONS; do
2035
if test ! -d "${srcdir}/extensions/${extension}"; then
2036
AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2037
fi
2038
done
2039
2040
if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2041
AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2042
fi
2043
2044
# Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2045
# "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2046
if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2047
MOZ_ENABLE_CAIRO_FT=1
2048
FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2049
CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2050
AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2051
fi
2052
2053
AC_CHECK_PROGS(WGET, wget, "")
2054
AC_SUBST(WGET)
2055
2056
dnl ========================================================
2057
dnl Updater
2058
dnl ========================================================
2059
2060
if test "$MOZ_IOS"; then
2061
MOZ_UPDATER=
2062
fi
2063
2064
MOZ_ARG_DISABLE_BOOL(updater,
2065
[ --disable-updater Disable building of updater],
2066
MOZ_UPDATER=,
2067
MOZ_UPDATER=1 )
2068
2069
if test -n "$MOZ_UPDATER"; then
2070
AC_DEFINE(MOZ_UPDATER)
2071
fi
2072
2073
dnl ========================================================
2074
dnl parental controls (for Windows Vista)
2075
dnl ========================================================
2076
MOZ_ARG_DISABLE_BOOL(parental-controls,
2077
[ --disable-parental-controls
2078
Do not build parental controls],
2079
MOZ_DISABLE_PARENTAL_CONTROLS=1,
2080
MOZ_DISABLE_PARENTAL_CONTROLS=)
2081
if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2082
AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2083
fi
2084
2085
AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2086
2087
dnl ========================================================
2088
dnl = Disable smartcard support
2089
dnl ========================================================
2090
if test -n "$MOZ_NO_SMART_CARDS"; then
2091
AC_DEFINE(MOZ_NO_SMART_CARDS)
2092
fi
2093
AC_SUBST(MOZ_NO_SMART_CARDS)
2094
2095
dnl ========================================================
2096
dnl = Sandboxing support
2097
dnl ========================================================
2098
if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2099
# Bug 1182565: TSan conflicts with sandboxing on Linux.
2100
# Bug 1287971: LSan also conflicts with sandboxing on Linux.
2101
case $OS_TARGET in
2102
Linux|Android)
2103
MOZ_SANDBOX=
2104
;;
2105
esac
2106
fi
2107
2108
MOZ_ARG_DISABLE_BOOL(sandbox,
2109
[ --disable-sandbox Disable sandboxing support],
2110
MOZ_SANDBOX=,
2111
MOZ_SANDBOX=1)
2112
2113
case "$OS_TARGET" in
2114
WINNT|Darwin|OpenBSD)
2115
;;
2116
Linux)
2117
case $CPU_ARCH in
2118
x86_64|x86)
2119
;;
2120
# Linux sandbox is only available on x86 and x86_64.
2121
*)
2122
MOZ_SANDBOX=
2123
;;
2124
esac
2125
;;
2126
*)
2127
# Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2128
MOZ_SANDBOX=
2129
;;
2130
esac
2131
2132
if test -n "$MOZ_SANDBOX"; then
2133
AC_DEFINE(MOZ_SANDBOX)
2134
fi
2135
2136
AC_SUBST(MOZ_SANDBOX)
2137
2138
2139
dnl ========================================================
2140
dnl =
2141
dnl = Module specific options
2142
dnl =
2143
dnl ========================================================
2144
MOZ_ARG_HEADER(Individual module options)
2145
2146
dnl ==============================
2147
dnl === SQLite fdatasync check ===
2148
dnl ==============================
2149
dnl Check to see if fdatasync is available and make use of it
2150
AC_CHECK_FUNC(fdatasync)
2151
2152
dnl ========================================================
2153
dnl = Disable zipwriter
2154
dnl ========================================================
2155
MOZ_ARG_DISABLE_BOOL(zipwriter,
2156
[ --disable-zipwriter Disable zipwriter component],
2157
MOZ_ZIPWRITER=,
2158
MOZ_ZIPWRITER=1 )
2159
AC_SUBST(MOZ_ZIPWRITER)
2160
2161
dnl ========================================================
2162
dnl =
2163
dnl = Feature options that require extra sources to be pulled
2164
dnl =
2165
dnl ========================================================
2166
dnl MOZ_ARG_HEADER(Features that require extra sources)
2167
2168
dnl ========================================================
2169
dnl =
2170
dnl = Runtime debugging and Optimization Options
2171
dnl =
2172
dnl ========================================================
2173
MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2174
2175
dnl ========================================================
2176
dnl enable mobile optimizations
2177
dnl ========================================================
2178
MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2179
[ --enable-mobile-optimize
2180
Enable mobile optimizations],
2181
MOZ_GFX_OPTIMIZE_MOBILE=1)
2182
2183
AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2184
2185
if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2186
# We ignore paint will resample on mobile for performance.
2187
# We may want to revisit this later.
2188
MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2189
2190
AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2191
AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2192
fi
2193
2194
dnl ========================================================
2195
dnl = Enable code optimization. ON by default.
2196
dnl ========================================================
2197
2198
# Use value from moz.configure if one is defined. Else use our computed
2199
# value.
2200
if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2201
MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2202
fi
2203
2204
if test "$COMPILE_ENVIRONMENT"; then
2205
if test -n "$MOZ_OPTIMIZE"; then
2206
AC_MSG_CHECKING([for valid C compiler optimization flags])
2207
_SAVE_CFLAGS=$CFLAGS
2208
CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2209
AC_TRY_COMPILE([#include <stdio.h>],
2210
[printf("Hello World\n");],
2211
_results=yes,
2212
_results=no)
2213
AC_MSG_RESULT([$_results])
2214
if test "$_results" = "no"; then
2215
AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2216
fi
2217
CFLAGS=$_SAVE_CFLAGS
2218
if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2219
# When using llvm-based LTO, non numeric optimization levels are
2220
# not supported by the linker, so force the linker to use -O2 (
2221
# which doesn't influence the level compilation units are actually
2222
# compiled at).
2223
case " $MOZ_OPTIMIZE_FLAGS " in
2224
*\ -Os\ *|*\ -Oz\ *)
2225
MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2226
;;
2227
esac
2228
fi
2229
fi
2230
fi # COMPILE_ENVIRONMENT
2231
2232
AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2233
AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2234
AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2235
2236
dnl ========================================================
2237
dnl = Enable runtime logging
2238
dnl ========================================================
2239
AC_DEFINE(MOZ_LOGGING)
2240
AC_DEFINE(FORCE_PR_LOG)
2241
2242
dnl ========================================================
2243
dnl = This will enable logging of addref, release, ctor, dtor.
2244
dnl ========================================================
2245
_ENABLE_LOGREFCNT=42
2246
MOZ_ARG_ENABLE_BOOL(logrefcnt,
2247
[ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2248
_ENABLE_LOGREFCNT=1,
2249
_ENABLE_LOGREFCNT= )
2250
if test "$_ENABLE_LOGREFCNT" = "1"; then
2251
AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2252
elif test -z "$_ENABLE_LOGREFCNT"; then
2253
AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2254
fi
2255
2256
dnl ========================================================
2257
dnl moz_dump_painting
2258
dnl ========================================================
2259
MOZ_ARG_ENABLE_BOOL(dump-painting,
2260
[ --enable-dump-painting Enable paint debugging.],
2261
MOZ_DUMP_PAINTING=1,
2262
MOZ_DUMP_PAINTING= )
2263
if test -n "$MOZ_DUMP_PAINTING"; then
2264
AC_DEFINE(MOZ_DUMP_PAINTING)
2265
AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2266
fi
2267
if test -n "$MOZ_DEBUG"; then
2268
AC_DEFINE(MOZ_DUMP_PAINTING)
2269
fi
2270
2271
case "${OS_TARGET}" in
2272
Android|WINNT|Darwin)
2273
MOZ_GLUE_IN_PROGRAM=
2274
;;
2275
*)
2276
dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2277
MOZ_GLUE_IN_PROGRAM=1
2278
AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2279
;;
2280
esac
2281
2282
dnl ========================================================
2283
dnl = Jemalloc build setup
2284
dnl ========================================================
2285
if test -z "$MOZ_MEMORY"; then
2286
case "${target}" in
2287
*-mingw*)
2288
if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2289
AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.])
2290
fi
2291
;;
2292
esac
2293
else
2294
dnl The generic feature tests that determine how to compute ncpus are long and
2295
dnl complicated. Therefore, simply define special cpp variables for the
2296
dnl platforms we have special knowledge of.
2297
case "${target}" in
2298
*-mingw*)
2299
export MOZ_NO_DEBUG_RTL=1
2300
;;
2301
esac
2302
fi # MOZ_MEMORY
2303
AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2304
2305
dnl ========================================================
2306
dnl = Enable using the clang plugin to build
2307
dnl ========================================================
2308
2309
if test -n "$COMPILE_ENVIRONMENT"; then
2310
MOZ_CONFIG_CLANG_PLUGIN
2311
fi # COMPILE_ENVIRONMENT
2312
2313
dnl ========================================================
2314
dnl = Enable stripping of libs & executables
2315
dnl ========================================================
2316
MOZ_ARG_ENABLE_BOOL(strip,
2317
[ --enable-strip Enable stripping of libs & executables ],
2318
ENABLE_STRIP=1,
2319
ENABLE_STRIP= )
2320
2321
dnl ========================================================
2322
dnl = Enable stripping of libs & executables when packaging
2323
dnl ========================================================
2324
MOZ_ARG_ENABLE_BOOL(install-strip,
2325
[ --enable-install-strip Enable stripping of libs & executables when packaging ],
2326
PKG_SKIP_STRIP= ,
2327
PKG_SKIP_STRIP=1)
2328
2329
dnl ========================================================
2330
dnl = frontend JS debug mode
2331
dnl ========================================================
2332
2333
MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2334
[ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2335
DEBUG_JS_MODULES=1,
2336
DEBUG_JS_MODULES=)
2337
2338
AC_SUBST(DEBUG_JS_MODULES)
2339
2340
dnl ========================================================
2341
dnl =
2342
dnl = Profiling and Instrumenting
2343
dnl =
2344
dnl ========================================================
2345
MOZ_ARG_HEADER(Profiling and Instrumenting)
2346
2347
dnl ========================================================
2348
dnl = Offer a way to disable the startup cache
2349
dnl ========================================================
2350
2351
MOZ_ARG_DISABLE_BOOL(startupcache,
2352
[ --disable-startupcache Disable startup cache ],
2353
MOZ_DISABLE_STARTUPCACHE=1,
2354
MOZ_DISABLE_STARTUPCACHE=)
2355
2356
if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2357
AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2358
fi
2359
AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2360
2361
dnl ========================================================
2362
dnl = Support for demangling undefined symbols
2363
dnl ========================================================
2364
if test -z "$SKIP_LIBRARY_CHECKS"; then
2365
AC_LANG_SAVE
2366
AC_LANG_CPLUSPLUS
2367
AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2368
AC_LANG_RESTORE
2369
fi
2370
2371
# Demangle only for debug or DMD builds
2372
MOZ_DEMANGLE_SYMBOLS=
2373
if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2374
MOZ_DEMANGLE_SYMBOLS=1
2375
AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2376
fi
2377
AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2378
2379
dnl ========================================================
2380
dnl = Support for gcc stack unwinding (from gcc 3.3)
2381
dnl ========================================================
2382
if test -z "$SKIP_LIBRARY_CHECKS"; then
2383
AC_LANG_SAVE
2384
AC_LANG_CPLUSPLUS
2385
MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2386
AC_LANG_RESTORE
2387
fi
2388
2389
dnl ========================================================
2390
dnl JIT observers
2391
dnl ========================================================
2392
2393
MOZ_ARG_WITH_STRING(jitreport-granularity,
2394
[ --jitreport-granularity=N
2395
Default granularity at which to report JIT code
2396
to external tools
2397
0 - no info
2398
1 - code ranges for whole functions only
2399
2 - per-line information
2400
3 - per-op information],
2401
JITREPORT_GRANULARITY=$withval,
2402
JITREPORT_GRANULARITY=3)
2403
2404
AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2405
2406
dnl ========================================================
2407
dnl =
2408
dnl = Misc. Options
2409
dnl =
2410
dnl ========================================================
2411
MOZ_ARG_HEADER(Misc. Options)
2412
2413
dnl ========================================================
2414
dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2415
dnl ========================================================
2416
MOZ_ARG_WITH_STRING(user-appdir,
2417
[ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2418
[ val=`echo $withval`
2419
if echo "$val" | grep "\/" >/dev/null; then
2420
AC_MSG_ERROR("Homedir must be single relative path.")
2421
else
2422
MOZ_USER_DIR="$val"
2423
fi])
2424
2425
AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2426
2427
if test -z "$SKIP_COMPILER_CHECKS"; then
2428
dnl ========================================================
2429
dnl =
2430
dnl = Compiler Options
2431
dnl =
2432
dnl ========================================================
2433
MOZ_ARG_HEADER(Compiler Options)
2434
2435
dnl ========================================================
2436
dnl Check for gcc -pipe support
2437
dnl ========================================================
2438
AC_MSG_CHECKING([for -pipe support])
2439
if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2440
dnl Any gcc that supports firefox supports -pipe.
2441
CFLAGS="$CFLAGS -pipe"
2442
CXXFLAGS="$CXXFLAGS -pipe"
2443
AC_MSG_RESULT([yes])
2444
else
2445
AC_MSG_RESULT([no])
2446
fi
2447
2448
fi # ! SKIP_COMPILER_CHECKS
2449
2450
AC_LANG_C
2451
2452
if test "$COMPILE_ENVIRONMENT"; then
2453
MOZ_EXPAND_LIBS
2454
fi # COMPILE_ENVIRONMENT
2455
2456
dnl ========================================================
2457
dnl =
2458
dnl = Static Build Options
2459
dnl =
2460
dnl ========================================================
2461
MOZ_ARG_HEADER(Static build options)
2462
2463
if test -z "$MOZ_SYSTEM_ZLIB"; then
2464
if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2465
ZLIB_IN_MOZGLUE=1
2466
AC_DEFINE(ZLIB_IN_MOZGLUE)
2467
fi
2468
fi
2469
2470
AC_SUBST(ZLIB_IN_MOZGLUE)
2471
2472
dnl ========================================================
2473
dnl =
2474
dnl = Standalone module options