~ubuntu-branches/ubuntu/saucy/nspr/saucy-updates

« back to all changes in this revision

Viewing changes to .pc/30_pkgconfig.patch/mozilla/nsprpub/configure.in

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-11-27 17:39:22 UTC
  • mfrom: (1.1.15) (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20121127173922-1zfbtwmy1vczqwxq
Tags: 2:4.9.3-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - rules: Enable Thumb2 build on armel, armhf.
  - control: Change Vcs-* to XS-Debian-Vcs-*.
  - control: Add conflicts to evolution-documentation-*,
    language-support-translation-*.
  - control: Add Breaks: evolution-plugins.

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 
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 the Netscape Portable Runtime (NSPR).
17
 
dnl
18
 
dnl The Initial Developer of the Original Code is
19
 
dnl Netscape Communications Corporation.
20
 
dnl Portions created by the Initial Developer are Copyright (C) 1998
21
 
dnl the Initial Developer. All Rights Reserved.
22
 
dnl
23
 
dnl Contributor(s):
24
 
dnl   Christopher Seawood <cls@seawood.org>
25
 
dnl   Howard Chu <hyc@symas.com>
26
 
dnl   Mark Mentovai <mark@moxienet.com>
27
 
dnl
28
 
dnl Alternatively, the contents of this file may be used under the terms of
29
 
dnl either the GNU General Public License Version 2 or later (the "GPL"), or
30
 
dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31
 
dnl in which case the provisions of the GPL or the LGPL are applicable instead
32
 
dnl of those above. If you wish to allow use of your version of this file only
33
 
dnl under the terms of either the GPL or the LGPL, and not to allow others to
34
 
dnl use your version of this file under the terms of the MPL, indicate your
35
 
dnl decision by deleting the provisions above and replace them with the notice
36
 
dnl and other provisions required by the GPL or the LGPL. If you do not delete
37
 
dnl the provisions above, a recipient may use your version of this file under
38
 
dnl the terms of any one of the MPL, the GPL or the LGPL.
39
 
dnl
40
 
dnl ***** END LICENSE BLOCK *****
41
 
 
42
 
AC_PREREQ(2.12)
43
 
AC_INIT(config/libc_r.h)
44
 
 
45
 
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
46
 
AC_CANONICAL_SYSTEM
47
 
 
48
 
dnl ========================================================
49
 
dnl = Defaults
50
 
dnl ========================================================
51
 
MOD_MAJOR_VERSION=4
52
 
MOD_MINOR_VERSION=8
53
 
MOD_PATCH_VERSION=9
54
 
NSPR_MODNAME=nspr20
55
 
_HAVE_PTHREADS=
56
 
USE_PTHREADS=
57
 
USE_USER_PTHREADS=
58
 
USE_NSPR_THREADS=
59
 
USE_N32=
60
 
USE_64=
61
 
USE_CPLUS=
62
 
USE_IPV6=
63
 
USE_MDUPDATE=
64
 
_MACOSX_DEPLOYMENT_TARGET=
65
 
_OPTIMIZE_FLAGS=-O
66
 
_DEBUG_FLAGS=-g
67
 
MOZ_DEBUG=1
68
 
MOZ_OPTIMIZE=
69
 
OBJDIR='$(OBJDIR_NAME)'
70
 
OBJDIR_NAME=.
71
 
OBJDIR_SUFFIX=OBJ
72
 
NSINSTALL='$(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall'
73
 
NOSUCHFILE=/no-such-file
74
 
LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)'
75
 
LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)'
76
 
CYGWIN_WRAPPER=
77
 
MACOS_SDK_DIR=
78
 
NEXT_ROOT=
79
 
MT=
80
 
MOZ_OS2_HIGH_MEMORY=1
81
 
PROFILE_GEN_CFLAGS=
82
 
PROFILE_GEN_LDFLAGS=
83
 
PROFILE_USE_CFLAGS=
84
 
PROFILE_USE_LDFLAGS=
85
 
 
86
 
dnl Link in libraries necessary to resolve all symbols for shared libs
87
 
RESOLVE_LINK_SYMBOLS=
88
 
 
89
 
dnl ========================================================
90
 
dnl =
91
 
dnl = Dont change the following lines.  Doing so breaks:
92
 
dnl =
93
 
dnl = CFLAGS="-foo" ./configure
94
 
dnl =
95
 
dnl ========================================================
96
 
CFLAGS="${CFLAGS=}"
97
 
CXXFLAGS="${CXXFLAGS=}"
98
 
LDFLAGS="${LDFLAGS=}"
99
 
DLLFLAGS="${DLLFLAGS=}"
100
 
HOST_CFLAGS="${HOST_CFLAGS=}"
101
 
HOST_LDFLAGS="${HOST_LDFLAGS=}"
102
 
 
103
 
case "$target" in
104
 
*-cygwin*|*-mingw*)
105
 
    # Check to see if we are really running in a msvc environemnt
106
 
    _WIN32_MSVC=
107
 
    AC_CHECK_PROGS(CC, cl)
108
 
    if test "$CC" = "cl"; then
109
 
        echo 'main() { return 0; }' > dummy.c
110
 
        ${CC} -o dummy dummy.c >/dev/null 2>&1
111
 
        if test $? = 0; then
112
 
            _WIN32_MSVC=1
113
 
            CXX=$CC
114
 
        else
115
 
            AC_MSG_WARN([$(CC) test failed.  Using normal feature tests])
116
 
        fi
117
 
        rm -f dummy dummy.o dummy.obj dummy.exe dummy.c
118
 
    fi
119
 
    ;;
120
 
*-msvc*)
121
 
    _WIN32_MSVC=1
122
 
    ;;
123
 
*-mks*)
124
 
    _WIN32_MSVC=1
125
 
    ;;
126
 
esac
127
 
 
128
 
if test -n "$_WIN32_MSVC"; then
129
 
    SKIP_PATH_CHECKS=1
130
 
    SKIP_COMPILER_CHECKS=1
131
 
    SKIP_LIBRARY_CHECKS=1
132
 
fi
133
 
 
134
 
dnl ========================================================
135
 
dnl = Android uses a very custom (hacky) toolchain; we need to do this
136
 
dnl = here, so that the compiler checks can succeed
137
 
dnl ========================================================
138
 
 
139
 
AC_ARG_WITH(android-ndk,
140
 
[  --with-android-ndk=DIR
141
 
                      location where the Android NDK can be found],
142
 
    android_ndk=$withval)
143
 
 
144
 
AC_ARG_WITH(android-toolchain,
145
 
[  --with-android-toolchain=DIR
146
 
                            location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
147
 
    android_toolchain=$withval)
148
 
 
149
 
AC_ARG_WITH(android-platform,
150
 
[  --with-android-platform=DIR
151
 
                           location of platform dir, default NDK/build/platforms/android-5/arch-arm],
152
 
    android_platform=$withval)
153
 
 
154
 
case "$target" in
155
 
arm-linux*-android*|*-linuxandroid*)
156
 
    android_tool_prefix="arm-linux-androideabi"
157
 
    ;;
158
 
arm-android-eabi)
159
 
    android_tool_prefix="arm-eabi"
160
 
    ;;
161
 
*)
162
 
    android_tool_prefix="$target_os"
163
 
    ;;
164
 
esac
165
 
 
166
 
case "$target" in
167
 
*-android*|*-linuxandroid*)
168
 
    if test -z "$android_ndk" ; then
169
 
       AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
170
 
    fi
171
 
 
172
 
    if test -z "$android_toolchain" ; then
173
 
       android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
174
 
    fi
175
 
 
176
 
    if test -z "$android_platform" ; then
177
 
       android_platform="$android_ndk"/build/platforms/android-5/arch-arm
178
 
    fi
179
 
 
180
 
    dnl set up compilers
181
 
    AS="$android_toolchain"/bin/"$android_tool_prefix"-as
182
 
    CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
183
 
    CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
184
 
    CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
185
 
    LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
186
 
    AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
187
 
    RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
188
 
    STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
189
 
 
190
 
    CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
191
 
    CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS"
192
 
    CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions $CXXFLAGS"
193
 
    LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS"
194
 
 
195
 
    dnl prevent cross compile section from using these flags as host flags
196
 
    if test -z "$HOST_CPPFLAGS" ; then
197
 
        HOST_CPPFLAGS=" "
198
 
    fi
199
 
    if test -z "$HOST_CFLAGS" ; then
200
 
        HOST_CFLAGS=" "
201
 
    fi
202
 
    if test -z "$HOST_CXXFLAGS" ; then
203
 
        HOST_CXXFLAGS=" "
204
 
    fi
205
 
    if test -z "$HOST_LDFLAGS" ; then
206
 
        HOST_LDFLAGS=" "
207
 
    fi
208
 
 
209
 
    WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
210
 
 
211
 
    AC_DEFINE(ANDROID)
212
 
    ;;
213
 
esac
214
 
 
215
 
dnl ========================================================
216
 
dnl =
217
 
dnl = Check options that may affect the compiler
218
 
dnl =
219
 
dnl ========================================================
220
 
dist_prefix='${MOD_DEPTH}/dist'
221
 
dist_bindir='${dist_prefix}/bin'
222
 
dist_includedir='${dist_prefix}/include/nspr'
223
 
dist_libdir='${dist_prefix}/lib'
224
 
dnl If the --includedir option was not specified, add '/nspr' to autoconf's
225
 
dnl default value of includedir.
226
 
if test "${includedir}" = '${prefix}/include'; then
227
 
    includedir='${prefix}/include/nspr'
228
 
fi
229
 
 
230
 
AC_ARG_WITH(dist-prefix,
231
 
    [  --with-dist-prefix=DIST_PREFIX
232
 
                          place build files in DIST_PREFIX [dist]],
233
 
    dist_prefix=$withval)
234
 
 
235
 
AC_ARG_WITH(dist-bindir,
236
 
    [  --with-dist-bindir=DIR  build execuatables in DIR [DIST_PREFIX/bin]],
237
 
    dist_bindir=$withval)
238
 
 
239
 
AC_ARG_WITH(dist-includedir,
240
 
    [  --with-dist-includedir=DIR
241
 
                          build include files in DIR [DIST_PREFIX/include/nspr]],
242
 
    dist_includedir=$withval)
243
 
 
244
 
AC_ARG_WITH(dist-libdir,
245
 
    [  --with-dist-libdir=DIR  build library files in DIR [DIST_PREFIX/lib]],
246
 
    dist_libdir=$withval)
247
 
 
248
 
AC_SUBST(dist_prefix)
249
 
AC_SUBST(dist_bindir)
250
 
AC_SUBST(dist_includedir)
251
 
AC_SUBST(dist_libdir)
252
 
 
253
 
dnl Check if NSPR is being compiled for Mozilla
254
 
dnl Let --with-arg override environment setting
255
 
dnl
256
 
AC_ARG_WITH(mozilla,
257
 
    [  --with-mozilla          Compile NSPR with Mozilla support],
258
 
    [   if test "$withval" = "yes"; then
259
 
            AC_DEFINE(MOZILLA_CLIENT)
260
 
            MOZILLA_CLIENT=1
261
 
            else
262
 
                MOZILLA_CLIENT=
263
 
            fi],
264
 
    [   if test -n "$MOZILLA_CLIENT"; then
265
 
                AC_DEFINE(MOZILLA_CLIENT)
266
 
            fi])
267
 
 
268
 
AC_ARG_ENABLE(optimize,
269
 
    [  --enable-optimize[=OPT] Enable code optimizations (ie. -O2) ],
270
 
    [ if test "$enableval" != "no"; then
271
 
          MOZ_OPTIMIZE=1
272
 
          if test -n "$enableval" -a "$enableval" != "yes"; then
273
 
            _OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
274
 
            _SAVE_OPTIMIZE_FLAGS=$_OPTIMIZE_FLAGS
275
 
          fi
276
 
      else
277
 
          MOZ_OPTIMIZE=
278
 
      fi ])
279
 
 
280
 
AC_ARG_ENABLE(debug,
281
 
    [  --enable-debug[=DBG]    Enable debugging (using compiler flags DBG)],
282
 
    [ if test "$enableval" != "no"; then
283
 
          MOZ_DEBUG=1
284
 
          MOZ_DEBUG_SYMBOLS=1
285
 
          if test -n "$enableval" -a "$enableval" != "yes"; then
286
 
              _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
287
 
              _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS
288
 
          fi
289
 
      else
290
 
          MOZ_DEBUG=
291
 
      fi ],
292
 
      MOZ_DEBUG_SYMBOLS=1)
293
 
 
294
 
AC_ARG_ENABLE(debug-symbols,
295
 
    [  --enable-debug-symbols[=DBG]    Enable debugging symbols
296
 
                                       (using compiler flags DBG)],
297
 
    [ if test "$enableval" != "no"; then
298
 
          MOZ_DEBUG_SYMBOLS=1
299
 
          if test -n "$enableval" -a "$enableval" != "yes"; then
300
 
              if test -z "$_SAVE_DEBUG_FLAGS"; then
301
 
                  _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
302
 
                  _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS
303
 
              else
304
 
                  AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
305
 
              fi
306
 
          fi
307
 
      else
308
 
          MOZ_DEBUG_SYMBOLS=
309
 
      fi ])
310
 
 
311
 
AC_ARG_ENABLE(win32-target,
312
 
    [  --enable-win32-target=\$t
313
 
                          Specify win32 flavor. (WIN95 or WINNT)],
314
 
    OS_TARGET=`echo $enableval | tr a-z A-Z`)
315
 
 
316
 
AC_ARG_ENABLE(symbian-target,
317
 
    [  --enable-symbian-target=\$t
318
 
                          Specify symbian flavor. (WINSCW or GCCE)],
319
 
    OS_TARGET=`echo $enableval | tr a-z A-Z`)
320
 
 
321
 
AC_ARG_ENABLE(debug-rtl,
322
 
    [  --enable-debug-rtl      Use the MSVC debug runtime library],
323
 
    [ if test "$enableval" = "yes"; then
324
 
            USE_DEBUG_RTL=1
325
 
      fi ])
326
 
 
327
 
AC_ARG_ENABLE(n32,
328
 
    [  --enable-n32            Enable n32 ABI support (IRIX only)],
329
 
    [ if test "$enableval" = "yes"; then
330
 
        USE_N32=1
331
 
      else if test "$enableval" = "no"; then
332
 
        USE_N32=
333
 
      fi
334
 
    fi ])
335
 
 
336
 
AC_ARG_ENABLE(64bit,
337
 
    [  --enable-64bit          Enable 64-bit support (on certain platforms)],
338
 
    [ if test "$enableval" = "yes"; then
339
 
            USE_64=1
340
 
      fi ])
341
 
 
342
 
AC_ARG_ENABLE(mdupdate,
343
 
    [  --enable-mdupdate       Enable use of certain compilers' mdupdate feature],
344
 
    [ if test "$enableval" = "yes"; then
345
 
            USE_MDUPDATE=1
346
 
      fi ])
347
 
 
348
 
AC_ARG_ENABLE(cplus,
349
 
    [  --enable-cplus          Enable some c++ api routines],
350
 
    [ if test "$enableval" = "yes"; then
351
 
            USE_CPLUS=1
352
 
      fi]) 
353
 
 
354
 
AC_ARG_WITH(arm-kuser,
355
 
    [  --with-arm-kuser        Use kuser helpers (Linux/ARM only)
356
 
                          (Requires kernel 2.6.13 or later)],
357
 
    [ if test "$withval" = "yes"; then
358
 
            AC_DEFINE(_PR_ARM_KUSER)
359
 
      fi ])
360
 
 
361
 
dnl ========================================================
362
 
dnl = Mac OS X SDK support
363
 
dnl ========================================================
364
 
AC_ARG_WITH(macos-sdk,
365
 
    [  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
366
 
    MACOS_SDK_DIR=$withval)
367
 
 
368
 
AC_ARG_ENABLE(macos-target,
369
 
             [  --enable-macos-target=VER
370
 
                          Set the minimum MacOS version needed at runtime
371
 
                          [10.2 for ppc, 10.4 for x86]],
372
 
             [_MACOSX_DEPLOYMENT_TARGET=$enableval])
373
 
 
374
 
dnl ========================================================
375
 
dnl =
376
 
dnl = Set the threading model
377
 
dnl =
378
 
dnl ========================================================
379
 
case "$target" in
380
 
 
381
 
*-aix*)
382
 
    case "${target_os}" in
383
 
    aix3.2*)
384
 
        USE_NSPR_THREADS=1
385
 
        ;;
386
 
    *)
387
 
        USE_PTHREADS=1
388
 
        ;;
389
 
    esac
390
 
    ;;
391
 
 
392
 
esac
393
 
 
394
 
dnl ========================================================
395
 
dnl =
396
 
dnl = Set the default C compiler
397
 
dnl =
398
 
dnl ========================================================
399
 
if test -z "$CC"; then
400
 
    case "$target" in
401
 
 
402
 
    *-aix*)
403
 
        if test -z "$USE_NSPR_THREADS"; then
404
 
            CC=xlc_r
405
 
        else
406
 
            CC=xlc
407
 
        fi
408
 
    ;;
409
 
 
410
 
    *-hpux*)
411
 
        CC=cc
412
 
    ;;
413
 
 
414
 
    *-irix*)
415
 
        CC=cc
416
 
    ;;
417
 
 
418
 
    *-osf*)
419
 
        CC=cc
420
 
    ;;
421
 
 
422
 
    *-solaris*)
423
 
        CC=cc
424
 
    ;;
425
 
 
426
 
    esac
427
 
fi
428
 
 
429
 
dnl ========================================================
430
 
dnl =
431
 
dnl = Set the default C++ compiler
432
 
dnl =
433
 
dnl ========================================================
434
 
if test -z "$CXX"; then
435
 
    case "$target" in
436
 
 
437
 
    *-aix*)
438
 
        if test -z "$USE_NSPR_THREADS"; then
439
 
            CXX=xlC_r
440
 
        else
441
 
            CXX=xlC
442
 
        fi
443
 
    ;;
444
 
 
445
 
    *-hpux*)
446
 
        case "${target_os}" in
447
 
        hpux10.30)
448
 
            CXX=aCC
449
 
            ;;
450
 
        hpux11.*)
451
 
            CXX=aCC
452
 
            ;;
453
 
        *)
454
 
            CXX=CC
455
 
            ;;
456
 
        esac
457
 
    ;;
458
 
 
459
 
    *-irix*)
460
 
        CXX=CC
461
 
    ;;
462
 
 
463
 
    *-osf*)
464
 
        CXX=cxx
465
 
    ;;
