1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
16 dnl The Original Code is the Netscape Portable Runtime (NSPR).
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.
24 dnl Christopher Seawood <cls@seawood.org>
25 dnl Howard Chu <hyc@symas.com>
26 dnl Mark Mentovai <mark@moxienet.com>
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.
40 dnl ***** END LICENSE BLOCK *****
43 AC_INIT(config/libc_r.h)
45 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
48 dnl ========================================================
50 dnl ========================================================
64 _MACOSX_DEPLOYMENT_TARGET=
69 OBJDIR='$(OBJDIR_NAME)'
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)'
82 dnl Link in libraries necessary to resolve all symbols for shared libs
85 dnl ========================================================
87 dnl = Dont change the following lines. Doing so breaks:
89 dnl = CFLAGS="-foo" ./configure
91 dnl ========================================================
93 CXXFLAGS="${CXXFLAGS=}"
95 DLLFLAGS="${DLLFLAGS=}"
96 HOST_CFLAGS="${HOST_CFLAGS=}"
97 HOST_LDFLAGS="${HOST_LDFLAGS=}"
101 # Check to see if we are really running in a msvc environemnt
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
111 AC_MSG_WARN([$(CC) test failed. Using normal feature tests])
113 rm -f dummy dummy.o dummy.obj dummy.exe dummy.c
124 if test -n "$_WIN32_MSVC"; then
126 SKIP_COMPILER_CHECKS=1
127 SKIP_LIBRARY_CHECKS=1
130 dnl ========================================================
132 dnl = Check options that may affect the compiler
134 dnl ========================================================
135 dist_prefix='${MOD_DEPTH}/dist'
136 dist_bindir='${dist_prefix}/bin'
137 dist_includedir='${dist_prefix}/include/nspr'
138 dist_libdir='${dist_prefix}/lib'
139 dnl If the --includedir option was not specified, add '/nspr' to autoconf's
140 dnl default value of includedir.
141 if test "${includedir}" = '${prefix}/include'; then
142 includedir='${prefix}/include/nspr'
145 AC_ARG_WITH(dist-prefix,
146 [ --with-dist-prefix=DIST_PREFIX
147 place build files in DIST_PREFIX [dist]],
148 dist_prefix=$withval)
150 AC_ARG_WITH(dist-bindir,
151 [ --with-dist-bindir=DIR build execuatables in DIR [DIST_PREFIX/bin]],
152 dist_bindir=$withval)
154 AC_ARG_WITH(dist-includedir,
155 [ --with-dist-includedir=DIR
156 build include files in DIR [DIST_PREFIX/include/nspr]],
157 dist_includedir=$withval)
159 AC_ARG_WITH(dist-libdir,
160 [ --with-dist-libdir=DIR build library files in DIR [DIST_PREFIX/lib]],
161 dist_libdir=$withval)
163 AC_SUBST(dist_prefix)
164 AC_SUBST(dist_bindir)
165 AC_SUBST(dist_includedir)
166 AC_SUBST(dist_libdir)
168 dnl Check if NSPR is being compiled for Mozilla
169 dnl Let --with-arg override environment setting
172 [ --with-mozilla Compile NSPR with Mozilla support],
173 [ if test "$withval" = "yes"; then
174 AC_DEFINE(MOZILLA_CLIENT)
179 [ if test -n "$MOZILLA_CLIENT"; then
180 AC_DEFINE(MOZILLA_CLIENT)
183 AC_ARG_ENABLE(optimize,
184 [ --enable-optimize(=val) Enable code optimizations (val, ie. -O2) ],
185 [ if test "$enableval" != "no"; then
187 if test -n "$enableval" && test "$enableval" != "yes"; then
188 _OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
189 _SAVE_OPTIMIZE_FLAGS=$_OPTIMIZE_FLAGS
196 [ --disable-debug Do not compile in debugging symbols
197 --enable-debug(=val) Enable debugging (debug flags val)],
198 [ if test "$enableval" = "no"; then
202 if test -n "$enableval" && test "$enableval" != "yes"; then
203 _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
204 _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS
208 AC_ARG_ENABLE(win32-target,
209 [ --enable-win32-target=\$t
210 Specify win32 flavor. (WIN95 or WINNT)],
211 OS_TARGET=`echo $enableval | tr a-z A-Z`)
213 AC_ARG_ENABLE(symbian-target,
214 [ --enable-symbian-target=\$t
215 Specify symbian flavor. (WINSCW or GCCE)],
216 OS_TARGET=`echo $enableval | tr a-z A-Z`)
218 AC_ARG_ENABLE(debug-rtl,
219 [ --enable-debug-rtl Use the MSVC debug runtime library],
220 [ if test "$enableval" = "yes"; then
225 [ --enable-n32 Enable n32 ABI support (IRIX only)],
226 [ if test "$enableval" = "yes"; then
228 else if test "$enableval" = "no"; then
234 [ --enable-64bit Enable 64-bit support (on certain platforms)],
235 [ if test "$enableval" = "yes"; then
239 AC_ARG_ENABLE(mdupdate,
240 [ --enable-mdupdate Enable use of certain compilers' mdupdate feature],
241 [ if test "$enableval" = "yes"; then
246 [ --enable-cplus Enable some c++ api routines],
247 [ if test "$enableval" = "yes"; then
251 AC_ARG_WITH(arm-kuser,
252 [ --with-arm-kuser Use kuser helpers (Linux/ARM only)
253 (Requires kernel 2.6.13 or later)],
254 [ if test "$withval" = "yes"; then
255 AC_DEFINE(_PR_ARM_KUSER)
258 dnl ========================================================
259 dnl = Mac OS X SDK support
260 dnl ========================================================
261 AC_ARG_WITH(macos-sdk,
262 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
263 MACOS_SDK_DIR=$withval)
265 AC_ARG_ENABLE(macos-target,
266 [ --enable-macos-target=VER
267 Set the minimum MacOS version needed at runtime
268 [10.2 for ppc, 10.4 for x86]],
269 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
271 dnl ========================================================
273 dnl = Set the threading model
275 dnl ========================================================
279 case "${target_os}" in
291 dnl ========================================================
293 dnl = Set the default C compiler
295 dnl ========================================================
296 if test -z "$CC"; then
300 if test -z "$USE_NSPR_THREADS"; then
326 dnl ========================================================
328 dnl = Set the default C++ compiler
330 dnl ========================================================
331 if test -z "$CXX"; then
335 if test -z "$USE_NSPR_THREADS"; then
343 case "${target_os}" in
371 if test -z "$SKIP_PATH_CHECKS"; then
372 AC_PATH_PROG(WHOAMI, $WHOAMI whoami, echo not_whoami)
375 if test -n "$MOZ_DEBUG"; then
377 DEFINES="$DEFINES -UNDEBUG"
379 case "${target_os}" in
381 DEFINES="$DEFINES -DDEBUG_${USER}"
383 msvc*|mks*|cygwin*|mingw*|wince*|winmo*|os2*)
384 DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
387 DEFINES="$DEFINES -DDEBUG_`$WHOAMI`"
392 DEFINES="$DEFINES -UDEBUG"
395 if test -z "$SKIP_COMPILER_CHECKS"; then
396 dnl ========================================================
397 dnl Checks for compilers.
398 dnl ========================================================
399 if test "$target" != "$host"; then
400 echo "cross compiling from $host to $target"
404 _SAVE_CFLAGS="$CFLAGS"
405 _SAVE_LDFLAGS="$LDFLAGS"
407 AC_MSG_CHECKING([for $host compiler])
408 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc, "")
409 if test -z "$HOST_CC"; then
410 AC_MSG_ERROR([no acceptable cc found in \$PATH])
412 AC_MSG_RESULT([$HOST_CC])
413 if test -z "$HOST_CFLAGS"; then
414 HOST_CFLAGS="$CFLAGS"
416 if test -z "$HOST_LDFLAGS"; then
417 HOST_LDFLAGS="$LDFLAGS"
421 CFLAGS="$HOST_CFLAGS"
422 LDFLAGS="$HOST_LDFLAGS"
424 AC_MSG_CHECKING([whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
425 AC_TRY_COMPILE([], [return(0);],
426 [ac_cv_prog_host_cc_works=1 AC_MSG_RESULT([yes])],
427 AC_MSG_ERROR([installation or configuration problem: $host compiler $HOST_CC cannot create executables.]) )
431 LDFLAGS=$_SAVE_LDFLAGS
433 case "$build:$target" in
434 powerpc-apple-darwin8*:i?86-apple-darwin*)
435 dnl The Darwin cross compiler doesn't necessarily point itself at a
436 dnl root that has libraries for the proper architecture, it defaults
437 dnl to the system root. The libraries in the system root on current
438 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
439 dnl checks will fail. Fake a working SDK in that case.
441 _SAVE_CXXFLAGS=$CXXLAGS
442 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
443 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
447 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo)
450 if test -n "$USE_CPLUS"; then
451 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", echo)
456 case "$build:$target" in
457 powerpc-apple-darwin8*:i?86-apple-darwin*)
458 dnl Revert the changes made above. From this point on, the target
459 dnl compiler will never be used without applying the SDK to CFLAGS
460 dnl (see --with-macos-sdk below).
462 CXXFLAGS=$_SAVE_CXXFLAGS
466 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", echo)
467 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", echo)
468 AC_CHECK_PROGS(AS, $AS "${target_alias}-as" "${target}-as", echo)
469 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", echo)
470 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", echo)
471 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", echo)
475 if test -n "$USE_CPLUS"; then
476 if test "$CC" = "cl" -a -z "$CXX"; then
484 AC_PATH_PROGS(AS, as, $CC)
485 AC_PATH_PROGS(AR, ar, echo not_ar)
486 AC_PATH_PROGS(LD, ld link, echo not_ld)
487 AC_PATH_PROGS(STRIP, strip, echo not_strip)
488 AC_PATH_PROGS(WINDRES, windres, echo not_windres)
489 if test -z "$HOST_CC"; then
492 if test -z "$HOST_CFLAGS"; then
493 HOST_CFLAGS="$CFLAGS"
497 if test "$GCC" = "yes"; then
500 if test "$GXX" = "yes"; then
503 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
508 case "$build:$target" in
509 i?86-apple-darwin*:powerpc-apple-darwin*)
510 dnl cross_compiling will have erroneously been set to "no" in this
511 dnl case, because the x86 build host is able to run ppc code in a
512 dnl translated environment, making a cross compiler appear native.
517 if test "$cross_compiling" = "yes"; then
523 dnl ========================================================
524 dnl Check for gcc -pipe support
525 dnl ========================================================
526 AC_MSG_CHECKING([for gcc -pipe support])
527 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
528 echo '#include <stdio.h>' > dummy-hello.c
529 echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c
530 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
531 cat dummy-hello.s | ${AS} -o dummy-hello.S - 2>&5
537 if test "$_res_as_stdin" = "yes"; then
539 CFLAGS="$CFLAGS -pipe"
540 AC_TRY_COMPILE( [ #include <stdio.h> ],
541 [printf("Hello World\n");],
542 [_res_gcc_pipe="yes"],
543 [_res_gcc_pipe="no"] )
546 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
548 CFLAGS="$CFLAGS -pipe"
549 CXXFLAGS="$CXXFLAGS -pipe"
553 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
554 AC_MSG_RESULT([$_res])
559 dnl ===============================================================
560 dnl Check for .hidden assembler directive and visibility attribute.
561 dnl Borrowed from glibc configure.in
562 dnl ===============================================================
563 if test "$GNU_CC"; then
564 AC_CACHE_CHECK(for visibility(hidden) attribute,
565 ac_cv_visibility_hidden,
566 [cat > conftest.c <<EOF
567 int foo __attribute__ ((visibility ("hidden"))) = 1;
569 ac_cv_visibility_hidden=no
570 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
571 if grep '\.hidden.*foo' conftest.s >/dev/null; then
572 ac_cv_visibility_hidden=yes
577 if test "$ac_cv_visibility_hidden" = "yes"; then
578 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
579 AC_CACHE_CHECK(for visibility pragma support,
580 ac_cv_visibility_pragma,
581 [cat > conftest.c <<EOF
582 #pragma GCC visibility push(hidden)
584 #pragma GCC visibility push(default)
587 ac_cv_visibility_pragma=no
588 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
589 if grep '\.hidden.*foo_hidden' conftest.s >/dev/null; then
590 if ! grep '\.hidden.*foo_default' conftest.s > /dev/null; then
591 ac_cv_visibility_pragma=yes
597 if test "$ac_cv_visibility_pragma" = "yes"; then
598 AC_DEFINE(HAVE_VISIBILITY_PRAGMA)
599 # To work around a build problem on Linux x86-64 (Bugzilla bug
600 # 293438), we use the -fvisibility=hidden flag. This flag is less
601 # optimal than #pragma GCC visibility push(hidden) because the flag
602 # assumes that symbols defined outside the current source file have
603 # the default visibility. This has the advantage that we don't need
604 # to wrap system header files, but has the disadvantage that calls
605 # to hidden symbols defined in other source files cannot be
606 # optimized by the compiler. The -fvisibility=hidden flag does
607 # hide and export symbols correctly.
608 #VISIBILITY_FLAGS='-I$(dist_includedir)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
609 #WRAP_SYSTEM_INCLUDES=1
610 VISIBILITY_FLAGS="-fvisibility=hidden"
611 WRAP_SYSTEM_INCLUDES=
616 fi # SKIP_COMPILER_CHECKS
618 dnl ========================================================
619 dnl Checks for programs.
620 dnl ========================================================
621 if test -z "$SKIP_PATH_CHECKS"; then
622 AC_PATH_PROGS(PERL, perl5 perl, echo not_perl)
623 elif test -z "$PERL"; then
627 dnl ========================================================
628 dnl Default platform specific options
629 dnl ========================================================
634 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
642 if test -n "$CROSS_COMPILE"; then
643 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
645 OS_TEST="${target_cpu}"
646 case "${target_os}" in
647 linux*) OS_ARCH=Linux ;;
648 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
649 mingw*) OS_ARCH=WINNT ;;
650 wince*) OS_ARCH=WINCE ;;
651 winmo*) OS_ARCH=WINCE ;;
652 darwin*) OS_ARCH=Darwin ;;
653 riscos*) OS_ARCH=RISCOS ;;
656 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
657 OS_RELEASE=`uname -r`
661 if test "$OS_ARCH" = "IRIX64"; then
665 if test "$OS_ARCH" = "AIX"; then
666 OS_RELEASE=`uname -v`.`uname -r`
669 if test "$OS_ARCH" = "FreeBSD"; then
670 OS_RELEASE=`echo $OS_RELEASE | sed 's/-.*//'`
673 if test "$OS_ARCH" = "Linux"; then
674 OS_RELEASE=`echo $OS_RELEASE | sed 's/-.*//'`
675 OS_RELEASE=`echo $OS_RELEASE | awk -F\. '{ print $1 "." $2 }'`
678 #######################################################################
679 # Master "Core Components" macros for getting the OS target #
680 #######################################################################
683 # Note: OS_TARGET should be specified on the command line for gmake.
684 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
685 # The difference between the Win95 target and the WinNT target is that
686 # the WinNT target uses Windows NT specific features not available
687 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
688 # at lesser performance (the Win95 target uses threads; the WinNT target
691 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
696 # The following hack allows one to build on a WIN95 machine (as if
697 # s/he were cross-compiling on a WINNT host for a WIN95 target).
698 # It also accomodates for MKS's uname.exe. If you never intend
699 # to do development on a WIN95 machine, you don't need this hack.
714 CYGWIN_9*|CYGWIN_ME*)
715 OS_ARCH='CYGWIN_NT-4.0'
725 # On WIN32, we also define the variable CPU_ARCH.
731 if test "$CPU_ARCH" = "I386"; then
737 # If uname -s returns "Windows_NT", we assume that we are using
738 # the uname.exe in MKS toolkit.
740 # The -r option of MKS uname only returns the major version number.
741 # So we need to use its -v option to get the minor version number.
742 # Moreover, it doesn't have the -p option, so we need to use uname -m.
745 OS_MINOR_RELEASE=`uname -v`
746 if test "$OS_MINOR_RELEASE" = "00"; then
749 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
752 # MKS's uname -m returns "586" on a Pentium machine.
754 if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
758 CYGWIN_NT*|MINGW*_NT*)
760 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
761 # the uname.exe in the Cygwin tools.
762 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
763 # the uname.exe in the MSYS tools.
765 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
769 # Cygwin's uname -m returns "i686" on a Pentium Pro machine.
771 if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
777 if test -n "$MOZILLA_CLIENT" && test "$OS_ARCH" = "WINNT"; then
779 if test -n "$MOZ_DEBUG"; then
783 if test -z "$OS_TARGET"; then
786 if test "$OS_TARGET" = "WIN95"; then
789 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
791 dnl ========================================================
792 dnl Enable high-memory support on OS/2 by default.
793 dnl ========================================================
794 AC_ARG_ENABLE(os2-high-mem,
795 [ --disable-os2-high-mem Disable high-memory support on OS/2],
796 [ if test "$enableval" = "no"; then
799 MOZ_OS2_HIGH_MEMORY=1
802 dnl ========================================================
803 dnl Override of system specific host options
804 dnl ========================================================
809 *-cygwin*|*-msvc*|*-mks*|*-wince*|*-winmo*)
810 NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
811 if test `echo "${PATH}" | grep -c \;` = 0; then
812 CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
816 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
821 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
825 dnl ========================================================
826 dnl Override of system specific target options
827 dnl ========================================================
834 DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
835 AC_CHECK_HEADER(sys/atomic_op.h, AC_DEFINE(AIX_HAVE_ATOMIC_OP_H))
836 case "${target_os}" in
838 AC_DEFINE(AIX_RENAME_SELECT)
839 AC_DEFINE(_PR_NO_LARGE_FILES)
840 AIX_LINK_OPTS='-bnso -berok'
841 PR_MD_ASFILES=os_AIX.s
844 AC_DEFINE(AIX_TIMERS)
845 AC_DEFINE(_PR_NO_LARGE_FILES)
849 AIX_LINK_OPTS='-bnso -berok'
850 LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)_shr'
851 LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)_shr'
854 AC_DEFINE(AIX_TIMERS)
855 AC_DEFINE(_PR_HAVE_OFF64_T)
856 AIX_LINK_OPTS='-brtl -bnso -berok'
859 AC_DEFINE(AIX_TIMERS)
860 AC_DEFINE(_PR_HAVE_OFF64_T)
861 AC_DEFINE(AIX4_3_PLUS)
862 AC_DEFINE(HAVE_SOCKLEN_T)
863 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
865 AIX_LINK_OPTS='-brtl -bnso -berok'
868 AC_DEFINE(AIX_TIMERS)
869 AC_DEFINE(_PR_HAVE_OFF64_T)
870 AC_DEFINE(AIX4_3_PLUS)
871 AC_DEFINE(HAVE_SOCKLEN_T)
872 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
874 AIX_LINK_OPTS='-brtl -bnso -berok'
877 CFLAGS="$CFLAGS -qro -qroconst"
878 AIX_WRAP='$(DIST)/lib/aixwrap.o'
879 AIX_TMP='./_aix_tmp.o'
880 if test -n "$USE_64"; then
881 MDCPUCFG_H=_aix64.cfg
884 MDCPUCFG_H=_aix32.cfg
887 RESOLVE_LINK_SYMBOLS=1
894 AC_DEFINE(_POSIX_SOURCE)
899 RESOLVE_LINK_SYMBOLS=1
900 case "${target_cpu}" in
903 _DEBUG_FLAGS='-gdwarf-2 -O0'
904 MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
905 AC_CHECK_LIB(bind, gethostbyaddr, [OS_LIBS="$OS_LIBS -lbind -lsocket"])
911 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'
913 _DEBUG_FLAGS='-g -O0'
921 AC_DEFINE(NEED_BSDREGEX)
923 CFLAGS="$CFLAGS -Wall -Wno-format"
924 CXXFLAGS="$CXXFLAGS -Wall -Wno-format"
926 if echo "$OS_TEST" | grep -c 86 >/dev/null; then
928 elif echo "$OS_TEST" | grep -c sparc >/dev/null; then
939 AC_DEFINE(_PR_BSDI_JMPBUF_IS_ARRAY)
940 AC_DEFINE(_PR_STAT_HAS_ONLY_ST_ATIME)
941 AC_DEFINE(_PR_NEED_H_ERRNO)
948 AC_DEFINE(_PR_TIMESPEC_HAS_TS_SEC)
949 AC_DEFINE(_PR_BSDI_JMPBUF_IS_ARRAY)
952 AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
953 PR_MD_ASFILES=os_BSD_OS_386_2.s
957 AC_DEFINE(_PR_SELECT_CONST_TIMEVAL)
958 AC_DEFINE(_PR_BSDI_JMPBUF_IS_STRUCT)
961 AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
962 MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
964 DSO_LDOPTS='-shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so)'
967 bsdi4.2* | bsdi4.3* | bsdi5.*)
968 AC_DEFINE(_PR_HAVE_GETPROTO_R)
969 AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER)
974 AC_DEFINE(_PR_SELECT_CONST_TIMEVAL)
975 AC_DEFINE(_PR_BSDI_JMPBUF_IS_STRUCT)
978 AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
987 AC_DEFINE(HAVE_BSD_FLOCK)
988 AC_DEFINE(HAVE_SOCKLEN_T)
989 AS='$(CC) -x assembler-with-cpp'
990 CFLAGS="$CFLAGS -Wall -fno-common"
991 case "${target_cpu}" in
993 if test -n "$USE_64"; then
995 CC="$CC -arch x86_64"
1005 DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
1007 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1008 STRIP="$STRIP -x -S"
1011 MDCPUCFG_H=_darwin.cfg
1012 PR_MD_CSRCS=darwin.c
1013 PR_MD_ASFILES=os_Darwin.s
1015 # Add Mac OS X support for loading CFM & CFBundle plugins
1016 if test -f /System/Library/Frameworks/Carbon.framework/Carbon; then
1017 AC_DEFINE(XP_MACOSX)
1020 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1021 dnl Use the specified value
1022 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1023 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
1024 dnl No value specified on the command line or in the environment,
1025 dnl use the lesser of the library's minimum or the architecture's
1027 case "${target_cpu}" in
1029 dnl Architecture minimum 10.2
1030 export MACOSX_DEPLOYMENT_TARGET=10.2
1033 dnl Architecture minimum 10.4
1034 export MACOSX_DEPLOYMENT_TARGET=10.4
1039 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is
1040 dnl in use. NEXT_ROOT will be set and exported if it's needed for
1043 if test "$MACOS_SDK_DIR"; then
1044 dnl Sync this section with the one in Mozilla's top level.
1046 if test ! -d "$MACOS_SDK_DIR"; then
1047 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1048 specify a valid SDK. SDKs are installed when the optional cross-development
1049 tools are selected during the Xcode/Developer Tools installation.])
1053 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
1054 GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1055 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1057 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1058 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1059 SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks"
1060 if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
1061 SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks"
1064 SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}"
1066 CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
1068 dnl CPP needs to be set for AC_CHECK_HEADER.
1069 CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
1072 HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
1074 if test "$HOST_DARWIN_MAJOR" -lt 9 ; then
1075 dnl The build host is running Tiger (10.4) or earlier.
1076 dnl ld support for -syslibroot is compiler-agnostic, but
1077 dnl only available on Tiger and later. On Tiger and
1078 dnl earlier build hosts, just rely on NEXT_ROOT, because
1079 dnl it's not been shown to cause any problems.
1080 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}"
1082 dnl The build host is running Leopard (10.5) or later.
1083 dnl With NEXT_ROOT set, the linker will still not apply
1084 dnl it when resolving dependencies. This causes problems
1085 dnl on Leopard, where an SDK depends on frameworks which
1086 dnl were present in earlier OS releases (and the associated
1087 dnl SDK) but not in Leopard. -syslibroot does not have
1088 dnl this problem, but it results in harmless warnings when
1089 dnl NEXT_ROOT is set. NEXT_ROOT needs to remain set even
1090 dnl on Leopard because the compiler uses it too.
1091 MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
1094 LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
1095 export NEXT_ROOT=$MACOS_SDK_DIR
1097 if test -n "$CROSS_COMPILE" ; then
1098 dnl NEXT_ROOT will be in the environment, but it
1099 dnl shouldn't be set for the build host. HOST_CXX is
1100 dnl presently unused.
1101 HOST_CC="NEXT_ROOT= $HOST_CC"
1102 HOST_CXX="NEXT_ROOT= $HOST_CXX"
1105 dnl gcc >= 4.0 uses different paths than above, but knows
1106 dnl how to find them itself.
1107 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1109 dnl CPP needs to be set for AC_CHECK_HEADER.
1110 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1112 dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which
1113 dnl has an ld that supports -syslibroot. Don't set
1114 dnl NEXT_ROOT because it will be ignored and cause
1115 dnl warnings when -syslibroot is specified.
1116 if test "$GCC_VERSION_FULL" != "4.0.0" ; then
1117 dnl gcc > 4.0.0 will pass -syslibroot to ld automatically
1118 dnl based on the -isysroot it receives.
1119 LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
1121 dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs
1123 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1132 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
1136 AC_DEFINE(_DGUX_SOURCE)
1137 AC_DEFINE(_POSIX4A_DRAFT6_SOURCE)
1141 MDCPUCFG_H=_dgux.cfg
1146 if test -z "$USE_NSPR_THREADS"; then
1151 AC_DEFINE(HAVE_BSD_FLOCK)
1152 AC_DEFINE(HAVE_SOCKLEN_T)
1153 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
1154 MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
1155 if test "$MOZ_OBJFORMAT" = "elf"; then
1160 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1162 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
1163 MDCPUCFG_H=_freebsd.cfg
1164 PR_MD_CSRCS=freebsd.c
1170 AC_DEFINE(_HPUX_SOURCE)
1171 # OSF1 and HPUX report the POLLHUP event for a socket when the
1172 # shutdown(SHUT_WR) operation is called for the remote end, even though
1173 # the socket is still writeable. Use select(), instead of poll(), to
1174 # workaround this problem.
1175 AC_DEFINE(_PR_POLL_WITH_SELECT)
1176 AC_DEFINE(_USE_BIG_FDS)
1177 DSO_LDOPTS='-b +h $(notdir $@)'
1179 if test "$OS_TEST" = "ia64"; then
1181 DSO_LDOPTS="$DSO_LDOPTS +b '\$\$ORIGIN'"
1182 CPU_ARCH_TAG=_$OS_TEST
1183 if test -z "$USE_64"; then
1186 PR_MD_ASFILES=os_HPUX_ia64.s
1190 PR_MD_ASFILES=os_HPUX.s
1192 if test -n "$USE_64"; then
1193 MDCPUCFG_H=_hpux64.cfg
1195 MDCPUCFG_H=_hpux32.cfg
1197 if test -z "$GNU_CC"; then
1205 if test -n "$MOZILLA_CLIENT"; then
1206 DEFAULT_IMPL_STRATEGY=_EMU
1209 if echo "$OS_RELEASE" | grep ^A.09 >/dev/null; then
1210 AC_DEFINE(_PR_NEED_H_ERRNO)
1212 DEFAULT_IMPL_STRATEGY=_EMU
1216 if echo "$OS_RELEASE" | egrep '^(A.09|B.10)' >/dev/null; then
1217 AC_DEFINE(_PR_NO_LARGE_FILES)
1220 if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
1221 AC_DEFINE(_PR_NEED_H_ERRNO)
1224 if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
1225 AC_DEFINE(HAVE_INT_LOCALTIME_R)
1228 if echo "$OS_RELEASE" | egrep '^(B.10.30|B.11)' >/dev/null; then
1229 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
1232 # HP-UX 11i v2 (B.11.23) or higher
1234 case "$OS_RELEASE" in
1235 [C-Z]*|B.[2-9]*|B.1[2-9]*|B.11.[3-9]*|B.11.2[3-9]*)
1241 if test "$OS_RELEASE" = "B.10.01"; then
1243 DEFAULT_IMPL_STRATEGY=_EMU
1246 if test "$OS_RELEASE" = "B.10.10"; then
1248 AC_DEFINE(HPUX10_10)
1249 DEFAULT_IMPL_STRATEGY=_PTH
1252 if test "$OS_RELEASE" = "B.10.20"; then
1254 AC_DEFINE(HPUX10_20)
1255 if test -z "$GNU_CC"; then
1256 CFLAGS="$CFLAGS +DAportable +DS1.1"
1257 CXXFLAGS="$CXXFLAGS +DAportable +DS1.1"
1259 DEFAULT_IMPL_STRATEGY=_PTH
1262 if test "$OS_RELEASE" = "B.10.30"; then
1264 AC_DEFINE(HPUX10_30)
1265 if test -z "$GNU_CC"; then
1266 CFLAGS="$CFLAGS +DAportable +DS1.1"
1267 CXXFLAGS="$CXXFLAGS +DAportable +DS1.1"
1269 DEFAULT_IMPL_STRATEGY=_PTH
1272 if echo "$OS_RELEASE" | grep ^B.11 >/dev/null; then
1275 AC_DEFINE(_LARGEFILE64_SOURCE)
1276 AC_DEFINE(_PR_HAVE_OFF64_T)
1277 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1278 if test -z "$GNU_CC"; then
1279 if test -z "$USE_64"; then
1280 if test "$OS_TEST" = "ia64"; then
1281 CFLAGS="$CFLAGS +DD32"
1282 CXXFLAGS="$CXXFLAGS +DD32"
1284 CFLAGS="$CFLAGS +DAportable +DS2.0"
1285 CXXFLAGS="$CXXFLAGS +DAportable +DS2.0"
1288 if test "$OS_TEST" = "ia64"; then
1289 CFLAGS="$CFLAGS +DD64"
1290 CXXFLAGS="$CXXFLAGS +DD64"
1292 CFLAGS="$CFLAGS +DA2.0W +DS2.0"
1293 CXXFLAGS="$CXXFLAGS +DA2.0W +DS2.0"
1297 DEFAULT_IMPL_STRATEGY=_PTH
1300 if test "$DEFAULT_IMPL_STRATEGY" = "_EMU"; then
1304 elif test "$DEFAULT_IMPL_STRATEGY" = "_PTH"; then
1306 if test "$USE_NSPR_THREADS"; then
1309 if test "$USE_USER_PTHREADS"; then
1319 AC_DEFINE(_SGI_MP_SOURCE)
1320 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1322 PR_MD_ASFILES=os_Irix.s
1323 MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@'
1325 RESOLVE_LINK_SYMBOLS=1
1326 if test -n "$USE_64"; then
1327 MDCPUCFG_H=_irix64.cfg
1329 MDCPUCFG_H=_irix32.cfg
1331 case "${target_os}" in
1348 if test "$GNU_CC"; then
1350 dnl If we are using gcc with native binutils, we need to
1352 dnl #lineno "filename" num num
1353 dnl lines, which confuse IRIX native as. Add -Wp,-P to the
1354 dnl gcc command line, which passes -P to the preprocessor.
1356 AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
1357 CFLAGS="$CFLAGS -Wall -Wno-format"
1358 _OPTIMIZE_FLAGS="-O6"
1360 if test -n "$USE_N32"; then
1361 AS='as -D_ASM $(INCLUDES) -n32'
1363 AS='as -D_ASM $(INCLUDES)'
1365 CFLAGS="$CFLAGS -fullwarn -xansi"
1366 if test "$USE_N32"; then
1367 _OPTIMIZE_FLAGS="-O -OPT:Olimit=4000"
1369 _OPTIMIZE_FLAGS="-O -Olimit 4000"
1371 if test "$USE_MDUPDATE"; then
1372 CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
1376 CFLAGS="$CFLAGS -multigot"
1377 DSO_LDOPTS="-no_unresolved"
1378 if test "$USE_N32"; then
1379 CFLAGS="$CFLAGS -n32 -woff 1209"
1380 DSO_LDOPTS="$DSO_LDOPTS -n32"
1382 if test "$USE_64"; then
1383 CFLAGS="$CFLAGS -64"
1385 CFLAGS="$CFLAGS -32"
1390 CFLAGS="$CFLAGS -xgot"
1394 if test "${target_os}" = "irix5.3"; then
1397 case "${target_os}" in
1399 if test -z "$GNU_CC"; then
1400 CFLAGS="$CFLAGS -mips3"
1402 AC_DEFINE(_PR_HAVE_GETPROTO_R)
1403 AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER)
1404 AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
1409 AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
1414 *-linux*|*-gnu*|*-k*bsd*-gnu)
1415 if test -z "$USE_NSPR_THREADS"; then
1420 AC_DEFINE(_GNU_SOURCE)
1421 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1422 case "${target_os}" in
1427 CFLAGS="$CFLAGS -Wall"
1428 CXXFLAGS="$CXXFLAGS -Wall"
1429 MDCPUCFG_H=_linux.cfg
1431 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1433 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
1435 _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
1436 # combo is not yet good at debugging inlined
1437 # functions (even when using DWARF2 as the
1440 if echo "$OS_TEST" | grep -c 86 >/dev/null; then
1445 CPU_ARCH_TAG=_${CPU_ARCH}
1446 case "${target_cpu}" in
1450 CFLAGS="$CFLAGS -mieee"
1451 CXXFLAGS="$CXXFLAGS -mieee"
1455 PR_MD_ASFILES=os_Linux_x86.s
1458 PR_MD_ASFILES=os_Linux_ia64.s
1461 if test -n "$USE_64"; then
1462 PR_MD_ASFILES=os_Linux_x86_64.s
1465 PR_MD_ASFILES=os_Linux_x86.s
1471 PR_MD_ASFILES=os_Linux_ppc.s
1474 if test -n "$USE_64"; then
1478 PR_MD_ASFILES=os_Linux_ppc.s
1482 CFLAGS="$CFLAGS -m68020-60"
1483 CXXFLAGS="$CXXFLAGS -m68020-60"
1488 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1491 PR_MD_ARCH_DIR=windows
1492 RESOLVE_LINK_SYMBOLS=1
1494 if test -n "$GNU_CC"; then
1495 CC="$CC -mno-cygwin"
1496 CXX="$CXX -mno-cygwin"
1498 MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
1500 # Use temp file for windres (bug 213281)
1501 RCFLAGS='-O coff --use-temp-file'
1506 AR='lib -NOLOGO -OUT:"$@"'
1508 RANLIB='echo not_ranlib'
1509 STRIP='echo not_strip'
1511 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1516 # Determine compiler version
1517 CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
1518 _CC_MAJOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $1 }'`
1519 _CC_MINOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $2 }'`
1520 MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
1522 # Ensure that mt is Microsoft (R) Manifest Tool and not magnetic
1523 # tape manipulation utility (or something else)
1524 if test "$MSC_VER" -ge "1400"; then
1526 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
1529 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
1530 if test -n "$MSMT_TOOL"; then
1531 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
1532 if test -z "$MSMANIFEST_TOOL_VERSION"; then
1533 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
1538 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
1542 CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
1543 DLLFLAGS="$DLLFLAGS -OUT:\"\$@\""
1546 if test -z "$MOZ_OPTIMIZE"; then
1547 CFLAGS="$CFLAGS -Od"
1550 if test -n "$USE_DEBUG_RTL"; then
1551 CFLAGS="$CFLAGS -MDd"
1553 CFLAGS="$CFLAGS -MD"
1556 if test -n "$MOZ_DEBUG"; then
1559 DEFINES="$DEFINES -U_DEBUG"
1562 if test -n "$MOZ_OPTIMIZE"; then
1563 if test -n "$MOZ_DEBUG_SYMBOLS"; then
1564 _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Zi"
1565 DLLFLAGS="$DLLFLAGS -DEBUG -OPT:REF"
1566 LDFLAGS="$LDFLAGS -DEBUG -OPT:REF"
1570 if test -n "$MOZ_DEBUG"; then
1571 DLLFLAGS="$DLLFLAGS -DEBUG"
1572 LDFLAGS="$LDFLAGS -DEBUG"
1575 OS_DLLFLAGS="-nologo -DLL -SUBSYSTEM:WINDOWS"
1576 if test "$MSC_VER" -le "1200" -a -z "$MOZ_DEBUG_SYMBOLS"; then
1577 OS_DLLFLAGS="$OS_DLLFLAGS -PDB:NONE"
1580 if test "$OS_TARGET" = "WINNT"; then
1581 CFLAGS="$CFLAGS -GT"
1582 LIBNSPR='$(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1583 LIBPLC='$(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1585 LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1586 LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1590 if test -n "$USE_STATIC_TLS"; then
1591 AC_DEFINE(_PR_USE_STATIC_TLS)
1594 if test "$OS_TARGET" = "WINNT"; then
1598 # undefine WINNT as some versions of mingw gcc define it by default
1599 DEFINES="$DEFINES -UWINNT"
1600 AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
1603 if test "$CPU_ARCH" = "x86"; then
1606 CPU_ARCH_TAG=$CPU_ARCH
1609 if test -n "$USE_DEBUG_RTL"; then
1613 case "$OS_TARGET" in
1615 MDCPUCFG_H=_winnt.cfg
1618 MDCPUCFG_H=_win95.cfg
1621 AC_MSG_ERROR([Missing OS_TARGET for ${target}. Use --enable-win32-target to set.])
1625 case "$target_cpu" in
1627 if test -n "$USE_64"; then
1651 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1655 if test "$USE_64"; then
1665 AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
1667 AR='lib -NOLOGO -OUT:"$@"'
1673 MKSHLIB='$(LD) -DLL $(DSO_LDOPTS) -OUT:$@'
1675 PR_MD_ARCH_DIR=windows
1676 RESOLVE_LINK_SYMBOLS=1
1678 MDCPUCFG_H=_win95.cfg
1679 LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1680 LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1682 DLLFLAGS='-OUT:"$@"'
1683 if test -n "$MOZ_DEBUG_SYMBOLS"; then
1684 OS_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1685 OS_DLLFLAGS='-DEBUG -DEBUGTYPE:CV'
1686 DSO_LDOPTS='-DEBUG -DEBUGTYPE:CV'
1698 if test "$OS_RELEASE" = "2.03"; then
1699 AC_DEFINE(_PR_STAT_HAS_ST_ATIM)
1701 AC_DEFINE(_PR_STAT_HAS_ST_ATIM_UNION)
1704 if test -z "$GNU_CC"; then
1705 CFLAGS="$CFLAGS -Hnocopyr"
1706 CXXFLAGS="$CXXFLAGS -Hnocopyr"
1708 CFLAGS="$CFLAGS -fPIC -Wall"
1709 CXXFLAGS="$CXXFLAGS -fPIC -Wall"
1723 if test -z "$GNU_CC"; then
1724 CC='$(NSDEPTH)/build/hcc cc -Xa -KGnum=0 -KOlimit=4000'
1727 OS_LIBS="$OS_LIBS -lsocket -lnsl -ldl"
1736 AC_DEFINE(HAVE_BSD_FLOCK)
1737 if test -z "$USE_NSPR_THREADS"; then
1740 MDCPUCFG_H=_netbsd.cfg
1741 PR_MD_CSRCS=netbsd.c
1743 DSO_CFLAGS='-fPIC -DPIC'
1744 CFLAGS="$CFLAGS -ansi -Wall"
1745 CXXFLAGS="$CXXFLAGS -ansi -Wall"
1746 MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
1748 if test -z "$OBJECT_FMT"; then
1749 if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ 2>/dev/null; then
1752 DSO_LDOPTS='-shared'
1756 DSO_LDOPTS='-shared -Wl,-soname,$(notdir $@)'
1760 if test "$LIBRUNPATH"; then
1761 DSO_LDOPTS="$DSO_LDOPTS -Wl,-R$LIBRUNPATH"
1772 AC_DEFINE(HAVE_SVID_GETTOD)
1774 CFLAGS="$CFLAGS -Xa -fullwarn"
1775 CXXFLAGS="$CXXFLAGS -Xa -fullwarn"
1777 MDCPUCFG_H=_sony.cfg
1781 *-nextstep*|*-openstep*)
1784 AC_DEFINE(HAVE_BSD_FLOCK)
1785 AC_DEFINE(_POSIX_SOURCE)
1786 CFLAGS="$CFLAGS -Wall -fno-common -traditional-cpp -posix"
1787 CXXFLAGS="$CXXFLAGS -Wall -fno-common -traditional-cpp -posix"
1790 MDCPUCFG_H=_nextstep.cfg
1791 PR_MD_CSRCS=nextstep.c
1798 AC_DEFINE(_QNX_SOURCE)
1799 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
1802 MKSHLIB='$(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(notdir $@) -o $@'
1805 OS_LIBS="$OS_LIBS -lsocket"
1806 _OPTIMIZE_FLAGS="-O1"
1807 _DEBUG_FLAGS="-gstabs"
1813 AC_DEFINE(HAVE_BSD_FLOCK)
1814 AC_DEFINE(HAVE_SOCKLEN_T)
1815 CFLAGS="$CFLAGS -ansi -Wall"
1816 CXXFLAGS="$CXXFLAGS -ansi -Wall"
1819 MDCPUCFG_H=_openbsd.cfg
1820 PR_MD_CSRCS=openbsd.c
1822 if test -z "$USE_NSPR_THREADS"; then
1825 DSO_LDOPTS='-shared -fPIC'
1826 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1830 SHELL_OVERRIDE="SHELL = /usr/bin/ksh"
1833 AC_DEFINE(_REENTRANT)
1834 # OSF1 and HPUX report the POLLHUP event for a socket when the
1835 # shutdown(SHUT_WR) operation is called for the remote end, even though
1836 # the socket is still writeable. Use select(), instead of poll(), to
1837 # workaround this problem.
1838 AC_DEFINE(_PR_POLL_WITH_SELECT)
1840 if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then
1844 if test -z "$GNU_CC"; then
1845 CC="$CC -std1 -ieee_with_inexact"
1846 if test "$OS_RELEASE" != "V2.0"; then
1847 CC="$CC -readonly_strings"
1849 _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
1850 AC_CHECK_HEADER(machine/builtins.h, AC_DEFINE(OSF1_HAVE_MACHINE_BUILTINS_H))
1852 CFLAGS="$CFLAGS -mieee"
1853 CXXFLAGS="$CXXFLAGS -mieee"
1856 if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
1857 AC_DEFINE(HAVE_INT_LOCALTIME_R)
1859 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1860 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
1862 if echo $OS_RELEASE | grep -c V4.0 >/dev/null; then
1863 AC_DEFINE(OSF1V4_MAP_PRIVATE_BUG)
1865 DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
1866 MDCPUCFG_H=_osf1.cfg
1873 AC_DEFINE(_PR_NEED_H_ERRNO)
1882 AC_DEFINE(_PR_NEED_H_ERRNO)
1884 MDCPUCFG_H=_riscos.cfg
1885 PR_MD_CSRCS=riscos.c
1887 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
1888 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1897 AC_DEFINE(_PR_NEED_H_ERRNO)
1898 CC='cc -b elf -KPIC'
1899 CXX='$(NSDEPTH)/build/hcpp CC +.cpp +w'
1902 DSO_LDOPTS='-b elf -G'
1903 MDCPUCFG_H=_scoos.cfg
1911 AC_DEFINE(RELIANTUNIX)
1913 AC_DEFINE(HAVE_SVID_GETTOD)
1914 if echo "$OS_TEST" | grep -c 86 2>/dev/null; then
1921 if test "$GNU_CC"; then
1922 AS='$(CC) -x assembler-with-cpp'
1923 if test "$CPU_ARCH" = "mips"; then
1926 CFLAGS="$CFLAGS -Wall -Wno-format"
1929 _OPTIMIZE_FLAGS='-O -F Olimit,4000'
1932 DSO_LDOPTS='-G -z defs -h $(@:$(OBJDIR)/%.so=%.so)'
1934 if test "$OS_RELEASE" = "5.43"; then
1935 AC_DEFINE(IP_MULTICAST)
1938 OS_LIBS="$OS_LIBS -lsocket -lnsl -lresolv -ldl -lc"
1940 MDCPUCFG_H=_reliantunix.cfg
1941 PR_MD_CSRCS=reliantunix.c
1942 if test "${OS_ARCH}" = "mips"; then
1943 PR_MD_ASFILES=os_ReliantUNIX.s
1950 CFLAGS="$CFLAGS -Wall -Wno-format"
1951 if test "$USE_MDUPDATE"; then
1952 CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
1959 if test "$OS_RELEASE" = "4.1.3_U1"; then
1961 OS_LIBS="$OS_LIBS -lm"
1963 MDCPUCFG_H=_sunos4.cfg
1964 PR_MD_CSRCS=sunos4.c
1968 if test -z "$USE_NSPR_THREADS"; then
1977 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1979 MDCPUCFG_H=_solaris.cfg
1980 PR_MD_CSRCS=solaris.c
1982 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1983 RESOLVE_LINK_SYMBOLS=1
1984 case "${OS_RELEASE}" in
1988 # It is safe to use the -Bdirect linker flag on Solaris 10 or later.
1992 if test -n "$GNU_CC"; then
1994 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
1997 DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore'
1998 if test -n "$USE_B_DIRECT"; then
1999 DSO_LDOPTS="$DSO_LDOPTS,-Bdirect"
2003 DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore'
2004 if test -n "$USE_B_DIRECT"; then
2005 DSO_LDOPTS="$DSO_LDOPTS -Bdirect"
2008 if test -n "$GNU_CC"; then
2009 CFLAGS="$CFLAGS -Wall"
2010 CXXFLAGS="$CXXFLAGS -Wall"
2011 if test -n "$USE_MDUPDATE"; then
2012 CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
2013 CXXFLAGS="$CXXFLAGS -MDupdate \$(DEPENDENCIES)"
2015 GCC_AS=`$CC -print-prog-name=as`
2016 if test "`echo | $GCC_AS -v 2>&1 | grep -c GNU`" != "0"; then
2020 CFLAGS="$CFLAGS -xstrconst"
2021 CXXFLAGS="$CXXFLAGS -Qoption cg -xstrconst -features=tmplife"
2022 if test -z "$MOZ_OPTIMIZE"; then
2023 CFLAGS="$CFLAGS -xs"
2024 CXXFLAGS="$CXXFLAGS -xs"
2026 _OPTIMIZE_FLAGS=-xO4
2028 if test -z "$GNU_AS"; then
2029 ASFLAGS="$ASFLAGS -Wa,-P"
2031 if test -n "$USE_64"; then
2032 if test -n "$GNU_CC"; then
2036 if test "$OS_TEST" = "i86pc"; then
2037 CC="$CC -xarch=amd64"
2038 CXX="$CXX -xarch=amd64"
2041 CXX="$CXX -xarch=v9"
2045 if test "$OS_TEST" = "i86pc"; then
2046 if test -z "$USE_64"; then
2049 CPU_ARCH_TAG=_$OS_TEST
2050 # The default debug format, DWARF (-g), is not supported by gcc
2051 # on i386-ANY-sysv4/solaris, but the stabs format is. It is
2052 # assumed that the Solaris assembler /usr/ccs/bin/as is used.
2053 # If your gcc uses GNU as, you do not need the -Wa,-s option.
2054 if test -n "$MOZ_DEBUG" && test -n "$GNU_CC"; then
2055 _DEBUG_FLAGS=-gstabs
2056 if test -z "$GNU_AS"; then
2057 _DEBUG_FLAGS="$_DEBUG_FLAGS -Wa,-s"
2061 case "${target_os}" in
2063 AC_DEFINE(_PR_NO_LARGE_FILES)
2066 AC_DEFINE(_PR_NO_LARGE_FILES)
2069 AC_DEFINE(SOLARIS2_5)
2072 AC_DEFINE(_PR_HAVE_OFF64_T)
2073 # The lfcompile64(5) man page on Solaris 2.6 says:
2074 # For applications that do not wish to conform to the POSIX or
2075 # X/Open specifications, the 64-bit transitional interfaces
2076 # are available by default. No compile-time flags need to be
2078 # But gcc 2.7.2.x fails to define _LARGEFILE64_SOURCE by default.
2079 # The native compiler, gcc 2.8.x, and egcs don't have this problem.
2080 if test -n "$GNU_CC"; then
2081 AC_DEFINE(_LARGEFILE64_SOURCE)
2085 case "${target_os}" in
2097 # Solaris 8 or higher has IPv6.
2098 AC_DEFINE(_PR_INET6)
2101 if test "$CPU_ARCH" = "sparc"; then
2102 # 64-bit Solaris SPARC requires V9 architecture, so the following
2104 if test -z "$USE_64"; then
2105 ULTRASPARC_LIBRARY=nspr_flt
2108 # Purify requires that binaries linked against nspr also
2109 # be linked against -lrt (or -lposix4) so add it to OS_LIBS
2111 _librt=`echo $_rev 5.6 | awk '{ if ($1 > $2) print "-lrt"; else print "-lposix4" }'`
2112 OS_LIBS="$OS_LIBS $_librt"
2121 if echo $OS_RELEASE | grep -c 2.1 2>/dev/null; then
2122 AC_DEFINE(_PR_NO_LARGE_FILES)
2123 CC='$(NSDEPTH)/build/hcc cc'
2124 CXX='$(NSDEPTH)/build/hcpp CC'
2125 MDCPUCFG_H=_unixware.cfg
2127 AC_DEFINE(_LARGEFILE64_SOURCE)
2128 AC_DEFINE(_PR_HAVE_OFF64_T)
2129 AC_DEFINE(_PR_HAVE_SOCKADDR_LEN)
2130 MDCPUCFG_H=_unixware7.cfg
2132 PR_MD_CSRCS=unixware.c
2138 AC_ARG_WITH(symbian-sdk,
2139 [ --with-symbian-sdk=SYMBIAN_SDK_DIR
2140 The path to the Symbian SDK],
2141 SYMBIAN_SDK_DIR=$withval)
2143 echo -----------------------------------------------------------------------------
2144 echo Building with Symbian SDK in: $SYMBIAN_SDK_DIR
2145 echo -----------------------------------------------------------------------------
2150 AC_DEFINE(__SYMBIAN32__)
2153 AC_DEFINE(__SUPPORT_CPP_EXCEPTIONS__)
2154 AC_DEFINE(MOZ_STDERR_TO_STDOUT)
2155 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
2156 AC_DEFINE(HAVE_SOCKLEN_T)
2164 MDCPUCFG_H=_symbian.cfg
2165 PR_MD_CSRCS=symbian.c
2167 RANLIB='echo no ranlib '
2170 OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
2171 CFLAGS="$CFLAGS -MD -nostdinc"
2172 SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
2173 echo -------------------------------------------------------
2174 echo SYMBIAN_SYS_INCLUDE is: $SYMBIAN_SYS_INCLUDE
2175 echo -------------------------------------------------------
2176 case "$OS_TARGET" in
2182 WINSCW_LD_DIR="\$(SYMBIAN_SDK_DIR)/EPOC32/RELEASE/WINSCW/UDEB"
2183 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)"
2184 SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include Symbian_OS_v9.2.hrh"
2185 AR_FLAGS="-library -msgstyle gcc -stdlib -subsystem windows -noimplib -o \$@"
2189 AC_DEFINE(__WINSCW__)
2190 DEFINES="$DEFINES -U_WIN32"
2193 CFLAGS="$CFLAGS -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -x c -msoft-float"
2194 CXXFLAGS="$CXXFLAGS $CFLAGS -Wno-ctor-dtor-privacy"
2195 SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h"
2198 DEFINES="$DEFINES -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
2201 AC_MSG_ERROR([Missing OS_TARGET for ${target}. Set --enable-symbian-target to with 'WINSCW' or 'GCCE'.])
2204 CFLAGS="$CFLAGS ${SYMBIAN_SYS_INCLUDE}"
2210 AC_DEFINE(BSD_SELECT)
2211 AC_DEFINE(TCPV40HDRS)
2219 RESOLVE_LINK_SYMBOLS=1
2224 CFLAGS="$CFLAGS -Wall -Zomf"
2225 CXXFLAGS="$CFLAGS -Wall -Zomf"
2226 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2228 DSO_LDOPTS='-Zomf -Zdll'
2230 _OPTIMIZE_FLAGS="-O2 -s"
2231 _DEBUG_FLAGS="-g -fno-inline"
2232 if test -n "$MOZ_OPTIMIZE"; then
2233 DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2237 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2238 LDFLAGS="$LDFLAGS -Zhigh-mem"
2239 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2242 # GCC for OS/2 currently predefines these, but we don't want them
2243 DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
2252 if test -z "$SKIP_LIBRARY_CHECKS"; then
2253 dnl ========================================================
2254 dnl Check for system libraries
2255 dnl ========================================================
2256 dnl AC_CHECK_LIB(C, main)
2257 dnl AC_CHECK_LIB(C_r, main)
2258 dnl AC_CHECK_LIB(c, main)
2259 dnl AC_CHECK_LIB(c_r, main)
2260 dnl AC_CHECK_LIB(dce, main)
2261 dnl AC_CHECK_LIB(dl, main)
2262 dnl AC_CHECK_LIB(dld, main)
2263 dnl AC_CHECK_LIB(gen, main)
2264 dnl AC_CHECK_LIB(ip6, main)
2265 dnl AC_CHECK_LIB(l, main)
2266 dnl AC_CHECK_LIB(m, main)
2267 dnl AC_CHECK_LIB(nsl, main)
2268 dnl AC_CHECK_LIB(posix4, main)
2269 dnl AC_CHECK_LIB(prstrms, main)
2270 dnl AC_CHECK_LIB(prstrms_shr, main)
2271 dnl AC_CHECK_LIB(pthread, main)
2272 dnl AC_CHECK_LIB(pthreads, main)
2273 dnl AC_CHECK_LIB(resolv, main)
2274 dnl AC_CHECK_LIB(rt, main)
2275 dnl AC_CHECK_LIB(socket, main)
2276 dnl AC_CHECK_LIB(svld, main)
2277 dnl AC_CHECK_LIB(thread, main)
2278 dnl AC_CHECK_LIB(vms_jackets, main)
2281 dnl We don't want anything to link with libdl even if it's present on OS X,
2282 dnl since it's not used and not part of the default installation.
2283 dnl The same goes for BeOS.
2284 dnl OS/2 has dlfcn in libc.
2287 *-darwin*|*-beos*|*-os2*)
2290 AC_CHECK_LIB(dl, dlopen,
2291 AC_CHECK_HEADER(dlfcn.h,
2292 OS_LIBS="-ldl $OS_LIBS"))
2297 dnl ========================================================
2298 dnl Check for system header files.
2299 dnl ========================================================
2300 dnl AC_HEADER_DIRENT
2302 dnl AC_HEADER_SYS_WAIT
2303 dnl AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/ioctl.h sys/time.h unistd.h)
2305 dnl ========================================================
2306 dnl Check for typedefs and structs
2307 dnl ========================================================
2314 dnl AC_STRUCT_ST_BLKSIZE
2315 dnl AC_STRUCT_ST_BLOCKS
2316 dnl AC_STRUCT_ST_RDEV
2320 dnl ========================================================
2321 dnl Checks for library functions.
2322 dnl ========================================================
2323 AC_PROG_GCC_TRADITIONAL
2324 AC_CHECK_FUNCS(lchown strerror)
2328 dnl AC_FUNC_SETVBUF_REVERSED
2330 dnl AC_FUNC_STRFTIME
2331 dnl AC_FUNC_UTIME_NULL
2333 dnl AC_CHECK_FUNCS(ftime getcwd gethostname gettimeofday getwd mkdir mktime putenv rmdir select socket strdup strerror strstr strtol strtoul uname)
2335 dnl ========================================================
2337 dnl ========================================================
2339 dnl ========================================================
2341 dnl = --enable-strip
2343 dnl = Enable stripping of libs and executables
2345 dnl ========================================================
2346 AC_ARG_ENABLE(strip,
2347 [ --enable-strip Enable stripping of shared libs and programs],
2348 [ if test "$enableval" = "yes"; then
2352 dnl Check for hpux options
2353 case "${target_os}" in
2355 if test -z "$GNU_CC"; then
2357 AC_CACHE_CHECK(for +Olit support,
2358 ac_cv_hpux_usable_olit_option,
2359 dnl since aCC doesn't throw an error on invalid options,
2360 dnl we have to test this the hard way
2361 [ac_cv_hpux_usable_olit_option=no
2363 echo 'int main() { return 0; }' | cat > conftest.c
2364 ${CC-cc} ${CFLAGS} +Olit=all -o conftest conftest.c > conftest.out 2>&1
2365 if test $? -eq 0; then
2366 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out`"; then
2367 ac_cv_hpux_usable_olit_option=yes
2373 if test "$ac_cv_hpux_usable_olit_option" = "yes"; then
2374 CFLAGS="$CFLAGS +Olit=all"
2375 CXXFLAGS="$CXXFLAGS +Olit=all"
2377 CFLAGS="$CFLAGS +ESlit"
2378 CXXFLAGS="$CXXFLAGS +ESlit"
2385 dnl Apparently, some systems cannot properly check for the pthread
2386 dnl library unless <pthread.h> is included so we need to test
2389 dnl MOZ_CHECK_PTHREADS(lib, success, failure)
2390 AC_DEFUN(MOZ_CHECK_PTHREADS,
2392 AC_MSG_CHECKING([for pthread_create in -l$1])
2394 #include <pthread.h>
2395 void *foo(void *v) { return v; }
2398 if (!pthread_create(&t, 0, &foo, 0)) {
2403 echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS" 1>&5;
2404 ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS 2>&5;
2406 rm -f dummy.c dummy${ac_exeext} ;
2407 if test "$_res" = "0"; then
2408 AC_MSG_RESULT([yes])
2416 case "$target_os" in
2421 MOZ_CHECK_PTHREADS(pthreads,
2422 _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2423 MOZ_CHECK_PTHREADS(pthread,
2424 _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2425 MOZ_CHECK_PTHREADS(c_r,
2426 _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2427 MOZ_CHECK_PTHREADS(c,
2436 AC_ARG_WITH(pthreads,
2437 [ --with-pthreads Use system pthreads library as thread subsystem],
2438 [ if test "$withval" = "yes"; then
2439 if test -n "$_HAVE_PTHREADS"; then
2444 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2450 [ if test -n "$_HAVE_PTHREADS" && test -z "$USE_USER_PTHREADS" && test -z "$USE_NSPR_THREADS"; then
2456 AC_ARG_ENABLE(user-pthreads,
2457 [ --enable-user-pthreads Build using userland pthreads],
2458 [ if test "$enableval" = "yes"; then
2459 if test -n "$_HAVE_PTHREADS"; then
2464 AC_MSG_ERROR([ --enable-user-pthreads specified for a system without pthread support ]);
2468 AC_ARG_ENABLE(nspr-threads,
2469 [ --enable-nspr-threads Build using classic nspr threads],
2470 [ if test "$enableval" = "yes"; then
2478 AC_ARG_WITH(bthreads,
2479 [ --with-bthreads Use system bthreads library as thread subsystem
2481 [ if test "$withval" = "yes"; then
2489 fi # SKIP_LIBRARY_CHECKS
2492 [ --enable-ipv6 Compile ipv6 support],
2493 [ if test "$enableval" = "yes"; then
2500 AC_ARG_ENABLE(boehm,
2501 [ --enable-boehm Enable the Boehm Garbage Collector],
2502 [ if test "$enableval" = "yes"; then
2503 AC_DEFINE(GC_LEAK_DETECTOR)
2507 if test -n "$USE_PTHREADS"; then
2508 dnl See if -pthread is supported.
2510 ac_cv_have_dash_pthread=no
2511 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2512 echo 'int main() { return 0; }' | cat > conftest.c
2513 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2514 if test $? -eq 0; then
2515 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2516 ac_cv_have_dash_pthread=yes
2517 case "$target_os" in
2519 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2522 CFLAGS="$CFLAGS -pthread"
2523 CXXFLAGS="$CXXFLAGS -pthread"
2529 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2532 dnl See if -pthreads is supported.
2534 ac_cv_have_dash_pthreads=no
2535 if test "$ac_cv_have_dash_pthread" = "no"; then
2536 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2537 echo 'int main() { return 0; }' | cat > conftest.c
2538 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2539 if test $? -eq 0; then
2540 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2541 ac_cv_have_dash_pthreads=yes
2542 CFLAGS="$CFLAGS -pthreads"
2543 CXXFLAGS="$CXXFLAGS -pthreads"
2547 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2552 if test "$ac_cv_have_dash_pthreads" = "yes"; then
2557 AC_DEFINE(_REENTRANT)
2558 AC_DEFINE(_THREAD_SAFE)
2559 dnl -pthread links in -lc_r, so don't specify it explicitly.
2560 if test "$ac_cv_have_dash_pthread" = "yes"; then
2561 _PTHREAD_LDFLAGS="-pthread"
2563 _PTHREAD_LDFLAGS="-lc_r"
2567 if test "$ac_cv_have_dash_pthread" = "yes"; then
2568 _PTHREAD_LDFLAGS="-pthread"
2572 AC_DEFINE(_THREAD_SAFE)
2573 dnl -pthread links in -lc_r, so don't specify it explicitly.
2574 if test "$ac_cv_have_dash_pthread" = "yes"; then
2579 if test "$ac_cv_have_dash_pthread" = "yes"; then
2580 _PTHREAD_LDFLAGS=-pthread
2583 *-linux*|*-gnu*|*-k*bsd*-gnu)
2584 AC_DEFINE(_REENTRANT)
2589 if test -n "$USE_USER_PTHREADS"; then
2596 dnl Special thread exceptions
2600 if test -n "$USE_NSPR_THREADS"; then
2601 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2603 case "$target_os" in
2605 if test -z "$USE_PTHREADS"; then
2606 AC_DEFINE(AIX_RENAME_SELECT)
2610 if test -z "$USE_NSPR_THREADS"; then
2611 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2615 if test -z "$USE_NSPR_THREADS"; then
2616 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2618 if test -n "$USE_PTHREADS"; then
2619 AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2623 if test -z "$USE_NSPR_THREADS"; then
2624 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2626 if test -n "$USE_PTHREADS"; then
2627 AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2633 if test -n "$USE_PTHREADS"; then
2634 AC_DEFINE(_PR_NEED_PTHREAD_INIT)
2638 if test -n "$USE_NSPR_THREADS"; then
2639 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2643 if test -n "$USE_NSPR_THREADS"; then
2644 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2646 if test "$USE_PTHREADS"; then
2647 if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
2648 AC_DEFINE(_REENTRANT)
2649 AC_DEFINE(_PR_DCETHREADS)
2651 AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
2652 AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2655 if test "$USE_USER_PTHREADS"; then
2656 AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
2660 if test "${target_os}" = "irix6.5"; then
2661 if test -n "$USE_PTHREADS"; then
2662 AC_DEFINE(_PR_HAVE_GETHOST_R)
2663 AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
2667 *-linux*|*-gnu*|*-k*bsd*-gnu)
2668 if test -n "$USE_NSPR_THREADS"; then
2669 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2672 *-mingw*|*-cygwin*|*-msvc*|*-mks*|*-wince*|*-winmo*|*-os2*|*-beos*)
2673 dnl win32, wince, os2 & beos cannot use pthreads
2678 *-netbsd*|*-openbsd*)
2679 if test -n "$USE_NSPR_THREADS"; then
2680 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2684 if test -n "$USE_NSPR_THREADS"; then
2685 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2687 if test -n "$USE_PTHREADS"; then
2688 if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
2691 AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2696 if test -n "$USE_NSPR_THREADS"; then
2697 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2699 if test -n "$USE_PTHREADS"; then
2700 AC_DEFINE(_REENTRANT)
2701 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2702 if test "$OS_TEST" = "i86pc"; then
2703 if test -n "$USE_64"; then
2704 PR_MD_ASFILES=os_SunOS_x86_64.s
2706 PR_MD_ASFILES=os_SunOS_x86.s
2709 if test -n "$USE_64"; then
2710 PR_MD_ASFILES=os_SunOS_sparcv9.s
2716 if test -n "$USE_PTHREADS"; then
2717 AC_DEFINE(_PR_HAVE_GETHOST_R)
2718 AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
2723 OS_LIBS="$_PTHREAD_LDFLAGS $OS_LIBS"
2725 dnl If the user passed in arg to --enable-optimize or --enable-debug,
2726 dnl make sure that we use it.
2727 if test -n "$_SAVE_OPTIMIZE_FLAGS"; then
2728 _OPTIMIZE_FLAGS="$_SAVE_OPTIMIZE_FLAGS"
2731 if test -n "$_SAVE_DEBUG_FLAGS"; then
2732 _DEBUG_FLAGS="$_SAVE_DEBUG_FLAGS"
2735 if test -n "$MOZ_OPTIMIZE"; then
2736 CFLAGS="$CFLAGS $_OPTIMIZE_FLAGS"
2737 CXXFLAGS="$CXXFLAGS $_OPTIMIZE_FLAGS"
2740 if test -n "$MOZ_DEBUG"; then
2741 CFLAGS="$CFLAGS $_DEBUG_FLAGS"
2742 CXXFLAGS="$CXXFLAGS $_DEBUG_FLAGS"
2745 if test -n "$MOZ_OPTIMIZE"; then
2751 if test -n "$USE_64"; then
2755 RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${COMPILER_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}.${OBJDIR_SUFFIX}"
2757 dnl ========================================================
2758 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
2759 dnl ========================================================
2760 case "$target_os" in
2762 CC="\$(CYGWIN_WRAPPER) $CC"
2763 CXX="\$(CYGWIN_WRAPPER) $CXX"
2764 RC="\$(CYGWIN_WRAPPER) $RC"
2768 dnl ========================================================
2769 dnl Substitution of found variables.
2770 dnl ========================================================
2771 AC_SUBST(SHELL_OVERRIDE)
2773 AC_SUBST(MOZILLA_CLIENT)
2780 AC_SUBST(HOST_CFLAGS)
2782 AC_SUBST(HOST_LDFLAGS)
2784 AC_SUBST(GCC_USE_GNU_LD)
2786 AC_SUBST(CROSS_COMPILE)
2788 AC_SUBST(MOZ_OPTIMIZE)
2794 AC_SUBST(OBJECT_MODE)
2795 AC_SUBST(GC_LEAK_DETECTOR)
2796 AC_SUBST(ENABLE_STRIP)
2798 AC_SUBST(USE_PTHREADS)
2799 AC_SUBST(USE_BTHREADS)
2800 AC_SUBST(USE_USER_PTHREADS)
2801 AC_SUBST(USE_NSPR_THREADS)
2806 AC_SUBST(MOD_MAJOR_VERSION)
2807 AC_SUBST(MOD_MINOR_VERSION)
2808 AC_SUBST(MOD_PATCH_VERSION)
2809 AC_SUBST(NSPR_MODNAME)
2810 AC_SUBST(MDCPUCFG_H)
2811 AC_SUBST(PR_MD_CSRCS)
2812 AC_SUBST(PR_MD_ASFILES)
2813 AC_SUBST(PR_MD_ARCH_DIR)
2816 AC_SUBST(OBJ_SUFFIX)
2817 AC_SUBST(LIB_SUFFIX)
2818 AC_SUBST(DLL_SUFFIX)
2819 AC_SUBST(ASM_SUFFIX)
2821 AC_SUBST(DSO_CFLAGS)
2822 AC_SUBST(DSO_LDOPTS)
2826 AC_SUBST(OS_RELEASE)
2828 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2844 AC_SUBST(RESOLVE_LINK_SYMBOLS)
2845 AC_SUBST(AIX_LINK_OPTS)
2846 AC_SUBST(NOSUCHFILE)
2847 AC_SUBST(MOZ_OBJFORMAT)
2848 AC_SUBST(ULTRASPARC_LIBRARY)
2851 AC_SUBST(OBJDIR_NAME)
2852 AC_SUBST(RELEASE_OBJDIR_NAME)
2859 AC_SUBST(OS_DLLFLAGS)
2860 AC_SUBST(CYGWIN_WRAPPER)
2861 AC_SUBST(VISIBILITY_FLAGS)
2862 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2863 AC_SUBST(MACOS_SDK_DIR)
2864 AC_SUBST(SYMBIAN_SDK_DIR)
2868 dnl ========================================================
2869 dnl Generate output files.
2870 dnl ========================================================
2881 lib/libc/include/Makefile
2882 lib/libc/src/Makefile
2886 pkg/solaris/Makefile
2887 pkg/solaris/SUNWpr/Makefile
2888 pkg/solaris/SUNWprd/Makefile
2891 pr/include/md/Makefile
2892 pr/include/obsolete/Makefile
2893 pr/include/private/Makefile
2896 pr/src/linking/Makefile
2897 pr/src/malloc/Makefile
2899 pr/src/md/${PR_MD_ARCH_DIR}/Makefile
2900 pr/src/memory/Makefile
2901 pr/src/misc/Makefile
2902 pr/src/threads/Makefile
2904 pr/tests/dll/Makefile
2907 dnl lib/tests/Makefile
2908 dnl pr/tests/w16gui/Makefile
2911 if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then
2912 MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile"
2913 elif test -n "$USE_PTHREADS"; then
2914 MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile"
2915 elif test -n "$USE_BTHREADS"; then
2916 MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile"
2919 if test -n "$USE_CPLUS"; then
2920 MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile"
2923 echo $MAKEFILES > unallmakefiles
2925 AC_OUTPUT([$MAKEFILES], [chmod +x config/nspr-config])