~ubuntu-branches/ubuntu/oneiric/enigmail/oneiric-updates

« back to all changes in this revision

Viewing changes to configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2010-04-10 01:42:24 UTC
  • Revision ID: james.westby@ubuntu.com-20100410014224-fbq9ui5x3b0h2t36
Tags: 2:1.0.1-0ubuntu1
* First releaase of enigmail 1.0.1 for tbird/icedove 3
  (LP: #527138)
* redo packaging from scratch 
  + add debian/make-orig target that uses xulrunner provided
    buildsystem + enigmail tarball to produce a proper orig.tar.gz
  + use debhelper 7 with mozilla-devscripts
  + use debian source format 3.0 (quilt)
  + patch enigmail to use frozen API only
    - add debian/patches/frozen_api.diff
  + patch build system to not link against -lxul - which isnt
    available for sdks produced by all-static apps like tbird
    - add debian/patches/build_system_dont_link_libxul.diff
  + add minimal build-depends to control

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