466
 
 
467
 
    *-solaris*)
468
 
        CXX=CC
469
 
    ;;
470
 
 
471
 
    esac
472
 
fi
473
 
 
474
 
if test -z "$SKIP_PATH_CHECKS"; then
475
 
    AC_PATH_PROG(WHOAMI, $WHOAMI whoami, echo not_whoami)
476
 
fi
477
 
 
478
 
if test -n "$MOZ_DEBUG"; then
479
 
    AC_DEFINE(DEBUG)
480
 
    DEFINES="$DEFINES -UNDEBUG"
481
 
 
482
 
    case "${target_os}" in
483
 
    beos*)
484
 
        DEFINES="$DEFINES -DDEBUG_${USER}"
485
 
        ;;
486
 
    msvc*|mks*|cygwin*|mingw*|wince*|winmo*|os2*)
487
 
        DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
488
 
        ;;
489
 
    *) 
490
 
        DEFINES="$DEFINES -DDEBUG_`$WHOAMI`"
491
 
        ;;
492
 
    esac
493
 
else
494
 
    AC_DEFINE(NDEBUG)
495
 
    DEFINES="$DEFINES -UDEBUG"
496
 
fi
497
 
 
498
 
if test -z "$SKIP_COMPILER_CHECKS"; then
499
 
dnl ========================================================
500
 
dnl Checks for compilers.
501
 
dnl ========================================================
502
 
if test "$target" != "$host"; then
503
 
    echo "cross compiling from $host to $target"
504
 
    cross_compiling=yes
505
 
 
506
 
    _SAVE_CC="$CC"
507
 
    _SAVE_CFLAGS="$CFLAGS"
508
 
    _SAVE_LDFLAGS="$LDFLAGS"
509
 
 
510
 
    AC_MSG_CHECKING([for $host compiler])
511
 
    AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc, "")
512
 
    if test -z "$HOST_CC"; then
513
 
        AC_MSG_ERROR([no acceptable cc found in \$PATH])
514
 
    fi
515
 
    AC_MSG_RESULT([$HOST_CC])
516
 
    if test -z "$HOST_CFLAGS"; then
517
 
        HOST_CFLAGS="$CFLAGS"
518
 
    fi
519
 
    if test -z "$HOST_LDFLAGS"; then
520
 
        HOST_LDFLAGS="$LDFLAGS"
521
 
    fi
522
 
 
523
 
    CC="$HOST_CC"
524
 
    CFLAGS="$HOST_CFLAGS"
525
 
    LDFLAGS="$HOST_LDFLAGS"
526
 
 
527
 
    AC_MSG_CHECKING([whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
528
 
    AC_TRY_COMPILE([], [return(0);], 
529
 
        [ac_cv_prog_host_cc_works=1 AC_MSG_RESULT([yes])],
530
 
        AC_MSG_ERROR([installation or configuration problem: $host compiler $HOST_CC cannot create executables.]) )
531
 
 
532
 
    CC=$_SAVE_CC
533
 
    CFLAGS=$_SAVE_CFLAGS
534
 
    LDFLAGS=$_SAVE_LDFLAGS
535
 
 
536
 
    case "$build:$target" in 
537
 
      powerpc-apple-darwin8*:i?86-apple-darwin*)
538
 
        dnl The Darwin cross compiler doesn't necessarily point itself at a
539
 
        dnl root that has libraries for the proper architecture, it defaults
540
 
        dnl to the system root.  The libraries in the system root on current
541
 
        dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
542
 
        dnl checks will fail.  Fake a working SDK in that case.
543
 
        _SAVE_CFLAGS=$CFLAGS 
544
 
        _SAVE_CXXFLAGS=$CXXLAGS
545
 
        CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
546
 
        CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
547
 
        ;;        
548
 
    esac            
549
 
 
550
 
    AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo)
551
 
    unset ac_cv_prog_CC
552
 
    AC_PROG_CC
553
 
    if test -n "$USE_CPLUS"; then
554
 
        AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", echo)
555
 
        unset ac_cv_prog_CXX
556
 
        AC_PROG_CXX
557
 
    fi
558
 
 
559
 
    case "$build:$target" in
560
 
      powerpc-apple-darwin8*:i?86-apple-darwin*)
561
 
        dnl Revert the changes made above.  From this point on, the target
562
 
        dnl compiler will never be used without applying the SDK to CFLAGS
563
 
        dnl (see --with-macos-sdk below).
564
 
        CFLAGS=$_SAVE_CFLAGS
565
 
        CXXFLAGS=$_SAVE_CXXFLAGS
566
 
        ;;
567
 
    esac
568
 
 
569
 
    AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", echo)
570
 
    AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", echo)
571
 
    AC_CHECK_PROGS(AS, $AS "${target_alias}-as" "${target}-as", echo)
572
 
    AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", echo)
573
 
    AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", echo)
574
 
    AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", echo)
575
 
 
576
 
else
577
 
    AC_PROG_CC
578
 
    if test -n "$USE_CPLUS"; then
579
 
        if test "$CC" = "cl" -a -z "$CXX"; then
580
 
            CXX=$CC
581
 
        else        
582
 
            AC_PROG_CXX
583
 
        fi
584
 
    fi
585
 
    AC_PROG_CPP
586
 
    AC_PROG_RANLIB
587
 
    AC_PATH_PROGS(AS, as, $CC)
588
 
    AC_PATH_PROGS(AR, ar, echo not_ar)
589
 
    AC_PATH_PROGS(LD, ld link, echo not_ld)
590
 
    AC_PATH_PROGS(STRIP, strip, echo not_strip)
591
 
    AC_PATH_PROGS(WINDRES, windres, echo not_windres)
592
 
    if test -z "$HOST_CC"; then
593
 
        HOST_CC="$CC"
594
 
    fi
595
 
    if test -z "$HOST_CFLAGS"; then
596
 
        HOST_CFLAGS="$CFLAGS"
597
 
    fi
598
 
fi
599
 
 
600
 
if test "$GCC" = "yes"; then
601
 
    GNU_CC=1
602
 
fi
603
 
if test "$GXX" = "yes"; then
604
 
    GNU_CXX=1
605
 
fi
606
 
if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
607
 
    GNU_AS=1
608
 
fi
609
 
rm -f a.out
610
 
 
611
 
case "$build:$target" in
612
 
    i?86-apple-darwin*:powerpc-apple-darwin*)
613
 
        dnl cross_compiling will have erroneously been set to "no" in this
614
 
        dnl case, because the x86 build host is able to run ppc code in a
615
 
        dnl translated environment, making a cross compiler appear native.
616
 
        cross_compiling=yes
617
 
        ;;
618
 
esac
619
 
 
620
 
if test "$cross_compiling"  = "yes"; then
621
 
    CROSS_COMPILE=1
622
 
else
623
 
    CROSS_COMPILE=
624
 
fi
625
 
 
626
 
dnl ========================================================
627
 
dnl Check for gcc -pipe support
628
 
dnl ========================================================
629
 
AC_MSG_CHECKING([for gcc -pipe support])
630
 
if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
631
 
    echo '#include <stdio.h>' > dummy-hello.c
632
 
    echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c
633
 
    ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
634
 
    cat dummy-hello.s | ${AS} -o dummy-hello.S - 2>&5
635
 
    if test $? = 0; then
636
 
        _res_as_stdin="yes"
637
 
    else
638
 
        _res_as_stdin="no"
639
 
    fi
640
 
    if test "$_res_as_stdin" = "yes"; then
641
 
        _SAVE_CFLAGS=$CFLAGS
642
 
        CFLAGS="$CFLAGS -pipe"
643
 
        AC_TRY_COMPILE( [ #include <stdio.h> ],
644
 
            [printf("Hello World\n");],
645
 
            [_res_gcc_pipe="yes"],
646
 
            [_res_gcc_pipe="no"] )
647
 
        CFLAGS=$_SAVE_CFLAGS
648
 
    fi
649
 
    if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
650
 
        _res="yes";
651
 
        CFLAGS="$CFLAGS -pipe"
652
 
        CXXFLAGS="$CXXFLAGS -pipe"
653
 
    else
654
 
        _res="no"
655
 
    fi
656
 
    rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
657
 
    AC_MSG_RESULT([$_res])
658
 
else
659
 
    AC_MSG_RESULT([no])
660
 
fi
661
 
 
662
 
dnl ========================================================
663
 
dnl Profile guided optimization
664
 
dnl ========================================================
665
 
dnl Test for profiling options
666
 
dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
667
 
 
668
 
_SAVE_CFLAGS="$CFLAGS"
669
 
CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
670
 
 
671
 
AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
672
 
AC_TRY_COMPILE([], [return 0;],
673
 
               [ PROFILE_GEN_CFLAGS="-fprofile-generate"
674
 
                 result="yes" ], result="no")
675
 
AC_MSG_RESULT([$result])
676
 
 
677
 
if test $result = "yes"; then
678
 
   PROFILE_GEN_LDFLAGS="-fprofile-generate"
679
 
   PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
680
 
   PROFILE_USE_LDFLAGS="-fprofile-use"
681
 
fi
682
 
 
683
 
CFLAGS="$_SAVE_CFLAGS"
684
 
 
685
 
dnl ===============================================================
686
 
dnl Check for .hidden assembler directive and visibility attribute.
687
 
dnl Borrowed from glibc configure.in
688
 
dnl ===============================================================
689
 
if test "$GNU_CC"; then
690
 
    AC_CACHE_CHECK(for visibility(hidden) attribute,
691
 
        ac_cv_visibility_hidden,
692
 
        [cat > conftest.c <<EOF
693
 
        int foo __attribute__ ((visibility ("hidden"))) = 1;
694
 
EOF
695
 
        ac_cv_visibility_hidden=no
696
 
        if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
697
 
            if grep '\.hidden.*foo' conftest.s >/dev/null; then
698
 
                ac_cv_visibility_hidden=yes
699
 
            fi
700
 
        fi
701
 
        rm -f conftest.[cs]
702
 
        ])
703
 
    if test "$ac_cv_visibility_hidden" = "yes"; then
704
 
        AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
705
 
        AC_CACHE_CHECK(for visibility pragma support,
706
 
            ac_cv_visibility_pragma,
707
 
            [cat > conftest.c <<EOF
708
 
#pragma GCC visibility push(hidden)
709
 
            int foo_hidden = 1;
710
 
#pragma GCC visibility push(default)
711
 
            int foo_default = 1;
712
 
EOF
713
 
            ac_cv_visibility_pragma=no
714
 
            if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
715
 
                if grep '\.hidden.*foo_hidden' conftest.s >/dev/null; then
716
 
                    if ! grep '\.hidden.*foo_default' conftest.s > /dev/null; then
717
 
                        ac_cv_visibility_pragma=yes
718
 
                    fi
719
 
                fi
720
 
            fi
721
 
            rm -f conftest.[cs]
722
 
            ])
723
 
        if test "$ac_cv_visibility_pragma" = "yes"; then
724
 
            AC_DEFINE(HAVE_VISIBILITY_PRAGMA)
725
 
            # To work around a build problem on Linux x86-64 (Bugzilla bug
726
 
            # 293438), we use the -fvisibility=hidden flag.  This flag is less
727
 
            # optimal than #pragma GCC visibility push(hidden) because the flag
728
 
            # assumes that symbols defined outside the current source file have
729
 
            # the default visibility.  This has the advantage that we don't need
730
 
            # to wrap system header files, but has the disadvantage that calls
731
 
            # to hidden symbols defined in other source files cannot be
732
 
            # optimized by the compiler.  The -fvisibility=hidden flag does
733
 
            # hide and export symbols correctly.
734
 
            #VISIBILITY_FLAGS='-I$(dist_includedir)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
735
 
            #WRAP_SYSTEM_INCLUDES=1
736
 
            VISIBILITY_FLAGS="-fvisibility=hidden"
737
 
            WRAP_SYSTEM_INCLUDES=
738
 
        fi
739
 
    fi
740
 
fi # GNU_CC
741
 
 
742
 
fi # SKIP_COMPILER_CHECKS
743
 
 
744
 
dnl ========================================================
745
 
dnl Checks for programs.
746
 
dnl ========================================================
747
 
if test -z "$SKIP_PATH_CHECKS"; then
748
 
    AC_PATH_PROGS(PERL, perl5 perl, echo not_perl)
749
 
elif test -z "$PERL"; then
750
 
    PERL=perl
751
 
fi
752
 
 
753
 
dnl ========================================================
754
 
dnl Default platform specific options
755
 
dnl ========================================================
756
 
OBJ_SUFFIX=o
757
 
LIB_SUFFIX=a
758
 
DLL_SUFFIX=so
759
 
ASM_SUFFIX=s
760
 
MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
761
 
PR_MD_ASFILES=
762
 
PR_MD_CSRCS=
763
 
PR_MD_ARCH_DIR=unix
764
 
AR_FLAGS='cr $@'
765
 
AS='$(CC)'
766
 
ASFLAGS='$(CFLAGS)'
767
 
 
768
 
if test -n "$CROSS_COMPILE"; then
769
 
    OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
770
 
    OS_RELEASE=
771
 
    OS_TEST="${target_cpu}"
772
 
    case "${target_os}" in
773
 
        linux*)       OS_ARCH=Linux ;;
774
 
        solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
775
 
        mingw*)       OS_ARCH=WINNT ;;
776
 
        wince*)       OS_ARCH=WINCE ;;
777
 
        winmo*)       OS_ARCH=WINCE ;;
778
 
        darwin*)      OS_ARCH=Darwin ;;
779
 
        riscos*)      OS_ARCH=RISCOS ;;
780
 
    esac
781
 
else
782
 
    OS_ARCH=`uname -s | sed -e 's|/|_|g'`
783
 
    OS_RELEASE=`uname -r`
784
 
    OS_TEST=`uname -m`
785
 
fi
786
 
 
787
 
if test "$OS_ARCH" = "IRIX64"; then
788
 
    OS_ARCH=IRIX
789
 
fi
790
 
 
791
 
if test "$OS_ARCH" = "AIX"; then
792
 
    OS_RELEASE=`uname -v`.`uname -r`
793
 
fi
794
 
 
795
 
if test "$OS_ARCH" = "FreeBSD"; then
796
 
    OS_RELEASE=`echo $OS_RELEASE | sed 's/-.*//'`
797
 
fi
798
 
 
799
 
if test "$OS_ARCH" = "Linux"; then
800
 
    OS_RELEASE=`echo $OS_RELEASE | sed 's/-.*//'`
801
 
    OS_RELEASE=`echo $OS_RELEASE | awk -F\. '{ print $1 "." $2 }'`
802
 
fi
803
 
 
804
 
#######################################################################
805
 
# Master "Core Components" macros for getting the OS target           #
806
 
#######################################################################
807
 
 
808
 
#
809
 
# Note: OS_TARGET should be specified on the command line for gmake.
810
 
# When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
811
 
# The difference between the Win95 target and the WinNT target is that
812
 
# the WinNT target uses Windows NT specific features not available
813
 
# in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
814
 
# at lesser performance (the Win95 target uses threads; the WinNT target
815
 
# uses fibers).
816
 
#
817
 
# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
818
 
# cross-compilation.
819
 
#
820
 
 
821
 
#
822
 
# The following hack allows one to build on a WIN95 machine (as if
823
 
# s/he were cross-compiling on a WINNT host for a WIN95 target).
824
 
# It also accomodates for MKS's uname.exe.  If you never intend
825
 
# to do development on a WIN95 machine, you don't need this hack.
826
 
#
827
 
case "$OS_ARCH" in
828
 
WIN95)
829
 
    OS_ARCH=WINNT
830
 
    OS_TARGET=WIN95
831
 
    ;;
832
 
Windows_95)
833
 
    OS_ARCH=Windows_NT
834
 
    OS_TARGET=WIN95
835
 
    ;;
836
 
Windows_98)
837
 
    OS_ARCH=Windows_NT
838
 
    OS_TARGET=WIN95
839
 
    ;;
840
 
CYGWIN_9*|CYGWIN_ME*)
841
 
    OS_ARCH='CYGWIN_NT-4.0'
842
 
    OS_TARGET=WIN95
843
 
    ;;
844
 
OS_2)
845
 
    OS_ARCH=OS2
846
 
    OS_TARGET=OS2
847
 
    ;;
848
 
esac
849
 
 
850
 
#
851
 
# On WIN32, we also define the variable CPU_ARCH.
852
 
#
853
 
 
854
 
case "$OS_ARCH" in
855
 
WINNT)
856
 
    CPU_ARCH=`uname -p`
857
 
    if test "$CPU_ARCH" = "I386"; then
858
 
        CPU_ARCH=x86
859
 
    fi
860
 
    ;;
861
 
Windows_NT)
862
 
#
863
 
# If uname -s returns "Windows_NT", we assume that we are using
864
 
# the uname.exe in MKS toolkit.
865
 
#
866
 
# The -r option of MKS uname only returns the major version number.
867
 
# So we need to use its -v option to get the minor version number.
868
 
# Moreover, it doesn't have the -p option, so we need to use uname -m.
869
 
#
870
 
    OS_ARCH=WINNT
871
 
    OS_MINOR_RELEASE=`uname -v`
872
 
    if test "$OS_MINOR_RELEASE" = "00"; then
873
 
        OS_MINOR_RELEASE=0
874
 
    fi
875
 
    OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
876
 
    CPU_ARCH=`uname -m`
877
 
    #
878
 
    # MKS's uname -m returns "586" on a Pentium machine.
879
 
    #
880
 
    if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
881
 
        CPU_ARCH=x86
882
 
    fi
883
 
    ;;
884
 
CYGWIN_NT*|MINGW*_NT*)
885
 
#
886
 
# If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
887
 
# the uname.exe in the Cygwin tools.
888
 
# If uname -s returns MINGW32_NT-5.1, we assume that we are using
889
 
# the uname.exe in the MSYS tools.
890
 
#
891
 
    OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
892
 
    OS_ARCH=WINNT
893
 
    CPU_ARCH=`uname -m`
894
 
    #
895
 
    # Cygwin's uname -m returns "i686" on a Pentium Pro machine.
896
 
    #
897
 
    if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
898
 
        CPU_ARCH=x86
899
 
    fi
900
 
    ;;
901
 
esac
902
 
 
903
 
if test -n "$MOZILLA_CLIENT" && test "$OS_ARCH" = "WINNT"; then
904
 
    OS_TARGET=WIN95
905
 
    if test -n "$MOZ_DEBUG"; then
906
 
        USE_DEBUG_RTL=1
907
 
    fi
908
 
fi
909
 
