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