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`,
214 AC_ARG_ENABLE(debug-rtl,
215 [ --enable-debug-rtl Use the MSVC debug runtime library],
216 [ if test "$enableval" = "yes"; then
221 [ --enable-n32 Enable n32 ABI support (IRIX only)],
222 [ if test "$enableval" = "yes"; then
224 else if test "$enableval" = "no"; then
230 [ --enable-64bit Enable 64-bit support (on certain platforms)],
231 [ if test "$enableval" = "yes"; then
235 AC_ARG_ENABLE(mdupdate,
236 [ --enable-mdupdate Enable use of certain compilers' mdupdate feature],
237 [ if test "$enableval" = "yes"; then
242 [ --enable-cplus Enable some c++ api routines],
243 [ if test "$enableval" = "yes"; then
247 AC_ARG_WITH(arm-kuser,
248 [ --with-arm-kuser Use kuser helpers (Linux/ARM only)
249 (Requires kernel 2.6.13 or later)],
250 [ if test "$withval" = "yes"; then
251 AC_DEFINE(_PR_ARM_KUSER)
254 dnl ========================================================
255 dnl = Mac OS X SDK support
256 dnl ========================================================
257 AC_ARG_WITH(macos-sdk,
258 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
259 MACOS_SDK_DIR=$withval)
261 AC_ARG_ENABLE(macos-target,
262 [ --enable-macos-target=VER
263 Set the minimum MacOS version needed at runtime
264 [10.2 for ppc, 10.4 for x86]],
265 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
267 dnl ========================================================
269 dnl = Set the threading model
271 dnl ========================================================
275 case "${target_os}" in
287 dnl ========================================================
289 dnl = Set the default C compiler
291 dnl ========================================================
292 if test -z "$CC"; then
296 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
375 if test -z "$SKIP_PATH_CHECKS"; then
376 AC_PATH_PROG(WHOAMI, $WHOAMI whoami, echo not_whoami)
379 if test -n "$MOZ_DEBUG"; then
381 DEFINES="$DEFINES -UNDEBUG"
383 case "${target_os}" in
385 DEFINES="$DEFINES -DDEBUG_${USER}"
387 msvc*|mks*|cygwin*|mingw*|os2*)
388 DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
391 DEFINES="$DEFINES -DDEBUG_`$WHOAMI`"
396 DEFINES="$DEFINES -UDEBUG"
399 if test -z "$SKIP_COMPILER_CHECKS"; then
400 dnl ========================================================
401 dnl Checks for compilers.
402 dnl ========================================================
403 if test "$target" != "$host"; then
404 echo "cross compiling from $host to $target"
408 _SAVE_CFLAGS="$CFLAGS"
409 _SAVE_LDFLAGS="$LDFLAGS"
411 AC_MSG_CHECKING([for $host compiler])
412 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc, "")
413 if test -z "$HOST_CC"; then
414 AC_MSG_ERROR([no acceptable cc found in \$PATH])
416 AC_MSG_RESULT([$HOST_CC])
417 if test -z "$HOST_CFLAGS"; then
418 HOST_CFLAGS="$CFLAGS"
420 if test -z "$HOST_LDFLAGS"; then
421 HOST_LDFLAGS="$LDFLAGS"
425 CFLAGS="$HOST_CFLAGS"
426 LDFLAGS="$HOST_LDFLAGS"
428 AC_MSG_CHECKING([whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
429 AC_TRY_COMPILE([], [return(0);],
430 [ac_cv_prog_host_cc_works=1 AC_MSG_RESULT([yes])],
431 AC_MSG_ERROR([installation or configuration problem: $host compiler $HOST_CC cannot create executables.]) )
435 LDFLAGS=$_SAVE_LDFLAGS
437 case "$build:$target" in
438 powerpc-apple-darwin8*:i?86-apple-darwin*)
439 dnl The Darwin cross compiler doesn't necessarily point itself at a
440 dnl root that has libraries for the proper architecture, it defaults
441 dnl to the system root. The libraries in the system root on current
442 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
443 dnl checks will fail. Fake a working SDK in that case.
445 _SAVE_CXXFLAGS=$CXXLAGS
446 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
447 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
451 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo)
454 if test -n "$USE_CPLUS"; then
455 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", echo)
460 case "$build:$target" in
461 powerpc-apple-darwin8*:i?86-apple-darwin*)
462 dnl Revert the changes made above. From this point on, the target
463 dnl compiler will never be used without applying the SDK to CFLAGS
464 dnl (see --with-macos-sdk below).
466 CXXFLAGS=$_SAVE_CXXFLAGS
470 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", echo)
471 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", echo)
472 AC_CHECK_PROGS(AS, $AS "${target_alias}-as" "${target}-as", echo)
473 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", echo)
474 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", echo)
475 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", echo)
479 if test -n "$USE_CPLUS"; then
480 if test "$CC" = "cl" -a -z "$CXX"; then
488 AC_PATH_PROGS(AS, as, $CC)
489 AC_PATH_PROGS(AR, ar, echo not_ar)
490 AC_PATH_PROGS(LD, ld link, echo not_ld)
491 AC_PATH_PROGS(STRIP, strip, echo not_strip)
492 AC_PATH_PROGS(WINDRES, windres, echo not_windres)
493 if test -z "$HOST_CC"; then
496 if test -z "$HOST_CFLAGS"; then
497 HOST_CFLAGS="$CFLAGS"
501 if test "$GCC" = "yes"; then
504 if test "$GXX" = "yes"; then
507 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
512 case "$build:$target" in
513 i?86-apple-darwin*:powerpc-apple-darwin*)
514 dnl cross_compiling will have erroneously been set to "no" in this
515 dnl case, because the x86 build host is able to run ppc code in a
516 dnl translated environment, making a cross compiler appear native.
521 if test "$cross_compiling" = "yes"; then
527 dnl ========================================================
528 dnl Check for gcc -pipe support
529 dnl ========================================================
530 AC_MSG_CHECKING([for gcc -pipe support])
531 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
532 echo '#include <stdio.h>' > dummy-hello.c
533 echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c
534 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
535 cat dummy-hello.s | ${AS} -o dummy-hello.S - 2>&5
541 if test "$_res_as_stdin" = "yes"; then
543 CFLAGS="$CFLAGS -pipe"
544 AC_TRY_COMPILE( [ #include <stdio.h> ],
545 [printf("Hello World\n");],
546 [_res_gcc_pipe="yes"],
547 [_res_gcc_pipe="no"] )
550 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
552 CFLAGS="$CFLAGS -pipe"
553 CXXFLAGS="$CXXFLAGS -pipe"
557 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
558 AC_MSG_RESULT([$_res])
563 dnl ===============================================================
564 dnl Check for .hidden assembler directive and visibility attribute.
565 dnl Borrowed from glibc configure.in
566 dnl ===============================================================
567 if test "$GNU_CC"; then
568 AC_CACHE_CHECK(for visibility(hidden) attribute,
569 ac_cv_visibility_hidden,
570 [cat > conftest.c <<EOF
571 int foo __attribute__ ((visibility ("hidden"))) = 1;
573 ac_cv_visibility_hidden=no
574 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
575 if grep '\.hidden.*foo' conftest.s >/dev/null; then
576 ac_cv_visibility_hidden=yes
581 if test "$ac_cv_visibility_hidden" = "yes"; then
582 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
583 AC_CACHE_CHECK(for visibility pragma support,
584 ac_cv_visibility_pragma,
585 [cat > conftest.c <<EOF
586 #pragma GCC visibility push(hidden)
588 #pragma GCC visibility push(default)
591 ac_cv_visibility_pragma=no
592 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
593 if grep '\.hidden.*foo_hidden' conftest.s >/dev/null; then
594 if ! grep '\.hidden.*foo_default' conftest.s > /dev/null; then
595 ac_cv_visibility_pragma=yes
601 if test "$ac_cv_visibility_pragma" = "yes"; then
602 AC_DEFINE(HAVE_VISIBILITY_PRAGMA)
603 # To work around a build problem on Linux x86-64 (Bugzilla bug
604 # 293438), we use the -fvisibility=hidden flag. This flag is less
605 # optimal than #pragma GCC visibility push(hidden) because the flag
606 # assumes that symbols defined outside the current source file have
607 # the default visibility. This has the advantage that we don't need
608 # to wrap system header files, but has the disadvantage that calls
609 # to hidden symbols defined in other source files cannot be
610 # optimized by the compiler. The -fvisibility=hidden flag does
611 # hide and export symbols correctly.
612 #VISIBILITY_FLAGS='-I$(dist_includedir)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
613 #WRAP_SYSTEM_INCLUDES=1
614 VISIBILITY_FLAGS="-fvisibility=hidden"
615 WRAP_SYSTEM_INCLUDES=
620 fi # SKIP_COMPILER_CHECKS
622 dnl ========================================================
623 dnl Checks for programs.
624 dnl ========================================================
625 if test -z "$SKIP_PATH_CHECKS"; then
626 AC_PATH_PROGS(PERL, perl5 perl, echo not_perl)
627 elif test -z "$PERL"; then
631 dnl ========================================================
632 dnl Default platform specific options
633 dnl ========================================================
638 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
646 if test -n "$CROSS_COMPILE"; then
647 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
649 OS_TEST="${target_cpu}"
650 case "${target_os}" in
651 linux*) OS_ARCH=Linux ;;
652 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
653 mingw*) OS_ARCH=WINNT ;;
654 darwin*) OS_ARCH=Darwin ;;
657 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
658 OS_RELEASE=`uname -r`
662 if test "$OS_ARCH" = "IRIX64"; then
666 if test "$OS_ARCH" = "AIX"; then
667 OS_RELEASE=`uname -v`.`uname -r`
670 if test "$OS_ARCH" = "FreeBSD"; then
671 OS_RELEASE=`echo $OS_RELEASE | sed 's/-.*//'`
674 if test "$OS_ARCH" = "Linux"; then
675 OS_RELEASE=`echo $OS_RELEASE | sed 's/-.*//'`
676 OS_RELEASE=`echo $OS_RELEASE | awk -F\. '{ print $1 "." $2 }'`
679 if test "$OS_ARCH" = "OpenVMS"; then
680 OS_RELEASE=`uname -v`
683 #######################################################################
684 # Master "Core Components" macros for getting the OS target #
685 #######################################################################
688 # Note: OS_TARGET should be specified on the command line for gmake.
689 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
690 # The difference between the Win95 target and the WinNT target is that
691 # the WinNT target uses Windows NT specific features not available
692 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
693 # at lesser performance (the Win95 target uses threads; the WinNT target
696 # When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
697 # is built. See: win16_3.11.mk for lots more about the Win16 target.
699 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
704 # The following hack allows one to build on a WIN95 machine (as if
705 # s/he were cross-compiling on a WINNT host for a WIN95 target).
706 # It also accomodates for MKS's uname.exe. If you never intend
707 # to do development on a WIN95 machine, you don't need this hack.
722 CYGWIN_9*|CYGWIN_ME*)
723 OS_ARCH='CYGWIN_NT-4.0'
733 # On WIN32, we also define the variable CPU_ARCH.
739 if test "$CPU_ARCH" = "I386"; then
745 # If uname -s returns "Windows_NT", we assume that we are using
746 # the uname.exe in MKS toolkit.
748 # The -r option of MKS uname only returns the major version number.
749 # So we need to use its -v option to get the minor version number.
750 # Moreover, it doesn't have the -p option, so we need to use uname -m.
753 OS_MINOR_RELEASE=`uname -v`
754 if test "$OS_MINOR_RELEASE" = "00"; then
757 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
760 # MKS's uname -m returns "586" on a Pentium machine.
762 if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
766 CYGWIN_NT*|MINGW*_NT*)
768 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
769 # the uname.exe in the Cygwin tools.
770 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
771 # the uname.exe in the MSYS tools.
773 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
777 # Cygwin's uname -m returns "i686" on a Pentium Pro machine.
779 if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
785 if test -n "$MOZILLA_CLIENT" && test "$OS_ARCH" = "WINNT"; then
787 if test -n "$MOZ_DEBUG"; then
791 if test -z "$OS_TARGET"; then
794 if test "$OS_TARGET" = "WIN95"; then
797 if test "$OS_TARGET" = "WIN16"; then
800 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
802 dnl ========================================================
803 dnl Enable high-memory support on OS/2 by default.
804 dnl ========================================================
805 AC_ARG_ENABLE(os2-high-mem,
806 [ --disable-os2-high-mem Disable high-memory support on OS/2],
807 [ if test "$enableval" = "no"; then
810 MOZ_OS2_HIGH_MEMORY=1
813 dnl ========================================================
814 dnl Override of system specific host options
815 dnl ========================================================
820 *-cygwin*|*-msvc*|*-mks*)
821 NSINSTALL='$(CYGWIN_WRAPPER) nsinstall'
822 if test `echo "${PATH}" | grep -c \;` = 0; then
823 CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
827 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
832 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
836 dnl ========================================================
837 dnl Override of system specific target options
838 dnl ========================================================
845 DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
846 AC_CHECK_HEADER(sys/atomic_op.h, AC_DEFINE(AIX_HAVE_ATOMIC_OP_H))
847 case "${target_os}" in
849 AC_DEFINE(AIX_RENAME_SELECT)
850 AC_DEFINE(_PR_NO_LARGE_FILES)
851 AIX_LINK_OPTS='-bnso -berok'
852 PR_MD_ASFILES=os_AIX.s
855 AC_DEFINE(AIX_TIMERS)
856 AC_DEFINE(_PR_NO_LARGE_FILES)
860 AIX_LINK_OPTS='-bnso -berok'
861 LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)_shr'
862 LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)_shr'
865 AC_DEFINE(AIX_TIMERS)
866 AC_DEFINE(_PR_HAVE_OFF64_T)
867 AIX_LINK_OPTS='-brtl -bnso -berok'
870 AC_DEFINE(AIX_TIMERS)
871 AC_DEFINE(_PR_HAVE_OFF64_T)
872 AC_DEFINE(AIX4_3_PLUS)
873 AC_DEFINE(HAVE_SOCKLEN_T)
874 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
876 AIX_LINK_OPTS='-brtl -bnso -berok'
879 AC_DEFINE(AIX_TIMERS)
880 AC_DEFINE(_PR_HAVE_OFF64_T)
881 AC_DEFINE(AIX4_3_PLUS)
882 AC_DEFINE(HAVE_SOCKLEN_T)
883 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
885 AIX_LINK_OPTS='-brtl -bnso -berok'
888 CFLAGS="$CFLAGS -qro -qroconst"
889 AIX_WRAP='$(DIST)/lib/aixwrap.o'
890 AIX_TMP='./_aix_tmp.o'
891 if test -n "$USE_64"; then
892 MDCPUCFG_H=_aix64.cfg
895 MDCPUCFG_H=_aix32.cfg
898 RESOLVE_LINK_SYMBOLS=1
905 AC_DEFINE(_POSIX_SOURCE)
910 RESOLVE_LINK_SYMBOLS=1
911 case "${target_cpu}" in
914 _DEBUG_FLAGS='-gdwarf-2 -O0'
915 MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
916 AC_CHECK_LIB(bind, gethostbyaddr, [OS_LIBS="$OS_LIBS -lbind -lsocket"])
922 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'
924 _DEBUG_FLAGS='-g -O0'
932 AC_DEFINE(NEED_BSDREGEX)
934 CFLAGS="$CFLAGS -Wall -Wno-format"
935 CXXFLAGS="$CXXFLAGS -Wall -Wno-format"
937 if echo "$OS_TEST" | grep -c 86 >/dev/null; then
939 elif echo "$OS_TEST" | grep -c sparc >/dev/null; then
950 AC_DEFINE(_PR_BSDI_JMPBUF_IS_ARRAY)
951 AC_DEFINE(_PR_STAT_HAS_ONLY_ST_ATIME)
952 AC_DEFINE(_PR_NEED_H_ERRNO)
959 AC_DEFINE(_PR_TIMESPEC_HAS_TS_SEC)
960 AC_DEFINE(_PR_BSDI_JMPBUF_IS_ARRAY)
963 AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
964 PR_MD_ASFILES=os_BSD_OS_386_2.s
968 AC_DEFINE(_PR_SELECT_CONST_TIMEVAL)
969 AC_DEFINE(_PR_BSDI_JMPBUF_IS_STRUCT)
972 AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
973 MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
975 DSO_LDOPTS='-shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so)'
978 bsdi4.2* | bsdi4.3* | bsdi5.*)
979 AC_DEFINE(_PR_HAVE_GETPROTO_R)
980 AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER)
985 AC_DEFINE(_PR_SELECT_CONST_TIMEVAL)
986 AC_DEFINE(_PR_BSDI_JMPBUF_IS_STRUCT)
989 AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
998 AC_DEFINE(HAVE_BSD_FLOCK)
999 AC_DEFINE(HAVE_SOCKLEN_T)
1000 CFLAGS="$CFLAGS -Wmost -fno-common"
1001 case "${target_cpu}" in
1003 if test -n "$USE_64"; then
1005 CC="$CC -arch x86_64"
1015 DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names'
1016 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1017 STRIP="$STRIP -x -S"
1020 MDCPUCFG_H=_darwin.cfg
1021 PR_MD_CSRCS=darwin.c
1022 PR_MD_ASFILES=os_Darwin.s
1024 # Add Mac OS X support for loading CFM & CFBundle plugins
1025 if test -f /System/Library/Frameworks/Carbon.framework/Carbon; then
1026 AC_DEFINE(XP_MACOSX)
1029 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1030 dnl Use the specified value
1031 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1032 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
1033 dnl No value specified on the command line or in the environment,
1034 dnl use the lesser of the library's minimum or the architecture's
1036 case "${target_cpu}" in
1038 dnl Architecture minimum 10.2
1039 export MACOSX_DEPLOYMENT_TARGET=10.2
1042 dnl Architecture minimum 10.4
1043 export MACOSX_DEPLOYMENT_TARGET=10.4
1048 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is
1049 dnl in use. NEXT_ROOT will be set and exported if it's needed for
1052 if test "$MACOS_SDK_DIR"; then
1053 dnl Sync this section with the one in Mozilla's top level.
1055 if test ! -d "$MACOS_SDK_DIR"; then
1056 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1057 specify a valid SDK. SDKs are installed when the optional cross-development
1058 tools are selected during the Xcode/Developer Tools installation.])
1062 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
1063 GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1064 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1066 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1067 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1068 SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks"
1069 if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
1070 SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks"
1073 SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}"
1075 CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
1077 dnl CPP needs to be set for AC_CHECK_HEADER.
1078 CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
1081 HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
1083 if test "$HOST_DARWIN_MAJOR" -lt 9 ; then
1084 dnl The build host is running Tiger (10.4) or earlier.
1085 dnl ld support for -syslibroot is compiler-agnostic, but
1086 dnl only available on Tiger and later. On Tiger and
1087 dnl earlier build hosts, just rely on NEXT_ROOT, because
1088 dnl it's not been shown to cause any problems.
1089 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}"
1091 dnl The build host is running Leopard (10.5) or later.
1092 dnl With NEXT_ROOT set, the linker will still not apply
1093 dnl it when resolving dependencies. This causes problems
1094 dnl on Leopard, where an SDK depends on frameworks which
1095 dnl were present in earlier OS releases (and the associated
1096 dnl SDK) but not in Leopard. -syslibroot does not have
1097 dnl this problem, but it results in harmless warnings when
1098 dnl NEXT_ROOT is set. NEXT_ROOT needs to remain set even
1099 dnl on Leopard because the compiler uses it too.
1100 MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
1103 dnl LDFLAGS is for the utilities built in config (now and
1104 dnl nsinstall). DSO_LDOPTS is used when linking shared
1106 LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
1107 DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS"
1108 export NEXT_ROOT=$MACOS_SDK_DIR
1110 if test -n "$CROSS_COMPILE" ; then
1111 dnl NEXT_ROOT will be in the environment, but it
1112 dnl shouldn't be set for the build host. HOST_CXX is
1113 dnl presently unused.
1114 HOST_CC="NEXT_ROOT= $HOST_CC"
1115 HOST_CXX="NEXT_ROOT= $HOST_CXX"
1118 dnl gcc >= 4.0 uses different paths than above, but knows
1119 dnl how to find them itself.
1120 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1122 dnl CPP needs to be set for AC_CHECK_HEADER.
1123 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1125 dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which
1126 dnl has an ld that supports -syslibroot. Don't set
1127 dnl NEXT_ROOT because it will be ignored and cause
1128 dnl warnings when -syslibroot is specified.
1130 dnl Both LDFLAGS and DSO_LDOPTS are set here, see the
1131 dnl gcc < 4.0 case for the explanation.
1132 if test "$GCC_VERSION_FULL" != "4.0.0" ; then
1133 dnl gcc > 4.0.0 will pass -syslibroot to ld automatically
1134 dnl based on the -isysroot it receives.
1135 LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
1136 DSO_LDOPTS="$DSO_LDOPTS -isysroot ${MACOS_SDK_DIR}"
1138 dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs
1140 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1141 DSO_LDOPTS="$DSO_LDOPTS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1150 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
1154 AC_DEFINE(_DGUX_SOURCE)
1155 AC_DEFINE(_POSIX4A_DRAFT6_SOURCE)
1159 MDCPUCFG_H=_dgux.cfg
1164 if test -z "$USE_NSPR_THREADS"; then
1169 AC_DEFINE(HAVE_BSD_FLOCK)
1170 AC_DEFINE(HAVE_SOCKLEN_T)
1171 CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
1172 MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
1173 if test "$MOZ_OBJFORMAT" = "elf"; then
1178 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1180 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
1181 MDCPUCFG_H=_freebsd.cfg
1182 PR_MD_CSRCS=freebsd.c
1188 AC_DEFINE(_HPUX_SOURCE)
1189 # OSF1 and HPUX report the POLLHUP event for a socket when the
1190 # shutdown(SHUT_WR) operation is called for the remote end, even though
1191 # the socket is still writeable. Use select(), instead of poll(), to
1192 # workaround this problem.
1193 AC_DEFINE(_PR_POLL_WITH_SELECT)
1194 AC_DEFINE(_USE_BIG_FDS)
1195 DSO_LDOPTS='-b +h $(notdir $@)'
1197 if test "$OS_TEST" = "ia64"; then
1199 DSO_LDOPTS="$DSO_LDOPTS +b '\$\$ORIGIN'"
1200 CPU_ARCH_TAG=_$OS_TEST
1201 if test -z "$USE_64"; then
1204 PR_MD_ASFILES=os_HPUX_ia64.s
1208 PR_MD_ASFILES=os_HPUX.s
1210 if test -n "$USE_64"; then
1211 MDCPUCFG_H=_hpux64.cfg
1213 MDCPUCFG_H=_hpux32.cfg
1215 if test -z "$GNU_CC"; then
1223 if test -n "$MOZILLA_CLIENT"; then
1224 DEFAULT_IMPL_STRATEGY=_EMU
1227 if echo "$OS_RELEASE" | grep ^A.09 >/dev/null; then
1228 AC_DEFINE(_PR_NEED_H_ERRNO)
1230 DEFAULT_IMPL_STRATEGY=_EMU
1234 if echo "$OS_RELEASE" | egrep '^(A.09|B.10)' >/dev/null; then
1235 AC_DEFINE(_PR_NO_LARGE_FILES)
1238 if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
1239 AC_DEFINE(_PR_NEED_H_ERRNO)
1242 if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
1243 AC_DEFINE(HAVE_INT_LOCALTIME_R)
1246 if echo "$OS_RELEASE" | egrep '^(B.10.30|B.11)' >/dev/null; then
1247 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
1250 # HP-UX 11i v2 (B.11.23) or higher
1252 case "$OS_RELEASE" in
1253 [C-Z]*|B.[2-9]*|B.1[2-9]*|B.11.[3-9]*|B.11.2[3-9]*)
1259 if test "$OS_RELEASE" = "B.10.01"; then
1261 DEFAULT_IMPL_STRATEGY=_EMU
1264 if test "$OS_RELEASE" = "B.10.10"; then
1266 AC_DEFINE(HPUX10_10)
1267 DEFAULT_IMPL_STRATEGY=_PTH
1270 if test "$OS_RELEASE" = "B.10.20"; then
1272 AC_DEFINE(HPUX10_20)
1273 if test -z "$GNU_CC"; then
1274 CFLAGS="$CFLAGS +DAportable +DS1.1"
1275 CXXFLAGS="$CXXFLAGS +DAportable +DS1.1"
1277 DEFAULT_IMPL_STRATEGY=_PTH
1280 if test "$OS_RELEASE" = "B.10.30"; then
1282 AC_DEFINE(HPUX10_30)
1283 if test -z "$GNU_CC"; then
1284 CFLAGS="$CFLAGS +DAportable +DS1.1"
1285 CXXFLAGS="$CXXFLAGS +DAportable +DS1.1"
1287 DEFAULT_IMPL_STRATEGY=_PTH
1290 if echo "$OS_RELEASE" | grep ^B.11 >/dev/null; then
1293 AC_DEFINE(_LARGEFILE64_SOURCE)
1294 AC_DEFINE(_PR_HAVE_OFF64_T)
1295 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1296 if test -z "$GNU_CC"; then
1297 if test -z "$USE_64"; then
1298 if test "$OS_TEST" = "ia64"; then
1299 CFLAGS="$CFLAGS +DD32"
1300 CXXFLAGS="$CXXFLAGS +DD32"
1302 CFLAGS="$CFLAGS +DAportable +DS2.0"
1303 CXXFLAGS="$CXXFLAGS +DAportable +DS2.0"
1306 if test "$OS_TEST" = "ia64"; then
1307 CFLAGS="$CFLAGS +DD64"
1308 CXXFLAGS="$CXXFLAGS +DD64"
1310 CFLAGS="$CFLAGS +DA2.0W +DS2.0"
1311 CXXFLAGS="$CXXFLAGS +DA2.0W +DS2.0"
1315 DEFAULT_IMPL_STRATEGY=_PTH
1318 if test "$DEFAULT_IMPL_STRATEGY" = "_EMU"; then
1322 elif test "$DEFAULT_IMPL_STRATEGY" = "_PTH"; then
1324 if test "$USE_NSPR_THREADS"; then
1327 if test "$USE_USER_PTHREADS"; then
1337 AC_DEFINE(_SGI_MP_SOURCE)
1338 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1340 PR_MD_ASFILES=os_Irix.s
1341 MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@'
1343 RESOLVE_LINK_SYMBOLS=1
1344 if test -n "$USE_64"; then
1345 MDCPUCFG_H=_irix64.cfg
1347 MDCPUCFG_H=_irix32.cfg
1349 case "${target_os}" in
1366 if test "$GNU_CC"; then
1368 dnl If we are using gcc with native binutils, we need to
1370 dnl #lineno "filename" num num
1371 dnl lines, which confuse IRIX native as. Add -Wp,-P to the
1372 dnl gcc command line, which passes -P to the preprocessor.
1374 AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
1375 CFLAGS="$CFLAGS -Wall -Wno-format"
1376 _OPTIMIZE_FLAGS="-O6"
1378 if test -n "$USE_N32"; then
1379 AS='as -D_ASM $(INCLUDES) -n32'
1381 AS='as -D_ASM $(INCLUDES)'
1383 CFLAGS="$CFLAGS -fullwarn -xansi"
1384 if test "$USE_N32"; then
1385 _OPTIMIZE_FLAGS="-O -OPT:Olimit=4000"
1387 _OPTIMIZE_FLAGS="-O -Olimit 4000"
1389 if test "$USE_MDUPDATE"; then
1390 CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
1394 CFLAGS="$CFLAGS -multigot"
1395 DSO_LDOPTS="-no_unresolved"
1396 if test "$USE_N32"; then
1397 CFLAGS="$CFLAGS -n32 -woff 1209"
1398 DSO_LDOPTS="$DSO_LDOPTS -n32"
1400 if test "$USE_64"; then
1401 CFLAGS="$CFLAGS -64"
1403 CFLAGS="$CFLAGS -32"
1408 CFLAGS="$CFLAGS -xgot"
1412 if test "${target_os}" = "irix5.3"; then
1415 case "${target_os}" in
1417 if test -z "$GNU_CC"; then
1418 CFLAGS="$CFLAGS -mips3"
1420 AC_DEFINE(_PR_HAVE_GETPROTO_R)
1421 AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER)
1422 AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
1427 AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
1432 *-linux*|*-gnu*|*-k*bsd*-gnu)
1433 if test -z "$USE_NSPR_THREADS"; then
1438 AC_DEFINE(_GNU_SOURCE)
1439 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1440 case "${target_os}" in
1445 CFLAGS="$CFLAGS -Wall"
1446 CXXFLAGS="$CXXFLAGS -Wall"
1447 MDCPUCFG_H=_linux.cfg
1449 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1451 DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
1453 _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that
1454 # combo is not yet good at debugging inlined
1455 # functions (even when using DWARF2 as the
1458 if echo "$OS_TEST" | grep -c 86 >/dev/null; then
1463 CPU_ARCH_TAG=_${CPU_ARCH}
1464 case "${target_cpu}" in
1468 CFLAGS="$CFLAGS -mieee"
1469 CXXFLAGS="$CXXFLAGS -mieee"
1473 PR_MD_ASFILES=os_Linux_x86.s
1476 PR_MD_ASFILES=os_Linux_ia64.s
1479 if test -n "$USE_64"; then
1480 PR_MD_ASFILES=os_Linux_x86_64.s
1483 PR_MD_ASFILES=os_Linux_x86.s
1489 PR_MD_ASFILES=os_Linux_ppc.s
1492 if test -n "$USE_64"; then
1496 PR_MD_ASFILES=os_Linux_ppc.s
1500 CFLAGS="$CFLAGS -m68020-60"
1501 CXXFLAGS="$CXXFLAGS -m68020-60"
1506 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1509 PR_MD_ARCH_DIR=windows
1510 RESOLVE_LINK_SYMBOLS=1
1512 if test -n "$GNU_CC"; then
1513 CC="$CC -mno-cygwin"
1514 CXX="$CXX -mno-cygwin"
1516 MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
1518 # Use temp file for windres (bug 213281)
1519 RCFLAGS='-O coff --use-temp-file'
1524 AR='lib -NOLOGO -OUT:"$@"'
1526 RANLIB='echo not_ranlib'
1527 STRIP='echo not_strip'
1529 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1534 # Determine compiler version
1535 CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
1536 _CC_MAJOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $1 }'`
1537 _CC_MINOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $2 }'`
1538 MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
1540 # Ensure that mt is Microsoft (R) Manifest Tool and not magnetic
1541 # tape manipulation utility (or something else)
1542 if test "$MSC_VER" -ge "1400"; then
1544 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
1547 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
1548 if test -n "$MSMT_TOOL"; then
1549 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
1550 if test -z "$MSMANIFEST_TOOL_VERSION"; then
1551 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
1556 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
1560 CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
1561 DLLFLAGS="$DLLFLAGS -OUT:\"\$@\""
1564 if test -z "$MOZ_OPTIMIZE"; then
1565 CFLAGS="$CFLAGS -Od"
1568 if test -n "$USE_DEBUG_RTL"; then
1569 CFLAGS="$CFLAGS -MDd"
1571 CFLAGS="$CFLAGS -MD"
1574 if test -n "$MOZ_DEBUG"; then
1577 DEFINES="$DEFINES -U_DEBUG"
1580 if test -n "$MOZ_OPTIMIZE"; then
1581 if test -n "$MOZ_PROFILE"; then
1582 _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Z7"
1584 if test -n "$MOZ_DEBUG_SYMBOLS"; then
1585 _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Zi"
1587 if test -n "$MOZ_PROFILE" -o -n "$MOZ_DEBUG_SYMBOLS"; then
1588 DLLFLAGS="$DLLFLAGS -DEBUG -OPT:REF"
1589 LDFLAGS="$LDFLAGS -DEBUG -OPT:REF"
1593 if test -n "$MOZ_DEBUG"; then
1594 DLLFLAGS="$DLLFLAGS -DEBUG"
1595 LDFLAGS="$LDFLAGS -DEBUG"
1598 OS_DLLFLAGS="-nologo -DLL -SUBSYSTEM:WINDOWS"
1599 if test "$MSC_VER" -le "1200" -a -z "$MOZ_DEBUG_SYMBOLS"; then
1600 OS_DLLFLAGS="$OS_DLLFLAGS -PDB:NONE"
1603 if test "$OS_TARGET" = "WINNT"; then
1604 CFLAGS="$CFLAGS -GT"
1605 LIBNSPR='$(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1606 LIBPLC='$(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1608 LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1609 LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)'
1613 if test -n "$USE_STATIC_TLS"; then
1614 AC_DEFINE(_PR_USE_STATIC_TLS)
1617 if test "$OS_TARGET" = "WINNT"; then
1621 # undefine WINNT as some versions of mingw gcc define it by default
1622 DEFINES="$DEFINES -UWINNT"
1623 AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
1626 if test "$CPU_ARCH" = "x86"; then
1629 CPU_ARCH_TAG=$CPU_ARCH
1632 if test -n "$USE_DEBUG_RTL"; then
1636 case "$OS_TARGET" in
1638 MDCPUCFG_H=_winnt.cfg
1641 MDCPUCFG_H=_win95.cfg
1644 MDCPUCFG_H=_win16.cfg
1647 AC_MSG_ERROR([Missing OS_TARGET for ${target}. Use --enable-win32-target to set.])
1651 case "$target_cpu" in
1653 if test -n "$USE_64"; then
1677 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1681 if test "$USE_64"; then
1693 if test "$OS_RELEASE" = "2.03"; then
1694 AC_DEFINE(_PR_STAT_HAS_ST_ATIM)
1696 AC_DEFINE(_PR_STAT_HAS_ST_ATIM_UNION)
1699 if test -z "$GNU_CC"; then
1700 CFLAGS="$CFLAGS -Hnocopyr"
1701 CXXFLAGS="$CXXFLAGS -Hnocopyr"
1703 CFLAGS="$CFLAGS -fPIC -Wall"
1704 CXXFLAGS="$CXXFLAGS -fPIC -Wall"
1718 if test -z "$GNU_CC"; then
1719 CC='$(NSDEPTH)/build/hcc cc -Xa -KGnum=0 -KOlimit=4000'
1722 OS_LIBS="$OS_LIBS -lsocket -lnsl -ldl"
1731 AC_DEFINE(HAVE_BSD_FLOCK)
1733 MDCPUCFG_H=_netbsd.cfg
1734 PR_MD_CSRCS=netbsd.c
1736 DSO_CFLAGS='-fPIC -DPIC'
1737 CFLAGS="$CFLAGS -ansi -Wall"
1738 CXXFLAGS="$CXXFLAGS -ansi -Wall"
1739 MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
1741 if test -z "$OBJECT_FMT"; then
1742 if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ 2>/dev/null; then
1745 DSO_LDOPTS='-shared'
1749 DSO_LDOPTS='-shared -Wl,-soname,$(notdir $@)'
1753 if test "$LIBRUNPATH"; then
1754 DSO_LDOPTS="$DSO_LDOPTS -Wl,-R$LIBRUNPATH"
1765 AC_DEFINE(HAVE_SVID_GETTOD)
1767 CFLAGS="$CFLAGS -Xa -fullwarn"
1768 CXXFLAGS="$CXXFLAGS -Xa -fullwarn"
1770 MDCPUCFG_H=_sony.cfg
1774 *-nextstep*|*-openstep*)
1777 AC_DEFINE(HAVE_BSD_FLOCK)
1778 AC_DEFINE(_POSIX_SOURCE)
1779 CFLAGS="$CFLAGS -Wall -fno-common -traditional-cpp -posix"
1780 CXXFLAGS="$CXXFLAGS -Wall -fno-common -traditional-cpp -posix"
1783 MDCPUCFG_H=_nextstep.cfg
1784 PR_MD_CSRCS=nextstep.c
1791 AC_DEFINE(_QNX_SOURCE)
1792 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
1795 MKSHLIB='$(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(notdir $@) -o $@'
1798 OS_LIBS="$OS_LIBS -lsocket"
1799 _OPTIMIZE_FLAGS="-O1"
1800 _DEBUG_FLAGS="-gstabs"
1806 AC_DEFINE(HAVE_BSD_FLOCK)
1807 AC_DEFINE(HAVE_SOCKLEN_T)
1808 CFLAGS="$CFLAGS -ansi -Wall"
1809 CXXFLAGS="$CXXFLAGS -ansi -Wall"
1812 MDCPUCFG_H=_openbsd.cfg
1813 PR_MD_CSRCS=openbsd.c
1815 if test -z "$USE_NSPR_THREADS"; then
1818 DSO_LDOPTS='-shared -fPIC'
1819 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1825 AC_DEFINE(PR_GETIPNODE_NOT_THREADSAFE)
1826 RESOLVE_LINK_SYMBOLS=1
1828 MDCPUCFG_H=_openvms.cfg
1829 PR_MD_CSRCS=openvms.c
1830 DSO_LDOPTS='-shared -auto_symvec $(LDFLAGS)'
1831 if test -n "$MOZ_DEBUG"; then
1832 DSO_LDOPTS="$DSO_LDOPTS $_DEBUG_FLAGS"
1834 DSO_LDOPTS="$DSO_LDOPTS $_OPTIMIZE_FLAGS"
1839 SHELL_OVERRIDE="SHELL = /usr/bin/ksh"
1842 AC_DEFINE(_REENTRANT)
1843 # OSF1 and HPUX report the POLLHUP event for a socket when the
1844 # shutdown(SHUT_WR) operation is called for the remote end, even though
1845 # the socket is still writeable. Use select(), instead of poll(), to
1846 # workaround this problem.
1847 AC_DEFINE(_PR_POLL_WITH_SELECT)
1849 if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then
1853 if test -z "$GNU_CC"; then
1854 CC="$CC -std1 -ieee_with_inexact"
1855 if test "$OS_RELEASE" != "V2.0"; then
1856 CC="$CC -readonly_strings"
1858 _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
1859 AC_CHECK_HEADER(machine/builtins.h, AC_DEFINE(OSF1_HAVE_MACHINE_BUILTINS_H))
1861 CFLAGS="$CFLAGS -mieee"
1862 CXXFLAGS="$CXXFLAGS -mieee"
1865 if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
1866 AC_DEFINE(HAVE_INT_LOCALTIME_R)
1868 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1869 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
1871 if echo $OS_RELEASE | grep -c V4.0 >/dev/null; then
1872 AC_DEFINE(OSF1V4_MAP_PRIVATE_BUG)
1874 DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
1875 MDCPUCFG_H=_osf1.cfg
1882 AC_DEFINE(_PR_NEED_H_ERRNO)
1891 AC_DEFINE(_PR_NEED_H_ERRNO)
1893 MDCPUCFG_H=_riscos.cfg
1894 PR_MD_CSRCS=riscos.c
1896 LD="/home/riscos/env/ro-ar cr"
1905 AC_DEFINE(_PR_NEED_H_ERRNO)
1906 CC='cc -b elf -KPIC'
1907 CXX='$(NSDEPTH)/build/hcpp CC +.cpp +w'
1910 DSO_LDOPTS='-b elf -G'
1911 MDCPUCFG_H=_scoos.cfg
1919 AC_DEFINE(RELIANTUNIX)
1921 AC_DEFINE(HAVE_SVID_GETTOD)
1922 if echo "$OS_TEST" | grep -c 86 2>/dev/null; then
1929 if test "$GNU_CC"; then
1930 AS='$(CC) -x assembler-with-cpp'
1931 if test "$CPU_ARCH" = "mips"; then
1934 CFLAGS="$CFLAGS -Wall -Wno-format"
1937 _OPTIMIZE_FLAGS='-O -F Olimit,4000'
1940 DSO_LDOPTS='-G -z defs -h $(@:$(OBJDIR)/%.so=%.so)'
1942 if test "$OS_RELEASE" = "5.43"; then
1943 AC_DEFINE(IP_MULTICAST)
1946 OS_LIBS="$OS_LIBS -lsocket -lnsl -lresolv -ldl -lc"
1948 MDCPUCFG_H=_reliantunix.cfg
1949 PR_MD_CSRCS=reliantunix.c
1950 if test "${OS_ARCH}" = "mips"; then
1951 PR_MD_ASFILES=os_ReliantUNIX.s
1958 CFLAGS="$CFLAGS -Wall -Wno-format"
1959 if test "$USE_MDUPDATE"; then
1960 CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
1967 if test "$OS_RELEASE" = "4.1.3_U1"; then
1969 OS_LIBS="$OS_LIBS -lm"
1971 MDCPUCFG_H=_sunos4.cfg
1972 PR_MD_CSRCS=sunos4.c
1976 if test -z "$USE_NSPR_THREADS"; then
1985 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
1987 MDCPUCFG_H=_solaris.cfg
1988 PR_MD_CSRCS=solaris.c
1990 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1991 RESOLVE_LINK_SYMBOLS=1
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,-Bdirect'
2000 DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore -Bdirect'
2002 if test -n "$GNU_CC"; then
2003 CFLAGS="$CFLAGS -Wall"
2004 CXXFLAGS="$CXXFLAGS -Wall"
2005 if test -n "$USE_MDUPDATE"; then
2006 CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
2007 CXXFLAGS="$CXXFLAGS -MDupdate \$(DEPENDENCIES)"
2009 GCC_AS=`$CC -print-prog-name=as`
2010 if test "`echo | $GCC_AS -v 2>&1 | grep -c GNU`" != "0"; then
2014 CFLAGS="$CFLAGS -xstrconst"
2015 CXXFLAGS="$CXXFLAGS -Qoption cg -xstrconst -features=tmplife"
2016 if test -z "$MOZ_OPTIMIZE"; then
2017 CFLAGS="$CFLAGS -xs"
2018 CXXFLAGS="$CXXFLAGS -xs"
2020 _OPTIMIZE_FLAGS=-xO4
2022 if test -z "$GNU_AS"; then
2023 ASFLAGS="$ASFLAGS -Wa,-P"
2025 if test -n "$USE_64"; then
2026 if test -n "$GNU_CC"; then
2030 if test "$OS_TEST" = "i86pc"; then
2031 CC="$CC -xarch=amd64"
2032 CXX="$CXX -xarch=amd64"
2035 CXX="$CXX -xarch=v9"
2039 if test "$OS_TEST" = "i86pc"; then
2040 if test -z "$USE_64"; then
2043 CPU_ARCH_TAG=_$OS_TEST
2044 # The default debug format, DWARF (-g), is not supported by gcc
2045 # on i386-ANY-sysv4/solaris, but the stabs format is. It is
2046 # assumed that the Solaris assembler /usr/ccs/bin/as is used.
2047 # If your gcc uses GNU as, you do not need the -Wa,-s option.
2048 if test -n "$MOZ_DEBUG" && test -n "$GNU_CC"; then
2049 _DEBUG_FLAGS=-gstabs
2050 if test -z "$GNU_AS"; then
2051 _DEBUG_FLAGS="$_DEBUG_FLAGS -Wa,-s"
2055 case "${target_os}" in
2057 AC_DEFINE(_PR_NO_LARGE_FILES)
2060 AC_DEFINE(_PR_NO_LARGE_FILES)
2063 AC_DEFINE(SOLARIS2_5)
2066 AC_DEFINE(_PR_HAVE_OFF64_T)
2067 # The lfcompile64(5) man page on Solaris 2.6 says:
2068 # For applications that do not wish to conform to the POSIX or
2069 # X/Open specifications, the 64-bit transitional interfaces
2070 # are available by default. No compile-time flags need to be
2072 # But gcc 2.7.2.x fails to define _LARGEFILE64_SOURCE by default.
2073 # The native compiler, gcc 2.8.x, and egcs don't have this problem.
2074 if test -n "$GNU_CC"; then
2075 AC_DEFINE(_LARGEFILE64_SOURCE)
2079 case "${target_os}" in
2091 # Solaris 8 or higher has IPv6.
2092 AC_DEFINE(_PR_INET6)
2095 if test "$CPU_ARCH" = "sparc"; then
2096 # 64-bit Solaris SPARC requires V9 architecture, so the following
2098 if test -z "$USE_64"; then
2099 ULTRASPARC_LIBRARY=nspr_flt
2102 # Purify requires that binaries linked against nspr also
2103 # be linked against -lrt (or -lposix4) so add it to OS_LIBS
2105 _librt=`echo $_rev 5.6 | awk '{ if ($1 > $2) print "-lrt"; else print "-lposix4" }'`
2106 OS_LIBS="$OS_LIBS $_librt"
2115 if echo $OS_RELEASE | grep -c 2.1 2>/dev/null; then
2116 AC_DEFINE(_PR_NO_LARGE_FILES)
2117 CC='$(NSDEPTH)/build/hcc cc'
2118 CXX='$(NSDEPTH)/build/hcpp CC'
2119 MDCPUCFG_H=_unixware.cfg
2121 AC_DEFINE(_LARGEFILE64_SOURCE)
2122 AC_DEFINE(_PR_HAVE_OFF64_T)
2123 AC_DEFINE(_PR_HAVE_SOCKADDR_LEN)
2124 MDCPUCFG_H=_unixware7.cfg
2126 PR_MD_CSRCS=unixware.c
2134 AC_DEFINE(BSD_SELECT)
2135 AC_DEFINE(TCPV40HDRS)
2143 RESOLVE_LINK_SYMBOLS=1
2148 CFLAGS="$CFLAGS -Wall -Zomf"
2149 CXXFLAGS="$CFLAGS -Wall -Zomf"
2150 MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2152 DSO_LDOPTS='-Zomf -Zdll -Zmap'
2154 _OPTIMIZE_FLAGS="-O2 -s"
2155 _DEBUG_FLAGS="-g -fno-inline"
2156 if test -n "$MOZ_OPTIMIZE"; then
2157 DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2162 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2163 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2164 LDFLAGS="$LDFLAGS -Zhigh-mem"
2165 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2168 # GCC for OS/2 currently predefines these, but we don't want them
2169 DEFINES="$DEFINES -Uunix -U__unix -U__unix__"
2178 if test -z "$SKIP_LIBRARY_CHECKS"; then
2179 dnl ========================================================
2180 dnl Check for system libraries
2181 dnl ========================================================
2182 dnl AC_CHECK_LIB(C, main)
2183 dnl AC_CHECK_LIB(C_r, main)
2184 dnl AC_CHECK_LIB(c, main)
2185 dnl AC_CHECK_LIB(c_r, main)
2186 dnl AC_CHECK_LIB(dce, main)
2187 dnl AC_CHECK_LIB(dl, main)
2188 dnl AC_CHECK_LIB(dld, main)
2189 dnl AC_CHECK_LIB(gen, main)
2190 dnl AC_CHECK_LIB(ip6, main)
2191 dnl AC_CHECK_LIB(l, main)
2192 dnl AC_CHECK_LIB(m, main)
2193 dnl AC_CHECK_LIB(nsl, main)
2194 dnl AC_CHECK_LIB(posix4, main)
2195 dnl AC_CHECK_LIB(prstrms, main)
2196 dnl AC_CHECK_LIB(prstrms_shr, main)
2197 dnl AC_CHECK_LIB(pthread, main)
2198 dnl AC_CHECK_LIB(pthreads, main)
2199 dnl AC_CHECK_LIB(resolv, main)
2200 dnl AC_CHECK_LIB(rt, main)
2201 dnl AC_CHECK_LIB(socket, main)
2202 dnl AC_CHECK_LIB(svld, main)
2203 dnl AC_CHECK_LIB(thread, main)
2204 dnl AC_CHECK_LIB(vms_jackets, main)
2207 dnl We don't want anything to link with libdl even if it's present on OS X,
2208 dnl since it's not used and not part of the default installation.
2209 dnl The same goes for BeOS.
2215 AC_CHECK_LIB(dl, dlopen,
2216 AC_CHECK_HEADER(dlfcn.h,
2217 OS_LIBS="-ldl $OS_LIBS"))
2222 dnl ========================================================
2223 dnl Check for system header files.
2224 dnl ========================================================
2225 dnl AC_HEADER_DIRENT
2227 dnl AC_HEADER_SYS_WAIT
2228 dnl AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/ioctl.h sys/time.h unistd.h)
2230 dnl ========================================================
2231 dnl Check for typedefs and structs
2232 dnl ========================================================
2239 dnl AC_STRUCT_ST_BLKSIZE
2240 dnl AC_STRUCT_ST_BLOCKS
2241 dnl AC_STRUCT_ST_RDEV
2245 dnl ========================================================
2246 dnl Checks for library functions.
2247 dnl ========================================================
2248 AC_PROG_GCC_TRADITIONAL
2249 AC_CHECK_FUNCS(lchown strerror)
2253 dnl AC_FUNC_SETVBUF_REVERSED
2255 dnl AC_FUNC_STRFTIME
2256 dnl AC_FUNC_UTIME_NULL
2258 dnl AC_CHECK_FUNCS(ftime getcwd gethostname gettimeofday getwd mkdir mktime putenv rmdir select socket strdup strerror strstr strtol strtoul uname)
2260 dnl ========================================================
2262 dnl ========================================================
2264 dnl ========================================================
2266 dnl = --enable-strip
2268 dnl = Enable stripping of libs and executables
2270 dnl ========================================================
2271 AC_ARG_ENABLE(strip,
2272 [ --enable-strip Enable stripping of shared libs and programs],
2273 [ if test "$enableval" = "yes"; then
2277 dnl Check for hpux options
2278 case "${target_os}" in
2280 if test -z "$GNU_CC"; then
2282 AC_CACHE_CHECK(for +Olit support,
2283 ac_cv_hpux_usable_olit_option,
2284 dnl since aCC doesn't throw an error on invalid options,
2285 dnl we have to test this the hard way
2286 [ac_cv_hpux_usable_olit_option=no
2288 echo 'int main() { return 0; }' | cat > conftest.c
2289 ${CC-cc} ${CFLAGS} +Olit=all -o conftest conftest.c > conftest.out 2>&1
2290 if test $? -eq 0; then
2291 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out`"; then
2292 ac_cv_hpux_usable_olit_option=yes
2298 if test "$ac_cv_hpux_usable_olit_option" = "yes"; then
2299 CFLAGS="$CFLAGS +Olit=all"
2300 CXXFLAGS="$CXXFLAGS +Olit=all"
2302 CFLAGS="$CFLAGS +ESlit"
2303 CXXFLAGS="$CXXFLAGS +ESlit"
2310 dnl Apparently, some systems cannot properly check for the pthread
2311 dnl library unless <pthread.h> is included so we need to test
2314 dnl MOZ_CHECK_PTHREADS(lib, success, failure)
2315 AC_DEFUN(MOZ_CHECK_PTHREADS,
2317 AC_MSG_CHECKING([for pthread_create in -l$1])
2319 #include <pthread.h>
2320 void *foo(void *v) { return v; }
2323 if (!pthread_create(&t, 0, &foo, 0)) {
2328 echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS" 1>&5;
2329 ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS 2>&5;
2331 rm -f dummy.c dummy${ac_exeext} ;
2332 if test "$_res" = "0"; then
2333 AC_MSG_RESULT([yes])
2341 case "$target_os" in
2346 MOZ_CHECK_PTHREADS(pthreads,
2347 _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2348 MOZ_CHECK_PTHREADS(pthread,
2349 _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2350 MOZ_CHECK_PTHREADS(c_r,
2351 _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2352 MOZ_CHECK_PTHREADS(c,
2361 AC_ARG_WITH(pthreads,
2362 [ --with-pthreads Use system pthreads library as thread subsystem],
2363 [ if test "$withval" = "yes"; then
2364 if test -n "$_HAVE_PTHREADS"; then
2369 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2375 [ if test -n "$_HAVE_PTHREADS" && test -z "$USE_USER_PTHREADS" && test -z "$USE_NSPR_THREADS"; then
2381 AC_ARG_ENABLE(user-pthreads,
2382 [ --enable-user-pthreads Build using userland pthreads],
2383 [ if test "$enableval" = "yes"; then
2384 if test -n "$_HAVE_PTHREADS"; then
2389 AC_MSG_ERROR([ --enable-user-pthreads specified for a system without pthread support ]);
2393 AC_ARG_ENABLE(nspr-threads,
2394 [ --enable-nspr-threads Build using classic nspr threads],
2395 [ if test "$enableval" = "yes"; then
2403 AC_ARG_WITH(bthreads,
2404 [ --with-bthreads Use system bthreads library as thread subsystem
2406 [ if test "$withval" = "yes"; then
2414 fi # SKIP_LIBRARY_CHECKS
2417 [ --enable-ipv6 Compile ipv6 support],
2418 [ if test "$enableval" = "yes"; then
2425 AC_ARG_ENABLE(boehm,
2426 [ --enable-boehm Enable the Boehm Garbage Collector],
2427 [ if test "$enableval" = "yes"; then
2428 AC_DEFINE(GC_LEAK_DETECTOR)
2432 if test -n "$USE_PTHREADS"; then
2433 dnl See if -pthread is supported.
2435 ac_cv_have_dash_pthread=no
2436 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2437 echo 'int main() { return 0; }' | cat > conftest.c
2438 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2439 if test $? -eq 0; then
2440 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2441 ac_cv_have_dash_pthread=yes
2442 case "$target_os" in
2444 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2447 CFLAGS="$CFLAGS -pthread"
2448 CXXFLAGS="$CXXFLAGS -pthread"
2454 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2457 dnl See if -pthreads is supported.
2459 ac_cv_have_dash_pthreads=no
2460 if test "$ac_cv_have_dash_pthread" = "no"; then
2461 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2462 echo 'int main() { return 0; }' | cat > conftest.c
2463 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2464 if test $? -eq 0; then
2465 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2466 ac_cv_have_dash_pthreads=yes
2467 CFLAGS="$CFLAGS -pthreads"
2468 CXXFLAGS="$CXXFLAGS -pthreads"
2472 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2477 if test "$ac_cv_have_dash_pthreads" = "yes"; then
2482 AC_DEFINE(_REENTRANT)
2483 AC_DEFINE(_THREAD_SAFE)
2484 dnl -pthread links in -lc_r, so don't specify it explicitly.
2485 if test "$ac_cv_have_dash_pthread" = "yes"; then
2486 _PTHREAD_LDFLAGS="-pthread"
2488 _PTHREAD_LDFLAGS="-lc_r"
2492 if test "$ac_cv_have_dash_pthread" = "yes"; then
2493 _PTHREAD_LDFLAGS="-pthread"
2497 AC_DEFINE(_THREAD_SAFE)
2498 dnl -pthread links in -lc_r, so don't specify it explicitly.
2499 if test "$ac_cv_have_dash_pthread" = "yes"; then
2504 if test "$ac_cv_have_dash_pthread" = "yes"; then
2505 _PTHREAD_LDFLAGS=-pthread
2508 *-linux*|*-gnu*|*-k*bsd*-gnu)
2509 AC_DEFINE(_REENTRANT)
2514 if test -n "$USE_USER_PTHREADS"; then
2521 dnl Special thread exceptions
2525 if test -n "$USE_NSPR_THREADS"; then
2526 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2528 case "$target_os" in
2530 if test -z "$USE_PTHREADS"; then
2531 AC_DEFINE(AIX_RENAME_SELECT)
2535 if test -z "$USE_NSPR_THREADS"; then
2536 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2540 if test -z "$USE_NSPR_THREADS"; then
2541 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2543 if test -n "$USE_PTHREADS"; then
2544 AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2548 if test -z "$USE_NSPR_THREADS"; then
2549 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2551 if test -n "$USE_PTHREADS"; then
2552 AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2558 if test -n "$USE_PTHREADS"; then
2559 AC_DEFINE(_PR_NEED_PTHREAD_INIT)
2563 if test -n "$USE_NSPR_THREADS"; then
2564 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2568 if test -n "$USE_NSPR_THREADS"; then
2569 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2571 if test "$USE_PTHREADS"; then
2572 if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
2573 AC_DEFINE(_REENTRANT)
2574 AC_DEFINE(_PR_DCETHREADS)
2576 AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
2577 AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2580 if test "$USE_USER_PTHREADS"; then
2581 AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
2585 if test "${target_os}" = "irix6.5"; then
2586 if test -n "$USE_PTHREADS"; then
2587 AC_DEFINE(_PR_HAVE_GETHOST_R)
2588 AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
2592 *-linux*|*-gnu*|*-k*bsd*-gnu)
2593 if test -n "$USE_NSPR_THREADS"; then
2594 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2597 *-mingw*|*-cygwin*|*-msvc*|*-mks*|*-os2*|*-beos*)
2598 dnl win32, os2 & beos cannot use pthreads
2603 *-netbsd*|*-openbsd*)
2604 if test -n "$USE_NSPR_THREADS"; then
2605 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2609 if test -n "$USE_NSPR_THREADS"; then
2610 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2612 if test -n "$USE_PTHREADS"; then
2613 if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
2616 AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
2621 if test -n "$USE_NSPR_THREADS"; then
2622 AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
2624 if test -n "$USE_PTHREADS"; then
2625 AC_DEFINE(_REENTRANT)
2626 AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
2627 if test "$OS_TEST" = "i86pc"; then
2628 if test -n "$USE_64"; then
2629 PR_MD_ASFILES=os_SunOS_x86_64.s
2631 PR_MD_ASFILES=os_SunOS_x86.s
2634 if test -n "$USE_64"; then
2635 PR_MD_ASFILES=os_SunOS_sparcv9.s
2641 if test -n "$USE_PTHREADS"; then
2642 AC_DEFINE(_PR_HAVE_GETHOST_R)
2643 AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
2648 OS_LIBS="$_PTHREAD_LDFLAGS $OS_LIBS"
2650 dnl If the user passed in arg to --enable-optimize or --enable-debug,
2651 dnl make sure that we use it.
2652 if test -n "$_SAVE_OPTIMIZE_FLAGS"; then
2653 _OPTIMIZE_FLAGS="$_SAVE_OPTIMIZE_FLAGS"
2656 if test -n "$_SAVE_DEBUG_FLAGS"; then
2657 _DEBUG_FLAGS="$_SAVE_DEBUG_FLAGS"
2660 if test -n "$MOZ_OPTIMIZE"; then
2661 CFLAGS="$CFLAGS $_OPTIMIZE_FLAGS"
2662 CXXFLAGS="$CXXFLAGS $_OPTIMIZE_FLAGS"
2665 if test -n "$MOZ_DEBUG"; then
2666 CFLAGS="$CFLAGS $_DEBUG_FLAGS"
2667 CXXFLAGS="$CXXFLAGS $_DEBUG_FLAGS"
2670 if test -n "$MOZ_OPTIMIZE"; then
2676 if test -n "$USE_64"; then
2680 RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${COMPILER_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}.${OBJDIR_SUFFIX}"
2682 dnl ========================================================
2683 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
2684 dnl ========================================================
2685 case "$target_os" in
2687 CC="\$(CYGWIN_WRAPPER) $CC"
2688 CXX="\$(CYGWIN_WRAPPER) $CXX"
2689 RC="\$(CYGWIN_WRAPPER) $RC"
2693 dnl ========================================================
2694 dnl Substitution of found variables.
2695 dnl ========================================================
2696 AC_SUBST(SHELL_OVERRIDE)
2698 AC_SUBST(MOZILLA_CLIENT)
2705 AC_SUBST(HOST_CFLAGS)
2707 AC_SUBST(HOST_LDFLAGS)
2709 AC_SUBST(GCC_USE_GNU_LD)
2711 AC_SUBST(CROSS_COMPILE)
2713 AC_SUBST(MOZ_OPTIMIZE)
2719 AC_SUBST(OBJECT_MODE)
2720 AC_SUBST(GC_LEAK_DETECTOR)
2721 AC_SUBST(ENABLE_STRIP)
2723 AC_SUBST(USE_PTHREADS)
2724 AC_SUBST(USE_BTHREADS)
2725 AC_SUBST(USE_USER_PTHREADS)
2726 AC_SUBST(USE_NSPR_THREADS)
2731 AC_SUBST(MOD_MAJOR_VERSION)
2732 AC_SUBST(MOD_MINOR_VERSION)
2733 AC_SUBST(MOD_PATCH_VERSION)
2734 AC_SUBST(NSPR_MODNAME)
2735 AC_SUBST(MDCPUCFG_H)
2736 AC_SUBST(PR_MD_CSRCS)
2737 AC_SUBST(PR_MD_ASFILES)
2738 AC_SUBST(PR_MD_ARCH_DIR)
2741 AC_SUBST(OBJ_SUFFIX)
2742 AC_SUBST(LIB_SUFFIX)
2743 AC_SUBST(DLL_SUFFIX)
2744 AC_SUBST(ASM_SUFFIX)
2746 AC_SUBST(DSO_CFLAGS)
2747 AC_SUBST(DSO_LDOPTS)
2751 AC_SUBST(OS_RELEASE)
2753 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2769 AC_SUBST(RESOLVE_LINK_SYMBOLS)
2770 AC_SUBST(AIX_LINK_OPTS)
2771 AC_SUBST(NOSUCHFILE)
2772 AC_SUBST(MOZ_OBJFORMAT)
2773 AC_SUBST(ULTRASPARC_LIBRARY)
2776 AC_SUBST(OBJDIR_NAME)
2777 AC_SUBST(RELEASE_OBJDIR_NAME)
2784 AC_SUBST(OS_DLLFLAGS)
2785 AC_SUBST(CYGWIN_WRAPPER)
2786 AC_SUBST(VISIBILITY_FLAGS)
2787 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2788 AC_SUBST(MACOS_SDK_DIR)
2792 dnl ========================================================
2793 dnl Generate output files.
2794 dnl ========================================================
2805 lib/libc/include/Makefile
2806 lib/libc/src/Makefile
2810 pkg/solaris/Makefile
2811 pkg/solaris/SUNWpr/Makefile
2812 pkg/solaris/SUNWprd/Makefile
2815 pr/include/md/Makefile
2816 pr/include/obsolete/Makefile
2817 pr/include/private/Makefile
2820 pr/src/linking/Makefile
2821 pr/src/malloc/Makefile
2823 pr/src/md/${PR_MD_ARCH_DIR}/Makefile
2824 pr/src/memory/Makefile
2825 pr/src/misc/Makefile
2826 pr/src/threads/Makefile
2828 pr/tests/dll/Makefile
2831 dnl lib/tests/Makefile
2832 dnl pr/tests/w16gui/Makefile
2835 if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then
2836 MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile"
2837 elif test -n "$USE_PTHREADS"; then
2838 MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile"
2839 elif test -n "$USE_BTHREADS"; then
2840 MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile"
2843 if test -n "$USE_CPLUS"; then
2844 MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile"
2847 echo $MAKEFILES > unallmakefiles
2849 AC_OUTPUT([$MAKEFILES], [chmod +x config/nspr-config])