if test -z "$OS_TARGET"; then
910
 
    OS_TARGET=$OS_ARCH
911
 
fi
912
 
if test "$OS_TARGET" = "WIN95"; then
913
 
    OS_RELEASE="4.0"
914
 
fi
915
 
OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
916
 
 
917
 
dnl ========================================================
918
 
dnl Enable high-memory support on OS/2 by default.
919
 
dnl ========================================================
920
 
AC_ARG_ENABLE(os2-high-mem,
921
 
    [  --disable-os2-high-mem  Disable high-memory support on OS/2],
922
 
    [ if test "$enableval" = "no"; then
923
 
        MOZ_OS2_HIGH_MEMORY=
924
 
      else
925
 
        MOZ_OS2_HIGH_MEMORY=1
926
 
      fi ])
927
 
 
928
 
dnl ========================================================
929
 
dnl = ARM toolchain tweaks
930
 
dnl ========================================================
931
 
 
932
 
dnl Defaults
933
 
case "${CPU_ARCH}-${OS_TARGET}" in
934
 
arm-Android)
935
 
    MOZ_THUMB=yes
936
 
    MOZ_ARCH=armv7-a
937
 
    MOZ_FPU=vfp
938
 
    MOZ_FLOAT_ABI=softfp
939
 
    ;;
940
 
arm-*)
941
 
    if test -n "$MOZ_PLATFORM_MAEMO"; then
942
 
        MOZ_THUMB=no
943
 
        MOZ_ARCH=armv7-a
944
 
        MOZ_FLOAT_ABI=softfp
945
 
    fi
946
 
    if test "$MOZ_PLATFORM_MAEMO" = 6; then
947
 
        MOZ_THUMB=yes
948
 
    fi
949
 
    ;;
950
 
esac
951
 
 
952
 
dnl Kept for compatibility with some buildbot mozconfig
953
 
AC_ARG_ENABLE(thumb2, [], MOZ_THUMB=$enableval)
954
 
 
955
 
AC_ARG_WITH(thumb,
956
 
[  --with-thumb[[=yes|no|toolchain-default]]]
957
 
[                          Use Thumb instruction set (-mthumb)],
958
 
    if test -z "$GNU_CC"; then
959
 
        AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchain-defaults])
960
 
    fi
961
 
    MOZ_THUMB=$withval)
962
 
 
963
 
AC_ARG_WITH(thumb-interwork,
964
 
[  --with-thumb-interwork[[=yes|no|toolchain-default]]
965
 
                           Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
966
 
    if test -z "$GNU_CC"; then
967
 
        AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchain-defaults])
968
 
    fi
969
 
    MOZ_THUMB_INTERWORK=$withval)
970
 
 
971
 
AC_ARG_WITH(arch,
972
 
[  --with-arch=[[type|toolchain-default]]
973
 
                           Use specific CPU features (-march=type)],
974
 
    if test -z "$GNU_CC"; then
975
 
        AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchain-defaults])
976
 
    fi
977
 
    MOZ_ARCH=$withval)
978
 
 
979
 
AC_ARG_WITH(fpu,
980
 
[  --with-fpu=[[type|toolchain-default]]
981
 
                           Use specific FPU type (-mfpu=type)],
982
 
    if test -z "$GNU_CC"; then
983
 
        AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchain-defaults])
984
 
    fi
985
 
    MOZ_FPU=$withval)
986
 
 
987
 
AC_ARG_WITH(float-abi,
988
 
[  --with-float-abi=[[type|toolchain-default]]
989
 
                           Use specific arm float ABI (-mfloat-abi=type)],
990
 
    if test -z "$GNU_CC"; then
991
 
        AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchain-defaults])
992
 
    fi
993
 
    MOZ_FLOAT_ABI=$withval)
994
 
 
995
 
AC_ARG_WITH(soft-float,
996
 
[  --with-soft-float[[=yes|no|toolchain-default]]
997
 
                           Use soft float library (-msoft-float)],
998
 
    if test -z "$GNU_CC"; then
999
 
        AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchain-defaults])
1000
 
    fi
1001
 
    MOZ_SOFT_FLOAT=$withval)
1002
 
 
1003
 
case "$MOZ_ARCH" in
1004
 
toolchain-default|"")
1005
 
    arch_flag=""
1006
 
    ;;
1007
 
*)
1008
 
    arch_flag="-march=$MOZ_ARCH"
1009
 
    ;;
1010
 
esac
1011
 
 
1012
 
case "$MOZ_THUMB" in
1013
 
yes)
1014
 
    MOZ_THUMB2=1
1015
 
    thumb_flag="-mthumb"
1016
 
    ;;
1017
 
no)
1018
 
    MOZ_THUMB2=
1019
 
    thumb_flag="-marm"
1020
 
    ;;
1021
 
*)
1022
 
    _SAVE_CFLAGS="$CFLAGS"
1023
 
    CFLAGS="$arch_flag"
1024
 
    AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
1025
 
        MOZ_THUMB2=1,
1026
 
        MOZ_THUMB2=)
1027
 
    CFLAGS="$_SAVE_CFLAGS"
1028
 
    thumb_flag=""
1029
 
    ;;
1030
 
esac
1031
 
 
1032
 
case "$MOZ_THUMB_INTERWORK" in
1033
 
yes)
1034
 
    thumb_interwork_flag="-mthumb-interwork"
1035
 
    ;;
1036
 
no)
1037
 
    thumb_interwork_flag="-mno-thumb-interwork"
1038
 
    ;;
1039
 
*) # toolchain-default
1040
 
    thumb_interwork_flag=""
1041
 
    ;;
1042
 
esac
1043
 
 
1044
 
case "$MOZ_FPU" in
1045
 
toolchain-default|"")
1046
 
    fpu_flag=""
1047
 
    ;;
1048
 
*)
1049
 
    fpu_flag="-mfpu=$MOZ_FPU"
1050
 
    ;;
1051
 
esac
1052
 
 
1053
 
case "$MOZ_FLOAT_ABI" in
1054
 
toolchain-default|"")
1055
 
    float_abi_flag=""
1056
 
    ;;
1057
 
*)
1058
 
    float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
1059
 
    ;;
1060
 
esac
1061
 
 
1062
 
case "$MOZ_SOFT_FLOAT" in
1063
 
yes)
1064
 
    soft_float_flag="-msoft-float"
1065
 
    ;;
1066
 
no)
1067
 
    soft_float_flag="-mno-soft-float"
1068
 
    ;;
1069
 
*) # toolchain-default
1070
 
    soft_float_flag=""
1071
 
    ;;
1072
 
esac
1073
 
 
1074
 
dnl Use echo to avoid accumulating space characters
1075
 
all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
1076
 
if test -n "$all_flags"; then
1077
 
    _SAVE_CFLAGS="$CFLAGS"
1078
 
    CFLAGS="$all_flags"
1079
 
    AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
1080
 
    AC_TRY_COMPILE([],[return 0;],
1081
 
        AC_MSG_RESULT([yes]),
1082
 
        AC_MSG_ERROR([no]))
1083
 
 
1084
 
    CFLAGS="$_SAVE_CFLAGS $all_flags"
1085
 
    CXXFLAGS="$CXXFLAGS $all_flags"
1086
 
    ASFLAGS="$ASFLAGS $all_flags"
1087
 
    if test -n "$thumb_flag"; then
1088
 
        LDFLAGS="$LDFLAGS $thumb_flag"
1089
 
    fi
1090
 
fi
1091
 
 
1092
 
dnl ========================================================
1093
 
dnl Override of system specific host options
1094
 
dnl ========================================================
1095
 
case "$host" in
1096
 
*-mingw*)
1097
 
    NSINSTALL=nsinstall
1098
 
    ;;
1099
 
*-cygwin*|*-msvc*|*-mks*|*-wince*|*-winmo*)
1100
 
    NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
1101
 
    if test `echo "${PATH}" | grep -c \;` = 0; then
1102
 
        CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
1103
 
    fi
1104
 
    ;;
1105
 
*-beos*)
1106
 
    HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
1107
 
    ;;
1108
 
*os2*)
1109
 
    ;;
1110
 
*)
1111
 
    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1112
 
    ;;
1113
 
esac
1114
 
 
1115
 
dnl ========================================================
1116
 
dnl Override of system specific target options
1117
 
dnl ========================================================
1118
 
case "$target" in
1119
 
 
1120
 
*-aix*)
1121
 
    AC_DEFINE(XP_UNIX)
1122
 
    AC_DEFINE(AIX)
1123
 
    AC_DEFINE(SYSV)
1124
 
    DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
1125
 
    AC_CHECK_HEADER(sys/atomic_op.h, AC_DEFINE(AIX_HAVE_ATOMIC_OP_H))
1126
 
    case "${target_os}" in
1127
 
    aix3.2*)
1128
 
        AC_DEFINE(AIX_RENAME_SELECT)
1129
 
        AC_DEFINE(_PR_NO_LARGE_FILES)
1130
 
        AIX_LINK_OPTS='-bnso -berok'
1131
 
        PR_MD_ASFILES=os_AIX.s
1132
 
        ;;
1133
 
    aix4.1*)
1134
 
        AC_DEFINE(AIX_TIMERS)
1135
 
        AC_DEFINE(_PR_NO_LARGE_FILES)
1136
 
        AC_DEFINE(AIX4_1)
1137
 
        MKSHLIB=
1138
 
        DSO_LDOPTS=
1139
 
        AIX_LINK_OPTS='-bnso -berok'
1140
 
        LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)_shr'
1141
 
        LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)_shr'
1142
 
        ;;
1143
 
    aix4.2*)
1144
 
        AC_DEFINE(AIX_TIMERS)
1145
 
        AC_DEFINE(_PR_HAVE_OFF64_T)
1146
 
        AIX_LINK_OPTS='-brtl -bnso -berok'
1147
 
        ;;
1148
 
    aix4.3*)
1149
 
        AC_DEFINE(AIX_TIMERS)
1150
 
        AC_DEFINE(_PR_HAVE_OFF64_T)
1151
 
        AC_DEFINE(AIX4_3_PLUS)
1152
 
        AC_DEFINE(HAVE_SOCKLEN_T)
1153
 
        AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1154
 
        USE_IPV6=1
1155
 
        AIX_LINK_OPTS='-brtl -bnso -berok'
1156
 
        ;;
1157
 
    *)
1158
 
        AC_DEFINE(AIX_TIMERS)
1159
 
        AC_DEFINE(_PR_HAVE_OFF64_T)
1160
 
        AC_DEFINE(AIX4_3_PLUS)
1161
 
        AC_DEFINE(HAVE_SOCKLEN_T)
1162
 
        AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1163
 
        USE_IPV6=1
1164
 
        AIX_LINK_OPTS='-brtl -bnso -berok'
1165
 
        ;;
1166
 
    esac
1167
 
    CFLAGS="$CFLAGS -qro -qroconst"
1168
 
    AIX_WRAP='$(DIST)/lib/aixwrap.o'
1169
 
    AIX_TMP='./_aix_tmp.o'
1170
 
    if test -n "$USE_64"; then
1171
 
        MDCPUCFG_H=_aix64.cfg
1172
 
        OBJECT_MODE=64
1173
 
    else
1174
 
        MDCPUCFG_H=_aix32.cfg
1175
 
    fi
1176
 
    PR_MD_CSRCS=aix.c
1177
 
    RESOLVE_LINK_SYMBOLS=1
1178
 
    ;;
1179
 
        
1180
 
*-android*|*-linuxandroid*)
1181
 
    if test -z "$USE_NSPR_THREADS"; then
1182
 
        USE_PTHREADS=1
1183
 
        IMPL_STRATEGY=_PTH
1184
 
    fi
1185
 
    AC_DEFINE(XP_UNIX)
1186
 
    AC_DEFINE(_GNU_SOURCE)
1187
 
    AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1188
 
    AC_DEFINE(LINUX)
1189
 
    CFLAGS="$CFLAGS -Wall"
1190
 
    CXXFLAGS="$CXXFLAGS -Wall"
1191
 
    MDCPUCFG_H=_linux.cfg
1192
 
    PR_MD_CSRCS=linux.c
1193
 
    MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
1194
 
    DSO_CFLAGS=-fPIC
1195
 
    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
1196
 
    _OPTIMIZE_FLAGS=-O2
1197
 
    _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
1198
 
                                   # combo is not yet good at debugging inlined
1199
 
                                   # functions (even when using DWARF2 as the
1200
 
                                   # debugging format)
1201
 
    COMPILER_TAG=_glibc
1202
 
    CPU_ARCH=arm
1203
 
    CPU_ARCH_TAG=_arm
1204
 
    OS_TARGET=Android
1205
 
    ;;
1206
 
 
1207
 
*-beos*)
1208
 
    AC_DEFINE(XP_BEOS)
1209
 
    AC_DEFINE(BeOS)
1210
 
    AC_DEFINE(BEOS)
1211
 
    AC_DEFINE(_POSIX_SOURCE)
1212
 
    DSO_LDOPTS=-nostart
1213
 
    MDCPUCFG_H=_beos.cfg
1214
 
    USE_BTHREADS=1
1215
 
    PR_MD_ARCH_DIR=beos
1216
 
    RESOLVE_LINK_SYMBOLS=1
1217
 
    case "${target_cpu}" in
1218
 
    i*86)
1219
 
        _OPTIMIZE_FLAGS=-O2
1220
 
        _DEBUG_FLAGS='-gdwarf-2 -O0'
1221
 
        MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
1222
 
        AC_CHECK_LIB(bind, gethostbyaddr, [OS_LIBS="$OS_LIBS -lbind -lsocket"])
1223
 
        ;;
1224
 
    powerpc)
1225
 
        CC=mwcc
1226
 
        CCC=mwcc
1227
 
        LD=mwld
1228
 
        DSO_LDOPTS='-xms -export pragma -init _init_routine_ -term _term_routine_ -lroot -lnet /boot/develop/lib/ppc/glue-noinit.a /boot/develop/lib/ppc/init_term_dyn.o /boot/develop/lib/ppc/start_dyn.o'
1229
 
        _OPTIMIZE_FLAGS=-O2    
1230
 
        _DEBUG_FLAGS='-g -O0'
1231
 
        ;;
1232
 
    esac
1233
 
    ;;
1234
 
 
1235
 
*-bsdi*)
1236
 
    AC_DEFINE(XP_UNIX)
1237
 
    AC_DEFINE(BSDI)
1238
 
    AC_DEFINE(NEED_BSDREGEX)
1239
 
 
1240
 
    CFLAGS="$CFLAGS -Wall -Wno-format"
1241
 
    CXXFLAGS="$CXXFLAGS -Wall -Wno-format"
1242
 
 
1243
 
    if echo "$OS_TEST" | grep -c 86 >/dev/null; then
1244
 
        CPU_ARCH=x86
1245
 
    elif echo "$OS_TEST" | grep -c sparc >/dev/null; then 
1246
 
        CPU_ARCH=sparc
1247
 
    fi
1248
 
 
1249
 
    MDCPUCFG_H=_bsdi.cfg
1250
 
    PR_MD_CSRCS=bsdi.c
1251
 
 
1252
 
    DSO_LDOPTS=-r
1253
 
 
1254
 
    case "$target_os" in
1255
 
    bsdi1.1*)
1256
 
        AC_DEFINE(_PR_BSDI_JMPBUF_IS_ARRAY)
1257
 
        AC_DEFINE(_PR_STAT_HAS_ONLY_ST_ATIME)
1258
 
        AC_DEFINE(_PR_NEED_H_ERRNO)
1259
 
        MKSHLIB=
1260
 
        DSO_CFLAGS=
1261
 
        DSO_LDOPTS=
1262
 
        ;;
1263
 
 
1264
 
    bsdi2.1*)
1265
 
        AC_DEFINE(_PR_TIMESPEC_HAS_TS_SEC)
1266
 
        AC_DEFINE(_PR_BSDI_JMPBUF_IS_ARRAY)
1267
 
        AC_DEFINE(HAVE_DLL)
1268
 
        AC_DEFINE(USE_DLFCN)
1269
 
        AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
1270
 
        PR_MD_ASFILES=os_BSD_OS_386_2.s
1271
 
        ;;
1272
 
 
1273
 
    bsdi4.* | bsdi5.*)
1274
 
        AC_DEFINE(_PR_SELECT_CONST_TIMEVAL)
1275
 
        AC_DEFINE(_PR_BSDI_JMPBUF_IS_STRUCT)
1276
 
        AC_DEFINE(HAVE_DLL)
1277
 
        AC_DEFINE(USE_DLFCN)
1278
 
        AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
1279
 
        MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
1280
 
        DSO_CFLAGS=-fPIC
1281
 
        DSO_LDOPTS='-shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so)'
1282
 
        STRIP="$STRIP -d"
1283
 
        case "$target_os" in
1284
 
        bsdi4.2* | bsdi4.3* | bsdi5.*)
1285
 
            AC_DEFINE(_PR_HAVE_GETPROTO_R)
1286
 
            AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER)
1287
 
            ;;
1288
 
        esac
1289
 
        ;;
1290
 
    *)
1291
 
        AC_DEFINE(_PR_SELECT_CONST_TIMEVAL)
1292
 
        AC_DEFINE(_PR_BSDI_JMPBUF_IS_STRUCT)
1293
 
        AC_DEFINE(HAVE_DLL)
1294
 
        AC_DEFINE(USE_DLFCN)
1295
 
        AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
1296
 
        ;;
1297
 
    esac
1298
 
 
1299
 
    ;;
1300
 
 
1301
 
*-darwin*)
1302
 
    AC_DEFINE(XP_UNIX)
1303
 
    AC_DEFINE(DARWIN)
1304
 
    AC_DEFINE(HAVE_BSD_FLOCK)
1305
 
    AC_DEFINE(HAVE_SOCKLEN_T)
1306
 
    AS='$(CC) -x assembler-with-cpp'
1307
 
    CFLAGS="$CFLAGS -Wall -fno-common"
1308
 
    case "${target_cpu}" in
1309
 
        i*86*)
1310
 
            if test -n "$USE_64"; then
1311
 
                CPU_ARCH=x86_64
1312
 
            else        
1313
 
                CPU_ARCH=i386
1314
 
            fi
1315
 
            ;;
1316
 
        *)
1317
 
            CPU_ARCH=ppc
1318
 
            ;;
1319
 
    esac
1320
 
    if test "`echo $CC | grep -c '\-arch '`" = "0"; then
1321
 
        CC="$CC -arch $CPU_ARCH"
1322
 
    fi
1323
 
    DSO_CFLAGS=-fPIC
1324
 
    DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
