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

« back to all changes in this revision

Viewing changes to mozilla/configure.in

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

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl -*- 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
 
 
10
AC_PREREQ(2.13)
 
11
AC_INIT(config/config.mk)
 
12
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 
13
AC_CANONICAL_SYSTEM
 
14
TARGET_CPU="${target_cpu}"
 
15
TARGET_VENDOR="${target_vendor}"
 
16
TARGET_OS="${target_os}"
 
17
 
 
18
MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1`
 
19
AC_SUBST(MOZ_DEB_TIMESTAMP)
 
20
 
 
21
dnl ========================================================
 
22
dnl =
 
23
dnl = Don't change the following two lines.  Doing so breaks:
 
24
dnl =
 
25
dnl = CFLAGS="-foo" ./configure
 
26
dnl =
 
27
dnl ========================================================
 
28
CFLAGS="${CFLAGS=}"
 
29
CPPFLAGS="${CPPFLAGS=}"
 
30
CXXFLAGS="${CXXFLAGS=}"
 
31
LDFLAGS="${LDFLAGS=}"
 
32
HOST_CFLAGS="${HOST_CFLAGS=}"
 
33
HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
 
34
HOST_LDFLAGS="${HOST_LDFLAGS=}"
 
35
 
 
36
dnl ========================================================
 
37
dnl = Preserve certain environment flags passed to configure
 
38
dnl = We want sub projects to receive the same flags
 
39
dnl = untainted by this configure script
 
40
dnl ========================================================
 
41
_SUBDIR_CC="$CC"
 
42
_SUBDIR_CXX="$CXX"
 
43
_SUBDIR_CFLAGS="$CFLAGS"
 
44
_SUBDIR_CPPFLAGS="$CPPFLAGS"
 
45
_SUBDIR_CXXFLAGS="$CXXFLAGS"
 
46
_SUBDIR_LDFLAGS="$LDFLAGS"
 
47
_SUBDIR_HOST_CC="$HOST_CC"
 
48
_SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
 
49
_SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
 
50
_SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
 
51
_SUBDIR_CONFIG_ARGS="$ac_configure_args"
 
52
 
 
53
dnl Set the version number of the libs included with mozilla
 
54
dnl ========================================================
 
55
MOZJPEG=62
 
56
MOZPNG=10511
 
57
NSPR_VERSION=4
 
58
NSS_VERSION=3
 
59
 
 
60
dnl Set the minimum version of toolkit libs used by mozilla
 
61
dnl ========================================================
 
62
GLIB_VERSION=1.2.0
 
63
PERL_VERSION=5.006
 
64
PYTHON_VERSION=2.5
 
65
CAIRO_VERSION=1.10
 
66
PANGO_VERSION=1.14.0
 
67
GTK2_VERSION=2.10.0
 
68
WINDRES_VERSION=2.14.90
 
69
W32API_VERSION=3.14
 
70
GNOMEVFS_VERSION=2.0
 
71
GNOMEUI_VERSION=2.2.0
 
72
GCONF_VERSION=1.2.1
 
73
GIO_VERSION=2.18
 
74
STARTUP_NOTIFICATION_VERSION=0.8
 
75
DBUS_VERSION=0.60
 
76
SQLITE_VERSION=3.7.13
 
77
 
 
78
MSMANIFEST_TOOL=
 
79
 
 
80
dnl Set various checks
 
81
dnl ========================================================
 
82
MISSING_X=
 
83
AC_PROG_AWK
 
84
 
 
85
dnl Initialize the Pthread test variables early so they can be
 
86
dnl  overridden by each platform.
 
87
dnl ========================================================
 
88
USE_PTHREADS=
 
89
_PTHREAD_LDFLAGS=""
 
90
 
 
91
dnl Do not allow a separate objdir build if a srcdir build exists.
 
92
dnl ==============================================================
 
93
_topsrcdir=`cd \`dirname $0\`; pwd`
 
94
_objdir=`pwd`
 
95
 
 
96
if test "$_topsrcdir" != "$_objdir"
 
97
then
 
98
  # Check for a couple representative files in the source tree
 
99
  _conflict_files=
 
100
  for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
 
101
    if test -f $file; then
 
102
      _conflict_files="$_conflict_files $file"
 
103
    fi
 
104
  done
 
105
  if test "$_conflict_files"; then
 
106
    echo "***"
 
107
    echo "*   Your source tree contains these files:"
 
108
    for file in $_conflict_files; do
 
109
      echo "*         $file"
 
110
    done
 
111
    cat 1>&2 <<-EOF
 
112
        *   This indicates that you previously built in the source tree.
 
113
        *   A source tree build can confuse the separate objdir build.
 
114
        *
 
115
        *   To clean up the source tree:
 
116
        *     1. cd $_topsrcdir
 
117
        *     2. gmake distclean
 
118
        ***
 
119
        EOF
 
120
    exit 1
 
121
    break
 
122
  fi
 
123
fi
 
124
MOZ_BUILD_ROOT=`pwd`
 
125
 
 
126
MOZ_DEFAULT_COMPILER
 
127
 
 
128
COMPILE_ENVIRONMENT=1
 
129
MOZ_ARG_DISABLE_BOOL(compile-environment,
 
130
[  --disable-compile-environment
 
131
                          Disable compiler/library checks.],
 
132
    COMPILE_ENVIRONMENT= )
 
133
AC_SUBST(COMPILE_ENVIRONMENT)
 
134
 
 
135
MOZ_ARG_WITH_STRING(l10n-base,
 
136
[  --with-l10n-base=DIR    path to l10n repositories],
 
137
    L10NBASEDIR=$withval)
 
138
if test -n "$L10NBASEDIR"; then
 
139
    if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
 
140
        AC_MSG_ERROR([--with-l10n-base must specify a path])
 
141
    elif test -d "$L10NBASEDIR"; then
 
142
        L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
 
143
    else
 
144
        AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
 
145
    fi
 
146
fi
 
147
AC_SUBST(L10NBASEDIR)
 
148
 
 
149
dnl Check for Perl first -- needed for win32 SDK checks
 
150
MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
 
151
if test -z "$PERL" -o "$PERL" = ":"; then
 
152
    AC_MSG_ERROR([perl not found in \$PATH])
 
153
fi
 
154
 
 
155
MOZ_ARG_WITH_STRING(gonk,
 
156
[  --with-gonk=DIR
 
157
               location of gonk dir],
 
158
    gonkdir=$withval)
 
159
 
 
160
MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
 
161
[  --with-gonk-toolchain-prefix=DIR
 
162
                          prefix to gonk toolchain commands],
 
163
    gonk_toolchain_prefix=$withval)
 
164
 
 
165
if test -n "$gonkdir" ; then
 
166
    kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
 
167
    android_source="$gonkdir"
 
168
    ANDROID_SOURCE="$android_source"
 
169
    ANDROID_NDK="${ANDROID_SOURCE}/ndk"
 
170
 
 
171
    dnl set up compilers
 
172
    TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
 
173
    AS="$gonk_toolchain_prefix"as
 
174
    CC="$gonk_toolchain_prefix"gcc
 
175
    CXX="$gonk_toolchain_prefix"g++
 
176
    CPP="$gonk_toolchain_prefix"cpp
 
177
    LD="$gonk_toolchain_prefix"ld
 
178
    AR="$gonk_toolchain_prefix"ar
 
179
    RANLIB="$gonk_toolchain_prefix"ranlib
 
180
    STRIP="$gonk_toolchain_prefix"strip
 
181
 
 
182
    STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
 
183
    STLPORT_LIBS="-lstlport"
 
184
 
 
185
    case "$target_cpu" in
 
186
    arm)
 
187
        ARCH_DIR=arch-arm
 
188
        ;;
 
189
    i?86)
 
190
        ARCH_DIR=arch-x86
 
191
        ;;
 
192
    esac
 
193
 
 
194
    CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/frameworks/base/include -I$gonkdir/external/dbus $CPPFLAGS -I$gonkdir/frameworks/base/services/sensorservice -I$gonkdir/frameworks/base/services/camera"
 
195
    CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
 
196
    CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
 
197
    dnl Add -llog by default, since we use it all over the place.
 
198
    LIBS="$LIBS -llog $STLPORT_LIBS"
 
199
 
 
200
    LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ $LDFLAGS"
 
201
 
 
202
    dnl prevent cross compile section from using these flags as host flags
 
203
    if test -z "$HOST_CPPFLAGS" ; then
 
204
        HOST_CPPFLAGS=" "
 
205
    fi
 
206
    if test -z "$HOST_CFLAGS" ; then
 
207
        HOST_CFLAGS=" "
 
208
    fi
 
209
    if test -z "$HOST_CXXFLAGS" ; then
 
210
        HOST_CXXFLAGS=" "
 
211
    fi
 
212
    if test -z "$HOST_LDFLAGS" ; then
 
213
        HOST_LDFLAGS=" "
 
214
    fi
 
215
 
 
216
    AC_DEFINE(ANDROID)
 
217
    AC_DEFINE(HAVE_SYS_UIO_H)
 
218
    AC_DEFINE(HAVE_PTHREADS)
 
219
    CROSS_COMPILE=1
 
220
    MOZ_CHROME_FILE_FORMAT=omni
 
221
    direct_nspr_config=1
 
222
else
 
223
    MOZ_ANDROID_NDK
 
224
 
 
225
    case "$target" in
 
226
    *-android*|*-linuxandroid*)
 
227
        if test -z "$ANDROID_PACKAGE_NAME" ; then
 
228
            ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
 
229
        fi
 
230
        MOZ_CHROME_FILE_FORMAT=omni
 
231
        ZLIB_DIR=yes
 
232
        ;;
 
233
    *-linux*)
 
234
        AC_PATH_PROG(OBJCOPY,objcopy)
 
235
        ;;
 
236
    esac
 
237
fi
 
238
 
 
239
AC_SUBST(ANDROID_SOURCE)
 
240
AC_SUBST(ANDROID_PACKAGE_NAME)
 
241
AC_SUBST(OBJCOPY)
 
242
 
 
243
dnl ========================================================
 
244
dnl Checks for compilers.
 
245
dnl ========================================================
 
246
dnl Set CROSS_COMPILE in the environment when running configure
 
247
dnl to use the cross-compile setup for now
 
248
dnl ========================================================
 
249
 
 
250
dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
 
251
AR_FLAGS='cr $@'
 
252
 
 
253
if test "$COMPILE_ENVIRONMENT"; then
 
254
 
 
255
if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
 
256
    echo "cross compiling from $host to $target"
 
257
    cross_compiling=yes
 
258
 
 
259
    _SAVE_CC="$CC"
 
260
    _SAVE_CFLAGS="$CFLAGS"
 
261
    _SAVE_LDFLAGS="$LDFLAGS"
 
262
 
 
263
    AC_MSG_CHECKING([for host c compiler])
 
264
    AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
 
265
    if test -z "$HOST_CC"; then
 
266
        AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
 
267
    fi
 
268
    AC_MSG_RESULT([$HOST_CC])
 
269
    AC_MSG_CHECKING([for host c++ compiler])
 
270
    AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
 
271
    if test -z "$HOST_CXX"; then
 
272
        AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
 
273
    fi
 
274
    AC_MSG_RESULT([$HOST_CXX])
 
275
 
 
276
    if test -z "$HOST_CFLAGS"; then
 
277
        HOST_CFLAGS="$CFLAGS"
 
278
    fi
 
279
    if test -z "$HOST_CXXFLAGS"; then
 
280
        HOST_CXXFLAGS="$CXXFLAGS"
 
281
    fi
 
282
    if test -z "$HOST_LDFLAGS"; then
 
283
        HOST_LDFLAGS="$LDFLAGS"
 
284
    fi
 
285
    if test -z "$HOST_AR_FLAGS"; then
 
286
        HOST_AR_FLAGS="$AR_FLAGS"
 
287
    fi
 
288
    AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
 
289
    AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
 
290
    CC="$HOST_CC"
 
291
    CFLAGS="$HOST_CFLAGS"
 
292
    LDFLAGS="$HOST_LDFLAGS"
 
293
 
 
294
    AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
 
295
    AC_TRY_COMPILE([], [return(0);],
 
296
        [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
 
297
        AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
 
298
 
 
299
    CC="$HOST_CXX"
 
300
    CFLAGS="$HOST_CXXFLAGS"
 
301
 
 
302
    AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
 
303
    AC_TRY_COMPILE([], [return(0);],
 
304
        [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
 
305
        AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
 
306
 
 
307
    CC=$_SAVE_CC
 
308
    CFLAGS=$_SAVE_CFLAGS
 
309
    LDFLAGS=$_SAVE_LDFLAGS
 
310
 
 
311
    AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
 
312
    unset ac_cv_prog_CC
 
313
    AC_PROG_CC
 
314
    AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
 
315
    unset ac_cv_prog_CXX
 
316
    AC_PROG_CXX
 
317
 
 
318
    AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
 
319
    AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
 
320
    MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
 
321
    AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
 
322
    AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
 
323
    AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
 
324
    AC_DEFINE(CROSS_COMPILE)
 
325
else
 
326
    AC_PROG_CC
 
327
    case "$target" in
 
328
    *-mingw*)
 
329
      # Work around the conftest.exe access problem on Windows
 
330
      sleep 2
 
331
    esac
 
332
    AC_PROG_CXX
 
333
    AC_PROG_RANLIB
 
334
    MOZ_PATH_PROGS(AS, $AS as, $CC)
 
335
    AC_CHECK_PROGS(AR, ar, :)
 
336
    AC_CHECK_PROGS(LD, ld, :)
 
337
    AC_CHECK_PROGS(STRIP, strip, :)
 
338
    AC_CHECK_PROGS(WINDRES, windres, :)
 
339
    if test -z "$HOST_CC"; then
 
340
        HOST_CC="$CC"
 
341
    fi
 
342
    if test -z "$HOST_CFLAGS"; then
 
343
        HOST_CFLAGS="$CFLAGS"
 
344
    fi
 
345
    if test -z "$HOST_CXX"; then
 
346
        HOST_CXX="$CXX"
 
347
    fi
 
348
    if test -z "$HOST_CXXFLAGS"; then
 
349
        HOST_CXXFLAGS="$CXXFLAGS"
 
350
    fi
 
351
    if test -z "$HOST_LDFLAGS"; then
 
352
        HOST_LDFLAGS="$LDFLAGS"
 
353
    fi
 
354
    if test -z "$HOST_RANLIB"; then
 
355
        HOST_RANLIB="$RANLIB"
 
356
    fi
 
357
    if test -z "$HOST_AR"; then
 
358
        HOST_AR="$AR"
 
359
    fi
 
360
    if test -z "$HOST_AR_FLAGS"; then
 
361
        HOST_AR_FLAGS="$AR_FLAGS"
 
362
    fi
 
363
fi
 
364
 
 
365
if test -n "$MOZ_WINCONSOLE"; then
 
366
    AC_DEFINE(MOZ_WINCONSOLE)
 
367
fi
 
368
 
 
369
MOZ_TOOL_VARIABLES
 
370
 
 
371
dnl ========================================================
 
372
dnl Special win32 checks
 
373
dnl ========================================================
 
374
 
 
375
# With win8, sdk target=602, WINVER=602
 
376
MOZ_ARG_ENABLE_BOOL(metro,
 
377
[  --enable-metro           Enable Windows Metro build targets],
 
378
    MOZ_METRO=1,
 
379
    MOZ_METRO=)
 
380
if test -n "$MOZ_METRO"; then
 
381
    AC_DEFINE(MOZ_METRO)
 
382
    # Target the Windows 8 Kit
 
383
    WINSDK_TARGETVER=602
 
384
    # Allow a higher api set
 
385
    WINVER=602
 
386
    # toolkit/library/makefile.in needs these, see nsDllMain.
 
387
    CRTDLLVERSION=110
 
388
    CRTEXPDLLVERSION=1-1-0
 
389
else
 
390
    # Target the Windows 7 SDK by default
 
391
    WINSDK_TARGETVER=601
 
392
    WINVER=502
 
393
fi
 
394
 
 
395
AC_SUBST(CRTDLLVERSION)
 
396
AC_SUBST(CRTEXPDLLVERSION)
 
397
 
 
398
if test -n "$MOZ_METRO"; then
 
399
  case "$target" in
 
400
  *-mingw*)
 
401
    ;;
 
402
  *)
 
403
    AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
 
404
    ;;
 
405
  esac
 
406
fi
 
407
 
 
408
MOZ_ARG_WITH_STRING(windows-version,
 
409
[  --with-windows-version=WINSDK_TARGETVER
 
410
                          Windows SDK version to target. Lowest version
 
411
                          currently allowed is 601 (Win7), highest is 602 (Win8)],
 
412
  WINSDK_TARGETVER=$withval)
 
413
 
 
414
# Currently only two sdk versions allowed, 601 and 602
 
415
case "$WINSDK_TARGETVER" in
 
416
601|602)
 
417
    MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
 
418
    ;;
 
419
 
 
420
*)
 
421
    AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
 
422
    ;;
 
423
esac
 
424
 
 
425
case "$target" in
 
426
*-mingw*)
 
427
    if test "$GCC" != "yes"; then
 
428
        # Check to see if we are really running in a msvc environemnt
 
429
        _WIN32_MSVC=1
 
430
        AC_CHECK_PROGS(MIDL, midl)
 
431
 
 
432
        # Make sure compilers are valid
 
433
        CFLAGS="$CFLAGS -TC -nologo"
 
434
        CXXFLAGS="$CXXFLAGS -TP -nologo"
 
435
        AC_LANG_SAVE
 
436
        AC_LANG_C
 
437
        AC_TRY_COMPILE([#include <stdio.h>],
 
438
            [ printf("Hello World\n"); ],,
 
439
            AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
 
440
 
 
441
        AC_LANG_CPLUSPLUS
 
442
        AC_TRY_COMPILE([#include <new.h>],
 
443
            [ unsigned *test = new unsigned(42); ],,
 
444
            AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
 
445
        AC_LANG_RESTORE
 
446
 
 
447
        changequote(,)
 
448
        _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
 
449
        changequote([,])
 
450
 
 
451
        # Determine compiler version
 
452
        CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
 
453
        _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
 
454
        _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
 
455
        _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
 
456
        _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
 
457
        _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
 
458
 
 
459
        CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
 
460
        _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
 
461
 
 
462
        if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
 
463
            AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
 
464
        fi
 
465
 
 
466
        if test "$_CC_MAJOR_VERSION" = "14"; then
 
467
            dnl Require VC8SP1 or newer.
 
468
            dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
 
469
            if test "$_CC_RELEASE" -lt 50727 -o \
 
470
                    \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
 
471
              AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
 
472
            fi
 
473
 
 
474
            _CC_SUITE=8
 
475
            _MSVS_VERSION=2005
 
476
            AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
 
477
            AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
 
478
        elif test "$_CC_MAJOR_VERSION" = "15"; then
 
479
            _CC_SUITE=9
 
480
            _MSVS_VERSION=2008
 
481
            AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
 
482
            AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
 
483
        elif test "$_CC_MAJOR_VERSION" = "16"; then
 
484
            _CC_SUITE=10
 
485
            _MSVS_VERSION=2010
 
486
            AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
 
487
            AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
 
488
        elif test "$_CC_MAJOR_VERSION" = "17"; then
 
489
            _CC_SUITE=11
 
490
            _MSVS_VERSION=2012
 
491
            AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
 
492
            AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
 
493
        else
 
494
            AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
 
495
        fi
 
496
 
 
497
        AC_DEFINE(HAVE_SEH_EXCEPTIONS)
 
498
 
 
499
        if test -n "$WIN32_REDIST_DIR"; then
 
500
          if test ! -d "$WIN32_REDIST_DIR"; then
 
501
            AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
 
502
          fi
 
503
          WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
 
504
        fi
 
505
 
 
506
        dnl Confirm we have the pri tools on win8 builds
 
507
        if test -n "$MOZ_METRO"; then
 
508
          AC_MSG_CHECKING([for makepri])
 
509
          AC_CHECK_PROGS(MAKEPRI, makepri, "")
 
510
          if test -z "MAKEPRI" ; then
 
511
              AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
 
512
          fi
 
513
          AC_SUBST(MAKEPRI)
 
514
        fi
 
515
 
 
516
        dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
 
517
        dnl not something else like "magnetic tape manipulation utility".
 
518
        MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
 
519
        if test -z "$MSMT_TOOL"; then
 
520
          AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
 
521
        fi
 
522
 
 
523
        changequote(,)
 
524
        _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
 
525
        changequote([,])
 
526
        MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
 
527
        if test -z "$MSMANIFEST_TOOL_VERSION"; then
 
528
          AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
 
529
        fi
 
530
 
 
531
        MSMANIFEST_TOOL=1
 
532
        unset MSMT_TOOL
 
533
 
 
534
        # Check linker version
 
535
        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
 
536
        _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
 
537
        if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
 
538
            AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
 
539
        fi
 
540
 
 
541
        INCREMENTAL_LINKER=1
 
542
 
 
543
        # Check midl version
 
544
        _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
 
545
        _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
 
546
        _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
 
547
        _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
 
548
        # Add flags if necessary
 
549
        AC_MSG_CHECKING([for midl flags])
 
550
        case "$target" in
 
551
        i*86-*)
 
552
            if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
 
553
                # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
 
554
                # MIDL version 7.00.0500 or later has no problem.
 
555
                MIDL_FLAGS="${MIDL_FLAGS} -env win32"
 
556
                AC_MSG_RESULT([need -env win32])
 
557
            else
 
558
                AC_MSG_RESULT([none needed])
 
559
            fi
 
560
            ;;
 
561
        x86_64-*)
 
562
            MIDL_FLAGS="${MIDL_FLAGS} -env x64"
 
563
            ;;
 
564
        *)
 
565
            AC_MSG_RESULT([none needed])
 
566
            ;;
 
567
        esac
 
568
 
 
569
        # Identify which version of the SDK we're building with
 
570
        # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
 
571
        # from there
 
572
        MOZ_CHECK_HEADERS([winsdkver.h])
 
573
        if test "$ac_cv_header_winsdkver_h" = "yes"; then
 
574
            # Get the highest _WIN32_WINNT and NTDDI versions supported
 
575
            # Take the higher of the two
 
576
            # This is done because the Windows 7 beta SDK reports its
 
577
            # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
 
578
            AC_CACHE_CHECK(for highest Windows version supported by this SDK,
 
579
                           ac_cv_winsdk_maxver,
 
580
                           [cat > conftest.h <<EOF
 
581
#include <winsdkver.h>
 
582
#include <sdkddkver.h>
 
583
 
 
584
#if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
 
585
#define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
 
586
#else
 
587
#define WINSDK_MAXVER NTDDI_MAXVER
 
588
#endif
 
589
 
 
590
WINSDK_MAXVER
 
591
EOF
 
592
                            ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
 
593
                            rm -f conftest.h
 
594
                           ])
 
595
            MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
 
596
        else
 
597
            # Any SDK which doesn't have WinSDKVer.h is too old.
 
598
            AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
 
599
        fi
 
600
 
 
601
        unset _MSVC_VER_FILTER
 
602
 
 
603
        AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
 
604
            [
 
605
                AC_LANG_SAVE
 
606
                AC_LANG_CPLUSPLUS
 
607
                _SAVE_CXXFLAGS="$CXXFLAGS"
 
608
                CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
 
609
                AC_TRY_COMPILE([#include <exception>],
 
610
                            [std::_Throw(std::exception()); return 0;],
 
611
                            ac_cv_have_std__Throw="yes",
 
612
                            ac_cv_have_std__Throw="no")
 
613
                CXXFLAGS="$_SAVE_CXXFLAGS"
 
614
                AC_LANG_RESTORE
 
615
            ])
 
616
 
 
617
        if test "$ac_cv_have_std__Throw" = "yes"; then
 
618
            AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
 
619
                           ac_cv_have_dllimport_exception_bug,
 
620
                [
 
621
                    AC_LANG_SAVE
 
622
                    AC_LANG_CPLUSPLUS
 
623
                    _SAVE_CXXFLAGS="$CXXFLAGS"
 
624
                    CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
 
625
                    AC_TRY_LINK([#include <vector>],
 
626
                                [std::vector<int> v; return v.at(1);],
 
627
                                ac_cv_have_dllimport_exception_bug="no",
 
628
                                ac_cv_have_dllimport_exception_bug="yes")
 
629
                    CXXFLAGS="$_SAVE_CXXFLAGS"
 
630
                    AC_LANG_RESTORE
 
631
                ])
 
632
            if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
 
633
                WRAP_STL_INCLUDES=1
 
634
                MOZ_MSVC_STL_WRAP__Throw=1
 
635
                AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
 
636
            fi
 
637
        else
 
638
            AC_CACHE_CHECK(for overridable _RAISE,
 
639
                           ac_cv_have__RAISE,
 
640
                [
 
641
                    AC_LANG_SAVE
 
642
                    AC_LANG_CPLUSPLUS
 
643
                    _SAVE_CXXFLAGS="$CXXFLAGS"
 
644
                    CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
 
645
                    AC_TRY_COMPILE([#include <xstddef>
 
646
                                    #undef _RAISE
 
647
                                    #define _RAISE(x) externallyDefinedFunction((x).what())
 
648
                                    #include <vector>
 
649
                                   ],
 
650
                                   [std::vector<int> v; return v.at(1);],
 
651
                                   ac_cv_have__RAISE="no",
 
652
                                   ac_cv_have__RAISE="yes")
 
653
                    CXXFLAGS="$_SAVE_CXXFLAGS"
 
654
                    AC_LANG_RESTORE
 
655
                ])
 
656
            if test "$ac_cv_have__RAISE" = "yes"; then
 
657
                WRAP_STL_INCLUDES=1
 
658
                MOZ_MSVC_STL_WRAP__RAISE=1
 
659
                AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
 
660
            else
 
661
                AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
 
662
            fi
 
663
        fi
 
664
 
 
665
        if test "$WRAP_STL_INCLUDES" = "1"; then
 
666
            STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
 
667
        fi
 
668
    else
 
669
        # Check w32api version
 
670
        _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
 
671
        _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
 
672
        AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
 
673
        AC_TRY_COMPILE([#include <w32api.h>],
 
674
            #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
 
675
                (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
 
676
                 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
 
677
                #error "test failed."
 
678
            #endif
 
679
            , [ res=yes ], [ res=no ])
 
680
        AC_MSG_RESULT([$res])
 
681
        if test "$res" != "yes"; then
 
682
            AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
 
683
        fi
 
684
        # Check windres version
 
685
        AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
 
686
        _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
 
687
        AC_MSG_RESULT([$_WINDRES_VERSION])
 
688
        _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
 
689
        _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
 
690
        _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
 
691
        WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
 
692
        WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
 
693
        WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
 
694
        if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
 
695
                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
 
696
                "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
 
697
                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
 
698
                "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
 
699
                "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
 
700
        then
 
701
            AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
 
702
        fi
 
703
 
 
704
        MOZ_WINSDK_MAXVER=0x06020000
 
705
    fi # !GNU_CC
 
706
 
 
707
    AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
 
708
    AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
 
709
    # Require OS features provided by IE 6.0 SP2 (XP SP2)
 
710
    AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
 
711
 
 
712
    # If the maximum version supported by this SDK is lower than the target
 
713
    # version, error out
 
714
    AC_MSG_CHECKING([for Windows SDK being recent enough])
 
715
    if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
 
716
        AC_MSG_RESULT("yes")
 
717
    else
 
718
        AC_MSG_RESULT("no")
 
719
        AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
 
720
    fi
 
721
    
 
722
    # Make sure the sdk / code we're targeting has the right toolset
 
723
    AC_MSG_CHECKING([SDK and tools are in sync])
 
724
    if test -n "$MOZ_METRO"; then
 
725
      if test "$MOZ_MSVCVERSION" -gt "10"; then
 
726
        AC_MSG_RESULT("yes")
 
727
      else
 
728
        AC_MSG_RESULT("no")
 
729
        AC_MSG_ERROR([Your MOZ_MSVCVERSION equals $MOZ_MSVCVERSION and you've enabled metro build support. You can't target metro without msvc 11 or higher. Disable metro support or switch to a newer set of tools.])
 
730
      fi
 
731
    fi
 
732
      
 
733
    AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
 
734
    # Definitions matching sdkddkver.h
 
735
    AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
 
736
    ;;
 
737
esac
 
738
 
 
739
AC_PROG_CPP
 
740
AC_PROG_CXXCPP
 
741
 
 
742
if test -n "$_WIN32_MSVC"; then
 
743
    SKIP_PATH_CHECKS=1
 
744
    SKIP_COMPILER_CHECKS=1
 
745
    SKIP_LIBRARY_CHECKS=1
 
746
 
 
747
    # Since we're skipping compiler and library checks, hard-code
 
748
    # some facts here.
 
749
    AC_DEFINE(HAVE_IO_H)
 
750
    AC_DEFINE(HAVE_SETBUF)
 
751
    AC_DEFINE(HAVE_ISATTY)
 
752
    if test $_MSC_VER -ge 1600; then
 
753
        AC_DEFINE(HAVE_NULLPTR)
 
754
    fi
 
755
fi
 
756
 
 
757
fi # COMPILE_ENVIRONMENT
 
758
 
 
759
AC_SUBST(MIDL_FLAGS)
 
760
AC_SUBST(_MSC_VER)
 
761
 
 
762
AC_SUBST(GNU_AS)
 
763
AC_SUBST(GNU_LD)
 
764
AC_SUBST(GNU_CC)
 
765
AC_SUBST(GNU_CXX)
 
766
AC_SUBST(INTEL_CC)
 
767
AC_SUBST(INTEL_CXX)
 
768
 
 
769
AC_SUBST(STL_FLAGS)
 
770
AC_SUBST(WRAP_STL_INCLUDES)
 
771
AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
 
772
AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
 
773
 
 
774
dnl ========================================================
 
775
dnl Checks for programs.
 
776
dnl ========================================================
 
777
AC_PROG_INSTALL
 
778
AC_PROG_LN_S
 
779
 
 
780
if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
 
781
AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
 
782
_perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
 
783
_perl_res=$?
 
784
AC_MSG_RESULT([$_perl_version])
 
785
 
 
786
if test "$_perl_res" != 0; then
 
787
    AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
 
788
fi
 
789
fi
 
790
 
 
791
AC_MSG_CHECKING([for full perl installation])
 
792
_perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
 
793
_perl_res=$?
 
794
if test "$_perl_res" != 0; then
 
795
    AC_MSG_RESULT([no])
 
796
    AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
 
797
else
 
798
    AC_MSG_RESULT([yes])
 
799
fi
 
800
 
 
801
MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
 
802
if test -z "$PYTHON"; then
 
803
    AC_MSG_ERROR([python was not found in \$PATH])
 
804
fi
 
805
 
 
806
MOZ_ARG_WITH_BOOL(system-ply,
 
807
[  --with-system-ply       Use system installed python ply library],
 
808
    [if $PYTHON -c 'import ply' 2>&5; then
 
809
         MOZ_SYSTEM_PLY=1
 
810
     else
 
811
         AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
 
812
     fi])
 
813
 
 
814
AC_SUBST(MOZ_SYSTEM_PLY)
 
815
 
 
816
if test -z "$COMPILE_ENVIRONMENT"; then
 
817
    NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
 
818
fi
 
819
AC_SUBST(NSINSTALL_BIN)
 
820
 
 
821
MOZ_PATH_PROG(DOXYGEN, doxygen, :)
 
822
MOZ_PATH_PROG(AUTOCONF, autoconf, :)
 
823
MOZ_PATH_PROGS(UNZIP, unzip)
 
824
if test -z "$UNZIP" -o "$UNZIP" = ":"; then
 
825
    AC_MSG_ERROR([unzip not found in \$PATH])
 
826
fi
 
827
MOZ_PATH_PROGS(ZIP, zip)
 
828
if test -z "$ZIP" -o "$ZIP" = ":"; then
 
829
    AC_MSG_ERROR([zip not found in \$PATH])
 
830
fi
 
831
MOZ_PATH_PROG(MOZ_NATIVE_MAKEDEPEND, makedepend)
 
832
MOZ_PATH_PROG(XARGS, xargs)
 
833
if test -z "$XARGS" -o "$XARGS" = ":"; then
 
834
    AC_MSG_ERROR([xargs not found in \$PATH .])
 
835
fi
 
836
 
 
837
MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
 
838
AC_SUBST(RPMBUILD)
 
839
 
 
840
if test "$COMPILE_ENVIRONMENT"; then
 
841
 
 
842
dnl ========================================================
 
843
dnl = Mac OS X toolchain support
 
844
dnl ========================================================
 
845
 
 
846
case "$target_os" in
 
847
darwin*)
 
848
    dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
 
849
    dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
 
850
    dnl the environment and includedir purposes (when using an SDK, below),
 
851
    dnl but remember the full version number for the libdir (SDK).
 
852
    changequote(,)
 
853
    GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
 
854
    GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
 
855
    changequote([,])
 
856
    if test "$GCC_VERSION_FULL" = "4.0.0" ; then
 
857
        dnl Bug 280479, but this keeps popping up in bug 292530 too because
 
858
        dnl 4.0.0/4061 is the default compiler in Tiger.
 
859
        changequote(,)
 
860
        GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
 
861
        changequote([,])
 
862
        if test "$GCC_BUILD" = "4061" ; then
 
863
            AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
 
864
This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
 
865
from building Mozilla. Upgrade to Xcode 2.1 or later.])
 
866
        fi
 
867
    fi
 
868
 
 
869
    dnl xcodebuild needs GCC_VERSION defined in the environment, since it
 
870
    dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
 
871
    dnl /usr/bin/g(cc|++)-$GCC_VERSION.
 
872
    MOZ_PATH_PROGS(PBBUILD_BIN, pbbuild xcodebuild pbxbuild)
 
873
 
 
874
    dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
 
875
    dnl it has moved into /usr/bin.
 
876
    MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
 
877
    ;;
 
878
esac
 
879
 
 
880
AC_SUBST(GCC_VERSION)
 
881
 
 
882
dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
 
883
dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
 
884
dnl when we can run target binaries.
 
885
AC_SUBST(UNIVERSAL_BINARY)
 
886
AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
 
887
 
 
888
dnl ========================================================
 
889
dnl Check for MacOS deployment target version
 
890
dnl ========================================================
 
891
 
 
892
MOZ_ARG_ENABLE_STRING(macos-target,
 
893
                      [  --enable-macos-target=VER (default=10.6)
 
894
                          Set the minimum MacOS version needed at runtime],
 
895
                      [_MACOSX_DEPLOYMENT_TARGET=$enableval])
 
896
 
 
897
case "$target" in
 
898
*-darwin*)
 
899
    if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
 
900
        dnl Use the specified value
 
901
        export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
 
902
    else
 
903
        dnl No value specified on the command line or in the environment,
 
904
        dnl use architecture minimum.
 
905
        export MACOSX_DEPLOYMENT_TARGET=10.6
 
906
    fi
 
907
    ;;
 
908
esac
 
909
 
 
910
AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
 
911
 
 
912
dnl ========================================================
 
913
dnl = Mac OS X SDK support
 
914
dnl ========================================================
 
915
MACOS_SDK_DIR=
 
916
NEXT_ROOT=
 
917
MOZ_ARG_WITH_STRING(macos-sdk,
 
918
[  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
 
919
    MACOS_SDK_DIR=$withval)
 
920
 
 
921
dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
 
922
dnl NEXT_ROOT will be set and exported only if it's needed.
 
923
AC_SUBST(MACOS_SDK_DIR)
 
924
AC_SUBST(NEXT_ROOT)
 
925
 
 
926
if test "$MACOS_SDK_DIR"; then
 
927
  dnl Sync this section with the ones in NSPR and NSS.
 
928
  dnl Changes to the cross environment here need to be accounted for in
 
929
  dnl the libIDL checks (below) and xpidl build.
 
930
 
 
931
  if test ! -d "$MACOS_SDK_DIR"; then
 
932
    AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
 
933
specify a valid SDK.  SDKs are installed when the optional cross-development
 
934
tools are selected during the Xcode/Developer Tools installation.])
 
935
  fi
 
936
 
 
937
  GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
 
938
  if test "$GCC_VERSION_MAJOR" -lt "4" ; then
 
939
    AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
 
940
  else
 
941
    CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
 
942
    CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
 
943
 
 
944
    dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
 
945
    CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
 
946
    CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
 
947
 
 
948
    if test "$GCC_VERSION_FULL" = "4.0.0" ; then
 
949
      dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
 
950
      dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
 
951
      dnl be ignored and cause warnings when -syslibroot is specified.
 
952
      dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
 
953
      dnl the -isysroot it receives, so this is only needed with 4.0.0.
 
954
      LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
 
955
    fi
 
956
  fi
 
957
 
 
958
  AC_LANG_SAVE
 
959
  AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
 
960
  AC_LANG_CPLUSPLUS
 
961
  AC_TRY_COMPILE([#include <new>],[],
 
962
   result=yes,
 
963
   result=no)
 
964
  AC_LANG_RESTORE
 
965
  AC_MSG_RESULT($result)
 
966
 
 
967
  if test "$result" = "no" ; then
 
968
    AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
 
969
  fi
 
970
fi
 
971
 
 
972
fi # COMPILE_ENVIRONMENT
 
973
 
 
974
AC_MSG_CHECKING([compiler version])
 
975
# Just print it so it shows up in the logs.
 
976
cc_version=$($CC --version)
 
977
AC_MSG_RESULT([$cc_version])
 
978
 
 
979
if test -n "$MAKE"; then
 
980
  if test `echo $MAKE | grep -c make.py` != 1; then
 
981
     NOT_PYMAKE=$MAKE
 
982
  fi
 
983
fi
 
984
 
 
985
case "$host_os" in
 
986
mingw*)
 
987
    MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
 
988
    ;;
 
989
*)
 
990
    MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
 
991
    ;;
 
992
esac
 
993
if test "$GMAKE" = ":"; then
 
994
   AC_MSG_ERROR([GNU make not found])
 
995
fi
 
996
AC_SUBST(GMAKE)
 
997
 
 
998
if test -z "$MAKE"; then
 
999
  MAKE=$GMAKE
 
1000
fi
 
1001
 
 
1002
if test "$COMPILE_ENVIRONMENT"; then
 
1003
 
 
1004
AC_PATH_XTRA
 
1005
 
 
1006
XCFLAGS="$X_CFLAGS"
 
1007
 
 
1008
fi # COMPILE_ENVIRONMENT
 
1009
 
 
1010
dnl ========================================================
 
1011
dnl set the defaults first
 
1012
dnl ========================================================
 
1013
AS_BIN=$AS
 
1014
AR_LIST='$(AR) t'
 
1015
AR_EXTRACT='$(AR) x'
 
1016
AR_DELETE='$(AR) d'
 
1017
AS='$(CC)'
 
1018
AS_DASH_C_FLAG='-c'
 
1019
DLL_PREFIX=lib
 
1020
LIB_PREFIX=lib
 
1021
DLL_SUFFIX=.so
 
1022
OBJ_SUFFIX=o
 
1023
LIB_SUFFIX=a
 
1024
ASM_SUFFIX=s
 
1025
IMPORT_LIB_SUFFIX=
 
1026
TARGET_MD_ARCH=unix
 
1027
DIRENT_INO=d_ino
 
1028
MOZ_USER_DIR=".mozilla"
 
1029
 
 
1030
MOZ_JPEG_CFLAGS=
 
1031
MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
 
1032
MOZ_BZ2_CFLAGS=
 
1033
MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
 
1034
MOZ_PNG_CFLAGS=
 
1035
MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
 
1036
 
 
1037
MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
 
1038
MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
 
1039
DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
 
1040
MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
 
1041
XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
 
1042
LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
 
1043
XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
 
1044
XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
 
1045
 
 
1046
# These are specially defined on Windows only
 
1047
case "$target" in
 
1048
*-mingw*)
 
1049
  XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
 
1050
  XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
 
1051
  ;;
 
1052
*)
 
1053
  XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
 
1054
  XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
 
1055
  ;;
 
1056
esac
 
1057
 
 
1058
MOZ_FS_LAYOUT=unix
 
1059
 
 
1060
MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
 
1061
 
 
1062
USE_DEPENDENT_LIBS=1
 
1063
 
 
1064
_PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
 
1065
 
 
1066
if test -n "$CROSS_COMPILE"; then
 
1067
    OS_TARGET="${target_os}"
 
1068
    OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
 
1069
    OS_RELEASE=
 
1070
    case "${target_os}" in
 
1071
        linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
 
1072
        kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
 
1073
        gnu*)         OS_ARCH=GNU ;;
 
1074
        solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
 
1075
        mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
 
1076
        darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
 
1077
    esac
 
1078
    case "${target}" in
 
1079
        *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
 
1080
    esac
 
1081
else
 
1082
    OS_TARGET=`uname -s`
 
1083
    OS_ARCH=`uname -s | sed -e 's|/|_|g'`
 
1084
    OS_RELEASE=`uname -r`
 
1085
fi
 
1086
 
 
1087
# Before this used `uname -m` when not cross compiling
 
1088
# but that breaks when you have a 64 bit kernel with a 32 bit userland.
 
1089
OS_TEST="${target_cpu}"
 
1090
 
 
1091
HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
 
1092
 
 
1093
#######################################################################
 
1094
# Master "Core Components" macros for getting the OS target           #
 
1095
#######################################################################
 
1096
 
 
1097
#
 
1098
# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
 
1099
# cross-compilation.
 
1100
#
 
1101
 
 
1102
#
 
1103
# Define and override various archtecture-specific variables, including
 
1104
# HOST_OS_ARCH
 
1105
# OS_ARCH
 
1106
# OS_TEST
 
1107
# OS_TARGET
 
1108
# OS_RELEASE
 
1109
# OS_MINOR_RELEASE
 
1110
#
 
1111
 
 
1112
case "$HOST_OS_ARCH" in
 
1113
mingw*)
 
1114
    HOST_OS_ARCH=WINNT
 
1115
    ;;
 
1116
darwin*)
 
1117
    HOST_OS_ARCH=Darwin
 
1118
    ;;
 
1119
linux*)
 
1120
    HOST_OS_ARCH=Linux
 
1121
    ;;
 
1122
solaris*)
 
1123
    HOST_OS_ARCH=SunOS
 
1124
    SOLARIS_SUNPRO_CC=
 
1125
    SOLARIS_SUNPRO_CXX=
 
1126
    if test -z "$GNU_CC"; then
 
1127
        if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
 
1128
            SOLARIS_SUNPRO_CC=1
 
1129
       fi
 
1130
    fi
 
1131
 
 
1132
    if test -z "$GNU_CXX"; then
 
1133
       if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
 
1134
           SOLARIS_SUNPRO_CXX=1
 
1135
       fi
 
1136
    fi
 
1137
    AC_SUBST(SOLARIS_SUNPRO_CC)
 
1138
    AC_SUBST(SOLARIS_SUNPRO_CXX)
 
1139
    ;;
 
1140
BSD_386)
 
1141
    HOST_OS_ARCH=BSD
 
1142
    ;;
 
1143
OS_2)
 
1144
    HOST_OS_ARCH=OS2
 
1145
    ;;
 
1146
esac
 
1147
 
 
1148
case "$OS_ARCH" in
 
1149
WINNT)
 
1150
    if test -z "$CROSS_COMPILE" ; then
 
1151
        OS_TEST=`uname -p`
 
1152
    fi
 
1153
    ;;
 
1154
Windows_NT)
 
1155
#
 
1156
# If uname -s returns "Windows_NT", we assume that we are using
 
1157
# the uname.exe in MKS toolkit.
 
1158
#
 
1159
# The -r option of MKS uname only returns the major version number.
 
1160
# So we need to use its -v option to get the minor version number.
 
1161
# Moreover, it doesn't have the -p option, so we need to use uname -m.
 
1162
#
 
1163
    OS_ARCH=WINNT
 
1164
    OS_TARGET=WINNT
 
1165
    OS_MINOR_RELEASE=`uname -v`
 
1166
    if test "$OS_MINOR_RELEASE" = "00"; then
 
1167
        OS_MINOR_RELEASE=0
 
1168
    fi
 
1169
    OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
 
1170
    ;;
 
1171
MINGW*_NT*)
 
1172
#
 
1173
# If uname -s returns MINGW32_NT-5.1, we assume that we are using
 
1174
# the uname.exe in the MSYS tools.
 
1175
#
 
1176
    OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
 
1177
    OS_ARCH=WINNT
 
1178
    OS_TARGET=WINNT
 
1179
    ;;
 
1180
AIX)
 
1181
    OS_RELEASE=`uname -v`.`uname -r`
 
1182
    OS_TEST=${target_cpu}
 
1183
    ;;
 
1184
BSD_386)
 
1185
    OS_ARCH=BSD
 
1186
    ;;
 
1187
OS_2)
 
1188
    OS_ARCH=OS2
 
1189
    OS_TARGET=OS2
 
1190
    OS_RELEASE=`uname -v`
 
1191
    ;;
 
1192
Darwin)
 
1193
    case "${target_cpu}" in
 
1194
    powerpc*)
 
1195
        OS_TEST=ppc
 
1196
        ;;
 
1197
    i*86*)
 
1198
        OS_TEST=i386
 
1199
        ;;
 
1200
    x86_64)
 
1201
        OS_TEST=x86_64
 
1202
        ;;
 
1203
    *)
 
1204
        if test -z "$CROSS_COMPILE" ; then
 
1205
            OS_TEST=`uname -p`
 
1206
        fi
 
1207
        ;;
 
1208
    esac
 
1209
    ;;
 
1210
esac
 
1211
 
 
1212
# Only set CPU_ARCH if we recognize the value of OS_TEST
 
1213
 
 
1214
case "$OS_TEST" in
 
1215
*86 | i86pc)
 
1216
    CPU_ARCH=x86
 
1217
    ;;
 
1218
 
 
1219
powerpc64 | ppc64)
 
1220
    CPU_ARCH=ppc64
 
1221
    ;;
 
1222
 
 
1223
powerpc | ppc | rs6000)
 
1224
    CPU_ARCH=ppc
 
1225
    ;;
 
1226
 
 
1227
Alpha | alpha | ALPHA)
 
1228
    CPU_ARCH=Alpha
 
1229
    ;;
 
1230
 
 
1231
s390)
 
1232
    CPU_ARCH=s390
 
1233
    ;;
 
1234
 
 
1235
s390x)
 
1236
    CPU_ARCH=s390x
 
1237
    ;;
 
1238
 
 
1239
hppa* | parisc)
 
1240
    CPU_ARCH=hppa
 
1241
    ;;
 
1242
 
 
1243
sun4u | sparc*)
 
1244
    CPU_ARCH=sparc
 
1245
    ;;
 
1246
 
 
1247
x86_64 | ia64)
 
1248
    CPU_ARCH="$OS_TEST"
 
1249
    ;;
 
1250
 
 
1251
arm*)
 
1252
    CPU_ARCH=arm
 
1253
    ;;
 
1254
 
 
1255
mips|mipsel)
 
1256
    CPU_ARCH="mips"
 
1257
    ;;
 
1258
esac
 
1259
 
 
1260
if test -z "$OS_TARGET"; then
 
1261
    OS_TARGET=$OS_ARCH
 
1262
fi
 
1263
OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
 
1264
 
 
1265
dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
 
1266
dnl ===============================================================
 
1267
INTEL_ARCHITECTURE=
 
1268
case "$OS_TEST" in
 
1269
    x86_64|i?86)
 
1270
      INTEL_ARCHITECTURE=1
 
1271
esac
 
1272
 
 
1273
dnl Configure platform-specific CPU architecture compiler options.
 
1274
dnl ==============================================================
 
1275
MOZ_ARCH_OPTS
 
1276
 
 
1277
dnl =================================================================
 
1278
dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
 
1279
dnl which is bad when cross compiling.
 
1280
dnl =================================================================
 
1281
if test "$COMPILE_ENVIRONMENT"; then
 
1282
configure_static_assert_macros='
 
1283
#define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
 
1284
#define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
 
1285
#define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
 
1286
'
 
1287
 
 
1288
dnl test that the macros actually work:
 
1289
AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
 
1290
AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
 
1291
 [AC_LANG_SAVE
 
1292
  AC_LANG_C
 
1293
  ac_cv_static_assertion_macros_work="yes"
 
1294
  AC_TRY_COMPILE([$configure_static_assert_macros],
 
1295
                 [CONFIGURE_STATIC_ASSERT(1)],
 
1296
                 ,
 
1297
                 ac_cv_static_assertion_macros_work="no")
 
1298
  AC_TRY_COMPILE([$configure_static_assert_macros],
 
1299
                 [CONFIGURE_STATIC_ASSERT(0)],
 
1300
                 ac_cv_static_assertion_macros_work="no",
 
1301
                 )
 
1302
  AC_LANG_CPLUSPLUS
 
1303
  AC_TRY_COMPILE([$configure_static_assert_macros],
 
1304
                 [CONFIGURE_STATIC_ASSERT(1)],
 
1305
                 ,
 
1306
                 ac_cv_static_assertion_macros_work="no")
 
1307
  AC_TRY_COMPILE([$configure_static_assert_macros],
 
1308
                 [CONFIGURE_STATIC_ASSERT(0)],
 
1309
                 ac_cv_static_assertion_macros_work="no",
 
1310
                 )
 
1311
  AC_LANG_RESTORE
 
1312
 ])
 
1313
AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
 
1314
if test "$ac_cv_static_assertion_macros_work" = "no"; then
 
1315
    AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
 
1316
fi
 
1317
fi # COMPILE_ENVIRONMENT
 
1318
 
 
1319
dnl ========================================================
 
1320
dnl Android libstdc++, placed here so it can use MOZ_ARCH
 
1321
dnl computed above.
 
1322
dnl ========================================================
 
1323
 
 
1324
MOZ_ANDROID_STLPORT
 
1325
 
 
1326
dnl ========================================================
 
1327
dnl Suppress Clang Argument Warnings
 
1328
dnl ========================================================
 
1329
if test -n "$CLANG_CC"; then
 
1330
    _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
 
1331
    CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
 
1332
fi
 
1333
if test -n "$CLANG_CXX"; then
 
1334
    _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
 
1335
fi
 
1336
 
 
1337
dnl ========================================================
 
1338
dnl = Use Address Sanitizer
 
1339
dnl ========================================================
 
1340
MOZ_ARG_ENABLE_BOOL(address-sanitizer,
 
1341
[  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
 
1342
    MOZ_ASAN=1,
 
1343
    MOZ_ASAN= )
 
1344
if test -n "$MOZ_ASAN"; then
 
1345
    MOZ_LLVM_HACKS=1
 
1346
    AC_DEFINE(MOZ_ASAN)
 
1347
fi
 
1348
AC_SUBST(MOZ_ASAN)
 
1349
 
 
1350
dnl ========================================================
 
1351
dnl = Enable hacks required for LLVM instrumentations
 
1352
dnl ========================================================
 
1353
MOZ_ARG_ENABLE_BOOL(llvm-hacks,
 
1354
[  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
 
1355
    MOZ_LLVM_HACKS=1,
 
1356
    MOZ_LLVM_HACKS= )
 
1357
if test -n "$MOZ_LLVM_HACKS"; then
 
1358
    MOZ_NO_WLZDEFS=1
 
1359
    MOZ_CFLAGS_NSS=1
 
1360
fi
 
1361
AC_SUBST(MOZ_NO_WLZDEFS)
 
1362
AC_SUBST(MOZ_CFLAGS_NSS)
 
1363
 
 
1364
dnl ========================================================
 
1365
dnl GNU specific defaults
 
1366
dnl ========================================================
 
1367
if test "$GNU_CC"; then
 
1368
    # FIXME: Let us build with strict aliasing. bug 414641.
 
1369
    CFLAGS="$CFLAGS -fno-strict-aliasing"
 
1370
    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
 
1371
    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
 
1372
    DSO_LDOPTS='-shared'
 
1373
    if test "$GCC_USE_GNU_LD"; then
 
1374
        # Some tools like ASan use a runtime library that is only
 
1375
        # linked against executables, so we must allow undefined
 
1376
        # symbols for shared objects in some cases.
 
1377
        if test -z "$MOZ_NO_WLZDEFS"; then
 
1378
            # Don't allow undefined symbols in libraries
 
1379
            DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
 
1380
        fi
 
1381
    fi
 
1382
    WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
 
1383
    DSO_CFLAGS=''
 
1384
    DSO_PIC_CFLAGS='-fPIC'
 
1385
    ASFLAGS="$ASFLAGS -fPIC"
 
1386
    AC_MSG_CHECKING([for --noexecstack option to as])
 
1387
    _SAVE_CFLAGS=$CFLAGS
 
1388
    CFLAGS="$CFLAGS -Wa,--noexecstack"
 
1389
    AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
 
1390
                     [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
 
1391
                     AC_MSG_RESULT([no]))
 
1392
    CFLAGS=$_SAVE_CFLAGS
 
1393
    AC_MSG_CHECKING([for -z noexecstack option to ld])
 
1394
    _SAVE_LDFLAGS=$LDFLAGS
 
1395
    LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
 
1396
    AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
 
1397
                  AC_MSG_RESULT([no])
 
1398
                  LDFLAGS=$_SAVE_LDFLAGS)
 
1399
 
 
1400
    # Check for -mssse3 on $CC
 
1401
    AC_MSG_CHECKING([for -mssse3 option to $CC])
 
1402
    HAVE_COMPILER_FLAG_MSSSE3=
 
1403
    _SAVE_CFLAGS=$CFLAGS
 
1404
    CFLAGS="$CFLAGS -mssse3"
 
1405
    AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
 
1406
                     [HAVE_COMPILER_FLAG_MSSSE3=1],
 
1407
                     AC_MSG_RESULT([no]))
 
1408
    CFLAGS=$_SAVE_CFLAGS
 
1409
    AC_SUBST(HAVE_COMPILER_FLAG_MSSSE3)
 
1410
 
 
1411
    # Turn on GNU-specific warnings:
 
1412
    # -Wall - turn on a lot of warnings
 
1413
    # -pedantic - this is turned on below
 
1414
    # -Wpointer-arith - enabled with -pedantic, but good to have even if not
 
1415
    # -Wdeclaration-after-statement - MSVC doesn't like these
 
1416
    # -Werror=return-type - catches missing returns, zero false positives
 
1417
    # -Wtype-limits - catches overflow bugs, few false positives
 
1418
    # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
 
1419
    #
 
1420
    _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
 
1421
    MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
 
1422
    MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
 
1423
    MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
 
1424
    
 
1425
    # Turn off the following warnings that -Wall/-pedantic turn on:
 
1426
    # -Wno-unused - lots of violations in third-party code
 
1427
    # -Wno-overlength-strings - we exceed the minimum maximum length frequently
 
1428
    #
 
1429
    _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
 
1430
    MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
 
1431
 
 
1432
    if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
 
1433
       # Don't use -Wcast-align with ICC or clang
 
1434
       case "$CPU_ARCH" in
 
1435
           # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
 
1436
           hppa | ia64 | sparc | arm)
 
1437
           ;;
 
1438
           *)
 
1439
        _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
 
1440
           ;;
 
1441
       esac
 
1442
    fi
 
1443
 
 
1444
    dnl Turn pedantic on but disable the warnings for long long
 
1445
    _PEDANTIC=1
 
1446
 
 
1447
    _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
 
1448
    _USE_CPP_INCLUDE_FLAG=1
 
1449
 
 
1450
elif test "$SOLARIS_SUNPRO_CC"; then
 
1451
    DSO_CFLAGS=''
 
1452
    if test "$CPU_ARCH" = "sparc"; then
 
1453
        # for Sun Studio on Solaris/SPARC
 
1454
        DSO_PIC_CFLAGS='-xcode=pic32'
 
1455
    else
 
1456
        DSO_PIC_CFLAGS='-KPIC'
 
1457
    fi
 
1458
    _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
 
1459
else
 
1460
    MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
 
1461
    MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
 
1462
 
 
1463
    DSO_LDOPTS='-shared'
 
1464
    if test "$GNU_LD"; then
 
1465
        # Don't allow undefined symbols in libraries
 
1466
        DSO_LDOPTS="$DSO_LDOPTS -z defs"
 
1467
    fi
 
1468
 
 
1469
    DSO_CFLAGS=''
 
1470
    DSO_PIC_CFLAGS='-KPIC'
 
1471
    _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
 
1472
fi
 
1473
 
 
1474
if test "$GNU_CXX"; then
 
1475
    # FIXME: Let us build with strict aliasing. bug 414641.
 
1476
    CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
 
1477
 
 
1478
    # Turn on GNU-specific warnings:
 
1479
    # -Wall - turn on a lot of warnings
 
1480
    # -pedantic - this is turned on below
 
1481
    # -Wpointer-arith - enabled with -pedantic, but good to have even if not
 
1482
    # -Woverloaded-virtual - ???
 
1483
    # -Werror=return-type - catches missing returns, zero false positives
 
1484
    # -Wtype-limits - catches overflow bugs, few false positives
 
1485
    # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
 
1486
    #
 
1487
    _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
 
1488
    MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
 
1489
    MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
 
1490
    MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
 
1491
 
 
1492
    # Turn off the following warnings that -Wall/-pedantic turn on:
 
1493
    # -Wno-ctor-dtor-privacy - ???
 
1494
    # -Wno-overlength-strings - we exceed the minimum maximum length frequently 
 
1495
    # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
 
1496
    # -Wno-variadic-macros - ???
 
1497
    #
 
1498
    _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
 
1499
    MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
 
1500
    MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
 
1501
    MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
 
1502
 
 
1503
    if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
 
1504
       # Don't use -Wcast-align with ICC or clang
 
1505
       case "$CPU_ARCH" in
 
1506
           # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
 
1507
           hppa | ia64 | sparc | arm)
 
1508
           ;;
 
1509
           *)
 
1510
        _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
 
1511
           ;;
 
1512
       esac
 
1513
    fi
 
1514
 
 
1515
    _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
 
1516
    _USE_CPP_INCLUDE_FLAG=1
 
1517
 
 
1518
    # Recent clang and gcc support C++11 deleted functions without warnings if
 
1519
    # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
 
1520
    # versions).  We can't use -std=c++0x yet, so gcc's support must remain
 
1521
    # unused.  But clang's warning can be disabled, so when compiling with clang
 
1522
    # we use it to opt out of the warning, enabling (macro-encapsulated) use of
 
1523
    # deleted function syntax.
 
1524
    if test "$CLANG_CXX"; then
 
1525
        _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
 
1526
        MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
 
1527
    fi
 
1528
 
 
1529
else
 
1530
    _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
 
1531
fi
 
1532
 
 
1533
dnl gcc can come with its own linker so it is better to use the pass-thru calls
 
1534
dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
 
1535
dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
 
1536
dnl normal behavior.
 
1537
dnl ========================================================
 
1538
MKSHLIB_FORCE_ALL=
 
1539
MKSHLIB_UNFORCE_ALL=
 
1540
 
 
1541
if test "$COMPILE_ENVIRONMENT"; then
 
1542
if test "$GNU_CC"; then
 
1543
  AC_MSG_CHECKING(whether ld has archive extraction flags)
 
1544
  AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
 
1545
   [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
 
1546
    ac_cv_mkshlib_force_and_unforce="no"
 
1547
    exec 3<&0 <<LOOP_INPUT
 
1548
        force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
 
1549
        force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
 
1550
        force="-Wl,-all";              unforce="-Wl,-none"
 
1551
LOOP_INPUT
 
1552
    while read line
 
1553
    do
 
1554
      eval $line
 
1555
      LDFLAGS=$force
 
1556
      LIBS=$unforce
 
1557
      AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
 
1558
    done
 
1559
    exec 0<&3 3<&-
 
1560
    LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
 
1561
   ])
 
1562
  if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
 
1563
    AC_MSG_RESULT(no)
 
1564
  else
 
1565
    AC_MSG_RESULT(yes)
 
1566
    eval $ac_cv_mkshlib_force_and_unforce
 
1567
    MKSHLIB_FORCE_ALL=$force
 
1568
    MKSHLIB_UNFORCE_ALL=$unforce
 
1569
  fi
 
1570
fi # GNU_CC
 
1571
fi # COMPILE_ENVIRONMENT
 
1572
 
 
1573
dnl ========================================================
 
1574
dnl Checking for 64-bit OS
 
1575
dnl ========================================================
 
1576
if test "$COMPILE_ENVIRONMENT"; then
 
1577
AC_LANG_SAVE
 
1578
AC_LANG_C
 
1579
AC_MSG_CHECKING(for 64-bit OS)
 
1580
AC_TRY_COMPILE([$configure_static_assert_macros],
 
1581
               [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
 
1582
               result="yes", result="no")
 
1583
AC_MSG_RESULT("$result")
 
1584
if test "$result" = "yes"; then
 
1585
    AC_DEFINE(HAVE_64BIT_OS)
 
1586
    HAVE_64BIT_OS=1
 
1587
fi
 
1588
AC_SUBST(HAVE_64BIT_OS)
 
1589
AC_LANG_RESTORE
 
1590
fi # COMPILE_ENVIRONMENT
 
1591
 
 
1592
dnl ========================================================
 
1593
dnl Enable high-memory support on OS/2 by default.
 
1594
dnl ========================================================
 
1595
MOZ_OS2_HIGH_MEMORY=1
 
1596
MOZ_ARG_DISABLE_BOOL(os2-high-mem,
 
1597
[  --disable-os2-high-mem  Disable high-memory support on OS/2],
 
1598
    MOZ_OS2_HIGH_MEMORY=,
 
1599
    MOZ_OS2_HIGH_MEMORY=1 )
 
1600
AC_SUBST(MOZ_OS2_HIGH_MEMORY)
 
1601
 
 
1602
dnl ========================================================
 
1603
dnl = Use profiling compile flags
 
1604
dnl ========================================================
 
1605
MOZ_ARG_ENABLE_BOOL(profiling,
 
1606
[  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
 
1607
    MOZ_PROFILING=1,
 
1608
    MOZ_PROFILING= )
 
1609
 
 
1610
# For profiling builds keep the symbol information
 
1611
if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
 
1612
    STRIP_FLAGS="--strip-debug"
 
1613
fi
 
1614
 
 
1615
dnl ========================================================
 
1616
dnl = Use Valgrind
 
1617
dnl ========================================================
 
1618
MOZ_ARG_ENABLE_BOOL(valgrind,
 
1619
[  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
 
1620
    MOZ_VALGRIND=1,
 
1621
    MOZ_VALGRIND= )
 
1622
if test -n "$MOZ_VALGRIND"; then
 
1623
    MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
 
1624
        AC_MSG_ERROR(
 
1625
            [--enable-valgrind specified but Valgrind is not installed]))
 
1626
    AC_DEFINE(MOZ_VALGRIND)
 
1627
fi
 
1628
AC_SUBST(MOZ_VALGRIND)
 
1629
 
 
1630
dnl ========================================================
 
1631
dnl = Use DMD
 
1632
dnl ========================================================
 
1633
MOZ_ARG_ENABLE_BOOL(dmd,
 
1634
[  --enable-dmd            Enable DMD; also disables jemalloc (default=no)],
 
1635
    MOZ_DMD=1,
 
1636
    MOZ_DMD= )
 
1637
if test -n "$MOZ_DMD"; then
 
1638
    MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
 
1639
        AC_MSG_ERROR(
 
1640
            [--enable-dmd specified but Valgrind is not installed]))
 
1641
    AC_DEFINE(MOZ_DMD)
 
1642
fi
 
1643
 
 
1644
dnl ========================================================
 
1645
dnl jprof
 
1646
dnl ========================================================
 
1647
MOZ_ARG_ENABLE_BOOL(jprof,
 
1648
[  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
 
1649
    MOZ_JPROF=1,
 
1650
    MOZ_JPROF= )
 
1651
if test -n "$MOZ_JPROF"; then
 
1652
    MOZ_PROFILING=1
 
1653
    AC_DEFINE(MOZ_JPROF)
 
1654
fi
 
1655
 
 
1656
dnl ========================================================
 
1657
dnl SPS Profiler
 
1658
dnl ========================================================
 
1659
MOZ_ENABLE_PROFILER_SPS=1
 
1660
 
 
1661
case "${OS_TARGET}" in
 
1662
Android)
 
1663
    case "${CPU_ARCH}" in
 
1664
    x86 | arm) ;;
 
1665
    *)
 
1666
        MOZ_ENABLE_PROFILER_SPS=
 
1667
    esac
 
1668
    ;;
 
1669
Linux)
 
1670
    case "${CPU_ARCH}" in
 
1671
    x86 | x86_64) ;;
 
1672
    *)
 
1673
        MOZ_ENABLE_PROFILER_SPS=
 
1674
    esac
 
1675
    ;;
 
1676
WINNT|Darwin) ;;
 
1677
*)
 
1678
    MOZ_ENABLE_PROFILER_SPS=
 
1679
    ;;
 
1680
esac
 
1681
 
 
1682
if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
 
1683
    AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
 
1684
fi
 
1685
 
 
1686
dnl ========================================================
 
1687
dnl shark
 
1688
dnl ========================================================
 
1689
MOZ_ARG_ENABLE_BOOL(shark,
 
1690
[  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
 
1691
    MOZ_SHARK=1,
 
1692
    MOZ_SHARK= )
 
1693
if test -n "$MOZ_SHARK"; then
 
1694
    MOZ_PROFILING=1
 
1695
    AC_DEFINE(MOZ_SHARK)
 
1696
fi
 
1697
 
 
1698
dnl ========================================================
 
1699
dnl callgrind
 
1700
dnl ========================================================
 
1701
MOZ_ARG_ENABLE_BOOL(callgrind,
 
1702
[  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
 
1703
    MOZ_CALLGRIND=1,
 
1704
    MOZ_CALLGRIND= )
 
1705
if test -n "$MOZ_CALLGRIND"; then
 
1706
    MOZ_PROFILING=1
 
1707
    AC_DEFINE(MOZ_CALLGRIND)
 
1708
fi
 
1709
 
 
1710
dnl ========================================================
 
1711
dnl vtune
 
1712
dnl ========================================================
 
1713
MOZ_ARG_ENABLE_BOOL(vtune,
 
1714
[  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
 
1715
    MOZ_VTUNE=1,
 
1716
    MOZ_VTUNE= )
 
1717
if test -n "$MOZ_VTUNE"; then
 
1718
    MOZ_PROFILING=1
 
1719
    AC_DEFINE(MOZ_VTUNE)
 
1720
fi
 
1721
 
 
1722
dnl ========================================================
 
1723
dnl Profiling
 
1724
dnl ========================================================
 
1725
if test -n "$MOZ_PROFILING"; then
 
1726
    AC_DEFINE(MOZ_PROFILING)
 
1727
fi
 
1728
 
 
1729
dnl ========================================================
 
1730
dnl System overrides of the defaults for host
 
1731
dnl ========================================================
 
1732
case "$host" in
 
1733
*mingw*)
 
1734
    if test -n "$_WIN32_MSVC"; then
 
1735
        HOST_AR=lib
 
1736
        HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
 
1737
        HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
 
1738
        HOST_RANLIB='echo ranlib'
 
1739
    else
 
1740
        HOST_CFLAGS="$HOST_CFLAGS -mwindows"
 
1741
    fi
 
1742
    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
 
1743
    HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
 
1744
    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
 
1745
    HOST_BIN_SUFFIX=.exe
 
1746
    case "$host" in
 
1747
    *mingw*)
 
1748
        PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
 
1749
        ;;
 
1750
    esac
 
1751
 
 
1752
    case "${host_cpu}" in
 
1753
    i*86)
 
1754
        if test -n "$_WIN32_MSVC"; then
 
1755
            HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
 
1756
        fi
 
1757
        ;;
 
1758
    x86_64)
 
1759
        if test -n "$_WIN32_MSVC"; then
 
1760
            HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
 
1761
        fi
 
1762
        HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
 
1763
        ;;
 
1764
    esac
 
1765
    ;;
 
1766
 
 
1767
*-darwin*)
 
1768
    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
 
1769
    HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
 
1770
    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
 
1771
    ;;
 
1772
 
 
1773
*-linux*|*-kfreebsd*-gnu|*-gnu*)
 
1774
    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
 
1775
    HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
 
1776
    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
 
1777
    ;;
 
1778
 
 
1779
*os2*)
 
1780
    HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
 
1781
    HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
 
1782
    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
 
1783
    HOST_BIN_SUFFIX=.exe
 
1784
    MOZ_FIX_LINK_PATHS=
 
1785
    ;;
 
1786
 
 
1787
*)
 
1788
    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
 
1789
    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
 
1790
    ;;
 
1791
esac
 
1792
 
 
1793
dnl We require version 2.5 or newer of Python to build.
 
1794
AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
 
1795
changequote(,)
 
1796
$PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
 
1797
_python_res=$?
 
1798
changequote([,])
 
1799
if test "$_python_res" != 0; then
 
1800
    AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
 
1801
fi
 
1802
AC_MSG_RESULT([yes])
 
1803
 
 
1804
dnl Check for using a custom <stdint.h> implementation
 
1805
dnl ========================================================
 
1806
AC_MSG_CHECKING(for custom <stdint.h> implementation)
 
1807
if test "$MOZ_CUSTOM_STDINT_H"; then
 
1808
  AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
 
1809
  AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
 
1810
else
 
1811
  AC_MSG_RESULT(none specified)
 
1812
fi
 
1813
 
 
1814
dnl Get version of various core apps from the version files.
 
1815
FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
 
1816
 
 
1817
if test -z "$FIREFOX_VERSION"; then
 
1818
    AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
 
1819
fi
 
1820
 
 
1821
MOZ_DOING_LTO(lto_is_enabled)
 
1822
 
 
1823
dnl ========================================================
 
1824
dnl System overrides of the defaults for target
 
1825
dnl ========================================================
 
1826
 
 
1827
case "$target" in
 
1828
*-aix*)
 
1829
    AC_DEFINE(AIX)
 
1830
    if test ! "$GNU_CC"; then
 
1831
        if test ! "$HAVE_64BIT_OS"; then
 
1832
            # Compiling with Visual Age C++ object model compat is the
 
1833
            # default. To compile with object model ibm, add
 
1834
            # AIX_OBJMODEL=ibm to .mozconfig.
 
1835
            if test "$AIX_OBJMODEL" = "ibm"; then
 
1836
                CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
 
1837
            else
 
1838
                AIX_OBJMODEL=compat
 
1839
            fi
 
1840
        else
 
1841
            AIX_OBJMODEL=compat
 
1842
        fi
 
1843
        AC_SUBST(AIX_OBJMODEL)
 
1844
        DSO_LDOPTS='-qmkshrobj=1'
 
1845
        DSO_CFLAGS='-qflag=w:w'
 
1846
        DSO_PIC_CFLAGS=
 
1847
        LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
 
1848
        MOZ_FIX_LINK_PATHS=
 
1849
        MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
 
1850
        MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
 
1851
        if test "$COMPILE_ENVIRONMENT"; then
 
1852
            AC_LANG_SAVE
 
1853
            AC_LANG_CPLUSPLUS
 
1854
            AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
 
1855
            AC_TRY_COMPILE([],
 
1856
                [#if (__IBMCPP__ < 900)
 
1857
                 #error "Bad compiler"
 
1858
                 #endif],
 
1859
                _BAD_COMPILER=,_BAD_COMPILER=1)
 
1860
            if test -n "$_BAD_COMPILER"; then
 
1861
                AC_MSG_RESULT([no])
 
1862
                AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
 
1863
            else
 
1864
                AC_MSG_RESULT([yes])
 
1865
            fi
 
1866
            AC_LANG_RESTORE
 
1867
            TARGET_COMPILER_ABI="ibmc"
 
1868
            CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
 
1869
            CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
 
1870
        fi
 
1871
    fi
 
1872
    case "${target_os}" in
 
1873
    aix4.1*)
 
1874
        DLL_SUFFIX='_shr.a'
 
1875
        ;;
 
1876
    esac
 
1877
    if test "$COMPILE_ENVIRONMENT"; then
 
1878
        MOZ_CHECK_HEADERS(sys/inttypes.h)
 
1879
    fi
 
1880
    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
 
1881
    ;;
 
1882
 
 
1883
*-bsdi*)
 
1884
    dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
 
1885
    _PEDANTIC=
 
1886
    case $OS_RELEASE in
 
1887
        4.*|5.*)
 
1888
            STRIP="$STRIP -d"
 
1889
            ;;
 
1890
        *)
 
1891
            DSO_CFLAGS=''
 
1892
            DSO_LDOPTS='-r'
 
1893
            _WARNINGS_CFLAGS="-Wall"
 
1894
            _WARNINGS_CXXFLAGS="-Wall"
 
1895
            # The test above doesn't work properly, at least on 3.1.
 
1896
            MKSHLIB_FORCE_ALL=''
 
1897
            MKSHLIB_UNFORCE_ALL=''
 
1898
        ;;
 
1899
    esac
 
1900
    ;;
 
1901
 
 
1902
*-darwin*)
 
1903
    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
 
1904
    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
 
1905
    MOZ_OPTIMIZE_FLAGS="-O3"
 
1906
    _PEDANTIC=
 
1907
    # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
 
1908
    if test "$HAVE_64BIT_OS"; then
 
1909
        MOZ_MEMORY=1
 
1910
    fi
 
1911
    DLL_SUFFIX=".dylib"
 
1912
    DSO_LDOPTS=''
 
1913
    STRIP="$STRIP -x -S"
 
1914
    # Check whether we're targeting OS X or iOS
 
1915
    AC_CACHE_CHECK(for iOS target,
 
1916
                   ac_cv_ios_target,
 
1917
                   [AC_TRY_COMPILE([#include <TargetConditionals.h>
 
1918
#if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
 
1919
#error not iOS
 
1920
#endif],
 
1921
                                   [],
 
1922
                                   ac_cv_ios_target="yes",
 
1923
                                   ac_cv_ios_target="no")])
 
1924
    if test "$ac_cv_ios_target" = "yes"; then
 
1925
        AC_DEFINE(XP_IOS)
 
1926
        AC_DEFINE(XP_DARWIN)
 
1927
        _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
 
1928
    else
 
1929
        AC_DEFINE(XP_MACOSX)
 
1930
        AC_DEFINE(XP_DARWIN)
 
1931
        _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
 
1932
        # The ExceptionHandling framework is needed for Objective-C exception
 
1933
        # logging code in nsObjCExceptions.h. Currently we only use that in debug
 
1934
        # builds.
 
1935
        MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
 
1936
    fi
 
1937
    TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
 
1938
 
 
1939
 
 
1940
    if test "x$lto_is_enabled" = "xyes"; then
 
1941
        echo "Skipping -dead_strip because lto is enabled."
 
1942
    dnl DTrace and -dead_strip don't interact well. See bug 403132.
 
1943
    dnl ===================================================================
 
1944
    elif test "x$enable_dtrace" = "xyes"; then
 
1945
        echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
 
1946
    else
 
1947
        dnl check for the presence of the -dead_strip linker flag
 
1948
        AC_MSG_CHECKING([for -dead_strip option to ld])
 
1949
        _SAVE_LDFLAGS=$LDFLAGS
 
1950
        LDFLAGS="$LDFLAGS -Wl,-dead_strip"
 
1951
        AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
 
1952
        if test -n "$_HAVE_DEAD_STRIP" ; then
 
1953
            AC_MSG_RESULT([yes])
 
1954
            MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
 
1955
        else
 
1956
            AC_MSG_RESULT([no])
 
1957
        fi
 
1958
 
 
1959
        LDFLAGS=$_SAVE_LDFLAGS
 
1960
    fi
 
1961
 
 
1962
    dnl With newer linkers we need to pass -allow_heap_execute because of
 
1963
    dnl Microsoft Silverlight (5.1.10411.0 at least).
 
1964
    AC_MSG_CHECKING([for -allow_heap_execute option to ld])
 
1965
    _SAVE_LDFLAGS=$LDFLAGS
 
1966
    LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
 
1967
    AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
 
1968
                _HAVE_ALLOW_HEAP_EXECUTE=)
 
1969
    if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
 
1970
        AC_MSG_RESULT([yes])
 
1971
        MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
 
1972
    else
 
1973
        AC_MSG_RESULT([no])
 
1974
    fi
 
1975
    LDFLAGS=$_SAVE_LDFLAGS
 
1976
 
 
1977
    MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
 
1978
    ;;
 
1979
 
 
1980
ia64*-hpux*)
 
1981
    DLL_SUFFIX=".so"
 
1982
    if test ! "$GNU_CC"; then
 
1983
       DSO_LDOPTS='-b'
 
1984
       DSO_CFLAGS=""
 
1985
       DSO_PIC_CFLAGS=
 
1986
       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
 
1987
       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
 
1988
       CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
 
1989
    else
 
1990
       DSO_LDOPTS='-b -E'
 
1991
       MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
 
1992
       MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
 
1993
    fi
 
1994
    MOZ_FIX_LINK_PATHS=
 
1995
    MOZ_NATIVE_MAKEDEPEND=
 
1996
    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
 
1997
    AC_DEFINE(_LARGEFILE64_SOURCE)
 
1998
    ;;
 
1999
 
 
2000
*-hpux*)
 
2001
    DLL_SUFFIX=".sl"
 
2002
    if test ! "$GNU_CC"; then
 
2003
        DSO_LDOPTS='-b -Wl,+s'
 
2004
        DSO_CFLAGS=""
 
2005
        DSO_PIC_CFLAGS="+Z"
 
2006
        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
 
2007
        MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
 
2008
        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
 
2009
    else
 
2010
        DSO_LDOPTS='-b -E +s'
 
2011
        MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
 
2012
        MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
 
2013
    fi
 
2014
    MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
 
2015
    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
 
2016
    ;;
 
2017
 
 
2018
*-android*|*-linuxandroid*)
 
2019
    AC_DEFINE(NO_PW_GECOS)
 
2020
    no_x=yes
 
2021
    if test -n "$gonkdir"; then
 
2022
        _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
 
2023
        MOZ_B2G_RIL=1
 
2024
        MOZ_B2G_BT=1
 
2025
    else
 
2026
        _PLATFORM_DEFAULT_TOOLKIT=cairo-android
 
2027
        MOZ_LINKER=1
 
2028
    fi
 
2029
    TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
 
2030
 
 
2031
    MOZ_GFX_OPTIMIZE_MOBILE=1
 
2032
    MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
 
2033
    ;;
 
2034
 
 
2035
*-*linux*)
 
2036
    # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
 
2037
    # Similarly for GNU_CXX and INTEL_CXX.
 
2038
    if test "$INTEL_CC" -o "$INTEL_CXX"; then
 
2039
        # -Os has been broken on Intel's C/C++ compilers for quite a
 
2040
        # while; Intel recommends against using it.
 
2041
        MOZ_OPTIMIZE_FLAGS="-O2"
 
2042
        MOZ_DEBUG_FLAGS="-g"
 
2043
    elif test "$GNU_CC" -o "$GNU_CXX"; then
 
2044
        GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
 
2045
        case $GCC_VERSION in
 
2046
        4.1.*|4.2.*|4.5.*)
 
2047
            # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
 
2048
            MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
 
2049
        esac
 
2050
        MOZ_PGO_OPTIMIZE_FLAGS="-O3"
 
2051
        MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
 
2052
        MOZ_DEBUG_FLAGS="-g"
 
2053
    fi
 
2054
 
 
2055
    TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
 
2056
 
 
2057
    MOZ_MEMORY=1
 
2058
 
 
2059
    case "${target_cpu}" in
 
2060
    alpha*)
 
2061
        CFLAGS="$CFLAGS -mieee"
 
2062
        CXXFLAGS="$CXXFLAGS -mieee"
 
2063
    ;;
 
2064
    i*86)
 
2065
        USE_ELF_DYNSTR_GC=1
 
2066
    ;;
 
2067
    mips*)
 
2068
        MOZ_DEBUG_FLAGS="-g" # We want inlining
 
2069
    ;;
 
2070
    esac
 
2071
 
 
2072
    if test -z "$MC"; then
 
2073
        MC=mc.exe
 
2074
    fi
 
2075
    ;;
 
2076
*-mingw*)
 
2077
    DSO_CFLAGS=
 
2078
    DSO_PIC_CFLAGS=
 
2079
    DLL_SUFFIX=.dll
 
2080
    RC=rc.exe
 
2081
    MC=mc.exe
 
2082
    # certain versions of cygwin's makedepend barf on the
 
2083
    # #include <string> vs -I./dist/include/string issue so don't use it
 
2084
    MOZ_NATIVE_MAKEDEPEND=
 
2085
    if test -n "$GNU_CC"; then
 
2086
        CC="$CC -mwindows"
 
2087
        CXX="$CXX -mwindows"
 
2088
        CPP="$CPP -mwindows"
 
2089
        CFLAGS="$CFLAGS -mms-bitfields"
 
2090
        CXXFLAGS="$CXXFLAGS -mms-bitfields"
 
2091
        DSO_LDOPTS='-shared'
 
2092
        MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
 
2093
        MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
 
2094
        RC='$(WINDRES)'
 
2095
        # Use temp file for windres (bug 213281)
 
2096
        RCFLAGS='-O coff --use-temp-file'
 
2097
        # mingw doesn't require kernel32, user32, and advapi32 explicitly
 
2098
        LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
 
2099
        MOZ_FIX_LINK_PATHS=
 
2100
        DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
 
2101
        XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
 
2102
        DLL_PREFIX=
 
2103
        IMPORT_LIB_SUFFIX=dll.a
 
2104
        GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
 
2105
    else
 
2106
        TARGET_COMPILER_ABI=msvc
 
2107
        HOST_CC='$(CC)'
 
2108
        HOST_CXX='$(CXX)'
 
2109
        HOST_LD='$(LD)'
 
2110
        if test "$AS_BIN"; then
 
2111
            AS="$(basename "$AS_BIN")"
 
2112
        fi
 
2113
        AR='lib'
 
2114
        AR_FLAGS='-NOLOGO -OUT:"$@"'
 
2115
        AR_EXTRACT=
 
2116
        RANLIB='echo not_ranlib'
 
2117
        STRIP='echo not_strip'
 
2118
        PKG_SKIP_STRIP=1
 
2119
        XARGS=xargs
 
2120
        ZIP=zip
 
2121
        UNZIP=unzip
 
2122
        DOXYGEN=:
 
2123
        ASM_SUFFIX=asm
 
2124
        OBJ_SUFFIX=obj
 
2125
        LIB_SUFFIX=lib
 
2126
        DLL_PREFIX=
 
2127
        LIB_PREFIX=
 
2128
        IMPORT_LIB_SUFFIX=lib
 
2129
        MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
 
2130
        MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
 
2131
        MKSHLIB_FORCE_ALL=
 
2132
        MKSHLIB_UNFORCE_ALL=
 
2133
        DSO_LDOPTS=-SUBSYSTEM:WINDOWS
 
2134
        _USE_CPP_INCLUDE_FLAG=1
 
2135
        _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
 
2136
        _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
 
2137
        CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
 
2138
        CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
 
2139
        CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
 
2140
        # make 'foo == bar;' error out
 
2141
        CFLAGS="$CFLAGS -we4553"
 
2142
        CXXFLAGS="$CXXFLAGS -we4553"
 
2143
        LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
 
2144
        MOZ_DEBUG_FLAGS='-Zi'
 
2145
        MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
 
2146
        WARNINGS_AS_ERRORS='-WX'
 
2147
        MOZ_OPTIMIZE_FLAGS='-O1'
 
2148
        MOZ_FIX_LINK_PATHS=
 
2149
        DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
 
2150
        XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
 
2151
        LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
 
2152
        MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
 
2153
        if test $_MSC_VER -ge 1400; then
 
2154
            LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
 
2155
            dnl For profile-guided optimization
 
2156
            PROFILE_GEN_CFLAGS="-GL"
 
2157
            PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
 
2158
            dnl XXX: PGO builds can fail with warnings treated as errors,
 
2159
            dnl specifically "no profile data available" appears to be
 
2160
            dnl treated as an error sometimes. This might be a consequence
 
2161
            dnl of using WARNINGS_AS_ERRORS in some modules, combined
 
2162
            dnl with the linker doing most of the work in the whole-program
 
2163
            dnl optimization/PGO case. I think it's probably a compiler bug,
 
2164
            dnl but we work around it here.
 
2165
            PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
 
2166
            dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
 
2167
            dnl Probably also a compiler bug, but what can you do?
 
2168
            PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
 
2169
            LDFLAGS="$LDFLAGS -DYNAMICBASE"
 
2170
        fi
 
2171
    fi
 
2172
    AC_DEFINE(HAVE_SNPRINTF)
 
2173
    AC_DEFINE(_WINDOWS)
 
2174
    AC_DEFINE(WIN32)
 
2175
    AC_DEFINE(XP_WIN)
 
2176
    AC_DEFINE(XP_WIN32)
 
2177
    AC_DEFINE(HW_THREADS)
 
2178
    AC_DEFINE(STDC_HEADERS)
 
2179
    AC_DEFINE(NEW_H, <new>)
 
2180
    AC_DEFINE(WIN32_LEAN_AND_MEAN)
 
2181
    TARGET_MD_ARCH=win32
 
2182
    _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
 
2183
    BIN_SUFFIX='.exe'
 
2184
    MOZ_USER_DIR="Mozilla"
 
2185
 
 
2186
    dnl Hardcode to win95 for now - cls
 
2187
    TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
 
2188
 
 
2189
    dnl set NO_X11 defines here as the general check is skipped on win32
 
2190
    no_x=yes
 
2191
    AC_DEFINE(NO_X11)
 
2192
 
 
2193
    case "$host" in
 
2194
    *-mingw*)
 
2195
        MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
 
2196
        L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
 
2197
        ;;
 
2198
    esac
 
2199
 
 
2200
    case "$host" in
 
2201
    *-mingw*)
 
2202
        if test -z "$MOZ_TOOLS"; then
 
2203
            AC_MSG_ERROR([MOZ_TOOLS is not set])
 
2204
        fi
 
2205
        MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
 
2206
        if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
 
2207
            AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
 
2208
        fi
 
2209
        MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
 
2210
        if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
 
2211
            AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
 
2212
        fi
 
2213
        ;;
 
2214
    esac
 
2215
 
 
2216
    case "$host_os" in
 
2217
    cygwin*|msvc*|mks*)
 
2218
        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.])
 
2219
        ;;
 
2220
    esac
 
2221
 
 
2222
    case "$target" in
 
2223
    i*86-*)
 
2224
        if test "$HAVE_64BIT_OS"; then
 
2225
            AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
 
2226
        fi
 
2227
 
 
2228
        if test $_MSC_VER -ge 1400; then
 
2229
            LDFLAGS="$LDFLAGS -SAFESEH"
 
2230
        fi
 
2231
 
 
2232
        if test -n "$GNU_CC"; then
 
2233
            CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
 
2234
            CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
 
2235
        else
 
2236
            AC_DEFINE(HAVE_STDCALL)
 
2237
            DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
 
2238
        fi
 
2239
 
 
2240
        MOZ_CHECK_HEADERS(mmintrin.h)
 
2241
        AC_DEFINE(_X86_)
 
2242
        ;;
 
2243
    x86_64-*)
 
2244
        if test -n "$_WIN32_MSVC"; then
 
2245
            DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
 
2246
        fi
 
2247
        AC_DEFINE(_AMD64_)
 
2248
        ;;
 
2249
    *)
 
2250
        AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
 
2251
        ;;
 
2252
    esac
 
2253
 
 
2254
    if test "$HAVE_64BIT_OS"; then
 
2255
        AC_DEFINE(_WIN64)
 
2256
    fi
 
2257
    ;;
 
2258
 
 
2259
*-netbsd*)
 
2260
    DSO_CFLAGS=''
 
2261
    CFLAGS="$CFLAGS -Dunix"
 
2262
    CXXFLAGS="$CXXFLAGS -Dunix"
 
2263
    if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
 
2264
        DLL_SUFFIX=".so"
 
2265
        DSO_PIC_CFLAGS='-fPIC -DPIC'
 
2266
        DSO_LDOPTS='-shared'
 
2267
        BIN_FLAGS='-Wl,--export-dynamic'
 
2268
    else
 
2269
        DSO_PIC_CFLAGS='-fPIC -DPIC'
 
2270
        DLL_SUFFIX=".so.1.0"
 
2271
        DSO_LDOPTS='-shared'
 
2272
    fi
 
2273
    # This will fail on a.out systems prior to 1.5.1_ALPHA.
 
2274
    MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
 
2275
    MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
 
2276
    if test "$LIBRUNPATH"; then
 
2277
        DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
 
2278
    fi
 
2279
    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
 
2280
    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
 
2281
    ;;
 
2282
 
 
2283
*-openbsd*)
 
2284
    if test "$SO_VERSION"; then
 
2285
        DLL_SUFFIX=".so.$SO_VERSION"
 
2286
    else
 
2287
        DLL_SUFFIX=".so.1.0"
 
2288
    fi
 
2289
    MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
 
2290
    DSO_CFLAGS=''
 
2291
    DSO_PIC_CFLAGS='-fPIC'
 
2292
    DSO_LDOPTS='-shared -fPIC'
 
2293
    if test "$LIBRUNPATH"; then
 
2294
        DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
 
2295
    fi
 
2296
    ;;
 
2297
 
 
2298
*-os2*)
 
2299
    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
 
2300
    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
 
2301
    AC_DEFINE(OS2)
 
2302
    AC_DEFINE(XP_OS2)
 
2303
    AC_DEFINE(OS2EMX_PLAIN_CHAR)
 
2304
    AC_DEFINE(TCPV40HDRS)
 
2305
    DLL_PREFIX=
 
2306
    LIB_PREFIX=
 
2307
    LIB_SUFFIX=lib
 
2308
    BIN_SUFFIX=".exe"
 
2309
    DLL_SUFFIX=".dll"
 
2310
    IMPORT_LIB_SUFFIX=lib
 
2311
    DSO_PIC_CFLAGS=
 
2312
    AR=emxomfar
 
2313
    AR_FLAGS='r $@'
 
2314
    CFLAGS="$CFLAGS -Zomf"
 
2315
    CXXFLAGS="$CXXFLAGS -Zomf"
 
2316
    DSO_LDOPTS='-Zdll'
 
2317
    BIN_FLAGS='-Zlinker /ST:0x100000'
 
2318
    IMPLIB='emximp -o'
 
2319
    FILTER='true'
 
2320
    LDFLAGS='-Zmap'
 
2321
    WARNINGS_AS_ERRORS='-Werror'
 
2322
    MOZ_DEBUG_FLAGS="-g -fno-inline"
 
2323
    MOZ_OPTIMIZE_FLAGS="-O2"
 
2324
    MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
 
2325
    DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
 
2326
    LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
 
2327
    TARGET_MD_ARCH=os2
 
2328
    _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
 
2329
    RC=rc.exe
 
2330
    MC=mc.exe
 
2331
    RCFLAGS='-n'
 
2332
    MOZ_USER_DIR="Mozilla"
 
2333
    ZIP="$ZIP -X"
 
2334
 
 
2335
    if test "$MOZTOOLS"; then
 
2336
        MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
 
2337
    else
 
2338
        AC_MSG_ERROR([MOZTOOLS is not set])
 
2339
    fi
 
2340
    if test -n "$MOZ_OS2_HIGH_MEMORY"; then
 
2341
        DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
 
2342
        LDFLAGS="$LDFLAGS -Zhigh-mem"
 
2343
        MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
 
2344
        AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
 
2345
    fi
 
2346
 
 
2347
    # GCC for OS/2 currently predefines these, but we don't want them
 
2348
    _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
 
2349
    _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
 
2350
 
 
2351
    AC_CACHE_CHECK(for __declspec(dllexport),
 
2352
        ac_os2_declspec,
 
2353
        [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
 
2354
                        [return 0;],
 
2355
                        ac_os2_declspec="yes",
 
2356
                        ac_os2_declspec="no")])
 
2357
    if test "$ac_os2_declspec" != "yes"; then
 
2358
        AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
 
2359
    fi
 
2360
    ;;
 
2361
 
 
2362
*-solaris*)
 
2363
    AC_DEFINE(SOLARIS)
 
2364
    TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
 
2365
    MOZ_NATIVE_MAKEDEPEND=
 
2366
    MOZ_FIX_LINK_PATHS=
 
2367
    # $ORIGIN/.. is for shared libraries under components/ to locate shared
 
2368
    # libraries one level up (e.g. libnspr4.so)
 
2369
    if test "$SOLARIS_SUNPRO_CC"; then
 
2370
       LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
 
2371
       LIBS="-lCrun -lCstd -lc $LIBS"
 
2372
       AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
 
2373
       CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
 
2374
       CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
 
2375
       LDFLAGS="-xildoff $LDFLAGS"
 
2376
       if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
 
2377
           _SAVE_LDFLAGS=$LDFLAGS
 
2378
           LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
 
2379
           AC_TRY_LINK([#include <stdio.h>],
 
2380
                       [printf("Hello World\n");],
 
2381
                       ,
 
2382
                       [LDFLAGS=$_SAVE_LDFLAGS])
 
2383
       fi
 
2384
       MOZ_OPTIMIZE_FLAGS="-xO4"
 
2385
       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
 
2386
       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
 
2387
       MKSHLIB_FORCE_ALL='-z allextract'
 
2388
       MKSHLIB_UNFORCE_ALL='-z defaultextract'
 
2389
       DSO_LDOPTS='-G'
 
2390
       AR_LIST="$AR t"
 
2391
       AR_EXTRACT="$AR x"
 
2392
       AR_DELETE="$AR d"
 
2393
       AR='$(CXX) -xar'
 
2394
       AR_FLAGS='-o $@'
 
2395
       AS='/usr/ccs/bin/as'
 
2396
       ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
 
2397
       AS_DASH_C_FLAG=''
 
2398
       TARGET_COMPILER_ABI="sunc"
 
2399
       CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
 
2400
       CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
 
2401
       AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
 
2402
       AC_LANG_SAVE
 
2403
       AC_LANG_CPLUSPLUS
 
2404
       AC_TRY_COMPILE([],
 
2405
           [#if (__SUNPRO_CC < 0x590)
 
2406
           #error "Denied"
 
2407
           #endif],
 
2408
           _BAD_COMPILER=,_BAD_COMPILER=1)
 
2409
       if test -n "$_BAD_COMPILER"; then
 
2410
           _res="no"
 
2411
           AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
 
2412
       else
 
2413
           _res="yes"
 
2414
       fi
 
2415
       AC_TRY_COMPILE([],
 
2416
           [#if (__SUNPRO_CC >= 0x5100)
 
2417
           #error "Sun C++ 5.10 or above"
 
2418
           #endif],
 
2419
           _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
 
2420
       if test "$_ABOVE_SS12U1"; then
 
2421
           # disable xannotate
 
2422
           CXXFLAGS="$CXXFLAGS -xannotate=no"
 
2423
       fi
 
2424
       AC_MSG_RESULT([$_res])
 
2425
       AC_LANG_RESTORE
 
2426
    else
 
2427
       LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
 
2428
       LIBS="-lc $LIBS"
 
2429
       MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
 
2430
       MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
 
2431
       ASFLAGS="$ASFLAGS -fPIC"
 
2432
       DSO_LDOPTS='-shared'
 
2433
       WARNINGS_AS_ERRORS='-Werror'
 
2434
       _WARNINGS_CFLAGS=''
 
2435
       _WARNINGS_CXXFLAGS=''
 
2436
       if test "$OS_RELEASE" = "5.3"; then
 
2437
           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
 
2438
       fi
 
2439
    fi
 
2440
    if test "$OS_RELEASE" = "5.5.1"; then
 
2441
        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
 
2442
    fi
 
2443
    ;;
 
2444
 
 
2445
*-sunos*)
 
2446
    DSO_LDOPTS='-Bdynamic'
 
2447
    MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
 
2448
    MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
 
2449
    AC_DEFINE(SUNOS4)
 
2450
    AC_DEFINE(SPRINTF_RETURNS_STRING)
 
2451
    case "$(target_os)" in
 
2452
    sunos4.1*)
 
2453
        DLL_SUFFIX='.so.1.0'
 
2454
        ;;
 
2455
    esac
 
2456
    ;;
 
2457
 
 
2458
*-os2*)
 
2459
    HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
 
2460
    ;;
 
2461
 
 
2462
esac
 
2463
 
 
2464
AC_SUBST(MOZ_LINKER)
 
2465
if test -n "$MOZ_LINKER"; then
 
2466
  AC_DEFINE(MOZ_LINKER)
 
2467
fi
 
2468
AC_SUBST(MOZ_ENABLE_SZIP)
 
2469
 
 
2470
dnl Only one oddball right now (QNX), but this gives us flexibility
 
2471
dnl if any other platforms need to override this in the future.
 
2472
AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
 
2473
 
 
2474
dnl ========================================================
 
2475
dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
 
2476
dnl by now will not have any way to link most binaries (tests
 
2477
dnl as well as viewer, apprunner, etc.), because some symbols
 
2478
dnl will be left out of the "composite" .so's by ld as unneeded.
 
2479
dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
 
2480
dnl they can link in the static libs that provide the missing
 
2481
dnl symbols.
 
2482
dnl ========================================================
 
2483
NO_LD_ARCHIVE_FLAGS=
 
2484
if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
 
2485
    NO_LD_ARCHIVE_FLAGS=1
 
2486
fi
 
2487
case "$target" in
 
2488
*-os2*)
 
2489
    NO_LD_ARCHIVE_FLAGS=
 
2490
    ;;
 
2491
*-aix4.3*|*-aix5*)
 
2492
    NO_LD_ARCHIVE_FLAGS=
 
2493
    ;;
 
2494
*-mingw*)
 
2495
    if test -z "$GNU_CC"; then
 
2496
        NO_LD_ARCHIVE_FLAGS=
 
2497
    fi
 
2498
    ;;
 
2499
esac
 
2500
AC_SUBST(NO_LD_ARCHIVE_FLAGS)
 
2501
 
 
2502
dnl ========================================================
 
2503
dnl = Flags to strip unused symbols from .so components and
 
2504
dnl = to export jemalloc symbols when linking a program
 
2505
dnl ========================================================
 
2506
case "$target" in
 
2507
    *-linux*|*-kfreebsd*-gnu|*-gnu*)
 
2508
        MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
 
2509
        ;;
 
2510
    *-solaris*)
 
2511
        if test -z "$GNU_CC"; then
 
2512
         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
 
2513
        else
 
2514
         if test -z "$GCC_USE_GNU_LD"; then
 
2515
          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
 
2516
         else
 
2517
          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
 
2518
         fi
 
2519
        fi
 
2520
        ;;
 
2521
    *-darwin*)
 
2522
        MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
 
2523
        ;;
 
2524
    *-mingw*)
 
2525
        if test -n "$GNU_CC"; then
 
2526
           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
 
2527
        fi
 
2528
        ;;
 
2529
esac
 
2530
 
 
2531
if test -z "$COMPILE_ENVIRONMENT"; then
 
2532
    SKIP_COMPILER_CHECKS=1
 
2533
    SKIP_LIBRARY_CHECKS=1
 
2534
fi
 
2535
 
 
2536
MOZ_COMPILER_OPTS
 
2537
if test -z "$SKIP_COMPILER_CHECKS"; then
 
2538
dnl Checks for typedefs, structures, and compiler characteristics.
 
2539
dnl ========================================================
 
2540
AC_HEADER_STDC
 
2541
AC_C_CONST
 
2542
AC_TYPE_MODE_T
 
2543
AC_TYPE_OFF_T
 
2544
AC_TYPE_PID_T
 
2545
AC_TYPE_SIZE_T
 
2546
AC_LANG_CPLUSPLUS
 
2547
AC_MSG_CHECKING(for __stdcall)
 
2548
AC_CACHE_VAL(ac_cv___stdcall,
 
2549
 [AC_TRY_COMPILE([template <typename Method> struct foo;
 
2550
                  template <> struct foo<void (*)()> {};
 
2551
                  template <> struct foo<void (__stdcall*)()> {};],
 
2552
                 [],
 
2553
                 [ac_cv___stdcall=true],
 
2554
                 [ac_cv___stdcall=false])])
 
2555
if test "$ac_cv___stdcall" = true ; then
 
2556
  AC_DEFINE(HAVE_STDCALL)
 
2557
  AC_MSG_RESULT(yes)
 
2558
else
 
2559
  AC_MSG_RESULT(no)
 
2560
fi
 
2561
AC_LANG_C
 
2562
AC_MSG_CHECKING(for ssize_t)
 
2563
AC_CACHE_VAL(ac_cv_type_ssize_t,
 
2564
 [AC_TRY_COMPILE([#include <stdio.h>
 
2565
                  #include <sys/types.h>],
 
2566
                 [ssize_t foo = 0;],
 
2567
                 [ac_cv_type_ssize_t=true],
 
2568
                 [ac_cv_type_ssize_t=false])])
 
2569
if test "$ac_cv_type_ssize_t" = true ; then
 
2570
  AC_DEFINE(HAVE_SSIZE_T)
 
2571
  AC_MSG_RESULT(yes)
 
2572
else
 
2573
  AC_MSG_RESULT(no)
 
2574
fi
 
2575
AC_STRUCT_ST_BLKSIZE
 
2576
AC_MSG_CHECKING(for siginfo_t)
 
2577
AC_CACHE_VAL(ac_cv_siginfo_t,
 
2578
 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
 
2579
                  #include <signal.h>],
 
2580
                 [siginfo_t* info;],
 
2581
                 [ac_cv_siginfo_t=true],
 
2582
                 [ac_cv_siginfo_t=false])])
 
2583
if test "$ac_cv_siginfo_t" = true ; then
 
2584
  AC_DEFINE(HAVE_SIGINFO_T)
 
2585
  AC_MSG_RESULT(yes)
 
2586
else
 
2587
  AC_MSG_RESULT(no)
 
2588
fi
 
2589
 
 
2590
dnl Check for int64, uint, and uint_t.
 
2591
dnl ========================================================
 
2592
AC_MSG_CHECKING(for int64)
 
2593
AC_CACHE_VAL(ac_cv_int64,
 
2594
 [AC_TRY_COMPILE([#include <stdio.h>
 
2595
                  #include <sys/types.h>],
 
2596
                 [int64 foo = 0;],
 
2597
                 [ac_cv_int64=true],
 
2598
                 [ac_cv_int64=false])])
 
2599
if test "$ac_cv_int64" = true ; then
 
2600
  AC_DEFINE(HAVE_INT64)
 
2601
  AC_MSG_RESULT(yes)
 
2602
else
 
2603
  AC_MSG_RESULT(no)
 
2604
fi
 
2605
AC_MSG_CHECKING(for uint)
 
2606
AC_CACHE_VAL(ac_cv_uint,
 
2607
 [AC_TRY_COMPILE([#include <stdio.h>
 
2608
                  #include <sys/types.h>],
 
2609
                 [uint foo = 0;],
 
2610
                 [ac_cv_uint=true],
 
2611
                 [ac_cv_uint=false])])
 
2612
if test "$ac_cv_uint" = true ; then
 
2613
  AC_DEFINE(HAVE_UINT)
 
2614
  AC_MSG_RESULT(yes)
 
2615
else
 
2616
  AC_MSG_RESULT(no)
 
2617
fi
 
2618
AC_MSG_CHECKING(for uint_t)
 
2619
AC_CACHE_VAL(ac_cv_uint_t,
 
2620
 [AC_TRY_COMPILE([#include <stdio.h>
 
2621
                  #include <sys/types.h>],
 
2622
                 [uint_t foo = 0;],
 
2623
                 [ac_cv_uint_t=true],
 
2624
                 [ac_cv_uint_t=false])])
 
2625
if test "$ac_cv_uint_t" = true ; then
 
2626
  AC_DEFINE(HAVE_UINT_T)
 
2627
  AC_MSG_RESULT(yes)
 
2628
else
 
2629
  AC_MSG_RESULT(no)
 
2630
fi
 
2631
 
 
2632
dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
 
2633
dnl are defined when compiling C++ but not C.  Since the result of this
 
2634
dnl test is used only in C++, do it in C++.
 
2635
AC_LANG_CPLUSPLUS
 
2636
 
 
2637
AC_MSG_CHECKING(for uname.domainname)
 
2638
AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
 
2639
    [AC_TRY_COMPILE([#include <sys/utsname.h>],
 
2640
        [ struct utsname *res; char *domain;
 
2641
            (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
 
2642
        [ac_cv_have_uname_domainname_field=true],
 
2643
        [ac_cv_have_uname_domainname_field=false])])
 
2644
 
 
2645
if test "$ac_cv_have_uname_domainname_field" = "true"; then
 
2646
    AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
 
2647
    AC_MSG_RESULT(yes)
 
2648
else
 
2649
    AC_MSG_RESULT(no)
 
2650
fi
 
2651
 
 
2652
AC_MSG_CHECKING(for uname.__domainname)
 
2653
AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
 
2654
    [AC_TRY_COMPILE([#include <sys/utsname.h>],
 
2655
        [ struct utsname *res; char *domain;
 
2656
            (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
 
2657
        [ac_cv_have_uname_us_domainname_field=true],
 
2658
        [ac_cv_have_uname_us_domainname_field=false])])
 
2659
 
 
2660
if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
 
2661
    AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
 
2662
    AC_MSG_RESULT(yes)
 
2663
else
 
2664
    AC_MSG_RESULT(no)
 
2665
fi
 
2666
 
 
2667
dnl Check whether we can use gcc's c++0x mode
 
2668
AC_LANG_CPLUSPLUS
 
2669
 
 
2670
if test "$GNU_CXX"; then
 
2671
    _SAVE_CXXFLAGS=$CXXFLAGS
 
2672
    CXXFLAGS="$CXXFLAGS -std=gnu++0x"
 
2673
 
 
2674
    AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
 
2675
        ac_cv_cxx0x_headers_bug,
 
2676
        [AC_TRY_COMPILE([#include <memory>], [],
 
2677
                        ac_cv_cxx0x_headers_bug="no",
 
2678
                        ac_cv_cxx0x_headers_bug="yes")])
 
2679
    CXXFLAGS="$_SAVE_CXXFLAGS"
 
2680
    if test "$ac_cv_cxx0x_headers_bug" = "no"; then
 
2681
        CXXFLAGS="$CXXFLAGS -std=gnu++0x"
 
2682
    fi
 
2683
fi
 
2684
 
 
2685
dnl Check for usable char16_t (2 bytes, unsigned)
 
2686
dnl (we might not need the unsignedness check anymore)
 
2687
AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
 
2688
    ac_cv_have_usable_char16_t,
 
2689
    [AC_TRY_COMPILE([$configure_static_assert_macros],
 
2690
                    [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
 
2691
                     CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
 
2692
                     CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
 
2693
                     CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
 
2694
                     CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
 
2695
                    ac_cv_have_usable_char16_t="yes",
 
2696
                    ac_cv_have_usable_char16_t="no")])
 
2697
if test "$ac_cv_have_usable_char16_t" = "yes"; then
 
2698
    AC_DEFINE(HAVE_CPP_CHAR16_T)
 
2699
    HAVE_CPP_CHAR16_T=1
 
2700
elif test "$GNU_CXX"; then
 
2701
    CXXFLAGS="$_SAVE_CXXFLAGS"
 
2702
fi
 
2703
 
 
2704
dnl Check for usable wchar_t (2 bytes, unsigned)
 
2705
dnl (we really don't need the unsignedness check anymore)
 
2706
dnl ========================================================
 
2707
 
 
2708
AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
 
2709
    ac_cv_have_usable_wchar_v2,
 
2710
    [AC_TRY_COMPILE([#include <stddef.h>
 
2711
                     $configure_static_assert_macros],
 
2712
                    [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
 
2713
                     CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
 
2714
                    ac_cv_have_usable_wchar_v2="yes",
 
2715
                    ac_cv_have_usable_wchar_v2="no")])
 
2716
if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
 
2717
    AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
 
2718
    HAVE_CPP_2BYTE_WCHAR_T=1
 
2719
elif test "$ac_cv_have_usable_char16_t" != "yes"; then
 
2720
dnl This is really gcc-only
 
2721
dnl Do this test using CXX only since some versions of gcc
 
2722
dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
 
2723
dnl only have short-wchar support for c++.
 
2724
dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
 
2725
 
 
2726
    _SAVE_CXXFLAGS=$CXXFLAGS
 
2727
    CXXFLAGS="$CXXFLAGS -fshort-wchar"
 
2728
 
 
2729
    AC_CACHE_CHECK(for compiler -fshort-wchar option,
 
2730
        ac_cv_have_usable_wchar_option_v2,
 
2731
        [AC_TRY_LINK([#include <stddef.h>
 
2732
                      $configure_static_assert_macros],
 
2733
                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
 
2734
                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
 
2735
                     ac_cv_have_usable_wchar_option_v2="yes",
 
2736
                     ac_cv_have_usable_wchar_option_v2="no")])
 
2737
 
 
2738
    if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
 
2739
        AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
 
2740
        HAVE_CPP_2BYTE_WCHAR_T=1
 
2741
        if test "$OS_TARGET" = Android; then
 
2742
            WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
 
2743
            CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
 
2744
            CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
 
2745
            DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
 
2746
        else
 
2747
            WCHAR_CFLAGS="-fshort-wchar"
 
2748
        fi
 
2749
    else
 
2750
        CXXFLAGS=$_SAVE_CXXFLAGS
 
2751
    fi
 
2752
fi
 
2753
 
 
2754
dnl Check for nullptr (bug 626472)
 
2755
AC_LANG_CPLUSPLUS
 
2756
AC_MSG_CHECKING(for nullptr)
 
2757
AC_CACHE_VAL(ac_cv_nullptr,
 
2758
 [AC_TRY_COMPILE([],
 
2759
                 [int* foo = nullptr;],
 
2760
                 [ac_cv_nullptr=true],
 
2761
                 [ac_cv_nullptr=false])])
 
2762
if test "$ac_cv_nullptr" = true ; then
 
2763
  AC_DEFINE(HAVE_NULLPTR)
 
2764
  AC_MSG_RESULT(yes)
 
2765
else
 
2766
  AC_MSG_RESULT(no)
 
2767
fi
 
2768
 
 
2769
AC_LANG_C
 
2770
 
 
2771
dnl Check for .hidden assembler directive and visibility attribute.
 
2772
dnl Borrowed from glibc configure.in
 
2773
dnl ===============================================================
 
2774
if test "$GNU_CC"; then
 
2775
  AC_CACHE_CHECK(for visibility(hidden) attribute,
 
2776
                 ac_cv_visibility_hidden,
 
2777
                 [cat > conftest.c <<EOF
 
2778
                  int foo __attribute__ ((visibility ("hidden"))) = 1;
 
2779
EOF
 
2780
                  ac_cv_visibility_hidden=no
 
2781
                  if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
 
2782
                    if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
 
2783
                      ac_cv_visibility_hidden=yes
 
2784
                    fi
 
2785
                  fi
 
2786
                  rm -f conftest.[cs]
 
2787
                 ])
 
2788
  if test "$ac_cv_visibility_hidden" = "yes"; then
 
2789
    AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
 
2790
 
 
2791
    AC_CACHE_CHECK(for visibility(default) attribute,
 
2792
                   ac_cv_visibility_default,
 
2793
                   [cat > conftest.c <<EOF
 
2794
                    int foo __attribute__ ((visibility ("default"))) = 1;
 
2795
EOF
 
2796
                    ac_cv_visibility_default=no
 
2797
                    if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
 
2798
                      if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
 
2799
                        ac_cv_visibility_default=yes
 
2800
                      fi
 
2801
                    fi
 
2802
                    rm -f conftest.[cs]
 
2803
                   ])
 
2804
    if test "$ac_cv_visibility_default" = "yes"; then
 
2805
      AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
 
2806
 
 
2807
      AC_CACHE_CHECK(for visibility pragma support,
 
2808
                     ac_cv_visibility_pragma,
 
2809
                     [cat > conftest.c <<EOF
 
2810
#pragma GCC visibility push(hidden)
 
2811
                      int foo_hidden = 1;
 
2812
#pragma GCC visibility push(default)
 
2813
                      int foo_default = 1;
 
2814
EOF
 
2815
                      ac_cv_visibility_pragma=no
 
2816
                      if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
 
2817
                        if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
 
2818
                          if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
 
2819
                            ac_cv_visibility_pragma=yes
 
2820
                          fi
 
2821
                        fi
 
2822
                      fi
 
2823
                      rm -f conftest.[cs]
 
2824
                    ])
 
2825
      if test "$ac_cv_visibility_pragma" = "yes"; then
 
2826
        AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
 
2827
                       ac_cv_have_visibility_class_bug,
 
2828
                       [cat > conftest.c <<EOF
 
2829
#pragma GCC visibility push(hidden)
 
2830
struct __attribute__ ((visibility ("default"))) TestStruct {
 
2831
  static void Init();
 
2832
};
 
2833
__attribute__ ((visibility ("default"))) void TestFunc() {
 
2834
  TestStruct::Init();
 
2835
}
 
2836
EOF
 
2837
                       ac_cv_have_visibility_class_bug=no
 
2838
                       if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
 
2839
                         ac_cv_have_visibility_class_bug=yes
 
2840
                       else
 
2841
                         if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
 
2842
                           ac_cv_have_visibility_class_bug=yes
 
2843
                         fi
 
2844
                       fi
 
2845
                       rm -rf conftest.{c,S}
 
2846
                       ])
 
2847
 
 
2848
        AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
 
2849
                       ac_cv_have_visibility_builtin_bug,
 
2850
                       [cat > conftest.c <<EOF
 
2851
#pragma GCC visibility push(hidden)
 
2852
#pragma GCC visibility push(default)
 
2853
#include <string.h>
 
2854
#pragma GCC visibility pop
 
2855
 
 
2856
__attribute__ ((visibility ("default"))) void Func() {
 
2857
  char c[[100]];
 
2858
  memset(c, 0, sizeof(c));
 
2859
}
 
2860
EOF
 
2861
                       ac_cv_have_visibility_builtin_bug=no
 
2862
                       if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
 
2863
                         ac_cv_have_visibility_builtin_bug=yes
 
2864
                       else
 
2865
                         if test `grep -c "@PLT" conftest.S` = 0; then
 
2866
                           ac_cv_visibility_builtin_bug=yes
 
2867
                         fi
 
2868
                       fi
 
2869
                       rm -f conftest.{c,S}
 
2870
                       ])
 
2871
        if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
 
2872
                "$ac_cv_have_visibility_class_bug" = "no"; then
 
2873
          VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
 
2874
          WRAP_SYSTEM_INCLUDES=1
 
2875
          STL_FLAGS='-I$(DIST)/stl_wrappers'
 
2876
          WRAP_STL_INCLUDES=1
 
2877
        else
 
2878
          VISIBILITY_FLAGS='-fvisibility=hidden'
 
2879
        fi # have visibility pragma bug
 
2880
      fi   # have visibility pragma
 
2881
    fi     # have visibility(default) attribute
 
2882
  fi       # have visibility(hidden) attribute
 
2883
fi         # GNU_CC
 
2884
 
 
2885
# visibility hidden flag for Sun Studio on Solaris
 
2886
if test "$SOLARIS_SUNPRO_CC"; then
 
2887
VISIBILITY_FLAGS='-xldscope=hidden'
 
2888
fi         # Sun Studio on Solaris
 
2889
 
 
2890
AC_SUBST(WRAP_SYSTEM_INCLUDES)
 
2891
AC_SUBST(VISIBILITY_FLAGS)
 
2892
 
 
2893
MOZ_GCC_PR49911
 
2894
 
 
2895
dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
 
2896
dnl ========================================================
 
2897
if test "$GNU_CC"; then
 
2898
  CFLAGS_save="${CFLAGS}"
 
2899
  CFLAGS="${CFLAGS} -Werror"
 
2900
  AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
 
2901
                 ac_cv_force_align_arg_pointer,
 
2902
                 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
 
2903
                                 [],
 
2904
                                 ac_cv_force_align_arg_pointer="yes",
 
2905
                                 ac_cv_force_align_arg_pointer="no")])
 
2906
  CFLAGS="${CFLAGS_save}"
 
2907
  if test "$ac_cv_force_align_arg_pointer" = "yes"; then
 
2908
    HAVE_GCC_ALIGN_ARG_POINTER=1
 
2909
  else
 
2910
    HAVE_GCC_ALIGN_ARG_POINTER=
 
2911
  fi
 
2912
fi
 
2913
AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
 
2914
 
 
2915
dnl Checks for header files.
 
2916
dnl ========================================================
 
2917
AC_HEADER_DIRENT
 
2918
case "$target_os" in
 
2919
freebsd*|openbsd*)
 
2920
# for stuff like -lXshm
 
2921
    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
 
2922
    ;;
 
2923
esac
 
2924
MOZ_CHECK_COMMON_HEADERS
 
2925
 
 
2926
dnl These are all the places some variant of statfs can be hiding.
 
2927
MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
 
2928
 
 
2929
dnl Quota support
 
2930
MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
 
2931
MOZ_CHECK_HEADERS(linux/quota.h)
 
2932
 
 
2933
dnl Try for MMX support
 
2934
dnl NB - later gcc versions require -mmmx for this header to be successfully
 
2935
dnl included (or another option which implies it, such as -march=pentium-mmx)
 
2936
MOZ_CHECK_HEADERS(mmintrin.h)
 
2937
 
 
2938
dnl Check whether the compiler supports the new-style C++ standard
 
2939
dnl library headers (i.e. <new>) or needs the old "new.h"
 
2940
AC_LANG_CPLUSPLUS
 
2941
NEW_H=new.h
 
2942
MOZ_CHECK_HEADER(new, [NEW_H=new])
 
2943
AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
 
2944
AC_LANG_C
 
2945
 
 
2946
AC_ARG_ENABLE(dtrace,
 
2947
              [  --enable-dtrace         build with dtrace support if available (default=no)],
 
2948
              [enable_dtrace="yes"],)
 
2949
if test "x$enable_dtrace" = "xyes"; then
 
2950
  MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
 
2951
  if test -n "$HAVE_DTRACE"; then
 
2952
      AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
 
2953
  else
 
2954
      AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
 
2955
  fi
 
2956
fi
 
2957
AC_SUBST(HAVE_DTRACE)
 
2958
 
 
2959
case $target in
 
2960
*-aix4.3*|*-aix5*)
 
2961
        ;;
 
2962
*)
 
2963
        MOZ_CHECK_HEADERS(sys/cdefs.h)
 
2964
        ;;
 
2965
esac
 
2966
 
 
2967
MOZ_LINUX_PERF_EVENT
 
2968
 
 
2969
dnl Checks for libraries.
 
2970
dnl ========================================================
 
2971
case $target in
 
2972
*-hpux11.*)
 
2973
        ;;
 
2974
*)
 
2975
        AC_CHECK_LIB(c_r, gethostbyname_r)
 
2976
        ;;
 
2977
esac
 
2978
 
 
2979
dnl We don't want to link with libdl even if it's present on OS X, since
 
2980
dnl it's not used and not part of the default installation. OS/2 has dlfcn
 
2981
dnl in libc.
 
2982
dnl We don't want to link against libm or libpthread on Darwin since
 
2983
dnl they both are just symlinks to libSystem and explicitly linking
 
2984
dnl against libSystem causes issues when debugging (see bug 299601).
 
2985
case $target in
 
2986
*-darwin*)
 
2987
    ;;
 
2988
*-os2*)
 
2989
    ;;
 
2990
*)
 
2991
    AC_SEARCH_LIBS(dlopen, dl,
 
2992
        MOZ_CHECK_HEADER(dlfcn.h,
 
2993
        AC_DEFINE(HAVE_DLOPEN)))
 
2994
    ;;
 
2995
esac
 
2996
 
 
2997
_SAVE_CFLAGS="$CFLAGS"
 
2998
CFLAGS="$CFLAGS -D_GNU_SOURCE"
 
2999
AC_CHECK_FUNCS(dladdr memmem)
 
3000
CFLAGS="$_SAVE_CFLAGS"
 
3001
 
 
3002
if test ! "$GNU_CXX"; then
 
3003
 
 
3004
    case $target in
 
3005
    *-aix*)
 
3006
        AC_CHECK_LIB(C_r, demangle)
 
3007
        ;;
 
3008
     *)
 
3009
        AC_CHECK_LIB(C, demangle)
 
3010
        ;;
 
3011
     esac
 
3012
fi
 
3013
 
 
3014
dnl OS/2 has socket in libc.
 
3015
case $target in
 
3016
*-os2*)
 
3017
    ;;
 
3018
*)
 
3019
    AC_CHECK_LIB(socket, socket)
 
3020
esac
 
3021
 
 
3022
XLDFLAGS="$X_LIBS"
 
3023
XLIBS="$X_EXTRA_LIBS"
 
3024
 
 
3025
dnl ========================================================
 
3026
dnl Checks for X libraries.
 
3027
dnl Ordering is important.
 
3028
dnl Xt is dependent upon SM as of X11R6
 
3029
dnl ========================================================
 
3030
if test "$no_x" = "yes"; then
 
3031
    AC_DEFINE(NO_X11)
 
3032
else
 
3033
    AC_DEFINE_UNQUOTED(FUNCPROTO,15)
 
3034
        XLIBS="-lX11 $XLIBS"
 
3035
        _SAVE_LDFLAGS="$LDFLAGS"
 
3036
        LDFLAGS="$XLDFLAGS $LDFLAGS"
 
3037
        AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
 
3038
                [MISSING_X="$MISSING_X -lX11"], $XLIBS)
 
3039
        AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
 
3040
                [MISSING_X="$MISSING_X -lXext"], $XLIBS)
 
3041
 
 
3042
        AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
 
3043
        unset ac_cv_lib_Xt_XtFree
 
3044
            AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
 
3045
            AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
 
3046
        AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
 
3047
                    [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
 
3048
        ])
 
3049
 
 
3050
    # AIX needs the motif library linked before libXt to prevent
 
3051
    # crashes in plugins linked against Motif - Bug #98892
 
3052
    case "${target_os}" in
 
3053
    aix*)
 
3054
        XT_LIBS="-lXm $XT_LIBS"
 
3055
        ;;
 
3056
    esac
 
3057
 
 
3058
    dnl ========================================================
 
3059
    dnl = Check for XShm
 
3060
    dnl ========================================================
 
3061
    AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
 
3062
        $XLIBS $XEXT_LIBS)
 
3063
 
 
3064
    dnl ========================================================
 
3065
    dnl = Check for Xss
 
3066
    dnl ========================================================
 
3067
    MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
 
3068
        AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
 
3069
            [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
 
3070
             AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
 
3071
 
 
3072
        LDFLAGS="$_SAVE_LDFLAGS"
 
3073
fi # $no_x
 
3074
 
 
3075
AC_SUBST(XCFLAGS)
 
3076
AC_SUBST(XLDFLAGS)
 
3077
AC_SUBST(XLIBS)
 
3078
AC_SUBST(XEXT_LIBS)
 
3079
AC_SUBST(XT_LIBS)
 
3080
AC_SUBST(XSS_LIBS)
 
3081
 
 
3082
dnl ========================================================
 
3083
dnl = pthread support
 
3084
dnl = Start by checking whether the system support pthreads
 
3085
dnl ========================================================
 
3086
case "$target_os" in
 
3087
darwin*)
 
3088
    USE_PTHREADS=1
 
3089
    ;;
 
3090
*)
 
3091
    MOZ_CHECK_PTHREADS(pthreads,
 
3092
        USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
 
3093
        MOZ_CHECK_PTHREADS(pthread,
 
3094
            USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
 
3095
            MOZ_CHECK_PTHREADS(c_r,
 
3096
                USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
 
3097
                MOZ_CHECK_PTHREADS(c,
 
3098
                    USE_PTHREADS=1
 
3099
                )
 
3100
            )
 
3101
        )
 
3102
    )
 
3103
    ;;
 
3104
esac
 
3105
 
 
3106
dnl ========================================================
 
3107
dnl Check the command line for --with-pthreads
 
3108
dnl ========================================================
 
3109
MOZ_ARG_WITH_BOOL(pthreads,
 
3110
[  --with-pthreads         Force use of system pthread library with NSPR ],
 
3111
[ if test "$USE_PTHREADS"x = x; then
 
3112
    AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
 
3113
fi],
 
3114
    USE_PTHREADS=
 
3115
    _PTHREAD_LDFLAGS=
 
3116
)
 
3117
 
 
3118
dnl ========================================================
 
3119
dnl Do the platform specific pthread hackery
 
3120
dnl ========================================================
 
3121
if test "$USE_PTHREADS"x != x
 
3122
then
 
3123
        dnl
 
3124
        dnl See if -pthread is supported.
 
3125
        dnl
 
3126
        rm -f conftest*
 
3127
        ac_cv_have_dash_pthread=no
 
3128
        AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
 
3129
        echo 'int main() { return 0; }' | cat > conftest.c
 
3130
        ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
 
3131
        if test $? -eq 0; then
 
3132
                if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 
3133
                        ac_cv_have_dash_pthread=yes
 
3134
                case "$target_os" in
 
3135
                freebsd*)
 
3136
# Freebsd doesn't use -pthread for compiles, it uses them for linking
 
3137
                ;;
 
3138
                *)
 
3139
                            CFLAGS="$CFLAGS -pthread"
 
3140
                            CXXFLAGS="$CXXFLAGS -pthread"
 
3141
                ;;
 
3142
                esac
 
3143
                fi
 
3144
        fi
 
3145
        rm -f conftest*
 
3146
    AC_MSG_RESULT($ac_cv_have_dash_pthread)
 
3147
 
 
3148
        dnl
 
3149
        dnl See if -pthreads is supported.
 
3150
        dnl
 
3151
    ac_cv_have_dash_pthreads=no
 
3152
    if test "$ac_cv_have_dash_pthread" = "no"; then
 
3153
            AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
 
3154
        echo 'int main() { return 0; }' | cat > conftest.c
 
3155
            ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
 
3156
        if test $? -eq 0; then
 
3157
                if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
 
3158
                            ac_cv_have_dash_pthreads=yes
 
3159
                            CFLAGS="$CFLAGS -pthreads"
 
3160
                            CXXFLAGS="$CXXFLAGS -pthreads"
 
3161
                    fi
 
3162
            fi
 
3163
            rm -f conftest*
 
3164
        AC_MSG_RESULT($ac_cv_have_dash_pthreads)
 
3165
    fi
 
3166
 
 
3167
        case "$target" in
 
3168
            *-*-freebsd*)
 
3169
                        AC_DEFINE(_REENTRANT)
 
3170
                        AC_DEFINE(_THREAD_SAFE)
 
3171
                        dnl -pthread links in -lpthread, so don't specify it explicitly.
 
3172
                        if test "$ac_cv_have_dash_pthread" = "yes"; then
 
3173
                                _PTHREAD_LDFLAGS="-pthread"
 
3174
                        fi
 
3175
                        ;;
 
3176
 
 
3177
            *-*-openbsd*|*-*-bsdi*)
 
3178
                        AC_DEFINE(_REENTRANT)
 
3179
                        AC_DEFINE(_THREAD_SAFE)
 
3180
                        dnl -pthread links in -lc_r, so don't specify it explicitly.
 
3181
                        if test "$ac_cv_have_dash_pthread" = "yes"; then
 
3182
                _PTHREAD_LDFLAGS="-pthread"
 
3183
                        fi
 
3184
                        ;;
 
3185
 
 
3186
            *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
 
3187
                        AC_DEFINE(_REENTRANT)
 
3188
                        ;;
 
3189
 
 
3190
            *-aix4.3*|*-aix5*)
 
3191
                        AC_DEFINE(_REENTRANT)
 
3192
                        ;;
 
3193
 
 
3194
            *-hpux11.*)
 
3195
                        AC_DEFINE(_REENTRANT)
 
3196
                        ;;
 
3197
 
 
3198
            *-*-solaris*)
 
3199
                        AC_DEFINE(_REENTRANT)
 
3200
                        if test "$SOLARIS_SUNPRO_CC"; then
 
3201
                                CFLAGS="$CFLAGS -mt"
 
3202
                                CXXFLAGS="$CXXFLAGS -mt"
 
3203
                        fi
 
3204
                        ;;
 
3205
        esac
 
3206
    LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
 
3207
fi
 
3208
 
 
3209
 
 
3210
dnl Checks for library functions.
 
3211
dnl ========================================================
 
3212
AC_PROG_GCC_TRADITIONAL
 
3213
AC_FUNC_MEMCMP
 
3214
AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
 
3215
AC_CHECK_FUNCS(flockfile getpagesize)
 
3216
AC_CHECK_FUNCS(localtime_r strtok_r)
 
3217
 
 
3218
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
 
3219
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
 
3220
               ac_cv_clock_monotonic,
 
3221
               [for libs in "" -lrt; do
 
3222
                    _SAVE_LIBS="$LIBS"
 
3223
                    LIBS="$LIBS $libs"
 
3224
                    AC_TRY_LINK([#include <time.h>],
 
3225
                                 [ struct timespec ts;
 
3226
                                   clock_gettime(CLOCK_MONOTONIC, &ts); ],
 
3227
                                 ac_cv_clock_monotonic=$libs
 
3228
                                 LIBS="$_SAVE_LIBS"
 
3229
                                 break,
 
3230
                                 ac_cv_clock_monotonic=no)
 
3231
                    LIBS="$_SAVE_LIBS"
 
3232
                done])
 
3233
if test "$ac_cv_clock_monotonic" != "no"; then
 
3234
    HAVE_CLOCK_MONOTONIC=1
 
3235
    REALTIME_LIBS=$ac_cv_clock_monotonic
 
3236
    AC_DEFINE(HAVE_CLOCK_MONOTONIC)
 
3237
    AC_SUBST(HAVE_CLOCK_MONOTONIC)
 
3238
    AC_SUBST(REALTIME_LIBS)
 
3239
fi
 
3240
 
 
3241
dnl check for wcrtomb/mbrtowc
 
3242
dnl =======================================================================
 
3243
if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
 
3244
AC_LANG_SAVE
 
3245
AC_LANG_CPLUSPLUS
 
3246
AC_CACHE_CHECK(for wcrtomb,
 
3247
    ac_cv_have_wcrtomb,
 
3248
    [AC_TRY_LINK([#include <wchar.h>],
 
3249
                 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
 
3250
                 ac_cv_have_wcrtomb="yes",
 
3251
                 ac_cv_have_wcrtomb="no")])
 
3252
if test "$ac_cv_have_wcrtomb" = "yes"; then
 
3253
    AC_DEFINE(HAVE_WCRTOMB)
 
3254
fi
 
3255
AC_CACHE_CHECK(for mbrtowc,
 
3256
    ac_cv_have_mbrtowc,
 
3257
    [AC_TRY_LINK([#include <wchar.h>],
 
3258
                 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
 
3259
                 ac_cv_have_mbrtowc="yes",
 
3260
                 ac_cv_have_mbrtowc="no")])
 
3261
if test "$ac_cv_have_mbrtowc" = "yes"; then
 
3262
    AC_DEFINE(HAVE_MBRTOWC)
 
3263
fi
 
3264
AC_LANG_RESTORE
 
3265
fi
 
3266
 
 
3267
AC_CACHE_CHECK(
 
3268
    [for res_ninit()],
 
3269
    ac_cv_func_res_ninit,
 
3270
    [AC_TRY_LINK([
 
3271
        #ifdef linux
 
3272
        #define _BSD_SOURCE 1
 
3273
        #endif
 
3274
        #include <resolv.h>
 
3275
        ],
 
3276
        [int foo = res_ninit(&_res);],
 
3277
        [ac_cv_func_res_ninit=yes],
 
3278
        [ac_cv_func_res_ninit=no])
 
3279
    ])
 
3280
 
 
3281
if test "$ac_cv_func_res_ninit" = "yes"; then
 
3282
    AC_DEFINE(HAVE_RES_NINIT)
 
3283
dnl must add the link line we do something as foolish as this... dougt
 
3284
dnl else
 
3285
dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
 
3286
dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
 
3287
fi
 
3288
 
 
3289
AC_LANG_CPLUSPLUS
 
3290
AC_CACHE_CHECK(
 
3291
    [for gnu_get_libc_version()],
 
3292
    ac_cv_func_gnu_get_libc_version,
 
3293
    [AC_TRY_LINK([
 
3294
        #ifdef HAVE_GNU_LIBC_VERSION_H
 
3295
        #include <gnu/libc-version.h>
 
3296
        #endif
 
3297
        ],
 
3298
        [const char *glibc_version = gnu_get_libc_version();],
 
3299
        [ac_cv_func_gnu_get_libc_version=yes],
 
3300
        [ac_cv_func_gnu_get_libc_version=no]
 
3301
        )]
 
3302
    )
 
3303
 
 
3304
if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
 
3305
    AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
 
3306
fi
 
3307
 
 
3308
case $target_os in
 
3309
    darwin*|mingw*|os2*)
 
3310
        ;;
 
3311
    *)
 
3312
 
 
3313
AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
 
3314
    AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
 
3315
        AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
 
3316
_SAVE_LIBS=$LIBS
 
3317
LIBS="$LIBS $_ICONV_LIBS"
 
3318
AC_CACHE_CHECK(
 
3319
    [for iconv()],
 
3320
    ac_cv_func_iconv,
 
3321
    [AC_TRY_LINK([
 
3322
        #include <stdlib.h>
 
3323
        #include <iconv.h>
 
3324
        ],
 
3325
        [
 
3326
            iconv_t h = iconv_open("", "");
 
3327
            iconv(h, NULL, NULL, NULL, NULL);
 
3328
            iconv_close(h);
 
3329
        ],
 
3330
        [ac_cv_func_iconv=yes],
 
3331
        [ac_cv_func_iconv=no]
 
3332
        )]
 
3333
    )
 
3334
if test "$ac_cv_func_iconv" = "yes"; then
 
3335
    AC_DEFINE(HAVE_ICONV)
 
3336
    DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
 
3337
    LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
 
3338
    LIBICONV="$_ICONV_LIBS"
 
3339
    AC_CACHE_CHECK(
 
3340
        [for iconv() with const input],
 
3341
        ac_cv_func_const_iconv,
 
3342
        [AC_TRY_COMPILE([
 
3343
            #include <stdlib.h>
 
3344
            #include <iconv.h>
 
3345
            ],
 
3346
            [
 
3347
                const char *input = "testing";
 
3348
                iconv_t h = iconv_open("", "");
 
3349
                iconv(h, &input, NULL, NULL, NULL);
 
3350
                iconv_close(h);
 
3351
            ],
 
3352
            [ac_cv_func_const_iconv=yes],
 
3353
            [ac_cv_func_const_iconv=no]
 
3354
            )]
 
3355
        )
 
3356
    if test "$ac_cv_func_const_iconv" = "yes"; then
 
3357
        AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
 
3358
    fi
 
3359
fi
 
3360
LIBS=$_SAVE_LIBS
 
3361
 
 
3362
    ;;
 
3363
esac
 
3364
 
 
3365
AM_LANGINFO_CODESET
 
3366
 
 
3367
AC_LANG_C
 
3368
 
 
3369
dnl **********************
 
3370
dnl *** va_copy checks ***
 
3371
dnl **********************
 
3372
dnl we currently check for all three va_copy possibilities, so we get
 
3373
dnl all results in config.log for bug reports.
 
3374
AC_MSG_CHECKING(for an implementation of va_copy())
 
3375
AC_CACHE_VAL(ac_cv_va_copy,[
 
3376
    AC_TRY_RUN([
 
3377
        #include <stdarg.h>
 
3378
        void f (int i, ...) {
 
3379
            va_list args1, args2;
 
3380
            va_start (args1, i);
 
3381
            va_copy (args2, args1);
 
3382
            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
 
3383
                exit (1);
 
3384
            va_end (args1); va_end (args2);
 
3385
        }
 
3386
        int main() { f (0, 42); return 0; }],
 
3387
        ac_cv_va_copy=yes,
 
3388
        ac_cv_va_copy=no,
 
3389
        ac_cv_va_copy=no
 
3390
    )
 
3391
])
 
3392
AC_MSG_RESULT($ac_cv_va_copy)
 
3393
AC_MSG_CHECKING(for an implementation of __va_copy())
 
3394
AC_CACHE_VAL(ac_cv___va_copy,[
 
3395
    AC_TRY_RUN([
 
3396
        #include <stdarg.h>
 
3397
        void f (int i, ...) {
 
3398
            va_list args1, args2;
 
3399
            va_start (args1, i);
 
3400
            __va_copy (args2, args1);
 
3401
            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
 
3402
                exit (1);
 
3403
            va_end (args1); va_end (args2);
 
3404
        }
 
3405
        int main() { f (0, 42); return 0; }],
 
3406
        ac_cv___va_copy=yes,
 
3407
        ac_cv___va_copy=no,
 
3408
        ac_cv___va_copy=no
 
3409
    )
 
3410
])
 
3411
AC_MSG_RESULT($ac_cv___va_copy)
 
3412
AC_MSG_CHECKING(whether va_lists can be copied by value)
 
3413
AC_CACHE_VAL(ac_cv_va_val_copy,[
 
3414
    AC_TRY_RUN([
 
3415
        #include <stdarg.h>
 
3416
        void f (int i, ...) {
 
3417
            va_list args1, args2;
 
3418
            va_start (args1, i);
 
3419
            args2 = args1;
 
3420
            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
 
3421
                exit (1);
 
3422
            va_end (args1); va_end (args2);
 
3423
        }
 
3424
        int main() { f (0, 42); return 0; }],
 
3425
        ac_cv_va_val_copy=yes,
 
3426
        ac_cv_va_val_copy=no,
 
3427
        ac_cv_va_val_copy=yes
 
3428
    )
 
3429
])
 
3430
if test "x$ac_cv_va_copy" = "xyes"; then
 
3431
    AC_DEFINE(VA_COPY, va_copy)
 
3432
    AC_DEFINE(HAVE_VA_COPY)
 
3433
elif test "x$ac_cv___va_copy" = "xyes"; then
 
3434
    AC_DEFINE(VA_COPY, __va_copy)
 
3435
    AC_DEFINE(HAVE_VA_COPY)
 
3436
fi
 
3437
 
 
3438
if test "x$ac_cv_va_val_copy" = "xno"; then
 
3439
   AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
 
3440
fi
 
3441
AC_MSG_RESULT($ac_cv_va_val_copy)
 
3442
 
 
3443
dnl ===================================================================
 
3444
dnl ========================================================
 
3445
dnl Put your C++ language/feature checks below
 
3446
dnl ========================================================
 
3447
AC_LANG_CPLUSPLUS
 
3448
 
 
3449
ARM_ABI_PREFIX=
 
3450
if test "$GNU_CC"; then
 
3451
  if test "$CPU_ARCH" = "arm" ; then
 
3452
    AC_CACHE_CHECK(for ARM EABI,
 
3453
        ac_cv_gcc_arm_eabi,
 
3454
        [AC_TRY_COMPILE([],
 
3455
                        [
 
3456
#if defined(__ARM_EABI__)
 
3457
  return 0;
 
3458
#else
 
3459
#error Not ARM EABI.
 
3460
#endif
 
3461
                        ],
 
3462
                        ac_cv_gcc_arm_eabi="yes",
 
3463
                        ac_cv_gcc_arm_eabi="no")])
 
3464
    if test "$ac_cv_gcc_arm_eabi" = "yes"; then
 
3465
        HAVE_ARM_EABI=1
 
3466
        ARM_ABI_PREFIX=eabi-
 
3467
    else
 
3468
        ARM_ABI_PREFIX=oabi-
 
3469
    fi
 
3470
  fi
 
3471
 
 
3472
  TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
 
3473
fi
 
3474
 
 
3475
dnl Check for support of modern template specialization syntax
 
3476
dnl Test code and requirement from scc@netscape.com.
 
3477
dnl Autoconf cut-and-paste job by waterson@netscape.com
 
3478
AC_CACHE_CHECK(for modern C++ template specialization syntax support,
 
3479
               ac_cv_cpp_modern_specialize_template_syntax,
 
3480
               [AC_TRY_COMPILE(template <class T> struct X { int a; };
 
3481
                               class Y {};
 
3482
                               template <> struct X<Y> { double a; };,
 
3483
                               X<int> int_x;
 
3484
                               X<Y> y_x;,
 
3485
                               ac_cv_cpp_modern_specialize_template_syntax=yes,
 
3486
                               ac_cv_cpp_modern_specialize_template_syntax=no)])
 
3487
if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
 
3488
  AC_MSG_ERROR([The C++ compiler does not support template specialization])
 
3489
fi
 
3490
 
 
3491
dnl Some compilers support only full specialization, and some don't.
 
3492
AC_CACHE_CHECK(whether partial template specialization works,
 
3493
               ac_cv_cpp_partial_specialization,
 
3494
               [AC_TRY_COMPILE(template <class T> class Foo {};
 
3495
                               template <class T> class Foo<T*> {};,
 
3496
                               return 0;,
 
3497
                               ac_cv_cpp_partial_specialization=yes,
 
3498
                               ac_cv_cpp_partial_specialization=no)])
 
3499
if test "$ac_cv_cpp_partial_specialization" = yes ; then
 
3500
  AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
 
3501
fi
 
3502
 
 
3503
dnl Check to see if we can resolve ambiguity with |using|.
 
3504
AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
 
3505
               ac_cv_cpp_ambiguity_resolving_using,
 
3506
               [AC_TRY_COMPILE(class X {
 
3507
                                 public: int go(const X&) {return 3;}
 
3508
                                         int jo(const X&) {return 3;}
 
3509
                               };
 
3510
                               class Y : public X {
 
3511
                                 public:  int go(int) {return 2;}
 
3512
                                          int jo(int) {return 2;}
 
3513
                                          using X::jo;
 
3514
                                 private: using X::go;
 
3515
                               };,
 
3516
                               X x; Y y; y.jo(x);,
 
3517
                               ac_cv_cpp_ambiguity_resolving_using=yes,
 
3518
                               ac_cv_cpp_ambiguity_resolving_using=no)])
 
3519
if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
 
3520
   AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
 
3521
fi
 
3522
 
 
3523
dnl See if a dynamic_cast to void* gives the most derived object.
 
3524
AC_CACHE_CHECK(for C++ dynamic_cast to void*,
 
3525
               ac_cv_cpp_dynamic_cast_void_ptr,
 
3526
               [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
 
3527
                            class Y { int j; public: virtual ~Y() { } };
 
3528
                            class Z : public X, public Y { int k; };
 
3529
 
 
3530
                            int main() {
 
3531
                                 Z mdo;
 
3532
                                 X *subx = (X*)&mdo;
 
3533
                                 Y *suby = (Y*)&mdo;
 
3534
                                 return !((((void*)&mdo != (void*)subx) &&
 
3535
                                           ((void*)&mdo == dynamic_cast<void*>(subx))) ||
 
3536
                                          (((void*)&mdo != (void*)suby) &&
 
3537
                                           ((void*)&mdo == dynamic_cast<void*>(suby))));
 
3538
                            }],
 
3539
                           ac_cv_cpp_dynamic_cast_void_ptr=yes,
 
3540
                           ac_cv_cpp_dynamic_cast_void_ptr=no,
 
3541
                           ac_cv_cpp_dynamic_cast_void_ptr=no)])
 
3542
if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
 
3543
   AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
 
3544
fi
 
3545
 
 
3546
 
 
3547
dnl note that this one is reversed - if the test fails, then
 
3548
dnl we require implementations of unused virtual methods. Which
 
3549
dnl really blows because it means we'll have useless vtable
 
3550
dnl bloat.
 
3551
AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
 
3552
               ac_cv_cpp_unused_required,
 
3553
               [AC_TRY_LINK(class X {private: virtual void never_called();};,
 
3554
                               X x;,
 
3555
                               ac_cv_cpp_unused_required=no,
 
3556
                               ac_cv_cpp_unused_required=yes)])
 
3557
if test "$ac_cv_cpp_unused_required" = yes ; then
 
3558
   AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
 
3559
fi
 
3560
 
 
3561
 
 
3562
dnl Some compilers have trouble comparing a constant reference to a templatized
 
3563
dnl class to zero, and require an explicit operator==() to be defined that takes
 
3564
dnl an int. This test separates the strong from the weak.
 
3565
 
 
3566
AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
 
3567
               ac_cv_trouble_comparing_to_zero,
 
3568
               [AC_TRY_COMPILE([#include <algorithm>
 
3569
                                template <class T> class Foo {};
 
3570
                                class T2;
 
3571
                                template <class T> int operator==(const T2*, const T&) { return 0; }
 
3572
                                template <class T> int operator!=(const T2*, const T&) { return 0; }],
 
3573
                               [Foo<int> f; return (0 != f);],
 
3574
                               ac_cv_trouble_comparing_to_zero=no,
 
3575
                               ac_cv_trouble_comparing_to_zero=yes)])
 
3576
if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
 
3577
  AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
 
3578
fi
 
3579
 
 
3580
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
 
3581
# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
 
3582
# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
 
3583
# linking XUL.
 
3584
_SAVE_LDFLAGS=$LDFLAGS
 
3585
LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
 
3586
AC_CACHE_CHECK(for __thread keyword for TLS variables,
 
3587
               ac_cv_thread_keyword,
 
3588
               [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
 
3589
                            [return tlsIsMainThread;],
 
3590
                            ac_cv_thread_keyword=yes,
 
3591
                            ac_cv_thread_keyword=no)])
 
3592
LDFLAGS=$_SAVE_LDFLAGS
 
3593
# The custom dynamic linker doesn't support TLS variables
 
3594
MOZ_TLS=
 
3595
if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
 
3596
  # mips builds fail with TLS variables because of a binutils bug.
 
3597
  # See bug 528687
 
3598
  # OpenBSD doesn't have TLS support, and the test succeeds with clang++
 
3599
  case "${target}" in
 
3600
    mips*-*)
 
3601
      :
 
3602
      ;;
 
3603
    *-android*|*-linuxandroid*)
 
3604
      :
 
3605
      ;;
 
3606
    *-openbsd*)
 
3607
      :
 
3608
      ;;
 
3609
    *)
 
3610
      AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
 
3611
      MOZ_TLS=1
 
3612
      ;;
 
3613
  esac
 
3614
fi
 
3615
 
 
3616
dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
 
3617
if test -n "$MOZ_LINKER"; then
 
3618
  if test "$CPU_ARCH" = arm; then
 
3619
    dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
 
3620
    ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
 
3621
    dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
 
3622
    if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
 
3623
      LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000"
 
3624
      _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000"
 
3625
    fi
 
3626
  fi
 
3627
fi
 
3628
 
 
3629
dnl The custom linker doesn't support text relocations, but NDK >= r6b
 
3630
dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
 
3631
dnl We however want to avoid these text relocations, and this can be done
 
3632
dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
 
3633
dnl doesn't contain anything at all, beside placeholders for some sections,
 
3634
dnl and crtbegin only contains a finalizer function that calls
 
3635
dnl __cxa_finalize. The custom linker actually takes care of calling
 
3636
dnl __cxa_finalize when the library doesn't call it itself, which makes it
 
3637
dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
 
3638
dnl link crtbegin and crtend at all.
 
3639
if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$OS_TARGET" = "Android"; then
 
3640
  AC_CACHE_CHECK([whether the CRT objects have text relocations],
 
3641
    ac_cv_crt_has_text_relocations,
 
3642
    [echo 'int foo() { return 0; }' > conftest.cpp
 
3643
     if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
 
3644
        test -s conftest${DLL_SUFFIX}; then
 
3645
       if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
 
3646
         ac_cv_crt_has_text_relocations=yes
 
3647
       else
 
3648
         ac_cv_crt_has_text_relocations=no
 
3649
       fi
 
3650
     else
 
3651
       AC_ERROR([couldn't compile a simple C file])
 
3652
     fi
 
3653
     rm -rf conftest*])
 
3654
  if test "$ac_cv_crt_has_text_relocations" = yes; then
 
3655
    dnl While we want libraries to skip the CRT files, we don't want
 
3656
    dnl executables to be treated the same way. We thus set the flag
 
3657
    dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
 
3658
    dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
 
3659
    dnl Using LDFLAGS in nspr is safe, since we only really build
 
3660
    dnl libraries there.
 
3661
    DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
 
3662
    NSPR_LDFLAGS=-nostartfiles
 
3663
  fi
 
3664
fi
 
3665
 
 
3666
dnl Check for the existence of various allocation headers/functions
 
3667
 
 
3668
MALLOC_H=
 
3669
MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
 
3670
if test "$MALLOC_H" = ""; then
 
3671
  MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
 
3672
  if test "$MALLOC_H" = ""; then
 
3673
    MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
 
3674
  fi
 
3675
fi
 
3676
if test "$MALLOC_H" != ""; then
 
3677
   AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
 
3678
fi
 
3679
 
 
3680
MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
 
3681
AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
 
3682
 
 
3683
dnl See if compiler supports some gcc-style attributes
 
3684
 
 
3685
AC_CACHE_CHECK(for __attribute__((always_inline)),
 
3686
               ac_cv_attribute_always_inline,
 
3687
               [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
 
3688
                               [],
 
3689
                               ac_cv_attribute_always_inline=yes,
 
3690
                               ac_cv_attribute_always_inline=no)])
 
3691
 
 
3692
AC_CACHE_CHECK(for __attribute__((malloc)),
 
3693
               ac_cv_attribute_malloc,
 
3694
               [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
 
3695
                               [],
 
3696
                               ac_cv_attribute_malloc=yes,
 
3697
                               ac_cv_attribute_malloc=no)])
 
3698
 
 
3699
AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
 
3700
               ac_cv_attribute_warn_unused,
 
3701
               [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
 
3702
                               [],
 
3703
                               ac_cv_attribute_warn_unused=yes,
 
3704
                               ac_cv_attribute_warn_unused=no)])
 
3705
 
 
3706
dnl End of C++ language/feature checks
 
3707
AC_LANG_C
 
3708
 
 
3709
dnl ========================================================
 
3710
dnl =  Internationalization checks
 
3711
dnl ========================================================
 
3712
dnl
 
3713
dnl Internationalization and Locale support is different
 
3714
dnl on various UNIX platforms.  Checks for specific i18n
 
3715
dnl features go here.
 
3716
 
 
3717
dnl check for LC_MESSAGES
 
3718
AC_CACHE_CHECK(for LC_MESSAGES,
 
3719
                ac_cv_i18n_lc_messages,
 
3720
                [AC_TRY_COMPILE([#include <locale.h>],
 
3721
                                [int category = LC_MESSAGES;],
 
3722
                                ac_cv_i18n_lc_messages=yes,
 
3723
                                ac_cv_i18n_lc_messages=no)])
 
3724
if test "$ac_cv_i18n_lc_messages" = yes; then
 
3725
   AC_DEFINE(HAVE_I18N_LC_MESSAGES)
 
3726
fi
 
3727
 
 
3728
AC_HAVE_FUNCS(localeconv)
 
3729
fi # ! SKIP_COMPILER_CHECKS
 
3730
 
 
3731
TARGET_XPCOM_ABI=
 
3732
if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
 
3733
    TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
 
3734
fi
 
3735
 
 
3736
dnl Mozilla specific options
 
3737
dnl ========================================================
 
3738
dnl The macros used for command line options
 
3739
dnl are defined in build/autoconf/altoptions.m4.
 
3740
 
 
3741
dnl If the compiler supports these attributes, define them as
 
3742
dnl convenience macros.
 
3743
if test "$ac_cv_attribute_always_inline" = yes ; then
 
3744
  AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
 
3745
else
 
3746
  AC_DEFINE(NS_ALWAYS_INLINE,)
 
3747
fi
 
3748
 
 
3749
if test "$ac_cv_attribute_malloc" = yes ; then
 
3750
  AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
 
3751
else
 
3752
  AC_DEFINE(NS_ATTR_MALLOC,)
 
3753
fi
 
3754
 
 
3755
if test "$ac_cv_attribute_warn_unused" = yes ; then
 
3756
  AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
 
3757
else
 
3758
  AC_DEFINE(NS_WARN_UNUSED_RESULT,)
 
3759
fi
 
3760
 
 
3761
dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
 
3762
dnl features that Windows actually does support.
 
3763
 
 
3764
if test -n "$SKIP_COMPILER_CHECKS"; then
 
3765
   dnl Windows has malloc.h
 
3766
   AC_DEFINE(MALLOC_H, [<malloc.h>])
 
3767
   AC_DEFINE(HAVE_FORCEINLINE)
 
3768
   AC_DEFINE(HAVE_LOCALECONV)
 
3769
fi # SKIP_COMPILER_CHECKS
 
3770
 
 
3771
dnl ========================================================
 
3772
dnl =
 
3773
dnl = Check for external package dependencies
 
3774
dnl =
 
3775
dnl ========================================================
 
3776
MOZ_ARG_HEADER(External Packages)
 
3777
 
 
3778
MOZ_ARG_WITH_STRING(libxul-sdk,
 
3779
[  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
 
3780
  LIBXUL_SDK_DIR=$withval)
 
3781
 
 
3782
if test "$LIBXUL_SDK_DIR" = "yes"; then
 
3783
    AC_MSG_ERROR([--with-libxul-sdk must specify a path])
 
3784
elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
 
3785
    LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
 
3786
 
 
3787
    if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
 
3788
        AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
 
3789
    fi
 
3790
 
 
3791
fi
 
3792
AC_SUBST(LIBXUL_SDK)
 
3793
 
 
3794
if test -n "$LIBXUL_SDK"; then
 
3795
    LIBXUL_DIST="$LIBXUL_SDK"
 
3796
else
 
3797
    LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
 
3798
fi
 
3799
AC_SUBST(LIBXUL_DIST)
 
3800
 
 
3801
SYSTEM_LIBXUL=
 
3802
 
 
3803
dnl Get mozilla version from the SDK
 
3804
MOZILLA_VERSION=`cat ${LIBXUL_SDK}/include/mozilla-config.h | grep MOZILLA_VERSION_U | cut -d ' ' -f 3 | tail -n 1`
 
3805
MOZILLA_UAVERSION=`echo $(MOZILLA_VERSION) | sed -e 's/[ab].*//' -e 's/^\([^\.]*\)\.\([^\.]*\).*/\1\.\2/;'`
 
3806
 
 
3807
AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
 
3808
AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
 
3809
AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
 
3810
 
 
3811
MOZ_ARG_WITH_BOOL(system-libxul,
 
3812
[  --with-system-libxul    Use system installed libxul SDK],
 
3813
    SYSTEM_LIBXUL=1)
 
3814
 
 
3815
dnl ========================================================
 
3816
dnl = If NSPR was not detected in the system,
 
3817
dnl = use the one in the source tree (mozilla/nsprpub)
 
3818
dnl ========================================================
 
3819
MOZ_ARG_WITH_BOOL(system-nspr,
 
3820
[  --with-system-nspr      Use system installed NSPR],
 
3821
    _USE_SYSTEM_NSPR=1 )
 
3822
 
 
3823
if test -n "$_USE_SYSTEM_NSPR"; then
 
3824
    AM_PATH_NSPR(4.9.2, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
 
3825
fi
 
3826
 
 
3827
if test -n "$MOZ_NATIVE_NSPR"; then
 
3828
    _SAVE_CFLAGS=$CFLAGS
 
3829
    CFLAGS="$CFLAGS $NSPR_CFLAGS"
 
3830
    AC_TRY_COMPILE([#include "prtypes.h"],
 
3831
                [#ifndef PR_STATIC_ASSERT
 
3832
                 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
 
3833
                 #endif],
 
3834
                [MOZ_NATIVE_NSPR=1],
 
3835
                AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
 
3836
    AC_TRY_COMPILE([#include "prtypes.h"],
 
3837
                [#ifndef PR_UINT64
 
3838
                 #error PR_UINT64 not defined or requires including prtypes.h
 
3839
                 #endif],
 
3840
                [MOZ_NATIVE_NSPR=1],
 
3841
                AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
 
3842
    CFLAGS=$_SAVE_CFLAGS
 
3843
else
 
3844
    if test -z "$LIBXUL_SDK"; then
 
3845
        NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
 
3846
        if test -n "$GNU_CC"; then
 
3847
            NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
 
3848
        else
 
3849
            NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
 
3850
        fi
 
3851
    else
 
3852
        NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
 
3853
        NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
 
3854
    fi
 
3855
fi
 
3856
 
 
3857
dnl system libevent Support
 
3858
dnl ========================================================
 
3859
MOZ_ARG_WITH_STRING(system-libevent,
 
3860
[  --with-system-libevent=[PFX]
 
3861
                          Use system libevent [installed at prefix PFX]],
 
3862
    LIBEVENT_DIR=$withval)
 
3863
 
 
3864
_SAVE_CFLAGS=$CFLAGS
 
3865
_SAVE_LDFLAGS=$LDFLAGS
 
3866
_SAVE_LIBS=$LIBS
 
3867
if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
 
3868
    MOZ_NATIVE_LIBEVENT=
 
3869
else
 
3870
    if test "${LIBEVENT_DIR}" = "yes"; then
 
3871
        LIBEVENT_DIR=/usr
 
3872
    fi
 
3873
    CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
 
3874
    LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
 
3875
    MOZ_CHECK_HEADER(event.h,
 
3876
        [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
 
3877
             AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
 
3878
         fi],
 
3879
        AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
 
3880
    AC_CHECK_LIB(event, event_init,
 
3881
                 [MOZ_NATIVE_LIBEVENT=1
 
3882
                  MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
 
3883
                  MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
 
3884
                 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
 
3885
fi
 
3886
CFLAGS=$_SAVE_CFLAGS
 
3887
LDFLAGS=$_SAVE_LDFLAGS
 
3888
LIBS=$_SAVE_LIBS
 
3889
 
 
3890
AC_SUBST(MOZ_NATIVE_LIBEVENT)
 
3891
AC_SUBST(MOZ_LIBEVENT_INCLUDES)
 
3892
AC_SUBST(MOZ_LIBEVENT_LIBS)
 
3893
 
 
3894
dnl ========================================================
 
3895
dnl = If NSS was not detected in the system,
 
3896
dnl = use the one in the source tree (mozilla/security/nss)
 
3897
dnl ========================================================
 
3898
 
 
3899
MOZ_ARG_WITH_BOOL(system-nss,
 
3900
[  --with-system-nss       Use system installed NSS],
 
3901
    _USE_SYSTEM_NSS=1 )
 
3902
 
 
3903
if test -n "$_USE_SYSTEM_NSS"; then
 
3904
    AM_PATH_NSS(3.13.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
 
3905
fi
 
3906
 
 
3907
if test -n "$MOZ_NATIVE_NSS"; then
 
3908
   NSS_LIBS="$NSS_LIBS -lcrmf"
 
3909
else
 
3910
   NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
 
3911
   NSS_DEP_LIBS="\
 
3912
        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
 
3913
        \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
 
3914
        \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
 
3915
        \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
 
3916
        \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
 
3917
 
 
3918
   if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
 
3919
       NSS_LIBS="\
 
3920
        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
 
3921
        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
 
3922
        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
 
3923
        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
 
3924
        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
 
3925
   else
 
3926
       NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
 
3927
   fi
 
3928
fi
 
3929
 
 
3930
dnl ======================
 
3931
dnl Detect yasm
 
3932
dnl ======================
 
3933
 
 
3934
AC_MSG_CHECKING([for YASM assembler])
 
3935
AC_CHECK_PROGS(YASM, yasm, "")
 
3936
 
 
3937
if test -n "$YASM"; then
 
3938
  dnl Pull out yasm's version string
 
3939
  changequote(,)
 
3940
  _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
 
3941
  changequote([,])
 
3942
 
 
3943
  YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
 
3944
  _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
 
3945
  _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
 
3946
  _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
 
3947
  _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
 
3948
fi
 
3949
 
 
3950
if test -z "$SKIP_LIBRARY_CHECKS"; then
 
3951
dnl system JPEG support
 
3952
dnl ========================================================
 
3953
MOZ_ARG_WITH_STRING(system-jpeg,
 
3954
[  --with-system-jpeg[=PFX]
 
3955
                          Use system libjpeg [installed at prefix PFX]],
 
3956
    JPEG_DIR=$withval)
 
3957
 
 
3958
_SAVE_CFLAGS=$CFLAGS
 
3959
_SAVE_LDFLAGS=$LDFLAGS
 
3960
_SAVE_LIBS=$LIBS
 
3961
if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
 
3962
    CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
 
3963
    LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
 
3964
fi
 
3965
if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
 
3966
    MOZ_NATIVE_JPEG=
 
3967
else
 
3968
    AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
 
3969
fi
 
3970
 
 
3971
if test "$MOZ_NATIVE_JPEG" = 1; then
 
3972
    AC_TRY_COMPILE([ #include <stdio.h>
 
3973
                     #include <sys/types.h>
 
3974
                     #include <jpeglib.h> ],
 
3975
                   [ #if JPEG_LIB_VERSION < $MOZJPEG
 
3976
                     #error "Insufficient JPEG library version ($MOZJPEG required)."
 
3977
                     #endif ],
 
3978
                   MOZ_NATIVE_JPEG=1,
 
3979
                   AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
 
3980
fi
 
3981
CFLAGS=$_SAVE_CFLAGS
 
3982
LDFLAGS=$_SAVE_LDFLAGS
 
3983
LIBS=$_SAVE_LIBS
 
3984
 
 
3985
if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
 
3986
    MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
 
3987
    MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
 
3988
fi
 
3989
fi # SKIP_LIBRARY_CHECKS
 
3990
 
 
3991
dnl system ZLIB support
 
3992
dnl ========================================================
 
3993
MOZ_ZLIB_CHECK([1.2.3])
 
3994
 
 
3995
if test "$MOZ_NATIVE_ZLIB" != 1; then
 
3996
    MOZ_ZLIB_CFLAGS=
 
3997
    MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
 
3998
fi
 
3999
 
 
4000
if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
 
4001
    AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
 
4002
fi
 
4003
 
 
4004
if test -z "$SKIP_LIBRARY_CHECKS"; then
 
4005
dnl system BZIP2 Support
 
4006
dnl ========================================================
 
4007
MOZ_ARG_WITH_STRING(system-bz2,
 
4008
[  --with-system-bz2[=PFX]
 
4009
                          Use system libbz2 [installed at prefix PFX]],
 
4010
    BZ2_DIR=$withval)
 
4011
 
 
4012
_SAVE_CFLAGS=$CFLAGS
 
4013
_SAVE_LDFLAGS=$LDFLAGS
 
4014
_SAVE_LIBS=$LIBS
 
4015
if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
 
4016
    CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
 
4017
    LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
 
4018
fi
 
4019
if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
 
4020
    MOZ_NATIVE_BZ2=
 
4021
else
 
4022
    AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
 
4023
        [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
 
4024
fi
 
4025
CFLAGS=$_SAVE_CFLAGS
 
4026
LDFLAGS=$_SAVE_LDFLAGS
 
4027
LIBS=$_SAVE_LIBS
 
4028
 
 
4029
if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
 
4030
    MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
 
4031
    MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
 
4032
fi
 
4033
 
 
4034
dnl system PNG Support
 
4035
dnl ========================================================
 
4036
MOZ_ARG_WITH_STRING(system-png,
 
4037
[  --with-system-png[=PFX]
 
4038
                          Use system libpng [installed at prefix PFX]],
 
4039
    PNG_DIR=$withval)
 
4040
 
 
4041
_SAVE_CFLAGS=$CFLAGS
 
4042
_SAVE_LDFLAGS=$LDFLAGS
 
4043
_SAVE_LIBS=$LIBS
 
4044
if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
 
4045
    CFLAGS="-I${PNG_DIR}/include $CFLAGS"
 
4046
    LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
 
4047
fi
 
4048
if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
 
4049
    MOZ_NATIVE_PNG=
 
4050
else
 
4051
    AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
 
4052
                 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
 
4053
    AC_CHECK_LIB(png, png_get_acTL, ,
 
4054
                 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
 
4055
fi
 
4056
if test "$MOZ_NATIVE_PNG" = 1; then
 
4057
    AC_TRY_COMPILE([ #include <stdio.h>
 
4058
                     #include <sys/types.h>
 
4059
                     #include <png.h> ],
 
4060
                   [ #if PNG_LIBPNG_VER < $MOZPNG
 
4061
                     #error "Insufficient libpng version ($MOZPNG required)."
 
4062
                     #endif
 
4063
                     #ifndef PNG_UINT_31_MAX
 
4064
                     #error "Insufficient libpng version."
 
4065
                     #endif ],
 
4066
                   MOZ_NATIVE_PNG=1,
 
4067
                   AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
 
4068
fi
 
4069
CFLAGS=$_SAVE_CFLAGS
 
4070
LDFLAGS=$_SAVE_LDFLAGS
 
4071
LIBS=$_SAVE_LIBS
 
4072
 
 
4073
if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
 
4074
    MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
 
4075
    MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
 
4076
fi
 
4077
 
 
4078
fi # SKIP_LIBRARY_CHECKS
 
4079
 
 
4080
dnl system HunSpell Support
 
4081
dnl ========================================================
 
4082
MOZ_ARG_ENABLE_BOOL(system-hunspell,
 
4083
[  --enable-system-hunspell
 
4084
                          Use system hunspell (located with pkgconfig)],
 
4085
    MOZ_NATIVE_HUNSPELL=1 )
 
4086
 
 
4087
if test -n "$MOZ_NATIVE_HUNSPELL"; then
 
4088
    PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
 
4089
fi
 
4090
 
 
4091
AC_SUBST(MOZ_NATIVE_HUNSPELL)
 
4092
 
 
4093
dnl ========================================================
 
4094
dnl system libffi Support
 
4095
dnl ========================================================
 
4096
MOZ_ARG_ENABLE_BOOL(system-ffi,
 
4097
[  --enable-system-ffi       Use system libffi (located with pkgconfig)],
 
4098
    MOZ_NATIVE_FFI=1 )
 
4099
 
 
4100
if test -n "$MOZ_NATIVE_FFI"; then
 
4101
    # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
 
4102
    # for non-GCC compilers.
 
4103
    if test -z "$GNU_CC"; then
 
4104
        PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
 
4105
    else
 
4106
        PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
 
4107
    fi
 
4108
    MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
 
4109
fi
 
4110
 
 
4111
dnl ========================================================
 
4112
dnl Java SDK support
 
4113
dnl ========================================================
 
4114
 
 
4115
JAVA_BIN_PATH=
 
4116
MOZ_ARG_WITH_STRING(java-bin-path,
 
4117
[  --with-java-bin-path=dir
 
4118
                          Location of Java binaries (java, javac, jar)],
 
4119
    JAVA_BIN_PATH=$withval)
 
4120
 
 
4121
dnl ========================================================
 
4122
dnl =
 
4123
dnl = Application
 
4124
dnl =
 
4125
dnl ========================================================
 
4126
 
 
4127
MOZ_ARG_HEADER(Application)
 
4128
 
 
4129
ENABLE_TESTS=1
 
4130
ENABLE_SYSTEM_EXTENSION_DIRS=1
 
4131
MOZ_BRANDING_DIRECTORY=
 
4132
MOZ_OFFICIAL_BRANDING=
 
4133
MOZ_FEEDS=1
 
4134
MOZ_FLEXBOX=
 
4135
MOZ_WEBAPP_RUNTIME=
 
4136
MOZ_JSDEBUGGER=1
 
4137
MOZ_AUTH_EXTENSION=1
 
4138
MOZ_OGG=1
 
4139
MOZ_RAW=
 
4140
MOZ_SYDNEYAUDIO=
 
4141
MOZ_SPEEX_RESAMPLER=1
 
4142
MOZ_CUBEB=
 
4143
MOZ_VORBIS=
 
4144
MOZ_TREMOR=
 
4145
MOZ_WAVE=1
 
4146
MOZ_SAMPLE_TYPE_FLOAT32=
 
4147
MOZ_SAMPLE_TYPE_S16LE=
 
4148
MOZ_MEDIA=
 
4149
MOZ_OPUS=1
 
4150
MOZ_WEBM=1
 
4151
MOZ_WEBRTC=1
 
4152
MOZ_WEBRTC_SIGNALING=
 
4153
MOZ_MEDIA_PLUGINS=
 
4154
MOZ_MEDIA_NAVIGATOR=
 
4155
MOZ_OMX_PLUGIN=
 
4156
MOZ_VP8=
 
4157
MOZ_VP8_ERROR_CONCEALMENT=
 
4158
MOZ_VP8_ENCODER=
 
4159
VPX_AS=
 
4160
VPX_ASFLAGS=
 
4161
VPX_AS_DASH_C_FLAG=
 
4162
VPX_AS_CONVERSION=
 
4163
VPX_ASM_SUFFIX=
 
4164
VPX_X86_ASM=
 
4165
VPX_ARM_ASM=
 
4166
LIBJPEG_TURBO_AS=
 
4167
LIBJPEG_TURBO_ASFLAGS=
 
4168
LIBJPEG_TURBO_X86_ASM=
 
4169
LIBJPEG_TURBO_X64_ASM=
 
4170
LIBJPEG_TURBO_ARM_ASM=
 
4171
MOZ_PANGO=1
 
4172
MOZ_PERMISSIONS=1
 
4173
MOZ_PLACES=1
 
4174
MOZ_PREF_EXTENSIONS=1
 
4175
MOZ_PROFILELOCKING=1
 
4176
MOZ_PSM=1
 
4177
MOZ_REFLOW_PERF=
 
4178
MOZ_SAFE_BROWSING=
 
4179
MOZ_HELP_VIEWER=
 
4180
MOZ_SPELLCHECK=1
 
4181
MOZ_JAVA_COMPOSITOR=
 
4182
MOZ_ONLY_TOUCH_EVENTS=
 
4183
MOZ_TOOLKIT_SEARCH=1
 
4184
MOZ_UI_LOCALE=en-US
 
4185
MOZ_UNIVERSALCHARDET=1
 
4186
MOZ_URL_CLASSIFIER=
 
4187
MOZ_XTF=1
 
4188
MOZ_XUL=1
 
4189
MOZ_ZIPWRITER=1
 
4190
NS_PRINTING=1
 
4191
MOZ_PDF_PRINTING=
 
4192
MOZ_DISABLE_DOMCRYPTO=
 
4193
NSS_DISABLE_DBM=
 
4194
NECKO_WIFI=1
 
4195
NECKO_COOKIES=1
 
4196
NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
 
4197
USE_ARM_KUSER=
 
4198
BUILD_CTYPES=1
 
4199
MOZ_USE_NATIVE_POPUP_WINDOWS=
 
4200
MOZ_ANDROID_HISTORY=
 
4201
MOZ_WEBSMS_BACKEND=
 
4202
MOZ_GRAPHITE=1
 
4203
ACCESSIBILITY=1
 
4204
MOZ_SYS_MSG=
 
4205
 
 
4206
case "$target_os" in
 
4207
    mingw*)
 
4208
        NS_ENABLE_TSF=1
 
4209
        AC_DEFINE(NS_ENABLE_TSF)
 
4210
        ;;
 
4211
esac
 
4212
 
 
4213
case "${target}" in
 
4214
    *-android*|*-linuxandroid*)
 
4215
        if test "$CPU_ARCH" = "arm" ; then
 
4216
          USE_ARM_KUSER=1
 
4217
        fi
 
4218
 
 
4219
        NSS_DISABLE_DBM=1
 
4220
        NECKO_WIFI=
 
4221
        MOZ_THEME_FASTSTRIPE=1
 
4222
        MOZ_TREE_FREETYPE=1
 
4223
        MOZ_MEMORY=1
 
4224
        MOZ_RAW=1
 
4225
        ;;
 
4226
 
 
4227
esac
 
4228
 
 
4229
MOZ_ARG_ENABLE_STRING(application,
 
4230
[  --enable-application=APP
 
4231
                          Options include:
 
4232
                            browser (Firefox)
 
4233
                            xulrunner
 
4234
                            tools/update-packaging (AUS-related packaging tools)],
 
4235
[ MOZ_BUILD_APP=$enableval ] )
 
4236
 
 
4237
MOZ_ARG_WITH_STRING(xulrunner-stub-name,
 
4238
[  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
 
4239
  XULRUNNER_STUB_NAME=$withval)
 
4240
 
 
4241
if test -z "$XULRUNNER_STUB_NAME"; then
 
4242
  case "$target_os" in
 
4243
  darwin*)
 
4244
    XULRUNNER_STUB_NAME=xulrunner
 
4245
    ;;
 
4246
  *)
 
4247
    XULRUNNER_STUB_NAME=xulrunner-stub
 
4248
  esac
 
4249
fi
 
4250
AC_SUBST(XULRUNNER_STUB_NAME)
 
4251
 
 
4252
AC_MSG_CHECKING([for application to build])
 
4253
if test -z "$MOZ_BUILD_APP"; then
 
4254
  AC_MSG_RESULT([browser])
 
4255
  MOZ_BUILD_APP=browser
 
4256
else
 
4257
  # default mobile to be mobile/xul
 
4258
  if test "$MOZ_BUILD_APP" = "mobile" ; then
 
4259
    MOZ_BUILD_APP=mobile/xul
 
4260
  fi
 
4261
  # We have a valid application only if it has a build.mk file in its top
 
4262
  # directory.
 
4263
  if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
 
4264
    AC_MSG_RESULT([none])
 
4265
    AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
 
4266
  else
 
4267
    AC_MSG_RESULT([$MOZ_BUILD_APP])
 
4268
  fi
 
4269
fi
 
4270
 
 
4271
# Allow the application to influence configure with a confvars.sh script.
 
4272
 
 
4273
AC_MSG_CHECKING([if app-specific confvars.sh exists])
 
4274
if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
 
4275
  AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
 
4276
  . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
 
4277
else
 
4278
  AC_MSG_RESULT([no])
 
4279
fi
 
4280
 
 
4281
# Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
 
4282
MOZ_ARG_WITH_STRING(app-name,
 
4283
[--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
 
4284
WITH_APP_NAME=$withval,
 
4285
)
 
4286
 
 
4287
if test -n "$WITH_APP_NAME" ; then
 
4288
    MOZ_APP_NAME="$WITH_APP_NAME"
 
4289
fi
 
4290
 
 
4291
MOZ_ARG_WITH_STRING(app-basename,
 
4292
[--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
 
4293
WITH_APP_BASENAME=$withval,
 
4294
)
 
4295
 
 
4296
if test -n "$WITH_APP_BASENAME" ; then
 
4297
    MOZ_APP_BASENAME="$WITH_APP_BASENAME"
 
4298
fi
 
4299
 
 
4300
# Now is a good time to test for logic errors, define mismatches, etc.
 
4301
case "$MOZ_BUILD_APP" in
 
4302
xulrunner)
 
4303
  if test "$LIBXUL_SDK"; then
 
4304
    AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
 
4305
  fi
 
4306
  ;;
 
4307
esac
 
4308
 
 
4309
# Special cases where we need to AC_DEFINE something. Also a holdover for apps
 
4310
# that haven't made a confvars.sh yet. Don't add new stuff here, use
 
4311
# MOZ_BUILD_APP.
 
4312
case "$MOZ_BUILD_APP" in
 
4313
browser)
 
4314
  AC_DEFINE(MOZ_PHOENIX)
 
4315
  ;;
 
4316
 
 
4317
xulrunner)
 
4318
  AC_DEFINE(MOZ_XULRUNNER)
 
4319
  ;;
 
4320
esac
 
4321
 
 
4322
AC_SUBST(MOZ_BUILD_APP)
 
4323
AC_SUBST(MOZ_PHOENIX)
 
4324
AC_SUBST(MOZ_XULRUNNER)
 
4325
 
 
4326
AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
 
4327
 
 
4328
dnl ========================================================
 
4329
dnl Check android sdk version depending on mobile target
 
4330
dnl ========================================================
 
4331
 
 
4332
if test -z "$gonkdir" ; then
 
4333
    # Minimum Android SDK API Level we require.
 
4334
    case "$MOZ_BUILD_APP" in
 
4335
    mobile/xul)
 
4336
        android_min_api_level=13
 
4337
        ;;
 
4338
    mobile/android)
 
4339
        android_min_api_level=16
 
4340
        ;;
 
4341
    esac
 
4342
 
 
4343
    MOZ_ANDROID_SDK($android_min_api_level)
 
4344
fi
 
4345
 
 
4346
dnl ========================================================
 
4347
dnl =
 
4348
dnl = Toolkit Options
 
4349
dnl =
 
4350
dnl ========================================================
 
4351
MOZ_ARG_HEADER(Toolkit Options)
 
4352
 
 
4353
    dnl ========================================================
 
4354
    dnl = Select the default toolkit
 
4355
    dnl ========================================================
 
4356
        MOZ_ARG_ENABLE_STRING(default-toolkit,
 
4357
        [  --enable-default-toolkit=TK
 
4358
                          Select default toolkit
 
4359
                          Platform specific defaults:
 
4360
                            Mac OS X - cairo-cocoa
 
4361
                            OS/2 - cairo-os2
 
4362
                            Win32 - cairo-windows
 
4363
                            * - cairo-gtk2
 
4364
                            * - cairo-qt],
 
4365
    [ _DEFAULT_TOOLKIT=$enableval ],
 
4366
    [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
 
4367
 
 
4368
    if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
 
4369
        -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
 
4370
        -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
 
4371
        -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
 
4372
        -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
 
4373
        -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
 
4374
        -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
 
4375
        -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
 
4376
        -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
 
4377
    then
 
4378
        dnl nglayout only supports building with one toolkit,
 
4379
        dnl so ignore everything after the first comma (",").
 
4380
        MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
 
4381
    else
 
4382
        AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
 
4383
    fi
 
4384
 
 
4385
MOZ_ARG_WITHOUT_BOOL(x,
 
4386
[  --without-x              Build without X11],
 
4387
    WITHOUT_X11=1)
 
4388
 
 
4389
dnl ========================================================
 
4390
dnl = Enable the toolkit as needed                         =
 
4391
dnl ========================================================
 
4392
 
 
4393
MOZ_WIDGET_GTK=
 
4394
 
 
4395
case "$MOZ_WIDGET_TOOLKIT" in
 
4396
 
 
4397
cairo-windows)
 
4398
    MOZ_WIDGET_TOOLKIT=windows
 
4399
    MOZ_WEBGL=1
 
4400
    MOZ_PDF_PRINTING=1
 
4401
    MOZ_INSTRUMENT_EVENT_LOOP=1
 
4402
    ;;
 
4403
 
 
4404
cairo-gtk2|cairo-gtk2-x11)
 
4405
    MOZ_WIDGET_TOOLKIT=gtk2
 
4406
    MOZ_ENABLE_GTK2=1
 
4407
    MOZ_ENABLE_XREMOTE=1
 
4408
    MOZ_WEBGL=1
 
4409
    MOZ_GL_DEFAULT_PROVIDER=GLX
 
4410
 
 
4411
    AC_DEFINE(MOZ_X11)
 
4412
    MOZ_X11=1
 
4413
    USE_FC_FREETYPE=1
 
4414
 
 
4415
    TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
 
4416
    TK_LIBS='$(MOZ_GTK2_LIBS)'
 
4417
    AC_DEFINE(MOZ_WIDGET_GTK2)
 
4418
    MOZ_WIDGET_GTK=2
 
4419
    AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
 
4420
    MOZ_PDF_PRINTING=1
 
4421
    MOZ_INSTRUMENT_EVENT_LOOP=1
 
4422
    ;;
 
4423
 
 
4424
cairo-qt)
 
4425
    MOZ_WIDGET_TOOLKIT=qt
 
4426
    MOZ_ENABLE_QT=1
 
4427
    if test -z "$WITHOUT_X11"; then
 
4428
      MOZ_ENABLE_XREMOTE=1
 
4429
      MOZ_GL_DEFAULT_PROVIDER=GLX
 
4430
      MOZ_X11=1
 
4431
      AC_DEFINE(MOZ_X11)
 
4432
      XT_LIBS=
 
4433
    fi
 
4434
 
 
4435
    MOZ_WEBGL=1
 
4436
    USE_ELF_DYNSTR_GC=
 
4437
    USE_FC_FREETYPE=1
 
4438
    TK_CFLAGS='$(MOZ_QT_CFLAGS)'
 
4439
    TK_LIBS='$(MOZ_QT_LIBS)'
 
4440
    AC_DEFINE(MOZ_WIDGET_QT)
 
4441
    MOZ_PDF_PRINTING=1
 
4442
    ;;
 
4443
 
 
4444
cairo-os2)
 
4445
    MOZ_WIDGET_TOOLKIT=os2
 
4446
    USE_FC_FREETYPE=1
 
4447
    TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
 
4448
    TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
 
4449
    MOZ_PDF_PRINTING=1
 
4450
    ;;
 
4451
 
 
4452
cairo-cocoa)
 
4453
    MOZ_WIDGET_TOOLKIT=cocoa
 
4454
    AC_DEFINE(MOZ_WIDGET_COCOA)
 
4455
    LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
 
4456
    TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
 
4457
    TK_CFLAGS="-DNO_X11"
 
4458
    CFLAGS="$CFLAGS $TK_CFLAGS"
 
4459
    CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
 
4460
    LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
 
4461
    MOZ_USER_DIR="Mozilla"
 
4462
    MOZ_FS_LAYOUT=bundle
 
4463
    MOZ_WEBGL=1
 
4464
    MOZ_INSTRUMENT_EVENT_LOOP=1
 
4465
    ;;
 
4466
 
 
4467
cairo-uikit)
 
4468
    MOZ_WIDGET_TOOLKIT=uikit
 
4469
    AC_DEFINE(MOZ_WIDGET_UIKIT)
 
4470
    LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
 
4471
    TK_CFLAGS="-DNO_X11"
 
4472
    TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
 
4473
    CFLAGS="$CFLAGS $TK_CFLAGS"
 
4474
    CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
 
4475
    LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
 
4476
    MOZ_USER_DIR="Mozilla"
 
4477
    MOZ_FS_LAYOUT=bundle
 
4478
    ;;
 
4479
 
 
4480
cairo-android)
 
4481
    AC_DEFINE(MOZ_WIDGET_ANDROID)
 
4482
    MOZ_WIDGET_TOOLKIT=android
 
4483
    TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
 
4484
    TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
 
4485
    MOZ_WEBGL=1
 
4486
    MOZ_PDF_PRINTING=1
 
4487
    MOZ_INSTRUMENT_EVENT_LOOP=1
 
4488
    if test "$MOZ_BUILD_APP" = "mobile/xul"; then
 
4489
        MOZ_OLD_LINKER=1
 
4490
    fi
 
4491
    ;;
 
4492
 
 
4493
cairo-gonk)
 
4494
    AC_DEFINE(MOZ_WIDGET_GONK)
 
4495
    AC_DEFINE(MOZ_TOUCH)
 
4496
    MOZ_WIDGET_TOOLKIT=gonk
 
4497
    TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
 
4498
    TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
 
4499
    MOZ_WEBGL=1
 
4500
    MOZ_PDF_PRINTING=1
 
4501
    MOZ_TOUCH=1
 
4502
    ;;
 
4503
 
 
4504
esac
 
4505
 
 
4506
AC_SUBST(MOZ_OLD_LINKER)
 
4507
AC_SUBST(MOZ_PDF_PRINTING)
 
4508
if test "$MOZ_PDF_PRINTING"; then
 
4509
   PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
 
4510
   AC_DEFINE(MOZ_PDF_PRINTING)
 
4511
fi
 
4512
 
 
4513
if test "$MOZ_ENABLE_XREMOTE"; then
 
4514
    AC_DEFINE(MOZ_ENABLE_XREMOTE)
 
4515
fi
 
4516
 
 
4517
if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
 
4518
   AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
 
4519
fi
 
4520
 
 
4521
if test "$COMPILE_ENVIRONMENT"; then
 
4522
  if test "$MOZ_ENABLE_GTK2"; then
 
4523
    if test "$MOZ_X11"; then
 
4524
      GDK_PACKAGES=gdk-x11-2.0
 
4525
    fi
 
4526
 
 
4527
    PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
 
4528
  fi
 
4529
 
 
4530
fi # COMPILE_ENVIRONMENT
 
4531
 
 
4532
AC_SUBST(MOZ_FS_LAYOUT)
 
4533
 
 
4534
dnl ========================================================
 
4535
dnl Use ARM userspace kernel helpers; tell NSPR to enable
 
4536
dnl their usage and use them in spidermonkey.
 
4537
dnl ========================================================
 
4538
MOZ_ARG_WITH_BOOL(arm-kuser,
 
4539
[  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
 
4540
    USE_ARM_KUSER=1,)
 
4541
if test -n "$USE_ARM_KUSER"; then
 
4542
   AC_DEFINE(USE_ARM_KUSER)
 
4543
fi
 
4544
 
 
4545
dnl ========================================================
 
4546
dnl = startup-notification support module
 
4547
dnl ========================================================
 
4548
 
 
4549
if test "$MOZ_ENABLE_GTK2"
 
4550
then
 
4551
    MOZ_ENABLE_STARTUP_NOTIFICATION=
 
4552
 
 
4553
    MOZ_ARG_ENABLE_BOOL(startup-notification,
 
4554
    [  --enable-startup-notification
 
4555
                          Enable startup-notification support (default: disabled) ],
 
4556
        MOZ_ENABLE_STARTUP_NOTIFICATION=force,
 
4557
        MOZ_ENABLE_STARTUP_NOTIFICATION=)
 
4558
    if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
 
4559
    then
 
4560
        PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
 
4561
                          libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
 
4562
        [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
 
4563
            if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
 
4564
            then
 
4565
                AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
 
4566
            fi
 
4567
            MOZ_ENABLE_STARTUP_NOTIFICATION=
 
4568
        ])
 
4569
    fi
 
4570
 
 
4571
    if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
 
4572
        AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
 
4573
    fi
 
4574
 
 
4575
    TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
 
4576
fi
 
4577
AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
 
4578
AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
 
4579
AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
 
4580
 
 
4581
dnl ========================================================
 
4582
dnl = QT support
 
4583
dnl ========================================================
 
4584
if test "$MOZ_ENABLE_QT"
 
4585
then
 
4586
    MOZ_ARG_WITH_STRING(qtdir,
 
4587
    [  --with-qtdir=\$dir       Specify Qt directory ],
 
4588
    [ QTDIR=$withval])
 
4589
 
 
4590
    if test -z "$QTDIR"; then
 
4591
        PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
 
4592
        PKG_CHECK_MODULES(MOZ_QT5, QtWidgets QtMultimedia QtPrintSupport,
 
4593
                      MOZ_ENABLE_QT5=1,
 
4594
                      MOZ_ENABLE_QT5=)
 
4595
        if test "$MOZ_ENABLE_QT5"; then
 
4596
            echo "Using qt5"
 
4597
            MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT5_CFLAGS"
 
4598
            MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT5_LIBS"
 
4599
        fi
 
4600
 
 
4601
        AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
 
4602
        AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
 
4603
    else
 
4604
        MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
 
4605
 
 
4606
        MOZ_QT_CFLAGS="-DQT_SHARED"
 
4607
        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
 
4608
        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
 
4609
        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
 
4610
        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
 
4611
        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
 
4612
        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
 
4613
        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
 
4614
        HOST_MOC="$QTDIR/bin/moc"
 
4615
        HOST_RCC="$QTDIR/bin/rcc"
 
4616
 
 
4617
        # QtWidgets was introduced only in Qt5
 
4618
        if test -d $QTDIR/include/QtWidgets; then
 
4619
            MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
 
4620
            MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
 
4621
            MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtWidgets -lQtPrintSupport"
 
4622
        fi
 
4623
    fi
 
4624
    if test -z "$HOST_MOC"; then
 
4625
        AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
 
4626
incorrect])
 
4627
    fi
 
4628
    if test -z "$HOST_RCC"; then
 
4629
        AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
 
4630
incorrect])
 
4631
    fi
 
4632
 
 
4633
    MOC=$HOST_MOC
 
4634
    RCC=$HOST_RCC
 
4635
 
 
4636
    MOZ_ENABLE_QMSYSTEM2=
 
4637
    PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
 
4638
                      MOZ_ENABLE_QMSYSTEM2=1,
 
4639
                      MOZ_ENABLE_QMSYSTEM2=)
 
4640
 
 
4641
    if test "$MOZ_ENABLE_QMSYSTEM2"; then
 
4642
      MOZ_ENABLE_QMSYSTEM2=1
 
4643
      MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
 
4644
      MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
 
4645
      AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
 
4646
    fi
 
4647
 
 
4648
    MOZ_ENABLE_QTNETWORK=
 
4649
    PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
 
4650
                      MOZ_ENABLE_QTNETWORK=1,
 
4651
                      MOZ_ENABLE_QTNETWORK=)
 
4652
 
 
4653
    if test "$MOZ_ENABLE_QTNETWORK"; then
 
4654
      MOZ_ENABLE_QTNETWORK=1
 
4655
      AC_DEFINE(MOZ_ENABLE_QTNETWORK)
 
4656
    fi
 
4657
 
 
4658
    MOZ_ENABLE_QTMOBILITY=
 
4659
    PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
 
4660
                      MOZ_ENABLE_QTMOBILITY=1,
 
4661
                      MOZ_ENABLE_QTMOBILITY=)
 
4662
    if test "$MOZ_ENABLE_QTMOBILITY"; then
 
4663
       MOZ_ENABLE_QTMOBILITY=1
 
4664
       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
 
4665
       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
 
4666
    else
 
4667
       AC_CHECK_LIB(QtSensors, main, [
 
4668
          MOZ_ENABLE_QTMOBILITY=1
 
4669
          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
 
4670
          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
 
4671
          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
 
4672
          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
 
4673
          MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
 
4674
       ])
 
4675
    fi
 
4676
    if test "$MOZ_ENABLE_QTMOBILITY"; then
 
4677
       AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
 
4678
    fi
 
4679
fi
 
4680
 
 
4681
AC_SUBST(GTK_CONFIG)
 
4682
AC_SUBST(TK_CFLAGS)
 
4683
AC_SUBST(TK_LIBS)
 
4684
 
 
4685
AC_SUBST(MOZ_ENABLE_GTK2)
 
4686
AC_SUBST(MOZ_ENABLE_QT)
 
4687
AC_SUBST(MOZ_ENABLE_QTNETWORK)
 
4688
AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
 
4689
AC_SUBST(MOZ_ENABLE_QTMOBILITY)
 
4690
AC_SUBST(MOZ_ENABLE_XREMOTE)
 
4691
AC_SUBST(MOZ_GTK2_CFLAGS)
 
4692
AC_SUBST(MOZ_GTK2_LIBS)
 
4693
AC_SUBST(MOZ_WIDGET_GTK)
 
4694
AC_SUBST(MOZ_QT_CFLAGS)
 
4695
AC_SUBST(MOZ_QT_LIBS)
 
4696
 
 
4697
AC_SUBST(MOC)
 
4698
AC_SUBST(RCC)
 
4699
 
 
4700
AC_SUBST(MOZ_X11)
 
4701
 
 
4702
dnl ========================================================
 
4703
dnl =
 
4704
dnl = Components & Features
 
4705
dnl =
 
4706
dnl ========================================================
 
4707
MOZ_ARG_HEADER(Components and Features)
 
4708
 
 
4709
dnl ========================================================
 
4710
dnl = Localization
 
4711
dnl ========================================================
 
4712
MOZ_ARG_ENABLE_STRING(ui-locale,
 
4713
[  --enable-ui-locale=ab-CD
 
4714
                          Select the user interface locale (default: en-US)],
 
4715
    MOZ_UI_LOCALE=$enableval )
 
4716
AC_SUBST(MOZ_UI_LOCALE)
 
4717
 
 
4718
dnl ========================================================
 
4719
dnl = Trademarked Branding
 
4720
dnl ========================================================
 
4721
MOZ_ARG_ENABLE_BOOL(official-branding,
 
4722
[  --enable-official-branding
 
4723
                          Enable Official mozilla.org Branding
 
4724
                          Do not distribute builds with
 
4725
                          --enable-official-branding unless you have
 
4726
                          permission to use trademarks per
 
4727
                          http://www.mozilla.org/foundation/trademarks/ .],
 
4728
[
 
4729
  if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
 
4730
    AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
 
4731
  else
 
4732
    MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
 
4733
    MOZ_OFFICIAL_BRANDING=1
 
4734
  fi
 
4735
], MOZ_OFFICIAL_BRANDING=)
 
4736
 
 
4737
AC_SUBST(MOZ_OFFICIAL_BRANDING)
 
4738
if test -n "$MOZ_OFFICIAL_BRANDING"; then
 
4739
  AC_DEFINE(MOZ_OFFICIAL_BRANDING)
 
4740
fi
 
4741
 
 
4742
MOZ_ARG_WITH_STRING(branding,
 
4743
[  --with-branding=dir     Use branding from the specified directory.],
 
4744
    MOZ_BRANDING_DIRECTORY=$withval)
 
4745
 
 
4746
REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
 
4747
if test -z "$REAL_BRANDING_DIRECTORY"; then
 
4748
  REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
 
4749
fi
 
4750
 
 
4751
if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
 
4752
  . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
 
4753
fi
 
4754
 
 
4755
AC_SUBST(MOZ_BRANDING_DIRECTORY)
 
4756
 
 
4757
dnl ========================================================
 
4758
dnl = Distribution ID
 
4759
dnl ========================================================
 
4760
MOZ_ARG_WITH_STRING(distribution-id,
 
4761
[  --with-distribution-id=ID
 
4762
                          Set distribution-specific id (default=org.mozilla)],
 
4763
[ val=`echo $withval`
 
4764
    MOZ_DISTRIBUTION_ID="$val"])
 
4765
 
 
4766
if test -z "$MOZ_DISTRIBUTION_ID"; then
 
4767
   MOZ_DISTRIBUTION_ID="org.mozilla"
 
4768
fi
 
4769
 
 
4770
AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
 
4771
AC_SUBST(MOZ_DISTRIBUTION_ID)
 
4772
 
 
4773
 
 
4774
dnl ========================================================
 
4775
dnl complex text support off by default
 
4776
dnl ========================================================
 
4777
MOZ_ARG_DISABLE_BOOL(pango,
 
4778
[  --disable-pango         Disable usage of Pango ],
 
4779
    MOZ_PANGO=,
 
4780
    MOZ_PANGO=1)
 
4781
 
 
4782
dnl ========================================================
 
4783
dnl = Pango
 
4784
dnl ========================================================
 
4785
if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
 
4786
then
 
4787
    AC_SUBST(MOZ_PANGO)
 
4788
 
 
4789
    if test "$MOZ_PANGO"
 
4790
    then
 
4791
        PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
 
4792
 
 
4793
        PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
 
4794
        AC_SUBST(MOZ_PANGO_CFLAGS)
 
4795
        AC_SUBST(MOZ_PANGO_LIBS)
 
4796
        AC_DEFINE(MOZ_PANGO)
 
4797
    else
 
4798
        PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
 
4799
        AC_SUBST(FT2_CFLAGS)
 
4800
        AC_SUBST(FT2_LIBS)
 
4801
    fi
 
4802
fi
 
4803
 
 
4804
dnl ========================================================
 
4805
dnl = GnomeVFS, GIO and GConf support module
 
4806
dnl ========================================================
 
4807
 
 
4808
if test "$MOZ_X11"
 
4809
then
 
4810
    dnl build the gnomevfs extension by default only when the
 
4811
    dnl GTK2 toolkit is in use.
 
4812
    if test "$MOZ_ENABLE_GTK2"
 
4813
    then
 
4814
        MOZ_ENABLE_GNOMEVFS=1
 
4815
        MOZ_ENABLE_GCONF=1
 
4816
    fi
 
4817
 
 
4818
    dnl ========================================================
 
4819
    dnl = GnomeVFS support module
 
4820
    dnl ========================================================
 
4821
    MOZ_ARG_DISABLE_BOOL(gnomevfs,
 
4822
    [  --disable-gnomevfs      Disable GnomeVFS support ],
 
4823
        MOZ_ENABLE_GNOMEVFS=,
 
4824
        MOZ_ENABLE_GNOMEVFS=force)
 
4825
 
 
4826
    if test "$MOZ_ENABLE_GNOMEVFS"
 
4827
    then
 
4828
        PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
 
4829
            MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
 
4830
            MOZ_ENABLE_GNOMEVFS=1
 
4831
            AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
 
4832
        ],[
 
4833
            if test "$MOZ_ENABLE_GNOMEVFS" = "force"
 
4834
            then
 
4835
                AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
 
4836
            fi
 
4837
            MOZ_ENABLE_GNOMEVFS=
 
4838
        ])
 
4839
    else
 
4840
        if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
 
4841
            PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
 
4842
              MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
 
4843
            ])
 
4844
        fi
 
4845
    fi
 
4846
 
 
4847
    AC_SUBST(MOZ_ENABLE_GNOMEVFS)
 
4848
    AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
 
4849
    AC_SUBST(MOZ_GNOMEVFS_LIBS)
 
4850
 
 
4851
    dnl ========================================================
 
4852
    dnl = GIO support module
 
4853
    dnl ========================================================
 
4854
    MOZ_ARG_ENABLE_BOOL(gio,
 
4855
    [  --enable-gio            Enable GIO support (default: disabled)],
 
4856
        MOZ_ENABLE_GIO=force,
 
4857
        MOZ_ENABLE_GIO=)
 
4858
 
 
4859
    if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
 
4860
    then
 
4861
        PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
 
4862
                          [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
 
4863
        PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
 
4864
            MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
 
4865
            MOZ_ENABLE_GIO=1
 
4866
            AC_DEFINE(MOZ_ENABLE_GIO)
 
4867
        ],[
 
4868
            if test "$MOZ_ENABLE_GIO" = "force"
 
4869
            then
 
4870
                AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
 
4871
            fi
 
4872
            MOZ_ENABLE_GIO=
 
4873
        ])
 
4874
    fi
 
4875
 
 
4876
    AC_SUBST(MOZ_ENABLE_GIO)
 
4877
    AC_SUBST(MOZ_GIO_CFLAGS)
 
4878
    AC_SUBST(MOZ_GIO_LIBS)
 
4879
 
 
4880
    dnl ========================================================
 
4881
    dnl = GConf support module
 
4882
    dnl ========================================================
 
4883
    MOZ_ARG_DISABLE_BOOL(gconf,
 
4884
    [  --disable-gconf      Disable Gconf support ],
 
4885
        MOZ_ENABLE_GCONF=,
 
4886
        MOZ_ENABLE_GCONF=force)
 
4887
 
 
4888
    if test "$MOZ_ENABLE_GCONF"
 
4889
    then
 
4890
        PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
 
4891
            MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
 
4892
            MOZ_ENABLE_GCONF=1
 
4893
        ],[
 
4894
            if test "$MOZ_ENABLE_GCONF" = "force"
 
4895
            then
 
4896
                AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
 
4897
            fi
 
4898
            MOZ_ENABLE_GCONF=
 
4899
        ])
 
4900
    fi
 
4901
 
 
4902
    if test "$MOZ_ENABLE_GCONF"; then
 
4903
        AC_DEFINE(MOZ_ENABLE_GCONF)
 
4904
    fi
 
4905
 
 
4906
    AC_SUBST(MOZ_ENABLE_GCONF)
 
4907
    AC_SUBST(MOZ_GCONF_CFLAGS)
 
4908
    AC_SUBST(MOZ_GCONF_LIBS)
 
4909
fi
 
4910
 
 
4911
dnl ========================================================
 
4912
dnl = libproxy support
 
4913
dnl ========================================================
 
4914
 
 
4915
if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
 
4916
then
 
4917
    MOZ_ENABLE_LIBPROXY=
 
4918
 
 
4919
    MOZ_ARG_ENABLE_BOOL(libproxy,
 
4920
    [  --enable-libproxy         Enable libproxy support ],
 
4921
    MOZ_ENABLE_LIBPROXY=1,
 
4922
    MOZ_ENABLE_LIBPROXY=)
 
4923
 
 
4924
    if test "$MOZ_ENABLE_LIBPROXY"
 
4925
    then
 
4926
        PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
 
4927
        AC_DEFINE(MOZ_ENABLE_LIBPROXY)
 
4928
    fi
 
4929
fi
 
4930
AC_SUBST(MOZ_ENABLE_LIBPROXY)
 
4931
AC_SUBST(MOZ_LIBPROXY_CFLAGS)
 
4932
AC_SUBST(MOZ_LIBPROXY_LIBS)
 
4933
 
 
4934
dnl ========================================================
 
4935
dnl = GNOME component (mozgnome)
 
4936
dnl ========================================================
 
4937
 
 
4938
if test "$MOZ_ENABLE_GTK2"
 
4939
then
 
4940
    MOZ_ENABLE_GNOME_COMPONENT=1
 
4941
fi
 
4942
AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
 
4943
 
 
4944
dnl ========================================================
 
4945
dnl = libgnomeui support module
 
4946
dnl ========================================================
 
4947
 
 
4948
if test "$MOZ_ENABLE_GTK2"
 
4949
then
 
4950
    MOZ_ENABLE_GNOMEUI=1
 
4951
 
 
4952
    MOZ_ARG_DISABLE_BOOL(gnomeui,
 
4953
    [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
 
4954
        MOZ_ENABLE_GNOMEUI=,
 
4955
        MOZ_ENABLE_GNOMEUI=force)
 
4956
 
 
4957
    if test "$MOZ_ENABLE_GNOMEUI"
 
4958
    then
 
4959
        PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
 
4960
        [
 
4961
            MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
 
4962
            MOZ_ENABLE_GNOMEUI=1
 
4963
        ],[
 
4964
            if test "$MOZ_ENABLE_GNOMEUI" = "force"
 
4965
            then
 
4966
                AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
 
4967
            fi
 
4968
            MOZ_ENABLE_GNOMEUI=
 
4969
        ])
 
4970
    fi
 
4971
 
 
4972
    if test "$MOZ_ENABLE_GNOMEUI"; then
 
4973
        AC_DEFINE(MOZ_ENABLE_GNOMEUI)
 
4974
    fi
 
4975
fi
 
4976
 
 
4977
AC_SUBST(MOZ_ENABLE_GNOMEUI)
 
4978
AC_SUBST(MOZ_GNOMEUI_CFLAGS)
 
4979
AC_SUBST(MOZ_GNOMEUI_LIBS)
 
4980
 
 
4981
dnl ========================================================
 
4982
dnl = dbus support
 
4983
dnl ========================================================
 
4984
 
 
4985
if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
 
4986
then
 
4987
    MOZ_ENABLE_DBUS=1
 
4988
 
 
4989
    MOZ_ARG_DISABLE_BOOL(dbus,
 
4990
    [  --disable-dbus          Disable dbus support ],
 
4991
        MOZ_ENABLE_DBUS=,
 
4992
        MOZ_ENABLE_DBUS=1)
 
4993
 
 
4994
    if test "$MOZ_ENABLE_DBUS"
 
4995
    then
 
4996
        PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
 
4997
        PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
 
4998
        AC_DEFINE(MOZ_ENABLE_DBUS)
 
4999
    fi
 
5000
fi
 
5001
AC_SUBST(MOZ_ENABLE_DBUS)
 
5002
AC_SUBST(MOZ_DBUS_CFLAGS)
 
5003
AC_SUBST(MOZ_DBUS_LIBS)
 
5004
AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
 
5005
AC_SUBST(MOZ_DBUS_GLIB_LIBS)
 
5006
 
 
5007
dnl ========================================================
 
5008
dnl = Enable Android History instead of Places
 
5009
dnl ========================================================
 
5010
if test -n "$MOZ_ANDROID_HISTORY"; then
 
5011
     dnl Do this if defined in confvars.sh
 
5012
     AC_DEFINE(MOZ_ANDROID_HISTORY)
 
5013
fi
 
5014
 
 
5015
 
 
5016
dnl ========================================================
 
5017
dnl = Build with the Android Java compositor
 
5018
dnl ========================================================
 
5019
if test -n "$MOZ_JAVA_COMPOSITOR"; then
 
5020
     dnl Do this if defined in confvars.sh
 
5021
     AC_DEFINE(MOZ_JAVA_COMPOSITOR)
 
5022
fi
 
5023
 
 
5024
dnl ========================================================
 
5025
dnl = Disable WebSMS backend
 
5026
dnl ========================================================
 
5027
MOZ_ARG_DISABLE_BOOL(websms-backend,
 
5028
[  --disable-websms-backend
 
5029
                           Disable WebSMS backend],
 
5030
    MOZ_WEBSMS_BACKEND=,
 
5031
    MOZ_WEBSMS_BACKEND=1)
 
5032
 
 
5033
if test -n "$MOZ_WEBSMS_BACKEND"; then
 
5034
    AC_DEFINE(MOZ_WEBSMS_BACKEND)
 
5035
fi
 
5036
 
 
5037
dnl ========================================================
 
5038
dnl = Build Personal Security Manager
 
5039
dnl ========================================================
 
5040
MOZ_ARG_DISABLE_BOOL(crypto,
 
5041
[  --disable-crypto        Disable crypto support (Personal Security Manager)],
 
5042
    MOZ_PSM=,
 
5043
    MOZ_PSM=1 )
 
5044
 
 
5045
dnl ========================================================
 
5046
dnl = JS Debugger XPCOM component (js/jsd)
 
5047
dnl ========================================================
 
5048
MOZ_ARG_DISABLE_BOOL(jsd,
 
5049
[  --disable-jsd           Disable JavaScript debug library],
 
5050
    MOZ_JSDEBUGGER=,
 
5051
    MOZ_JSDEBUGGER=1)
 
5052
 
 
5053
 
 
5054
dnl ========================================================
 
5055
dnl = Enable IPDL's "expensive" unit tests
 
5056
dnl ========================================================
 
5057
MOZ_IPDL_TESTS=
 
5058
 
 
5059
MOZ_ARG_ENABLE_BOOL(ipdl-tests,
 
5060
[  --enable-ipdl-tests     Enable expensive IPDL tests],
 
5061
    MOZ_IPDL_TESTS=1,
 
5062
    MOZ_IPDL_TESTS=)
 
5063
 
 
5064
if test -n "$MOZ_IPDL_TESTS"; then
 
5065
    AC_DEFINE(MOZ_IPDL_TESTS)
 
5066
fi
 
5067
 
 
5068
AC_SUBST(MOZ_IPDL_TESTS)
 
5069
 
 
5070
dnl ========================================================
 
5071
dnl = Turns off code necessary for e10s compatibility
 
5072
dnl ========================================================
 
5073
dnl This is a temporary flag to be removed in bug 662601 when
 
5074
dnl it's no longer needed
 
5075
 
 
5076
MOZ_E10S_COMPAT=
 
5077
 
 
5078
MOZ_ARG_ENABLE_BOOL(e10s-compat,
 
5079
[  --enable-e10s-compat     Turns off code for e10s compat],
 
5080
    MOZ_E10S_COMPAT=1,
 
5081
    MOZ_E10S_COMPAT=)
 
5082
 
 
5083
if test -n "$MOZ_E10S_COMPAT"; then
 
5084
    AC_DEFINE(MOZ_E10S_COMPAT)
 
5085
fi
 
5086
 
 
5087
dnl ========================================================
 
5088
dnl = Disable building dbm
 
5089
dnl ========================================================
 
5090
MOZ_ARG_DISABLE_BOOL(dbm,
 
5091
[  --disable-dbm           Disable building dbm],
 
5092
    NSS_DISABLE_DBM=1,
 
5093
    NSS_DISABLE_DBM=)
 
5094
 
 
5095
dnl bi-directional support always on
 
5096
IBMBIDI=1
 
5097
AC_DEFINE(IBMBIDI)
 
5098
 
 
5099
dnl ========================================================
 
5100
dnl accessibility support on by default on all platforms
 
5101
dnl ========================================================
 
5102
MOZ_ARG_DISABLE_BOOL(accessibility,
 
5103
[  --disable-accessibility Disable accessibility support],
 
5104
    ACCESSIBILITY=,
 
5105
    ACCESSIBILITY=1 )
 
5106
if test "$ACCESSIBILITY"; then
 
5107
    AC_DEFINE(ACCESSIBILITY)
 
5108
fi
 
5109
 
 
5110
dnl ========================================================
 
5111
dnl Disable printing
 
5112
dnl ========================================================
 
5113
MOZ_ARG_DISABLE_BOOL(printing,
 
5114
[  --disable-printing      Disable printing support],
 
5115
    NS_PRINTING=,
 
5116
    NS_PRINTING=1)
 
5117
 
 
5118
if test "$NS_PRINTING"; then
 
5119
    AC_DEFINE(NS_PRINTING)
 
5120
    AC_DEFINE(NS_PRINT_PREVIEW)
 
5121
fi
 
5122
 
 
5123
dnl Turn off webrtc for OS's we don't handle yet, but allow 
 
5124
dnl --enable-webrtc to override.  Can disable for everything in
 
5125
dnl the master list above.
 
5126
if test -n "$MOZ_WEBRTC"; then
 
5127
    case "$target" in
 
5128
    *-android*|*-linuxandroid*)
 
5129
        dnl Make sure doesn't get matched by *-linux*
 
5130
        MOZ_WEBRTC=
 
5131
        ;;
 
5132
    *-linux*|*-mingw*|*-darwin*)
 
5133
        dnl Leave enabled
 
5134
        ;;
 
5135
    *)
 
5136
        dnl default to disabled for all others
 
5137
        MOZ_WEBRTC=
 
5138
        ;;
 
5139
    esac
 
5140
fi
 
5141
 
 
5142
dnl ========================================================
 
5143
dnl = Disable WebRTC code
 
5144
dnl ========================================================
 
5145
MOZ_ARG_DISABLE_BOOL(webrtc,
 
5146
[  --disable-webrtc        Disable support for WebRTC],
 
5147
    MOZ_WEBRTC=,
 
5148
    MOZ_WEBRTC=1)
 
5149
 
 
5150
if test -n "$MOZ_WEBRTC"; then
 
5151
    AC_DEFINE(MOZ_WEBRTC)
 
5152
    MOZ_MEDIA=1
 
5153
    MOZ_RAW=1
 
5154
    MOZ_VP8=1
 
5155
    MOZ_VP8_ENCODER=1
 
5156
    MOZ_VP8_ERROR_CONCEALMENT=1
 
5157
fi
 
5158
 
 
5159
AC_SUBST(MOZ_WEBRTC)
 
5160
 
 
5161
case "$target_cpu" in
 
5162
arm*)
 
5163
    MOZ_SAMPLE_TYPE_S16LE=1
 
5164
    AC_DEFINE(MOZ_SAMPLE_TYPE_S16LE)
 
5165
    AC_SUBST(MOZ_SAMPLE_TYPE_S16LE)
 
5166
;;
 
5167
*)
 
5168
    MOZ_SAMPLE_TYPE_FLOAT32=1
 
5169
    AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
 
5170
    AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
 
5171
;;
 
5172
esac
 
5173
 
 
5174
dnl ========================================================
 
5175
dnl = Enable Raw Codecs
 
5176
dnl ========================================================
 
5177
MOZ_ARG_ENABLE_BOOL(raw,
 
5178
[  --enable-raw           Enable support for RAW media],
 
5179
    MOZ_RAW=1,
 
5180
    MOZ_RAW=)
 
5181
 
 
5182
if test -n "$MOZ_RAW"; then
 
5183
    AC_DEFINE(MOZ_RAW)
 
5184
    MOZ_MEDIA=1
 
5185
fi
 
5186
 
 
5187
AC_SUBST(MOZ_RAW)
 
5188
 
 
5189
dnl ========================================================
 
5190
dnl = Disable Ogg Codecs
 
5191
dnl ========================================================
 
5192
MOZ_ARG_DISABLE_BOOL(ogg,
 
5193
[  --disable-ogg           Disable support for OGG media (Theora video and Vorbis audio)],
 
5194
    MOZ_OGG=,
 
5195
    MOZ_OGG=1)
 
5196
 
 
5197
if test -n "$MOZ_OGG"; then
 
5198
    AC_DEFINE(MOZ_OGG)
 
5199
    MOZ_SYDNEYAUDIO=1
 
5200
    MOZ_CUBEB=1
 
5201
    MOZ_MEDIA=1
 
5202
 
 
5203
    dnl Checks for __attribute__(aligned()) directive
 
5204
    AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
 
5205
        [ac_cv_c_attribute_aligned],
 
5206
        [ac_cv_c_attribute_aligned=0
 
5207
         CFLAGS_save="${CFLAGS}"
 
5208
         CFLAGS="${CFLAGS} -Werror"
 
5209
         for ac_cv_c_attr_align_try in 64 32 16 8; do
 
5210
           echo "trying $ac_cv_c_attr_align_try"
 
5211
           AC_TRY_COMPILE([],
 
5212
                          [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
 
5213
                          [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
 
5214
           if test "$ac_cv_c_attribute_aligned" != 0; then
 
5215
             break;
 
5216
           fi
 
5217
         done
 
5218
           CFLAGS="${CFLAGS_save}"])
 
5219
    if test "${ac_cv_c_attribute_aligned}" != "0"; then
 
5220
      AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
 
5221
                         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
 
5222
    fi
 
5223
fi
 
5224
 
 
5225
dnl ========================================================
 
5226
dnl = Disable Opus audio codec support
 
5227
dnl ========================================================
 
5228
MOZ_ARG_DISABLE_BOOL(opus,
 
5229
[  --disable-opus          Disable support for Opus audio],
 
5230
    MOZ_OPUS=,
 
5231
    MOZ_OPUS=1)
 
5232
 
 
5233
dnl ========================================================
 
5234
dnl = Disable VP8 decoder support
 
5235
dnl ========================================================
 
5236
MOZ_ARG_DISABLE_BOOL(webm,
 
5237
[  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
 
5238
    MOZ_WEBM=,
 
5239
    MOZ_WEBM=1)
 
5240
 
 
5241
if test -n "$MOZ_WEBM"; then
 
5242
    AC_DEFINE(MOZ_WEBM)
 
5243
    MOZ_VP8=1
 
5244
fi;
 
5245
 
 
5246
dnl ========================================================
 
5247
dnl = Enable media plugin support
 
5248
dnl ========================================================
 
5249
if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
 
5250
  dnl Enable support on android by default
 
5251
  MOZ_MEDIA_PLUGINS=1
 
5252
fi
 
5253
 
 
5254
MOZ_ARG_ENABLE_BOOL(media-plugins,
 
5255
[  --enable-media-plugins  Enable support for media plugins],
 
5256
    MOZ_MEDIA_PLUGINS=1,
 
5257
    MOZ_MEDIA_PLUGINS=)
 
5258
 
 
5259
if test -n "$MOZ_MEDIA_PLUGINS"; then
 
5260
  AC_DEFINE(MOZ_MEDIA_PLUGINS)
 
5261
fi
 
5262
 
 
5263
dnl ========================================================
 
5264
dnl = Enable getUserMedia support
 
5265
dnl ========================================================
 
5266
MOZ_ARG_ENABLE_BOOL(media-navigator,
 
5267
[  --enable-media-navigator  Enable support for getUserMedia],
 
5268
    MOZ_MEDIA_NAVIGATOR=1,
 
5269
    MOZ_MEDIA_NAVIGATOR=)
 
5270
 
 
5271
if test -n "$MOZ_MEDIA_NAVIGATOR"; then
 
5272
  AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
 
5273
fi
 
5274
 
 
5275
dnl ========================================================
 
5276
dnl = Enable building OMX media plugin (B2G or Android)
 
5277
dnl ========================================================
 
5278
if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
 
5279
  dnl Enable support on android by default
 
5280
  MOZ_OMX_PLUGIN=1
 
5281
fi
 
5282
 
 
5283
MOZ_ARG_ENABLE_BOOL(omx-plugin,
 
5284
[  --enable-omx-plugin      Enable building OMX plugin (B2G)],
 
5285
    MOZ_OMX_PLUGIN=1,
 
5286
    MOZ_OMX_PLUGIN=)
 
5287
 
 
5288
if test -n "$MOZ_OMX_PLUGIN"; then
 
5289
    if test "$OS_TARGET" = "Android"; then
 
5290
        dnl Only allow building OMX plugin on Gonk (B2G) or Android
 
5291
        AC_DEFINE(MOZ_OMX_PLUGIN)
 
5292
    else
 
5293
       dnl fail if we're not building on Gonk or Android
 
5294
       AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
 
5295
    fi
 
5296
fi
 
5297
 
 
5298
dnl system libvpx Support
 
5299
dnl ========================================================
 
5300
MOZ_ARG_WITH_BOOL(system-libvpx,
 
5301
[  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
 
5302
    MOZ_NATIVE_LIBVPX=1)
 
5303
 
 
5304
MOZ_LIBVPX_CFLAGS=
 
5305
MOZ_LIBVPX_LIBS=
 
5306
 
 
5307
if test -n "$MOZ_VP8"; then
 
5308
    AC_DEFINE(MOZ_VP8)
 
5309
    if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
 
5310
        AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
 
5311
    fi
 
5312
    if test -n "$MOZ_VP8_ENCODER" ; then
 
5313
        AC_DEFINE(MOZ_VP8_ENCODER)
 
5314
    fi
 
5315
 
 
5316
    if test -n "$MOZ_NATIVE_LIBVPX"; then
 
5317
        dnl ============================
 
5318
        dnl === libvpx Version check ===
 
5319
        dnl ============================
 
5320
        dnl Check to see if we have a system libvpx package.
 
5321
        PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.0.0)
 
5322
 
 
5323
        MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], 
 
5324
         [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
 
5325
 
 
5326
        _SAVE_LIBS=$LIBS
 
5327
        AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], 
 
5328
         [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
 
5329
        LIBS=$_SAVE_LIBS
 
5330
    fi
 
5331
fi
 
5332
 
 
5333
AC_SUBST(MOZ_NATIVE_LIBVPX)
 
5334
AC_SUBST(MOZ_LIBVPX_CFLAGS)
 
5335
AC_SUBST(MOZ_LIBVPX_LIBS)
 
5336
 
 
5337
if test "$MOZ_WEBM"; then
 
5338
    MOZ_SYDNEYAUDIO=1
 
5339
    MOZ_CUBEB=1
 
5340
    MOZ_MEDIA=1
 
5341
    if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
 
5342
        MOZ_VORBIS=1
 
5343
    else
 
5344
        MOZ_TREMOR=1
 
5345
    fi
 
5346
fi
 
5347
 
 
5348
if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE_LIBVPX"; then
 
5349
 
 
5350
    dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
 
5351
    dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
 
5352
    dnl We currently require gcc on all arm platforms.
 
5353
    VPX_AS=$YASM
 
5354
    VPX_ASM_SUFFIX=asm
 
5355
    VPX_NEED_OBJ_INT_EXTRACT=
 
5356
 
 
5357
    dnl See if we have assembly on this platform.
 
5358
    case "$OS_ARCH:$CPU_ARCH" in
 
5359
    Linux:x86)
 
5360
      VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
 
5361
      VPX_X86_ASM=1
 
5362
    ;;
 
5363
    Linux:x86_64)
 
5364
      VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
 
5365
      VPX_X86_ASM=1
 
5366
    ;;
 
5367
    SunOS:x86)
 
5368
      VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
 
5369
      VPX_X86_ASM=1
 
5370
    ;;
 
5371
    SunOS:x86_64)
 
5372
      VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
 
5373
      VPX_X86_ASM=1
 
5374
    ;;
 
5375
    OpenBSD:x86)
 
5376
      VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
 
5377
      VPX_X86_ASM=1
 
5378
    ;;
 
5379
    OpenBSD:x86_64)
 
5380
      VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
 
5381
      VPX_X86_ASM=1
 
5382
    ;;
 
5383
    Darwin:x86)
 
5384
      VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
 
5385
      VPX_X86_ASM=1
 
5386
    ;;
 
5387
    Darwin:x86_64)
 
5388
      VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
 
5389
      VPX_X86_ASM=1
 
5390
    ;;
 
5391
    WINNT:x86_64)
 
5392
      VPX_ASFLAGS="-f x64 -rnasm -pnasm"
 
5393
      VPX_X86_ASM=1
 
5394
    ;;
 
5395
    WINNT:x86)
 
5396
      dnl Check for yasm 1.1 or greater.
 
5397
      if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
 
5398
        AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed.  Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
 
5399
      elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
 
5400
        AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
 
5401
      else
 
5402
        VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
 
5403
        VPX_X86_ASM=1
 
5404
        dnl The encoder needs obj_int_extract to get asm offsets.
 
5405
      fi
 
5406
    ;;
 
5407
    *:arm*)
 
5408
      if test -n "$GNU_AS" ; then
 
5409
        VPX_AS=$AS
 
5410
        dnl These flags are a lie; they're just used to enable the requisite
 
5411
        dnl opcodes; actual arch detection is done at runtime.
 
5412
        VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
 
5413
        VPX_DASH_C_FLAG="-c"
 
5414
        VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
 
5415
        VPX_ASM_SUFFIX="$ASM_SUFFIX"
 
5416
        VPX_ARM_ASM=1
 
5417
      fi
 
5418
    esac
 
5419
 
 
5420
    if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
 
5421
      AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
 
5422
    fi
 
5423
 
 
5424
    if test -n "$MOZ_VP8_ENCODER" -a \
 
5425
            -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
 
5426
      dnl We prefer to get asm offsets using inline assembler, which the above
 
5427
      dnl compilers can do. When we're not using one of those, we have to fall
 
5428
      dnl back to obj_int_extract, which reads them from a compiled object
 
5429
      dnl file. Unfortunately, that only works if we're compiling on a system
 
5430
      dnl with the header files for the appropriate object file format.
 
5431
      VPX_NEED_OBJ_INT_EXTRACT=1
 
5432
    fi
 
5433
 
 
5434
    if test -n "$VPX_X86_ASM"; then
 
5435
      AC_DEFINE(VPX_X86_ASM)
 
5436
    elif test -n "$VPX_ARM_ASM"; then
 
5437
      AC_DEFINE(VPX_ARM_ASM)
 
5438
    else
 
5439
      AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
 
5440
    fi
 
5441
fi
 
5442
 
 
5443
dnl ========================================================
 
5444
dnl = Disable Wave decoder support
 
5445
dnl ========================================================
 
5446
MOZ_ARG_DISABLE_BOOL(wave,
 
5447
[  --disable-wave          Disable Wave decoder support],
 
5448
    MOZ_WAVE=,
 
5449
    MOZ_WAVE=1)
 
5450
 
 
5451
if test -n "$MOZ_WAVE"; then
 
5452
    AC_DEFINE(MOZ_WAVE)
 
5453
    MOZ_SYDNEYAUDIO=1
 
5454
    MOZ_CUBEB=1
 
5455
    MOZ_MEDIA=1
 
5456
fi
 
5457
 
 
5458
dnl ========================================================
 
5459
dnl = Handle dependent SYDNEYAUDIO, CUBEB, and MEDIA defines
 
5460
dnl ========================================================
 
5461
 
 
5462
if test -n "$MOZ_SYDNEYAUDIO"; then
 
5463
    AC_DEFINE(MOZ_SYDNEYAUDIO)
 
5464
fi
 
5465
 
 
5466
if test -n "$MOZ_SPEEX_RESAMPLER"; then
 
5467
    AC_DEFINE(MOZ_SPEEX_RESAMPLER)
 
5468
fi
 
5469
 
 
5470
if test -n "$MOZ_CUBEB"; then
 
5471
    case "$target" in
 
5472
    *-android*|*-linuxandroid*)
 
5473
        dnl No Android implementation of libcubeb yet.
 
5474
        ;;
 
5475
    *-linux*)
 
5476
        AC_DEFINE(MOZ_CUBEB)
 
5477
        ;;
 
5478
    *-mingw*)
 
5479
        AC_DEFINE(MOZ_CUBEB)
 
5480
        ;;
 
5481
    *-darwin*)
 
5482
        AC_DEFINE(MOZ_CUBEB)
 
5483
        ;;
 
5484
    *-openbsd*)
 
5485
        AC_DEFINE(MOZ_CUBEB)
 
5486
        ;;
 
5487
    *)
 
5488
        dnl Other targets will be enabled soon.
 
5489
        ;;
 
5490
    esac
 
5491
fi
 
5492
 
 
5493
if test -n "$MOZ_MEDIA"; then
 
5494
    AC_DEFINE(MOZ_MEDIA)
 
5495
fi
 
5496
 
 
5497
if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
 
5498
    AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive!  The build system should not allow them both to be set, but they are.  Please file a bug at https://bugzilla.mozilla.org/])
 
5499
fi
 
5500
 
 
5501
if test -n "$MOZ_VORBIS"; then
 
5502
    AC_DEFINE(MOZ_VORBIS)
 
5503
fi
 
5504
 
 
5505
if test -n "$MOZ_TREMOR"; then
 
5506
    AC_DEFINE(MOZ_TREMOR)
 
5507
fi
 
5508
 
 
5509
if test -n "$MOZ_OPUS"; then
 
5510
    AC_DEFINE(MOZ_OPUS)
 
5511
fi
 
5512
 
 
5513
dnl ========================================================
 
5514
dnl = Check alsa availability on Linux if using sydneyaudio
 
5515
dnl ========================================================
 
5516
 
 
5517
dnl If using sydneyaudio with Linux, ensure that the alsa library is available
 
5518
if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
 
5519
    PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
 
5520
         [echo "$MOZ_ALSA_PKG_ERRORS"
 
5521
          AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux.  Disable with --disable-ogg --disable-wave --disable-webm.  (On Ubuntu, you might try installing the package libasound2-dev.)])])
 
5522
fi
 
5523
 
 
5524
dnl ========================================================
 
5525
dnl = Enable PulseAudio
 
5526
dnl ========================================================
 
5527
 
 
5528
MOZ_ARG_ENABLE_BOOL(pulseaudio,
 
5529
[  --enable-pulseaudio          Enable PulseAudio support (experimental)],
 
5530
MOZ_PULSEAUDIO=1,
 
5531
MOZ_PULSEAUDIO=)
 
5532
 
 
5533
if test -n "$MOZ_PULSEAUDIO"; then
 
5534
    AC_DEFINE(MOZ_CUBEB)
 
5535
    PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
 
5536
         [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
 
5537
          AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
 
5538
fi
 
5539
 
 
5540
AC_SUBST(MOZ_PULSEAUDIO)
 
5541
AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
 
5542
AC_SUBST(MOZ_PULSEAUDIO_LIBS)
 
5543
 
 
5544
dnl ========================================================
 
5545
dnl = Enable GStreamer
 
5546
dnl ========================================================
 
5547
MOZ_ARG_ENABLE_BOOL(gstreamer,
 
5548
[  --enable-gstreamer           Enable GStreamer support],
 
5549
MOZ_GSTREAMER=1,
 
5550
MOZ_GSTREAMER=)
 
5551
 
 
5552
if test "$MOZ_GSTREAMER"; then
 
5553
    # API version, eg 0.10, 1.0 etc
 
5554
    GST_API_VERSION=0.10
 
5555
    # core/base release number
 
5556
    # depend on >= 0.10.33 as that's when the playbin2 source-setup signal was
 
5557
    # introduced
 
5558
    GST_VERSION=0.10.33
 
5559
    PKG_CHECK_MODULES(GSTREAMER,
 
5560
                      gstreamer-$GST_API_VERSION >= $GST_VERSION
 
5561
                      gstreamer-app-$GST_API_VERSION
 
5562
                      gstreamer-plugins-base-$GST_API_VERSION)
 
5563
    if test -n "$GSTREAMER_LIBS"; then
 
5564
       _SAVE_LDFLAGS=$LDFLAGS
 
5565
       LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
 
5566
       AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
 
5567
       if test -n "$_HAVE_LIBGSTVIDEO" ; then
 
5568
          GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
 
5569
       else
 
5570
          AC_MSG_ERROR([gstreamer video backend requires libgstvideo])
 
5571
       fi
 
5572
       LDFLAGS=$_SAVE_LDFLAGS
 
5573
    else
 
5574
       AC_MSG_ERROR([gstreamer backend requires the gstreamer packages])
 
5575
    fi
 
5576
fi
 
5577
AC_SUBST(GSTREAMER_CFLAGS)
 
5578
AC_SUBST(GSTREAMER_LIBS)
 
5579
AC_SUBST(MOZ_GSTREAMER)
 
5580
 
 
5581
if test -n "$MOZ_GSTREAMER"; then
 
5582
   AC_DEFINE(MOZ_GSTREAMER)
 
5583
   MOZ_MEDIA=1
 
5584
fi
 
5585
 
 
5586
 
 
5587
dnl ========================================================
 
5588
dnl Permissions System
 
5589
dnl ========================================================
 
5590
MOZ_ARG_DISABLE_BOOL(permissions,
 
5591
[  --disable-permissions   Disable permissions (popup and cookie blocking)],
 
5592
    MOZ_PERMISSIONS=,
 
5593
    MOZ_PERMISSIONS=1
 
5594
)
 
5595
 
 
5596
dnl ========================================================
 
5597
dnl NegotiateAuth
 
5598
dnl ========================================================
 
5599
MOZ_ARG_DISABLE_BOOL(negotiateauth,
 
5600
[  --disable-negotiateauth Disable GSS-API negotiation ],
 
5601
    MOZ_AUTH_EXTENSION=,
 
5602
    MOZ_AUTH_EXTENSION=1 )
 
5603
 
 
5604
dnl ========================================================
 
5605
dnl XTF
 
5606
dnl ========================================================
 
5607
MOZ_ARG_DISABLE_BOOL(xtf,
 
5608
[  --disable-xtf           Disable XTF (pluggable xml tags) support],
 
5609
    MOZ_XTF=,
 
5610
    MOZ_XTF=1 )
 
5611
if test "$MOZ_XTF"; then
 
5612
  AC_DEFINE(MOZ_XTF)
 
5613
fi
 
5614
 
 
5615
dnl ========================================================
 
5616
dnl Pref extensions (autoconfig)
 
5617
dnl ========================================================
 
5618
MOZ_ARG_DISABLE_BOOL(pref-extensions,
 
5619
[  --disable-pref-extensions
 
5620
                          Disable pref extensions such as autoconfig],
 
5621
  MOZ_PREF_EXTENSIONS=,
 
5622
  MOZ_PREF_EXTENSIONS=1 )
 
5623
 
 
5624
dnl ========================================================
 
5625
dnl Searching of system directories for extensions.
 
5626
dnl Note: this switch is meant to be used for test builds
 
5627
dnl whose behavior should not depend on what happens to be
 
5628
dnl installed on the local machine.
 
5629
dnl ========================================================
 
5630
MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
 
5631
[  --disable-system-extension-dirs
 
5632
                          Disable searching system- and account-global
 
5633
                          directories for extensions of any kind; use
 
5634
                          only profile-specific extension directories],
 
5635
  ENABLE_SYSTEM_EXTENSION_DIRS=,
 
5636
  ENABLE_SYSTEM_EXTENSION_DIRS=1 )
 
5637
if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
 
5638
  AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
 
5639
fi
 
5640
 
 
5641
dnl ========================================================
 
5642
dnl = Universalchardet
 
5643
dnl ========================================================
 
5644
MOZ_ARG_DISABLE_BOOL(universalchardet,
 
5645
[  --disable-universalchardet
 
5646
                          Disable universal encoding detection],
 
5647
  MOZ_UNIVERSALCHARDET=,
 
5648
  MOZ_UNIVERSALCHARDET=1 )
 
5649
 
 
5650
if test -n "${JAVA_BIN_PATH}"; then
 
5651
  dnl Look for javac and jar in the specified path.
 
5652
  JAVA_PATH="$JAVA_BIN_PATH"
 
5653
else
 
5654
  dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
 
5655
  JAVA_PATH="$JAVA_HOME/bin:$PATH"
 
5656
fi
 
5657
 
 
5658
MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
 
5659
MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
 
5660
MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
 
5661
 
 
5662
if test -n "${JAVA_BIN_PATH}" -o \
 
5663
  \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
 
5664
  if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
 
5665
    AC_MSG_ERROR([The programs java, javac and jar were not found.  Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
 
5666
  fi
 
5667
fi
 
5668
 
 
5669
dnl ========================================================
 
5670
dnl = ANGLE OpenGL->D3D translator for WebGL
 
5671
dnl = * only applies to win32
 
5672
dnl = * enabled by default (shipping build); requires explicit --disable to disable
 
5673
dnl ========================================================
 
5674
MOZ_ANGLE_RENDERER=
 
5675
MOZ_DIRECTX_SDK_PATH=
 
5676
MOZ_DIRECTX_SDK_CPU_SUFFIX=
 
5677
MOZ_D3DX9_VERSION=
 
5678
MOZ_D3DX9_CAB=
 
5679
MOZ_D3DCOMPILER_CAB=
 
5680
MOZ_D3DX9_DLL=
 
5681
MOZ_D3DCOMPILER_DLL=
 
5682
case "$target_os" in
 
5683
*mingw*)
 
5684
    MOZ_ANGLE_RENDERER=1
 
5685
    ;;
 
5686
esac
 
5687
 
 
5688
# The DirectX SDK libraries are split into x86 and x64 sub-directories
 
5689
case "${target_cpu}" in
 
5690
i*86)
 
5691
  MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
 
5692
  ;;
 
5693
x86_64)
 
5694
  MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
 
5695
  ;;
 
5696
esac
 
5697
 
 
5698
MOZ_ARG_DISABLE_BOOL(webgl,
 
5699
[  --disable-webgl     Disable building of the WebGL implementation],
 
5700
    MOZ_WEBGL_DISABLED=1,
 
5701
    MOZ_WEBGL_DISABLED=)
 
5702
 
 
5703
if test -n "$MOZ_WEBGL_DISABLED"; then
 
5704
  MOZ_WEBGL=
 
5705
  MOZ_ANGLE_RENDERER=
 
5706
fi
 
5707
 
 
5708
if test -n "$MOZ_ANGLE_RENDERER"; then
 
5709
  # Get the SDK path from the registry.
 
5710
  # First try to get the June 2010 SDK
 
5711
  MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
 
5712
  if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
 
5713
    # Otherwise just take whatever comes first
 
5714
    MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
 
5715
  fi
 
5716
 
 
5717
  if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
 
5718
    AC_MSG_ERROR([Found the February 2010 DirectX SDK. Need the June 2010 DirectX SDK, or newer.  Upgrade your SDK or reconfigure with --disable-webgl.])
 
5719
  else
 
5720
    MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
 
5721
  fi
 
5722
 
 
5723
  if test -n "$MOZ_DIRECTX_SDK_PATH" &&
 
5724
     test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
 
5725
         test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
 
5726
    AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
 
5727
  else
 
5728
    AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for WebGL. Either install it (June 2010 version or newer), or reconfigure with --disable-webgl.])
 
5729
  fi
 
5730
 
 
5731
  # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
 
5732
  MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
 
5733
 
 
5734
  if test -z "$MOZ_D3DX9_VERSION" ; then
 
5735
        AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for WebGL. Either reinstall the DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
 
5736
  fi
 
5737
 
 
5738
  MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
 
5739
  MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
 
5740
 
 
5741
  if test -z "$MOZ_D3DX9_CAB" -o -z "$MOZ_D3DCOMPILER_CAB"; then
 
5742
    AC_MSG_ERROR([Couldn't find the DirectX redistributable files. Either reinstall the DirectX SDK (making sure the "DirectX Redistributable Files" option is selected), or reconfigure with --disable-webgl.])
 
5743
  fi
 
5744
 
 
5745
  MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
 
5746
  MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
 
5747
fi
 
5748
 
 
5749
dnl ========================================================
 
5750
dnl = Breakpad crash reporting (on by default on supported platforms)
 
5751
dnl ========================================================
 
5752
 
 
5753
case $target in
 
5754
i?86-*-mingw*|x86_64-*-mingw*)
 
5755
  MOZ_CRASHREPORTER=1
 
5756
  ;;
 
5757
i?86-apple-darwin*|x86_64-apple-darwin*)
 
5758
  MOZ_CRASHREPORTER=1
 
5759
  ;;
 
5760
i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
 
5761
  if test "$MOZ_ENABLE_GTK2"; then
 
5762
    MOZ_CRASHREPORTER=1
 
5763
  fi
 
5764
  ;;
 
5765
*-android*|*-linuxandroid*)
 
5766
  MOZ_CRASHREPORTER=1
 
5767
  ;;
 
5768
*solaris*)
 
5769
  MOZ_CRASHREPORTER=1
 
5770
  ;;
 
5771
esac
 
5772
 
 
5773
MOZ_ARG_DISABLE_BOOL(crashreporter,
 
5774
[  --disable-crashreporter Disable breakpad crash reporting],
 
5775
    MOZ_CRASHREPORTER=,
 
5776
    MOZ_CRASHREPORTER=1)
 
5777
 
 
5778
if test -n "$MOZ_CRASHREPORTER"; then
 
5779
   AC_DEFINE(MOZ_CRASHREPORTER)
 
5780
 
 
5781
  if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
 
5782
    test -z "$SKIP_LIBRARY_CHECKS"; then
 
5783
    PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
 
5784
    AC_SUBST(MOZ_GTHREAD_CFLAGS)
 
5785
    AC_SUBST(MOZ_GTHREAD_LIBS)
 
5786
 
 
5787
    MOZ_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
 
5788
  fi
 
5789
 
 
5790
  if test "$OS_ARCH" != "$HOST_OS_ARCH"; then
 
5791
    AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.  Use --disable-crashreporter.])
 
5792
  fi
 
5793
 
 
5794
  if test "$OS_ARCH" = "WINNT" -a -z "$HAVE_64BIT_OS"; then
 
5795
    MOZ_CRASHREPORTER_INJECTOR=1
 
5796
    AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
 
5797
  fi
 
5798
fi
 
5799
 
 
5800
MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
 
5801
[  --with-crashreporter-enable-percent=NN
 
5802
                          Enable sending crash reports by default on NN% of users. (default=100)],
 
5803
[ val=`echo $withval | sed 's/[^0-9]//g'`
 
5804
    MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
 
5805
 
 
5806
if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
 
5807
   MOZ_CRASHREPORTER_ENABLE_PERCENT=100
 
5808
fi
 
5809
AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
 
5810
 
 
5811
dnl ========================================================
 
5812
dnl = libjpeg-turbo configuration
 
5813
dnl ========================================================
 
5814
MOZ_LIBJPEG_TURBO=
 
5815
if test -z "$MOZ_NATIVE_JPEG"; then
 
5816
    MOZ_LIBJPEG_TURBO=1
 
5817
fi
 
5818
 
 
5819
MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
 
5820
[ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
 
5821
    MOZ_LIBJPEG_TURBO=,
 
5822
    MOZ_LIBJPEG_TURBO=1)
 
5823
 
 
5824
if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
 
5825
    AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
 
5826
fi
 
5827
 
 
5828
dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
 
5829
dnl files.
 
5830
 
 
5831
if test -n "$MOZ_LIBJPEG_TURBO"; then
 
5832
 
 
5833
  dnl Do we support libjpeg-turbo on this platform?
 
5834
  case "$OS_ARCH:$OS_TEST" in
 
5835
  Linux:x86|Linux:i?86)
 
5836
    LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
 
5837
    LIBJPEG_TURBO_X86_ASM=1
 
5838
  ;;
 
5839
  Linux:x86_64)
 
5840
    LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
 
5841
    LIBJPEG_TURBO_X64_ASM=1
 
5842
  ;;
 
5843
  SunOS:i?86)
 
5844
    LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
 
5845
    LIBJPEG_TURBO_X86_ASM=1
 
5846
  ;;
 
5847
  SunOS:x86_64)
 
5848
    LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
 
5849
    LIBJPEG_TURBO_X64_ASM=1
 
5850
  ;;
 
5851
  Darwin:i?86)
 
5852
    LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
 
5853
    LIBJPEG_TURBO_X86_ASM=1
 
5854
  ;;
 
5855
  Darwin:x86_64)
 
5856
    LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
 
5857
    LIBJPEG_TURBO_X64_ASM=1
 
5858
  ;;
 
5859
  WINNT:x86|WINNT:i?86)
 
5860
    LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
 
5861
    LIBJPEG_TURBO_X86_ASM=1
 
5862
  ;;
 
5863
  WINNT:x86_64)
 
5864
    LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
 
5865
    LIBJPEG_TURBO_X64_ASM=1
 
5866
  ;;
 
5867
  *:arm*)
 
5868
    LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
 
5869
    LIBJPEG_TURBO_ARM_ASM=1
 
5870
  ;;
 
5871
  esac
 
5872
 
 
5873
fi
 
5874
 
 
5875
dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
 
5876
dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
 
5877
dnl it doesn't exist or we have too old of a version.
 
5878
if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
 
5879
    AC_MSG_CHECKING([for Yasm assembler])
 
5880
    AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
 
5881
 
 
5882
    if test -z "$LIBJPEG_TURBO_AS" ; then
 
5883
        AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed.  Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
 
5884
    fi
 
5885
 
 
5886
    dnl Check that we have the right yasm version.  We require 1.0.1 or newer
 
5887
    dnl on Linux and 1.1 or newer everywhere else.
 
5888
    if test "$OS_ARCH" = "Linux" ; then
 
5889
        if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
 
5890
            AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
 
5891
        fi
 
5892
    else
 
5893
        if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
 
5894
            AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
 
5895
        fi
 
5896
    fi
 
5897
fi
 
5898
 
 
5899
dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
 
5900
dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
 
5901
if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
 
5902
    echo "Using $AS as the assembler for ARM code."
 
5903
    LIBJPEG_TURBO_AS=$AS
 
5904
fi
 
5905
 
 
5906
if test -n "$LIBJPEG_TURBO_X86_ASM"; then
 
5907
    AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
 
5908
elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
 
5909
    AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
 
5910
elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
 
5911
    AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
 
5912
elif test -n "$MOZ_LIBJPEG_TURBO"; then
 
5913
    dnl Warn if we're not building the optimized routines, even though the user
 
5914
    dnl didn't specify --disable-libjpeg-turbo.
 
5915
    AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
 
5916
fi
 
5917
 
 
5918
dnl ========================================================
 
5919
dnl = Enable compilation of specific extension modules
 
5920
dnl ========================================================
 
5921
 
 
5922
MOZ_ARG_ENABLE_STRING(extensions,
 
5923
[  --enable-extensions     Enable extensions],
 
5924
[ for option in `echo $enableval | sed 's/,/ /g'`; do
 
5925
    if test "$option" = "yes" -o "$option" = "all"; then
 
5926
        AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
 
5927
    elif test "$option" = "no" -o "$option" = "none"; then
 
5928
        MOZ_EXTENSIONS=""
 
5929
    elif test "$option" = "default"; then
 
5930
        MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
 
5931
    elif test `echo "$option" | grep -c \^-` != 0; then
 
5932
        option=`echo $option | sed 's/^-//'`
 
5933
        MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
 
5934
    else
 
5935
        MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
 
5936
    fi
 
5937
done],
 
5938
    MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
 
5939
 
 
5940
if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
 
5941
    # Suppress warning on non-X11 platforms
 
5942
    if test -n "$MOZ_X11"; then
 
5943
        AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
 
5944
    fi
 
5945
    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
 
5946
fi
 
5947
 
 
5948
dnl Do not build gnomevfs with libxul based apps
 
5949
if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
 
5950
    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
 
5951
fi
 
5952
 
 
5953
if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
 
5954
    # Suppress warning on non-X11 platforms
 
5955
    if test -n "$MOZ_X11"; then
 
5956
        AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
 
5957
    fi
 
5958
    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
 
5959
fi
 
5960
 
 
5961
dnl Do not build gio with libxul based apps
 
5962
if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
 
5963
    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
 
5964
fi
 
5965
 
 
5966
if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
 
5967
    AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
 
5968
    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
 
5969
fi
 
5970
 
 
5971
dnl xforms requires xtf
 
5972
if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
 
5973
    AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
 
5974
    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
 
5975
fi
 
5976
 
 
5977
dnl Remove dupes
 
5978
MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
 
5979
 
 
5980
dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
 
5981
dnl when trying to build a nonexistent extension.
 
5982
for extension in $MOZ_EXTENSIONS; do
 
5983
    if test ! -d "${srcdir}/extensions/${extension}"; then
 
5984
        AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
 
5985
    fi
 
5986
done
 
5987
 
 
5988
if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
 
5989
  AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
 
5990
fi
 
5991
 
 
5992
dnl ========================================================
 
5993
dnl CSS3 Flexbox Support
 
5994
dnl ========================================================
 
5995
if test -n "$MOZ_FLEXBOX"; then
 
5996
  AC_DEFINE(MOZ_FLEXBOX)
 
5997
fi
 
5998
 
 
5999
dnl ========================================================
 
6000
dnl Build Freetype in the tree
 
6001
dnl ========================================================
 
6002
MOZ_ARG_ENABLE_BOOL(tree-freetype,
 
6003
[  --enable-tree-freetype  Enable Tree FreeType],
 
6004
    MOZ_TREE_FREETYPE=1,
 
6005
    MOZ_TREE_FREETYPE= )
 
6006
if test -n "$MOZ_TREE_FREETYPE"; then
 
6007
   if test -n "$_WIN32_MSVC"; then
 
6008
      AC_ERROR("building with in-tree freetype is not supported on MSVC")
 
6009
   fi
 
6010
   AC_DEFINE(MOZ_TREE_FREETYPE)
 
6011
   AC_SUBST(MOZ_TREE_FREETYPE)
 
6012
   MOZ_ENABLE_CAIRO_FT=1
 
6013
   FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
 
6014
   FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
 
6015
   CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
 
6016
   FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
 
6017
   CAIRO_FT_OSLIBS=''
 
6018
   CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
 
6019
   AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
 
6020
   AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
 
6021
   AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
 
6022
   AC_SUBST(CAIRO_FT_CFLAGS)
 
6023
fi
 
6024
 
 
6025
dnl ========================================================
 
6026
dnl Installer
 
6027
dnl ========================================================
 
6028
dnl Abort Windows build if the required major version and
 
6029
dnl minimum minor version of Unicode NSIS isn't in the path
 
6030
dnl (unless in case of cross compiling, for which Unicode
 
6031
dnl is not yet sufficient).
 
6032
if test "$OS_ARCH" = "WINNT"; then
 
6033
    REQ_NSIS_MAJOR_VER=2
 
6034
    MIN_NSIS_MINOR_VER=33
 
6035
    MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
 
6036
    if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
 
6037
      AC_MSG_RESULT([yes])
 
6038
      changequote(,)
 
6039
      MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
 
6040
      changequote([,])
 
6041
      if test ! "$MAKENSISU_VER" = ""; then
 
6042
          MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
 
6043
          MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
 
6044
      fi
 
6045
      AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
 
6046
      if test "$MAKENSISU_VER" = "" || \
 
6047
         test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
 
6048
              ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
 
6049
          AC_MSG_RESULT([no])
 
6050
          if test -z "$CROSS_COMPILE"; then
 
6051
            AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path.])
 
6052
          else
 
6053
            MAKENSISU=
 
6054
          fi
 
6055
      fi
 
6056
    elif test -z "$CROSS_COMPILE"; then
 
6057
      AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path.])
 
6058
    else
 
6059
      MAKENSISU=
 
6060
    fi
 
6061
fi
 
6062
 
 
6063
dnl ========================================================
 
6064
dnl Web App Runtime
 
6065
dnl ========================================================
 
6066
MOZ_ARG_DISABLE_BOOL(webapp-runtime,
 
6067
[  --disable-webapp-runtime  Disable Web App Runtime],
 
6068
    MOZ_WEBAPP_RUNTIME=,
 
6069
    MOZ_WEBAPP_RUNTIME=1)
 
6070
if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
 
6071
    MOZ_WEBAPP_RUNTIME=
 
6072
fi
 
6073
if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
 
6074
    MOZ_WEBAPP_RUNTIME=
 
6075
fi
 
6076
AC_SUBST(MOZ_WEBAPP_RUNTIME)
 
6077
if test "$MOZ_WEBAPP_RUNTIME"; then
 
6078
    AC_DEFINE(MOZ_WEBAPP_RUNTIME)
 
6079
fi
 
6080
 
 
6081
AC_MSG_CHECKING([for tar archiver])
 
6082
AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
 
6083
if test -z "$TAR"; then
 
6084
    AC_MSG_ERROR([no tar archiver found in \$PATH])
 
6085
fi
 
6086
AC_MSG_RESULT([$TAR])
 
6087
AC_SUBST(TAR)
 
6088
 
 
6089
AC_MSG_CHECKING([for wget])
 
6090
AC_CHECK_PROGS(WGET, wget, "")
 
6091
AC_MSG_RESULT([$WGET])
 
6092
AC_SUBST(WGET)
 
6093
 
 
6094
dnl ========================================================
 
6095
dnl Signing
 
6096
dnl ========================================================
 
6097
 
 
6098
if test -n "$MOZ_SIGN_CMD"; then
 
6099
    AC_DEFINE(MOZ_SIGNING)
 
6100
fi
 
6101
 
 
6102
dnl ========================================================
 
6103
dnl Maintenance Service
 
6104
dnl ========================================================
 
6105
 
 
6106
MOZ_ARG_ENABLE_BOOL(maintenance-service,
 
6107
[  --enable-maintenance-service       Enable building of maintenanceservice],
 
6108
    MOZ_MAINTENANCE_SERVICE=1,
 
6109
    MOZ_MAINTENANCE_SERVICE= )
 
6110
 
 
6111
if test -n "$MOZ_MAINTENANCE_SERVICE"; then
 
6112
  if test "$OS_ARCH" = "WINNT"; then
 
6113
    AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
 
6114
  else
 
6115
    AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
 
6116
  fi
 
6117
fi
 
6118
 
 
6119
dnl ========================================================
 
6120
dnl Verify MAR signatures
 
6121
dnl ========================================================
 
6122
 
 
6123
MOZ_ARG_ENABLE_BOOL(verify-mar,
 
6124
[  --enable-verify-mar     Enable verifying MAR signatures],
 
6125
    MOZ_VERIFY_MAR_SIGNATURE=1,
 
6126
    MOZ_VERIFY_MAR_SIGNATURE= )
 
6127
 
 
6128
if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
 
6129
  if test "$OS_ARCH" = "WINNT"; then
 
6130
    AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
 
6131
  else
 
6132
    AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
 
6133
  fi
 
6134
fi
 
6135
 
 
6136
dnl ========================================================
 
6137
dnl Enable building the signmar program.
 
6138
dnl This option is much different than the --enable-verify-mar option.
 
6139
dnl --enable-verify-mar is for enabling the verification check on MAR
 
6140
dnl files in the updater.  The --enable-signmar option is for building
 
6141
dnl the signmar program.
 
6142
dnl ========================================================
 
6143
 
 
6144
MOZ_ARG_ENABLE_BOOL(signmar,
 
6145
[  --enable-signmar     Enable building the signmar program],
 
6146
    MOZ_ENABLE_SIGNMAR=1,
 
6147
    MOZ_ENABLE_SIGNMAR= )
 
6148
 
 
6149
if test -n "$MOZ_ENABLE_SIGNMAR"; then
 
6150
  AC_DEFINE(MOZ_ENABLE_SIGNMAR)
 
6151
fi
 
6152
 
 
6153
dnl ========================================================
 
6154
dnl Updater
 
6155
dnl ========================================================
 
6156
 
 
6157
MOZ_ARG_DISABLE_BOOL(updater,
 
6158
[  --disable-updater       Disable building of updater],
 
6159
    MOZ_UPDATER=,
 
6160
    MOZ_UPDATER=1 )
 
6161
 
 
6162
if test -n "$MOZ_UPDATER"; then
 
6163
    AC_DEFINE(MOZ_UPDATER)
 
6164
fi
 
6165
 
 
6166
# app update channel is 'default' when not supplied.
 
6167
MOZ_ARG_ENABLE_STRING([update-channel],
 
6168
[  --enable-update-channel=CHANNEL
 
6169
                          Select application update channel (default=default)],
 
6170
    MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
 
6171
 
 
6172
if test -z "$MOZ_UPDATE_CHANNEL"; then
 
6173
    MOZ_UPDATE_CHANNEL=default
 
6174
fi
 
6175
AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
 
6176
AC_SUBST(MOZ_UPDATE_CHANNEL)
 
6177
 
 
6178
# tools/update-packaging is not checked out by default.
 
6179
MOZ_ARG_ENABLE_BOOL(update-packaging,
 
6180
[  --enable-update-packaging
 
6181
                          Enable tools/update-packaging],
 
6182
    MOZ_UPDATE_PACKAGING=1,
 
6183
    MOZ_UPDATE_PACKAGING= )
 
6184
AC_SUBST(MOZ_UPDATE_PACKAGING)
 
6185
 
 
6186
dnl ========================================================
 
6187
dnl build the tests by default
 
6188
dnl ========================================================
 
6189
MOZ_ARG_DISABLE_BOOL(tests,
 
6190
[  --disable-tests         Do not build test libraries & programs],
 
6191
    ENABLE_TESTS=,
 
6192
    ENABLE_TESTS=1 )
 
6193
 
 
6194
dnl ========================================================
 
6195
dnl parental controls (for Windows Vista)
 
6196
dnl ========================================================
 
6197
MOZ_ARG_DISABLE_BOOL(parental-controls,
 
6198
[  --disable-parental-controls
 
6199
                          Do not build parental controls],
 
6200
   MOZ_DISABLE_PARENTAL_CONTROLS=1,
 
6201
   MOZ_DISABLE_PARENTAL_CONTROLS=)
 
6202
if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
 
6203
    AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
 
6204
fi
 
6205
 
 
6206
AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
 
6207
 
 
6208
dnl ========================================================
 
6209
dnl = Disable DOMCrypto
 
6210
dnl ========================================================
 
6211
if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
 
6212
    AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
 
6213
fi
 
6214
 
 
6215
dnl ========================================================
 
6216
dnl =
 
6217
dnl = Module specific options
 
6218
dnl =
 
6219
dnl ========================================================
 
6220
MOZ_ARG_HEADER(Individual module options)
 
6221
 
 
6222
dnl ========================================================
 
6223
dnl = Disable feed handling components
 
6224
dnl ========================================================
 
6225
MOZ_ARG_DISABLE_BOOL(feeds,
 
6226
[  --disable-feeds         Disable feed handling and processing components],
 
6227
    MOZ_FEEDS=,
 
6228
    MOZ_FEEDS=1 )
 
6229
if test -n "$MOZ_FEEDS"; then
 
6230
    AC_DEFINE(MOZ_FEEDS)
 
6231
else
 
6232
    if test "$MOZ_BUILD_APP" = "browser"; then
 
6233
        AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
 
6234
    fi
 
6235
fi
 
6236
 
 
6237
dnl ========================================================
 
6238
dnl Check for sqlite
 
6239
dnl ========================================================
 
6240
 
 
6241
MOZ_NATIVE_SQLITE=
 
6242
MOZ_ARG_ENABLE_BOOL(system-sqlite,
 
6243
[  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
 
6244
MOZ_NATIVE_SQLITE=1,
 
6245
MOZ_NATIVE_SQLITE= )
 
6246
 
 
6247
if test -z "$MOZ_NATIVE_SQLITE"
 
6248
then
 
6249
    SQLITE_CFLAGS=
 
6250
    SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
 
6251
else
 
6252
    dnl ============================
 
6253
    dnl === SQLite Version check ===
 
6254
    dnl ============================
 
6255
    dnl Check to see if the system SQLite package is new enough.
 
6256
    PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
 
6257
 
 
6258
    dnl ==================================
 
6259
    dnl === SQLITE_SECURE_DELETE check ===
 
6260
    dnl ==================================
 
6261
    dnl Check to see if the system SQLite package is compiled with
 
6262
    dnl SQLITE_SECURE_DELETE enabled.
 
6263
    AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
 
6264
    _SAVE_CFLAGS="$CFLAGS"
 
6265
    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
 
6266
    _SAVE_LIBS="$LIBS"
 
6267
    LIBS="$LIBS $SQLITE_LIBS"
 
6268
    AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
 
6269
        AC_TRY_RUN([
 
6270
            #include "sqlite3.h"
 
6271
 
 
6272
            int main(int argc, char **argv){
 
6273
              return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
 
6274
            }],
 
6275
            ac_cv_sqlite_secure_delete=yes,
 
6276
            ac_cv_sqlite_secure_delete=no,
 
6277
            ac_cv_sqlite_secure_delete=no
 
6278
        )
 
6279
    ])
 
6280
    AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
 
6281
    CFLAGS="$_SAVE_CFLAGS"
 
6282
    LIBS="$_SAVE_LIBS"
 
6283
    if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
 
6284
        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
 
6285
    fi
 
6286
 
 
6287
    dnl ===============================
 
6288
    dnl === SQLITE_THREADSAFE check ===
 
6289
    dnl ===============================
 
6290
    dnl Check to see if the system SQLite package is compiled with
 
6291
    dnl SQLITE_THREADSAFE enabled.
 
6292
    AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
 
6293
    _SAVE_CFLAGS="$CFLAGS"
 
6294
    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
 
6295
    _SAVE_LIBS="$LIBS"
 
6296
    LIBS="$LIBS $SQLITE_LIBS"
 
6297
    AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
 
6298
        AC_TRY_RUN([
 
6299
            #include "sqlite3.h"
 
6300
 
 
6301
            int main(int argc, char **argv){
 
6302
              return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
 
6303
            }],
 
6304
            ac_cv_sqlite_threadsafe=yes,
 
6305
            ac_cv_sqlite_threadsafe=no,
 
6306
            ac_cv_sqlite_threadsafe=no
 
6307
        )
 
6308
    ])
 
6309
    AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
 
6310
    CFLAGS="$_SAVE_CFLAGS"
 
6311
    LIBS="$_SAVE_LIBS"
 
6312
    if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
 
6313
        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
 
6314
    fi
 
6315
 
 
6316
    dnl ================================
 
6317
    dnl === SQLITE_ENABLE_FTS3 check ===
 
6318
    dnl ================================
 
6319
    dnl check to see if the system SQLite package is compiled with
 
6320
    dnl SQLITE_ENABLE_FTS3 enabled.
 
6321
    AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
 
6322
    _SAVE_CFLAGS="$CFLAGS"
 
6323
    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
 
6324
    _SAVE_LIBS="$LIBS"
 
6325
    LIBS="$LIBS $SQLITE_LIBS"
 
6326
    AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
 
6327
        AC_TRY_RUN([
 
6328
            #include "sqlite3.h"
 
6329
 
 
6330
            int main(int argc, char **argv){
 
6331
              return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
 
6332
            }],
 
6333
            ac_cv_sqlite_enable_fts3=yes,
 
6334
            ac_cv_sqlite_enable_fts3=no,
 
6335
            ac_cv_sqlite_enable_fts3=no
 
6336
        )
 
6337
    ])
 
6338
    AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
 
6339
    CFLAGS="$_SAVE_CFLAGS"
 
6340
    LIBS="$_SAVE_LIBS"
 
6341
    if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
 
6342
        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
 
6343
    fi
 
6344
 
 
6345
    dnl =========================================
 
6346
    dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
 
6347
    dnl =========================================
 
6348
    dnl check to see if the system SQLite package is compiled with
 
6349
    dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
 
6350
    AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
 
6351
    _SAVE_CFLAGS="$CFLAGS"
 
6352
    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
 
6353
    _SAVE_LIBS="$LIBS"
 
6354
    LIBS="$LIBS $SQLITE_LIBS"
 
6355
    AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
 
6356
        AC_TRY_RUN([
 
6357
            #include "sqlite3.h"
 
6358
 
 
6359
            int main(int argc, char **argv){
 
6360
              return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
 
6361
            }],
 
6362
            ac_cv_sqlite_enable_unlock_notify=yes,
 
6363
            ac_cv_sqlite_enable_unlock_notify=no,
 
6364
            ac_cv_sqlite_enable_unlock_notify=no
 
6365
        )
 
6366
    ])
 
6367
    AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
 
6368
    CFLAGS="$_SAVE_CFLAGS"
 
6369
    LIBS="$_SAVE_LIBS"
 
6370
    if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
 
6371
        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
 
6372
    fi
 
6373
fi
 
6374
 
 
6375
if test -n "$MOZ_NATIVE_SQLITE"; then
 
6376
    AC_DEFINE(MOZ_NATIVE_SQLITE)
 
6377
fi
 
6378
AC_SUBST(MOZ_NATIVE_SQLITE)
 
6379
 
 
6380
dnl ========================================================
 
6381
dnl = Enable help viewer (off by default)
 
6382
dnl ========================================================
 
6383
if test -n "$MOZ_HELP_VIEWER"; then
 
6384
     dnl Do this if defined in confvars.sh
 
6385
     AC_DEFINE(MOZ_HELP_VIEWER)
 
6386
fi
 
6387
 
 
6388
dnl ========================================================
 
6389
dnl = Enable safe browsing (anti-phishing)
 
6390
dnl ========================================================
 
6391
MOZ_ARG_ENABLE_BOOL(safe-browsing,
 
6392
[  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
 
6393
    MOZ_SAFE_BROWSING=1,
 
6394
    MOZ_SAFE_BROWSING= )
 
6395
if test -n "$MOZ_SAFE_BROWSING"; then
 
6396
    AC_DEFINE(MOZ_SAFE_BROWSING)
 
6397
fi
 
6398
AC_SUBST(MOZ_SAFE_BROWSING)
 
6399
 
 
6400
dnl ========================================================
 
6401
dnl = Enable url-classifier
 
6402
dnl ========================================================
 
6403
dnl Implicitly enabled by default if building with safe-browsing
 
6404
if test -n "$MOZ_SAFE_BROWSING"; then
 
6405
    MOZ_URL_CLASSIFIER=1
 
6406
fi
 
6407
MOZ_ARG_ENABLE_BOOL(url-classifier,
 
6408
[  --enable-url-classifier Enable url classifier module],
 
6409
    MOZ_URL_CLASSIFIER=1,
 
6410
    MOZ_URL_CLASSIFIER= )
 
6411
if test -n "$MOZ_URL_CLASSIFIER"; then
 
6412
    AC_DEFINE(MOZ_URL_CLASSIFIER)
 
6413
fi
 
6414
AC_SUBST(MOZ_URL_CLASSIFIER)
 
6415
 
 
6416
dnl ========================================================
 
6417
dnl = Disable zipwriter
 
6418
dnl ========================================================
 
6419
MOZ_ARG_DISABLE_BOOL(zipwriter,
 
6420
[  --disable-zipwriter     Disable zipwriter component],
 
6421
    MOZ_ZIPWRITER=,
 
6422
    MOZ_ZIPWRITER=1 )
 
6423
AC_SUBST(MOZ_ZIPWRITER)
 
6424
 
 
6425
dnl ========================================================
 
6426
dnl = libconic
 
6427
dnl ========================================================
 
6428
dnl superseded by QtNetwork starting from 4.7
 
6429
MOZ_ENABLE_LIBCONIC=1
 
6430
 
 
6431
if test -n "$MOZ_ENABLE_QT"; then
 
6432
  if test "$MOZ_ENABLE_QTNETWORK"; then
 
6433
    MOZ_ENABLE_LIBCONIC=
 
6434
  fi
 
6435
fi
 
6436
 
 
6437
MOZ_ARG_DISABLE_BOOL(libconic,
 
6438
[  --disable-libconic      Disable libconic],
 
6439
    MOZ_ENABLE_LIBCONIC=,
 
6440
    MOZ_ENABLE_LIBCONIC=1 )
 
6441
 
 
6442
if test -n "$MOZ_ENABLE_LIBCONIC"; then
 
6443
    PKG_CHECK_MODULES(LIBCONIC, conic,
 
6444
                      MOZ_ENABLE_LIBCONIC=1,
 
6445
                      MOZ_ENABLE_LIBCONIC=)
 
6446
fi
 
6447
if test "$MOZ_ENABLE_LIBCONIC"; then
 
6448
    AC_DEFINE(MOZ_ENABLE_LIBCONIC)
 
6449
fi
 
6450
 
 
6451
AC_SUBST(MOZ_ENABLE_LIBCONIC)
 
6452
AC_SUBST(LIBCONIC_CFLAGS)
 
6453
AC_SUBST(LIBCONIC_LIBS)
 
6454
 
 
6455
dnl ========================================================
 
6456
dnl = Maemo checks
 
6457
dnl ========================================================
 
6458
 
 
6459
MAEMO_SDK_TARGET_VER=-1
 
6460
 
 
6461
MOZ_ARG_WITH_STRING(maemo-version,
 
6462
[  --with-maemo-version=MAEMO_SDK_TARGET_VER
 
6463
                          Maemo SDK Version],
 
6464
  MAEMO_SDK_TARGET_VER=$withval)
 
6465
 
 
6466
case "$MAEMO_SDK_TARGET_VER" in
 
6467
5)
 
6468
    MOZ_PLATFORM_MAEMO=5
 
6469
    ;;
 
6470
 
 
6471
6)
 
6472
    MOZ_PLATFORM_MAEMO=6
 
6473
    ;;
 
6474
 
 
6475
-1)
 
6476
    dnl We aren't compiling for Maemo, move on.
 
6477
    ;;
 
6478
*)
 
6479
    AC_MSG_ERROR([Unknown Maemo Version.  Try setting --with-maemo-version to 5 or 6.])
 
6480
    ;;
 
6481
esac
 
6482
 
 
6483
if test $MOZ_PLATFORM_MAEMO; then
 
6484
   AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
 
6485
 
 
6486
   if test -z "$MOZ_ENABLE_DBUS"; then
 
6487
       AC_MSG_ERROR([DBus is required when building for Maemo])
 
6488
   fi
 
6489
 
 
6490
   MOZ_GFX_OPTIMIZE_MOBILE=1
 
6491
   MOZ_GL_DEFAULT_PROVIDER=EGL
 
6492
   MOZ_MAEMO_LIBLOCATION=
 
6493
 
 
6494
   if test $MOZ_PLATFORM_MAEMO = 5; then
 
6495
      dnl if we have Xcomposite we should also have Xdamage and Xfixes
 
6496
      MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
 
6497
          [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
 
6498
      AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
 
6499
                   [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
 
6500
 
 
6501
      AC_SUBST(XCOMPOSITE_LIBS)
 
6502
 
 
6503
      PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
 
6504
      MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
 
6505
      MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
 
6506
      if test -z "$_LIB_FOUND"; then
 
6507
         AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
 
6508
      fi
 
6509
 
 
6510
 
 
6511
      PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
 
6512
      MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
 
6513
      MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
 
6514
      if test -z "$_LIB_FOUND"; then
 
6515
         AC_MSG_ERROR([LibOSSO is required when building for Maemo])
 
6516
      fi
 
6517
 
 
6518
      PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
 
6519
      MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
 
6520
      MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
 
6521
      if test -z "$_LIB_FOUND"; then
 
6522
         AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
 
6523
      fi
 
6524
 
 
6525
   fi
 
6526
   if test $MOZ_PLATFORM_MAEMO = 6; then
 
6527
 
 
6528
      PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
 
6529
                        _LIB_FOUND=1,
 
6530
                        _LIB_FOUND=)
 
6531
      if test "$_LIB_FOUND"; then
 
6532
         MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
 
6533
         MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
 
6534
         MOZ_ENABLE_CONTENTMANAGER=1
 
6535
         AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
 
6536
      else
 
6537
         AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
 
6538
      fi
 
6539
      AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
 
6540
 
 
6541
      dnl ========================================================
 
6542
      dnl = Enable meego libcontentaction
 
6543
      dnl ========================================================
 
6544
      MOZ_ARG_ENABLE_BOOL(meegocontentaction,
 
6545
      [  --enable-meegocontentaction           Enable meegocontentaction support],
 
6546
         MOZ_MEEGOCONTENTACTION=1,
 
6547
         MOZ_MEEGOCONTENTACTION=)
 
6548
 
 
6549
      if test -n "$MOZ_MEEGOCONTENTACTION"; then
 
6550
 
 
6551
         PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
 
6552
         if test "$_LIB_FOUND"; then
 
6553
            MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
 
6554
            MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
 
6555
            MOZ_ENABLE_CONTENTACTION=1
 
6556
            AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
 
6557
            AC_SUBST(MOZ_ENABLE_CONTENTACTION)
 
6558
         fi
 
6559
      fi
 
6560
 
 
6561
      MOZ_ARG_ENABLE_BOOL(meegotouch,
 
6562
      [  --enable-meegotouch  Enable meegotouch support],
 
6563
         MOZ_MEEGOTOUCHENABLED=1,
 
6564
         MOZ_MEEGOTOUCHENABLED=)
 
6565
 
 
6566
      if test -n "$MOZ_MEEGOTOUCHENABLED"; then
 
6567
          PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
 
6568
          if test "$_LIB_FOUND"; then
 
6569
              MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
 
6570
              MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
 
6571
              AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
 
6572
          else
 
6573
              AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
 
6574
          fi
 
6575
      fi
 
6576
   fi
 
6577
 
 
6578
   PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
 
6579
   MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
 
6580
   MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
 
6581
   if test "$_LIB_FOUND"; then
 
6582
      MOZ_MAEMO_LIBLOCATION=1
 
6583
      AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
 
6584
   else
 
6585
      AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
 
6586
   fi
 
6587
   AC_SUBST(MOZ_MAEMO_LIBLOCATION)
 
6588
 
 
6589
   PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
 
6590
   MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
 
6591
   MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
 
6592
   if test "$_LIB_FOUND"; then
 
6593
      MOZ_ENABLE_MEEGOTOUCHSHARE=1
 
6594
      AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
 
6595
   else
 
6596
      AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
 
6597
   fi
 
6598
   AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
 
6599
 
 
6600
   AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
 
6601
   AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
 
6602
fi
 
6603
 
 
6604
dnl ========================================================
 
6605
dnl = XRender Composite
 
6606
dnl ========================================================
 
6607
MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
 
6608
[  --enable-egl-xrender-composite
 
6609
                          Enable EGL xrender composite optimizations],
 
6610
    MOZ_EGL_XRENDER_COMPOSITE=1)
 
6611
 
 
6612
if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
 
6613
    AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
 
6614
fi
 
6615
 
 
6616
AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
 
6617
 
 
6618
dnl ========================================================
 
6619
dnl GL provider
 
6620
dnl ========================================================
 
6621
MOZ_GL_PROVIDER=
 
6622
MOZ_ARG_WITH_STRING(gl-provider,
 
6623
[  --with-gl-provider=ID
 
6624
                          Set GL provider backend type],
 
6625
[ val=`echo $withval`
 
6626
    MOZ_GL_PROVIDER="$val"])
 
6627
 
 
6628
if test -n "$MOZ_GL_PROVIDER"; then
 
6629
MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
 
6630
AC_SUBST(MOZ_GL_PROVIDER)
 
6631
AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
 
6632
fi
 
6633
AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
 
6634
 
 
6635
dnl ========================================================
 
6636
dnl = faststripe theme
 
6637
dnl ========================================================
 
6638
MOZ_ARG_ENABLE_BOOL(faststripe,
 
6639
[  --enable-faststripe     Use faststripe theme],
 
6640
    MOZ_THEME_FASTSTRIPE=1,
 
6641
    MOZ_THEME_FASTSTRIPE= )
 
6642
AC_SUBST(MOZ_THEME_FASTSTRIPE)
 
6643
 
 
6644
dnl ========================================================
 
6645
dnl =
 
6646
dnl = Feature options that require extra sources to be pulled
 
6647
dnl =
 
6648
dnl ========================================================
 
6649
dnl MOZ_ARG_HEADER(Features that require extra sources)
 
6650
 
 
6651
dnl ========================================================
 
6652
dnl =
 
6653
dnl = Debugging Options
 
6654
dnl =
 
6655
dnl ========================================================
 
6656
MOZ_ARG_HEADER(Debugging and Optimizations)
 
6657
 
 
6658
dnl ========================================================
 
6659
dnl = Disable building with debug info.
 
6660
dnl = Debugging is OFF by default
 
6661
dnl ========================================================
 
6662
if test -z "$MOZ_DEBUG_FLAGS"; then
 
6663
  MOZ_DEBUG_FLAGS="-g"
 
6664
fi
 
6665
 
 
6666
MOZ_ARG_ENABLE_STRING(debug,
 
6667
[  --enable-debug[=DBG]    Enable building with developer debug info
 
6668
                           (using compiler flags DBG)],
 
6669
[ if test "$enableval" != "no"; then
 
6670
    MOZ_DEBUG=1
 
6671
    if test -n "$enableval" -a "$enableval" != "yes"; then
 
6672
        MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
 
6673
        _MOZ_DEBUG_FLAGS_SET=1
 
6674
    fi
 
6675
  else
 
6676
    MOZ_DEBUG=
 
6677
  fi ],
 
6678
  MOZ_DEBUG=)
 
6679
 
 
6680
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
 
6681
MOZ_ARG_WITH_STRING(debug-label,
 
6682
[  --with-debug-label=LABELS
 
6683
                          Define DEBUG_<value> for each comma-separated
 
6684
                          value given.],
 
6685
[ for option in `echo $withval | sed 's/,/ /g'`; do
 
6686
    MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
 
6687
done])
 
6688
 
 
6689
MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
 
6690
 
 
6691
if test -n "$MOZ_DEBUG"; then
 
6692
    AC_MSG_CHECKING([for valid debug flags])
 
6693
    _SAVE_CFLAGS=$CFLAGS
 
6694
    CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
 
6695
    AC_TRY_COMPILE([#include <stdio.h>],
 
6696
        [printf("Hello World\n");],
 
6697
        _results=yes,
 
6698
        _results=no)
 
6699
    AC_MSG_RESULT([$_results])
 
6700
    if test "$_results" = "no"; then
 
6701
        AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
 
6702
    fi
 
6703
    CFLAGS=$_SAVE_CFLAGS
 
6704
fi
 
6705
 
 
6706
dnl ========================================================
 
6707
dnl enable mobile optimizations
 
6708
dnl ========================================================
 
6709
MOZ_ARG_ENABLE_BOOL(mobile-optimize,
 
6710
[  --enable-mobile-optimize
 
6711
                          Enable mobile optimizations],
 
6712
    MOZ_GFX_OPTIMIZE_MOBILE=1)
 
6713
 
 
6714
AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
 
6715
 
 
6716
if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
 
6717
    AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
 
6718
fi
 
6719
 
 
6720
dnl ========================================================
 
6721
dnl = Enable code optimization. ON by default.
 
6722
dnl ========================================================
 
6723
if test -z "$MOZ_OPTIMIZE_FLAGS"; then
 
6724
        MOZ_OPTIMIZE_FLAGS="-O"
 
6725
fi
 
6726
 
 
6727
MOZ_ARG_ENABLE_STRING(optimize,
 
6728
[  --disable-optimize      Disable compiler optimization
 
6729
  --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
 
6730
[ if test "$enableval" != "no"; then
 
6731
    MOZ_OPTIMIZE=1
 
6732
    if test -n "$enableval" -a "$enableval" != "yes"; then
 
6733
        MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
 
6734
        MOZ_OPTIMIZE=2
 
6735
    fi
 
6736
else
 
6737
    MOZ_OPTIMIZE=
 
6738
fi ], MOZ_OPTIMIZE=1)
 
6739
 
 
6740
MOZ_SET_FRAMEPTR_FLAGS
 
6741
 
 
6742
if test "$COMPILE_ENVIRONMENT"; then
 
6743
if test -n "$MOZ_OPTIMIZE"; then
 
6744
    AC_MSG_CHECKING([for valid optimization flags])
 
6745
    _SAVE_CFLAGS=$CFLAGS
 
6746
    CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
 
6747
    AC_TRY_COMPILE([#include <stdio.h>],
 
6748
        [printf("Hello World\n");],
 
6749
        _results=yes,
 
6750
        _results=no)
 
6751
    AC_MSG_RESULT([$_results])
 
6752
    if test "$_results" = "no"; then
 
6753
        AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
 
6754
    fi
 
6755
    CFLAGS=$_SAVE_CFLAGS
 
6756
fi
 
6757
fi # COMPILE_ENVIRONMENT
 
6758
 
 
6759
AC_SUBST(MOZ_OPTIMIZE)
 
6760
AC_SUBST(MOZ_FRAMEPTR_FLAGS)
 
6761
AC_SUBST(MOZ_OPTIMIZE_FLAGS)
 
6762
AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
 
6763
AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
 
6764
AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
 
6765
AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
 
6766
 
 
6767
dnl ========================================================
 
6768
dnl = Enable generation of debug symbols
 
6769
dnl ========================================================
 
6770
MOZ_ARG_ENABLE_STRING(debug-symbols,
 
6771
[  --enable-debug-symbols[=DBG]
 
6772
                          Enable debugging symbols (using compiler flags DBG)],
 
6773
[ if test "$enableval" != "no"; then
 
6774
      MOZ_DEBUG_SYMBOLS=1
 
6775
      if test -n "$enableval" -a "$enableval" != "yes"; then
 
6776
          if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
 
6777
              MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
 
6778
          else
 
6779
              AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
 
6780
          fi
 
6781
      fi
 
6782
  else
 
6783
      MOZ_DEBUG_SYMBOLS=
 
6784
  fi ],
 
6785
  MOZ_DEBUG_SYMBOLS=1)
 
6786
 
 
6787
if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
 
6788
    AC_DEFINE(MOZ_DEBUG_SYMBOLS)
 
6789
    export MOZ_DEBUG_SYMBOLS
 
6790
fi
 
6791
 
 
6792
dnl ========================================================
 
6793
dnl = Enable any treating of compile warnings as errors
 
6794
dnl ========================================================
 
6795
MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
 
6796
[  --enable-warnings-as-errors
 
6797
                          Enable treating of warnings as errors],
 
6798
    MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
 
6799
    MOZ_ENABLE_WARNINGS_AS_ERRORS=)
 
6800
if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
 
6801
   WARNINGS_AS_ERRORS=''
 
6802
fi
 
6803
 
 
6804
dnl ========================================================
 
6805
dnl = Disable runtime logging checks
 
6806
dnl ========================================================
 
6807
MOZ_ARG_DISABLE_BOOL(logging,
 
6808
[  --disable-logging       Disable logging facilities],
 
6809
    NS_DISABLE_LOGGING=1,
 
6810
    NS_DISABLE_LOGGING= )
 
6811
if test "$NS_DISABLE_LOGGING"; then
 
6812
    AC_DEFINE(NS_DISABLE_LOGGING)
 
6813
else
 
6814
    AC_DEFINE(MOZ_LOGGING)
 
6815
fi
 
6816
 
 
6817
dnl ========================================================
 
6818
dnl = This will enable logging of addref, release, ctor, dtor.
 
6819
dnl ========================================================
 
6820
_ENABLE_LOGREFCNT=42
 
6821
MOZ_ARG_ENABLE_BOOL(logrefcnt,
 
6822
[  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
 
6823
    _ENABLE_LOGREFCNT=1,
 
6824
    _ENABLE_LOGREFCNT= )
 
6825
if test "$_ENABLE_LOGREFCNT" = "1"; then
 
6826
    AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
 
6827
elif test -z "$_ENABLE_LOGREFCNT"; then
 
6828
    AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
 
6829
fi
 
6830
 
 
6831
dnl ========================================================
 
6832
dnl moz_dump_painting
 
6833
dnl ========================================================
 
6834
MOZ_ARG_ENABLE_BOOL(dump-painting,
 
6835
[  --enable-dump-painting          Enable paint debugging.],
 
6836
    MOZ_DUMP_PAINTING=1,
 
6837
    MOZ_DUMP_PAINTING= )
 
6838
if test -n "$MOZ_DUMP_PAINTING"; then
 
6839
    AC_DEFINE(MOZ_DUMP_PAINTING)
 
6840
    AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
 
6841
fi
 
6842
if test -n "$MOZ_DEBUG"; then
 
6843
    AC_DEFINE(MOZ_DUMP_PAINTING)
 
6844
fi
 
6845
 
 
6846
dnl ========================================================
 
6847
dnl = Enable trace malloc
 
6848
dnl ========================================================
 
6849
NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
 
6850
MOZ_ARG_ENABLE_BOOL(trace-malloc,
 
6851
[  --enable-trace-malloc   Enable malloc tracing; also disables jemalloc],
 
6852
    NS_TRACE_MALLOC=1,
 
6853
    NS_TRACE_MALLOC= )
 
6854
if test "$NS_TRACE_MALLOC"; then
 
6855
  # Please, Mr. Linker Man, don't take away our symbol names
 
6856
  MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
 
6857
  USE_ELF_DYNSTR_GC=
 
6858
  AC_DEFINE(NS_TRACE_MALLOC)
 
6859
fi
 
6860
AC_SUBST(NS_TRACE_MALLOC)
 
6861
 
 
6862
dnl ========================================================
 
6863
dnl = Enable jemalloc
 
6864
dnl ========================================================
 
6865
MOZ_ARG_ENABLE_BOOL(jemalloc,
 
6866
[  --enable-jemalloc       Replace memory allocator with jemalloc],
 
6867
    MOZ_MEMORY=1,
 
6868
    MOZ_MEMORY=)
 
6869
 
 
6870
if test "$NS_TRACE_MALLOC"; then
 
6871
    MOZ_MEMORY=
 
6872
fi
 
6873
if test "$MOZ_DMD"; then
 
6874
    MOZ_MEMORY=
 
6875
fi
 
6876
 
 
6877
if test "${OS_TARGET}" = "Android"; then
 
6878
  dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
 
6879
  :
 
6880
elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
 
6881
  dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
 
6882
  if test -z "$GNU_CC"; then
 
6883
    MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
 
6884
  else
 
6885
    MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
 
6886
  fi
 
6887
else
 
6888
  dnl On other Unix systems, we only want to link executables against mozglue
 
6889
  MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
 
6890
  dnl On other Unix systems, where mozglue is a static library, jemalloc is
 
6891
  dnl separated for the SDK, so we need to add it here.
 
6892
  if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
 
6893
    MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
 
6894
  fi
 
6895
  MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
 
6896
  if test -n "$GNU_CC"; then
 
6897
    dnl And we need mozglue symbols to be exported.
 
6898
    MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
 
6899
  fi
 
6900
  if test "$MOZ_LINKER" = 1; then
 
6901
    MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $ZLIB_LIBS"
 
6902
  fi
 
6903
fi
 
6904
 
 
6905
if test -z "$MOZ_MEMORY"; then
 
6906
  case "${target}" in
 
6907
    *-mingw*)
 
6908
      if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
 
6909
        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.])
 
6910
      fi
 
6911
      ;;
 
6912
  esac
 
6913
else
 
6914
  dnl Don't try to run compiler tests on Windows
 
6915
  if test "$OS_ARCH" = "WINNT"; then
 
6916
    if test -z "$HAVE_64BIT_OS"; then
 
6917
      AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
 
6918
    else
 
6919
      AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
 
6920
    fi
 
6921
  else
 
6922
    AC_CHECK_SIZEOF([int *], [4])
 
6923
    case "${ac_cv_sizeof_int_p}" in
 
6924
    4)
 
6925
      AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
 
6926
      ;;
 
6927
    8)
 
6928
      AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
 
6929
      ;;
 
6930
    *)
 
6931
      AC_MSG_ERROR([Unexpected pointer size])
 
6932
      ;;
 
6933
    esac
 
6934
  fi
 
6935
 
 
6936
  AC_DEFINE(MOZ_MEMORY)
 
6937
  if test -n "$MOZ_JEMALLOC"; then
 
6938
    AC_DEFINE(MOZ_JEMALLOC)
 
6939
  fi
 
6940
  if test "x$MOZ_DEBUG" = "x1"; then
 
6941
    AC_DEFINE(MOZ_MEMORY_DEBUG)
 
6942
  fi
 
6943
  dnl The generic feature tests that determine how to compute ncpus are long and
 
6944
  dnl complicated.  Therefore, simply define special cpp variables for the
 
6945
  dnl platforms we have special knowledge of.
 
6946
  case "${target}" in
 
6947
  *-darwin*)
 
6948
    AC_DEFINE(MOZ_MEMORY_DARWIN)
 
6949
    ;;
 
6950
  *-*freebsd*)
 
6951
    AC_DEFINE(MOZ_MEMORY_BSD)
 
6952
    ;;
 
6953
  *-android*|*-linuxandroid*)
 
6954
    AC_DEFINE(MOZ_MEMORY_LINUX)
 
6955
    AC_DEFINE(MOZ_MEMORY_ANDROID)
 
6956
    if test -z "$gonkdir"; then
 
6957
      _WRAP_MALLOC=1
 
6958
    else
 
6959
      AC_DEFINE(MOZ_MEMORY_GONK)
 
6960
    fi
 
6961
    MOZ_GLUE_LDFLAGS=
 
6962
    ;;
 
6963
  *-*linux*)
 
6964
    AC_DEFINE(MOZ_MEMORY_LINUX)
 
6965
    ;;
 
6966
  *-netbsd*)
 
6967
    AC_DEFINE(MOZ_MEMORY_BSD)
 
6968
    ;;
 
6969
  *-solaris*)
 
6970
    AC_DEFINE(MOZ_MEMORY_SOLARIS)
 
6971
    ;;
 
6972
  *-mingw*)
 
6973
    AC_DEFINE(MOZ_MEMORY_WINDOWS)
 
6974
    if test -z "$MOZ_DEBUG"; then
 
6975
      WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
 
6976
    else
 
6977
      WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
 
6978
    fi
 
6979
    dnl Look for a broken crtdll.obj
 
6980
    WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
 
6981
    lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
 
6982
    if grep -q '__imp__\{0,1\}free' crtdll.obj; then
 
6983
      MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
 
6984
      dnl Also pass this to NSPR/NSS
 
6985
      DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
 
6986
    else
 
6987
      DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
 
6988
    fi
 
6989
    rm crtdll.obj
 
6990
 
 
6991
    export DLLFLAGS
 
6992
    ;;
 
6993
  *)
 
6994
    AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
 
6995
    ;;
 
6996
  esac
 
6997
fi # MOZ_MEMORY
 
6998
AC_SUBST(MOZ_MEMORY)
 
6999
AC_SUBST(MOZ_JEMALLOC)
 
7000
AC_SUBST(MOZ_GLUE_LDFLAGS)
 
7001
AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
 
7002
AC_SUBST(WIN32_CRT_LIBS)
 
7003
dnl Need to set this for make because NSS doesn't have configure
 
7004
AC_SUBST(DLLFLAGS)
 
7005
 
 
7006
dnl We need to wrap dlopen and related functions on Android because we use
 
7007
dnl our own linker.
 
7008
if test "$OS_TARGET" = Android; then
 
7009
    WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
 
7010
    if test -n "$MOZ_OLD_LINKER"; then
 
7011
        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
 
7012
    fi
 
7013
    WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
 
7014
    WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
 
7015
fi
 
7016
 
 
7017
dnl ========================================================
 
7018
dnl = Use malloc wrapper lib
 
7019
dnl ========================================================
 
7020
MOZ_ARG_ENABLE_BOOL(wrap-malloc,
 
7021
[  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
 
7022
    _WRAP_MALLOC=1,
 
7023
    _WRAP_MALLOC= )
 
7024
 
 
7025
if test -n "$_WRAP_MALLOC"; then
 
7026
    if test -n "$GNU_CC"; then
 
7027
        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
 
7028
        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
 
7029
        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
 
7030
        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
 
7031
        dnl Wrap operator new and operator delete on Android.
 
7032
        if test "$OS_TARGET" = "Android"; then
 
7033
            WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
 
7034
        fi
 
7035
    else
 
7036
        AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
 
7037
    fi
 
7038
fi
 
7039
 
 
7040
dnl ========================================================
 
7041
dnl = Location of malloc wrapper lib
 
7042
dnl ========================================================
 
7043
MOZ_ARG_WITH_STRING(wrap-malloc,
 
7044
[  --with-wrap-malloc=DIR  Location of malloc wrapper library],
 
7045
    WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
 
7046
 
 
7047
dnl ========================================================
 
7048
dnl = Use JS Call tracing
 
7049
dnl ========================================================
 
7050
MOZ_ARG_ENABLE_BOOL(trace-jscalls,
 
7051
[  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
 
7052
    MOZ_TRACE_JSCALLS=1,
 
7053
    MOZ_TRACE_JSCALLS= )
 
7054
if test -n "$MOZ_TRACE_JSCALLS"; then
 
7055
    AC_DEFINE(MOZ_TRACE_JSCALLS)
 
7056
fi
 
7057
 
 
7058
dnl ========================================================
 
7059
dnl = Use incremental GC
 
7060
dnl ========================================================
 
7061
JSGC_INCREMENTAL=1
 
7062
MOZ_ARG_DISABLE_BOOL(gcincremental,
 
7063
[  --disable-gcincremental Disable incremental GC],
 
7064
    JSGC_INCREMENTAL= )
 
7065
if test -n "$JSGC_INCREMENTAL"; then
 
7066
    AC_DEFINE(JSGC_INCREMENTAL)
 
7067
fi
 
7068
 
 
7069
dnl ========================================================
 
7070
dnl ETW - Event Tracing for Windows
 
7071
dnl ========================================================
 
7072
MOZ_ARG_ENABLE_BOOL(ETW,
 
7073
[  --enable-ETW            Enable ETW (Event Tracing for Windows) event reporting],
 
7074
    MOZ_ETW=1,
 
7075
    MOZ_ETW= )
 
7076
if test -n "$MOZ_ETW"; then
 
7077
    AC_DEFINE(MOZ_ETW)
 
7078
fi
 
7079
 
 
7080
if test -n "$MOZ_ETW"; then
 
7081
    if test -z "$MOZ_WINSDK_TARGETVER"; then
 
7082
        AC_MSG_ERROR([--enable-ETW is only valid on Windows])
 
7083
    fi
 
7084
fi
 
7085
 
 
7086
dnl ========================================================
 
7087
dnl Zealous JavaScript GC
 
7088
dnl ========================================================
 
7089
MOZ_ARG_ENABLE_BOOL(gczeal,
 
7090
[  --enable-gczeal         Enable zealous JavaScript GCing],
 
7091
    JS_GC_ZEAL=1,
 
7092
    JS_GC_ZEAL= )
 
7093
if test -n "$JS_GC_ZEAL"; then
 
7094
    AC_DEFINE(JS_GC_ZEAL)
 
7095
fi
 
7096
 
 
7097
dnl ========================================================
 
7098
dnl JS opt-mode assertions and minidump instrumentation
 
7099
dnl ========================================================
 
7100
MOZ_ARG_ENABLE_BOOL(js-diagnostics,
 
7101
[  --enable-js-diagnostics
 
7102
                          Enable JS diagnostic assertions and breakpad data],
 
7103
    JS_CRASH_DIAGNOSTICS=1,
 
7104
    JS_CRASH_DIAGNOSTICS= )
 
7105
if test -n "$JS_CRASH_DIAGNOSTICS"; then
 
7106
    AC_DEFINE(JS_CRASH_DIAGNOSTICS)
 
7107
fi
 
7108
 
 
7109
MOZ_CHECK_CCACHE
 
7110
 
 
7111
dnl ========================================================
 
7112
dnl = Enable static checking using gcc-dehydra
 
7113
dnl ========================================================
 
7114
 
 
7115
MOZ_ARG_WITH_STRING(static-checking,
 
7116
[  --with-static-checking=path/to/gcc_dehydra.so
 
7117
                          Enable static checking of code using GCC-dehydra],
 
7118
    DEHYDRA_PATH=$withval,
 
7119
    DEHYDRA_PATH= )
 
7120
 
 
7121
if test -n "$DEHYDRA_PATH"; then
 
7122
    if test ! -f "$DEHYDRA_PATH"; then
 
7123
        AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
 
7124
    fi
 
7125
    AC_DEFINE(NS_STATIC_CHECKING)
 
7126
fi
 
7127
AC_SUBST(DEHYDRA_PATH)
 
7128
 
 
7129
dnl ========================================================
 
7130
dnl = Enable stripping of libs & executables
 
7131
dnl ========================================================
 
7132
MOZ_ARG_ENABLE_BOOL(strip,
 
7133
[  --enable-strip          Enable stripping of libs & executables ],
 
7134
    ENABLE_STRIP=1,
 
7135
    ENABLE_STRIP= )
 
7136
 
 
7137
dnl ========================================================
 
7138
dnl = Enable stripping of libs & executables when packaging
 
7139
dnl ========================================================
 
7140
MOZ_ARG_ENABLE_BOOL(install-strip,
 
7141
[  --enable-install-strip  Enable stripping of libs & executables when packaging ],
 
7142
    PKG_SKIP_STRIP= ,
 
7143
    PKG_SKIP_STRIP=1)
 
7144
 
 
7145
dnl ========================================================
 
7146
dnl = --enable-elf-dynstr-gc
 
7147
dnl ========================================================
 
7148
MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
 
7149
[  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
 
7150
    USE_ELF_DYNSTR_GC=1,
 
7151
    USE_ELF_DYNSTR_GC= )
 
7152
 
 
7153
dnl ========================================================
 
7154
dnl = --disable-elf-hack
 
7155
dnl ========================================================
 
7156
 
 
7157
USE_ELF_HACK=1
 
7158
MOZ_ARG_DISABLE_BOOL(elf-hack,
 
7159
[  --disable-elf-hack      Disable elf hacks],
 
7160
    USE_ELF_HACK=,
 
7161
    USE_ELF_HACK=1)
 
7162
 
 
7163
# Disable elf hack for profiling because the built in profiler
 
7164
# doesn't read the segments properly with elf hack. This is
 
7165
# temporary and should be fixed soon in the profiler.
 
7166
if test "$MOZ_PROFILING" = 1; then
 
7167
  USE_ELF_HACK=
 
7168
fi
 
7169
 
 
7170
# Only enable elfhack where supported
 
7171
if test "$USE_ELF_HACK" = 1; then
 
7172
    case "${HOST_OS_ARCH},${OS_ARCH}" in
 
7173
    Linux,Linux)
 
7174
        case "${CPU_ARCH}" in
 
7175
        arm | x86 | x86_64)
 
7176
            USE_ELF_HACK=1
 
7177
            ;;
 
7178
        *)
 
7179
            USE_ELF_HACK=
 
7180
            ;;
 
7181
        esac
 
7182
        ;;
 
7183
    *)
 
7184
        USE_ELF_HACK=
 
7185
        ;;
 
7186
    esac
 
7187
fi
 
7188
 
 
7189
if test "$USE_ELF_HACK" = 1; then
 
7190
    dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
 
7191
    dnl memory addresses it maps to. The result is that by the time elfhack
 
7192
    dnl kicks in, it is not possible to apply relocations because of that,
 
7193
    dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
 
7194
    dnl segment. It makes elfhack mostly useless, so considering the problems
 
7195
    dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
 
7196
    dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
 
7197
    dnl the linker creates PT_GNU_RELRO segments.
 
7198
    AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
 
7199
        LINK_WITH_PT_GNU_RELRO,
 
7200
        [echo "int main() {return 0;}" > conftest.${ac_ext}
 
7201
         if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
 
7202
            test -s conftest${ac_exeext}; then
 
7203
            if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
 
7204
                LINK_WITH_PT_GNU_RELRO=yes
 
7205
            else
 
7206
                LINK_WITH_PT_GNU_RELRO=no
 
7207
            fi
 
7208
         else
 
7209
             dnl We really don't expect to get here, but just in case
 
7210
             AC_ERROR([couldn't compile a simple C file])
 
7211
         fi
 
7212
         rm -rf conftest*])
 
7213
    if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
 
7214
        AC_MSG_WARN([Disabling elfhack])
 
7215
        USE_ELF_HACK=
 
7216
    fi
 
7217
fi
 
7218
 
 
7219
dnl ========================================================
 
7220
dnl = libstdc++ compatibility hacks
 
7221
dnl ========================================================
 
7222
 
 
7223
STDCXX_COMPAT=
 
7224
MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
 
7225
[  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
 
7226
    STDCXX_COMPAT=1)
 
7227
 
 
7228
AC_SUBST(STDCXX_COMPAT)
 
7229
 
 
7230
if test -n "$STDCXX_COMPAT"; then
 
7231
   eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
 
7232
   AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
 
7233
   AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
 
7234
fi
 
7235
 
 
7236
dnl ========================================================
 
7237
dnl =
 
7238
dnl = Profiling and Instrumenting
 
7239
dnl =
 
7240
dnl ========================================================
 
7241
MOZ_ARG_HEADER(Profiling and Instrumenting)
 
7242
 
 
7243
dnl ========================================================
 
7244
dnl = Enable NS_FUNCTION_TIMER, which provides Function
 
7245
dnl = timing for identifying code bottlenecks
 
7246
dnl = NS_FUNCTION_TIMER is off by default.
 
7247
dnl ========================================================
 
7248
MOZ_ARG_ENABLE_BOOL(functiontimer,
 
7249
[  --enable-functiontimer  Enable NS_FUNCTION_TIMER ],
 
7250
    NS_FUNCTION_TIMER=1,
 
7251
    NS_FUNCTION_TIMER= )
 
7252
if test -n "$NS_FUNCTION_TIMER"; then
 
7253
    AC_DEFINE(NS_FUNCTION_TIMER)
 
7254
fi
 
7255
 
 
7256
dnl ========================================================
 
7257
dnl = Enable runtime visual profiling logger
 
7258
dnl ========================================================
 
7259
MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
 
7260
[  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
 
7261
    MOZ_VISUAL_EVENT_TRACER=1,
 
7262
    MOZ_VISUAL_EVENT_TRACER=)
 
7263
if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
 
7264
    AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
 
7265
fi
 
7266
 
 
7267
dnl ========================================================
 
7268
dnl Turn on reflow counting
 
7269
dnl ========================================================
 
7270
MOZ_ARG_ENABLE_BOOL(reflow-perf,
 
7271
[  --enable-reflow-perf    Enable reflow performance tracing],
 
7272
    MOZ_REFLOW_PERF=1,
 
7273
    MOZ_REFLOW_PERF= )
 
7274
if test -n "$MOZ_REFLOW_PERF"; then
 
7275
    AC_DEFINE(MOZ_REFLOW_PERF)
 
7276
fi
 
7277
 
 
7278
dnl ========================================================
 
7279
dnl Enable code size metrics.
 
7280
dnl ========================================================
 
7281
MOZ_ARG_ENABLE_BOOL(codesighs,
 
7282
[  --enable-codesighs      Enable code size analysis tools],
 
7283
    _ENABLE_CODESIGHS=1,
 
7284
    _ENABLE_CODESIGHS= )
 
7285
if test -n "$_ENABLE_CODESIGHS"; then
 
7286
    if test -d $srcdir/tools/codesighs; then
 
7287
        MOZ_MAPINFO=1
 
7288
    else
 
7289
        AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
 
7290
    fi
 
7291
fi
 
7292
 
 
7293
dnl ========================================================
 
7294
dnl = Enable Radio Interface for B2G (Gonk usually)
 
7295
dnl ========================================================
 
7296
MOZ_ARG_ENABLE_BOOL(b2g-ril,
 
7297
[  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
 
7298
    MOZ_B2G_RIL=1,
 
7299
    MOZ_B2G_RIL= )
 
7300
if test -n "$MOZ_B2G_RIL"; then
 
7301
    AC_DEFINE(MOZ_B2G_RIL)
 
7302
fi
 
7303
AC_SUBST(MOZ_B2G_RIL)
 
7304
 
 
7305
dnl ========================================================
 
7306
dnl = Enable Bluetooth Interface for B2G (Gonk usually)
 
7307
dnl ========================================================
 
7308
MOZ_ARG_ENABLE_BOOL(b2g-bt,
 
7309
[  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
 
7310
    MOZ_B2G_BT=1,
 
7311
    MOZ_B2G_BT= )
 
7312
if test -n "$MOZ_B2G_BT"; then
 
7313
    AC_DEFINE(MOZ_B2G_BT)
 
7314
fi
 
7315
AC_SUBST(MOZ_B2G_BT)
 
7316
 
 
7317
dnl ========================================================
 
7318
dnl = Enable Support for System Messages API
 
7319
dnl ========================================================
 
7320
if test -n "$MOZ_SYS_MSG"; then
 
7321
    AC_DEFINE(MOZ_SYS_MSG)
 
7322
fi
 
7323
AC_SUBST(MOZ_SYS_MSG)
 
7324
 
 
7325
dnl ========================================================
 
7326
dnl = Enable Camera Interface for B2G (Gonk usually)
 
7327
dnl ========================================================
 
7328
MOZ_ARG_ENABLE_BOOL(b2g-camera,
 
7329
[  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
 
7330
    MOZ_B2G_CAMERA=1,
 
7331
    MOZ_B2G_CAMERA= )
 
7332
if test -n "$MOZ_B2G_CAMERA"; then
 
7333
   AC_DEFINE(MOZ_B2G_CAMERA)
 
7334
fi
 
7335
AC_SUBST(MOZ_B2G_CAMERA)
 
7336
 
 
7337
dnl ========================================================
 
7338
dnl = Support for demangling undefined symbols
 
7339
dnl ========================================================
 
7340
if test -z "$SKIP_LIBRARY_CHECKS"; then
 
7341
    AC_LANG_SAVE
 
7342
    AC_LANG_CPLUSPLUS
 
7343
    AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
 
7344
    AC_LANG_RESTORE
 
7345
fi
 
7346
 
 
7347
# Demangle only for debug or trace-malloc builds
 
7348
MOZ_DEMANGLE_SYMBOLS=
 
7349
if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
 
7350
    MOZ_DEMANGLE_SYMBOLS=1
 
7351
    AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
 
7352
fi
 
7353
AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
 
7354
 
 
7355
dnl ========================================================
 
7356
dnl = Support for gcc stack unwinding (from gcc 3.3)
 
7357
dnl ========================================================
 
7358
if test -z "$SKIP_LIBRARY_CHECKS"; then
 
7359
    MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
 
7360
fi
 
7361
 
 
7362
dnl ========================================================
 
7363
dnl JIT observers
 
7364
dnl ========================================================
 
7365
 
 
7366
MOZ_ARG_WITH_STRING(jitreport-granularity,
 
7367
[  --jitreport-granularity=N
 
7368
                           Default granularity at which to report JIT code
 
7369
                           to external tools
 
7370
                             0 - no info
 
7371
                             1 - code ranges for whole functions only
 
7372
                             2 - per-line information
 
7373
                             3 - per-op information],
 
7374
  JITREPORT_GRANULARITY=$withval,
 
7375
  JITREPORT_GRANULARITY=3)
 
7376
 
 
7377
AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
 
7378
 
 
7379
dnl ========================================================
 
7380
dnl =
 
7381
dnl = Misc. Options
 
7382
dnl =
 
7383
dnl ========================================================
 
7384
MOZ_ARG_HEADER(Misc. Options)
 
7385
 
 
7386
dnl ========================================================
 
7387
dnl update xterm title
 
7388
dnl ========================================================
 
7389
MOZ_ARG_ENABLE_BOOL(xterm-updates,
 
7390
[  --enable-xterm-updates  Update XTERM titles with current command.],
 
7391
    MOZ_UPDATE_XTERM=1,
 
7392
    MOZ_UPDATE_XTERM= )
 
7393
 
 
7394
dnl =========================================================
 
7395
dnl = Chrome format
 
7396
dnl =========================================================
 
7397
MOZ_ARG_ENABLE_STRING([chrome-format],
 
7398
[  --enable-chrome-format=jar|flat|both|symlink|omni
 
7399
                          Select FORMAT of chrome files (default=jar)],
 
7400
    MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
 
7401
 
 
7402
if test -z "$MOZ_CHROME_FILE_FORMAT"; then
 
7403
    MOZ_CHROME_FILE_FORMAT=jar
 
7404
fi
 
7405
 
 
7406
if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
 
7407
    test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
 
7408
    test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
 
7409
    test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
 
7410
    test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
 
7411
    AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
 
7412
fi
 
7413
 
 
7414
dnl =========================================================
 
7415
dnl Omnijar packaging (bug 552121)
 
7416
dnl =========================================================
 
7417
dnl Omnijar packaging is compatible with flat packaging.
 
7418
dnl In unpackaged builds, omnijar looks for files as if
 
7419
dnl things were flat packaged. After packaging, all files
 
7420
dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
 
7421
dnl is set to flat since putting files into jars is only
 
7422
dnl done during packaging with omnijar.
 
7423
if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
 
7424
    MOZ_OMNIJAR=1
 
7425
    AC_DEFINE(MOZ_OMNIJAR)
 
7426
    if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
 
7427
        MOZ_CHROME_FILE_FORMAT=flat
 
7428
    else
 
7429
        MOZ_CHROME_FILE_FORMAT=symlink
 
7430
    fi
 
7431
elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
 
7432
    AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
 
7433
fi
 
7434
 
 
7435
OMNIJAR_NAME=omni.ja
 
7436
AC_SUBST(OMNIJAR_NAME)
 
7437
AC_SUBST(MOZ_OMNIJAR)
 
7438
 
 
7439
dnl ========================================================
 
7440
dnl = Define default location for MOZILLA_FIVE_HOME
 
7441
dnl ========================================================
 
7442
MOZ_ARG_WITH_STRING(default-mozilla-five-home,
 
7443
[  --with-default-mozilla-five-home
 
7444
                          Set the default value for MOZILLA_FIVE_HOME],
 
7445
[ val=`echo $withval`
 
7446
  AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
 
7447
 
 
7448
dnl ========================================================
 
7449
dnl = Location of the mozilla user directory (default is ~/.mozilla).],
 
7450
dnl ========================================================
 
7451
MOZ_ARG_WITH_STRING(user-appdir,
 
7452
[  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
 
7453
[ val=`echo $withval`
 
7454
if echo "$val" | grep "\/" >/dev/null; then
 
7455
    AC_MSG_ERROR("Homedir must be single relative path.")
 
7456
else
 
7457
    MOZ_USER_DIR="$val"
 
7458
fi])
 
7459
 
 
7460
AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
 
7461
 
 
7462
dnl ========================================================
 
7463
dnl = Doxygen configuration
 
7464
dnl ========================================================
 
7465
dnl Use commas to specify multiple dirs to this arg
 
7466
MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
 
7467
MOZ_ARG_WITH_STRING(doc-input-dirs,
 
7468
[  --with-doc-input-dirs=DIRS
 
7469
                          Header/idl dirs to create docs from],
 
7470
[ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
 
7471
AC_SUBST(MOZ_DOC_INPUT_DIRS)
 
7472
 
 
7473
dnl Use commas to specify multiple dirs to this arg
 
7474
MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
 
7475
MOZ_ARG_WITH_STRING(doc-include-dirs,
 
7476
[  --with-doc-include-dirs=DIRS
 
7477
                          Include dirs to preprocess doc headers],
 
7478
[ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
 
7479
AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
 
7480
 
 
7481
MOZ_DOC_OUTPUT_DIR='./dist/docs'
 
7482
MOZ_ARG_WITH_STRING(doc-output-dir,
 
7483
[  --with-doc-output-dir=DIR
 
7484
                          Dir to generate docs into],
 
7485
[ MOZ_DOC_OUTPUT_DIR=$withval ] )
 
7486
AC_SUBST(MOZ_DOC_OUTPUT_DIR)
 
7487
 
 
7488
if test -z "$SKIP_COMPILER_CHECKS"; then
 
7489
dnl ========================================================
 
7490
dnl =
 
7491
dnl = Compiler Options
 
7492
dnl =
 
7493
dnl ========================================================
 
7494
MOZ_ARG_HEADER(Compiler Options)
 
7495
 
 
7496
dnl ========================================================
 
7497
dnl Check for gcc -pipe support
 
7498
dnl ========================================================
 
7499
AC_MSG_CHECKING([for -pipe support])
 
7500
if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
 
7501
    dnl Any gcc that supports firefox supports -pipe.
 
7502
    CFLAGS="$CFLAGS -pipe"
 
7503
    CXXFLAGS="$CXXFLAGS -pipe"
 
7504
    AC_MSG_RESULT([yes])
 
7505
else
 
7506
    AC_MSG_RESULT([no])
 
7507
fi
 
7508
 
 
7509
dnl ========================================================
 
7510
dnl Profile guided optimization (gcc checks)
 
7511
dnl ========================================================
 
7512
dnl Test for profiling options
 
7513
dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
 
7514
 
 
7515
_SAVE_CFLAGS="$CFLAGS"
 
7516
CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
 
7517
 
 
7518
AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
 
7519
AC_TRY_COMPILE([], [return 0;],
 
7520
               [ PROFILE_GEN_CFLAGS="-fprofile-generate"
 
7521
                 result="yes" ], result="no")
 
7522
AC_MSG_RESULT([$result])
 
7523
 
 
7524
if test $result = "yes"; then
 
7525
  PROFILE_GEN_LDFLAGS="-fprofile-generate"
 
7526
  PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
 
7527
  PROFILE_USE_LDFLAGS="-fprofile-use"
 
7528
fi
 
7529
 
 
7530
CFLAGS="$_SAVE_CFLAGS"
 
7531
 
 
7532
if test -n "$INTEL_CC"; then
 
7533
  PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
 
7534
  PROFILE_GEN_LDFLAGS=
 
7535
  PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
 
7536
  PROFILE_USE_LDFLAGS=
 
7537
fi
 
7538
 
 
7539
dnl Sun Studio on Solaris
 
7540
if test "$SOLARIS_SUNPRO_CC"; then
 
7541
  PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
 
7542
  PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
 
7543
  PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
 
7544
  PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
 
7545
fi
 
7546
 
 
7547
AC_SUBST(PROFILE_GEN_CFLAGS)
 
7548
AC_SUBST(PROFILE_GEN_LDFLAGS)
 
7549
AC_SUBST(PROFILE_USE_CFLAGS)
 
7550
AC_SUBST(PROFILE_USE_LDFLAGS)
 
7551
 
 
7552
AC_LANG_CPLUSPLUS
 
7553
 
 
7554
dnl ========================================================
 
7555
dnl Test for -pedantic bustage
 
7556
dnl ========================================================
 
7557
MOZ_ARG_DISABLE_BOOL(pedantic,
 
7558
[  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
 
7559
_PEDANTIC= )
 
7560
if test "$_PEDANTIC"; then
 
7561
    _SAVE_CXXFLAGS=$CXXFLAGS
 
7562
    CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
 
7563
    AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
 
7564
    AC_TRY_COMPILE([$configure_static_assert_macros],
 
7565
                   [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
 
7566
                   result="no", result="yes" )
 
7567
    AC_MSG_RESULT([$result])
 
7568
    CXXFLAGS="$_SAVE_CXXFLAGS"
 
7569
 
 
7570
    case "$result" in
 
7571
    no)
 
7572
        _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
 
7573
        _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
 
7574
        ;;
 
7575
    yes)
 
7576
        AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
 
7577
        ;;
 
7578
    esac
 
7579
fi
 
7580
 
 
7581
dnl ========================================================
 
7582
dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
 
7583
dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
 
7584
dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
 
7585
dnl ========================================================
 
7586
_SAVE_CXXFLAGS=$CXXFLAGS
 
7587
CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
 
7588
AC_CACHE_CHECK(for correct overload resolution with const and templates,
 
7589
    ac_nscap_nonconst_opeq_bug,
 
7590
    [AC_TRY_COMPILE([
 
7591
                      template <class T>
 
7592
                      class Pointer
 
7593
                        {
 
7594
                        public:
 
7595
                          T* myPtr;
 
7596
                        };
 
7597
 
 
7598
                      template <class T, class U>
 
7599
                      int operator==(const Pointer<T>& rhs, U* lhs)
 
7600
                        {
 
7601
                          return rhs.myPtr == lhs;
 
7602
                        }
 
7603
 
 
7604
                      template <class T, class U>
 
7605
                      int operator==(const Pointer<T>& rhs, const U* lhs)
 
7606
                        {
 
7607
                          return rhs.myPtr == lhs;
 
7608
                        }
 
7609
                    ],
 
7610
                    [
 
7611
                      Pointer<int> foo;
 
7612
                      const int* bar;
 
7613
                      return foo == bar;
 
7614
                    ],
 
7615
                    ac_nscap_nonconst_opeq_bug="no",
 
7616
                    ac_nscap_nonconst_opeq_bug="yes")])
 
7617
CXXFLAGS="$_SAVE_CXXFLAGS"
 
7618
 
 
7619
if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
 
7620
    AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
 
7621
fi
 
7622
fi # ! SKIP_COMPILER_CHECKS
 
7623
 
 
7624
AC_DEFINE(CPP_THROW_NEW, [throw()])
 
7625
AC_LANG_C
 
7626
 
 
7627
if test "$COMPILE_ENVIRONMENT"; then
 
7628
MOZ_EXPAND_LIBS
 
7629
fi # COMPILE_ENVIRONMENT
 
7630
 
 
7631
dnl ========================================================
 
7632
dnl =
 
7633
dnl = Build depencency options
 
7634
dnl =
 
7635
dnl ========================================================
 
7636
MOZ_ARG_HEADER(Build dependencies)
 
7637
 
 
7638
dnl ========================================================
 
7639
dnl = Do not auto generate dependency info
 
7640
dnl ========================================================
 
7641
MOZ_AUTO_DEPS=1
 
7642
MOZ_ARG_DISABLE_BOOL(auto-deps,
 
7643
[  --disable-auto-deps     Do not automatically generate dependency info],
 
7644
    MOZ_AUTO_DEPS=,
 
7645
    MOZ_AUTO_DEPS=1)
 
7646
 
 
7647
if test -n "$MOZ_AUTO_DEPS"; then
 
7648
dnl ========================================================
 
7649
dnl = Use mkdepend instead of $CC -MD for dependency generation
 
7650
dnl ========================================================
 
7651
_cpp_md_flag=
 
7652
MOZ_ARG_DISABLE_BOOL(md,
 
7653
[  --disable-md            Do not use compiler-based dependencies ],
 
7654
  [_cpp_md_flag=],
 
7655
  [_cpp_md_flag=1],
 
7656
  [dnl Default is to turn on -MD if using GNU-compatible compilers
 
7657
   if test "$GNU_CC" -a "$GNU_CXX"; then
 
7658
     _cpp_md_flag=1
 
7659
   fi
 
7660
  dnl Default is to use -xM if using Sun Studio on Solaris
 
7661
   if test "$SOLARIS_SUNPRO_CC"; then
 
7662
     _cpp_md_flag=1
 
7663
   fi])
 
7664
if test "$_cpp_md_flag"; then
 
7665
  COMPILER_DEPEND=1
 
7666
  _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(@F).pp)'
 
7667
  dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
 
7668
  if test "$SOLARIS_SUNPRO_CC"; then
 
7669
    _DEPEND_CFLAGS=
 
7670
  fi
 
7671
else
 
7672
  COMPILER_DEPEND=
 
7673
  dnl Don't override this for MSVC
 
7674
  if test -z "$_WIN32_MSVC"; then
 
7675
    _USE_CPP_INCLUDE_FLAG=
 
7676
    _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
 
7677
    _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
 
7678
  else
 
7679
    echo '#include <stdio.h>' > dummy-hello.c
 
7680
    changequote(,)
 
7681
    CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
 
7682
    changequote([,])
 
7683
    if test -z "$CL_INCLUDES_PREFIX"; then
 
7684
        AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
 
7685
    fi
 
7686
    AC_SUBST(CL_INCLUDES_PREFIX)
 
7687
    rm -f dummy-hello.c
 
7688
    COMPILER_DEPEND=1
 
7689
  fi
 
7690
fi
 
7691
fi # MOZ_AUTO_DEPS
 
7692
MDDEPDIR='.deps'
 
7693
AC_SUBST(MOZ_AUTO_DEPS)
 
7694
AC_SUBST(COMPILER_DEPEND)
 
7695
AC_SUBST(MDDEPDIR)
 
7696
 
 
7697
dnl ========================================================
 
7698
dnl =
 
7699
dnl = Static Build Options
 
7700
dnl =
 
7701
dnl ========================================================
 
7702
MOZ_ARG_HEADER(Static build options)
 
7703
 
 
7704
# split JS out by default to avoid VS2005 PGO crash (bug 591836).
 
7705
if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
 
7706
  ENABLE_SHARED_JS=1
 
7707
fi
 
7708
 
 
7709
MOZ_ARG_ENABLE_BOOL(shared-js,
 
7710
[  --enable-shared-js
 
7711
                          Create a shared JavaScript library.],
 
7712
    ENABLE_SHARED_JS=1,
 
7713
    ENABLE_SHARED_JS=)
 
7714
 
 
7715
if test -n "$ENABLE_SHARED_JS"; then
 
7716
  JS_SHARED_LIBRARY=1
 
7717
  MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
 
7718
else
 
7719
  MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
 
7720
  AC_DEFINE(MOZ_STATIC_JS)
 
7721
fi
 
7722
AC_SUBST(JS_SHARED_LIBRARY)
 
7723
 
 
7724
AC_SUBST(LIBXUL_LIBS)
 
7725
XPCOM_LIBS="$LIBXUL_LIBS"
 
7726
 
 
7727
dnl ========================================================
 
7728
dnl =
 
7729
dnl = Standalone module options
 
7730
dnl =
 
7731
dnl ========================================================
 
7732
MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
 
7733
 
 
7734
dnl Check for GLib.
 
7735
dnl ========================================================
 
7736
 
 
7737
if test -z "$SKIP_PATH_CHECKS"; then
 
7738
if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
 
7739
    if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
 
7740
        PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
 
7741
    fi
 
7742
fi
 
7743
fi
 
7744
 
 
7745
if test -z "${GLIB_GMODULE_LIBS}" \
 
7746
   -a -n "${GLIB_CONFIG}"\
 
7747
    -a "${GLIB_CONFIG}" != no\
 
7748
; then
 
7749
    GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
 
7750
fi
 
7751
 
 
7752
AC_SUBST(GLIB_CFLAGS)
 
7753
AC_SUBST(GLIB_LIBS)
 
7754
AC_SUBST(GLIB_GMODULE_LIBS)
 
7755
 
 
7756
dnl ========================================================
 
7757
dnl Graphics checks.
 
7758
dnl ========================================================
 
7759
 
 
7760
if test "${OS_TARGET}" = "WINNT" -o "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android" -o "${MOZ_WIDGET_TOOLKIT}" = "gtk2"; then
 
7761
MOZ_ENABLE_SKIA=1
 
7762
else
 
7763
MOZ_ENABLE_SKIA=
 
7764
fi
 
7765
 
 
7766
MOZ_ARG_ENABLE_BOOL(skia,
 
7767
[  --enable-skia   Enable use of Skia],
 
7768
MOZ_ENABLE_SKIA=1,
 
7769
MOZ_ENABLE_SKIA=)
 
7770
 
 
7771
if test "$USE_FC_FREETYPE"; then
 
7772
    if test "$COMPILE_ENVIRONMENT"; then
 
7773
        dnl ========================================================
 
7774
        dnl = Check for freetype2 and its functionality
 
7775
        dnl ========================================================
 
7776
        PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
 
7777
 
 
7778
        if test "$_HAVE_FREETYPE2"; then
 
7779
            _SAVE_LIBS="$LIBS"
 
7780
            _SAVE_CFLAGS="$CFLAGS"
 
7781
            LIBS="$LIBS $FT2_LIBS"
 
7782
            CFLAGS="$CFLAGS $FT2_CFLAGS"
 
7783
 
 
7784
            AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
 
7785
                ac_cv_member_FT_Bitmap_Size_y_ppem,
 
7786
                [AC_TRY_COMPILE([#include <ft2build.h>
 
7787
                                 #include FT_FREETYPE_H],
 
7788
                                [FT_Bitmap_Size s;
 
7789
                                 if (sizeof s.y_ppem) return 0;
 
7790
                                 return 1],
 
7791
                                ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
 
7792
                                ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
 
7793
            if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
 
7794
                HAVE_FT_BITMAP_SIZE_Y_PPEM=1
 
7795
            else
 
7796
                HAVE_FT_BITMAP_SIZE_Y_PPEM=0
 
7797
            fi
 
7798
            AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
 
7799
                               $HAVE_FT_BITMAP_SIZE_Y_PPEM,
 
7800
                               [FT_Bitmap_Size structure includes y_ppem field])
 
7801
 
 
7802
            AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
 
7803
 
 
7804
            LIBS="$_SAVE_LIBS"
 
7805
            CFLAGS="$_SAVE_CFLAGS"
 
7806
        fi
 
7807
 
 
7808
        _SAVE_CPPFLAGS="$CPPFLAGS"
 
7809
        CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
 
7810
        MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
 
7811
            [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
 
7812
        CPPFLAGS="$_SAVE_CPPFLAGS"
 
7813
    else
 
7814
        AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
 
7815
    fi
 
7816
 
 
7817
    PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
 
7818
    [
 
7819
        if test "$MOZ_PANGO"; then
 
7820
            MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
 
7821
            MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
 
7822
        else
 
7823
            FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
 
7824
            FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
 
7825
        fi
 
7826
    ])
 
7827
fi
 
7828
 
 
7829
dnl ========================================================
 
7830
dnl Check for pixman and cairo
 
7831
dnl ========================================================
 
7832
 
 
7833
MOZ_TREE_CAIRO=1
 
7834
MOZ_ARG_ENABLE_BOOL(system-cairo,
 
7835
[  --enable-system-cairo   Use system cairo (located with pkgconfig)],
 
7836
MOZ_TREE_CAIRO=,
 
7837
MOZ_TREE_CAIRO=1 )
 
7838
 
 
7839
MOZ_TREE_PIXMAN=1
 
7840
MOZ_ARG_ENABLE_BOOL(system-pixman,
 
7841
[ --enable-system-pixman Use system pixman (located with pkgconfig)],
 
7842
MOZ_TREE_PIXMAN=,
 
7843
MOZ_TREE_PIXMAN=force,
 
7844
MOZ_TREE_PIXMAN=1 )
 
7845
 
 
7846
# System cairo depends on system pixman
 
7847
if test "$MOZ_TREE_PIXMAN" = "force"; then
 
7848
    if test -z "$MOZ_TREE_CAIRO"; then
 
7849
        AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
 
7850
    else
 
7851
        MOZ_TREE_PIXMAN=1
 
7852
    fi
 
7853
elif test -z "$MOZ_TREE_CAIRO"; then
 
7854
    MOZ_TREE_PIXMAN=
 
7855
fi
 
7856
 
 
7857
if test "$MOZ_TREE_PIXMAN"; then
 
7858
    AC_DEFINE(MOZ_TREE_PIXMAN)
 
7859
    MOZ_PIXMAN_CFLAGS=""
 
7860
    MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
 
7861
else
 
7862
    PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
 
7863
    MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
 
7864
    MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
 
7865
fi
 
7866
AC_SUBST(MOZ_PIXMAN_CFLAGS)
 
7867
AC_SUBST(MOZ_PIXMAN_LIBS)
 
7868
 
 
7869
# Check for headers defining standard int types.
 
7870
MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
 
7871
 
 
7872
if test "$MOZ_TREE_CAIRO"; then
 
7873
    MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
 
7874
    AC_DEFINE(MOZ_TREE_CAIRO)
 
7875
 
 
7876
    # For now we assume that we will have a uint64_t available through
 
7877
    # one of the above headers or mozstdint.h.
 
7878
    AC_DEFINE(HAVE_UINT64_T)
 
7879
 
 
7880
    # Define macros for cairo-features.h
 
7881
    TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
 
7882
    if test "$MOZ_X11"; then
 
7883
        XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
 
7884
        XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
 
7885
        PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
 
7886
        FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
 
7887
        MOZ_ENABLE_CAIRO_FT=1
 
7888
        CAIRO_FT_CFLAGS="$FT2_CFLAGS"
 
7889
    fi
 
7890
    case "$MOZ_WIDGET_TOOLKIT" in
 
7891
      qt)
 
7892
        QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
 
7893
        ;;
 
7894
      cocoa | uikit)
 
7895
        QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
 
7896
        QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
 
7897
        QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
 
7898
        ;;
 
7899
      windows)
 
7900
        WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
 
7901
        WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
 
7902
        if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
 
7903
            WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
 
7904
            WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
 
7905
            MOZ_ENABLE_D2D_SURFACE=1
 
7906
            MOZ_ENABLE_DWRITE_FONT=1
 
7907
        else
 
7908
            WIN32_DWRITE_FONT_FEATURE=
 
7909
            WIN32_D2D_SURFACE_FEATURE=
 
7910
        fi
 
7911
 
 
7912
        MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
 
7913
 
 
7914
        dnl D3D10 Layers depend on D2D Surfaces.
 
7915
        if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
 
7916
          MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
 
7917
        fi
 
7918
        ;;
 
7919
      os2)
 
7920
        OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
 
7921
        FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
 
7922
        MOZ_ENABLE_CAIRO_FT=1
 
7923
        CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
 
7924
        CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
 
7925
        CAIRO_FT_LIBS=""
 
7926
        ;;
 
7927
    esac
 
7928
    if test "$USE_FC_FREETYPE"; then
 
7929
        FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
 
7930
    fi
 
7931
    AC_SUBST(MOZ_ENABLE_CAIRO_FT)
 
7932
    AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
 
7933
    AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
 
7934
    AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
 
7935
    AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
 
7936
    AC_SUBST(CAIRO_FT_CFLAGS)
 
7937
 
 
7938
    AC_SUBST(PS_SURFACE_FEATURE)
 
7939
    AC_SUBST(PDF_SURFACE_FEATURE)
 
7940
    AC_SUBST(SVG_SURFACE_FEATURE)
 
7941
    AC_SUBST(XLIB_SURFACE_FEATURE)
 
7942
    AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
 
7943
    AC_SUBST(QUARTZ_SURFACE_FEATURE)
 
7944
    AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
 
7945
    AC_SUBST(WIN32_SURFACE_FEATURE)
 
7946
    AC_SUBST(OS2_SURFACE_FEATURE)
 
7947
    AC_SUBST(DIRECTFB_SURFACE_FEATURE)
 
7948
    AC_SUBST(FT_FONT_FEATURE)
 
7949
    AC_SUBST(FC_FONT_FEATURE)
 
7950
    AC_SUBST(WIN32_FONT_FEATURE)
 
7951
    AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
 
7952
    AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
 
7953
    AC_SUBST(QUARTZ_FONT_FEATURE)
 
7954
    AC_SUBST(PNG_FUNCTIONS_FEATURE)
 
7955
    AC_SUBST(QT_SURFACE_FEATURE)
 
7956
    AC_SUBST(TEE_SURFACE_FEATURE)
 
7957
 
 
7958
    MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
 
7959
    MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
 
7960
 
 
7961
    if test "$MOZ_X11"; then
 
7962
        MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
 
7963
    fi
 
7964
 
 
7965
    CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
 
7966
else
 
7967
    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
 
7968
    MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
 
7969
    MOZ_CAIRO_LIBS="$CAIRO_LIBS"
 
7970
    PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
 
7971
    if test "$MOZ_X11"; then
 
7972
        PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
 
7973
        MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
 
7974
        MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
 
7975
        MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
 
7976
    fi
 
7977
fi
 
7978
 
 
7979
AC_SUBST(MOZ_TREE_CAIRO)
 
7980
AC_SUBST(MOZ_CAIRO_CFLAGS)
 
7981
AC_SUBST(MOZ_CAIRO_LIBS)
 
7982
AC_SUBST(MOZ_CAIRO_OSLIBS)
 
7983
AC_SUBST(MOZ_TREE_PIXMAN)
 
7984
 
 
7985
dnl ========================================================
 
7986
dnl qcms
 
7987
dnl ========================================================
 
7988
 
 
7989
QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
 
7990
AC_SUBST(QCMS_LIBS)
 
7991
 
 
7992
dnl ========================================================
 
7993
dnl HarfBuzz
 
7994
dnl ========================================================
 
7995
MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
 
7996
AC_SUBST(MOZ_HARFBUZZ_LIBS)
 
7997
 
 
7998
dnl ========================================================
 
7999
dnl SIL Graphite
 
8000
dnl ========================================================
 
8001
if test "$MOZ_GRAPHITE"; then
 
8002
  MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
 
8003
  AC_DEFINE(MOZ_GRAPHITE)
 
8004
else
 
8005
  MOZ_GRAPHITE_LIBS=
 
8006
fi
 
8007
AC_SUBST(MOZ_GRAPHITE)
 
8008
AC_SUBST(MOZ_GRAPHITE_LIBS)
 
8009
 
 
8010
dnl ========================================================
 
8011
dnl OTS
 
8012
dnl ========================================================
 
8013
MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
 
8014
AC_SUBST(MOZ_OTS_LIBS)
 
8015
 
 
8016
dnl ========================================================
 
8017
dnl Skia 
 
8018
dnl ========================================================
 
8019
if test "$MOZ_ENABLE_SKIA"; then
 
8020
  MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
 
8021
  AC_DEFINE(MOZ_ENABLE_SKIA)
 
8022
else
 
8023
  MOZ_SKIA_LIBS=
 
8024
fi
 
8025
AC_SUBST(MOZ_ENABLE_SKIA)
 
8026
AC_SUBST(MOZ_SKIA_LIBS)
 
8027
 
 
8028
dnl ========================================================
 
8029
dnl disable xul
 
8030
dnl ========================================================
 
8031
MOZ_ARG_DISABLE_BOOL(xul,
 
8032
[  --disable-xul           Disable XUL],
 
8033
    MOZ_XUL= )
 
8034
if test "$MOZ_XUL"; then
 
8035
  AC_DEFINE(MOZ_XUL)
 
8036
else
 
8037
  dnl remove extensions that require XUL
 
8038
  MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
 
8039
fi
 
8040
 
 
8041
AC_SUBST(MOZ_XUL)
 
8042
 
 
8043
dnl ========================================================
 
8044
dnl disable profile locking
 
8045
dnl   do no use this in applications that can have more than
 
8046
dnl   one process accessing the profile directory.
 
8047
dnl ========================================================
 
8048
MOZ_ARG_DISABLE_BOOL(profilelocking,
 
8049
[  --disable-profilelocking
 
8050
                          Disable profile locking],
 
8051
    MOZ_PROFILELOCKING=,
 
8052
    MOZ_PROFILELOCKING=1 )
 
8053
if test "$MOZ_PROFILELOCKING"; then
 
8054
  AC_DEFINE(MOZ_PROFILELOCKING)
 
8055
fi
 
8056
 
 
8057
dnl ========================================================
 
8058
dnl necko configuration options
 
8059
dnl ========================================================
 
8060
 
 
8061
dnl
 
8062
dnl option to disable various necko protocols
 
8063
dnl
 
8064
MOZ_ARG_ENABLE_STRING(necko-protocols,
 
8065
[  --enable-necko-protocols[={http,ftp,default,all,none}]
 
8066
                          Enable/disable specific protocol handlers],
 
8067
[ for option in `echo $enableval | sed 's/,/ /g'`; do
 
8068
    if test "$option" = "yes" -o "$option" = "all"; then
 
8069
        NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
 
8070
    elif test "$option" = "no" -o "$option" = "none"; then
 
8071
        NECKO_PROTOCOLS=""
 
8072
    elif test "$option" = "default"; then
 
8073
        NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
 
8074
    elif test `echo "$option" | grep -c \^-` != 0; then
 
8075
        option=`echo $option | sed 's/^-//'`
 
8076
        NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
 
8077
    else
 
8078
        NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
 
8079
    fi
 
8080
done],
 
8081
    NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
 
8082
dnl Remove dupes
 
8083
NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
 
8084
AC_SUBST(NECKO_PROTOCOLS)
 
8085
for p in $NECKO_PROTOCOLS; do
 
8086
    AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
 
8087
    _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
 
8088
done
 
8089
 
 
8090
dnl
 
8091
dnl option to disable necko's wifi scanner
 
8092
dnl
 
8093
MOZ_ARG_DISABLE_BOOL(necko-wifi,
 
8094
[  --disable-necko-wifi    Disable necko wifi scanner],
 
8095
    NECKO_WIFI=,
 
8096
    NECKO_WIFI=1)
 
8097
 
 
8098
if test "$OS_ARCH" = "OS2"; then
 
8099
  dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
 
8100
  NECKO_WIFI=
 
8101
fi
 
8102
if test "$NECKO_WIFI" -a \
 
8103
        "$OS_ARCH" != "Linux" -a \
 
8104
        "$OS_ARCH" != "Darwin" -a \
 
8105
        "$OS_ARCH" != "SunOS" -a \
 
8106
        "$OS_ARCH" != "WINNT"; then
 
8107
  AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
 
8108
fi
 
8109
 
 
8110
if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
 
8111
then
 
8112
  MOZ_CHECK_HEADER([iwlib.h])
 
8113
  if test "$ac_cv_header_iwlib_h" != "yes"; then
 
8114
    AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora) or libiw-devel (openSUSE)); use --disable-necko-wifi to disable])
 
8115
  fi
 
8116
fi
 
8117
 
 
8118
if test "$NECKO_WIFI"; then
 
8119
  AC_DEFINE(NECKO_WIFI)
 
8120
  _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
 
8121
fi
 
8122
AC_SUBST(NECKO_WIFI)
 
8123
 
 
8124
dnl
 
8125
dnl option to disable cookies
 
8126
dnl
 
8127
MOZ_ARG_DISABLE_BOOL(cookies,
 
8128
[  --disable-cookies       Disable cookie support],
 
8129
    NECKO_COOKIES=,
 
8130
    NECKO_COOKIES=1)
 
8131
AC_SUBST(NECKO_COOKIES)
 
8132
if test "$NECKO_COOKIES"; then
 
8133
    AC_DEFINE(NECKO_COOKIES)
 
8134
    _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
 
8135
fi
 
8136
 
 
8137
dnl
 
8138
dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
 
8139
dnl
 
8140
MOZ_ARG_DISABLE_BOOL(ctypes,
 
8141
[  --disable-ctypes        Disable js-ctypes],
 
8142
    BUILD_CTYPES=,
 
8143
    BUILD_CTYPES=1)
 
8144
AC_SUBST(BUILD_CTYPES)
 
8145
if test "$BUILD_CTYPES"; then
 
8146
    AC_DEFINE(BUILD_CTYPES)
 
8147
fi
 
8148
 
 
8149
dnl Build Places if required
 
8150
if test "$MOZ_PLACES"; then
 
8151
  AC_DEFINE(MOZ_PLACES)
 
8152
fi
 
8153
 
 
8154
dnl Build Apps in the Cloud (AITC) if required
 
8155
AC_SUBST(MOZ_SERVICES_AITC)
 
8156
if test -n "$MOZ_SERVICES_AITC"; then
 
8157
  AC_DEFINE(MOZ_SERVICES_AITC)
 
8158
fi
 
8159
 
 
8160
dnl Build Notifications if required
 
8161
AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
 
8162
if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
 
8163
  AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
 
8164
fi
 
8165
 
 
8166
dnl Build Sync Services if required
 
8167
AC_SUBST(MOZ_SERVICES_SYNC)
 
8168
if test -n "$MOZ_SERVICES_SYNC"; then
 
8169
  AC_DEFINE(MOZ_SERVICES_SYNC)
 
8170
fi
 
8171
 
 
8172
dnl ========================================================
 
8173
if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
 
8174
    MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
 
8175
fi
 
8176
 
 
8177
if test "$MOZ_APP_COMPONENT_INCLUDE"; then
 
8178
  AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
 
8179
fi
 
8180
 
 
8181
if test "$MOZ_APP_COMPONENT_MODULES"; then
 
8182
  AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
 
8183
fi
 
8184
 
 
8185
dnl ========================================================
 
8186
dnl =
 
8187
dnl = Maintainer debug option (no --enable equivalent)
 
8188
dnl =
 
8189
dnl ========================================================
 
8190
 
 
8191
AC_SUBST(AR)
 
8192
AC_SUBST(AR_FLAGS)
 
8193
AC_SUBST(AR_LIST)
 
8194
AC_SUBST(AR_EXTRACT)
 
8195
AC_SUBST(AR_DELETE)
 
8196
AC_SUBST(AS)
 
8197
AC_SUBST(ASFLAGS)
 
8198
AC_SUBST(AS_DASH_C_FLAG)
 
8199
AC_SUBST(LD)
 
8200
AC_SUBST(RC)
 
8201
AC_SUBST(RCFLAGS)
 
8202
AC_SUBST(MC)
 
8203
AC_SUBST(WINDRES)
 
8204
AC_SUBST(IMPLIB)
 
8205
AC_SUBST(FILTER)
 
8206
AC_SUBST(BIN_FLAGS)
 
8207
AC_SUBST(MOZ_WIDGET_TOOLKIT)
 
8208
AC_SUBST(MOZ_UPDATE_XTERM)
 
8209
AC_SUBST(MOZ_PLATFORM_MAEMO)
 
8210
AC_SUBST(MOZ_AUTH_EXTENSION)
 
8211
AC_SUBST(MOZ_PERMISSIONS)
 
8212
AC_SUBST(MOZ_XTF)
 
8213
AC_SUBST(MOZ_PREF_EXTENSIONS)
 
8214
AC_SUBST(MOZ_JS_LIBS)
 
8215
AC_SUBST(MOZ_PSM)
 
8216
AC_SUBST(MOZ_DEBUG)
 
8217
AC_SUBST(MOZ_DEBUG_SYMBOLS)
 
8218
AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
 
8219
AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
 
8220
AC_SUBST(MOZ_DEBUG_FLAGS)
 
8221
AC_SUBST(MOZ_DEBUG_LDFLAGS)
 
8222
AC_SUBST(WARNINGS_AS_ERRORS)
 
8223
AC_SUBST(MOZ_EXTENSIONS)
 
8224
AC_SUBST(MOZ_JSDEBUGGER)
 
8225
AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
 
8226
AC_SUBST(MOZ_JPROF)
 
8227
AC_SUBST(MOZ_SHARK)
 
8228
AC_SUBST(MOZ_CALLGRIND)
 
8229
AC_SUBST(MOZ_VTUNE)
 
8230
AC_SUBST(MOZ_ETW)
 
8231
AC_SUBST(MOZ_PROFILING)
 
8232
AC_SUBST(LIBICONV)
 
8233
AC_SUBST(MOZ_PLACES)
 
8234
AC_SUBST(MOZ_TOOLKIT_SEARCH)
 
8235
AC_SUBST(MOZ_FEEDS)
 
8236
AC_SUBST(NS_PRINTING)
 
8237
AC_SUBST(MOZ_WEBGL)
 
8238
AC_SUBST(MOZ_HELP_VIEWER)
 
8239
AC_SUBST(TOOLCHAIN_PREFIX)
 
8240
 
 
8241
AC_SUBST(JAVA)
 
8242
AC_SUBST(JAVAC)
 
8243
AC_SUBST(JAR)
 
8244
 
 
8245
AC_SUBST(MOZ_PROFILELOCKING)
 
8246
 
 
8247
AC_SUBST(ENABLE_TESTS)
 
8248
AC_SUBST(ENABLE_MARIONETTE)
 
8249
AC_SUBST(IBMBIDI)
 
8250
AC_SUBST(MOZ_UNIVERSALCHARDET)
 
8251
AC_SUBST(ACCESSIBILITY)
 
8252
AC_SUBST(MOZ_SPELLCHECK)
 
8253
AC_SUBST(MOZ_JAVA_COMPOSITOR)
 
8254
AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
 
8255
AC_SUBST(MOZ_CRASHREPORTER)
 
8256
AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
 
8257
AC_SUBST(MOZ_MAINTENANCE_SERVICE)
 
8258
AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
 
8259
AC_SUBST(MOZ_ENABLE_SIGNMAR)
 
8260
AC_SUBST(MOZ_UPDATER)
 
8261
AC_SUBST(MOZ_ANGLE_RENDERER)
 
8262
AC_SUBST(MOZ_DIRECTX_SDK_PATH)
 
8263
AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
 
8264
AC_SUBST(MOZ_D3DX9_VERSION)
 
8265
AC_SUBST(MOZ_D3DX9_CAB)
 
8266
AC_SUBST(MOZ_D3DCOMPILER_CAB)
 
8267
AC_SUBST(MOZ_D3DX9_DLL)
 
8268
AC_SUBST(MOZ_D3DCOMPILER_DLL)
 
8269
AC_SUBST(MOZ_METRO)
 
8270
 
 
8271
AC_SUBST(MOZ_ANDROID_HISTORY)
 
8272
AC_SUBST(MOZ_WEBSMS_BACKEND)
 
8273
AC_SUBST(ENABLE_STRIP)
 
8274
AC_SUBST(PKG_SKIP_STRIP)
 
8275
AC_SUBST(STRIP_FLAGS)
 
8276
AC_SUBST(USE_ELF_DYNSTR_GC)
 
8277
AC_SUBST(USE_ELF_HACK)
 
8278
AC_SUBST(INCREMENTAL_LINKER)
 
8279
AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
 
8280
AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
 
8281
 
 
8282
AC_SUBST(MOZ_FIX_LINK_PATHS)
 
8283
AC_SUBST(XPCOM_LIBS)
 
8284
AC_SUBST(XPCOM_FROZEN_LDOPTS)
 
8285
AC_SUBST(XPCOM_GLUE_LDOPTS)
 
8286
AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
 
8287
AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
 
8288
AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
 
8289
 
 
8290
AC_SUBST(USE_DEPENDENT_LIBS)
 
8291
 
 
8292
AC_SUBST(MOZ_BUILD_ROOT)
 
8293
AC_SUBST(MOZ_OS2_TOOLS)
 
8294
 
 
8295
AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
 
8296
AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
 
8297
AC_SUBST(MOZ_LINKER_EXTRACT)
 
8298
AC_SUBST(MOZ_PER_WINDOW_PRIVATE_BROWSING)
 
8299
 
 
8300
dnl ========================================================
 
8301
dnl = Mac bundle name prefix
 
8302
dnl ========================================================
 
8303
MOZ_ARG_WITH_STRING(macbundlename-prefix,
 
8304
[  --with-macbundlename-prefix=prefix
 
8305
                          Prefix for MOZ_MACBUNDLE_NAME],
 
8306
[ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
 
8307
 
 
8308
MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
 
8309
if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
 
8310
  MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
 
8311
fi
 
8312
 
 
8313
if test "$MOZ_DEBUG"; then
 
8314
  MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
 
8315
else
 
8316
  MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
 
8317
fi
 
8318
AC_SUBST(MOZ_MACBUNDLE_NAME)
 
8319
 
 
8320
dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
 
8321
MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
 
8322
MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
 
8323
if test "$MOZ_DEBUG"; then
 
8324
  MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
 
8325
fi
 
8326
 
 
8327
AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
 
8328
AC_SUBST(MOZ_MACBUNDLE_ID)
 
8329
 
 
8330
# The following variables are available to branding and application
 
8331
# configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
 
8332
# - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
 
8333
# impacts profile location and user-visible fields.
 
8334
# - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
 
8335
# versions of a given application (e.g. Aurora and Firefox both use
 
8336
# "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
 
8337
# for application.ini's "Name" field, which controls profile location in
 
8338
# the absence of a "Profile" field (see below), and various system
 
8339
# integration hooks (Unix remoting, Windows MessageWindow name, etc.)
 
8340
# - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
 
8341
# Mac Bundle name, Updater, Installer), it is typically used for nightly
 
8342
# builds (e.g. Aurora for Firefox).
 
8343
# - MOZ_APP_VERSION: Defines the application version number.
 
8344
# - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
 
8345
# defaults to a lowercase form of MOZ_APP_BASENAME.
 
8346
# - MOZ_APP_PROFILE: When set, used for application.ini's
 
8347
# "Profile" field, which controls profile location.
 
8348
# - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
 
8349
# crash reporter server url.
 
8350
# - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
 
8351
# - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
 
8352
 
 
8353
if test -z "$MOZ_APP_NAME"; then
 
8354
   MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
 
8355
fi
 
8356
 
 
8357
# For extensions and langpacks, we require a max version that is compatible
 
8358
# across security releases. MOZ_APP_MAXVERSION is our method for doing that.
 
8359
# 10.0a1 and 10.0a2 aren't affected
 
8360
# 10.0 becomes 10.0.*
 
8361
# 10.0.1 becomes 10.0.*
 
8362
IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
 
8363
if test -z "$IS_ALPHA"; then
 
8364
  changequote(,)
 
8365
  MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
 
8366
  changequote([,])
 
8367
else
 
8368
  MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
 
8369
fi
 
8370
 
 
8371
AC_SUBST(MOZ_APP_NAME)
 
8372
AC_SUBST(MOZ_APP_DISPLAYNAME)
 
8373
AC_SUBST(MOZ_APP_BASENAME)
 
8374
AC_SUBST(MOZ_APP_VENDOR)
 
8375
AC_SUBST(MOZ_APP_PROFILE)
 
8376
AC_SUBST(MOZ_APP_ID)
 
8377
AC_SUBST(MAR_CHANNEL_ID)
 
8378
AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
 
8379
AC_SUBST(MOZ_PROFILE_MIGRATOR)
 
8380
AC_SUBST(MOZ_EXTENSION_MANAGER)
 
8381
AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
 
8382
AC_SUBST(MOZ_APP_UA_NAME)
 
8383
AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
 
8384
AC_SUBST(MOZ_APP_VERSION)
 
8385
AC_SUBST(MOZ_APP_MAXVERSION)
 
8386
AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
 
8387
AC_SUBST(FIREFOX_VERSION)
 
8388
AC_SUBST(MOZ_UA_OS_AGNOSTIC)
 
8389
if test -n "$MOZ_UA_OS_AGNOSTIC"; then
 
8390
  AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
 
8391
fi
 
8392
AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
 
8393
AC_SUBST(MOZ_UA_BUILDID)
 
8394
 
 
8395
# We can't use the static application.ini data when building against
 
8396
# a libxul SDK.
 
8397
if test -n "$LIBXUL_SDK"; then
 
8398
    MOZ_APP_STATIC_INI=
 
8399
fi
 
8400
AC_SUBST(MOZ_APP_STATIC_INI)
 
8401
 
 
8402
AC_SUBST(MOZ_PKG_SPECIAL)
 
8403
 
 
8404
AC_SUBST(MOZILLA_OFFICIAL)
 
8405
 
 
8406
if test "$MOZ_TELEMETRY_REPORTING"; then
 
8407
    AC_DEFINE(MOZ_TELEMETRY_REPORTING)
 
8408
fi
 
8409
 
 
8410
dnl win32 options
 
8411
AC_SUBST(MOZ_MAPINFO)
 
8412
AC_SUBST(MOZ_BROWSE_INFO)
 
8413
AC_SUBST(MOZ_TOOLS_DIR)
 
8414
AC_SUBST(WIN32_REDIST_DIR)
 
8415
AC_SUBST(MAKENSISU)
 
8416
 
 
8417
dnl Echo the CFLAGS to remove extra whitespace.
 
8418
CFLAGS=`echo \
 
8419
        $_WARNINGS_CFLAGS \
 
8420
        $CFLAGS`
 
8421
 
 
8422
CXXFLAGS=`echo \
 
8423
        $_WARNINGS_CXXFLAGS \
 
8424
        $CXXFLAGS`
 
8425
 
 
8426
COMPILE_CFLAGS=`echo \
 
8427
    $_DEFINES_CFLAGS \
 
8428
        $_DEPEND_CFLAGS \
 
8429
    $COMPILE_CFLAGS`
 
8430
 
 
8431
COMPILE_CXXFLAGS=`echo \
 
8432
    $_DEFINES_CXXFLAGS \
 
8433
        $_DEPEND_CFLAGS \
 
8434
    $COMPILE_CXXFLAGS`
 
8435
 
 
8436
AC_SUBST(MOZ_NATIVE_MAKEDEPEND)
 
8437
AC_SUBST(SYSTEM_LIBXUL)
 
8438
AC_SUBST(MOZ_NATIVE_JPEG)
 
8439
AC_SUBST(MOZ_NATIVE_PNG)
 
8440
AC_SUBST(MOZ_NATIVE_BZ2)
 
8441
 
 
8442
AC_SUBST(MOZ_FLEXBOX)
 
8443
AC_SUBST(MOZ_JPEG_CFLAGS)
 
8444
AC_SUBST(MOZ_JPEG_LIBS)
 
8445
AC_SUBST(MOZ_BZ2_CFLAGS)
 
8446
AC_SUBST(MOZ_BZ2_LIBS)
 
8447
AC_SUBST(MOZ_PNG_CFLAGS)
 
8448
AC_SUBST(MOZ_PNG_LIBS)
 
8449
 
 
8450
AC_SUBST(NSPR_CFLAGS)
 
8451
AC_SUBST(NSPR_LIBS)
 
8452
AC_SUBST(MOZ_NATIVE_NSPR)
 
8453
 
 
8454
AC_SUBST(NSS_CFLAGS)
 
8455
AC_SUBST(NSS_LIBS)
 
8456
AC_SUBST(NSS_DEP_LIBS)
 
8457
AC_SUBST(MOZ_NATIVE_NSS)
 
8458
AC_SUBST(NSS_DISABLE_DBM)
 
8459
 
 
8460
OS_CFLAGS="$CFLAGS"
 
8461
OS_CXXFLAGS="$CXXFLAGS"
 
8462
OS_CPPFLAGS="$CPPFLAGS"
 
8463
OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
 
8464
OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
 
8465
OS_LDFLAGS="$LDFLAGS"
 
8466
OS_LIBS="$LIBS"
 
8467
AC_SUBST(OS_CFLAGS)
 
8468
AC_SUBST(OS_CXXFLAGS)
 
8469
AC_SUBST(OS_CPPFLAGS)
 
8470
AC_SUBST(OS_COMPILE_CFLAGS)
 
8471
AC_SUBST(OS_COMPILE_CXXFLAGS)
 
8472
AC_SUBST(OS_LDFLAGS)
 
8473
AC_SUBST(OS_LIBS)
 
8474
AC_SUBST(CROSS_COMPILE)
 
8475
AC_SUBST(WCHAR_CFLAGS)
 
8476
 
 
8477
AC_SUBST(HOST_CC)
 
8478
AC_SUBST(HOST_CXX)
 
8479
AC_SUBST(HOST_CFLAGS)
 
8480
AC_SUBST(HOST_CXXFLAGS)
 
8481
AC_SUBST(HOST_LDFLAGS)
 
8482
AC_SUBST(HOST_OPTIMIZE_FLAGS)
 
8483
AC_SUBST(HOST_AR)
 
8484
AC_SUBST(HOST_AR_FLAGS)
 
8485
AC_SUBST(HOST_LD)
 
8486
AC_SUBST(HOST_RANLIB)
 
8487
AC_SUBST(HOST_NSPR_MDCPUCFG)
 
8488
AC_SUBST(HOST_BIN_SUFFIX)
 
8489
AC_SUBST(HOST_OS_ARCH)
 
8490
 
 
8491
AC_SUBST(TARGET_CPU)
 
8492
AC_SUBST(TARGET_VENDOR)
 
8493
AC_SUBST(TARGET_OS)
 
8494
AC_SUBST(TARGET_NSPR_MDCPUCFG)
 
8495
AC_SUBST(TARGET_MD_ARCH)
 
8496
AC_SUBST(TARGET_XPCOM_ABI)
 
8497
AC_SUBST(OS_TARGET)
 
8498
AC_SUBST(OS_ARCH)
 
8499
AC_SUBST(OS_RELEASE)
 
8500
AC_SUBST(OS_TEST)
 
8501
AC_SUBST(CPU_ARCH)
 
8502
AC_SUBST(INTEL_ARCHITECTURE)
 
8503
 
 
8504
AC_SUBST(MOZ_CHROME_FILE_FORMAT)
 
8505
 
 
8506
AC_SUBST(WRAP_LDFLAGS)
 
8507
AC_SUBST(MKSHLIB)
 
8508
AC_SUBST(MKCSHLIB)
 
8509
AC_SUBST(MKSHLIB_FORCE_ALL)
 
8510
AC_SUBST(MKSHLIB_UNFORCE_ALL)
 
8511
AC_SUBST(DSO_CFLAGS)
 
8512
AC_SUBST(DSO_PIC_CFLAGS)
 
8513
AC_SUBST(DSO_LDOPTS)
 
8514
AC_SUBST(LIB_PREFIX)
 
8515
AC_SUBST(DLL_PREFIX)
 
8516
AC_SUBST(DLL_SUFFIX)
 
8517
AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
 
8518
AC_SUBST(LIB_SUFFIX)
 
8519
AC_SUBST(OBJ_SUFFIX)
 
8520
AC_SUBST(BIN_SUFFIX)
 
8521
AC_SUBST(ASM_SUFFIX)
 
8522
AC_SUBST(IMPORT_LIB_SUFFIX)
 
8523
AC_SUBST(USE_N32)
 
8524
AC_SUBST(CC_VERSION)
 
8525
AC_SUBST(CXX_VERSION)
 
8526
AC_SUBST(MSMANIFEST_TOOL)
 
8527
AC_SUBST(NS_ENABLE_TSF)
 
8528
AC_SUBST(MOZ_NSS_PATCH)
 
8529
AC_SUBST(MOZ_APP_COMPONENT_LIBS)
 
8530
AC_SUBST(MOZ_APP_EXTRA_LIBS)
 
8531
 
 
8532
AC_SUBST(MOZ_MEDIA)
 
8533
AC_SUBST(MOZ_SYDNEYAUDIO)
 
8534
AC_SUBST(MOZ_SPEEX_RESAMPLER)
 
8535
AC_SUBST(MOZ_CUBEB)
 
8536
AC_SUBST(MOZ_WAVE)
 
8537
AC_SUBST(MOZ_VORBIS)
 
8538
AC_SUBST(MOZ_TREMOR)
 
8539
AC_SUBST(MOZ_OPUS)
 
8540
AC_SUBST(MOZ_WEBM)
 
8541
AC_SUBST(MOZ_MEDIA_PLUGINS)
 
8542
AC_SUBST(MOZ_OMX_PLUGIN)
 
8543
AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
 
8544
AC_SUBST(MOZ_VP8_ENCODER)
 
8545
AC_SUBST(MOZ_VP8)
 
8546
AC_SUBST(MOZ_OGG)
 
8547
AC_SUBST(MOZ_ALSA_LIBS)
 
8548
AC_SUBST(MOZ_ALSA_CFLAGS)
 
8549
AC_SUBST(VPX_AS)
 
8550
AC_SUBST(VPX_ASFLAGS)
 
8551
AC_SUBST(VPX_DASH_C_FLAG)
 
8552
AC_SUBST(VPX_AS_CONVERSION)
 
8553
AC_SUBST(VPX_ASM_SUFFIX)
 
8554
AC_SUBST(VPX_X86_ASM)
 
8555
AC_SUBST(VPX_ARM_ASM)
 
8556
AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
 
8557
AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
 
8558
AC_SUBST(LIBJPEG_TURBO_AS)
 
8559
AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
 
8560
AC_SUBST(LIBJPEG_TURBO_X86_ASM)
 
8561
AC_SUBST(LIBJPEG_TURBO_X64_ASM)
 
8562
AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
 
8563
 
 
8564
AC_SUBST(MOZ_PACKAGE_JSSHELL)
 
8565
 
 
8566
AC_MSG_CHECKING([for posix_fallocate])
 
8567
AC_TRY_LINK([#define _XOPEN_SOURCE 600
 
8568
  #include <fcntl.h>],
 
8569
                 [posix_fallocate(0, 0, 0);],
 
8570
                 [ac_cv___posix_fallocate=true],
 
8571
                 [ac_cv___posix_fallocate=false])
 
8572
 
 
8573
if test "$ac_cv___posix_fallocate" = true ; then
 
8574
  AC_DEFINE(HAVE_POSIX_FALLOCATE)
 
8575
  AC_MSG_RESULT(yes)
 
8576
else
 
8577
  AC_MSG_RESULT(no)
 
8578
fi
 
8579
 
 
8580
dnl Check for missing components
 
8581
if test "$COMPILE_ENVIRONMENT"; then
 
8582
if test "$MOZ_X11"; then
 
8583
    if test "$WITHOUT_X11"; then
 
8584
        AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
 
8585
    fi
 
8586
    dnl ====================================================
 
8587
    dnl = Check if X headers exist
 
8588
    dnl ====================================================
 
8589
    _SAVE_CFLAGS=$CFLAGS
 
8590
    CFLAGS="$CFLAGS $XCFLAGS"
 
8591
    AC_TRY_COMPILE([
 
8592
        #include <stdio.h>
 
8593
        #include <stdlib.h>
 
8594
        #include <X11/Xlib.h>
 
8595
        #include <X11/Intrinsic.h>
 
8596
        #include <X11/extensions/XShm.h>
 
8597
    ],
 
8598
    [
 
8599
        Display *dpy = 0;
 
8600
        if ((dpy = XOpenDisplay(NULL)) == NULL) {
 
8601
            fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
 
8602
            exit(1);
 
8603
        }
 
8604
    ], [],
 
8605
    [ AC_MSG_ERROR([Could not compile basic X program.]) ])
 
8606
    CFLAGS="$_SAVE_CFLAGS"
 
8607
 
 
8608
    if test -n "$MISSING_X"; then
 
8609
        AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
 
8610
    fi
 
8611
 
 
8612
fi # MOZ_X11
 
8613
 
 
8614
dnl Check for headers, etc. needed by WebGL.
 
8615
if test "$MOZ_GL_DEFAULT_PROVIDER" = "GLX"; then
 
8616
    MOZ_CHECK_HEADER(GL/glx.h)
 
8617
    if test "$ac_cv_header_GL_glx_h" != "yes"; then
 
8618
        AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa-devel (openSUSE))])
 
8619
    fi
 
8620
fi # MOZ_GL_DEFAULT_PROVIDER=GLX
 
8621
fi # COMPILE_ENVIRONMENT
 
8622
 
 
8623
dnl Set various defines and substitutions
 
8624
dnl ========================================================
 
8625
 
 
8626
if test "$OS_ARCH" = "Darwin"; then
 
8627
  AC_DEFINE(XP_UNIX)
 
8628
elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
 
8629
  AC_DEFINE(XP_UNIX)
 
8630
fi
 
8631
 
 
8632
if test "$MOZ_DEBUG"; then
 
8633
    AC_DEFINE(MOZ_REFLOW_PERF)
 
8634
    AC_DEFINE(MOZ_REFLOW_PERF_DSP)
 
8635
fi
 
8636
 
 
8637
if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
 
8638
    AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
 
8639
    ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
 
8640
    ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
 
8641
    ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
 
8642
    ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
 
8643
    AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
 
8644
    AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
 
8645
    AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
 
8646
fi
 
8647
 
 
8648
AC_SUBST(MOZILLA_VERSION)
 
8649
 
 
8650
AC_SUBST(ac_configure_args)
 
8651
 
 
8652
dnl Spit out some output
 
8653
dnl ========================================================
 
8654
 
 
8655
dnl The following defines are used by xpcom
 
8656
_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
 
8657
CPP_THROW_NEW
 
8658
HAVE_CPP_2BYTE_WCHAR_T
 
8659
HAVE_CPP_AMBIGUITY_RESOLVING_USING
 
8660
HAVE_CPP_CHAR16_T
 
8661
HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
 
8662
HAVE_CPP_PARTIAL_SPECIALIZATION
 
8663
HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
 
8664
HAVE_STATVFS
 
8665
HAVE_STATVFS64
 
8666
NEED_CPP_UNUSED_IMPLEMENTATIONS
 
8667
NEW_H
 
8668
HAVE_GETPAGESIZE
 
8669
HAVE_ICONV
 
8670
HAVE_ICONV_WITH_CONST_INPUT
 
8671
HAVE_MBRTOWC
 
8672
HAVE_SYS_MOUNT_H
 
8673
HAVE_SYS_VFS_H
 
8674
HAVE_WCRTOMB
 
8675
"
 
8676
 
 
8677
AC_CONFIG_HEADER(
 
8678
netwerk/necko-config.h
 
8679
xpcom/xpcom-config.h
 
8680
xpcom/xpcom-private.h
 
8681
)
 
8682
 
 
8683
# Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
 
8684
# "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
 
8685
# Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
 
8686
# the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
 
8687
# (apparently) only need this hack when egrep's "pattern" is particularly long
 
8688
# (as in the following code) and the first egrep on our $PATH is Apple's.  See
 
8689
# bug 655339.
 
8690
case "$host" in
 
8691
*-apple-darwin11*)
 
8692
    FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
 
8693
    ;;
 
8694
*)
 
8695
    FIXED_EGREP="egrep"
 
8696
    ;;
 
8697
esac
 
8698
 
 
8699
dnl Create a virtualenv where we can install local Python packages
 
8700
AC_MSG_RESULT([Creating Python virtualenv])
 
8701
rm -rf _virtualenv
 
8702
mkdir -p _virtualenv
 
8703
MACOSX_DEPLOYMENT_TARGET= PYTHONDONTWRITEBYTECODE= $PYTHON $_topsrcdir/python/virtualenv/virtualenv.py --system-site-packages ./_virtualenv
 
8704
case "$host_os" in
 
8705
mingw*)
 
8706
    PYTHON=$MOZ_BUILD_ROOT/_virtualenv/Scripts/python.exe
 
8707
    ;;
 
8708
*)
 
8709
    PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python
 
8710
    ;;
 
8711
esac
 
8712
 
 
8713
AC_SUBST(PYTHON)
 
8714
 
 
8715
# Populate the virtualenv
 
8716
AC_MSG_RESULT([Populating Python virtualenv])
 
8717
MACOSX_DEPLOYMENT_TARGET= LDFLAGS="${HOST_LDFLAGS}" \
 
8718
  CC="${HOST_CC}" CXX="${HOST_CXX}" \
 
8719
  CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" \
 
8720
  $PYTHON $_topsrcdir/build/virtualenv/populate_virtualenv.py \
 
8721
    $_topsrcdir $_topsrcdir/build/virtualenv/packages.txt \
 
8722
  || exit 1
 
8723
 
 
8724
dnl Load the list of Makefiles to generate.
 
8725
dnl   To add new Makefiles, edit allmakefiles.sh.
 
8726
dnl   allmakefiles.sh sets the variable, MAKEFILES.
 
8727
. ${srcdir}/allmakefiles.sh
 
8728
 
 
8729
echo $MAKEFILES > unallmakefiles
 
8730
 
 
8731
AC_OUTPUT($MAKEFILES)
 
8732
 
 
8733
# Generate Makefiles for WebRTC directly from .gyp files
 
8734
if test "${OS_TARGET}" = "WINNT"; then
 
8735
   if test "$HAVE_64BIT_OS"; then
 
8736
      OS_BITS=64
 
8737
   else
 
8738
      OS_BITS=32
 
8739
   fi
 
8740
   EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
 
8741
fi
 
8742
 
 
8743
if test -n "$MOZ_WEBRTC"; then
 
8744
   AC_MSG_RESULT("generating WebRTC Makefiles...")
 
8745
 
 
8746
   GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
 
8747
 
 
8748
   $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
 
8749
     $GYP_WEBRTC_OPTIONS \
 
8750
     --generator-output=${_objdir}/media/webrtc/trunk \
 
8751
     ${srcdir}/media/webrtc/trunk/peerconnection.gyp
 
8752
   if test "$?" != 0; then
 
8753
      AC_MSG_ERROR([failed to generate WebRTC Makefiles])
 
8754
   fi
 
8755
 
 
8756
   # XXX disable until we land the tranche with signaling
 
8757
   if test -n "$MOZ_WEBRTC_SIGNALING"; then
 
8758
     AC_MSG_RESULT("generating WebRTC/Signaling Makefiles...")
 
8759
     $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
 
8760
       $GYP_WEBRTC_OPTIONS \
 
8761
       --generator-output=${_objdir}/media/webrtc/signaling \
 
8762
       ${srcdir}/media/webrtc/signaling/signaling.gyp
 
8763
     if test "$?" != 0; then
 
8764
        AC_MSG_ERROR([failed to generate WebRTC/Signaling Makefiles])
 
8765
     fi
 
8766
   fi
 
8767
 
 
8768
   AC_MSG_RESULT("generating gtest Makefiles...")
 
8769
   # Ok to pass some extra -D's that are ignored here
 
8770
   $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
 
8771
     $GYP_WEBRTC_OPTIONS \
 
8772
     --generator-output=${_objdir}/media/webrtc/trunk/testing/ \
 
8773
     ${srcdir}/media/webrtc/trunk/testing/gtest.gyp
 
8774
   if test "$?" != 0; then
 
8775
      AC_MSG_ERROR([failed to generate gtest Makefiles])
 
8776
   fi
 
8777
fi
 
8778
 
 
8779
# Generate a JSON config file for unittest harnesses etc to read
 
8780
# build configuration details from in a standardized way.
 
8781
OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
 
8782
MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
 
8783
  $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
 
8784
if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
 
8785
  rm ./mozinfo.json.tmp
 
8786
else
 
8787
  mv -f ./mozinfo.json.tmp ./mozinfo.json
 
8788
fi
 
8789
 
 
8790
# Run jemalloc configure script
 
8791
 
 
8792
if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
 
8793
  ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
 
8794
  if test "$OS_ARCH" = "Linux"; then
 
8795
    MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
 
8796
    MANGLED=
 
8797
    JEMALLOC_WRAPPER=
 
8798
    if test -n "$_WRAP_MALLOC"; then
 
8799
      JEMALLOC_WRAPPER=__wrap_
 
8800
    fi
 
8801
    for mangle in ${MANGLE}; do
 
8802
      if test -n "$MANGLED"; then
 
8803
        MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
 
8804
      else
 
8805
        MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
 
8806
      fi
 
8807
    done
 
8808
    ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
 
8809
  fi
 
8810
  unset CONFIG_FILES
 
8811
  if test -z "$MOZ_TLS"; then
 
8812
    ac_configure_args="$ac_configure_args --disable-tls"
 
8813
  fi
 
8814
  EXTRA_CFLAGS="$CFLAGS"
 
8815
  for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
 
8816
    ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
 
8817
  done
 
8818
  if test "$CROSS_COMPILE"; then
 
8819
    ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
 
8820
  fi
 
8821
  _save_cache_file="$cache_file"
 
8822
  cache_file=$_objdir/memory/jemalloc/src/config.cache
 
8823
  AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
 
8824
  cache_file="$_save_cache_file"
 
8825
  ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
8826
fi
 
8827
 
 
8828
dnl Build libunwind for Android profiling builds
 
8829
if test "$OS_TARGET" = "Android" -a "$MOZ_PROFILING"; then
 
8830
  old_ac_configure_arg="$ac_configure_args"
 
8831
  ac_configure_args="--build=${build} --host=${target_alias} --disable-shared --enable-block-signals=no"
 
8832
  if test "$MOZ_DEBUG"; then
 
8833
    ac_configure_args="$ac_configure_args --enable-debug"
 
8834
  fi
 
8835
  if test "$DSO_PIC_CFLAGS"; then
 
8836
    ac_configure_args="$ac_configure_args --with-pic"
 
8837
  fi
 
8838
  ac_configure_args="$ac_configure_args \
 
8839
      CC=\"$CC\" \
 
8840
      CXX=\"$CXX\" \
 
8841
      CPP=\"$CPP\" \
 
8842
      CFLAGS=\"$CFLAGS\" \
 
8843
      CXXFLAGS=\"$CXXFLAGS\" \
 
8844
      CPPFLAGS=\"$CPPFLAGS\" \
 
8845
      LD=\"$LD\" \
 
8846
      LDFLAGS=\"$LDFLAGS\" \
 
8847
      AR=\"$AR\" \
 
8848
      RANLIB=\"$RANLIB\" \
 
8849
      STRIP=\"$STRIP\" \
 
8850
      LIBS=\"$LIBS\""
 
8851
 
 
8852
  # Use a separate cache file for libunwind, since it does not use caching.
 
8853
  mkdir -p $_objdir/tools/profiler/libunwind/src
 
8854
  old_cache_file=$cache_file
 
8855
  cache_file=$_objdir/tools/profiler/libunwind/src/config.cache
 
8856
  old_config_files=$CONFIG_FILES
 
8857
  unset CONFIG_FILES
 
8858
  AC_OUTPUT_SUBDIRS(tools/profiler/libunwind/src)
 
8859
  cache_file=$old_cache_file
 
8860
  ac_configure_args="$old_ac_configure_args"
 
8861
  CONFIG_FILES=$old_config_files
 
8862
fi
 
8863
 
 
8864
# Run freetype configure script
 
8865
 
 
8866
if test "$MOZ_TREE_FREETYPE"; then
 
8867
   export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
 
8868
   export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
 
8869
   export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
 
8870
   export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
 
8871
   export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
 
8872
   ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
 
8873
   AC_OUTPUT_SUBDIRS(modules/freetype2)
 
8874
fi
 
8875
 
 
8876
if test -z "$direct_nspr_config"; then
 
8877
    dnl ========================================================
 
8878
    dnl = Setup a nice relatively clean build environment for
 
8879
    dnl = sub-configures.
 
8880
    dnl ========================================================
 
8881
    CC="$_SUBDIR_CC"
 
8882
    CXX="$_SUBDIR_CXX"
 
8883
    CFLAGS="$_SUBDIR_CFLAGS"
 
8884
    CPPFLAGS="$_SUBDIR_CPPFLAGS"
 
8885
    CXXFLAGS="$_SUBDIR_CXXFLAGS"
 
8886
    LDFLAGS="$_SUBDIR_LDFLAGS"
 
8887
    HOST_CC="$_SUBDIR_HOST_CC"
 
8888
    HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
 
8889
    HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
 
8890
    RC=
 
8891
fi
 
8892
 
 
8893
unset MAKEFILES
 
8894
unset CONFIG_FILES
 
8895
 
 
8896
# No need to run subconfigures when building with LIBXUL_SDK_DIR
 
8897
if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
 
8898
 
 
8899
export WRAP_LDFLAGS
 
8900
 
 
8901
if test -n "$_WRAP_MALLOC"; then
 
8902
    # Avoid doubling wrap malloc arguments
 
8903
    _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
 
8904
fi
 
8905
 
 
8906
if test -z "$MOZ_NATIVE_NSPR"; then
 
8907
    ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
 
8908
    if test -z "$MOZ_DEBUG"; then
 
8909
        ac_configure_args="$ac_configure_args --disable-debug"
 
8910
    else
 
8911
        ac_configure_args="$ac_configure_args --enable-debug"
 
8912
    fi
 
8913
    if test "$MOZ_OPTIMIZE" = "1"; then
 
8914
        ac_configure_args="$ac_configure_args --enable-optimize"
 
8915
    elif test -z "$MOZ_OPTIMIZE"; then
 
8916
        ac_configure_args="$ac_configure_args --disable-optimize"
 
8917
    fi
 
8918
    if test -n "$HAVE_64BIT_OS"; then
 
8919
        ac_configure_args="$ac_configure_args --enable-64bit"
 
8920
    fi
 
8921
    if test -n "$USE_ARM_KUSER"; then
 
8922
        ac_configure_args="$ac_configure_args --with-arm-kuser"
 
8923
    fi
 
8924
    ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
 
8925
    if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
 
8926
      # dladdr is supported by the new linker, even when the system linker doesn't
 
8927
      # support it. Trick nspr into using dladdr when it's not supported.
 
8928
      _SAVE_CPPFLAGS="$CPPFLAGS"
 
8929
      export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
 
8930
    fi
 
8931
    _SAVE_LDFLAGS="$LDFLAGS"
 
8932
    export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
 
8933
    AC_OUTPUT_SUBDIRS(nsprpub)
 
8934
    LDFLAGS="$_SAVE_LDFLAGS"
 
8935
    if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
 
8936
      unset CPPFLAGS
 
8937
      CPPFLAGS="$_SAVE_CFLAGS"
 
8938
    fi
 
8939
    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
8940
fi
 
8941
 
 
8942
dnl ========================================================
 
8943
dnl = Setup a nice relatively clean build environment for
 
8944
dnl = sub-configures.
 
8945
dnl ========================================================
 
8946
CC="$_SUBDIR_CC"
 
8947
CXX="$_SUBDIR_CXX"
 
8948
CFLAGS="$_SUBDIR_CFLAGS"
 
8949
CPPFLAGS="$_SUBDIR_CPPFLAGS"
 
8950
CXXFLAGS="$_SUBDIR_CXXFLAGS"
 
8951
LDFLAGS="$_SUBDIR_LDFLAGS"
 
8952
HOST_CC="$_SUBDIR_HOST_CC"
 
8953
HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
 
8954
HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
 
8955
RC=
 
8956
 
 
8957
# Run the SpiderMonkey 'configure' script.
 
8958
dist=$MOZ_BUILD_ROOT/dist
 
8959
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
8960
ac_configure_args="$ac_configure_args --enable-threadsafe"
 
8961
if test "$BUILD_CTYPES"; then
 
8962
    # Build js-ctypes on the platforms we can.
 
8963
    ac_configure_args="$ac_configure_args --enable-ctypes"
 
8964
fi
 
8965
if test -z "$JS_SHARED_LIBRARY" ; then
 
8966
    ac_configure_args="$ac_configure_args --disable-shared-js"
 
8967
fi
 
8968
if test -z "$MOZ_NATIVE_NSPR"; then
 
8969
    ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
 
8970
    ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
 
8971
fi
 
8972
ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
 
8973
ac_configure_args="$ac_configure_args --prefix=$dist"
 
8974
if test "$MOZ_MEMORY"; then
 
8975
   ac_configure_args="$ac_configure_args --enable-jemalloc"
 
8976
fi
 
8977
if test -n "$MOZ_GLUE_LDFLAGS"; then
 
8978
   export MOZ_GLUE_LDFLAGS
 
8979
fi
 
8980
if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
 
8981
   export MOZ_GLUE_PROGRAM_LDFLAGS
 
8982
fi
 
8983
if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
 
8984
   MOZ_ZLIB_LIBS=
 
8985
fi
 
8986
export MOZ_NATIVE_ZLIB
 
8987
export MOZ_ZLIB_CFLAGS
 
8988
export MOZ_ZLIB_LIBS
 
8989
export MOZ_APP_NAME
 
8990
export STLPORT_CPPFLAGS
 
8991
export STLPORT_LDFLAGS
 
8992
export STLPORT_LIBS
 
8993
export JS_STANDALONE=no
 
8994
AC_OUTPUT_SUBDIRS(js/src)
 
8995
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 
8996
 
 
8997
fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR