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