1325
 
    _OPTIMIZE_FLAGS=-O2
1326
 
    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1327
 
    STRIP="$STRIP -x -S"
1328
 
    DLL_SUFFIX=dylib
1329
 
    USE_PTHREADS=1
1330
 
    MDCPUCFG_H=_darwin.cfg
1331
 
    PR_MD_CSRCS=darwin.c
1332
 
    PR_MD_ASFILES=os_Darwin.s
1333
 
 
1334
 
    # Add Mac OS X support for loading CFM & CFBundle plugins
1335
 
    if test -f "${MACOS_SDK_DIR}/System/Library/Frameworks/Carbon.framework/Carbon"; then
1336
 
        AC_DEFINE(XP_MACOSX)
1337
 
        OS_TARGET=MacOSX
1338
 
 
1339
 
        if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1340
 
            dnl Use the specified value
1341
 
            export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1342
 
        elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
1343
 
            dnl No value specified on the command line or in the environment,
1344
 
            dnl use the lesser of the library's minimum or the architecture's
1345
 
            dnl minimum.
1346
 
            case "${target_cpu}" in
1347
 
                powerpc*)
1348
 
                    dnl Architecture minimum 10.2
1349
 
                    export MACOSX_DEPLOYMENT_TARGET=10.2
1350
 
                    ;;
1351
 
                i*86*)
1352
 
                    dnl Architecture minimum 10.4
1353
 
                    export MACOSX_DEPLOYMENT_TARGET=10.4
1354
 
                    ;;
1355
 
            esac
1356
 
        fi
1357
 
 
1358
 
        dnl MACOS_SDK_DIR will be set to the SDK location whenever one is
1359
 
        dnl in use.  NEXT_ROOT will be set and exported if it's needed for
1360
 
        dnl ld.
1361
 
 
1362
 
        if test "$MACOS_SDK_DIR"; then
1363
 
            dnl Sync this section with the one in Mozilla's top level.
1364
 
 
1365
 
            if test ! -d "$MACOS_SDK_DIR"; then
1366
 
                AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1367
 
specify a valid SDK.  SDKs are installed when the optional cross-development
1368
 
tools are selected during the Xcode/Developer Tools installation.])
1369
 
            fi
1370
 
 
1371
 
            changequote(,)
1372
 
            CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
1373
 
            GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1374
 
            GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1375
 
            changequote([,])
1376
 
            GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1377
 
            if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1378
 
                SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks"
1379
 
                if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
1380
 
                    SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks"
1381
 
                fi
1382
 
 
1383
 
                SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}"
1384
 
 
1385
 
                CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
1386
 
 
1387
 
                dnl CPP needs to be set for AC_CHECK_HEADER.
1388
 
                CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
1389
 
 
1390
 
                changequote(,)
1391
 
                HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
1392
 
                changequote([,])
1393
 
                if test "$HOST_DARWIN_MAJOR" -lt 9 ; then
1394
 
                    dnl The build host is running Tiger (10.4) or earlier.
1395
 
                    dnl ld support for -syslibroot is compiler-agnostic, but
1396
 
                    dnl only available on Tiger and later.  On Tiger and
1397
 
                    dnl earlier build hosts, just rely on NEXT_ROOT, because
1398
 
                    dnl it's not been shown to cause any problems.
1399
 
                    MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}"
1400
 
                else
1401
 
                    dnl The build host is running Leopard (10.5) or later.
1402
 
                    dnl With NEXT_ROOT set, the linker will still not apply
1403
 
                    dnl it when resolving dependencies.  This causes problems
1404
 
                    dnl on Leopard, where an SDK depends on frameworks which
1405
 
                    dnl were present in earlier OS releases (and the associated
1406
 
                    dnl SDK) but not in Leopard.  -syslibroot does not have
1407
 
                    dnl this problem, but it results in harmless warnings when
1408
 
                    dnl NEXT_ROOT is set.  NEXT_ROOT needs to remain set even
1409
 
                    dnl on Leopard because the compiler uses it too.
1410
 
                    MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
1411
 
                fi
1412
 
 
1413
 
                LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
1414
 
                export NEXT_ROOT=$MACOS_SDK_DIR
1415
 
 
1416
 
                if test -n "$CROSS_COMPILE" ; then
1417
 
                    dnl NEXT_ROOT will be in the environment, but it
1418
 
                    dnl shouldn't be set for the build host.  HOST_CXX is
1419
 
                    dnl presently unused.
1420
 
                    HOST_CC="NEXT_ROOT= $HOST_CC"
1421
 
                    HOST_CXX="NEXT_ROOT= $HOST_CXX"
1422
 
                fi
1423
 
            else
1424
 
                dnl gcc >= 4.0 uses different paths than above, but knows
1425
 
                dnl how to find them itself.
1426
 
                CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1427
 
 
1428
 
                dnl CPP needs to be set for AC_CHECK_HEADER.
1429
 
                CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1430
 
 
1431
 
                dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which
1432
 
                dnl has an ld that supports -syslibroot.  Don't set
1433
 
                dnl NEXT_ROOT because it will be ignored and cause
1434
 
                dnl warnings when -syslibroot is specified.
1435
 
                if test "$GCC_VERSION_FULL" != "4.0.0" ; then
1436
 
                    dnl gcc > 4.0.0 will pass -syslibroot to ld automatically
1437
 
                    dnl based on the -isysroot it receives.
1438
 
                    LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
1439
 
                else
1440
 
                    dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs
1441
 
                    dnl to be explicit.
1442
 
                    LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1443
 
                fi
1444
 
            fi
1445
 
        fi
1446
 
    fi
1447
 
    ;;
1448
 
 
1449
 
*-dgux*)
1450
 
    AC_DEFINE(XP_UNIX)
1451
 
    AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
1452
 
    AC_DEFINE(SVR4)
1453
 
    AC_DEFINE(SYSV)
1454
 
    AC_DEFINE(DGUX)
1455
 
    AC_DEFINE(_DGUX_SOURCE)
1456
 
    AC_DEFINE(_POSIX4A_DRAFT6_SOURCE)
1457
 
    DSO_LDOPTS=-G
1458
 
    _OPTIMIZE_FLAGS=-O2
1459
 
    _DEBUG_FLAGS=
1460
 
    MDCPUCFG_H=_dgux.cfg
1461
 
    PR_MD_CSRCS=dgux.c
1462
 
    ;;
1463
 
 
1464
 
*-freebsd*)
1465
 
    if test -z "$USE_NSPR_THREADS"; then
1466
 
        USE_PTHREADS=1
1467
 
    fi
1468
 
    AC_DEFINE(XP_UNIX)
1469
 
    AC_DEFINE(FREEBSD)
1470
 
    AC_DEFINE(HAVE_BSD_FLOCK)
1471
 
    AC_DEFINE(HAVE_SOCKLEN_T)
1472
 
    CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
1473
 
    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
1474
 
    if test "$MOZ_OBJFORMAT" = "elf"; then
1475
 
        DLL_SUFFIX=so
1476
 
    else
1477
 
        DLL_SUFFIX=so.1.0
1478
 
    fi
1479
 
    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1480
 
    DSO_CFLAGS=-fPIC
1481
 
    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
1482
 
    MDCPUCFG_H=_freebsd.cfg
1483
 
    PR_MD_CSRCS=freebsd.c
1484
 
    ;;
1485
 
 
1486
 
*-hpux*)
1487
 
    AC_DEFINE(XP_UNIX)
1488
 
    AC_DEFINE(HPUX)
1489
 
    AC_DEFINE(_HPUX_SOURCE)
1490
 
    # OSF1 and HPUX report the POLLHUP event for a socket when the
1491
 
    # shutdown(SHUT_WR) operation is called for the remote end, even though
1492
 
    # the socket is still writeable. Use select(), instead of poll(), to
1493
 
    # workaround this problem.
1494
 
    AC_DEFINE(_PR_POLL_WITH_SELECT)
1495
 
    AC_DEFINE(_USE_BIG_FDS)
1496
 
    DSO_LDOPTS='-b +h $(notdir $@)'
1497
 
    PR_MD_CSRCS=hpux.c
1498
 
    if test "$OS_TEST" = "ia64"; then
1499
 
        DLL_SUFFIX=so
1500
 
        DSO_LDOPTS="$DSO_LDOPTS +b '\$\$ORIGIN'"
1501
 
        CPU_ARCH_TAG=_$OS_TEST 
1502
 
        if test -z "$USE_64"; then
1503
 
            COMPILER_TAG=_32
1504
 
        fi
1505
 
        PR_MD_ASFILES=os_HPUX_ia64.s
1506
 
    else
1507
 
        AC_DEFINE(hppa)
1508
 
        DLL_SUFFIX=sl
1509
 
        PR_MD_ASFILES=os_HPUX.s
1510
 
    fi
1511
 
    if test -n "$USE_64"; then
1512
 
        MDCPUCFG_H=_hpux64.cfg
1513
 
    else
1514
 
        MDCPUCFG_H=_hpux32.cfg
1515
 
    fi
1516
 
    if test -z "$GNU_CC"; then
1517
 
        CC="$CC -Ae"
1518
 
        CXX="$CXX -ext"
1519
 
        DSO_CFLAGS=+Z
1520
 
    else
1521
 
        DSO_CFLAGS=-fPIC
1522
 
        ASFLAGS="$ASFLAGS -x assembler-with-cpp"
1523
 
    fi
1524
 
 
1525
 
    if test -n "$MOZILLA_CLIENT"; then
1526
 
        DEFAULT_IMPL_STRATEGY=_EMU
1527
 
    fi
1528
 
 
1529
 
    if echo "$OS_RELEASE" | grep ^A.09 >/dev/null; then
1530
 
        AC_DEFINE(_PR_NEED_H_ERRNO)
1531
 
        AC_DEFINE(HPUX9)
1532
 
        DEFAULT_IMPL_STRATEGY=_EMU
1533
 
        USE_NSPR_THREADS=1
1534
 
    fi
1535
 
 
1536
 
    if echo "$OS_RELEASE" | egrep '^(A.09|B.10)' >/dev/null; then
1537
 
        AC_DEFINE(_PR_NO_LARGE_FILES)
1538
 
    fi
1539
 
 
1540
 
    if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
1541
 
        AC_DEFINE(_PR_NEED_H_ERRNO)
1542
 
    fi
1543
 
 
1544
 
    if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
1545
 
        AC_DEFINE(HAVE_INT_LOCALTIME_R)
1546
 
    fi
1547
 
 
1548
 
    if echo "$OS_RELEASE" | egrep '^(B.10.30|B.11)' >/dev/null; then
1549
 
        AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
1550
 
    fi
1551
 
 
1552
 
    # HP-UX 11i v2 (B.11.23) or higher
1553
 
    changequote(<<,>>)
1554
 
    case "$OS_RELEASE" in
1555
 
    [C-Z]*|B.[2-9]*|B.1[2-9]*|B.11.[3-9]*|B.11.2[3-9]*)
1556
 
        USE_IPV6=1
1557
 
        ;;
1558
 
    esac
1559
 
    changequote([,])
1560
 
 
1561
 
    if test "$OS_RELEASE" = "B.10.01"; then
1562
 
        AC_DEFINE(HPUX10)
1563
 
        DEFAULT_IMPL_STRATEGY=_EMU
1564
 
    fi
1565
 
 
1566
 
    if test "$OS_RELEASE" = "B.10.10"; then
1567
 
        AC_DEFINE(HPUX10)
1568
 
        AC_DEFINE(HPUX10_10)
1569
 
        DEFAULT_IMPL_STRATEGY=_PTH
1570
 
    fi
1571
 
 
1572
 
    if test "$OS_RELEASE" = "B.10.20"; then
1573
 
        AC_DEFINE(HPUX10)
1574
 
        AC_DEFINE(HPUX10_20)
1575
 
        if test -z "$GNU_CC"; then
1576
 
            CFLAGS="$CFLAGS +DAportable +DS1.1"
1577
 
            CXXFLAGS="$CXXFLAGS +DAportable +DS1.1"
1578
 
        fi
1579
 
        DEFAULT_IMPL_STRATEGY=_PTH
1580
 
    fi
1581
 
 
1582
 
    if test "$OS_RELEASE" = "B.10.30"; then
1583
 
        AC_DEFINE(HPUX10)
1584
 
        AC_DEFINE(HPUX10_30)
1585
 
        if test -z "$GNU_CC"; then
1586
 
            CFLAGS="$CFLAGS +DAportable +DS1.1"
1587
 
            CXXFLAGS="$CXXFLAGS +DAportable +DS1.1"
1588
 
        fi
1589
 
        DEFAULT_IMPL_STRATEGY=_PTH
1590
 
    fi
1591
 
 
1592
 
    if echo "$OS_RELEASE" | grep ^B.11 >/dev/null; then
1593
 
        AC_DEFINE(HPUX10)
1594
 
        AC_DEFINE(HPUX11)
1595
 
        AC_DEFINE(_LARGEFILE64_SOURCE)
1596
 
        AC_DEFINE(_PR_HAVE_OFF64_T)
1597
 
        AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1598
 
        if test -z "$GNU_CC"; then
1599
 
            if test -z "$USE_64"; then
1600
 
                if test "$OS_TEST" = "ia64"; then
1601
 
                    CFLAGS="$CFLAGS +DD32"
1602
 
                    CXXFLAGS="$CXXFLAGS +DD32"
1603
 
                else
1604
 
                    CFLAGS="$CFLAGS +DAportable +DS2.0"
1605
 
                    CXXFLAGS="$CXXFLAGS +DAportable +DS2.0"
1606
 
                fi
1607
 
            else
1608
 
                if test "$OS_TEST" = "ia64"; then
1609
 
                    CFLAGS="$CFLAGS +DD64"
1610
 
                    CXXFLAGS="$CXXFLAGS +DD64"
1611
 
                else
1612
 
                    CFLAGS="$CFLAGS +DA2.0W +DS2.0"
1613
 
                    CXXFLAGS="$CXXFLAGS +DA2.0W +DS2.0"
1614
 
                fi
1615
 
            fi
1616
 
        fi
1617
 
        DEFAULT_IMPL_STRATEGY=_PTH
1618
 
    fi
1619
 
 
1620
 
    if test "$DEFAULT_IMPL_STRATEGY" = "_EMU"; then
1621
 
        USE_NSPR_THREADS=1
1622
 
        USE_PTHREADS=
1623
 
        USE_USER_PTHREADS=
1624
 
    elif test "$DEFAULT_IMPL_STRATEGY" = "_PTH"; then
1625
 
        USE_PTHREADS=1
1626
 
        if test "$USE_NSPR_THREADS"; then
1627
 
            USE_PTHREADS=
1628
 
        fi
1629
 
        if test "$USE_USER_PTHREADS"; then
1630
 
            USE_PTHREADS=
1631
 
        fi
1632
 
    fi
1633
 
    ;;
1634
 
 
1635
 
*-irix*)
1636
 
    AC_DEFINE(XP_UNIX)
1637
 
    AC_DEFINE(IRIX)
1638
 
    AC_DEFINE(SVR4)
1639
 
    AC_DEFINE(_SGI_MP_SOURCE)
1640
 
    AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1641
 
    PR_MD_CSRCS=irix.c
1642
 
    PR_MD_ASFILES=os_Irix.s
1643
 
    MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@'
1644
 
    STRIP="$STRIP -f"
1645
 
    RESOLVE_LINK_SYMBOLS=1
1646
 
    if test -n "$USE_64"; then
1647
 
        MDCPUCFG_H=_irix64.cfg
1648
 
    else
1649
 
        MDCPUCFG_H=_irix32.cfg
1650
 
    fi
1651
 
    case "${target_os}" in
1652
 
    irix6*)
1653
 
        AC_DEFINE(IRIX6)
1654
 
        USE_PTHREADS=1
1655
 
        USE_N32=1
1656
 
        COMPILER_TAG=_n32
1657
 
        IMPL_STRATEGY=_PTH
1658
 
        ;;
1659
 
    irix5*)
1660
 
        AC_DEFINE(IRIX5)
1661
 
        USE_NSPR_THREADS=1
1662
 
        ;;
1663
 
    *)
1664
 
        USE_PTHREADS=1
1665
 
        USE_N32=1
1666
 
        ;;
1667
 
    esac
1668
 
    if test "$GNU_CC"; then
1669
 
        dnl
1670
 
        dnl If we are using gcc with native binutils, we need to
1671
 
        dnl suppress the
1672
 
        dnl #lineno "filename" num num
1673
 
        dnl lines, which confuse IRIX native as.  Add -Wp,-P to the
1674
 
        dnl gcc command line, which passes -P to the preprocessor.
1675
 
        dnl
1676
 
            AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
1677
 
            CFLAGS="$CFLAGS -Wall -Wno-format"
1678
 
            _OPTIMIZE_FLAGS="-O6"
1679
 
    else
1680
 
            if test -n "$USE_N32"; then
1681
 
                AS='as -D_ASM $(INCLUDES) -n32'
1682
 
            else
1683
 
                AS='as -D_ASM $(INCLUDES)'
1684
 
            fi
1685
 
            CFLAGS="$CFLAGS -fullwarn -xansi"
1686
 
            if test "$USE_N32"; then
1687
 
                _OPTIMIZE_FLAGS="-O -OPT:Olimit=4000"
1688
 
            else
1689
 
                _OPTIMIZE_FLAGS="-O -Olimit 4000"
1690
 
            fi
1691
 
            if test "$USE_MDUPDATE"; then
1692
 
                CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
1693
 
            fi
1694
 
            case "${target}" in
1695
 
            *-irix6.*)
1696
 
                CFLAGS="$CFLAGS -multigot"
1697
 
                DSO_LDOPTS="-no_unresolved"
1698
 
                if test "$USE_N32"; then
1699
 
                        CFLAGS="$CFLAGS -n32 -woff 1209"
1700
 
                        DSO_LDOPTS="$DSO_LDOPTS -n32"
1701
 
                else
1702
 
                        if test "$USE_64"; then
1703
 
                            CFLAGS="$CFLAGS -64"
1704
 
                        else
1705
 
                            CFLAGS="$CFLAGS -32"
1706
 
                        fi
1707
 
                fi
1708
 
                ;;
1709
 
            *)
1710
 
                CFLAGS="$CFLAGS -xgot"
1711
 
                ;;
1712
 
            esac
1713
 
    fi
1714
 
    if test "${target_os}" = "irix5.3"; then
1715
 
            AC_DEFINE(IRIX5_3)
1716
 
    fi
1717
 
    case "${target_os}" in
1718
 
        irix6.5)
1719
 
            if test -z "$GNU_CC"; then
1720
 
                    CFLAGS="$CFLAGS -mips3"
1721
 
            fi
1722
 
            AC_DEFINE(_PR_HAVE_GETPROTO_R)
1723
 
            AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER)
1724
 
            AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
1725
 
            ;;
1726
 
        irix5*)
1727
 
            ;;
1728
 
        *)
1729
 
            AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
1730
 
            ;;
1731
 
        esac
1732
 
    ;;
1733
 
 
1734
 
*-linux*|*-gnu*|*-k*bsd*-gnu)
1735
 
    if test -z "$USE_NSPR_THREADS"; then
1736
 
        USE_PTHREADS=1
1737
 
        IMPL_STRATEGY=_PTH
1738
 
    fi
1739
 
    AC_DEFINE(XP_UNIX)
1740
 
    AC_DEFINE(_GNU_SOURCE)
1741
 
    AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1742
 
    case "${target_os}" in
1743
 
    linux*)
1744
 
        AC_DEFINE(LINUX)
1745
 
        ;;
1746
 
    esac
1747
 
    CFLAGS="$CFLAGS -Wall"
1748
 
    CXXFLAGS="$CXXFLAGS -Wall"
1749
 
    MDCPUCFG_H=_linux.cfg
1750
 
    PR_MD_CSRCS=linux.c
1751
 
    MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
1752
 
    DSO_CFLAGS=-fPIC
1753
 
    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
1754
 
    _OPTIMIZE_FLAGS=-O2
1755
 
    _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
1756
 
                                   # combo is not yet good at debugging inlined
1757
 
                                   # functions (even when using DWARF2 as the
1758
 
                                   # debugging format)
1759
 
    COMPILER_TAG=_glibc
1760
 
    if echo "$OS_TEST" | grep -c 86 >/dev/null; then
1761
 
        CPU_ARCH=x86
1762
 
    else
1763
 
        CPU_ARCH=$OS_TEST
1764
 
    fi
1765
 
    CPU_ARCH_TAG=_${CPU_ARCH}
1766
 
    case "${target_cpu}" in
1767
 
    alpha)
1768
 
        AC_DEFINE(_ALPHA_)
1769
 
        AC_DEFINE(__alpha)
1770
 
        CFLAGS="$CFLAGS -mieee"
1771
 
        CXXFLAGS="$CXXFLAGS -mieee"
1772
 
        ;;
1773
 
    i*86)
1774
 
        AC_DEFINE(i386)
1775
 
        PR_MD_ASFILES=os_Linux_x86.s
1776
 
        ;;
1777
 
    ia64)
1778
 
        PR_MD_ASFILES=os_Linux_ia64.s
1779
 
        ;;
1780
 
    x86_64)
1781
 
        if test -n "$USE_64"; then
1782
 
            PR_MD_ASFILES=os_Linux_x86_64.s
1783
 
        else
1784
 
            AC_DEFINE(i386)
1785
 
            PR_MD_ASFILES=os_Linux_x86.s
1786
 
            CC="$CC -m32"
1787
 
            CXX="$CXX -m32"
1788
 
        fi
1789
 
        ;;
1790
 
    ppc|powerpc)
1791
 
        PR_MD_ASFILES=os_Linux_ppc.s
1792
 
        ;;
1793
 
    powerpc64)
1794
 
        if test -n "$USE_64"; then
1795
 
            CC="$CC -m64"
1796
 
            CXX="$CXX -m64"
1797
 
        else
1798
 
            PR_MD_ASFILES=os_Linux_ppc.s
1799
 
        fi
1800
 
        ;;
1801
 
    m68k)
1802
 
        CFLAGS="$CFLAGS -m68020-60"
1803
 
        CXXFLAGS="$CXXFLAGS -m68020-60"
1804
 
        ;;
1805
 
    esac    
1806
 
    ;;
1807
 
 
1808
 
*-mingw*|*-cygwin*|*-msvc*|*-mks*)
1809
 
    AC_DEFINE(XP_PC)
1810
 
    AC_DEFINE(WIN32)
1811
 
    PR_MD_ARCH_DIR=windows
1812
 
    RESOLVE_LINK_SYMBOLS=1
1813
 
 
1814
 
    if test -n "$GNU_CC"; then
1815
 
        CC="$CC -mwindows"
1816
 
        CXX="$CXX -mwindows"
1817
 
        DLL_SUFFIX=dll
1818
 
        MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
1819
 
        RC=$WINDRES
1820
 
        # Use temp file for windres (bug 213281)
1821
 
        RCFLAGS='-O coff --use-temp-file'
1822
 
    else
1823
 
        CC=cl
1824
 
        CXX=cl
1825
 
        LD=link
1826
 
        AR='lib -NOLOGO -OUT:"$@"'
1827
 
        AR_FLAGS=
1828
 
        RANLIB='echo not_ranlib'
1829
 
        STRIP='echo not_strip'
1830
 
        RC=rc.exe
1831
 
        GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1832
 
        OBJ_SUFFIX=obj
1833
 
        LIB_SUFFIX=lib
1834
 
        DLL_SUFFIX=dll
1835
 
 
1836
 
        # Determine compiler version
1837
 
        changequote(,)
1838
 
        _MSVC_VER_FILTER='s|.* \([0-9]\+\.[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?\).*|\1|p'
1839
 
        changequote([,])
1840
 
        CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
1841
 
        _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'`
1842
 
        _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'`
1843
 
        _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'`
1844
 
        _CC_BUILD=`echo ${CC_VERSION} | awk -F\. '{ print $4 }'`
1845
 
        MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
1846
 
 
1847
 
        if test "$_CC_MAJOR_VERSION" -eq "14"; then
1848
 
           dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
1849
 
           dnl so be very specific here!
1850
 
           dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
1851
 
           if test $_CC_RELEASE -gt 50727; then
1852
 
              _USE_DYNAMICBASE=1
1853
 
           elif test $_CC_BUILD -ge 762; then
1854
 
              _USE_DYNAMICBASE=1
1855
 
           fi
1856
 
           AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
1857
 
           AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
1858
 
        elif test $_CC_MAJOR_VERSION -ge 15; then
1859
 
           _USE_DYNAMICBASE=1    
1860
 
           AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
1861
 
           AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
1862
 
        fi
1863
 
 
1864
 
        if test -n "$_USE_DYNAMICBASE"; then
1865
 
           DLLFLAGS="$DLLFLAGS -DYNAMICBASE"
1866
 
        fi
1867
 
 
1868
 
        # Ensure that mt is Microsoft (R) Manifest Tool and not magnetic
1869
 
        # tape manipulation utility (or something else)
1870
 
        if test "$MSC_VER" -ge "1400"; then
1871
 
            changequote(,)
1872
 
            _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
1873
 
            changequote([,])
1874
 
 
1875
 
            MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
1876
 
            if test -n "$MSMT_TOOL"; then
1877
 
                MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
1878
 
                if test -z "$MSMANIFEST_TOOL_VERSION"; then
1879
 
                    AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
1880
 
                fi
1881
 
                MT=mt
1882
 
                unset MSMT_TOOL
1883
 
            else
1884
 
                AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
1885
 
            fi
1886
 
        fi
1887
 
        
1888
 
        CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
1889
 
        DLLFLAGS="$DLLFLAGS -OUT:\"\$@\""
1890
 
        _DEBUG_FLAGS=-Zi
1891
 
        _OPTIMIZE_FLAGS=-O2
1892
 
 
1893
 
        PROFILE_GEN_CFLAGS="-GL"
1894
 
        PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1895
 
        PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1896
 
        PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1897
 
 
1898
 
        if test -z "$MOZ_OPTIMIZE"; then
1899
 
            CFLAGS="$CFLAGS -Od"
1900
 
        fi
1901
 
 
1902
 
        if test -n "$USE_DEBUG_RTL"; then
1903
 
            CFLAGS="$CFLAGS -MDd"
1904
 
        else
1905
 
            CFLAGS="$CFLAGS -MD"
1906
 
        fi
1907
 
 
1908
 
        if test -n "$MOZ_DEBUG"; then
1909
 
            AC_DEFINE(_DEBUG)
1910
 
        else
1911
 
            DEFINES="$DEFINES -U_DEBUG"
1912
 
        fi
1913
 
 
1914
 
        if test -n "$MOZ_DEBUG_SYMBOLS"; then
1915
 
            if test -n "$MOZ_OPTIMIZE"; then
1916
 
                DLLFLAGS="$DLLFLAGS -DEBUG -OPT:REF"
1917
 
                LDFLAGS="$LDFLAGS -DEBUG -OPT:REF"
1918
 
            else
1919
 
                DLLFLAGS="$DLLFLAGS -DEBUG"
1920
 
                LDFLAGS="$LDFLAGS -DEBUG"
1921
 
            fi
1922
 
        fi
1923
 
 
1924
 
        OS_DLLFLAGS="-nologo -DLL -SUBSYSTEM:WINDOWS"
1925
 
        if test "$MSC_VER" -le "1200" -a -z "$MOZ_DEBUG_SYMBOLS"; then
1926
 
            OS_DLLFLAGS="$OS_DLLFLAGS -PDB:NONE"
1927
 
        fi
1928
 
        
1929
 
        if test "$OS_TARGET" = "WINNT"; then
1930
 
            CFLAGS="$CFLAGS -GT"
1931
 
            LIBNSPR='$(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1932
 
            LIBPLC='$(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1933
 
        else
1934
 
            LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1935
 
            LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1936
 
        fi
1937
 
    fi # GNU_CC
1938
 
 
1939
 
    if test -n "$USE_STATIC_TLS"; then
1940
 
        AC_DEFINE(_PR_USE_STATIC_TLS)
1941
 
    fi
1942
 
 
1943
 
    if test "$OS_TARGET" = "WINNT"; then
1944
 
        AC_DEFINE(WINNT)
1945
 
    else
1946
 
        AC_DEFINE(WIN95)
1947
 
        # undefine WINNT as some versions of mingw gcc define it by default
1948
 
        DEFINES="$DEFINES -UWINNT"
1949
 
        AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
1950
 
    fi
1951
 
 
1952
 
    if test "$CPU_ARCH" = "x86"; then
1953
 
        CPU_ARCH_TAG=
1954
 
    else
1955
 
        CPU_ARCH_TAG=$CPU_ARCH
1956
 
    fi
1957
 
 
1958
 
    if test -n "$USE_DEBUG_RTL"; then
1959
 
        OBJDIR_SUFFIX=OBJD
1960
 
    fi
1961
 
 
1962
 
    case "$OS_TARGET" in
1963
 
    WINNT)
1964
 
            MDCPUCFG_H=_winnt.cfg
1965
 
            ;;
1966
 
    WIN95)
1967
 
            MDCPUCFG_H=_win95.cfg
1968
 
            ;;
1969
 
    *)
1970
 
            AC_MSG_ERROR([Missing OS_TARGET for ${target}.  Use --enable-win32-target to set.])
1971
 
        ;;
1972
 
    esac
1973
 
 
1974
 
    case "$target_cpu" in
1975
 
    i*86)
1976
 
        if test -n "$USE_64"; then
1977
 
            AC_DEFINE(_AMD64_)
1978
 
        else            
1979
 
            AC_DEFINE(_X86_)
1980
 
        fi
1981
 
        ;;
1982
 
    x86_64)
1983
 
            AC_DEFINE(_AMD64_)
1984
 
            USE_64=1
1985
 
            ;;
1986
 
    ia64)
1987
 
            AC_DEFINE(_IA64_)
1988
 
            USE_64=1
1989
 
            ;;
1990
 
    *)
1991
 
            AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1992
 
            ;;
1993
 
    esac
1994
 
    ;;
1995
 
 
1996
 
*-wince*|*-winmo*)
1997
 
    AC_DEFINE(XP_PC)
1998
 
    AC_DEFINE(WIN32)
1999
 
    AC_DEFINE(WINCE)
2000
 
    AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
2001
 
 
2002
 
    AR_FLAGS='-NOLOGO -OUT:"$@"'
2003
 
 
2004
 
    OBJ_SUFFIX=obj
2005
 
    LIB_SUFFIX=lib
2006
 
    DLL_SUFFIX=dll
2007
 
    MKSHLIB='$(LD) -DLL $(DSO_LDOPTS) -OUT:$@'
2008
 
 
2009
 
    PR_MD_ARCH_DIR=windows
2010
 
    RESOLVE_LINK_SYMBOLS=1
2011
 
 
2012
 
    MDCPUCFG_H=_win95.cfg
2013
 
    LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
2014
 
    LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
2015
 
 
2016
 
    DLLFLAGS='-OUT:"$@"'
2017
 
    if test -n "$MOZ_DEBUG_SYMBOLS"; then
2018
 
        OS_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2019
 
        OS_DLLFLAGS='-DEBUG -DEBUGTYPE:CV'
2020
 
        DSO_LDOPTS='-DEBUG -DEBUGTYPE:CV'
2021
 
    fi
2022
 
    _DEBUG_FLAGS=-Zi
2023
 
    _OPTIMIZE_FLAGS=-O2
2024
 
    ;;
2025
 
 
2026
 
*-ncr-sysv*)
2027
 
    AC_DEFINE(XP_UNIX)
2028
 
    AC_DEFINE(SVR4)
2029
 
    AC_DEFINE(SYSV)
2030
 
    AC_DEFINE(NCR)
2031
 
    USE_NSPR_THREADS=1
2032
 
    if test "$OS_RELEASE" = "2.03"; then
2033
 
        AC_DEFINE(_PR_STAT_HAS_ST_ATIM)
2034
 
    else
2035
 
        AC_DEFINE(_PR_STAT_HAS_ST_ATIM_UNION)
2036
 
    fi
2037
 
 
2038
 
    if test -z "$GNU_CC"; then
2039
 
        CFLAGS="$CFLAGS -Hnocopyr"
2040
 
        CXXFLAGS="$CXXFLAGS -Hnocopyr"
2041
 
    else
2042
 
        CFLAGS="$CFLAGS -fPIC -Wall"
2043
 
        CXXFLAGS="$CXXFLAGS -fPIC -Wall"
2044
 
        DSO_LDOPTS=-G
2045
 
    fi
2046
 
    MDCPUCFG_H=_ncr.cfg
2047
 
    PR_MD_CSRCS=ncr.c
2048
 
    ;;
2049
 
 
2050
 
mips-nec-sysv*)
2051
 
    AC_DEFINE(XP_UNIX)
2052
 
    AC_DEFINE(SVR4)
2053
 
    AC_DEFINE(__SVR4)
2054
 
    AC_DEFINE(NEC)
2055
 
    AC_DEFINE(nec_ews)
2056
 
    USE_NSPR_THREADS=1
2057
 
    if test -z "$GNU_CC"; then
2058
 
        CC='$(NSDEPTH)/build/hcc cc -Xa -KGnum=0 -KOlimit=4000'
2059
 
        CXX=g++
2060
 
    fi
2061
 
    OS_LIBS="$OS_LIBS -lsocket -lnsl -ldl"
2062
 
    DSO_LDOPTS=-G
2063
 
    MDCPUCFG_H=_nec.cfg
2064
 
    PR_MD_CSRCS=nec.c
2065
 
    ;;
2066
 
 
2067
 
*-netbsd*)
2068
 
    AC_DEFINE(XP_UNIX)
2069
 
    AC_DEFINE(NETBSD)
2070
 
    AC_DEFINE(HAVE_BSD_FLOCK)
2071
 
    if test -z "$USE_NSPR_THREADS"; then
2072
 
        USE_PTHREADS=1
2073
 
    fi
2074
 
    MDCPUCFG_H=_netbsd.cfg
2075
 
    PR_MD_CSRCS=netbsd.c
2076
 
 
2077
 
    DSO_CFLAGS='-fPIC -DPIC'
2078
 
    CFLAGS="$CFLAGS -ansi -Wall"
2079
 
    CXXFLAGS="$CXXFLAGS -ansi -Wall"
2080
 
    MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
2081
 
 
2082
 
    if test -z "$OBJECT_FMT"; then
2083
 
        if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ 2>/dev/null; then
2084
 
            OBJECT_FMT=a.out
2085
 
            DLL_SUFFIX=so.1.0
2086
 
            DSO_LDOPTS='-shared'
2087
 
        else
2088
 
            OBJECT_FMT=ELF
2089
 
            DLL_SUFFIX=so
2090
 
            DSO_LDOPTS='-shared -Wl,-soname,$(notdir $@)'
2091
 
        fi
2092
 
    fi
2093
 
 
2094
 
    if test "$LIBRUNPATH"; then
2095
 
        DSO_LDOPTS="$DSO_LDOPTS -Wl,-R$LIBRUNPATH"
2096
 
    fi
2097
 
    ;;
2098
 
 
2099
 
mips-sony-newsos*)
2100
 
    AC_DEFINE(XP_UNIX)
2101
 
    AC_DEFINE(SONY)
2102
 
    AC_DEFINE(SYSV)
2103
 
    AC_DEFINE(SVR4)
2104
 
    AC_DEFINE(__svr4)
2105
 
    AC_DEFINE(__svr4__)
2106
 
    AC_DEFINE(HAVE_SVID_GETTOD)
2107
 
    USE_NSPR_THREADS=1
2108
 
    CFLAGS="$CFLAGS -Xa -fullwarn"
2109
 
    CXXFLAGS="$CXXFLAGS -Xa -fullwarn"
2110
 
    DSO_LDOPTS=-G
2111
 
    MDCPUCFG_H=_sony.cfg
2112
 
    PR_MD_CSRCS=sony.c
2113
 
    ;;
2114
 
 
2115
 
*-nextstep*|*-openstep*)
2116
 
    AC_DEFINE(XP_UNIX)
2117
 
    AC_DEFINE(NEXTSTEP)
2118
 
    AC_DEFINE(HAVE_BSD_FLOCK)
2119
 
    AC_DEFINE(_POSIX_SOURCE)
2120
 
    CFLAGS="$CFLAGS -Wall -fno-common -traditional-cpp -posix"
2121
 
    CXXFLAGS="$CXXFLAGS -Wall -fno-common -traditional-cpp -posix"
2122
 
    USE_NSPR_THREADS=1
2123
 
    DLL_SUFFIX=dylib
2124
 
    MDCPUCFG_H=_nextstep.cfg
2125
 
    PR_MD_CSRCS=nextstep.c
2126
 
    ;;
2127
 
 
2128
 
 
2129
 
*-nto*)
2130
 
    AC_DEFINE(XP_UNIX)
2131
 
    AC_DEFINE(NTO)
2132
 
    AC_DEFINE(_QNX_SOURCE)
2133
 
    AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2134
 
    MDCPUCFG_H=_nto.cfg
2135
 
    PR_MD_CSRCS=nto.c
2136
 
    MKSHLIB='$(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(notdir $@) -o $@'
2137
 
    DSO_CFLAGS=-fPIC
2138
 
    DSO_LDOPTS=-shared
2139
 
    OS_LIBS="$OS_LIBS -lsocket"
2140
 
    _OPTIMIZE_FLAGS="-O1"
2141
 
    _DEBUG_FLAGS="-gstabs"
2142
 
        ;;
2143
 
 
2144
 
*-openbsd*)
2145
 
    AC_DEFINE(XP_UNIX)
2146
 
    AC_DEFINE(OPENBSD)
2147
 
    AC_DEFINE(HAVE_BSD_FLOCK)
2148
 
    AC_DEFINE(HAVE_SOCKLEN_T)
2149
 
    CFLAGS="$CFLAGS -ansi -Wall"
2150
 
    CXXFLAGS="$CXXFLAGS -ansi -Wall"
2151
 
    DLL_SUFFIX=so.1.0
2152
 
    DSO_CFLAGS=-fPIC
2153
 
    MDCPUCFG_H=_openbsd.cfg
2154
 
    PR_MD_CSRCS=openbsd.c
2155
 
    OS_LIBS="-lc"
2156
 
    if test -z "$USE_NSPR_THREADS"; then
2157
 
        USE_PTHREADS=1
2158
 
    fi
2159
 
    DSO_LDOPTS='-shared -fPIC'
2160
 
    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2161
 
    ;;
2162
 
 
2163
 
*-osf*)
2164
 
    SHELL_OVERRIDE="SHELL               = /usr/bin/ksh"
2165
 
    AC_DEFINE(XP_UNIX)
2166
 
    AC_DEFINE(OSF1)
2167
 
    AC_DEFINE(_REENTRANT)
2168
 
    # OSF1 and HPUX report the POLLHUP event for a socket when the
2169
 
    # shutdown(SHUT_WR) operation is called for the remote end, even though
2170
 
    # the socket is still writeable. Use select(), instead of poll(), to
2171
 
    # workaround this problem.
2172
 
    AC_DEFINE(_PR_POLL_WITH_SELECT)
2173
 
 
2174
 
    if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then
2175
 
        USE_NSPR_THREADS=1
2176
 
    fi
2177
 
 
2178
 
    if test -z "$GNU_CC"; then
2179
 
        CC="$CC -std1 -ieee_with_inexact"
2180
 
        if test "$OS_RELEASE" != "V2.0"; then
2181
 
            CC="$CC -readonly_strings"
2182
 
        fi
2183
 
        _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
2184
 
        AC_CHECK_HEADER(machine/builtins.h, AC_DEFINE(OSF1_HAVE_MACHINE_BUILTINS_H))
2185
 
    else
2186
 
        CFLAGS="$CFLAGS -mieee"
2187
 
        CXXFLAGS="$CXXFLAGS -mieee"
2188
 
    fi
2189
 
 
2190
 
    if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
2191
 
        AC_DEFINE(HAVE_INT_LOCALTIME_R)
2192
 
    else
2193
 
        AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
2194
 
        AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2195
 
    fi
2196
 
    if echo $OS_RELEASE | grep -c V4.0 >/dev/null; then
2197
 
        AC_DEFINE(OSF1V4_MAP_PRIVATE_BUG)
2198
 
    fi
2199
 
    DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
2200
 
    MDCPUCFG_H=_osf1.cfg
2201
 
    PR_MD_CSRCS=osf1.c
2202
 
    ;;
2203
 
 
2204
 
*-qnx*)
2205
 
    AC_DEFINE(XP_UNIX)
2206
 
    AC_DEFINE(QNX)
2207
 
    AC_DEFINE(_PR_NEED_H_ERRNO)
2208
 
    USE_NSPR_THREADS=1
2209
 
    MDCPUCFG_H=_qnx.cfg
2210
 
    PR_MD_CSRCS=qnx.c
2211
 
    ;;
2212
 
 
2213
 
*-riscos*)
2214
 
    AC_DEFINE(XP_UNIX)
2215
 
    AC_DEFINE(RISCOS)
2216
 
    AC_DEFINE(_PR_NEED_H_ERRNO)
2217
 
    USE_PTHREADS=1
2218
 
    MDCPUCFG_H=_riscos.cfg
2219
 
    PR_MD_CSRCS=riscos.c
2220
 
    DSO_CFLAGS=-fPIC
2221
 
    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
2222
 
    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2223
 
    ;;
2224
 
 
2225
 
*-*-sco*)
2226
 
    AC_DEFINE(XP_UNIX)
2227
 
    AC_DEFINE(SCO)
2228
 
    AC_DEFINE(sco)
2229
 
    AC_DEFINE(SYSV)
2230
 
    AC_DEFINE(_SVID3)
2231
 
    AC_DEFINE(_PR_NEED_H_ERRNO)
2232
 
    CC='cc -b elf -KPIC'
2233
 
    CXX='$(NSDEPTH)/build/hcpp CC +.cpp +w'
2234
 
    USE_NSPR_THREADS=1
2235
 
    CPU_ARCH=x86
2236
 
    DSO_LDOPTS='-b elf -G'
2237
 
    MDCPUCFG_H=_scoos.cfg
2238
 
    PR_MD_SRCS=scoos.c
2239
 
    ;;
2240
 
 
2241
 
*-sinix*)
2242
 
    AC_DEFINE(XP_UNIX)
2243
 
    AC_DEFINE(SVR4)
2244
 
    AC_DEFINE(SNI)
2245
 
    AC_DEFINE(RELIANTUNIX)
2246
 
    AC_DEFINE(sinix)
2247
 
    AC_DEFINE(HAVE_SVID_GETTOD)
2248
 
    if echo "$OS_TEST" | grep -c 86 2>/dev/null; then
2249
 
        AC_DEFINE(i386)
2250
 
        CPU_ARCH=x86
2251
 
    else
2252
 
        CPU_ARCH=mips
2253
 
    fi
2254
 
 
2255
 
    if test "$GNU_CC"; then
2256
 
        AS='$(CC) -x assembler-with-cpp'
2257
 
        if test "$CPU_ARCH" = "mips"; then
2258
 
            LD=gld
2259
 
        fi
2260
 
        CFLAGS="$CFLAGS -Wall -Wno-format"
2261
 
    else
2262
 
        AS='/usr/bin/cc'
2263
 
        _OPTIMIZE_FLAGS='-O -F Olimit,4000'
2264
 
    fi
2265
 
 
2266
 
    DSO_LDOPTS='-G -z defs -h $(@:$(OBJDIR)/%.so=%.so)'
2267
 
 
2268
 
    if test "$OS_RELEASE" = "5.43"; then
2269
 
        AC_DEFINE(IP_MULTICAST)
2270
 
    fi
2271
 
 
2272
 
    OS_LIBS="$OS_LIBS -lsocket -lnsl -lresolv -ldl -lc"
2273
 
    USE_NSPR_THREADS=1
2274
 
    MDCPUCFG_H=_reliantunix.cfg
2275
 
    PR_MD_CSRCS=reliantunix.c
2276
 
    if test "${OS_ARCH}" = "mips"; then
2277
 
        PR_MD_ASFILES=os_ReliantUNIX.s
2278
 
    fi
2279
 
    ;;
2280
 
 
2281
 
*-sunos*)
2282
 
    AC_DEFINE(XP_UNIX)
2283
 
    AC_DEFINE(SUNOS4)
2284
 
    CFLAGS="$CFLAGS -Wall -Wno-format"
2285
 
    if test "$USE_MDUPDATE"; then
2286
 
        CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
2287
 
    fi
2288
 
    CPU_ARCH=sparc
2289
 
    DLL_SUFFIX=so.1.0
2290
 
    DSO_LDOPTS=
2291
 
    DSO_CFLAGS=-fPIC
2292
 
    USE_NSPR_THREADS=1
2293
 
    if test "$OS_RELEASE" = "4.1.3_U1"; then
2294
 
        _OPTIMIZE_FLAGS=
2295
 
        OS_LIBS="$OS_LIBS -lm"
2296
 
    fi
2297
 
    MDCPUCFG_H=_sunos4.cfg
2298
 
    PR_MD_CSRCS=sunos4.c
2299
 
    ;;
2300
 
 
2301
 
*-solaris*)
2302
 
    if test -z "$USE_NSPR_THREADS"; then
2303
 
        USE_PTHREADS=1
2304
 
    fi
2305
 
    AC_DEFINE(XP_UNIX)
2306
 
    AC_DEFINE(SVR4)
2307
 
    AC_DEFINE(SYSV)
2308
 
    AC_DEFINE(__svr4)
2309
 
    AC_DEFINE(__svr4__)
2310
 
    AC_DEFINE(SOLARIS)
2311
 
    AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
2312
 
    CPU_ARCH=`uname -p`
2313
 
    MDCPUCFG_H=_solaris.cfg
2314
 
    PR_MD_CSRCS=solaris.c
2315
 
    LD=/usr/ccs/bin/ld
2316
 
    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2317
 
    RESOLVE_LINK_SYMBOLS=1
2318
 
    case "${OS_RELEASE}" in
2319
 
    5.8|5.9)
2320
 
        ;;
2321
 
    *)
2322
 
        # It is safe to use the -Bdirect linker flag on Solaris 10 or later.
2323
 
        USE_B_DIRECT=1
2324
 
        ;;
2325
 
    esac
2326
 
    if test -n "$GNU_CC"; then
2327
 
        DSO_CFLAGS=-fPIC
2328
 
        if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
2329
 
            GCC_USE_GNU_LD=1
2330
 
        fi
2331
 
        DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore' 
2332
 
        if test -n "$USE_B_DIRECT"; then
2333
 
            DSO_LDOPTS="$DSO_LDOPTS,-Bdirect"
2334
 
        fi
2335
 
    else
2336
 
        DSO_CFLAGS=-KPIC
2337
 
        DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore'
2338
 
        if test -n "$USE_B_DIRECT"; then
2339
 
            DSO_LDOPTS="$DSO_LDOPTS -Bdirect"
2340
 
        fi
2341
 
    fi
2342
 
    if test -n "$GNU_CC"; then
2343
 
        CFLAGS="$CFLAGS -Wall"
2344
 
        CXXFLAGS="$CXXFLAGS -Wall"
2345
 
        if test -n "$USE_MDUPDATE"; then
2346
 
            CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
2347
 
            CXXFLAGS="$CXXFLAGS -MDupdate \$(DEPENDENCIES)"
2348
 
        fi
2349
 
        GCC_AS=`$CC -print-prog-name=as`
2350
 
        if test "`echo | $GCC_AS -v 2>&1 | grep -c GNU`" != "0"; then
2351
 
            GNU_AS=1
2352
 
        fi
2353
 
    else
2354
 
        CFLAGS="$CFLAGS -xstrconst"
2355
 
        CXXFLAGS="$CXXFLAGS -Qoption cg -xstrconst -features=tmplife"
2356
 
        if test -z "$MOZ_OPTIMIZE"; then
2357
 
            CFLAGS="$CFLAGS -xs"
2358
 
            CXXFLAGS="$CXXFLAGS -xs"
2359
 
        fi
2360
 
        _OPTIMIZE_FLAGS=-xO4
2361
 
    fi
2362
 
    if test -z "$GNU_AS"; then
2363
 
        ASFLAGS="$ASFLAGS -Wa,-P"
2364
 
    fi
2365
 
    if test -n "$USE_64"; then
2366
 
        if test -n "$GNU_CC"; then
2367
 
            CC="$CC -m64"
2368
 
            CXX="$CXX -m64"
2369
 
        else
2370
 
            if test "$OS_TEST" = "i86pc"; then
2371
 
                CC="$CC -xarch=amd64"
2372
 
                CXX="$CXX -xarch=amd64"
2373
 
            else
2374
 
                CC="$CC -xarch=v9"
2375
 
                CXX="$CXX -xarch=v9"
2376
 
            fi
2377
 
        fi
2378
 
    fi
2379
 
    if test "$OS_TEST" = "i86pc"; then
2380
 
        if test -z "$USE_64"; then
2381
 
            AC_DEFINE(i386)
2382
 
        fi
2383
 
        CPU_ARCH_TAG=_$OS_TEST
2384
 
        # The default debug format, DWARF (-g), is not supported by gcc
2385
 
        # on i386-ANY-sysv4/solaris, but the stabs format is.  It is
2386
 
        # assumed that the Solaris assembler /usr/ccs/bin/as is used.
2387
 
        # If your gcc uses GNU as, you do not need the -Wa,-s option.
2388
 
        if test -n "$MOZ_DEBUG" && test -n "$GNU_CC"; then
2389
 
            _DEBUG_FLAGS=-gstabs
2390
 
            if test -z "$GNU_AS"; then
2391
 
                _DEBUG_FLAGS="$_DEBUG_FLAGS -Wa,-s"
2392
 
            fi
2393
 
        fi
2394
 
    fi
2395
 
    case "${target_os}" in
2396
 
    solaris2.3*)
2397
 
        AC_DEFINE(_PR_NO_LARGE_FILES)
2398
 
        ;;
2399
 
    solaris2.4*)
2400
 
        AC_DEFINE(_PR_NO_LARGE_FILES)
2401
 
        ;;
2402
 
    solaris2.5*)
2403
 
        AC_DEFINE(SOLARIS2_5)    
2404
 
        ;;
2405
 
    *)
2406
 
        AC_DEFINE(_PR_HAVE_OFF64_T)
2407
 
        # The lfcompile64(5) man page on Solaris 2.6 says:
2408
 
        #     For applications that do not wish to conform to the POSIX or
2409
 
        #     X/Open  specifications,  the  64-bit transitional interfaces
2410
 
        #     are available by default.  No compile-time flags need to  be
2411
 
        #     set.
2412
 
        # But gcc 2.7.2.x fails to define _LARGEFILE64_SOURCE by default.
2413
 
        # The native compiler, gcc 2.8.x, and egcs don't have this problem.
2414
 
        if test -n "$GNU_CC"; then
2415
 
            AC_DEFINE(_LARGEFILE64_SOURCE)
2416
 
        fi
2417
 
        ;;
2418
 
    esac
2419
 
    case "${target_os}" in
2420
 
    solaris2.3*)
2421
 
        ;;
2422
 
    solaris2.4*)
2423
 
        ;;
2424
 
    solaris2.5*)
2425
 
        ;;
2426
 
    solaris2.6*)
2427
 
        ;;
2428
 
    solaris2.7*)
2429
 
        ;;
2430
 
    *)
2431
 
        # Solaris 8 or higher has IPv6.
2432
 
        AC_DEFINE(_PR_INET6)
2433
 
        ;;
2434
 
    esac
2435
 
    if test "$CPU_ARCH" = "sparc"; then
2436
 
        # 64-bit Solaris SPARC requires V9 architecture, so the following
2437
 
        # is not needed.
2438
 
        if test -z "$USE_64"; then
2439
 
            ULTRASPARC_LIBRARY=nspr_flt
2440
 
        fi
2441
 
    fi
2442
 
    # Purify requires that binaries linked against nspr also
2443
 
    # be linked against -lrt (or -lposix4) so add it to OS_LIBS
2444
 
    _rev=`uname -r`
2445
 
    _librt=`echo $_rev 5.6 | awk '{ if ($1 > $2) print "-lrt"; else print "-lposix4" }'`
2446
 
    OS_LIBS="$OS_LIBS $_librt"
2447
 
    ;;
2448
 
 
2449
 
*-sco-sysv5*)
2450
 
    AC_DEFINE(XP_UNIX)
2451
 
    AC_DEFINE(UNIXWARE)
2452
 
    AC_DEFINE(SVR4)
2453
 
    AC_DEFINE(SYSV)
2454
 
    USE_NSPR_THREADS=1
2455
 
    if echo $OS_RELEASE | grep -c 2.1 2>/dev/null; then
2456
 
        AC_DEFINE(_PR_NO_LARGE_FILES)
2457
 
        CC='$(NSDEPTH)/build/hcc cc'
2458
 
        CXX='$(NSDEPTH)/build/hcpp CC'
2459
 
        MDCPUCFG_H=_unixware.cfg
2460
 
    else
2461
 
        AC_DEFINE(_LARGEFILE64_SOURCE)
2462
 
        AC_DEFINE(_PR_HAVE_OFF64_T)
2463
 
        AC_DEFINE(_PR_HAVE_SOCKADDR_LEN)
2464
 
        MDCPUCFG_H=_unixware7.cfg
2465
 
    fi
2466
 
    PR_MD_CSRCS=unixware.c
2467
 
    DSO_LDOPTS=-G
2468
 
    CPU_ARCH=x86
2469
 
    ;;
2470
 
 
2471
 
*-symbian*)
2472
 
    AC_ARG_WITH(symbian-sdk,
2473
 
    [  --with-symbian-sdk=SYMBIAN_SDK_DIR
2474
 
                          The path to the Symbian SDK],
2475
 
    SYMBIAN_SDK_DIR=$withval)
2476
 
 
2477
 
    echo -----------------------------------------------------------------------------
2478
 
    echo Building with Symbian SDK in: $SYMBIAN_SDK_DIR
2479
 
    echo -----------------------------------------------------------------------------
2480
 
 
2481
 
    AC_DEFINE(XP_UNIX)
2482
 
    AC_DEFINE(SYMBIAN)
2483
 
    AC_DEFINE(__arm__)
2484
 
    AC_DEFINE(__SYMBIAN32__)
2485
 
    AC_DEFINE(_UNICODE)
2486
 
    AC_DEFINE(NDEBUG)
2487
 
    AC_DEFINE(__SUPPORT_CPP_EXCEPTIONS__)
2488
 
    AC_DEFINE(MOZ_STDERR_TO_STDOUT)
2489
 
    AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
2490
 
    AC_DEFINE(HAVE_SOCKLEN_T)
2491
 
    USE_PTHREADS=1
2492
 
    LIB_SUFFIX=lib
2493
 
    DLL_SUFFIX=dll
2494
 
    MKSHLIB=
2495
 
    DSO_LDOPTS=
2496
 
    DSO_CFLAGS=
2497
 
    VISIBILITY_FLAGS=
2498
 
    MDCPUCFG_H=_symbian.cfg
2499
 
    PR_MD_CSRCS=symbian.c
2500
 
    NSINSTALL=nsinstall
2501
 
    RANLIB='echo no ranlib '
2502
 
    CPU_ARCH=ARM
2503
 
    OS_ARCH=SYMBIAN
2504
 
    OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
2505
 
    CFLAGS="$CFLAGS -MD -nostdinc"
2506
 
    SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
2507
 
    echo -------------------------------------------------------
2508
 
    echo SYMBIAN_SYS_INCLUDE is: $SYMBIAN_SYS_INCLUDE
2509
 
    echo -------------------------------------------------------
2510
 
    case "$OS_TARGET" in
2511
 
    WINSCW)
2512
 
        CC=mwccsym2.exe
2513
 
        CXX=mwccsym2.exe
2514
 
        LD=mwldsym2.exe
2515
 
        AR=mwldsym2.exe
2516
 
        WINSCW_LD_DIR="\$(SYMBIAN_SDK_DIR)/EPOC32/RELEASE/WINSCW/UDEB"
2517
 
        CFLAGS="$CFLAGS -O0 -inline off -wchar_t off -align 4 -warnings on -w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostderr -gccdep -cwd source -i- -I\$(VPATH)"
2518
 
        SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include Symbian_OS_v9.2.hrh"
2519
 
        AR_FLAGS="-library -msgstyle gcc -stdlib -subsystem windows -noimplib -o \$@"
2520
 
        AC_DEFINE(_DEBUG)
2521
 
        AC_DEFINE(__CW32__)
2522
 
        AC_DEFINE(__WINS__)
2523
 
        AC_DEFINE(__WINSCW__)
2524
 
        DEFINES="$DEFINES -U_WIN32"
2525
 
            ;;
2526
 
    GCCE)
2527
 
        CFLAGS="$CFLAGS -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -x c -msoft-float"
2528
 
        CXXFLAGS="$CXXFLAGS $CFLAGS -Wno-ctor-dtor-privacy"
2529
 
        SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h"
2530
 
        AC_DEFINE(__GCCE__)
2531
 
        AC_DEFINE(__EABI__)
2532
 
        DEFINES="$DEFINES -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
2533
 
            ;;
2534
 
    *)
2535
 
            AC_MSG_ERROR([Missing OS_TARGET for ${target}. Set --enable-symbian-target to with 'WINSCW' or 'GCCE'.])
2536
 
        ;;
2537
 
    esac
2538
 
    CFLAGS="$CFLAGS ${SYMBIAN_SYS_INCLUDE}"
2539
 
    ;;
2540
 
 
2541
 
*-os2*)
2542
 
    AC_DEFINE(XP_OS2)
2543
 
    AC_DEFINE(XP_PC)
2544
 
    AC_DEFINE(BSD_SELECT)
2545
 
    AC_DEFINE(TCPV40HDRS)
2546
 
    LIB_SUFFIX=lib
2547
 
    DLL_SUFFIX=dll
2548
 
    RC=rc.exe
2549
 
    PR_MD_ARCH_DIR=os2
2550
 
    PROG_SUFFIX=.exe
2551
 
    NSINSTALL=nsinstall
2552
 
    MDCPUCFG_H=_os2.cfg
2553
 
    RESOLVE_LINK_SYMBOLS=1
2554
 
 
2555
 
    AC_DEFINE(OS2)
2556
 
    AR=emxomfar
2557
 
    AR_FLAGS='r $@'
2558
 
    CFLAGS="$CFLAGS -Wall -Zomf"
2559
 
    CXXFLAGS="$CFLAGS -Wall -Zomf"
2560
 
    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2561
 
    DSO_CFLAGS=
2562
 
    DSO_LDOPTS='-Zomf -Zdll'
2563
 
    LDFLAGS='-Zmap'
2564
 
    _OPTIMIZE_FLAGS="-O2 -s"
2565
 
    _DEBUG_FLAGS="-g -fno-inline"
2566
 
    if test -n "$MOZ_OPTIMIZE"; then
2567
 
      DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2568
 
    fi
2569
 
    IMPLIB='emximp -o'
2570
 
    FILTER='emxexp -o'
2571
 
    if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2572
 
      LDFLAGS="$LDFLAGS -Zhigh-mem"
2573
 
      AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2574
 
    fi
2575
 
 
2576
 
    # GCC for OS/2 currently predefines these, but we don't want them
2577
 
    DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
2578
 
    ;;
2579
 
 
2580
 
*)
2581
 
    AC_DEFINE(XP_UNIX)
2582
 
    ;;
2583
 
   
2584
 
esac
2585
 
 
2586
 
if test -z "$SKIP_LIBRARY_CHECKS"; then
2587
 
dnl ========================================================
2588
 
dnl Check for system libraries
2589
 
dnl ========================================================
2590
 
dnl AC_CHECK_LIB(C, main)
2591
 
dnl AC_CHECK_LIB(C_r, main)
2592
 
dnl AC_CHECK_LIB(c, main)
2593
 
dnl AC_CHECK_LIB(c_r, main)
2594
 
dnl AC_CHECK_LIB(dce, main)
2595
 
dnl AC_CHECK_LIB(dl, main)
2596
 
dnl AC_CHECK_LIB(dld, main)
2597
 
dnl AC_CHECK_LIB(gen, main)
2598
 
dnl AC_CHECK_LIB(ip6, main)
2599
 
dnl AC_CHECK_LIB(l, main)
2600
 
dnl AC_CHECK_LIB(m, main)
2601
 
dnl AC_CHECK_LIB(nsl, main)
2602
 
dnl AC_CHECK_LIB(posix4, main)
2603
 
dnl AC_CHECK_LIB(prstrms, main)
2604
 
dnl AC_CHECK_LIB(prstrms_shr, main)
2605
 
dnl AC_CHECK_LIB(pthread, main)
2606
 
dnl AC_CHECK_LIB(pthreads, main)
2607
 
dnl AC_CHECK_LIB(resolv, main)
2608
 
dnl AC_CHECK_LIB(rt, main)
2609
 
dnl AC_CHECK_LIB(socket, main)
2610
 
dnl AC_CHECK_LIB(svld, main)
2611
 
dnl AC_CHECK_LIB(thread, main)
2612
 
dnl AC_CHECK_LIB(vms_jackets, main)
2613
 
 
2614
 
 
2615
 
dnl We don't want anything to link with libdl even if it's present on OS X, 
2616
 
dnl since it's not used and not part of the default installation.
2617
 
dnl The same goes for BeOS.
2618
 
dnl OS/2 has dlfcn in libc.
2619
 
 
2620
 
case $target in
2621
 
*-darwin*|*-beos*|*-os2*)
2622
 
    ;;
2623
 
*)
2624
 
    AC_CHECK_LIB(dl, dlopen,
2625
 
        AC_CHECK_HEADER(dlfcn.h,
2626
 
            OS_LIBS="-ldl $OS_LIBS"))
2627
 
    ;;
2628
 
esac
2629
 
 
2630
 
 
2631
 
dnl ========================================================
2632
 
dnl Check for system header files.
2633
 
dnl ========================================================
2634
 
dnl AC_HEADER_DIRENT
2635
 
dnl AC_HEADER_STDC
2636
 
dnl AC_HEADER_SYS_WAIT
2637
 
dnl AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/ioctl.h sys/time.h unistd.h)
2638
 
 
2639
 
dnl ========================================================
2640
 
dnl Check for typedefs and structs
2641
 
dnl ========================================================
2642
 
dnl AC_C_CONST
2643
 
dnl AC_TYPE_UID_T
2644
 
dnl AC_TYPE_MODE_T
2645
 
dnl AC_TYPE_OFF_T
2646
 
dnl AC_TYPE_PID_T
2647
 
dnl AC_TYPE_SIZE_T
2648
 
dnl AC_STRUCT_ST_BLKSIZE
2649
 
dnl AC_STRUCT_ST_BLOCKS
2650
 
dnl AC_STRUCT_ST_RDEV
2651
 
dnl AC_HEADER_TIME
2652
 
dnl AC_STRUCT_TM
2653
 
 
2654
 
dnl ========================================================
2655
 
dnl Checks for library functions.
2656
 
dnl ========================================================
2657
 
AC_PROG_GCC_TRADITIONAL
2658
 
AC_CHECK_FUNCS(lchown strerror)
2659
 
 
2660
 
dnl AC_FUNC_MEMCMP
2661
 
dnl AC_FUNC_MMAP
2662
 
dnl AC_FUNC_SETVBUF_REVERSED
2663
 
dnl AC_FUNC_STRCOLL
2664
 
dnl AC_FUNC_STRFTIME
2665
 
dnl AC_FUNC_UTIME_NULL
2666
 
dnl AC_FUNC_VPRINTF
2667
 
dnl AC_CHECK_FUNCS(ftime getcwd gethostname gettimeofday getwd mkdir mktime putenv rmdir select socket strdup strerror strstr strtol strtoul uname)
2668
 
 
2669
 
dnl ========================================================
2670
 
dnl Check options
2671
 
dnl ========================================================
2672
 
 
2673
 
dnl ======================================================
2674
 
dnl = Enable compiling with ccache
2675
 
dnl ======================================================
2676
 
AC_ARG_WITH(ccache,
2677
 
[  --with-ccache[=path/to/ccache]
2678
 
                          Enable compiling with ccache],
2679
 
    CCACHE=$withval, CCACHE="no")
2680
 
 
2681
 
if test "$CCACHE" != "no"; then
2682
 
    if test -n "$CCACHE"; then
2683
 
        if test "$CCACHE" = "yes"; then
2684
 
            CCACHE=
2685
 
        else
2686
 
            if test ! -e "$CCACHE"; then
2687
 
                AC_MSG_ERROR([$CCACHE not found])
2688
 
            fi
2689
 
        fi
2690
 
    fi
2691
 
    AC_PATH_PROGS(CCACHE, $CCACHE ccache)
2692
 
    if test -z "$CCACHE" -o "$CCACHE" = ":"; then
2693
 
        AC_MSG_ERROR([ccache not found])
2694
 
    elif test -x "$CCACHE"; then
2695
 
        CC="$CCACHE $CC"
2696
 
        CXX="$CCACHE $CXX"
2697
 
    else
2698
 
        AC_MSG_ERROR([$CCACHE is not executable])
2699
 
    fi
2700
 
fi
2701
 
 
2702
 
dnl ========================================================
2703
 
dnl =
2704
 
dnl = --enable-strip
2705
 
dnl = 
2706
 
dnl = Enable stripping of libs and executables
2707
 
dnl = 
2708
 
dnl ========================================================
2709
 
AC_ARG_ENABLE(strip,
2710
 
    [  --enable-strip          Enable stripping of shared libs and programs],
2711
 
    [ if test "$enableval" = "yes"; then
2712
 
            ENABLE_STRIP=1
2713
 
      fi ])
2714
 
 
2715
 
dnl Check for hpux options
2716
 
case "${target_os}" in
2717
 
hpux*)
2718
 
if test -z "$GNU_CC"; then
2719
 
 
2720
 
    AC_CACHE_CHECK(for +Olit support,
2721
 
        ac_cv_hpux_usable_olit_option,
2722
 
        dnl since aCC doesn't throw an error on invalid options,
2723
 
        dnl we have to test this the hard way
2724
 
        [ac_cv_hpux_usable_olit_option=no
2725
 
        rm -f conftest*
2726
 
        echo 'int main() { return 0; }' | cat > conftest.c
2727
 
        ${CC-cc} ${CFLAGS} +Olit=all -o conftest conftest.c > conftest.out 2>&1
2728
 
        if test $? -eq 0; then
2729
 
            if test -z "`egrep -i '(unrecognize|unknown)' conftest.out`"; then
2730
 
                ac_cv_hpux_usable_olit_option=yes
2731
 
            fi
2732
 
        fi
2733
 
        rm -f conftest*
2734
 
        ])
2735
 
 
2736
 
    if test "$ac_cv_hpux_usable_olit_option" = "yes"; then
2737
 
        CFLAGS="$CFLAGS +Olit=all"
2738
 
        CXXFLAGS="$CXXFLAGS +Olit=all"
2739
 
    else
2740
 
        CFLAGS="$CFLAGS +ESlit"
2741
 
        CXXFLAGS="$CXXFLAGS +ESlit"
2742
 
    fi
2743
 
fi
2744
 
;;
2745
 
esac
2746
 
 
2747
 
dnl
2748
 
dnl Apparently, some systems cannot properly check for the pthread
2749
 
dnl library unless <pthread.h> is included so we need to test
2750
 
dnl using it
2751
 
dnl
2752
 
dnl MOZ_CHECK_PTHREADS(lib, success, failure)
2753
 
AC_DEFUN(MOZ_CHECK_PTHREADS,
2754
 
[
2755
 
AC_MSG_CHECKING([for pthread_create in -l$1])
2756
 
echo "
2757
 
    #include <pthread.h> 
2758
 
    void *foo(void *v) { return v; } 
2759
 
    int main() { 
2760
 
        pthread_t t;
2761
 
        if (!pthread_create(&t, 0, &foo, 0)) {
2762
 
            pthread_join(t, 0);
2763
 
        }
2764
 
        return 0;
2765
 
    }" > dummy.c ;
2766
 
    echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS" 1>&5;
2767
 
    ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS 2>&5;
2768
 
    _res=$? ;
2769
 
    rm -f dummy.c dummy${ac_exeext} ;
2770
 
    if test "$_res" = "0"; then
2771
 
        AC_MSG_RESULT([yes])
2772
 
        [$2]
2773
 
    else
2774
 
        AC_MSG_RESULT([no])
2775
 
        [$3]
2776
 
    fi
2777
 
])
2778
 
 
2779
 
case "$target_os" in
2780
 
darwin*)
2781
 
    _HAVE_PTHREADS=1
2782
 
    ;;
2783
 
wince*)
2784
 
    _HAVE_PTHREADS=
2785
 
    ;;
2786
 
*)
2787
 
    MOZ_CHECK_PTHREADS(pthreads,
2788
 
        _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2789
 
        MOZ_CHECK_PTHREADS(pthread,
2790
 
            _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2791
 
            MOZ_CHECK_PTHREADS(c_r,
2792
 
                _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2793
 
                MOZ_CHECK_PTHREADS(c,
2794
 
                    _HAVE_PTHREADS=1
2795
 
                )
2796
 
            )
2797
 
        )
2798
 
    )
2799
 
    ;;
2800
 
esac
2801
 
 
2802
 
AC_ARG_WITH(pthreads,
2803
 
    [  --with-pthreads         Use system pthreads library as thread subsystem],
2804
 
    [ if test "$withval" = "yes"; then
2805
 
            if test -n "$_HAVE_PTHREADS"; then
2806
 
                    USE_PTHREADS=1 
2807
 
                    USE_USER_PTHREADS=
2808
 
                    USE_NSPR_THREADS=
2809
 
            else
2810
 
                    AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2811
 
            fi
2812
 
          else
2813
 
            USE_PTHREADS=
2814
 
            _PTHREAD_LDFLAGS=
2815
 
          fi],
2816
 
        [ if test -n "$_HAVE_PTHREADS" && test -z "$USE_USER_PTHREADS" && test -z "$USE_NSPR_THREADS"; then
2817
 
            USE_PTHREADS=1
2818
 
            USE_USER_PTHREADS=
2819
 
            USE_NSPR_THREADS=
2820
 
          fi])
2821
 
 
2822
 
AC_ARG_ENABLE(user-pthreads,
2823
 
    [  --enable-user-pthreads  Build using userland pthreads],
2824
 
    [ if test "$enableval" = "yes"; then
2825
 
        if test -n "$_HAVE_PTHREADS"; then
2826
 
                    USE_PTHREADS=
2827
 
                    USE_USER_PTHREADS=1
2828
 
                    USE_NSPR_THREADS=
2829
 
            else
2830
 
                    AC_MSG_ERROR([ --enable-user-pthreads specified for a system without pthread support ]);
2831
 
            fi
2832
 
          fi])
2833
 
 
2834
 
AC_ARG_ENABLE(nspr-threads,
2835
 
    [  --enable-nspr-threads   Build using classic nspr threads],
2836
 
    [ if test "$enableval" = "yes"; then
2837
 
            USE_PTHREADS=
2838
 
            USE_USER_PTHREADS=
2839
 
            USE_NSPR_THREADS=1
2840
 
          fi])
2841
 
 
2842
 
case "$target" in
2843
 
*-beos*)
2844
 
    AC_ARG_WITH(bthreads,
2845
 
    [  --with-bthreads         Use system bthreads library as thread subsystem
2846
 
                          (BeOS only)],
2847
 
    [   if test "$withval" = "yes"; then
2848
 
            USE_BTHREADS=1
2849
 
                USE_USER_PTHREADS=
2850
 
                USE_PTHREADS=
2851
 
            fi])
2852
 
    ;;
2853
 
esac
2854
 
 
2855
 
fi # SKIP_LIBRARY_CHECKS
2856
 
 
2857
 
AC_ARG_ENABLE(ipv6,
2858
 
    [  --enable-ipv6           Compile ipv6 support],
2859
 
    [ if test "$enableval" = "yes"; then
2860
 
            USE_IPV6=1
2861
 
      else
2862
 
            USE_IPV6=
2863
 
      fi])
2864
 
 
2865
 
if test -n "$USE_PTHREADS"; then
2866
 
   dnl See if -pthread is supported.
2867
 
   rm -f conftest*
2868
 
   ac_cv_have_dash_pthread=no
2869
 
   AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2870
 
   echo 'int main() { return 0; }' | cat > conftest.c
2871
 
   ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2872
 
   if test $? -eq 0; then
2873
 
        if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2874
 
            ac_cv_have_dash_pthread=yes
2875
 
                case "$target_os" in
2876
 
            freebsd*)
2877
 
# Freebsd doesn't use -pthread for compiles, it uses them for linking
2878
 
            ;;
2879
 
            *)
2880
 
            CFLAGS="$CFLAGS -pthread"
2881
 
            CXXFLAGS="$CXXFLAGS -pthread"
2882
 
            ;;
2883
 
        esac
2884
 
        fi
2885
 
    fi
2886
 
    rm -f conftest*
2887
 
    AC_MSG_RESULT($ac_cv_have_dash_pthread)
2888
 
 
2889
 
        dnl
2890
 
        dnl See if -pthreads is supported.
2891
 
        dnl
2892
 
    ac_cv_have_dash_pthreads=no
2893
 
    if test "$ac_cv_have_dash_pthread" = "no"; then
2894
 
            AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2895
 
        echo 'int main() { return 0; }' | cat > conftest.c
2896
 
            ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2897
 
        if test $? -eq 0; then
2898
 
                if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2899
 
                            ac_cv_have_dash_pthreads=yes
2900
 
                            CFLAGS="$CFLAGS -pthreads"
2901
 
                            CXXFLAGS="$CXXFLAGS -pthreads"
2902
 
                    fi
2903
 
            fi
2904
 
            rm -f conftest*
2905
 
        AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2906
 
    fi
2907
 
 
2908
 
    case "$target" in
2909
 
    *-solaris*)
2910
 
        if test "$ac_cv_have_dash_pthreads" = "yes"; then
2911
 
            _PTHREAD_LDFLAGS=
2912
 
        fi
2913
 
            ;;
2914
 
    *-freebsd*)
2915
 
            AC_DEFINE(_REENTRANT)
2916
 
            AC_DEFINE(_THREAD_SAFE)
2917
 
            dnl -pthread links in -lc_r, so don't specify it explicitly.
2918
 
            if test "$ac_cv_have_dash_pthread" = "yes"; then
2919
 
                _PTHREAD_LDFLAGS="-pthread"
2920
 
            else
2921
 
                _PTHREAD_LDFLAGS="-lc_r"
2922
 
            fi
2923
 
            ;;
2924
 
    *-netbsd*)
2925
 
            if test "$ac_cv_have_dash_pthread" = "yes"; then
2926
 
                _PTHREAD_LDFLAGS="-pthread"
2927
 
            fi
2928
 
            ;;
2929
 
    *-bsdi*)
2930
 
            AC_DEFINE(_THREAD_SAFE)
2931
 
            dnl -pthread links in -lc_r, so don't specify it explicitly.
2932
 
            if test "$ac_cv_have_dash_pthread" = "yes"; then
2933
 
                _PTHREAD_LDFLAGS=
2934
 
            fi
2935
 
            ;;
2936
 
    *-openbsd*)
2937
 
        if test "$ac_cv_have_dash_pthread" = "yes"; then
2938
 
            _PTHREAD_LDFLAGS=-pthread
2939
 
        fi
2940
 
        ;;
2941
 
    *-linux*|*-gnu*|*-k*bsd*-gnu)
2942
 
        AC_DEFINE(_REENTRANT)
2943
 
        ;;
2944
 
    esac
2945
 
 
2946
 
else 
2947
 
    if test -n "$USE_USER_PTHREADS"; then
2948
 
            USE_PTHREADS=
2949
 
            USE_NSPR_THREADS=
2950
 
    else
2951
 
        _PTHREAD_LDFLAGS=
2952
 
    fi
2953
 
fi
2954
 
dnl Special thread exceptions
2955
 
 
2956
 
case "$target" in
2957
 
*-aix*)
2958
 
    if test -n "$USE_NSPR_THREADS"; then
2959
 
        AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2960
 
    fi
2961
 
    case "$target_os" in
2962
 
    aix4.1*)
2963
 
        if test -z "$USE_PTHREADS"; then
2964
 
            AC_DEFINE(AIX_RENAME_SELECT)
2965
 
        fi
2966
 
        ;;
2967
 
    aix4.2*)
2968
 
        if test -z "$USE_NSPR_THREADS"; then
2969
 
            AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2970
 
        fi
2971
 
        ;;
2972
 
    aix4.3*)
2973
 
        if test -z "$USE_NSPR_THREADS"; then
2974
 
            AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2975
 
        fi
2976
 
        if test -n "$USE_PTHREADS"; then
2977
 
            AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2978
 
        fi
2979
 
        ;;
2980
 
    *)
2981
 
        if test -z "$USE_NSPR_THREADS"; then
2982
 
            AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2983
 
        fi
2984
 
        if test -n "$USE_PTHREADS"; then
2985
 
            AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2986
 
        fi
2987
 
        ;;
2988
 
    esac
2989
 
    ;;
2990
 
*-bsdi*)
2991
 
    if test -n "$USE_PTHREADS"; then
2992
 
        AC_DEFINE(_PR_NEED_PTHREAD_INIT)
2993
 
    fi
2994
 
    ;;
2995
 
*-freebsd*)
2996
 
    if test -n "$USE_NSPR_THREADS"; then
2997
 
        AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2998
 
    fi
2999
 
    ;;
3000
 
*-hpux*)
3001
 
    if test -n "$USE_NSPR_THREADS"; then
3002
 
        AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
3003
 
    fi 
3004
 
    if test "$USE_PTHREADS"; then
3005
 
        if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
3006
 
            AC_DEFINE(_REENTRANT)
3007
 
            AC_DEFINE(_PR_DCETHREADS)
3008
 
        else
3009
 
            AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
3010
 
            AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
3011
 
        fi
3012
 
    fi
3013
 
    if test "$USE_USER_PTHREADS"; then
3014
 
        AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
3015
 
    fi
3016
 
    ;;
3017
 
*-irix*)
3018
 
    if test "${target_os}" = "irix6.5"; then
3019
 
        if test -n "$USE_PTHREADS"; then
3020
 
            AC_DEFINE(_PR_HAVE_GETHOST_R)
3021
 
            AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
3022
 
        fi
3023
 
    fi
3024
 
    ;;
3025
 
*-linux*|*-gnu*|*-k*bsd*-gnu)
3026
 
    if test -n "$USE_NSPR_THREADS"; then
3027
 
        AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
3028
 
    fi
3029
 
    ;;
3030
 
*-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*|*-winmo*|*-os2*|*-beos*)
3031
 
    dnl win32, wince, os2 & beos cannot use pthreads
3032
 
    USE_PTHREADS=
3033
 
    _PTHREAD_LDFLAGS=
3034
 
    USE_USER_PTHREADS=
3035
 
    ;;
3036
 
*-netbsd*|*-openbsd*)
3037
 
    if test -n "$USE_NSPR_THREADS"; then
3038
 
        AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
3039
 
    fi
3040
 
    ;;
3041
 
*-osf*)
3042
 
    if test -n "$USE_NSPR_THREADS"; then
3043
 
        AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
3044
 
    fi
3045
 
    if test -n "$USE_PTHREADS"; then
3046
 
        if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
3047
 
            :
3048
 
        else
3049
 
            AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
3050
 
        fi
3051
 
    fi
3052
 
    ;;
3053
 
*-solaris*)
3054
 
    if test -n "$USE_NSPR_THREADS"; then
3055
 
        AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
3056
 
    fi
3057
 
    if test -n "$USE_PTHREADS"; then
3058
 
        AC_DEFINE(_REENTRANT)
3059
 
        AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
3060
 
        if test "$OS_TEST" = "i86pc"; then
3061
 
            if test -n "$USE_64"; then
3062
 
               PR_MD_ASFILES=os_SunOS_x86_64.s
3063
 
            else
3064
 
               PR_MD_ASFILES=os_SunOS_x86.s
3065
 
            fi
3066
 
        else
3067
 
            if test -n "$USE_64"; then
3068
 
                PR_MD_ASFILES=os_SunOS_sparcv9.s
3069
 
            fi
3070
 
        fi
3071
 
    fi
3072
 
    ;;
3073
 
*-nto*)
3074
 
    if test -n "$USE_PTHREADS"; then
3075
 
        AC_DEFINE(_PR_HAVE_GETHOST_R)
3076
 
        AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
3077
 
    fi
3078
 
    ;;
3079
 
esac
3080
 
 
3081
 
OS_LIBS="$_PTHREAD_LDFLAGS $OS_LIBS"
3082
 
 
3083
 
dnl If the user passed in arg to --enable-optimize or --enable-debug,
3084
 
dnl make sure that we use it.
3085
 
if test -n "$_SAVE_OPTIMIZE_FLAGS"; then
3086
 
    _OPTIMIZE_FLAGS="$_SAVE_OPTIMIZE_FLAGS"
3087
 
fi
3088
 
 
3089
 
if test -n "$_SAVE_DEBUG_FLAGS"; then
3090
 
    _DEBUG_FLAGS="$_SAVE_DEBUG_FLAGS"
3091
 
fi
3092
 
 
3093
 
if test -n "$MOZ_OPTIMIZE"; then
3094
 
    CFLAGS="$CFLAGS $_OPTIMIZE_FLAGS"
3095
 
    CXXFLAGS="$CXXFLAGS $_OPTIMIZE_FLAGS"
3096
 
fi
3097
 
 
3098
 
if test -n "$MOZ_DEBUG_SYMBOLS"; then
3099
 
    CFLAGS="$CFLAGS $_DEBUG_FLAGS"
3100
 
    CXXFLAGS="$CXXFLAGS $_DEBUG_FLAGS"
3101
 
fi
3102
 
 
3103
 
if test -n "$MOZ_OPTIMIZE"; then
3104
 
    OBJDIR_TAG=_OPT
3105
 
else
3106
 
    OBJDIR_TAG=_DBG
3107
 
fi
3108
 
 
3109
 
if test -n "$USE_64"; then
3110
 
    COMPILER_TAG=_64
3111
 
fi
3112
 
 
3113
 
RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${COMPILER_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}.${OBJDIR_SUFFIX}"
3114
 
 
3115
 
dnl ========================================================
3116
 
dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
3117
 
dnl ========================================================
3118
 
case "$target_os" in
3119
 
cygwin*|msvc*|mks*)
3120
 
    CC="\$(CYGWIN_WRAPPER) $CC"
3121
 
    CXX="\$(CYGWIN_WRAPPER) $CXX"
3122
 
    RC="\$(CYGWIN_WRAPPER) $RC"
3123
 
    ;;
3124
 
esac
3125
 
 
3126
 
dnl ========================================================
3127
 
dnl = Use malloc wrapper lib
3128
 
dnl ========================================================
3129
 
AC_ARG_ENABLE(wrap-malloc,
3130
 
[  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
3131
 
[     if test "$enableval" = "yes"; then
3132
 
            _WRAP_MALLOC=1
3133
 
      fi ])
3134
 
 
3135
 
if test -n "$_WRAP_MALLOC"; then
3136
 
    if test "$GNU_CC"; then
3137
 
       WRAP_MALLOC_CFLAGS="${LDFLAGS} ${WRAP_MALLOC_CFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -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 -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
3138
 
       DSO_LDOPTS="$DSO_LDOPTS $WRAP_MALLOC_CFLAGS"
3139
 
    else
3140
 
       AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
3141
 
    fi
3142
 
fi
3143
 
 
3144
 
dnl ========================================================
3145
 
dnl = Location of malloc wrapper lib
3146
 
dnl ========================================================
3147
 
AC_ARG_WITH(wrap-malloc,
3148
 
[  --with-wrap-malloc=SHAREDLIB  Location of malloc wrapper library],
3149
 
    WRAP_MALLOC_LIB=$withval)
3150
 
 
3151
 
dnl ========================================================
3152
 
dnl Substitution of found variables.
3153
 
dnl ========================================================
3154
 
AC_SUBST(SHELL_OVERRIDE)
3155
 
 
3156
 
AC_SUBST(MOZILLA_CLIENT)
3157
 
AC_SUBST(CC)
3158
 
AC_SUBST(CXX)
3159
 
AC_SUBST(CFLAGS)
3160
 
AC_SUBST(CXXFLAGS)
3161
 
AC_SUBST(CPPFLAGS)
3162
 
AC_SUBST(HOST_CC)
3163
 
AC_SUBST(HOST_CFLAGS)
3164
 
AC_SUBST(LDFLAGS)
3165
 
AC_SUBST(HOST_LDFLAGS)
3166
 
AC_SUBST(GNU_CC)
3167
 
AC_SUBST(GCC_USE_GNU_LD)
3168
 
AC_SUBST(MSC_VER)
3169
 
AC_SUBST(CROSS_COMPILE)
3170
 
 
3171
 
AC_SUBST(MOZ_OPTIMIZE)
3172
 
AC_SUBST(MOZ_DEBUG)
3173
 
AC_SUBST(MOZ_DEBUG_SYMBOLS)
3174
 
 
3175
 
AC_SUBST(USE_CPLUS)
3176
 
AC_SUBST(USE_IPV6)
3177
 
AC_SUBST(USE_N32)
3178
 
AC_SUBST(USE_64)
3179
 
AC_SUBST(OBJECT_MODE)
3180
 
AC_SUBST(ENABLE_STRIP)
3181
 
 
3182
 
AC_SUBST(USE_PTHREADS)
3183
 
AC_SUBST(USE_BTHREADS)
3184
 
AC_SUBST(USE_USER_PTHREADS)
3185
 
AC_SUBST(USE_NSPR_THREADS)
3186
 
 
3187
 
AC_SUBST(LIBNSPR)
3188
 
AC_SUBST(LIBPLC)
3189
 
 
3190
 
AC_SUBST(MOD_MAJOR_VERSION)
3191
 
AC_SUBST(MOD_MINOR_VERSION)
3192
 
AC_SUBST(MOD_PATCH_VERSION)
3193
 
AC_SUBST(NSPR_MODNAME)
3194
 
AC_SUBST(MDCPUCFG_H)
3195
 
AC_SUBST(PR_MD_CSRCS)
3196
 
AC_SUBST(PR_MD_ASFILES)
3197
 
AC_SUBST(PR_MD_ARCH_DIR)
3198
 
AC_SUBST(CPU_ARCH)
3199
 
 
3200
 
AC_SUBST(OBJ_SUFFIX)
3201
 
AC_SUBST(LIB_SUFFIX)
3202
 
AC_SUBST(DLL_SUFFIX)
3203
 
AC_SUBST(ASM_SUFFIX)
3204
 
AC_SUBST(WRAP_MALLOC_CFLAGS)
3205
 
AC_SUBST(WRAP_MALLOC_LIB)
3206
 
AC_SUBST(MKSHLIB)
3207
 
AC_SUBST(DSO_CFLAGS)
3208
 
AC_SUBST(DSO_LDOPTS)
3209
 
 
3210
 
AC_SUBST(OS_TARGET)
3211
 
AC_SUBST(OS_ARCH)
3212
 
AC_SUBST(OS_RELEASE)
3213
 
AC_SUBST(OS_TEST)
3214
 
AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3215
 
 
3216
 
AC_SUBST(DEFINES)
3217
 
AC_SUBST(DEFS)
3218
 
AC_SUBST(AR)
3219
 
AC_SUBST(AR_FLAGS)
3220
 
AC_SUBST(AS)
3221
 
AC_SUBST(ASFLAGS)
3222
 
AC_SUBST(LD)
3223
 
AC_SUBST(RANLIB)
3224
 
AC_SUBST(PERL)
3225
 
AC_SUBST(STRIP)
3226
 
AC_SUBST(FILTER)
3227
 
AC_SUBST(IMPLIB)
3228
 
 
3229
 
AC_SUBST(PROFILE_GEN_CFLAGS)
3230
 
AC_SUBST(PROFILE_GEN_LDFLAGS)
3231
 
AC_SUBST(PROFILE_USE_CFLAGS)
3232
 
AC_SUBST(PROFILE_USE_LDFLAGS)
3233
 
 
3234
 
AC_SUBST(OS_LIBS)
3235
 
AC_SUBST(RESOLVE_LINK_SYMBOLS)
3236
 
AC_SUBST(AIX_LINK_OPTS)
3237
 
AC_SUBST(NOSUCHFILE)
3238
 
AC_SUBST(MOZ_OBJFORMAT)
3239
 
AC_SUBST(ULTRASPARC_LIBRARY)
3240
 
 
3241
 
AC_SUBST(OBJDIR)
3242
 
AC_SUBST(OBJDIR_NAME)
3243
 
AC_SUBST(RELEASE_OBJDIR_NAME)
3244
 
AC_SUBST(NSINSTALL)
3245
 
AC_SUBST(OPTIMIZER)
3246
 
AC_SUBST(RC)
3247
 
AC_SUBST(RCFLAGS)
3248
 
AC_SUBST(DLLFLAGS)
3249
 
AC_SUBST(EXEFLAGS)
3250
 
AC_SUBST(OS_DLLFLAGS)
3251
 
AC_SUBST(CYGWIN_WRAPPER)
3252
 
AC_SUBST(VISIBILITY_FLAGS)
3253
 
AC_SUBST(WRAP_SYSTEM_INCLUDES)
3254
 
AC_SUBST(MACOS_SDK_DIR)
3255
 
AC_SUBST(SYMBIAN_SDK_DIR)
3256
 
AC_SUBST(NEXT_ROOT)
3257
 
AC_SUBST(MT)
3258
 
 
3259
 
dnl ========================================================
3260
 
dnl Generate output files.
3261
 
dnl ========================================================
3262
 
MAKEFILES="
3263
 
Makefile 
3264
 
config/Makefile
3265
 
config/autoconf.mk
3266
 
config/nsprincl.mk
3267
 
config/nsprincl.sh
3268
 
config/nspr-config
3269
 
lib/Makefile 
3270
 
lib/ds/Makefile 
3271
 
lib/libc/Makefile 
3272
 
lib/libc/include/Makefile 
3273
 
lib/libc/src/Makefile 
3274
 
lib/tests/Makefile
3275
 
pkg/Makefile
3276
 
pkg/linux/Makefile
3277
 
pkg/solaris/Makefile
3278
 
pkg/solaris/SUNWpr/Makefile
3279
 
pkg/solaris/SUNWprd/Makefile
3280
 
pr/Makefile 
3281
 
pr/include/Makefile 
3282
 
pr/include/md/Makefile 
3283
 
pr/include/obsolete/Makefile 
3284
 
pr/include/private/Makefile 
3285
 
pr/src/Makefile 
3286
 
pr/src/io/Makefile 
3287
 
pr/src/linking/Makefile 
3288
 
pr/src/malloc/Makefile 
3289
 
pr/src/md/Makefile 
3290
 
pr/src/md/${PR_MD_ARCH_DIR}/Makefile 
3291
 
pr/src/memory/Makefile 
3292
 
pr/src/misc/Makefile 
3293
 
pr/src/threads/Makefile 
3294
 
pr/tests/Makefile 
3295
 
pr/tests/dll/Makefile 
3296
 
"
3297
 
 
3298
 
dnl lib/tests/Makefile
3299
 
dnl pr/tests/w16gui/Makefile
3300
 
dnl tools/Makefile
3301
 
 
3302
 
if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then
3303
 
    MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile"
3304
 
elif test -n "$USE_PTHREADS"; then
3305
 
    MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile"
3306
 
elif test -n "$USE_BTHREADS"; then
3307
 
    MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile"
3308
 
fi
3309
 
 
3310
 
if test -n "$USE_CPLUS"; then
3311
 
    MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile"
3312
 
fi
3313
 
 
3314
 
echo $MAKEFILES > unallmakefiles
3315
 
 
3316
 
AC_OUTPUT([$MAKEFILES], [chmod +x config/nspr-config])