home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 August / Chip_2001-08_cd1.bin / zkuste / linux / bin / mozilla-source-0.9.1.tar.bz2 / mozilla-source-0.9.1.tar / mozilla / configure.in < prev    next >
Text File  |  2001-06-05  |  141KB  |  4,635 lines

  1. dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
  2. dnl The contents of this file are subject to the Mozilla Public
  3. dnl License Version 1.1 (the "License"); you may not use this file
  4. dnl except in compliance with the License. You may obtain a copy of
  5. dnl the License at http://www.mozilla.org/MPL/
  6. dnl
  7. dnl Software distributed under the License is distributed on an "AS
  8. dnl IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9. dnl implied. See the License for the specific language governing
  10. dnl rights and limitations under the License.
  11. dnl
  12. dnl The Original Code is this file as it was released upon August 6, 1998.
  13. dnl
  14. dnl The Initial Developer of the Original Code is Christopher
  15. dnl Seawood. Portions created by Christopher Seawood are
  16. dnl Copyright (C) 1998-2001 Christopher Seawood. All Rights Reserved.
  17. dnl
  18. dnl Contributor(s): Jamie Zawinski <jwz@jwz.org>
  19. dnl                 gettimeofday args check
  20. dnl               Christopher Blizzard <blizzard@appliedtheory.com>
  21. dnl                 gnomefe update & enable-pthreads
  22. dnl               Ramiro Estrugo <ramiro@netscape.com>
  23. dnl                 X11 makedepend support
  24. dnl                 Insure support.
  25. dnl               Henry Sobotka <sobotka@axess.com>
  26. dnl                 OS/2 support
  27. dnl               Dan Mosedale <dmose@mozilla.org>
  28. dnl                 LDAP support
  29. dnl               Seth Spitzer <sspitzer@netscape.com>
  30. dnl                 xpctools support
  31. dnl
  32. dnl Process this file with autoconf to produce a configure script.
  33. dnl ========================================================
  34.  
  35. AC_PREREQ(2.12)
  36. AC_INIT(config/config.mk)
  37. AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
  38. AC_CANONICAL_SYSTEM
  39. AC_PREFIX_DEFAULT(`pwd`/dist)
  40. TARGET_CPU="${target_cpu}"
  41. TARGET_OS="${target_os}"
  42.  
  43. dnl ========================================================
  44. dnl =
  45. dnl = Dont change the following two lines.  Doing so breaks:
  46. dnl =
  47. dnl = CFLAGS="-foo" ./configure
  48. dnl =
  49. dnl ========================================================
  50. CFLAGS="${CFLAGS=}"
  51. CPPFLAGS="${CPPFLAGS=}"
  52. CXXFLAGS="${CXXFLAGS=}"
  53. LDFLAGS="${LDFLAGS=}"
  54. HOST_CFLAGS="${HOST_CFLAGS=}"
  55. HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
  56. HOST_LDFLAGS="${HOST_LDFLAGS=}"
  57.  
  58. dnl ========================================================
  59. dnl = Preserve certain environment flags passed to configure
  60. dnl = We want sub projects to receive the same flags
  61. dnl = untainted by this configure script
  62. dnl ========================================================
  63. _SUBDIR_CC="$CC"
  64. _SUBDIR_CXX="$CXX"
  65. _SUBDIR_CFLAGS="$CFLAGS"
  66. _SUBDIR_CPPFLAGS="$CPPFLAGS"
  67. _SUBDIR_CXXFLAGS="$CFLAGS"
  68. _SUBDIR_LDFLAGS="$LDFLAGS"
  69. _SUBDIR_HOST_CC="$HOST_CC"
  70. _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
  71. _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
  72. _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
  73. _SUBDIR_CONFIG_ARGS="$ac_configure_args"
  74.  
  75. dnl Set the version number of the libs included with mozilla
  76. dnl ========================================================
  77. MOZJPEG=62
  78. MOZPNG=10009
  79. MOZMNG="((1<<16)|(0<<8)|(1))"
  80. NSPR_VERSION=4
  81.  
  82. dnl Set the minimum version of toolkit libs used by mozilla
  83. dnl ========================================================
  84. GLIB_VERSION=1.2.0
  85. GTK_VERSION=1.2.0
  86. GDK_PIXBUF_VERSION=0.8.0
  87. LIBIDL_VERSION=0.6.3
  88. PERL_VERSION=5.004
  89. QT_VERSION=2.2.0
  90. QT_VERSION_NUM=220
  91.  
  92. dnl Set various checks
  93. dnl ========================================================
  94. MISSING_FULLCIRCLE=
  95. MISSING_MOTIF=
  96. MISSING_NSPR=
  97. MISSING_X=
  98.  
  99. dnl Initialize the Pthread test variables early so they can be
  100. dnl  overridden by each platform.
  101. dnl ========================================================
  102. USE_PTHREADS=
  103. _PTHREAD_LDFLAGS=""
  104.  
  105. dnl Do not allow a separate objdir build if a srcdir build exists.
  106. dnl ==============================================================
  107. _topsrcdir=`cd \`dirname $0\`; pwd`
  108. _objdir=`pwd`
  109. if test "$_topsrcdir" != "$_objdir"
  110. then
  111.   # Check for a couple representative files in the source tree
  112.   _conflict_files=
  113.   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
  114.     if test -f $file; then
  115.       _conflict_files="$_conflict_files $file"
  116.     fi
  117.   done
  118.   if test "$_conflict_files"; then
  119.     echo "***"
  120.     echo "*   Your source tree contains these files:"
  121.     for file in $_conflict_files; do
  122.       echo "*         $file"
  123.     done
  124.     cat 1>&2 <<-EOF
  125.     *   This indicates that you previously built in the source tree.
  126.     *   A source tree build can confuse the separate objdir build.
  127.     *
  128.     *   To clean up the source tree:
  129.     *     1. cd $_topsrcdir
  130.     *     2. gmake distclean
  131.     ***
  132.     EOF
  133.     exit 1
  134.     break
  135.   fi
  136. fi
  137. MOZ_BUILD_ROOT=`pwd`
  138.  
  139. dnl ========================================================
  140. dnl Checks for compilers.
  141. dnl ========================================================
  142. dnl Set CROSS_COMPILE in the environment when running configure
  143. dnl to use the cross-compile setup for now
  144. dnl ========================================================
  145. if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
  146.     echo "cross compiling from $host to $target"
  147.     cross_compiling=yes
  148.  
  149.     _SAVE_CC="$CC"
  150.     _SAVE_CFLAGS="$CFLAGS"
  151.     _SAVE_LDFLAGS="$LDFLAGS"
  152.  
  153.     AC_MSG_CHECKING([for host c compiler])
  154.     if test -z "$HOST_CC"; then
  155.     AC_CHECK_PROGS(HOST_CC, gcc cc /usr/ucb/cc icc, "")
  156.     if test -z "$HOST_CC"; then
  157.         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
  158.     fi
  159.     fi
  160.     AC_MSG_RESULT([$HOST_CC])
  161.     AC_MSG_CHECKING([for host c++ compiler])
  162.     if test -z "$HOST_CXX"; then
  163.     AC_CHECK_PROGS(HOST_CXX, $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
  164.     if test -z "$HOST_CXX"; then
  165.         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
  166.     fi
  167.     fi
  168.     AC_MSG_RESULT([$HOST_CXX])
  169.  
  170.     if test -z "$HOST_CFLAGS"; then
  171.     HOST_CFLAGS="$CFLAGS"
  172.     fi
  173.     if test -z "$HOST_CXXFLAGS"; then
  174.     HOST_CXXFLAGS="$CXXFLAGS"
  175.     fi
  176.     if test -z "$HOST_LDFLAGS"; then
  177.     HOST_LDFLAGS="$LDFLAGS"
  178.     fi
  179.     if test -z "$HOST_RANLIB"; then
  180.     AC_CHECK_PROG(HOST_RANLIB, ranlib, ranlib, :)
  181.     fi
  182.     if test -z "$HOST_AR"; then
  183.     AC_CHECK_PROG(HOST_AR, ar, ar, :)
  184.     fi
  185.     CC="$HOST_CC"
  186.     CFLAGS="$HOST_CFLAGS"
  187.     LDFLAGS="$HOST_LDFLAGS"
  188.  
  189.     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
  190.     AC_TRY_COMPILE([], [return(0);], 
  191.     [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
  192.     AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
  193.  
  194.     CC="$HOST_CXX"
  195.     CFLAGS="$HOST_CXXFLAGS"
  196.  
  197.     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
  198.     AC_TRY_COMPILE([], [return(0);], 
  199.     [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
  200.     AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
  201.     
  202.     CC=$_SAVE_CC
  203.     CFLAGS=$_SAVE_CFLAGS
  204.     LDFLAGS=$_SAVE_LDFLAGS
  205.  
  206.     if test -z "$CC"; then
  207.     AC_CHECK_PROGS(CC, "${target_alias}-gcc" "${target}-gcc", :)
  208.     fi
  209.     unset ac_cv_prog_CC
  210.     AC_PROG_CC
  211.     if test -z "$CXX"; then
  212.     AC_CHECK_PROGS(CXX, "${target_alias}-g++" "${target}-g++", :)
  213.     fi
  214.     unset ac_cv_prog_CXX
  215.     AC_PROG_CXX
  216.     if test -z "$RANLIB"; then
  217.     AC_CHECK_PROGS(RANLIB, "${target_alias}-ranlib" "${target}-ranlib", :)
  218.     fi
  219.     if test -z "$AR"; then
  220.     AC_CHECK_PROGS(AR, "${target_alias}-ar" "${target}-ar", :)
  221.     fi
  222.     if test -z "$AS"; then
  223.     AC_CHECK_PROGS(AS, "${target_alias}-as" "${target}-as", :)
  224.     fi
  225.     if test -z "$LD"; then
  226.     AC_CHECK_PROGS(LD, "${target_alias}-ld" "${target}-ld", :)
  227.     fi
  228.     if test -z "$STRIP"; then
  229.     AC_CHECK_PROGS(STRIP, "${target_alias}-strip" "${target}-strip", :)
  230.     fi
  231.     if test -z "$DLLTOOL"; then
  232.     AC_CHECK_PROGS(DLLTOOL, "${target_alias}-dlltool" "${target}-dlltool", :)
  233.     fi
  234.     if test -z "$WINDRES"; then
  235.     AC_CHECK_PROGS(WINDRES, "${target_alias}-windres" "${target}-windres", :)
  236.     fi
  237.     AC_DEFINE(CROSS_COMPILE)
  238. else
  239.     AC_PROG_CC
  240.     AC_PROG_CXX
  241.     AC_PROG_RANLIB
  242.     AC_PATH_PROGS(AS, as, $CC)
  243.     AC_PATH_PROGS(AR, ar, :)
  244.     AC_PATH_PROGS(LD, ld, :)
  245.     AC_PATH_PROGS(STRIP, strip, :)
  246.     AC_PATH_PROGS(DLLTOOL, dlltool, :)
  247.     if test -z "$HOST_CC"; then
  248.     HOST_CC="$CC"
  249.     fi
  250.     if test -z "$HOST_CFLAGS"; then
  251.     HOST_CFLAGS="$CFLAGS"
  252.     fi
  253.     if test -z "$HOST_CXX"; then
  254.     HOST_CXX="$CXX"
  255.     fi
  256.     if test -z "$HOST_CXXFLAGS"; then
  257.     HOST_CXXFLAGS="$CXXFLAGS"
  258.     fi
  259.     if test -z "$HOST_LDFLAGS"; then
  260.     HOST_LDFLAGS="$LDFLAGS"
  261.     fi
  262.     if test -z "$HOST_RANLIB"; then
  263.     HOST_RANLIB="$RANLIB"
  264.     fi
  265.     if test -z "$HOST_AR"; then
  266.     HOST_AR="$AR"
  267.     fi
  268. fi
  269.  
  270. dnl Breaks icc on OS/2
  271. if test "$CC" != "icc"; then
  272.     AC_PROG_CC_C_O
  273.     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
  274.         USING_HCC=1
  275.         _OLDCC=$CC
  276.         _OLDCXX=$CXX
  277.         CC="${srcdir}/build/hcc '$CC'"
  278.         CXX="${srcdir}/build/hcpp '$CXX'"
  279.     fi
  280. fi
  281.  
  282. GNU_AS=
  283. GNU_CC=
  284. GNU_CXX=
  285. if test "$GCC" = "yes"; then
  286.     GNU_CC=1
  287. fi
  288. if test "$GXX" = "yes"; then
  289.     GNU_CXX=1
  290. fi
  291. if test "`echo | $AS -V 2>&1 | grep -c GNU`" != "0"; then
  292.     GNU_AS=1
  293. fi
  294. rm -f a.out
  295.  
  296. AC_SUBST(GNU_AS)
  297. AC_SUBST(GNU_CC)
  298. AC_SUBST(GNU_CXX)
  299.  
  300. dnl ========================================================
  301. dnl Check for gcc -pipe support
  302. dnl ========================================================
  303. MOZ_ARG_DISABLE_BOOL(gcc-pipe,
  304.     [  --disable-gcc-pipe      Disable -pipe check for gcc],
  305.     NO_GCC_PIPE=1)
  306.  
  307. AC_MSG_CHECKING([for gcc -pipe support])
  308.  
  309. if test -n "$NO_GCC_PIPE"; then
  310.     AC_MSG_RESULT([disabled])
  311. elif test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
  312.     echo '#include <stdio.h>' > dummy-hello.c
  313.     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
  314.     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
  315.     cat dummy-hello.s | ${AS} -o dummy-hello.S - 2>&5
  316.     if test $? = 0; then
  317.         _res_as_stdin="yes"
  318.     else
  319.         _res_as_stdin="no"
  320.     fi
  321.     if test "$_res_as_stdin" = "yes"; then
  322.         _SAVE_CFLAGS=$CFLAGS
  323.         CFLAGS="$CFLAGS -pipe"
  324.         AC_TRY_COMPILE( [ #include <stdio.h> ],
  325.             [printf("Hello World\n");],
  326.             [_res_gcc_pipe="yes"],
  327.             [_res_gcc_pipe="no"] )
  328.         CFLAGS=$_SAVE_CFLAGS
  329.     fi
  330.     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
  331.         _res="yes";
  332.         CFLAGS="$CFLAGS -pipe"
  333.         CXXFLAGS="$CXXFLAGS -pipe"
  334.     else
  335.         _res="no"
  336.     fi
  337.     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
  338.     AC_MSG_RESULT([$_res])
  339. else
  340.     AC_MSG_RESULT([no])
  341. fi
  342.  
  343. dnl ========================================================
  344. dnl Checks for programs.
  345. dnl ========================================================
  346. AC_PROG_CPP
  347. AC_PROG_CXXCPP
  348. AC_PROG_INSTALL
  349. AC_PROG_LN_S
  350. AC_PROG_AWK
  351. AC_PATH_PROGS(EMACS, xemacs lemacs emacs, :)
  352. AC_PATH_PROGS(PERL, $PERL perl5 perl )
  353. if test -z "$PERL" || test "$PERL" = ":"; then
  354.     AC_MSG_ERROR([perl not found in \$PATH])
  355. fi
  356.  
  357. AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
  358. _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
  359. _perl_res=$?
  360. AC_MSG_RESULT([$_perl_version])
  361.  
  362. if test "$_perl_res" != 0; then
  363.     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
  364. fi
  365.  
  366. AC_MSG_CHECKING([for full perl installation])
  367. _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
  368. _perl_res=$?
  369. if test "$_perl_res" != 0; then
  370.     AC_MSG_RESULT([no])
  371.     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
  372. else
  373.     AC_MSG_RESULT([yes])    
  374. fi
  375.  
  376. AC_PATH_PROG(WHOAMI, whoami, :)
  377. AC_PATH_PROG(AUTOCONF, autoconf, :)
  378. AC_PATH_PROG(UNZIP, unzip, :)
  379. AC_PATH_PROGS(ZIP, zip)
  380. if test -z "$ZIP" || test "$ZIP" = ":"; then
  381.     AC_MSG_WARN([zip not found in \$PATH. Disabling jar packaging])
  382.     MOZ_DISABLE_JAR_PACKAGING=1
  383. fi
  384. AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
  385. AC_PATH_PROG(XARGS, xargs)
  386. dnl if test -z "$XARGS" || test "$XARGS" = ":"; then
  387. dnl     AC_MSG_ERROR([xargs not found in \$PATH .])
  388. dnl fi
  389.  
  390. dnl Be sure the make we use is GNU make.
  391. AC_PATH_PROGS(MAKE, gmake make, :)
  392. _make_try=`$MAKE --version 2>/dev/null`
  393. if test ! "$_make_try"
  394. then
  395.     echo
  396.     echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
  397.     echo
  398.     exit 1
  399. fi
  400. dnl Now warn about version 3.77 if we find it.
  401. _make_vers=`$MAKE --version | grep Make | $AWK '{ print \$4 }' | sed 's/,//'`
  402. if test "$_make_vers" = "3.77"
  403. then
  404.     echo
  405.     echo "*** Found GNU Make 3.77.  This version is known to have problems with the"
  406.     echo "*** wildcard function in certain circumstances.  You may experience infinite"
  407.     echo "*** looping while building Mozilla with 3.77.  If this happens, you can"
  408.     echo "*** either downgrade to 3.76.1 or try configuring with --disable-md."
  409.     echo
  410. fi
  411.  
  412. AC_PROG_MAKE_SET
  413.  
  414. AC_PATH_XTRA
  415.  
  416. dnl Check in X11 include directory too.
  417. if test "$no_x" != "yes"; then
  418.     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
  419. fi
  420.  
  421. dnl ========================================================
  422. dnl set the defaults first
  423. dnl ========================================================
  424. AR_FLAGS='cr $@'
  425. AR_LIST='$(AR) t'
  426. AR_EXTRACT='$(AR) x'
  427. AR_DELETE='$(AR) d'
  428. AS='$(CC)'
  429. AS_DASH_C_FLAG='-c'
  430. DLL_SUFFIX=.so
  431. OBJ_SUFFIX=o
  432. LIB_SUFFIX=a
  433. TARGET_MD_ARCH=unix
  434. DIRENT_INO=d_ino
  435.  
  436. MOZ_JPEG_CFLAGS=
  437. MOZ_JPEG_LIBS='-L$(DIST)/lib -lmozjpeg'
  438. MOZ_ZLIB_CFLAGS=
  439. MOZ_ZLIB_LIBS='-L$(DIST)/lib -lmozz'
  440. MOZ_PNG_CFLAGS=
  441. MOZ_PNG_LIBS='-L$(DIST)/lib -lmozpng'
  442. MOZ_MNG_CFLAGS=
  443. MOZ_MNG_LIBS='-L$(DIST)/lib -lmozmng'
  444.  
  445. MOZ_JS_LIBS='-L$(DIST)/bin -lmozjs'
  446. XPCOM_LIBS='-L$(DIST)/bin -lxpcom'
  447.  
  448. MOZ_COMPONENT_NSPR_LIBS='-L$(DIST)/bin $(NSPR_LIBS)'
  449. MOZ_COMPONENT_XPCOM_LIBS='-L$(DIST)/bin -lxpcom'
  450.  
  451. if test -n "$CROSS_COMPILE"; then
  452.     OS_TARGET="${target_os}"
  453.     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
  454.     OS_RELEASE=
  455.     OS_TEST="${target_cpu}"
  456.     case "${target_os}" in
  457.         linux*)       OS_ARCH=Linux ;;
  458.         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
  459.         openvms*)     OS_TARGET=`uname -s`
  460.                       OS_ARCH=`uname -s | sed -e 's|/|_|g'`
  461.                       OS_RELEASE=`uname -r`
  462.                       OS_TEST=`uname -Wh`;;
  463.     esac
  464. else
  465.     OS_TARGET=`uname -s`
  466.     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
  467.     OS_RELEASE=`uname -r`
  468.     OS_TEST=`uname -m`
  469. fi
  470. _COMPILER_PREFIX=
  471.  
  472. dnl ========================================================
  473. dnl GNU specific defaults
  474. dnl ========================================================
  475. if test "$GNU_CC"; then
  476.     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  477.     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  478.     DSO_LDOPTS='-shared -Wl,-h -Wl,$@'
  479.     DSO_CFLAGS=''
  480.     DSO_PIC_CFLAGS='-fPIC'
  481.  
  482.     # Turn on GNU specific features
  483.     # -Wall - turn on all warnings
  484.     # -pedantic - make compiler warn about non-ANSI stuff, and
  485.     #             be a little bit stricter
  486.     # Warnings slamm took out for now (these were giving more noise than help):
  487.     # -Wbad-function-cast - warns when casting a function to a new return type
  488.     # -Wconversion - complained when char's or short's were used a function args
  489.     # -Wshadow - removed because it generates more noise than help --pete
  490.     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith -Wcast-align"
  491.  
  492.     dnl Turn pedantic on but disable the warnings for long long
  493.     _PEDANTIC=1
  494.     _IGNORE_LONG_LONG_WARNINGS=1
  495.  
  496.     _DEFINES_CFLAGS='-include $(DEPTH)/config-defs.h -DMOZILLA_CLIENT'
  497.     _USE_CPP_INCLUDE_FLAG=1
  498. else
  499.     MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  500.     MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  501.     DSO_LDOPTS='-shared -h $@'
  502.     DSO_CFLAGS=''
  503.     DSO_PIC_CFLAGS='-KPIC'
  504.     _DEFINES_CFLAGS='$(ACDEFINES) -DMOZILLA_CLIENT'
  505. fi
  506.  
  507. if test "$GNU_CXX"; then
  508.     # Turn on GNU specific features
  509.     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wconversion -Wpointer-arith -Wbad-function-cast -Wcast-align -Woverloaded-virtual -Wsynth"
  510.  
  511.     dnl The following warning breaks Qt
  512.     if test ! "$QTDIR"; then
  513.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS}"
  514.     fi
  515.  
  516.     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/config-defs.h'
  517.     _USE_CPP_INCLUDE_FLAG=1
  518. else
  519.     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT $(ACDEFINES)'
  520. fi
  521.  
  522. dnl gcc can come with its own linker so it is better to use the pass-thru calls
  523. dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
  524. dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
  525. dnl normal behavior.
  526. dnl ========================================================
  527. MKSHLIB_FORCE_ALL=
  528. MKSHLIB_UNFORCE_ALL=
  529. if test "$GNU_CC"; then
  530.   AC_MSG_CHECKING(whether ld has archive extraction flags)
  531.   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
  532.    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
  533.     ac_cv_mkshlib_force_and_unforce="no"
  534.     exec 3<&0 <<LOOP_INPUT
  535.     force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
  536.     force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
  537.     force="-Wl,-all";              unforce="-Wl,-none"
  538. LOOP_INPUT
  539.     while read line
  540.     do
  541.       eval $line
  542.       LDFLAGS=$force
  543.       LIBS=$unforce
  544.       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
  545.     done
  546.     exec 0<&3 3<&-
  547.     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
  548.    ])
  549.   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
  550.     AC_MSG_RESULT(no)
  551.   else
  552.     AC_MSG_RESULT(yes)
  553.     eval $ac_cv_mkshlib_force_and_unforce
  554.     MKSHLIB_FORCE_ALL=$force
  555.     MKSHLIB_UNFORCE_ALL=$unforce
  556.   fi
  557. fi
  558.  
  559. dnl ========================================================
  560. dnl System overrides of the defaults for host
  561. dnl ========================================================
  562. case "$host" in
  563. *-linux*)
  564.     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  565.     ;;
  566.  
  567. *-osf*)
  568.     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
  569.     ;;
  570.  
  571. esac
  572.  
  573. dnl =======================================================
  574. dnl Check to see if we are using an old version of the Compaq C compiler.
  575. dnl =======================================================
  576. dnl Even after installing this compiler, this test still fails.
  577. dnl AC_LANG_SAVE
  578. dnl AC_LANG_CPLUSPLUS
  579. dnl AC_MSG_CHECKING(for old DEC C++ compiler)
  580. dnl AC_TRY_COMPILE([], [
  581. dnl #if defined(__DECCXX) && (__DECCXX_VER<60190029)
  582. dnl #error "Compiler is too old."
  583. dnl #endif ],
  584. dnl [AC_MSG_RESULT([no])],
  585. dnl AC_MSG_ERROR([Compiler is too old.  Get a new one: http://www.unix.digital.com/dtk/]) )
  586. dnl AC_LANG_RESTORE
  587.  
  588. dnl ========================================================
  589. dnl Check for an old version of SUNWspro
  590. dnl ========================================================
  591. case "$target" in
  592. *-solaris*)
  593.     if test ! "$GNU_CC" && test ! -z "`${CC} -V 2>&1 | head -1 | grep '4.2'`"; then
  594.         AC_MSG_ERROR([SUNWspro4.2 is too old.  Use a newer version or gcc.])
  595.     fi
  596.     ;;
  597. esac
  598.  
  599. dnl ========================================================
  600. dnl System overrides of the defaults for target
  601. dnl ========================================================
  602. case "$target" in
  603. *-aix*)
  604.     if test ! "$GNU_CC"; then
  605.         # DSO_LDOPTS='-ldl -bM:SRE -p1 -brtl -bso -bexpall -bnoentry'
  606.         DSO_LDOPTS='-ldl -p1 -brtl -bso -bsymbolic -bnortllib'
  607.         DSO_CFLAGS='-qflag=w:w'
  608.         DSO_PIC_CFLAGS='-DPIC'
  609.     fi
  610.     case "${target_os}" in
  611.     aix4.1*)
  612.         DLL_SUFFIX='_shr.a'
  613.         ;;
  614.     esac
  615.     MKSHLIB='$(AIX_SHLIB_BIN) $(DSO_LDOPTS) -o $@'
  616.     MKCSHLIB='$(AIX_SHLIB_BIN) $(DSO_LDOPTS) -o $@'
  617.     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  618.     ;;
  619.  
  620. *-beos*)
  621.     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  622.     DSO_LDOPTS='-nostart -Wl,-h -Wl,$@'
  623.     TK_LIBS='-lbe -lroot'
  624.     LIBS="$LIBS -lbe"
  625.     AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
  626.     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
  627.     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar -Wno-ctor-dtor-privacy"
  628.     ;;
  629.  
  630. *-bsdi*)
  631.     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
  632.     _PEDANTIC=
  633.     _IGNORE_LONG_LONG_WARNINGS=
  634.     case $OS_RELEASE in
  635.     4.*)
  636.             STRIP="$STRIP -d"
  637.             ;;
  638.     *)
  639.         DSO_CFLAGS=''
  640.         DSO_LDOPTS='-r'
  641.         _WARNINGS_CFLAGS="-Wall"
  642.         _WARNINGS_CXXFLAGS="-Wall"
  643.         # The test above doesn't work properly, at least on 3.1.
  644.         MKSHLIB_FORCE_ALL=''
  645.         MKSHLIB_UNFORCE_ALL=''
  646.     ;;
  647.     esac
  648.     ;;
  649.  
  650. *-freebsd*)
  651.     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
  652.     DLL_SUFFIX=".so.1.0"
  653.     DSO_LDOPTS="-shared"
  654.     fi
  655.     if test ! "$GNU_CC"; then
  656.     DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
  657.     fi
  658. # Can't have force w/o an unforce.
  659. #    # Hack for FreeBSD 2.2
  660. #    if test -z "$MKSHLIB_FORCE_ALL"; then
  661. #    MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
  662. #    MKSHLIB_UNFORCE_ALL=''
  663. #    fi
  664.     ;; 
  665.  
  666. *-hpux*)
  667.     DLL_SUFFIX=".sl"
  668.     if test ! "$GNU_CC"; then
  669.         DSO_LDOPTS='-b -Wl,+s -L$(DIST)/bin'
  670.         DSO_CFLAGS=""
  671.         DSO_PIC_CFLAGS="+Z"
  672.         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  673.         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  674.     else
  675.         DSO_LDOPTS='-b -E +s -L$(DIST)/bin -L$(DIST)/lib'
  676.         MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  677.         MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  678.     fi
  679.     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
  680.     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  681.     ;;
  682.  
  683. *-irix5*)
  684.     AC_DEFINE(IRIX)
  685.     DSO_LDOPTS='-elf -shared'
  686.     if test "$GNU_CC"; then
  687.        MKSHLIB_FORCE_ALL='-Wl,-all'
  688.        MKSHLIB_UNFORCE_ALL='-Wl,-none'
  689.     else
  690.        MKSHLIB_FORCE_ALL='-all'
  691.        MKSHLIB_UNFORCE_ALL='-none'
  692.     fi
  693.     ;;
  694.  
  695. *-irix6*)
  696.     AC_DEFINE(IRIX)
  697.     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
  698.     dnl compile and link using -n32
  699.     USE_N32=1
  700.     DSO_LDOPTS='-elf -shared'
  701.     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  702.     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  703.     if test "$GNU_CC"; then
  704.        MKSHLIB_FORCE_ALL='-Wl,-all'
  705.        MKSHLIB_UNFORCE_ALL='-Wl,-none'
  706.        _WARNINGS_CFLAGS="-Wall"
  707.        _WARNINGS_CXXFLAGS="-Wall"
  708.     else
  709.        MKSHLIB_FORCE_ALL='-all'
  710.        MKSHLIB_UNFORCE_ALL='-none'
  711.        AR_LIST="$AR t"
  712.        AR_EXTRACT="$AR x"
  713.        AR_DELETE="$AR d"
  714.        AR='$(CXX) -ar'
  715.        AR_FLAGS='-o $@'
  716.        CFLAGS="$CFLAGS -woff 3262"
  717.        CXXFLAGS="$CXXFLAGS -woff 3262"
  718.        if test -n "$USE_N32"; then
  719.        ASFLAGS="$ASFLAGS -n32"
  720.        CFLAGS="$CFLAGS -n32"
  721.        CXXFLAGS="$CXXFLAGS -n32"
  722.        LDFLAGS="$LDFLAGS -n32"
  723.        fi
  724.        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  725.     fi
  726.     ;;
  727.  
  728. *-*linux*)
  729.     AC_DEFINE(_POSIX_SOURCE)
  730.     AC_DEFINE(_SVID_SOURCE)
  731.     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  732.     LIBS="$LIBS -lc"
  733.  
  734.     case "${host_cpu}" in
  735.     alpha*)
  736.         CFLAGS="$CFLAGS -mieee"
  737.         CXXFLAGS="$CXXFLAGS -mieee"
  738.     ;;
  739.     i?86)
  740.         USE_ELF_DYNSTR_GC=1
  741.     ;;
  742.     esac
  743.     ;;
  744.  
  745. *-mingw*)
  746.     AC_DEFINE(_WINDOWS)
  747.     AC_DEFINE(WIN32_LEAN_AND_MEAN)
  748.     AC_DEFINE(NONAMELESSUNION)
  749.     CFLAGS="$(CFLAGS) -fvtable-thunks"
  750.     CXXFLAGS="$(CXXFLAGS) -fvtable-thunks"
  751.     TARGET_MD_ARCH=win32
  752.     if test -z "$GNU_CC"; then
  753.     OBJ_SUFFIX=obj
  754.     LIB_SUFFIX=lib
  755.     DLL_SUFFIX=.dll
  756.     fi
  757.     MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $(LIBRARY_NAME).dll --output-lib $@'
  758.     MKCSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $(LIBRARY_NAME).dll --output-lib $@'
  759.     MKSHLIB_FORCE_ALL=
  760.     MKSHLIB_UNFORCE_ALL=
  761.     DSO_LDOPTS=
  762.     DSO_CFLAGS=
  763.     DSO_PIC_CFLAGS=
  764.     OS_TARGET=WINNT
  765.     dnl Hardcode to win95 for now - cls
  766.     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
  767.     
  768.     case "$target" in
  769.     i?86-*)
  770.     AC_DEFINE(_X86_)
  771.     ;;
  772.     alpha-*)
  773.     AC_DEFINE(_ALPHA_)
  774.     ;;
  775.     mips-*)
  776.     AC_DEFINE(_MIPS_)
  777.     ;;
  778.     *)
  779.     AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
  780.     ;;
  781.     esac
  782.     ;;
  783.  
  784. *-netbsd*)
  785.     DSO_CFLAGS=''
  786.     CFLAGS="$CFLAGS -Dunix"
  787.     CXXFLAGS="$CXXFLAGS -Dunix"
  788.     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
  789.         DLL_SUFFIX=".so"
  790.         DSO_PIC_CFLAGS='-fPIC -DPIC'
  791.         DSO_LDOPTS='-shared -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX)'
  792.     BIN_FLAGS='-Wl,--export-dynamic'
  793.     else
  794.         DSO_PIC_CFLAGS='-fPIC -DPIC'
  795.         DLL_SUFFIX=".so.1.0"
  796.         DSO_LDOPTS='-shared'
  797.     fi
  798.     # This will fail on a.out systems prior to 1.5.1_ALPHA.
  799.     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
  800.     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
  801.     if test "$LIBRUNPATH"; then
  802.     DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
  803.     fi
  804.     ;;
  805.  
  806. *-nto*) 
  807.     CFLAGS="$CFLAGS -DNTO -D_QNX_SOURCE -D_POSIX_C_SOURCE=199506 -D_i386"
  808.     CXXFLAGS="$CXXFLAGS -DNTO -D_QNX_SOURCE -D_POSIX_C_SOURCE=199506 -D_i386"
  809.     _WARNINGS_CFLAGS='-w'
  810.     _WARNINGS_CXXFLAGS='-w'
  811.     OS_TARGET="NTO"
  812.     MOZ_OPTIMIZE_FLAGS="-O1"
  813.     MOZ_DEBUG_FLAGS="-gstabs"
  814.     DSO_LDOPTS="-M $DSO_LDOPTS"
  815.     DSO_CFLAGS=''
  816.     DSO_PIC_CFLAGS="-shared -Wc,-fPIC -DPIC"
  817.     MKSHLIB='qcc -Vgcc_ntox86 $(DSO_LDOPTS) -o $@'
  818.     MKCSHLIB='qcc -Vgcc_ntox86 $(DSO_LDOPTS) -o $@'
  819.     AR='qcc -Vgcc_ntox86'
  820.     AR_FLAGS='-M -a $@'
  821.     AR_LIST='ar t'
  822.     AR_EXTRACT='ar x'
  823.     AR_DELETE='ar d'
  824.     _DEFINES_CFLAGS='-Wp,-include,$(DEPTH)/config-defs.h -DMOZILLA_CLIENT'
  825.     _DEFINES_CXXFLAGS='-Wp,-include,$(DEPTH)/config-defs.h -DMOZILLA_CLIENT'
  826.     _PREPROCESSOR_PREFIX="-Wp,"
  827.     _COMPILER_PREFIX="-Wc,"
  828.     _LINKER_PREFIX="-Wl,"      
  829.     USE_PTHREADS=1
  830.     _PTHREAD_LDFLAGS=""
  831.     LIBS="$LIBS -L/usr/lib -lsocket -lm -lstdc++"
  832.     HAVE_DEV_ZERO=1
  833.     ;;
  834.  
  835. *-openbsd*)
  836.     DLL_SUFFIX=".so.1.0"
  837.     DSO_CFLAGS=''
  838.     DSO_PIC_CFLAGS='-fPIC'
  839.     DSO_LDOPTS='-shared -h $@'
  840.     MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  841.     MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  842.     if $CC -E - -dM </dev/null | grep -v __ELF__ >/dev/null; then
  843.     DSO_LDOPTS="-Bshareable /usr/lib/c++rt0.o"
  844.     fi
  845.     if test "$LIBRUNPATH"; then
  846.     DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
  847.     fi
  848.     ;;
  849.  
  850. *-openvms*) 
  851.     if test "$OS_TARGET" = "POSIX_for_OpenVMS_AXP"; then
  852.     dnl Hack...
  853.     _OPENVMS_CROSS_COMPILE=1
  854.     fi
  855.     MISSING_NSPR="yes"
  856.     AC_DEFINE(NO_PW_GECOS)
  857.     AC_DEFINE(NO_UDSOCK)
  858.     USE_PTHREADS=1
  859.     ;;
  860.  
  861.  
  862. *-*-os2*)
  863.     MOZ_BUILD_ROOT=`pwd -D`
  864.     USE_SHORT_LIBNAME=1
  865.     BIN_SUFFIX='.exe'
  866.     OBJ_SUFFIX=obj
  867.     LIB_SUFFIX=lib
  868.     DLL_SUFFIX=.dll
  869.     DLLTOOL=''
  870.     LD='$(CC)'
  871.     DSO_CFLAGS=''
  872.     DSO_PIC_CFLAGS=''
  873.     MOZ_JPEG_LIBS='$(DIST)/lib/mozjpeg.$(LIB_SUFFIX)'
  874.     MOZ_ZLIB_LIBS='$(DIST)/lib/mozz.$(LIB_SUFFIX)'
  875.     MOZ_PNG_LIBS='$(DIST)/lib/mozpng.$(LIB_SUFFIX)'
  876.     MOZ_MNG_LIBS='$(DIST)/lib/mozmng.$(LIB_SUFFIX)'
  877.     MOZ_JS_LIBS='$(DIST)/lib/mozjs.lib'
  878.     OS_ARCH=OS2
  879.     OS_TARGET=OS2
  880.  
  881.     case "$target" in
  882.     *-*-os2_emx)
  883.         _PEDANTIC=''
  884.         AR=emxomfar
  885.         AR_FLAGS='-p256 r $@'
  886.         CFLAGS="-Zmtd -Zomf $CFLAGS"
  887.         CXXFLAGS="-Zmtd -Zomf $CXXFLAGS"
  888.         DSO_LDOPTS='-Zomf -Zdll -Zmt -Zcrtdll -Zlinker /NOO'
  889.         BIN_FLAGS='-Zlinker /PM:VIO -Zlinker /ST:0x30000'
  890.         IMPLIB='emximp -o'
  891.         FILTER='emxexp'
  892.         AC_DEFINE(OS2)
  893.         AC_DEFINE(XP_OS2_EMX)
  894.         AC_DEFINE(OS2EMX_PLAIN_CHAR)
  895.         MOZ_COMPONENT_NSPR_LIBS='-L$(DIST)/lib $(NSPR_LIBS)'
  896.         MOZ_COMPONENT_XPCOM_LIBS='-L$(DIST)/lib $(DIST)/lib/xpcom.lib'
  897.         XPCOM_LIBS='-L$(DIST)/lib -lxpcom'
  898.         ;;
  899.  
  900.     *-*-os2_vacpp)
  901. #        MOZ_BUILD_ROOT="$ROOT"`pwd -D`
  902.         AR=-ilib
  903.         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
  904.         AR_LIST='/L'
  905.         AR_EXTRACT='-*'
  906.         AR_DELETE='-'
  907.         LD='-ilink'
  908.         TARGET_MD_ARCH=os2
  909.         CFLAGS="/Q /qlibansi /Gd /Gm /Su4 /Mp /Tl-"
  910.         CXXFLAGS="/Q /qlibansi /Gd /Gm /Su4 /Mp /Tl-"
  911.         LDFLAGS="/FREE /DE /NOE /LINENUMBERS /nologo"
  912.         DSO_LDOPTS=''
  913.         IMPLIB='implib /NOL /NOI'
  914.         FILTER='cppfilt -q -B -P'
  915.         AC_DEFINE(NO_ANSI_KEYWORDS)
  916.         AC_DEFINE(OS2,4)
  917.         AC_DEFINE(_X86_)
  918.         AC_DEFINE(XP_OS2_VACPP)
  919.         AC_DEFINE(TCPV40HDRS)
  920.         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  921.         AC_DEFINE(STDC_HEADERS)
  922.         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
  923.         MOZ_COMPONENT_XPCOM_LIBS='$(DIST)/lib/xpcom.lib'
  924.         XPCOM_LIBS='$(DIST)/lib/xpcom.lib'
  925.         MKSHLIB='$(LD) $(DSO_LDOPTS)'
  926.         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
  927.         ;;
  928.     esac
  929.     ;;
  930.  
  931. alpha*-*-osf*)
  932.     if test "$GNU_CC"; then
  933.     DSO_LDOPTS='-shared -Wl,-soname -Wl,$@'
  934.     else
  935.     MOZ_DEBUG_FLAGS='-g3'
  936.     ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g -std1'
  937.     CFLAGS="$CFLAGS -std1 -ieee"
  938.     CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
  939.     DSO_LDOPTS='-shared -msym -expect_unresolved \* -soname $@ -update_registry $(DIST)/so_locations'
  940.     DSO_CFLAGS=
  941.     DSO_PIC_CFLAGS=
  942.     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  943.     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  944.     MKSHLIB_FORCE_ALL='-all'
  945.     MKSHLIB_UNFORCE_ALL='-none'
  946.     dnl Might fix the libxpcom.so breakage on this platform as well....
  947.     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
  948.     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  949.     fi
  950.     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
  951.     ;;
  952.  
  953. *-qnx*) 
  954.     DIRENT_INO=d_stat.st_ino
  955.     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
  956.     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
  957.     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  958.     if test "$no_x" = "yes"; then
  959.     MOZ_WIDGET_TOOLKIT='photon'
  960.     TK_CFLAGS='-I/usr/nto/include/photon'
  961.     TK_LIBS='-lphoton -lphrender'
  962.     AC_DEFINE(NO_X11)
  963.     fi
  964.     ;;
  965.  
  966. *-rhapsody*) 
  967.     DLL_SUFFIX=".dylib"
  968.     DSO_LDOPTS='-compatibility_version 1 -current_version 1'
  969.     AC_DEFINE(NO_X11)
  970.     AC_DEFINE(DARWIN)
  971.     AC_DEFINE(RHAPSODY)
  972.     AC_DEFINE(TARGET_CARBON)
  973.     AC_DEFINE(TARGET_API_MAC_CARBON)
  974.     ENABLE_TESTS=
  975.     MOZ_WIDGET_TOOLKIT='mac'
  976.     TK_LIBS='/System/Library/Frameworks/Carbon.framework/Carbon'
  977.     CFLAGS="$CFLAGS -traditional-cpp -fno-common -I/System/Library/Frameworks/Carbon.framework/Headers"
  978.     CXXFLAGS="$CXXFLAGS -traditional-cpp -fno-common -I/System/Library/Frameworks/Carbon.framework/Headers"
  979.     MKSHLIB='$(CXX) $(CXXFLAGS) -arch ppc $(DSO_LDOPTS) -o $@'
  980.     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  981.     MKSHLIB_FORCE_ALL=''
  982.     MKSHLIB_UNFORCE_ALL=''
  983.     ;;
  984.  
  985. *-sco*) 
  986.     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
  987.     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  988.     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
  989.     if test ! "$GNU_CC"; then
  990.        DSO_LDOPTS='-G -h $@'
  991.     fi
  992.     ;;
  993.  
  994. dnl the qsort routine under solaris is faulty
  995. *-solaris*) 
  996.     AC_DEFINE(BROKEN_QSORT)
  997.     TARGET_NSPR_MDCPUCFG='\"md/_solaris32.cfg\"'
  998.     SYSTEM_MAKEDEPEND=
  999.     if test -z "$GNU_CC"; then
  1000.        NS_USE_NATIVE=1
  1001.        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1002.        LDFLAGS='-xildoff'
  1003.        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  1004.        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  1005.        MKSHLIB_FORCE_ALL='-Qoption ld -z,allextract'
  1006.        MKSHLIB_UNFORCE_ALL=''
  1007.        DSO_LDOPTS='-G -Qoption ld -z,muldefs -h $@'
  1008.        AR_LIST="$AR t"
  1009.        AR_EXTRACT="$AR x"
  1010.        AR_DELETE="$AR d"
  1011.        AR='$(CXX) -xar'
  1012.        AR_FLAGS='-o $@'
  1013.        AS='/usr/ccs/bin/as'
  1014.        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
  1015.        AS_DASH_C_FLAG=''
  1016.     else
  1017.        ASFLAGS="$ASFLAGS -fPIC"
  1018.        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  1019.        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  1020.        DSO_LDOPTS='-G -h $@'
  1021.        _WARNINGS_CFLAGS=''
  1022.        _WARNINGS_CXXFLAGS=''
  1023.        if test "$OS_RELEASE" = "5.3"; then
  1024.       AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
  1025.        fi
  1026.     fi
  1027.     if test "$OS_RELEASE" = "5.5.1"; then
  1028.        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
  1029.     fi
  1030.     ;;
  1031.  
  1032. *-sunos*) 
  1033.     DSO_LDOPTS='-Bdynamic'
  1034.     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
  1035.     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
  1036.     AC_DEFINE(SUNOS4)
  1037.     AC_DEFINE(SPRINTF_RETURNS_STRING)
  1038.     case "$(target_os)" in
  1039.     sunos4.1*)
  1040.         DLL_SUFFIX='.so.1.0'
  1041.         ;;
  1042.     esac
  1043.     ;;
  1044.  
  1045. *-sysv4.2uw7*) 
  1046.     NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
  1047.     ;;
  1048.  
  1049. esac
  1050.  
  1051. dnl Only one oddball right now (QNX), but this gives us flexibility
  1052. dnl if any other platforms need to override this in the future.
  1053. AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
  1054.  
  1055. dnl ========================================================
  1056. dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
  1057. dnl by now will not have any way to link most binaries (tests
  1058. dnl as well as viewer, apprunner, etc.), because some symbols
  1059. dnl will be left out of the "composite" .so's by ld as unneeded.
  1060. dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
  1061. dnl they can link in the static libs that provide the missing
  1062. dnl symbols.
  1063. dnl ========================================================
  1064. NO_LD_ARCHIVE_FLAGS=
  1065. if test -z "$MKSHLIB_FORCE_ALL"; then
  1066.     NO_LD_ARCHIVE_FLAGS=1
  1067. fi
  1068. case "$target" in
  1069. *-*-os2_*)
  1070.     NO_LD_ARCHIVE_FLAGS=
  1071.     ;;
  1072. *-aix4.3*)
  1073.     NO_LD_ARCHIVE_FLAGS=
  1074.     ;;
  1075. *-openvms*)
  1076.     NO_LD_ARCHIVE_FLAGS=
  1077.     ;;
  1078. esac
  1079. AC_SUBST(NO_LD_ARCHIVE_FLAGS)
  1080.  
  1081. XLDFLAGS="$X_LIBS"
  1082. XLIBS="$X_EXTRA_LIBS"
  1083.  
  1084. dnl ========================================================
  1085. dnl Checks for X libraries.
  1086. dnl Ordering is important.
  1087. dnl Xt is dependent upon SM as of X11R6
  1088. dnl ========================================================
  1089. if test "$no_x" != "yes"
  1090. then
  1091.     XLIBS="-lX11 $XLIBS"
  1092.     _SAVE_LDFLAGS="$LDFLAGS"
  1093.     LDFLAGS="$XLDFLAGS $LDFLAGS"
  1094.     AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
  1095.         [MISSING_X="$MISSING_X -lX11"], $XLIBS)
  1096.     AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
  1097.         [MISSING_X="$MISSING_X -lXext"], $XLIBS)
  1098.     AC_CHECK_LIB(ICE, IceFlush, [XICE_LIBS="-lICE"],, $XLIBS)
  1099.     AC_CHECK_LIB(SM, SmcCloseConnection, [XSM_LIBS="-lSM"],, $XLIBS)
  1100.     AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"],
  1101.         [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XLIBS)
  1102.     AC_CHECK_LIB(Xmu, XmuLookupString, [XMU_LIBS="-lXmu"],
  1103.         [MISSING_X="$MISSING_X -lXmu"], $X_PRE_LIBS $XLIBS $XT_LIBS $XEXT_LIBS)
  1104.  
  1105.     dnl ========================================================
  1106.     dnl =
  1107.     dnl = Check for Xinerama
  1108.     dnl =
  1109.     dnl ========================================================
  1110.     AC_CHECK_LIB(Xinerama, XineramaIsActive, [MOZ_XINERAMA_LIBS="-lXinerama"],,
  1111.         $XLIBS $XEXT_LIBS)
  1112.     AC_CHECK_HEADER(X11/extensions/Xinerama.h)
  1113.  
  1114.     dnl ========================================================
  1115.     dnl =
  1116.     dnl = Check for XIE
  1117.     dnl =
  1118.     dnl ========================================================
  1119.     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
  1120.         $XLIBS $XEXT_LIBS)
  1121.     AC_CHECK_HEADER(X11/extensions/XIElib.h)
  1122.  
  1123.     if test "$MOZ_XIE_LIBS"; then
  1124.     dnl ====================================================
  1125.     dnl =
  1126.     dnl = If XIE is present and is desired, turn it on
  1127.     dnl =
  1128.     dnl ====================================================
  1129.     case $target in
  1130.         *-hpux*)
  1131.         ;;
  1132.         *)
  1133.         HAVE_XIE=1
  1134.         ;;
  1135.     esac
  1136.     fi
  1137.  
  1138.     LDFLAGS="$_SAVE_LDFLAGS"
  1139.  
  1140.     dnl ========================================================
  1141.     dnl =
  1142.     dnl = --enable-toolkit
  1143.     dnl = 
  1144.     dnl = Select the default x toolkit
  1145.     dnl = 
  1146.     dnl ========================================================
  1147.     AC_ARG_ENABLE(toolkit,
  1148.     [  --enable-toolkit=\$val   Enable \$val fe (defaults to gtk)],
  1149.       [    if test "$enableval" = "motif" \
  1150.             -o "$enableval" = "gtk" \
  1151.             -o "$enableval" = "qt" \
  1152.             -o "$enableval" = "xlib"
  1153.         then
  1154.              dnl nglayout only supports building with one toolkit,
  1155.              dnl so ignore everything after the first comma (",").
  1156.              MOZ_WIDGET_TOOLKIT=`echo "$enableval" | sed -e "s/,.*$//"`
  1157.         else
  1158.              AC_MSG_ERROR(Toolkit must be Xlib, GTK, Qt, or Motif.)
  1159.         fi], 
  1160.  
  1161.       [    MOZ_WIDGET_TOOLKIT="gtk" ])
  1162. fi # $no_x
  1163.  
  1164. dnl ========================================================
  1165. dnl =
  1166. dnl = If NSPR was not detected in the system, 
  1167. dnl = use the one in the source tree (mozilla/nsprpub)
  1168. dnl =
  1169. dnl ========================================================
  1170.  
  1171. AM_PATH_NSPR(4.0.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
  1172.  
  1173. if test -z "$MOZ_NATIVE_NSPR"; then
  1174.     AC_MSG_WARN(nspr-config not found. building local copy of NSPR)
  1175.     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(DIST) --cflags`'
  1176.     case "$target" in
  1177.     *-*-os2_vacpp)
  1178.         NSPR_LIBS='$(DIST)/lib/nspr'$NSPR_VERSION'.lib $(DIST)/lib/plc'$NSPR_VERSION'.lib $(DIST)/lib/plds'$NSPR_VERSION'.lib '$_PTHREAD_LDFLAGS''
  1179.         ;;
  1180.     *)
  1181.         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(DIST) --libs`'
  1182.         ;;
  1183.     esac
  1184. fi
  1185.  
  1186. dnl ========================================================
  1187. dnl =
  1188. dnl = --enable-xinerama
  1189. dnl =
  1190. dnl = This turns on xinerama support.  We just can't use the
  1191. dnl = autodetection of the libraries since on Red Hat 7 linking with
  1192. dnl = Xinerama crashes the dynamic loader.  Make people turn it on
  1193. dnl = explicitly.  The autodetection is done above in the Xlib
  1194. dnl = detection routines.
  1195. dnl =
  1196. dnl ========================================================
  1197.  
  1198.  
  1199. MOZ_ARG_ENABLE_BOOL(xinerama,
  1200. [  --enable-xinerama       Enable Xinerama support
  1201.                            ( not safe for Red Hat 7.0 ) ],
  1202.   [ if test -n "$MOZ_XINERAMA_LIBS" && \
  1203.       test -n "$ac_cv_header_X11_extensions_Xinerama_h"; then
  1204.         MOZ_ENABLE_XINERAMA=1
  1205.         AC_DEFINE(MOZ_ENABLE_XINERAMA)
  1206.     fi ]
  1207. )
  1208.  
  1209.  
  1210. MOZ_WIDGET_TOOLKIT_LDFLAGS='-lwidget_$(MOZ_WIDGET_TOOLKIT)'
  1211. MOZ_GFX_TOOLKIT_LDFLAGS='-lgfx_$(MOZ_WIDGET_TOOLKIT) $(MOZ_XLIBRGB_LDFLAGS)'
  1212. WIDGET_DLL='\"libwidget_$(MOZ_WIDGET_TOOLKIT)$(DLL_SUFFIX)\"'
  1213. GFXWIN_DLL='\"libgfx_$(MOZ_GFX_TOOLKIT)$(DLL_SUFFIX)\"'
  1214.  
  1215. case "$target_os" in
  1216. beos*)
  1217.     MOZ_WIDGET_TOOLKIT="beos"
  1218.     ;;
  1219.  
  1220. nto*)
  1221.     MOZ_WIDGET_TOOLKIT="photon"
  1222.     AC_DEFINE(NO_X11)
  1223.     TK_CFLAGS='-I/usr/include/photon'
  1224.     TK_LIBS='-lph -lphrender'
  1225.     ;;
  1226.  
  1227. os2*)
  1228.     MOZ_WIDGET_TOOLKIT=os2
  1229.     MOZ_WIDGET_TOOLKIT_LDFLAGS='$(DIST)/lib/wdgt$(MOZ_WIDGET_TOOLKIT)'
  1230.     MOZ_GFX_TOOLKIT_LDFLAGS='$(DIST)/lib/gfx_$(MOZ_WIDGET_TOOLKIT)'
  1231.     WIDGET_DLL='\"wdgt$(MOZ_WIDGET_TOOLKIT)$(DLL_SUFFIX)\"'
  1232.     GFXWIN_DLL='\"gfx_$(MOZ_GFX_TOOLKIT)$(DLL_SUFFIX)\"'
  1233.     ;;
  1234. esac
  1235.  
  1236. dnl XXX BROKEN dnl ========================================================
  1237. dnl XXX BROKEN dnl =
  1238. dnl XXX BROKEN dnl = --enable-gfx-toolkit
  1239. dnl XXX BROKEN dnl = 
  1240. dnl XXX BROKEN dnl = Select which toolkit to use for gfx (rendering)
  1241. dnl XXX BROKEN dnl = 
  1242. dnl XXX BROKEN dnl = Choices are:
  1243. dnl XXX BROKEN dnl = 
  1244. dnl XXX BROKEN dnl = gtk
  1245. dnl XXX BROKEN dnl = motif
  1246. dnl XXX BROKEN dnl = xlib
  1247. dnl XXX BROKEN dnl = 
  1248. dnl XXX BROKEN dnl = Default is whatever MOZ_WIDGET_TOOLKIT is
  1249. dnl XXX BROKEN dnl = 
  1250. dnl XXX BROKEN dnl = The only valid combinations are:
  1251. dnl XXX BROKEN dnl = 
  1252. dnl XXX BROKEN dnl = widget       gfx
  1253. dnl XXX BROKEN dnl = ------       ---
  1254. dnl XXX BROKEN dnl = gtk          gtk
  1255. dnl XXX BROKEN dnl = motif        motif
  1256. dnl XXX BROKEN dnl = xlib         xlib
  1257. dnl XXX BROKEN dnl = 
  1258. dnl XXX BROKEN dnl = motif        xlib (broken)
  1259. dnl XXX BROKEN dnl = gtk          xlib (not tested yet)
  1260. dnl XXX BROKEN dnl = 
  1261. dnl XXX BROKEN dnl ========================================================
  1262. dnl XXX BROKEN dnl MOZ_GFX_TOOLKIT=$MOZ_WIDGET_TOOLKIT
  1263. dnl XXX BROKEN dnl 
  1264. dnl XXX BROKEN dnl AC_ARG_ENABLE(gfx-toolkit,
  1265. dnl XXX BROKEN dnl [  --enable-gfx-toolkit=\$val   Enable \$val fe (defaults to same as widget)],
  1266. dnl XXX BROKEN dnl   [ MOZ_GFX_TOOLKIT=`echo "$enableval" | sed -e "s/,.*$//"` ], 
  1267. dnl XXX BROKEN dnl   [])
  1268. dnl XXX BROKEN dnl 
  1269. dnl XXX BROKEN dnl 
  1270. dnl XXX BROKEN dnl if echo ":$MOZ_GFX_TOOLKIT" | grep "xlib" >/dev/null
  1271. dnl XXX BROKEN dnl then
  1272. dnl XXX BROKEN dnl   MOZ_XLIBRGB_LDFLAGS=-lxlibrgb
  1273. dnl XXX BROKEN dnl   MOZ_USING_XLIBRGB=1
  1274. dnl XXX BROKEN dnl 
  1275. dnl XXX BROKEN dnl   AC_DEFINE(MOZ_USING_XLIBRGB)
  1276. dnl XXX BROKEN dnl 
  1277. dnl XXX BROKEN dnl   AC_SUBST(MOZ_XLIBRGB_LDFLAGS)
  1278. dnl XXX BROKEN dnl   AC_SUBST(MOZ_USING_XLIBRGB)
  1279. dnl XXX BROKEN dnl fi
  1280.  
  1281. dnl ========================================================
  1282. dnl =                                                        =
  1283. dnl = Enable the toolkit as needed                         =
  1284. dnl =                                                        =
  1285. dnl ========================================================
  1286.  
  1287. if test "$MOZ_WIDGET_TOOLKIT" = "gtk"
  1288. then
  1289.     MOZ_ENABLE_GTK=1
  1290.     MOZ_ENABLE_XREMOTE=1
  1291.     AC_DEFINE(MOZ_WIDGET_GTK)
  1292. fi
  1293.  
  1294. if test "$MOZ_WIDGET_TOOLKIT" = "xlib"
  1295. then
  1296.     MOZ_ENABLE_XLIB=1
  1297.     MOZ_ENABLE_XREMOTE=1
  1298.     AC_DEFINE(MOZ_WIDGET_XLIB)
  1299. fi
  1300.  
  1301. if test "$MOZ_WIDGET_TOOLKIT" = "qt"
  1302. then
  1303.     MOZ_ENABLE_QT=1
  1304.     MOZ_ENABLE_XREMOTE=1
  1305.     AC_DEFINE(MOZ_WIDGET_QT)
  1306. fi
  1307.  
  1308. if test "$MOZ_WIDGET_TOOLKIT" = "motif"
  1309. then
  1310.     MOZ_ENABLE_MOTIF=1
  1311.     MOZ_ENABLE_XREMOTE=1
  1312.     AC_DEFINE(MOZ_WIDGET_MOTIF)
  1313. fi
  1314.  
  1315. if test "$MOZ_WIDGET_TOOLKIT" = "photon"
  1316. then
  1317.     MOZ_ENABLE_PHOTON=1
  1318.     AC_DEFINE(MOZ_WIDGET_PHOTON)
  1319. fi
  1320.  
  1321.  
  1322. if test "$MOZ_ENABLE_XREMOTE"; then
  1323.     AC_DEFINE(MOZ_ENABLE_XREMOTE)
  1324. fi
  1325.  
  1326. dnl ========================================================
  1327. dnl =                                                       =
  1328. dnl = --with-gtk                                           =
  1329. dnl =                                                        =
  1330. dnl = Gtk support hackery                                  =
  1331. dnl =                                                        =
  1332. dnl ========================================================
  1333. if test "$no_x" != "yes"
  1334. then
  1335.     AC_ARG_WITH(gtk,
  1336.     [  --with-gtk              Enable GTK+ support ],
  1337.     [
  1338.         if test "$withval" = "yes"
  1339.         then
  1340.             MOZ_ENABLE_GTK=1
  1341.         else
  1342.             MOZ_ENABLE_GTK=
  1343.         fi
  1344.     ])
  1345. fi
  1346.  
  1347. HAVE_GDK_PIXBUF=
  1348. MOZ_GDK_PIXBUF_CFLAGS=
  1349. MOZ_GDK_PIXBUF_LIBS=
  1350.  
  1351. if test "$MOZ_ENABLE_GTK"
  1352. then
  1353.     AM_PATH_GTK($GTK_VERSION,,
  1354.       AC_MSG_ERROR(Test for GTK failed.))
  1355.  
  1356.  
  1357.     AM_PATH_GDK_PIXBUF($GDK_PIXBUF_VERSION,
  1358.       [HAVE_GDK_PIXBUF=1],)
  1359.  
  1360.     if test "$HAVE_GDK_PIXBUF"; then
  1361.         MOZ_GDK_PIXBUF_CFLAGS=$GDK_PIXBUF_CFLAGS
  1362.         MOZ_GDK_PIXBUF_LIBS=$GDK_PIXBUF_LIBS
  1363.     fi
  1364.  
  1365. dnl ========================================================
  1366. dnl =                               =
  1367. dnl = --with-java-supplement                   =
  1368. dnl =                               =
  1369. dnl = Blackwood Java Code                                  =
  1370. dnl =                               =
  1371. dnl ========================================================
  1372. if test "$no_x" != "yes"
  1373. then
  1374.     AC_ARG_WITH(java-supplement,
  1375.     [  --with-java-supplement  Enable Blackwood Java Code],
  1376.     [
  1377.         if test "$withval" = "yes"
  1378.         then
  1379.             MOZ_JAVA_SUPPLEMENT=1
  1380.         else
  1381.             MOZ_JAVA_SUPPLEMENT=
  1382.         fi
  1383.     ])
  1384. fi
  1385.  
  1386.     dnl ========================================================
  1387.     dnl =
  1388.     dnl = GLE support
  1389.     dnl = 
  1390.     dnl = See http://www.SoftHome.net/pub/users/timj/gle/index.htm
  1391.     dnl = 
  1392.     dnl ========================================================
  1393.     MOZ_GLE=
  1394.     MOZ_GLE_LDFLAGS=
  1395.  
  1396.     AC_ARG_WITH(gle,
  1397.     [  --with-gle              GLE support (for debugging gtk widgets) ],
  1398.     [
  1399.         if test "$withval" = "yes"
  1400.         then
  1401.             MOZ_GLE=1
  1402.             MOZ_GLE_LDFLAGS=-lgle
  1403.             AC_DEFINE(MOZ_GLE)
  1404.         else
  1405.             MOZ_GLE=
  1406.             MOZ_GLE_LDFLAGS=
  1407.         fi
  1408.     ])
  1409.  
  1410.     AC_ARG_WITH(static-gtk,
  1411.     [  --with-static-gtk       Link GTK statically if possible],
  1412.     sysstaticgtk=$withval)
  1413.  
  1414.     if test "$sysstaticgtk" != "yes"
  1415.     then
  1416.         MOZ_GTK_LDFLAGS=$GTK_LIBS
  1417.  
  1418.         if test "$MOZ_GLE"
  1419.         then
  1420.             MOZ_GTK_LDFLAGS=`echo $MOZ_GTK_LDFLAGS | sed -e 's/-lgtk/-lgle -lgtk/'`
  1421.         fi
  1422.     else
  1423.        changequote(,)
  1424.  
  1425.        GTK_LIBS_LOC=`echo $GTK_LIBS | sed 's/\(.*\)\(-lgtk.*\)/\1/'`
  1426.  
  1427.        GTK_STATIC_LOC=`echo $GTK_LIBS | sed 's/^ *-L\([^ ]*\) .*$/\1/'`
  1428.        GTK_STATIC=`echo $GTK_LIBS | sed 's/^.*-l\(gtk[^ ]*\) .*/\1/'`
  1429.        GDK_STATIC=`echo $GTK_LIBS | sed 's/^.*-l\(gdk[^ ]*\) .*/\1/'`
  1430.  
  1431.        GLIB_STATIC_LOC=`echo $GTK_LIBS | sed -e 's/^.*-lgdk[^ ]* *-L\([^ ]*\).*$/\1/' -e 's/^.* -lgdk[^ ]* .*$//'`
  1432.        if test ! "$GLIB_STATIC_LOC" ; then
  1433.          GLIB_STATIC_LOC=$GTK_STATIC_LOC
  1434.        fi
  1435.        GMODULE_STATIC=`echo $GTK_LIBS | sed 's/^.*-l\(gmodule[^ ]*\) .*/\1/'`
  1436.        GLIB_STATIC=`echo $GTK_LIBS | sed 's/^.*-l\(glib[^ ]*\) .*/\1/'`
  1437.  
  1438.        GTK_OTHER_LIBS=`echo $GTK_LIBS | sed 's/^.*-lglib *\(.*\)/\1/'`
  1439.  
  1440.        changequote([,])
  1441.  
  1442.        MOZ_GTK_LDFLAGS="$GTK_STATIC_LOC/lib${GTK_STATIC}.a"
  1443.        MOZ_GTK_LDFLAGS="$MOZ_GTK_LDFLAGS $GTK_STATIC_LOC/lib${GDK_STATIC}.a"
  1444.        MOZ_GTK_LDFLAGS="$MOZ_GTK_LDFLAGS $GLIB_STATIC_LOC/lib${GMODULE_STATIC}.a"
  1445.        MOZ_GTK_LDFLAGS="$MOZ_GTK_LDFLAGS $GLIB_STATIC_LOC/lib${GLIB_STATIC}.a"
  1446.        MOZ_GTK_LDFLAGS="$MOZ_GTK_LDFLAGS $GTK_LIBS_LOC $GTK_OTHER_LIBS"
  1447.     fi
  1448.  
  1449.     MOZ_GTK_CFLAGS=$GTK_CFLAGS
  1450.  
  1451. fi
  1452. dnl ========================================================
  1453. dnl =                                                      =
  1454. dnl = End Gtk support hackery                              =
  1455. dnl =                                                      =
  1456. dnl =   --disable-mozilla-gtk is down below because        =
  1457. dnl =   order matters to the Build Configurator.           =
  1458. dnl =                                                      =
  1459. dnl ========================================================
  1460.  
  1461. dnl ========================================================
  1462. dnl =                                                       =
  1463. dnl = --with-xprint                                           =
  1464. dnl =                                                        =
  1465. dnl = Xprint support hackery                               =
  1466. dnl =                                                        =
  1467. dnl ========================================================
  1468. if test "$no_x" != "yes"
  1469. then
  1470.     AC_ARG_WITH(xprint,
  1471.     [  --with-xprint           Enable Xprint support ],
  1472.     [
  1473.         if test "$withval" = "yes"
  1474.         then
  1475.             MOZ_ENABLE_XPRINT=1
  1476.         else
  1477.             MOZ_ENABLE_XPRINT=
  1478.         fi
  1479.     ])
  1480. fi
  1481.  
  1482. MISSING_XPRINT=
  1483. if test "$MOZ_ENABLE_XPRINT"
  1484. then
  1485.     AC_MSG_CHECKING(for xprint insanity)
  1486.  
  1487.     _SAVE_LDFLAGS="$LDFLAGS"
  1488.     LDFLAGS="$XLDFLAGS $LDFLAGS"
  1489.     AC_CHECK_LIB(Xp, XpGetPrinterList, [XPRINT_LIBS="-lXp"],
  1490.         [MISSING_XPRINT="$MISSING_XPRINT -lXp"], $XEXT_LIBS $XLIBS)
  1491.  
  1492.     LDFLAGS="$_SAVE_LDFLAGS"
  1493.  
  1494.     MOZ_XPRINT_CFLAGS="$X_CFLAGS"
  1495.     MOZ_XPRINT_LDFLAGS="$XLDFLAGS $XPRINT_LIBS"
  1496.     MOZ_XPRINT_LDFLAGS="$MOZ_XPRINT_LDFLAGS $XEXT_LIBS $X11_LIBS"
  1497.  
  1498. fi
  1499. dnl ========================================================
  1500. dnl =                                                        =
  1501. dnl = End Xprint support hackery                           =
  1502. dnl =                                                        =
  1503. dnl ========================================================
  1504.  
  1505. dnl ========================================================
  1506. dnl =                                                       =
  1507. dnl = --with-motif                                           =
  1508. dnl =                                                        =
  1509. dnl = Motif support hackery                                =
  1510. dnl =                                                        =
  1511. dnl ========================================================
  1512. if test "$no_x" != "yes"
  1513. then
  1514.     AC_ARG_WITH(motif,
  1515.     [  --with-motif            Enable Motif support ],
  1516.     [
  1517.         if test "$withval" = "yes"
  1518.         then
  1519.             MOZ_ENABLE_MOTIF=1
  1520.         else
  1521.             MOZ_ENABLE_MOTIF=
  1522.         fi
  1523.     ])
  1524. fi
  1525.  
  1526. if test "$MOZ_ENABLE_MOTIF"
  1527. then
  1528.     AC_MSG_CHECKING(for motif insanity)
  1529.  
  1530.     if test "$x_includes"
  1531.     then
  1532.         MOTIF_XINCS="-xif -I$x_includes"
  1533.     fi
  1534.  
  1535.     detect_motif="${srcdir}/config/mkdetect/detect_motif.sh -cc $CC $MOTIF_XINCS"
  1536.     MOTIF_VERSION=`${detect_motif}`
  1537.     MOTIF_INCLUDES=`${detect_motif} -if`
  1538.     MOTIF_STATIC_FLAGS=`${detect_motif} -sf`
  1539.     MOTIF_DYNAMIC_FLAGS=`${detect_motif} -df`
  1540.     MOTIF_DYNAMIC_PATHS=`${detect_motif} -dp`
  1541. dnl    MOTIF_REQUIRES_XPM=`${detect_motif} -xpm`
  1542.     MOTIF_REQUIRES_XPM="False"
  1543.  
  1544.     ${srcdir}/config/mkdetect/detect_motif.sh --cleanup
  1545.  
  1546.     if test "$MOTIF_REQUIRES_XPM" = "True" -o "$MOTIF_VERSION" = "2.1"
  1547.     then
  1548.         _SAVE_LDFLAGS="$LDFLAGS"
  1549.         LDFLAGS="$XLDFLAGS $LDFLAGS"
  1550.     fi
  1551.  
  1552.     if test "$MOTIF_REQUIRES_XPM" = "True"
  1553.     then
  1554.         AC_CHECK_LIB(Xpm, XpmWriteFileFromImage, 
  1555.         XPM_LIBS="-lXpm", 
  1556.         [MISSING_MOTIF="$MISSING_MOTIF -lXpm"], $XLIBS)
  1557.     fi
  1558.  
  1559.     if test "$MOTIF_VERSION" = "2.1"
  1560.     then
  1561.         AC_CHECK_LIB(Xp, XpGetPrinterList, 
  1562.         MOTIF_XP_LIBS="-lXp",
  1563.         [MISSING_MOTIF="$MISSING_MOTIF -lXp"], $XEXT_LIBS $XLIBS)
  1564.     fi
  1565.  
  1566.     LDFLAGS="$_SAVE_LDFLAGS"
  1567.  
  1568.     MOZ_MOTIF_LDFLAGS="$XLDFLAGS $MOZ_MOTIF_LDFLAGS"
  1569.  
  1570.     if test "$MOTIF_STATIC_LIB" = "unknown" -a "$MOTIF_DYNAMIC_LIB" = "unknown"
  1571.     then
  1572.         AC_MSG_RESULT(no)
  1573.     else
  1574.         AC_MSG_RESULT(yes)
  1575.     fi
  1576.  
  1577.     # Get rid of offending error values
  1578.     if test "$MOTIF_DYNAMIC_PATHS" = "unknown"
  1579.     then 
  1580.         MOTIF_DYNAMIC_PATHS=
  1581.     fi
  1582.  
  1583.     if test "$MOTIF_DYNAMIC_FLAGS" = "unknown"
  1584.     then 
  1585.         MOTIF_DYNAMIC_FLAGS=
  1586.     fi
  1587.  
  1588.     if test "$MOTIF_STATIC_FLAGS" = "unknown"
  1589.     then 
  1590.         MOTIF_STATIC_FLAGS=
  1591.     fi
  1592.  
  1593.     if test "$MOTIF_INCLUDE_DIR" = "unknown"
  1594.     then
  1595.         MOTIF_INCLUDE_DIR=
  1596.     fi
  1597.  
  1598.     MOZ_MOTIF_LDFLAGS="$MOTIF_XP_LIBS $MOZ_MOTIF_LDFLAGS $X_LIBS $XT_LIBS $XMU_LIBS $XPM_LIBS $XEXT_LIBS $X11_LIBS $XSM_LIBS $XICE_LIBS"
  1599.  
  1600.     AC_ARG_WITH(static-motif,
  1601.     [  --with-static-motif     Link Motif statically if possible],
  1602.     sysstaticmotif=$withval)
  1603.  
  1604.     if test "$sysstaticmotif" != "yes"; then
  1605.     _SAVE_LDFLAGS="$LDFLAGS"
  1606.         LDFLAGS="$MOTIF_DYNAMIC_PATHS $XLDFLAGS $LDFLAGS"
  1607.         AC_CHECK_LIB(Xm, XmStringCreate, 
  1608.         MOZ_MOTIF_LDFLAGS="$MOTIF_DYNAMIC_PATHS $MOTIF_DYNAMIC_FLAGS $MOZ_MOTIF_LDFLAGS",
  1609.         [MISSING_MOTIF="$MISSING_MOTIF $MOTIF_DYNAMIC_FLAGS"], 
  1610.         $MOTIF_DYNAMIC_PATHS $MOZ_MOTIF_LDFLAGS $XLIBS)
  1611.     LDFLAGS="$_SAVE_LDFLAGS"
  1612.     else
  1613.         AC_CHECK_LIB(Xm, XmStringCreate, 
  1614.         MOZ_MOTIF_LDFLAGS="$MOTIF_STATIC_FLAGS $MOZ_MOTIF_LDFLAGS",
  1615.         [MISSING_MOTIF="$MISSING_MOTIF $MOTIF_STATIC_FLAGS"], 
  1616.         $MOZ_MOTIF_LDFLAGS $XLIBS)
  1617.     fi
  1618.  
  1619.     MOZ_MOTIF_CFLAGS="$MOTIF_INCLUDES"
  1620. fi
  1621. dnl ========================================================
  1622. dnl =                                                        =
  1623. dnl = End Motif support hackery                            =
  1624. dnl =                                                        =
  1625. dnl ========================================================
  1626.  
  1627.  
  1628. dnl ========================================================
  1629. dnl =                                                       =
  1630. dnl = --with-xlib                                           =
  1631. dnl =                                                        =
  1632. dnl = Xlib support hackery                                 =
  1633. dnl =                                                        =
  1634. dnl ========================================================
  1635. if test "$no_x" != "yes"
  1636. then
  1637.     AC_ARG_WITH(xlib,
  1638.     [  --with-xlib             Enable xlib support ],
  1639.     [
  1640.         if test "$withval" = "yes"
  1641.         then
  1642.             MOZ_ENABLE_XLIB=1
  1643.         else
  1644.             MOZ_ENABLE_XLIB=
  1645.         fi
  1646.     ])
  1647. fi
  1648.  
  1649. if test "$MOZ_ENABLE_XLIB"
  1650. then
  1651.     AC_MSG_CHECKING(for xlib insanity)
  1652.     AC_MSG_RESULT(yes)
  1653.  
  1654.     MOZ_XLIB_CFLAGS="$X_CFLAGS"
  1655.     MOZ_XLIB_LDFLAGS="$XLDFLAGS"
  1656.     MOZ_XLIB_LDFLAGS="$MOZ_XLIB_LDFLAGS $XEXT_LIBS $X11_LIBS"
  1657. fi
  1658. dnl ========================================================
  1659. dnl =                                                        =
  1660. dnl = End Xlib support hackery                             =
  1661. dnl =                                                        =
  1662. dnl ========================================================
  1663.  
  1664.  
  1665. dnl ========================================================
  1666. dnl =                                                       =
  1667. dnl = --with-qt                                             =
  1668. dnl =                                                        =
  1669. dnl = Qt support hackery                                   =
  1670. dnl =                                                        =
  1671. dnl ========================================================
  1672. if test "$no_x" != "yes"
  1673. then
  1674.     AC_ARG_WITH(qt,
  1675.     [  --with-qt               Enable Qt support ],
  1676.     [
  1677.         if test "$withval" = "yes"
  1678.         then
  1679.             MOZ_ENABLE_QT=1
  1680.         else
  1681.             MOZ_ENABLE_QT=
  1682.         fi
  1683.     ])
  1684. fi
  1685.  
  1686. if test "$MOZ_ENABLE_QT"
  1687. then
  1688.     AC_ARG_WITH(qtdir,
  1689.     [  --with-qtdir=\$dir       Specify Qt directory ],
  1690.     [ QTDIR=$withval],
  1691.     [ QTDIR="/usr"])
  1692.  
  1693.     QT_CFLAGS="-I${QTDIR}/include -DQT_GENUINE_STR"
  1694.     QT_LIBS="-L/usr/X11R6/lib -L${QTDIR}/lib -lqt -lXext -lX11"
  1695. dnl    AM_PATH_QT($QT_VERSION,,
  1696. dnl      AC_MSG_ERROR(Test for QT failed.))
  1697.  
  1698.     AC_ARG_WITH(static-qt,
  1699.     [  --with-static-qt        Link qt statically if possible],
  1700.     sysstaticqt=$withval)
  1701.  
  1702.     if test "$sysstaticqt" != "yes"; then
  1703.        MOZ_QT_LDFLAGS=$QT_LIBS
  1704.     else
  1705.        changequote(,)
  1706.  
  1707.        QT_LIBS_LOC=`echo $QT_LIBS | sed 's/\(.*\)\(-lqt.*\)/\1/'`
  1708.  
  1709.        QT_STATIC_LOC=`echo $QT_LIBS | sed 's/^ *-L\([^ ]*\) .*$/\1/'`
  1710.        QT_STATIC=`echo $QT_LIBS | sed 's/^.*-l\(qt[^ ]*\) .*/\1/'`
  1711.  
  1712.        changequote([,])
  1713.  
  1714.        MOZ_QT_LDFLAGS="$QT_STATIC_LOC/lib${QT_STATIC}.a"
  1715.        MOZ_QT_LDFLAGS="$MOZ_QT_LDFLAGS $QT_STATIC_LOC/lib${QT_STATIC}.a"
  1716.        MOZ_QT_LDFLAGS="$MOZ_QT_LDFLAGS $QT_LIBS_LOC"
  1717.     fi
  1718.  
  1719.     MOZ_QT_CFLAGS=$QT_CFLAGS
  1720.  
  1721.     AC_LANG_CPLUSPLUS
  1722.  
  1723.     _SAVE_CXXFLAGS=$CXXFLAGS
  1724.     _SAVE_LIBS=$LIBS
  1725.  
  1726.     CXXFLAGS="$CXXFLAGS $QT_CFLAGS"
  1727.     LIBS="$LIBS $QT_LIBS"
  1728.     
  1729.     AC_MSG_CHECKING(Qt - version >= $QT_VERSION)
  1730.     AC_TRY_COMPILE([#include <qglobal.h>],
  1731.     [
  1732.         #if (QT_VERSION < $QT_VERSION_NUM)
  1733.             #error  "QT_VERSION too old"
  1734.         #endif
  1735.     ],result="yes",result="no")
  1736.  
  1737.     AC_MSG_RESULT("$result")
  1738.     if test "$result" = "no"; then
  1739.        AC_MSG_ERROR([Qt Mozilla requires at least version $QT_VERSION of Qt])
  1740.     fi
  1741.     CXXFLAGS=$_SAVE_CXXFLAGS
  1742.     LIBS=$_SAVE_LIBS
  1743.  
  1744.     AC_LANG_C
  1745. fi
  1746. dnl ========================================================
  1747. dnl =                                                        =
  1748. dnl = End Qt support hackery                               =
  1749. dnl =                                                        =
  1750. dnl ========================================================
  1751.  
  1752.  
  1753.  
  1754. dnl ========================================================
  1755. dnl =                                                        =
  1756. dnl = Define TK_LIBS and TK_CFLAGS for apps that need to   =
  1757. dnl = link in the toolkit (like viewer)                    =
  1758. dnl =                                                        =
  1759. dnl ========================================================
  1760. if test "$MOZ_WIDGET_TOOLKIT" = "gtk"
  1761. then
  1762.     TK_CFLAGS="$MOZ_GTK_CFLAGS"
  1763.     TK_LIBS="$MOZ_GTK_LDFLAGS"
  1764. fi
  1765.  
  1766. if test "$MOZ_WIDGET_TOOLKIT" = "xlib"
  1767. then
  1768.     TK_CFLAGS="$MOZ_XLIB_CFLAGS"
  1769.     TK_LIBS="$MOZ_XLIB_LDFLAGS"
  1770. fi
  1771.  
  1772. if test "$MOZ_WIDGET_TOOLKIT" = "qt"
  1773. then
  1774.     TK_CFLAGS="$MOZ_QT_CFLAGS"
  1775.     TK_LIBS="$MOZ_QT_LDFLAGS"
  1776. fi
  1777.  
  1778. if test "$MOZ_WIDGET_TOOLKIT" = "motif"
  1779. then
  1780.     TK_CFLAGS="$MOZ_MOTIF_CFLAGS"
  1781.     TK_LIBS="$MOZ_MOTIF_LDFLAGS"
  1782. fi
  1783.  
  1784. dnl ========================================================
  1785. dnl =                                                        =
  1786. dnl = Make sure a default toolkit is set                   =
  1787. dnl =                                                        =
  1788. dnl ========================================================
  1789. AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
  1790.  
  1791. AC_SUBST(GTK_CONFIG)
  1792. AC_SUBST(TK_CFLAGS)
  1793. AC_SUBST(TK_LIBS)
  1794.  
  1795. AC_SUBST(MOZ_ENABLE_GTK)
  1796. AC_SUBST(MOZ_ENABLE_MOTIF)
  1797. AC_SUBST(MOZ_ENABLE_XLIB)
  1798. AC_SUBST(MOZ_ENABLE_GTK)
  1799. AC_SUBST(MOZ_ENABLE_MOTIF)
  1800. AC_SUBST(MOZ_ENABLE_XLIB)
  1801. AC_SUBST(MOZ_ENABLE_QT)
  1802. AC_SUBST(MOZ_ENABLE_PHOTON)
  1803. AC_SUBST(MOZ_ENABLE_XREMOTE)
  1804. AC_SUBST(MOZ_GTK_CFLAGS)
  1805. AC_SUBST(MOZ_GTK_LDFLAGS)
  1806. AC_SUBST(MOZ_MOTIF_CFLAGS)
  1807. AC_SUBST(MOZ_MOTIF_LDFLAGS)
  1808. AC_SUBST(MOZ_XLIB_CFLAGS)
  1809. AC_SUBST(MOZ_XLIB_LDFLAGS)
  1810. AC_SUBST(MOZ_XPRINT_CFLAGS)
  1811. AC_SUBST(MOZ_XPRINT_LDFLAGS)
  1812. AC_SUBST(MOZ_ENABLE_XPRINT)
  1813. AC_SUBST(MOZ_QT_CFLAGS)
  1814. AC_SUBST(MOZ_QT_LDFLAGS)
  1815. AC_SUBST(MOZ_DEFAULT_TOOLKIT)
  1816.  
  1817. AC_SUBST(HAVE_GDK_PIXBUF)
  1818. AC_SUBST(MOZ_GDK_PIXBUF_CFLAGS)
  1819. AC_SUBST(MOZ_GDK_PIXBUF_LIBS)
  1820. AC_SUBST(HAVE_XIE)
  1821. AC_SUBST(MOZ_XIE_LIBS)
  1822.  
  1823. AC_SUBST(MOZ_XINERAMA_LIBS)
  1824. AC_SUBST(MOZ_ENABLE_XINERAMA)
  1825.  
  1826. XCFLAGS="$X_CFLAGS"
  1827.  
  1828. AC_SUBST(XCFLAGS)
  1829. AC_SUBST(XLDFLAGS)
  1830. AC_SUBST(XLIBS)
  1831.  
  1832. if test "$MOZ_ENABLE_GTK" || test "$MOZ_ENABLE_QT" \
  1833. || test "$MOZ_ENABLE_XLIB" || test "$MOZ_ENABLE_MOTIF"
  1834. then
  1835. AC_DEFINE(MOZ_X11)
  1836. fi
  1837.  
  1838. dnl Check for GLib and libIDL.
  1839. dnl ========================================================
  1840. SKIP_IDL_CHECK="no"
  1841.  
  1842. dnl = Allow users to disable libIDL checking for standalone modules
  1843. AC_ARG_WITH(libIDL,
  1844. [  --without-libIDL        Skip check for libIDL],
  1845. [  if test "$withval" = "no"; then
  1846.     SKIP_IDL_CHECK="yes"
  1847.    fi ])
  1848.  
  1849. dnl
  1850. dnl Only do silly ORBit fallback check if not cross-compiling
  1851. dnl
  1852. if test -z "$CROSS_COMPILE"; then
  1853.  
  1854. AC_PATH_PROGS(LIBIDL_CONFIG, $LIBIDL_CONFIG libIDL-config)
  1855.  
  1856. dnl We don't have a libIDL config program.  Look for orbit-config instead
  1857. if test -z "$LIBIDL_CONFIG"; then
  1858.     AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
  1859.     if test -n "$ORBIT_CONFIG"; then
  1860.         SKIP_IDL_CHECK="yes"
  1861.     _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
  1862.     _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
  1863.         _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
  1864.         _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
  1865.         LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
  1866.         LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
  1867.     fi
  1868. fi
  1869. fi
  1870.  
  1871. if test "$SKIP_IDL_CHECK" = "no"
  1872. then
  1873. AM_PATH_LIBIDL($LIBIDL_VERSION,,
  1874.   [echo libIDL $LIBIDL_VERSION or higher is required.]
  1875.   [echo See http://andrewtv.org/libIDL/ for more information.]
  1876.   [AC_MSG_ERROR(libIDL not installed.)])
  1877. fi
  1878.  
  1879. if test -n "$CROSS_COMPILE"; then
  1880.     if test -z "$HOST_LIBIDL_CONFIG"; then
  1881.         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
  1882.     fi
  1883.     if test -n "$HOST_LIBIDL_CONFIG"; then
  1884.         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
  1885.         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
  1886.     else
  1887.         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
  1888.         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
  1889.     fi
  1890.     if test "$OS_TARGET" = "POSIX_for_OpenVMS_AXP"; then
  1891.       LIBIDL_CFLAGS=`${LIBIDL_CONFIG}-VMS --cflags`
  1892.       LIBIDL_LIBS=`${LIBIDL_CONFIG}-VMS --libs`
  1893.     fi
  1894. fi
  1895.  
  1896. if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
  1897.     AM_PATH_GLIB(${GLIB_VERSION})
  1898. fi
  1899.  
  1900. AC_SUBST(LIBIDL_CFLAGS)
  1901. AC_SUBST(LIBIDL_LIBS)
  1902. AC_SUBST(GLIB_CFLAGS)
  1903. AC_SUBST(GLIB_LIBS)
  1904.  
  1905. dnl Checks for typedefs, structures, and compiler characteristics.
  1906. dnl ========================================================
  1907. AC_C_CONST
  1908. AC_TYPE_MODE_T
  1909. AC_TYPE_OFF_T
  1910. AC_TYPE_PID_T
  1911. AC_TYPE_SIZE_T
  1912. AC_TYPE_UID_T
  1913. AC_STRUCT_ST_BLKSIZE
  1914.  
  1915. dnl Visual Age for os/2 also defines size_t and off_t in certain 
  1916. dnl  header files.  These defines make Visual Age use the mozilla
  1917. dnl  defines types.
  1918. case "$target" in
  1919.     *-*-os2_vacpp)
  1920.         AC_DEFINE(__size_t)
  1921.         AC_DEFINE(__off_t)
  1922.         ;;
  1923. esac
  1924.  
  1925. dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
  1926. dnl ========================================================
  1927. AC_MSG_CHECKING(for int16_t)
  1928. AC_CACHE_VAL(ac_cv_int16_t,
  1929.  [AC_TRY_COMPILE([#include <stdio.h>
  1930.                   #include <sys/types.h>],
  1931.                  [int16_t foo = 0;],
  1932.                  [ac_cv_int16_t=true],
  1933.                  [ac_cv_int16_t=false])])
  1934. if test "$ac_cv_int16_t" = true ; then
  1935.   AC_DEFINE(HAVE_INT16_T)
  1936.   AC_MSG_RESULT(yes)
  1937. else
  1938.   AC_MSG_RESULT(no)
  1939. fi
  1940. AC_MSG_CHECKING(for int32_t)
  1941. AC_CACHE_VAL(ac_cv_int32_t,
  1942.  [AC_TRY_COMPILE([#include <stdio.h>
  1943.                   #include <sys/types.h>],
  1944.                  [int32_t foo = 0;],
  1945.                  [ac_cv_int32_t=true],
  1946.                  [ac_cv_int32_t=false])])
  1947. if test "$ac_cv_int32_t" = true ; then
  1948.   AC_DEFINE(HAVE_INT32_T)
  1949.   AC_MSG_RESULT(yes)
  1950. else
  1951.   AC_MSG_RESULT(no)
  1952. fi
  1953. AC_MSG_CHECKING(for int64_t)
  1954. AC_CACHE_VAL(ac_cv_int64_t,
  1955.  [AC_TRY_COMPILE([#include <stdio.h>
  1956.                   #include <sys/types.h>],
  1957.                  [int64_t foo = 0;],
  1958.                  [ac_cv_int64_t=true],
  1959.                  [ac_cv_int64_t=false])])
  1960. if test "$ac_cv_int64_t" = true ; then
  1961.   AC_DEFINE(HAVE_INT64_T)
  1962.   AC_MSG_RESULT(yes)
  1963. else
  1964.   AC_MSG_RESULT(no)
  1965. fi
  1966. AC_MSG_CHECKING(for int64)
  1967. AC_CACHE_VAL(ac_cv_int64,
  1968.  [AC_TRY_COMPILE([#include <stdio.h>
  1969.                   #include <sys/types.h>],
  1970.                  [int64 foo = 0;],
  1971.                  [ac_cv_int64=true],
  1972.                  [ac_cv_int64=false])])
  1973. if test "$ac_cv_int64" = true ; then
  1974.   AC_DEFINE(HAVE_INT64)
  1975.   AC_MSG_RESULT(yes)
  1976. else
  1977.   AC_MSG_RESULT(no)
  1978. fi
  1979. AC_MSG_CHECKING(for uint)
  1980. AC_CACHE_VAL(ac_cv_uint,
  1981.  [AC_TRY_COMPILE([#include <stdio.h>
  1982.                   #include <sys/types.h>],
  1983.                  [uint foo = 0;],
  1984.                  [ac_cv_uint=true],
  1985.                  [ac_cv_uint=false])])
  1986. if test "$ac_cv_uint" = true ; then
  1987.   AC_DEFINE(HAVE_UINT)
  1988.   AC_MSG_RESULT(yes)
  1989. else
  1990.   AC_MSG_RESULT(no)
  1991. fi
  1992. AC_MSG_CHECKING(for uint_t)
  1993. AC_CACHE_VAL(ac_cv_uint_t,
  1994.  [AC_TRY_COMPILE([#include <stdio.h>
  1995.                   #include <sys/types.h>],
  1996.                  [uint foo = 0;],
  1997.                  [ac_cv_uint_t=true],
  1998.                  [ac_cv_uint_t=false])])
  1999. if test "$ac_cv_uint_t" = true ; then
  2000.   AC_DEFINE(HAVE_UINT_T)
  2001.   AC_MSG_RESULT(yes)
  2002. else
  2003.   AC_MSG_RESULT(no)
  2004. fi
  2005. AC_MSG_CHECKING(for uint16_t)
  2006. AC_CACHE_VAL(ac_cv_uint16_t,
  2007.  [AC_TRY_COMPILE([#include <stdio.h>
  2008.                   #include <sys/types.h>],
  2009.                  [uint16_t foo = 0;],
  2010.                  [ac_cv_uint16_t=true],
  2011.                  [ac_cv_uint16_t=false])])
  2012. if test "$ac_cv_uint16_t" = true ; then
  2013.   AC_DEFINE(HAVE_UINT16_T)
  2014.   AC_MSG_RESULT(yes)
  2015. else
  2016.   AC_MSG_RESULT(no)
  2017. fi
  2018.  
  2019. dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
  2020. dnl are defined when compiling C++ but not C.  Since the result of this
  2021. dnl test is used only in C++, do it in C++.
  2022. AC_LANG_CPLUSPLUS
  2023.  
  2024. AC_MSG_CHECKING(for uname.domainname)
  2025. AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
  2026.     [AC_TRY_COMPILE([#include <sys/utsname.h>],
  2027.         [ struct utsname *res; char *domain; 
  2028.             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
  2029.         [ac_cv_have_uname_domainname_field=true],
  2030.         [ac_cv_have_uname_domainname_field=false])])
  2031.  
  2032. if test "$ac_cv_have_uname_domainname_field" = "true"; then
  2033.     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
  2034.     AC_MSG_RESULT(yes)
  2035. else
  2036.     AC_MSG_RESULT(no)
  2037. fi
  2038.  
  2039. AC_MSG_CHECKING(for uname.__domainname)
  2040. AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
  2041.     [AC_TRY_COMPILE([#include <sys/utsname.h>],
  2042.         [ struct utsname *res; char *domain; 
  2043.             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
  2044.         [ac_cv_have_uname_us_domainname_field=true],
  2045.         [ac_cv_have_uname_us_domainname_field=false])])
  2046.  
  2047. if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
  2048.     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
  2049.     AC_MSG_RESULT(yes)
  2050. else
  2051.     AC_MSG_RESULT(no)
  2052. fi
  2053.  
  2054. AC_LANG_C
  2055.  
  2056. AC_MSG_CHECKING(for 64-bit OS)
  2057. AC_TRY_RUN([ int main () {
  2058.     if (sizeof(long) == 8) { return 0; } return 1; } ],
  2059.         result="yes", result="no", result="maybe" )
  2060. AC_MSG_RESULT("$result")
  2061. if test "$result" = "yes"; then
  2062.     AC_DEFINE(HAVE_64BIT_OS)
  2063. fi
  2064.  
  2065. dnl Check for usable wchar_t (2 bytes, unsigned)
  2066. dnl (we really don't need the unsignedness check anymore)
  2067. dnl ========================================================
  2068.  
  2069. AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
  2070.     ac_cv_have_usable_wchar,
  2071.     [AC_TRY_RUN([#include <wchar.h>
  2072.                  int main () {
  2073.                    return (sizeof(wchar_t) != 2) ||
  2074.                           (wchar_t)-1 < (wchar_t) 0 ; } ],
  2075.                 ac_cv_have_usable_wchar="yes",
  2076.                 ac_cv_have_usable_wchar="no",
  2077.                 ac_cv_have_usable_wchar="maybe")])
  2078. if test "$ac_cv_have_usable_wchar" = "yes"; then
  2079.     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
  2080.     HAVE_CPP_2BYTE_WCHAR_T=1
  2081. else
  2082. dnl This is really gcc-only
  2083. dnl Do this test using CXX instead of CC since some versions of gcc
  2084. dnl 2.96-2.97 have a signed wchar_t in c++ only.
  2085.  
  2086.     _SAVE_CFLAGS=$CFLAGS
  2087.     _SAVE_CC=$CC
  2088.     CC=$CXX
  2089.     CFLAGS="$CFLAGS -fshort-wchar"
  2090.  
  2091.     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
  2092.         ac_cv_have_usable_wchar_option,
  2093.         [AC_TRY_RUN([#include <wchar.h>
  2094.                      int main () {
  2095.                        return (sizeof(wchar_t) != 2) ||
  2096.                               (wchar_t)-1 < (wchar_t) 0 ; } ],
  2097.                     ac_cv_have_usable_wchar_option="yes",
  2098.                     ac_cv_have_usable_wchar_option="no",
  2099.                     ac_cv_have_usable_wchar_option="maybe")])
  2100.  
  2101.     if test "$ac_cv_have_usable_wchar_option" = "yes"; then
  2102.         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
  2103.         HAVE_CPP_2BYTE_WCHAR_T=1
  2104. dnl Since this is gcc-only, CC and CXX should take the same arguments.
  2105.         CXXFLAGS="$CXXFLAGS -fshort-wchar"
  2106.     else    
  2107.         CFLAGS=$_SAVE_CFLAGS
  2108.     fi
  2109.     CC=$_SAVE_CC
  2110. fi
  2111.  
  2112. dnl Checks for header files.
  2113. dnl ========================================================
  2114. AC_HEADER_DIRENT
  2115. dnl -ldir is a noop for OS/2
  2116. case "$target_os" in
  2117. os2*)
  2118.     LIBS=
  2119.     ;;
  2120. esac
  2121. AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
  2122. AC_CHECK_HEADERS(sys/bittypes.h memory.h unistd.h sys/filio.h)
  2123. AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
  2124. AC_CHECK_HEADERS(X11/XKBlib.h)
  2125.  
  2126. dnl These are all the places some variant of statfs can be hiding.
  2127. AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
  2128.  
  2129. case $target in
  2130. *-aix4.3*)
  2131.     ;;
  2132. *)
  2133.     AC_CHECK_HEADERS(sys/cdefs.h)
  2134.     ;;
  2135. esac
  2136.  
  2137. dnl Checks for libraries.
  2138. dnl ========================================================
  2139. case $target in
  2140. *-hpux11.*)
  2141.     ;;
  2142. *)
  2143.     AC_CHECK_LIB(c_r, gethostbyname_r)
  2144.     ;;
  2145. esac
  2146. AC_CHECK_LIB(m, atan)
  2147. AC_CHECK_LIB(dl, dlopen)
  2148. if test ! "$GNU_CXX"; then
  2149.  
  2150.     case $target in
  2151.     *-solaris*)
  2152.     LIBS="-lCrun $LIBS"
  2153.     ;;
  2154.     *-aix*)
  2155.     AC_CHECK_LIB(C_r, demangle)
  2156.     ;;
  2157.      *)
  2158.     AC_CHECK_LIB(C, demangle)
  2159.     ;;
  2160.      esac
  2161. fi
  2162. dnl AC_CHECK_LIB(resolv, res_gethostbyaddr)
  2163. AC_CHECK_LIB(socket, socket)
  2164. dnl AC_CHECK_LIB(util, login)
  2165. dnl AC_CHECK_LIB(nsl, xdr_string)
  2166. dnl AC_CHECK_LIB(elf, elf_rawdata)
  2167. dnl AC_CHECK_LIB(intl, textdomain)
  2168. AC_CHECK_LIB(posix4, shm_open)
  2169. dnl AC_CHECK_LIB(w, iswupper)
  2170.  
  2171. dnl ========================================================
  2172. dnl =
  2173. dnl = pthread support
  2174. dnl = 
  2175. dnl ========================================================
  2176. dnl 
  2177. dnl Start by checking whether the system support pthreads
  2178. dnl 
  2179.  
  2180.  
  2181. MOZ_CHECK_PTHREADS(pthreads,
  2182.     USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
  2183.     MOZ_CHECK_PTHREADS(pthread,
  2184.         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
  2185.         MOZ_CHECK_PTHREADS(c_r,
  2186.             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
  2187.             MOZ_CHECK_PTHREADS(c,
  2188.                 USE_PTHREADS=1
  2189.             )
  2190.         )
  2191.     )
  2192. )
  2193.  
  2194. dnl
  2195. dnl Check the command line for --with-pthreads 
  2196. dnl
  2197. AC_ARG_WITH(pthreads,
  2198. [  --with-pthreads         Force use of system pthread library with NSPR ],
  2199.         [if test "$withval" = "yes"
  2200.          then
  2201.            if test "$USE_PTHREADS"x = x
  2202.            then
  2203.              AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
  2204.            fi
  2205.          else
  2206.            USE_PTHREADS=
  2207.            _PTHREAD_LDFLAGS=""
  2208.          fi] )
  2209.  
  2210. dnl
  2211. dnl Do the platform specific pthread hackery
  2212. dnl
  2213. if test "$USE_PTHREADS"x != x
  2214. then
  2215.     dnl
  2216.     dnl See if -pthread is supported.
  2217.     dnl
  2218.     rm -f conftest*
  2219.     ac_cv_have_dash_pthread=no
  2220.     AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
  2221.     echo 'int main() { return 0; }' | cat > conftest.c
  2222.     ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
  2223.     if test $? -eq 0; then
  2224.         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  2225.             ac_cv_have_dash_pthread=yes
  2226.             CFLAGS="$CFLAGS -pthread"
  2227.             CXXFLAGS="$CXXFLAGS -pthread"
  2228.         fi
  2229.     fi
  2230.     rm -f conftest*
  2231.     AC_MSG_RESULT($ac_cv_have_dash_pthread)
  2232.  
  2233.     dnl
  2234.     dnl See if -pthreads is supported.
  2235.     dnl
  2236.     ac_cv_have_dash_pthreads=no
  2237.     if test "$ac_cv_have_dash_pthread" = "no"; then
  2238.         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
  2239.         echo 'int main() { return 0; }' | cat > conftest.c
  2240.         ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
  2241.         if test $? -eq 0; then
  2242.             if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  2243.                 ac_cv_have_dash_pthreads=yes
  2244.                 CFLAGS="$CFLAGS -pthreads"
  2245.                 CXXFLAGS="$CXXFLAGS -pthreads"
  2246.             fi
  2247.         fi
  2248.         rm -f conftest*
  2249.         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
  2250.     fi
  2251.  
  2252.     case "$target" in
  2253.         *-*-freebsd*|*-*-openbsd*|*-*-bsdi*)
  2254.             AC_DEFINE(_REENTRANT)
  2255.             AC_DEFINE(_THREAD_SAFE)
  2256.             dnl -pthread links in -lc_r, so don't specify it explicitly.
  2257.             if test "$ac_cv_have_dash_pthread" = "yes"; then
  2258.                 _PTHREAD_LDFLAGS=""
  2259.             else
  2260.                 _PTHREAD_LDFLAGS="-lc_r"
  2261.             fi
  2262.             ;;
  2263.  
  2264.         *-*-linux*) 
  2265.             AC_DEFINE(_REENTRANT) 
  2266.             ;;
  2267.  
  2268.         *-*-nto*) 
  2269.             AC_DEFINE(_REENTRANT) 
  2270.             ;;
  2271.  
  2272.         *-aix4.3*)
  2273.             AC_DEFINE(_REENTRANT) 
  2274.             ;;
  2275.  
  2276.         *-hpux11.*)
  2277.             AC_DEFINE(_REENTRANT) 
  2278.             ;;
  2279.  
  2280.         *-*-os2*)
  2281.             USE_PTHREADS=
  2282.             _PTHREAD_LDFLAGS=
  2283.             ;;
  2284.  
  2285.         alpha*-*-osf*)
  2286.             AC_DEFINE(_REENTRANT)
  2287.             ;;
  2288.  
  2289.         *-*-solaris*) 
  2290.                 AC_DEFINE(_REENTRANT) 
  2291.             if test ! "$GNU_CC"; then
  2292.                 CFLAGS="$CFLAGS -mt" 
  2293.                 CXXFLAGS="$CXXFLAGS -mt" 
  2294.             fi
  2295.             ;;
  2296.     *-*-netbsd*)
  2297.         USE_PTHREADS=
  2298.         _PTHREAD_LDFLAGS=
  2299.     esac
  2300. fi
  2301.  
  2302. dnl
  2303. dnl Indicate that platform requires special thread safe 
  2304. dnl locking when starting up the OJI JVM 
  2305. dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
  2306. dnl ========================================================
  2307.  
  2308.    case "$target" in
  2309.     *-hpux*)      
  2310.         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
  2311.         ;;
  2312.     *)
  2313.         ;;
  2314.    esac
  2315.  
  2316.  
  2317. dnl See if mmap sees writes
  2318. dnl ========================================================
  2319. dnl For cross compiling, just define it as no, which is a safe default
  2320. AC_MSG_CHECKING(whether mmap() sees write()s)
  2321.  
  2322. changequote(,)
  2323. mmap_test_prog='
  2324.     #include <stdlib.h>
  2325.     #include <unistd.h>
  2326.     #include <sys/mman.h>
  2327.     #include <sys/types.h>
  2328.     #include <sys/stat.h>
  2329.     #include <fcntl.h>
  2330.  
  2331.     char fname[] = "conftest.file";
  2332.     char zbuff[1024]; /* Fractional page is probably worst case */
  2333.  
  2334.     int main() {
  2335.     char *map;
  2336.     int fd;
  2337.     int i;
  2338.     unlink(fname);
  2339.     fd = open(fname, O_RDWR | O_CREAT, 0660);
  2340.     if(fd<0) return 1;
  2341.     unlink(fname);
  2342.     write(fd, zbuff, sizeof(zbuff));
  2343.     lseek(fd, 0, SEEK_SET);
  2344.     map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
  2345.     if(map==(char*)-1) return 2;
  2346.     for(i=0; fname[i]; i++) {
  2347.         int rc = write(fd, &fname[i], 1);
  2348.         if(map[i]!=fname[i]) return 4;
  2349.     }
  2350.     return 0;
  2351.     }
  2352. '
  2353. changequote([,])
  2354.  
  2355. AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
  2356.  
  2357. AC_MSG_RESULT("$result")
  2358.  
  2359. if test "$result" = "no"; then
  2360.     AC_DEFINE(MMAP_MISSES_WRITES)
  2361. fi
  2362.  
  2363.  
  2364. dnl Checks for library functions.
  2365. dnl ========================================================
  2366. AC_PROG_GCC_TRADITIONAL
  2367. AC_FUNC_MEMCMP
  2368. AC_CHECK_FUNCS(random qsort strerror lchown fchmod snprintf localtime_r statvfs memmove usleep rint)
  2369. AC_CHECK_FUNCS(nl_langinfo)
  2370.  
  2371. AC_LANG_CPLUSPLUS
  2372. AC_CACHE_CHECK(
  2373.     [for gnu_get_libc_version()],
  2374.     ac_cv_func_gnu_get_libc_version,
  2375.     [AC_TRY_LINK([
  2376.         #ifdef HAVE_GNU_LIBC_VERSION_H
  2377.         #include <gnu/libc-version.h>
  2378.         #endif
  2379.         ],
  2380.         [const char *glibc_version = gnu_get_libc_version();],
  2381.         [ac_cv_func_gnu_get_libc_version=yes],
  2382.         [ac_cv_func_gnu_get_libc_version=no] 
  2383.         )]
  2384.     )
  2385.  
  2386. if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
  2387.     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
  2388. fi
  2389. AC_LANG_C
  2390.  
  2391. AC_MSG_CHECKING(how to call gettimeofday)
  2392. AC_CACHE_VAL(ac_cv_gettimeofday_args,
  2393.  [AC_TRY_COMPILE([#include <stdlib.h>
  2394.                   #include <sys/time.h>],
  2395.                  [struct timeval tv; struct timezone tzp;
  2396.                   gettimeofday(&tv, &tzp);],
  2397.                  [ac_cv_gettimeofday_args=2],
  2398.                  [AC_TRY_COMPILE([#include <stdlib.h>
  2399.                                   #include <sys/time.h>],
  2400.                                  [struct timeval tv; gettimeofday(&tv);],
  2401.                                  [ac_cv_gettimeofday_args=1],
  2402.                                  [ac_cv_gettimeofday_args=0])])])
  2403. if test "$ac_cv_gettimeofday_args" = 1 ; then
  2404.   AC_DEFINE(HAVE_GETTIMEOFDAY)
  2405.   AC_MSG_RESULT(one argument)
  2406. elif test "$ac_cv_gettimeofday_args" = 2 ; then
  2407.   AC_DEFINE(HAVE_GETTIMEOFDAY)
  2408.   AC_DEFINE(GETTIMEOFDAY_TWO_ARGS)
  2409.   AC_MSG_RESULT(two arguments)
  2410. else
  2411.   AC_MSG_RESULT(unknown)
  2412. fi
  2413.  
  2414. dnl Figure out how to 'allocate' paged memory areas (see xpcom/ds/nsPageMgr.cpp)
  2415. dnl First see if /dev/zero is supported so that we
  2416. dnl can mmap against it.  If not (hpux) then see if
  2417. dnl if valloc is supported (which is hpux's malloc
  2418. dnl on paged memory boundary
  2419. dnl ========================================================
  2420.  
  2421. AC_MSG_CHECKING(for /dev/zero)
  2422. if test "$HAVE_DEV_ZERO"; then
  2423.   AC_DEFINE(HAVE_DEV_ZERO)
  2424.   AC_MSG_RESULT(yes)
  2425. else
  2426. if test -r /dev/zero && test -z "$CROSS_COMPILE"; then
  2427.   AC_DEFINE(HAVE_DEV_ZERO)
  2428.   AC_MSG_RESULT(yes)
  2429. else
  2430.         AC_MSG_RESULT(no)
  2431.         AC_MSG_CHECKING(for valloc)
  2432.         AC_CACHE_VAL(ac_cv_valloc,
  2433.                      [AC_TRY_COMPILE([#include <stdlib.h>],
  2434.                                      [void *ptr = valloc(1);],
  2435.                                      [ac_cv_valloc=true],
  2436.                                      [ac_cv_valloc=false])])
  2437.  
  2438.     if test "$ac_cv_valloc" = true ; then
  2439.       AC_DEFINE(HAVE_VALLOC)
  2440.       AC_MSG_RESULT(yes)
  2441.     else
  2442.       AC_MSG_RESULT(no)
  2443.     fi
  2444. fi
  2445. fi
  2446.  
  2447. dnl Does this platform require array notation to assign to a va_list?
  2448. dnl If cross-compiling, we assume va_list is "normal".  If this breaks
  2449. dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
  2450. dnl also just to be sure.
  2451. AC_MSG_CHECKING(whether va_list assignments need array notation)
  2452. AC_CACHE_VAL(ac_cv_valistisarray,
  2453.     [AC_TRY_RUN([#include <stdlib.h>
  2454.              #include <stdarg.h>
  2455.              void foo(int i, ...) {
  2456.             va_list ap1, ap2;
  2457.             va_start(ap1, i);
  2458.             ap2 = ap1;
  2459.             if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123) { exit(1); }
  2460.             va_end(ap1); va_end(ap2);
  2461.              }
  2462.              int main() { foo(0, 123); return(0); }],
  2463.             [ac_cv_valistisarray=false],
  2464.             [ac_cv_valistisarray=true],
  2465.             [ac_cv_valistisarray=false])])
  2466.  
  2467. if test "$ac_cv_valistisarray" = true ; then
  2468.     AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
  2469.     AC_MSG_RESULT(yes)
  2470. else
  2471.     AC_MSG_RESULT(no)
  2472. fi
  2473.  
  2474. dnl Check for dll-challenged libc's.
  2475. dnl This check is apparently only needed for Linux.
  2476. case "$target" in
  2477.     *-linux*)
  2478.         dnl ===================================================================
  2479.         curdir=`pwd`
  2480.         rm -f conftest* /tmp/conftest*
  2481.         cat >> conftest.C <<\EOF
  2482. #include <stdio.h>
  2483. #include <link.h>
  2484. #include <dlfcn.h>
  2485. #ifdef _dl_loaded
  2486. void __dump_link_map(void) {
  2487.   struct link_map *map = _dl_loaded;
  2488.   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
  2489. }
  2490. int main() {
  2491.   dlopen("./conftest1.so",RTLD_LAZY);
  2492.   dlopen("./../tmp/conftest1.so",RTLD_LAZY);
  2493.   dlopen("/tmp/conftest1.so",RTLD_LAZY);
  2494.   dlopen("/tmp/../tmp/conftest1.so",RTLD_LAZY);
  2495.   __dump_link_map();
  2496. }
  2497. #else
  2498. /* _dl_loaded isn't defined, so this should be either a libc5 (glibc1) system, or a glibc2 system that doesn't have the multiple load bug (i.e., RH6.0).*/
  2499. int main() { printf("./conftest1.so\n"); }
  2500. #endif
  2501. EOF
  2502.  
  2503.         cat >> conftest1.C <<\EOF
  2504. #include <stdio.h>
  2505. void foo(void) {printf("foo in dll called\n");}
  2506. EOF
  2507.  
  2508.         ${CXX-g++} -fPIC -c -g conftest1.C
  2509.         ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
  2510.         ${CXX-g++} -g conftest.C -o conftest -ldl
  2511.         cp -f conftest1.so conftest /tmp
  2512.         cd /tmp
  2513.         if test `./conftest | grep conftest1.so | wc -l` -gt 1
  2514.         then
  2515.         echo
  2516.         echo "*** Your libc has a bug that can result in loading the same dynamic"
  2517.         echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
  2518.         echo "*** or later.  However, if you choose not to upgrade, the only effect"
  2519.         echo "*** will be excessive memory usage at runtime."
  2520.         echo
  2521.         fi
  2522.         cd ${curdir}
  2523.         rm -f conftest* /tmp/conftest*
  2524.         dnl ===================================================================
  2525.         ;;
  2526. esac
  2527.  
  2528. dnl Checks for specific (libc) global variables
  2529. AC_MSG_CHECKING(for sys_errlist/sys_nerr)
  2530. AC_CACHE_VAL(ac_cv_syserrlist,
  2531.  [AC_TRY_COMPILE([#include <stdio.h>
  2532.                   #include <errno.h>],
  2533.                  [char *foo = sys_errlist[sys_nerr-1];],
  2534.                  [ac_cv_syserrlist=true],
  2535.                  [ac_cv_syserrlist=false])])
  2536. if test "$ac_cv_syserrlist" = true ; then
  2537.   AC_DEFINE(HAVE_SYSERRLIST)
  2538.   AC_MSG_RESULT(yes)
  2539. else
  2540.   AC_MSG_RESULT(no)
  2541. fi  
  2542.  
  2543. dnl By default, turn rtti and exceptions off on g++/egcs
  2544. dnl ========================================================
  2545. if test "$GNU_CXX"; then
  2546.  
  2547.   _MOZ_RTTI_FLAGS=${_COMPILER_PREFIX}-fno-rtti
  2548.  
  2549.   AC_MSG_CHECKING(for C++ exceptions flag)
  2550.  
  2551.   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
  2552.   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
  2553.   [echo "int main() { return 0; }" | cat > conftest.C
  2554.  
  2555.   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
  2556.  
  2557.   if egrep "warning.*renamed" conftest.out >/dev/null; then
  2558.     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
  2559.   else
  2560.     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
  2561.   fi
  2562.  
  2563.   rm -f conftest*])
  2564.  
  2565.   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
  2566.   _MOZ_EXCEPTIONS_FLAGS=$ac_cv_cxx_exceptions_flags
  2567. fi
  2568.  
  2569. dnl Put your C++ language/feature checks below
  2570. AC_LANG_CPLUSPLUS
  2571.  
  2572. AC_MSG_CHECKING(for ios::binary)
  2573. AC_CACHE_VAL(ac_cv_ios_binary,
  2574.  [AC_TRY_COMPILE([#include <iostream.h>]
  2575.              [#include <fstream.h>],
  2576.                  [char *buffer = "config.log";
  2577.           fstream *mFileStream=new fstream(buffer, ios::binary);],
  2578.                  [ac_cv_ios_binary=true],
  2579.                  [ac_cv_ios_binary=false])])
  2580. if test "$ac_cv_ios_binary" = true ; then
  2581.   AC_DEFINE(HAVE_IOS_BINARY)
  2582.   AC_MSG_RESULT(yes)
  2583. else
  2584.   AC_MSG_RESULT(no)
  2585. fi  
  2586.  
  2587.  
  2588. AC_MSG_CHECKING(for ios::bin)
  2589. AC_CACHE_VAL(ac_cv_ios_bin,
  2590.  [AC_TRY_COMPILE([#include <iostream.h>]
  2591.                [#include <fstream.h>],
  2592.                  [char *buffer = "config.log";
  2593.                 fstream *mFileStream=new fstream(buffer, ios::bin);],
  2594.                  [ac_cv_ios_bin=true],
  2595.                  [ac_cv_ios_bin=false])])
  2596. if test "$ac_cv_ios_bin" = true ; then
  2597.   AC_DEFINE(HAVE_IOS_BIN)
  2598.   AC_MSG_RESULT(yes)
  2599. else
  2600.   AC_MSG_RESULT(no)
  2601. fi  
  2602.  
  2603. AC_MSG_CHECKING(for ostreams)
  2604. AC_CACHE_VAL(ac_cv_ostream,
  2605.   [AC_TRY_LINK([#include <iostream.h>],
  2606.                [streambuf *xxx; ostream *foo=new ostream(xxx);],
  2607.                [ac_cv_ostream=true],
  2608.                [ac_cv_ostream=false])])
  2609. if test "$ac_cv_ostream" = true ; then
  2610.   AC_DEFINE(HAVE_OSTREAM)
  2611.   AC_MSG_RESULT(yes)
  2612. else
  2613.   AC_MSG_RESULT(no)
  2614.   _SAVE_LIBS=$LIBS
  2615.   LIBS="$LIBS -lstdc++"
  2616.   if test "$target_os" = "os2_emx"; then
  2617.     LIBS='-lemxio -lsocket -lstdcpp'
  2618.   fi
  2619.   AC_MSG_CHECKING(for ostreams in -lstdc++)
  2620.   AC_CACHE_VAL(ac_cv_lib_stdcpp_ostream,
  2621.     [AC_TRY_LINK([#include <iostream.h>],
  2622.                 [ostream *foo=new ostream();],
  2623.                 [ac_cv_lib_stdcpp_ostream=true],
  2624.                 [ac_cv_lib_stdcpp_ostream=false])])
  2625.   if test "$ac_cv_lib_stdcpp_ostream" = true ; then
  2626.     AC_DEFINE(HAVE_OSTREAM)
  2627.     AC_MSG_RESULT(yes)
  2628.   else
  2629.     AC_MSG_RESULT(no)
  2630.     LIBS=$_SAVE_LIBS
  2631.   fi
  2632. fi
  2633.  
  2634. AC_CACHE_CHECK(for C++ \"bool\" keyword,
  2635.                ac_cv_cpp_bool,
  2636.                [AC_TRY_COMPILE(bool b;,
  2637.                                b = true;,
  2638.                                ac_cv_cpp_bool=yes,
  2639.                                ac_cv_cpp_bool=no)])
  2640. if test "$ac_cv_cpp_bool" = no ; then
  2641.    AC_DEFINE(NEEDS_bool)
  2642. fi
  2643.  
  2644.  
  2645. AC_CACHE_CHECK(for C++ \"explicit\" keyword,
  2646.                ac_cv_cpp_explicit,
  2647.                [AC_TRY_COMPILE(class X {
  2648.                                public: explicit X(int i) : i_(i) {}
  2649.                                private: int i_;
  2650.                                };,
  2651.                                X x(3);,
  2652.                                ac_cv_cpp_explicit=yes,
  2653.                                ac_cv_cpp_explicit=no)])
  2654. if test "$ac_cv_cpp_explicit" = yes ; then
  2655.    AC_DEFINE(HAVE_CPP_EXPLICIT)
  2656. fi
  2657.  
  2658. dnl Check for template specialization
  2659. dnl Test code and requirement from scc@netscape.com.
  2660. dnl Autoconf cut-and-paste job by shaver@mozilla.org.
  2661. AC_CACHE_CHECK(for C++ template specialization support,
  2662.                ac_cv_cpp_template_specialization,
  2663.                [AC_TRY_COMPILE(template <class T> struct X { int a; };
  2664.                                class Y {};
  2665.                                struct X<Y> { double a; };,
  2666.                                X<int> int_x;
  2667.                                X<Y> y_x;,
  2668.                                ac_cv_cpp_template_specialization=yes,
  2669.                                ac_cv_cpp_template_specialization=no)])
  2670. dnl The above test works fine for Sun's WorkShop 4.2 compiler, but
  2671. dnl dies horribly trying to build mozilla with HAVE_CPP_SPECIALIZATION
  2672. dnl defined.  So, even though the output above will say yes, we force
  2673. dnl it to reconsider....  (5.0 works fine, though.)
  2674. dnl Info and testing provided by tor@cs.brown.edu.
  2675. case "$target" in
  2676.   *-*-solaris*)
  2677.     if test ! "$GNU_CC"; then
  2678.        if test ! -z "`${CC} -V 2>&1 | head -1 | grep '4.2'`"; then
  2679.              ac_cv_cpp_template_specialization=no
  2680.        fi
  2681.     fi
  2682.     ;;
  2683. esac
  2684. if test "$ac_cv_cpp_template_specialization" = yes ; then
  2685.   AC_DEFINE(HAVE_CPP_SPECIALIZATION)
  2686. fi
  2687.  
  2688. dnl Check for support of modern template specialization syntax
  2689. dnl Test code and requirement from scc@netscape.com.
  2690. dnl Autoconf cut-and-paste job by waterson@netscape.com
  2691. AC_CACHE_CHECK(for modern C++ template specialization syntax support,
  2692.                ac_cv_cpp_modern_specialize_template_syntax,
  2693.                [AC_TRY_COMPILE(template <class T> struct X { int a; };
  2694.                                class Y {};
  2695.                                template <> struct X<Y> { double a; };,
  2696.                                X<int> int_x;
  2697.                                X<Y> y_x;,
  2698.                                ac_cv_cpp_modern_specialize_template_syntax=yes,
  2699.                                ac_cv_cpp_modern_specialize_template_syntax=no)])
  2700. if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
  2701.   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
  2702. fi
  2703.  
  2704.  
  2705. dnl Some compilers support only full specialization, and some don't.
  2706. AC_CACHE_CHECK(whether partial template specialization works,
  2707.                ac_cv_cpp_partial_specialization,
  2708.                [AC_TRY_COMPILE(template <class T> class Foo {};
  2709.                                template <class T> class Foo<T*> {};,
  2710.                                return 0;,
  2711.                                ac_cv_cpp_partial_specialization=yes,
  2712.                                ac_cv_cpp_partial_specialization=no)])
  2713. if test "$ac_cv_cpp_partial_specialization" = yes ; then
  2714.   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
  2715. fi
  2716.  
  2717.  
  2718. dnl Some compilers have limited support for operators with templates;
  2719. dnl specifically, it is necessary to define derived operators when a base
  2720. dnl class's operator declaration should suffice.
  2721. AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
  2722.                ac_cv_need_derived_template_operators,
  2723.                [AC_TRY_COMPILE([template <class T> class Base { };
  2724.                                 template <class T>
  2725.                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
  2726.                                 template <class T> class Derived : public Base<T> { };],
  2727.                                [Derived<char> a, b;
  2728.                                 Base<char> c = a + b;
  2729.                                 return 0;],
  2730.                                ac_cv_need_derived_template_operators=no,
  2731.                                ac_cv_need_derived_template_operators=yes)])
  2732. if test "$ac_cv_need_derived_template_operators" = yes ; then
  2733.   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
  2734. fi
  2735.  
  2736.  
  2737. dnl Some compilers have trouble detecting that a template class
  2738. dnl that derives from another template is actually an instance
  2739. dnl of the base class. This test checks for that.
  2740. AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
  2741.                ac_cv_need_cpp_template_cast_to_base,
  2742.                [AC_TRY_COMPILE([template <class T> class Base { };
  2743.                                 template <class T> class Derived : public Base<T> { };
  2744.                                 template <class T> int foo(const Base<T>&) { return 0; }],
  2745.                                [Derived<char> bar; return foo(bar);],
  2746.                                ac_cv_need_cpp_template_cast_to_base=no,
  2747.                                ac_cv_need_cpp_template_cast_to_base=yes)])
  2748. if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
  2749.   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
  2750. fi
  2751.  
  2752. dnl Some compilers have trouble resolving the ambiguity between two
  2753. dnl functions whose arguments differ only by cv-qualifications.
  2754. AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
  2755.                ac_cv_can_resolve_const_ambiguity,
  2756.                [AC_TRY_COMPILE([
  2757.                                 template <class T> class ptrClass {
  2758.                                   public: T* ptr;
  2759.                                 };
  2760.  
  2761.                                 template <class T> T* a(ptrClass<T> *arg) {
  2762.                                   return arg->ptr;
  2763.                                 }
  2764.  
  2765.                                 template <class T>
  2766.                                 const T* a(const ptrClass<T> *arg) {
  2767.                                   return arg->ptr;
  2768.                                 }
  2769.                                ],
  2770.                                [ ptrClass<int> i;
  2771.                                  a(&i); ],
  2772.                                ac_cv_can_resolve_const_ambiguity=yes,
  2773.                                ac_cv_can_resolve_const_ambiguity=no)])
  2774. if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
  2775.   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
  2776. fi
  2777.  
  2778. dnl
  2779. dnl We dont do exceptions on unix.  The only reason this used to be here
  2780. dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
  2781. dnl exceptions.  But, we turn exceptions off by default and this test breaks.
  2782. dnl So im commenting this out until someone writes some artificial 
  2783. dnl intelligence to detect not only if the compiler has exceptions, but if 
  2784. dnl they are enabled as well.
  2785. dnl 
  2786. dnl AC_CACHE_CHECK(for C++ \"exceptions\",
  2787. dnl                ac_cv_cpp_exceptions,
  2788. dnl                [AC_TRY_COMPILE(class X { public: X() {} };
  2789. dnl                                static void F() { throw X(); },
  2790. dnl                                try { F(); } catch(X & e) { },
  2791. dnl                                ac_cv_cpp_exceptions=yes,
  2792. dnl                                ac_cv_cpp_exceptions=no)])
  2793. dnl if test $ac_cv_cpp_exceptions = yes ; then
  2794. dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
  2795. dnl fi
  2796.  
  2797. dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
  2798. dnl supports it well enough to allow us to use it to change access, but not
  2799. dnl to resolve ambiguity. The next two tests determine how well the |using|
  2800. dnl keyword is supported.
  2801. dnl
  2802. dnl Check to see if we can change access with |using|.
  2803. AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
  2804.                ac_cv_cpp_access_changing_using,
  2805.                [AC_TRY_COMPILE(class X { public: int go(const X&) {return 3;} };
  2806.                                class Y : public X {
  2807.                                  public:  int go(int) {return 2;}
  2808.                                  private: using X::go;
  2809.                                };,
  2810.                                X x; Y y;,
  2811.                                ac_cv_cpp_access_changing_using=yes,
  2812.                                ac_cv_cpp_access_changing_using=no)])
  2813. if test "$ac_cv_cpp_access_changing_using" = yes ; then
  2814.    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
  2815. fi
  2816.  
  2817. dnl Check to see if we can resolve ambiguity with |using|.
  2818. AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
  2819.                ac_cv_cpp_ambiguity_resolving_using,
  2820.                [AC_TRY_COMPILE(class X { 
  2821.                                  public: int go(const X&) {return 3;}
  2822.                                          int jo(const X&) {return 3;}
  2823.                                };
  2824.                                class Y : public X {
  2825.                                  public:  int go(int) {return 2;}
  2826.                                           int jo(int) {return 2;}
  2827.                                           using X::jo;
  2828.                                  private: using X::go;
  2829.                                };,
  2830.                                X x; Y y; y.jo(x);,
  2831.                                ac_cv_cpp_ambiguity_resolving_using=yes,
  2832.                                ac_cv_cpp_ambiguity_resolving_using=no)])
  2833. if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
  2834.    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
  2835. fi
  2836.  
  2837. dnl Check to see if the |std| namespace is supported. If so, we'll want
  2838. dnl to qualify any standard library calls with "std::" to ensure that
  2839. dnl those functions can be resolved.
  2840. AC_CACHE_CHECK(for \"std::\" namespace,
  2841.                ac_cv_cpp_namespace_std,
  2842.                [AC_TRY_COMPILE([#include <algorithm>],
  2843.                                [return std::min(0, 1);],
  2844.                                ac_cv_cpp_namespace_std=yes,
  2845.                                ac_cv_cpp_namespace_std=no)])
  2846. if test "$ac_cv_cpp_namespace_std" = yes ; then
  2847.    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
  2848. fi
  2849.  
  2850. dnl Older compilers are overly ambitious with respect to using the standard
  2851. dnl template library's |operator!=()| when |operator==()| is defined. In
  2852. dnl which case, defining |operator!=()| in addition to |operator==()| causes
  2853. dnl ambiguity at compile-time. This test checks for that case.
  2854. AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
  2855.                ac_cv_cpp_unambiguous_std_notequal,
  2856.                [AC_TRY_COMPILE([#include <algorithm>
  2857.                                 struct T1 {};
  2858.                                 int operator==(const T1&, const T1&) { return 0; }
  2859.                                 int operator!=(const T1&, const T1&) { return 0; }],
  2860.                                [T1 a,b; return a != b;],
  2861.                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
  2862.                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
  2863. if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
  2864.   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
  2865. fi
  2866.  
  2867.  
  2868. AC_CACHE_CHECK(for C++ reinterpret_cast,
  2869.                ac_cv_cpp_reinterpret_cast,
  2870.                [AC_TRY_COMPILE(struct X { int i; };
  2871.                                struct Y { int i; };,
  2872.                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
  2873.                                ac_cv_cpp_reinterpret_cast=yes,
  2874.                                ac_cv_cpp_reinterpret_cast=no)])
  2875. if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
  2876.    AC_DEFINE(HAVE_CPP_NEW_CASTS)
  2877. fi
  2878.  
  2879. dnl See if a dynamic_cast to void* gives the most derived object.
  2880. AC_CACHE_CHECK(for C++ dynamic_cast to void*,
  2881.                ac_cv_cpp_dynamic_cast_void_ptr,
  2882.                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
  2883.                             class Y { int j; public: virtual ~Y() { } };
  2884.                             class Z : public X, public Y { int k; };
  2885.  
  2886.                             int main() {
  2887.                                  Z mdo;
  2888.                                  X *subx = (X*)&mdo;
  2889.                                  Y *suby = (Y*)&mdo;
  2890.                                  return !((((void*)&mdo != (void*)subx) &&
  2891.                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
  2892.                                           (((void*)&mdo != (void*)suby) &&
  2893.                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
  2894.                             }],
  2895.                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
  2896.                            ac_cv_cpp_dynamic_cast_void_ptr=no,
  2897.                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
  2898. if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
  2899.    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
  2900. fi
  2901.  
  2902.  
  2903. dnl note that this one is reversed - if the test fails, then
  2904. dnl we require implementations of unused virtual methods. Which
  2905. dnl really blows because it means we'll have useless vtable
  2906. dnl bloat.
  2907. AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
  2908.                ac_cv_cpp_unused_required,
  2909.                [AC_TRY_LINK(class X {private: virtual void never_called();};,
  2910.                                X x;,
  2911.                                ac_cv_cpp_unused_required=no,
  2912.                                ac_cv_cpp_unused_required=yes)])
  2913. if test "$ac_cv_cpp_unused_required" = yes ; then
  2914.    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
  2915. fi
  2916.  
  2917.  
  2918. dnl Some compilers have trouble comparing a constant reference to a templatized
  2919. dnl class to zero, and require an explicit operator==() to be defined that takes
  2920. dnl an int. This test separates the strong from the weak.
  2921.  
  2922. AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
  2923.                ac_cv_trouble_comparing_to_zero,
  2924.                [AC_TRY_COMPILE([#include <algorithm>
  2925.                                 template <class T> class Foo {};
  2926.                                 class T2;
  2927.                                 template <class T> int operator==(const T2*, const T&) { return 0; }
  2928.                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
  2929.                                [Foo<int> f; return (0 != f);],
  2930.                                ac_cv_trouble_comparing_to_zero=no,
  2931.                                ac_cv_trouble_comparing_to_zero=yes)])
  2932. if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
  2933.   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
  2934. fi
  2935.  
  2936.  
  2937.  
  2938. dnl End of C++ language/feature checks
  2939. AC_LANG_C
  2940.  
  2941. dnl ========================================================
  2942. dnl =
  2943. dnl =  Internationalization checks
  2944. dnl =
  2945. dnl ========================================================
  2946. dnl
  2947. dnl Internationalization and Locale support is different
  2948. dnl on various UNIX platforms.  Checks for specific i18n
  2949. dnl features go here.
  2950.  
  2951. dnl check for LC_MESSAGES
  2952. AC_CACHE_CHECK(for LC_MESSAGES,
  2953.         ac_cv_i18n_lc_messages,
  2954.         [AC_TRY_COMPILE([#include <locale.h>],
  2955.                 [int category = LC_MESSAGES;],
  2956.                 ac_cv_i18n_lc_messages=yes,
  2957.                 ac_cv_i18n_lc_messages=no)])
  2958. if test "$ac_cv_i18n_lc_messages" = yes; then
  2959.    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
  2960. fi     
  2961.  
  2962.  
  2963. dnl Mozilla specific options
  2964. dnl ========================================================
  2965. dnl The macros used for command line options
  2966. dnl are defined in build/autoconf/altoptions.m4.
  2967.  
  2968. dnl ========================================================
  2969. dnl =
  2970. dnl = Components and Features
  2971. dnl = 
  2972. dnl ========================================================
  2973. MOZ_ARG_HEADER(Components and Features)
  2974.  
  2975. MOZ_ARG_DISABLE_BOOL(async-dns,
  2976. [  --disable-async-dns     Disable separate dns thread],
  2977.   NO_UNIX_ASYNC_DNS=1)
  2978.  
  2979. MOZ_ARG_DISABLE_BOOL(logging,
  2980. [  --disable-logging       Disable logging facilities],
  2981.   NS_DISABLE_LOGGING=1)
  2982. if test "$NS_DISABLE_LOGGING"; then
  2983.     AC_DEFINE(NS_DISABLE_LOGGING)
  2984. else
  2985.     AC_DEFINE(MOZ_LOGGING)
  2986. fi
  2987.  
  2988. dnl build mozilla/xpfe by default
  2989. MOZ_BUILD_XPFE=1
  2990. MOZ_ARG_DISABLE_BOOL(build-xpfe,
  2991. [  --disable-build-xpfe    Disable building of mozilla/xpfe (BROKEN)],
  2992.   MOZ_BUILD_XPFE= )
  2993.  
  2994. dnl build Mail & News by default
  2995. MOZ_MAIL_NEWS=1
  2996. MOZ_ARG_DISABLE_BOOL(mailnews,
  2997. [  --disable-mailnews      Disable building of mail & news components],
  2998.   MOZ_MAIL_NEWS= )
  2999. if test "$MOZ_MAIL_NEWS"; then
  3000.   AC_DEFINE(MOZ_MAIL_NEWS)
  3001. fi
  3002. AC_SUBST(MOZ_MAIL_NEWS)
  3003.  
  3004. dnl Turn on editor logging by default
  3005. MOZ_EDITOR_API_LOG=1
  3006. MOZ_ARG_DISABLE_BOOL(editor-api-log,
  3007. [  --disable-editor-api-log
  3008.                           Disable editor logging],
  3009.   MOZ_EDITOR_API_LOG= )
  3010. if test "$MOZ_EDITOR_API_LOG"; then
  3011.   AC_DEFINE(MOZ_EDITOR_API_LOG)
  3012. fi
  3013. AC_SUBST(MOZ_EDITOR_API_LOG)
  3014.  
  3015. dnl Turn on the new lightweight gfx text control frames
  3016. MOZ_ENDER_LITE=1
  3017. MOZ_ARG_DISABLE_BOOL(ender-lite,
  3018. [  --disable-ender-lite    Disable new lightweight text control frames],
  3019.   MOZ_ENDER_LITE= )
  3020. if test "$MOZ_ENDER_LITE"; then
  3021.   AC_DEFINE(MOZ_ENDER_LITE)
  3022. fi
  3023. AC_SUBST(MOZ_ENDER_LITE)
  3024.  
  3025. dnl Turn on malloc tracing
  3026. NS_TRACE_MALLOC=
  3027. MOZ_ARG_ENABLE_BOOL(trace-malloc,
  3028. [  --enable-trace-malloc   Enable malloc tracing],
  3029.   NS_TRACE_MALLOC=1 )
  3030. if test "$NS_TRACE_MALLOC"; then
  3031.   AC_DEFINE(NS_TRACE_MALLOC)
  3032. fi
  3033. AC_SUBST(NS_TRACE_MALLOC)
  3034.  
  3035. dnl Turn on reflow counting
  3036. MOZ_REFLOW_PERF=
  3037. MOZ_ARG_ENABLE_BOOL(reflow-perf,
  3038. [  --enable-reflow-perf    Enable reflow performance tracing],
  3039.   MOZ_REFLOW_PERF=1 )
  3040. if test "$MOZ_REFLOW_PERF"; then
  3041.   AC_DEFINE(MOZ_REFLOW_PERF)
  3042. fi
  3043. AC_SUBST(MOZ_REFLOW_PERF)
  3044.  
  3045. dnl make sure that we compile in multi-processor support
  3046. NS_MT_SUPPORTED=1
  3047. AC_DEFINE(NS_MT_SUPPORTED)
  3048.  
  3049. dnl build the tests by default
  3050. ENABLE_TESTS=1
  3051. MOZ_ARG_DISABLE_BOOL(tests,
  3052. [  --disable-tests         Do not build tests libraries & programs],
  3053.   ENABLE_TESTS= )
  3054.  
  3055. dnl bi-directional support on by default
  3056. IBMBIDI=1
  3057. MOZ_ARG_DISABLE_BOOL(bidi,
  3058. [  --disable-bidi           Disable bi-directional support],
  3059.   IBMBIDI= )
  3060. if test "$IBMBIDI"; then
  3061.   AC_DEFINE(IBMBIDI)
  3062. fi
  3063.  
  3064. dnl ========================================================
  3065. dnl =
  3066. dnl = --enable-monolithic-toolkit
  3067. dnl =
  3068. dnl = We dont need to link in the toolkit statically into the
  3069. dnl = app.  With the exception of some test programs (most
  3070. dnl = notably the gecko viewer) mozilla does not have any
  3071. dnl = toolkit specific code in the "app"
  3072. dnl =
  3073. dnl = The only places where toolkit specific code is needed
  3074. dnl = are:
  3075. dnl =
  3076. dnl = mozilla/widget
  3077. dnl = mozilla/widget/timer
  3078. dnl = mozilla/gfx
  3079. dnl =
  3080. dnl = These components themselves link with the toolkit.  At
  3081. dnl = runtime, Mozilla will dlopen() these components and 
  3082. dnl = use the code in them without having to link with them.
  3083. dnl =
  3084. dnl = This all happens through XPCOM.
  3085. dnl =
  3086. dnl = Doing this makes it possible to have one single set of
  3087. dnl = binaries for mozilla which can effectively use a 
  3088. dnl = different widget toolkit at runtime.
  3089. dnl =
  3090. dnl = However, on some unik platforms, the linker (ld) and the
  3091. dnl = runtime loader (ld.so) might not be smart enough to 
  3092. dnl = resolve toolkit dependencies linked into components
  3093. dnl = which are later dlopen()ed by mozilla.
  3094. dnl =
  3095. dnl = For this reason, the --enable-monolithic-toolkit flag
  3096. dnl = is provided.  If set, it will cause the toolkit libs
  3097. dnl = to be linked in to mozilla itself, and not the 
  3098. dnl = 3 components above (widget, gfx and timer).
  3099. dnl =
  3100. dnl = In the case statement following this comment, I have
  3101. dnl = forced the toolkit to be monolithic for all platforms
  3102. dnl = that are not Linux and Solaris, as these are the only
  3103. dnl = ones that I could test.
  3104. dnl =
  3105. dnl = If you have questions, comments, or problems getting
  3106. dnl = this to work on your platform, send me email:
  3107. dnl = 
  3108. dnl = ramiro@fateware.com
  3109. dnl =
  3110. dnl ========================================================
  3111.  
  3112. dnl Assume life sucks
  3113. MOZ_MONOLITHIC_TOOLKIT=1
  3114.  
  3115. dnl The following are the only platforms I tested  -ramiro
  3116. dnl OpenVMS added by Colin Blake
  3117. dnl Tru64   added by Jim Nance
  3118. dnl hpux added by John Gaunt workaround for bug 39747
  3119. dnl irix added for bug 53471
  3120. dnl nto added by Jerry Kirk 
  3121. case "$target" in
  3122.     *-*-linux*)   MOZ_MONOLITHIC_TOOLKIT= ;;
  3123.     *-*-solaris*) MOZ_MONOLITHIC_TOOLKIT= ;;
  3124.     *-openvms*)   MOZ_MONOLITHIC_TOOLKIT= ;;
  3125.     *-bsdi*)      MOZ_MONOLITHIC_TOOLKIT= ;;
  3126.     *-freebsd*)   MOZ_MONOLITHIC_TOOLKIT= ;;
  3127.     *-netbsd*)    MOZ_MONOLITHIC_TOOLKIT= ;;
  3128.     *-openbsd*)   MOZ_MONOLITHIC_TOOLKIT= ;;
  3129.     *-*-aix*)     MOZ_MONOLITHIC_TOOLKIT= ;;
  3130.     *-*-osf*)     MOZ_MONOLITHIC_TOOLKIT= ;;
  3131.     *-hpux*)      MOZ_MONOLITHIC_TOOLKIT= ;;
  3132.     *-irix*)      MOZ_MONOLITHIC_TOOLKIT= ;;
  3133.     *-nto*)       MOZ_MONOLITHIC_TOOLKIT= ;;
  3134. esac
  3135.  
  3136.  
  3137. MOZ_ARG_ENABLE_BOOL(monolithic-toolkit,
  3138. [  --enable-monolithic-toolkit
  3139.                           Link the toolkit into the app],
  3140.   MOZ_MONOLITHIC_TOOLKIT=1)
  3141.  
  3142.  
  3143. if test "$MOZ_MONOLITHIC_TOOLKIT"
  3144. then
  3145.   AC_DEFINE(MOZ_MONOLITHIC_TOOLKIT)
  3146. fi
  3147. dnl ========================================================
  3148. dnl =
  3149. dnl = End MOZ_MONOLITHIC_TOOLKIT hacks
  3150. dnl =
  3151. dnl ========================================================
  3152.  
  3153. dnl ========================================================
  3154. dnl =
  3155. dnl = --enable-modules=mod1,mod2
  3156. dnl =
  3157. dnl = Only selectively build modules
  3158. dnl =
  3159. dnl ========================================================
  3160. BUILD_MODULES=all
  3161. MOZ_ARG_ENABLE_STRING(modules,
  3162. [  --enable-modules        Enable standalone build of specific modules],
  3163.   [ BUILD_MODULES=`echo $enableval | sed 's/,/ /g'` ] )
  3164. dnl ========================================================
  3165.  
  3166.  
  3167. dnl ========================================================
  3168. dnl =
  3169. dnl = --diable-pic-dso-cflags
  3170. dnl =
  3171. dnl = A hack to disable the generation of PIC for shared libs
  3172. dnl =
  3173. dnl ========================================================
  3174. ENABLE_PIC_DSO_CFLAGS=1
  3175.  
  3176. MOZ_ARG_DISABLE_BOOL(pic-dso-cflags,
  3177. [  --disable-pic-dso-cflags
  3178.                           Do not generate PIC for shared libs],
  3179.   ENABLE_PIC_DSO_CFLAGS= )
  3180.  
  3181. if test ! "$ENABLE_PIC_DSO_CFLAGS"
  3182. then
  3183.   DSO_PIC_CFLAGS=""
  3184. fi
  3185.  
  3186. dnl ========================================================
  3187. dnl =
  3188. dnl = Compiler Options
  3189. dnl = 
  3190. dnl ========================================================
  3191. MOZ_ARG_HEADER(Compiler Options)
  3192.  
  3193. MOZ_ARG_ENABLE_BOOL(crash-on-assert,
  3194. [  --enable-crash-on-assert
  3195.                           Make NS_ASSERTION crash on Unix],
  3196.   AC_DEFINE(UNIX_CRASH_ON_ASSERT))
  3197.  
  3198. dnl ========================================================
  3199. dnl =
  3200. dnl = --enable-lea
  3201. dnl = 
  3202. dnl = Enable Lea malloc in xpcom. OFF by default.
  3203. dnl = 
  3204. dnl ========================================================
  3205.  
  3206. MOZ_ARG_ENABLE_BOOL(lea,
  3207. [  --enable-lea            Enable Lea malloc ],
  3208.   [ XPCOM_USE_LEA=1
  3209.     AC_DEFINE(XPCOM_USE_LEA)] )
  3210.  
  3211.  
  3212. dnl ========================================================
  3213. dnl =
  3214. dnl = --enable-optimize
  3215. dnl = 
  3216. dnl = Enable code optimization. OFF by default.
  3217. dnl = 
  3218. dnl ========================================================
  3219. MOZ_OPTIMIZE=
  3220.  
  3221. if test ! "$MOZ_OPTIMIZE_FLAGS"
  3222. then
  3223.     MOZ_OPTIMIZE_FLAGS="-O"
  3224. fi
  3225.  
  3226. MOZ_ARG_ENABLE_STRING(optimize,
  3227. [  --enable-optimize(=val) Enable compiler optimizations (val, ie. -O2) ],
  3228.     [ if test "$enableval" != "no"; then
  3229.     MOZ_OPTIMIZE=1
  3230.     if test -n "$enableval" && test "$enableval" != "yes"; then
  3231.         MOZ_OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
  3232.     fi 
  3233.     fi ])
  3234.  
  3235. if test "$MOZ_OPTIMIZE"
  3236. then
  3237.   CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
  3238.   CXXFLAGS="$CXXFLAGS $MOZ_OPTIMIZE_FLAGS"
  3239. fi
  3240.  
  3241. dnl ========================================================
  3242. dnl =
  3243. dnl = --disable-debug
  3244. dnl = 
  3245. dnl = Disable building with debug info.
  3246. dnl = 
  3247. dnl = Debugging is ON by default so that we get more useful
  3248. dnl = bug reports.
  3249. dnl = 
  3250. dnl ========================================================
  3251. MOZ_DEBUG=1
  3252.  
  3253. if test ! "$MOZ_DEBUG_FLAGS"
  3254. then
  3255.     case "$target" in
  3256.     *-*-os2_vacpp)
  3257.         MOZ_DEBUG_FLAGS="/Ti+"
  3258.         ;;
  3259.     *-irix*)
  3260.         if test "$GNU_CC"; then
  3261.             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
  3262.             case "$GCC_VERSION" in
  3263.             2.95.*)
  3264.                 MOZ_DEBUG_FLAGS=""
  3265.                 ;;
  3266.             *)
  3267.                 MOZ_DEBUG_FLAGS="-g"
  3268.                 ;;
  3269.             esac
  3270.         else
  3271.             MOZ_DEBUG_FLAGS="-g"
  3272.         fi
  3273.         ;;
  3274.     *)
  3275.         MOZ_DEBUG_FLAGS="-g"
  3276.         ;;
  3277.     esac
  3278. fi
  3279.  
  3280. MOZ_ARG_DISABLE_BOOL(debug,
  3281. [  --disable-debug         Disable building with debug info],
  3282.   MOZ_DEBUG=)
  3283.  
  3284. MOZ_DEBUG_ENABLE_DEFS="-DDEBUG"
  3285.  case "${target_os}" in
  3286.     beos*)
  3287.       MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
  3288.         ;;
  3289.     *) 
  3290.       MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
  3291.         ;;
  3292.   esac
  3293. MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
  3294.  
  3295. MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
  3296.  
  3297. dnl ========================================================
  3298. dnl =
  3299. dnl = --enable-strip-libs
  3300. dnl = 
  3301. dnl = Enable stripping of .so and .a libs
  3302. dnl = 
  3303. dnl ========================================================
  3304. if test -z "$MOZ_POST_DSO_LIB_COMMAND"; then
  3305.   MOZ_POST_DSO_LIB_COMMAND=true
  3306. fi
  3307. if test -z "$MOZ_POST_PROGRAM_COMMAND"; then
  3308.   MOZ_POST_PROGRAM_COMMAND=true
  3309. fi
  3310.  
  3311. case "$target" in
  3312. *-*-os2*)
  3313.     MOZ_POST_DSO_LIB_COMMAND='@echo'
  3314.     MOZ_POST_PROGRAM_COMMAND='@echo'
  3315.     ;;
  3316. esac
  3317.  
  3318. MOZ_ARG_ENABLE_BOOL(strip-libs,
  3319. [  --enable-strip-libs     Enable stripping of .so and .a libs ],
  3320.   [ MOZ_POST_DSO_LIB_COMMAND='$(STRIP)'
  3321.     MOZ_POST_PROGRAM_COMMAND='$(STRIP)' ])
  3322.  
  3323. dnl ========================================================
  3324. dnl =
  3325. dnl = MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
  3326. dnl = 
  3327. dnl = Flags to strip unused symbols from .so components
  3328. dnl = 
  3329. dnl = On on Linux non debug builds by default
  3330. dnl = 
  3331. dnl ========================================================
  3332. MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
  3333.  
  3334. if test ! "$MOZ_DEBUG"
  3335. then
  3336.     case "$host" in
  3337.         *-linux*)
  3338.             MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  3339.         ;;
  3340.         *-nto*) 
  3341.             MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  3342.         ;;
  3343.     esac
  3344. fi
  3345. dnl ========================================================
  3346.  
  3347. dnl ========================================================
  3348. dnl =
  3349. dnl = --enable-elf-dynstr-gc
  3350. dnl = 
  3351. dnl ========================================================
  3352. MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
  3353. [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
  3354.     USE_ELF_DYNSTR_GC=1,
  3355.     USE_ELF_DYNSTR_GC= )
  3356.  
  3357. AC_SUBST(USE_ELF_DYNSTR_GC)
  3358.  
  3359. dnl ========================================================
  3360. dnl =
  3361. dnl = --with-debug-modules=module1,^module2,etc
  3362. dnl = 
  3363. dnl = Enable/disable debug for specific modules only
  3364. dnl =   module names beginning with ^ will be disabled (this is because you can't
  3365. dnl =   pass args to --without-debug-modules)
  3366. dnl = 
  3367. dnl ========================================================
  3368. MOZ_ARG_WITH_STRING(default-mozilla-five-home,
  3369. [  --with-default-mozilla-five-home
  3370.                           Set the default value for MOZILLA_FIVE_HOME],
  3371.   [ val=`echo $withval`
  3372.     AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val")
  3373.     ])
  3374. dnl ========================================================
  3375.  
  3376. dnl ========================================================
  3377. dnl =
  3378. dnl = --with-debug-modules=module1,^module2,etc
  3379. dnl = 
  3380. dnl = Enable/disable debug for specific modules only
  3381. dnl =   module names beginning with ^ will be disabled 
  3382. dnl =   (this is because you can't pass args to --without-debug-modules)
  3383. dnl = 
  3384. dnl ========================================================
  3385.  
  3386. MOZ_ARG_WITH_STRING(debug-modules,
  3387. [  --with-debug-modules    Enable/disable debug info for specific modules],
  3388.   [ MOZ_DEBUG_MODULES=`echo $withval | sed 's/,/ /g'` ] )
  3389. dnl ========================================================
  3390.  
  3391. dnl ========================================================
  3392. dnl =
  3393. dnl = --with-dbgrinfo-modules=module1,^module2,etc
  3394. dnl = 
  3395. dnl = Enable/disable generation of debugger info for specific modules only
  3396. dnl =    the special module name ALL_MODULES can be used to denote all modules
  3397. dnl =    module names beginning with ^ will be disabled
  3398. dnl = 
  3399. dnl ========================================================
  3400.  
  3401. MOZ_DBGRINFO_MODULES=""
  3402.  
  3403. MOZ_ARG_WITH_STRING(dbgrinfo-modules,
  3404. [  --with-dbgrinfo-modules Enable/disable debugger info for specific modules],
  3405.   [ for i in `echo $withval | sed 's/,/ /g'`; do
  3406.  
  3407.       dnl note that the list of module names is reversed as it is copied
  3408.       dnl this is important, as it will allow config.mk to interpret stuff like
  3409.       dnl "^ALL_MODULES xpcom" properly
  3410.       if test "$i" = "no"; then
  3411.         i="^ALL_MODULES"
  3412.       fi
  3413.       if test "$i" = "yes"; then
  3414.         i="ALL_MODULES"
  3415.       fi
  3416.       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
  3417.     done ])
  3418. dnl ========================================================
  3419.  
  3420. dnl ========================================================
  3421. dnl =
  3422. dnl = --enable-crypto
  3423. dnl =
  3424. dnl = Build Personal Security Manager
  3425. dnl =
  3426. dnl ========================================================
  3427. MOZ_PSM=
  3428.  
  3429. MOZ_ARG_ENABLE_BOOL(crypto,
  3430. [  --enable-crypto         Enable crypto (Personal Security Manager)],
  3431.   MOZ_PSM=1 )
  3432.  
  3433. dnl ========================================================
  3434. dnl =
  3435. dnl = --enable-jsd
  3436. dnl =
  3437. dnl = JS Debugger XPCOM component (js/jsd)
  3438. dnl = 
  3439. dnl ========================================================
  3440.  
  3441. MOZ_JSDEBUGGER=
  3442.  
  3443. MOZ_ARG_ENABLE_BOOL(jsd,
  3444. [  --enable-jsd            Enable JavaScript debug library],
  3445.    MOZ_JSDEBUGGER=1)
  3446.  
  3447. dnl ========================================================
  3448. dnl =
  3449. dnl = --with-extensions=extension1,extension2,
  3450. dnl = 
  3451. dnl = Enable compilation of specific extension modules
  3452. dnl = 
  3453. dnl ========================================================
  3454.  
  3455. dnl Need cookie and wallet to build mozilla, this should
  3456. dnl not be the case, 18352 has been filed.
  3457. dnl http://bugzilla.mozilla.org/show_bug.cgi?id=18352
  3458. MOZ_EXTENSIONS_DEFAULT="cookie wallet xml-rpc xmlextras help transformiix"
  3459. MOZ_EXTENSIONS_ALL="$MOZ_EXTENSIONS_DEFAULT irc xmlterm inspector access-builtin venkman" 
  3460.  
  3461. MOZ_ARG_WITH_STRING(extensions,
  3462. [  --with-extensions       Enable extensions (dirs in extensions/)],
  3463.   [ MOZ_EXTENSIONS=""
  3464.     for option in `echo $withval | sed 's/,/ /g'`; do
  3465.       if test "$option" = "yes" || test "$option" = "all"; then
  3466.         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
  3467.       elif test "$option" = "no" || test "$option" = "none"; then
  3468.         MOZ_EXTENSIONS=""
  3469.       elif test "$option" = "default"; then
  3470.         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
  3471.       else
  3472.         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
  3473.       fi
  3474.     done ],
  3475.   [ MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT" ] )
  3476.  
  3477. if test -z "$MOZ_ENABLE_GTK" && test `echo "$MOZ_EXTENSIONS" | grep -c xmlterm` -ne 0; then
  3478.     AC_MSG_WARN([Cannot build xmlterm without gtk toolkit. Removing xmlterm from MOZ_EXTENSIONS.])
  3479.     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xmlterm||'`
  3480. fi
  3481.  
  3482. if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
  3483.     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
  3484.     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
  3485. fi
  3486.  
  3487. dnl Disable jar packaging
  3488. MOZ_ARG_DISABLE_BOOL(jar-packaging,
  3489. [  --disable-jar-packaging Disable jar packaging of chrome (Deprecated) ],
  3490.     MOZ_DISABLE_JAR_PACKAGING=1
  3491. )
  3492.  
  3493. MOZ_ARG_ENABLE_STRING(chrome-format,
  3494. [  --enable-chrome-format=[jar|flat|both]
  3495.                           Select format of chrome files (defaults to jar)],
  3496.     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
  3497.  
  3498. if test -z "$MOZ_CHROME_FILE_FORMAT"; then
  3499.     if test -n "$MOZ_DISABLE_JAR_PACKAGING"; then
  3500.         MOZ_CHROME_FILE_FORMAT=flat
  3501.     else
  3502.         MOZ_CHROME_FILE_FORMAT=jar
  3503.     fi
  3504. fi
  3505.  
  3506. if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
  3507.     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
  3508.     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
  3509.     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat or both])
  3510. fi
  3511.  
  3512. dnl ========================================================
  3513. dnl Determine how to handle dependencies
  3514. dnl ========================================================
  3515. MOZ_AUTO_DEPS=1
  3516. MOZ_ARG_DISABLE_BOOL(auto-deps,
  3517. [  --disable-auto-deps     Do not automatically generate dependency info],
  3518.     MOZ_AUTO_DEPS=)
  3519.  
  3520. if test -n "$MOZ_AUTO_DEPS"; then
  3521. _cpp_md_flag=
  3522. MOZ_ARG_DISABLE_BOOL(md,
  3523. [  --disable-md            Do not use compiler-based dependencies ],
  3524.   [],
  3525.   [_cpp_md_flag=1],
  3526.   [dnl Default is to turn on -MD if using GNU-compatible compilers
  3527.    if test "$GNU_CC" -a "$GNU_CXX"; then
  3528.      _cpp_md_flag=1
  3529.    fi])
  3530. if test "$_cpp_md_flag"; then
  3531.   COMPILER_DEPEND=1
  3532.   _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
  3533. fi
  3534. fi # MOZ_AUTO_DEPS
  3535. MDDEPDIR='.deps'
  3536. AC_SUBST(MOZ_AUTO_DEPS)
  3537. AC_SUBST(COMPILER_DEPEND)
  3538. AC_SUBST(MDDEPDIR)
  3539.  
  3540.  
  3541. MOZ_ARG_DISABLE_BOOL(pedantic,
  3542. [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
  3543.   _PEDANTIC= )
  3544. if test "$_PEDANTIC"; then
  3545.     AC_LANG_CPLUSPLUS
  3546.     _SAVE_CXXFLAGS=$CXXFLAGS
  3547.     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
  3548.     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
  3549.     AC_TRY_RUN([ int main () {
  3550.                 if (sizeof(long long) != 8) { return 1; } 
  3551.                     return 0; } ],
  3552.         result="no", result="yes", result="maybe" )
  3553.     AC_MSG_RESULT([$result])
  3554.     CXXFLAGS="$_SAVE_CXXFLAGS"
  3555.     AC_LANG_C
  3556.  
  3557.     case "$result" in
  3558.     no)
  3559.         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
  3560.         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
  3561.         ;;
  3562.     yes)
  3563.         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
  3564.         ;;
  3565.     maybe)
  3566.         AC_MSG_WARN([Cannot test -pedantic long long bug when cross-compiling.])
  3567.         ;;
  3568.     esac
  3569. fi
  3570.  
  3571. dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
  3572. dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
  3573. dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
  3574.  
  3575. AC_LANG_CPLUSPLUS
  3576. _SAVE_CXXFLAGS=$CXXFLAGS
  3577. CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
  3578.  
  3579. AC_CACHE_CHECK(for correct overload resolution with const and templates,
  3580.     ac_nscap_nonconst_opeq_bug,
  3581.     [AC_TRY_COMPILE([
  3582.                       template <class T>
  3583.                       class Pointer
  3584.                         {
  3585.                         public:
  3586.                           T* myPtr;
  3587.                         };
  3588.                       
  3589.                       template <class T, class U>
  3590.                       int operator==(const Pointer<T>& rhs, U* lhs)
  3591.                         {
  3592.                           return rhs.myPtr == lhs;
  3593.                         }
  3594.                       
  3595.                       template <class T, class U>
  3596.                       int operator==(const Pointer<T>& rhs, const U* lhs)
  3597.                         {
  3598.                           return rhs.myPtr == lhs;
  3599.                         }
  3600.                     ],
  3601.                     [
  3602.                       Pointer<int> foo;
  3603.                       const int* bar;
  3604.                       return foo == bar;
  3605.                     ],
  3606.                     ac_nscap_nonconst_opeq_bug="no",
  3607.                     ac_nscap_nonconst_opeq_bug="yes")])
  3608.  
  3609. AC_LANG_C
  3610. CXXFLAGS="$_SAVE_CXXFLAGS"
  3611.  
  3612. if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
  3613.     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
  3614. fi
  3615.  
  3616. dnl pass -Wno-long-long to the compiler
  3617. MOZ_ARG_ENABLE_BOOL(long-long-warning,
  3618. [  --enable-long-long-warning
  3619.                           Pass -Wno-long-long to the compiler],
  3620.   _IGNORE_LONG_LONG_WARNINGS=)
  3621. if test "$_IGNORE_LONG_LONG_WARNINGS"; then
  3622.      _SAVE_CFLAGS="$CFLAGS"
  3623.      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
  3624.      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
  3625.      AC_TRY_COMPILE([], [return(0);], 
  3626.     [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
  3627.       _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
  3628.       result="yes" ], result="no")
  3629.      AC_MSG_RESULT([$result])
  3630.      CFLAGS="$_SAVE_CFLAGS"
  3631. fi
  3632.  
  3633. MOZ_ARG_DISABLE_BOOL(shared,
  3634. [  --disable-shared        Disable building of internal shared libs (BROKEN)],
  3635.   NO_SHARED_LIB=1)
  3636.  
  3637. dnl C++ rtti (g++/egcs only - for now)
  3638. dnl Should be smarter and check that the compiler does indeed have rtti
  3639. MOZ_ARG_ENABLE_BOOL(cpp-rtti,
  3640. [  --enable-cpp-rtti       Enable C++ RTTI ],
  3641.     [ _MOZ_RTTI_FLAGS=-frtti ]
  3642. )
  3643.  
  3644. dnl C++ exceptions (g++/egcs only - for now)
  3645. dnl Should be smarter and check that the compiler does indeed have exceptions
  3646. MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
  3647. [  --enable-cpp-exceptions Enable C++ exceptions ],
  3648.     [ _MOZ_EXCEPTIONS_FLAGS=-fexceptions ]
  3649. )
  3650.  
  3651. dnl Enable Ultrasparc specific compiler options
  3652. MOZ_ARG_ENABLE_BOOL(ultrasparc,
  3653. [  --enable-ultrasparc     Enable UltraSPARC specific compiler options ],
  3654.     [case "$target_os" in
  3655.     solaris*)   
  3656.         case $OS_TEST in
  3657.         sun4u)
  3658.             if test -z "$GNU_CC"; then
  3659.                 ASFLAGS='-xarch=v8plus -DULTRA_SPARC -P -L -D_ASM -D__STDC__=0 -K PIC'
  3660.                 AC_DEFINE(ULTRA_SPARC)
  3661.             else
  3662.                 CFLAGS="${CFLAGS} -Wa,-xarch=v8plus,-DULTRA_SPARC,-P,-L,-D_ASM,-D__STDC__=0"
  3663.                 CXXFLAGS="${CXXFLAGS} -Wa,-xarch=v8plus,-DULTRA_SPARC,-P,-L,-D_ASM,-D__STDC__=0,-K,PIC"
  3664.                 AC_DEFINE(ULTRA_SPARC)
  3665.             fi
  3666.             ;;
  3667.         esac
  3668.         ;;
  3669.     esac
  3670. ])
  3671.  
  3672. dnl ========================================================
  3673. dnl =
  3674. dnl = Profiling and Instrumenting
  3675. dnl = 
  3676. dnl ========================================================
  3677. MOZ_ARG_HEADER(Profiling and Instrumenting)
  3678.  
  3679. MOZ_ARG_ENABLE_BOOL(eazel-profiler,
  3680. [  --enable-eazel-profiler Enable Corel/Eazel profiler],
  3681.   [  ENABLE_EAZEL_PROFILER=1
  3682.      AC_DEFINE(ENABLE_EAZEL_PROFILER)
  3683.      USE_ELF_DYNSTR_GC=
  3684.      MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
  3685.      EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
  3686.      EAZEL_PROFILER_LIBS="-lprofiler -lpthread"])
  3687.  
  3688. MOZ_ARG_WITH_STRING(profile-modules,
  3689. [  --with-profile-modules  Enable/disable profiling for specific modules],
  3690.   [ MOZ_PROFILE_MODULES=`echo $withval | sed 's/,/ /g'` ] )
  3691. dnl ========================================================
  3692. dnl ========================================================
  3693.  
  3694. dnl Enable performance metrics.
  3695. MOZ_ARG_ENABLE_BOOL(perf-metrics,
  3696. [  --enable-perf-metrics   Enable performance metrics],
  3697.   MOZ_PERF_METRICS=1
  3698.   AC_DEFINE(MOZ_PERF_METRICS))
  3699.  
  3700. MOZ_ARG_ENABLE_BOOL(insure,
  3701. [  --enable-insure         Enable insure++ instrumentation (linux only)],
  3702.   [ MOZ_INSURE="insure" MOZ_INSURIFYING=1 MOZ_INSURE_DIRS="." MOZ_INSURE_EXCLUDE_DIRS="config" ])
  3703.  
  3704. MOZ_ARG_WITH_STRING(insure-dirs,
  3705. [  --with-insure-dirs=\$dirs
  3706.                           Dirs to instrument with insure ],
  3707.   MOZ_INSURE_DIRS=$withval )
  3708.  
  3709. MOZ_ARG_WITH_STRING(insure-exclude-dirs,
  3710. [  --with-insure-exclude-dirs=\$dirs
  3711.                           Dirs to not instrument with insure ],
  3712.   MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
  3713.  
  3714. MOZ_ARG_ENABLE_BOOL(boehm,
  3715. [  --enable-boehm          Enable the Boehm Garbage Collector],
  3716.   AC_DEFINE(GC_LEAK_DETECTOR)
  3717.   GC_LEAK_DETECTOR=1
  3718. )
  3719.  
  3720. dnl This will enable logging of addref, release, ctor, dtor.
  3721. MOZ_ARG_ENABLE_BOOL(logrefcnt,
  3722. [  --enable-logrefcnt      Enable Logging of refcounts (default=debug) ],
  3723.     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING),
  3724.     AC_DEFINE(NO_BUILD_REFCNT_LOGGING))
  3725.  
  3726.  
  3727. dnl mozilla/tools/leaky not part of default build.
  3728. MOZ_ARG_ENABLE_BOOL(leaky,
  3729. [  --enable-leaky          Enable leaky memory tool],
  3730.   MOZ_LEAKY=1)
  3731.  
  3732. dnl mozilla/tools/leaky not part of default build.
  3733. MOZ_ARG_ENABLE_BOOL(jprof,
  3734. [  --enable-jprof          Enable jprof profiling tool (pull tools/jprof)],
  3735.   MOZ_JPROF=1
  3736.   AC_DEFINE(MOZ_JPROF))
  3737.  
  3738. dnl mozilla/js/src/xpconnect/tools is not part of default build.
  3739. MOZ_ARG_ENABLE_BOOL(xpctools,
  3740. [  --enable-xpctools       Build JS profiling tool],
  3741.   MOZ_XPCTOOLS=1)
  3742.  
  3743. AC_MSG_CHECKING(webshell leaks option)
  3744. MOZ_ARG_ENABLE_BOOL(detect-webshell-leaks,
  3745. [  --enable-detect-webshell-leaks
  3746.                           Enable detection of webshell leaks 
  3747.                           (default=yes, unless --disable-debug is used)],
  3748.   [ AC_MSG_RESULT(on (user enabled))
  3749.     DETECT_WEBSHELL_LEAKS=1 ],
  3750.   [ AC_MSG_RESULT(off (user disabled)) ],
  3751.   [ if test "$MOZ_DEBUG"; then
  3752.       AC_MSG_RESULT(on (debug build))
  3753.       DETECT_WEBSHELL_LEAKS=1 
  3754.     else
  3755.       AC_MSG_RESULT(off (non-debug build))
  3756.     fi])
  3757.  
  3758. if test "$DETECT_WEBSHELL_LEAKS"; then
  3759.   AC_DEFINE(DETECT_WEBSHELL_LEAKS) 
  3760.   AC_SUBST(DETECT_WEBSHELL_LEAKS)
  3761. fi
  3762.  
  3763. MOZ_ARG_DISABLE_BOOL(double-buffer,
  3764. [  --disable-double-buffer Disable double buffering],
  3765.   AC_DEFINE(NO_DOUBLE_BUFFER))
  3766.  
  3767. MOZ_ARG_ENABLE_BOOL(wrap-malloc,
  3768. [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
  3769.   [ if test "$GNU_CC"; then
  3770.       WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc"
  3771.       MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
  3772.     fi])
  3773.  
  3774. MOZ_ARG_WITH_STRING(wrap-malloc,
  3775. [  --with-wrap-malloc=\$dir Location of malloc wrapper library],
  3776.   WRAP_MALLOC_LIB=$withval)
  3777.  
  3778. MOZ_ARG_ENABLE_BOOL(efence,
  3779. [  --enable-efence         Link with Electric Fence],
  3780.   AC_CHECK_LIB(efence,malloc))
  3781.  
  3782. dnl ========================================================
  3783. dnl =
  3784. dnl = MOZ_DEMANGLE_UNDEFINED_SYMBOLS
  3785. dnl =
  3786. dnl = Support for demangling undefined symbols
  3787. dnl = 
  3788. dnl ========================================================
  3789. AC_CHECK_LIB(iberty, cplus_demangle, [HAVE_DEMANGLE=1],
  3790.              HAVE_DEMANGLE=, "-liberty")
  3791.  
  3792. MOZ_DEMANGLE_SYMBOLS=
  3793.  
  3794. if test "$HAVE_DEMANGLE"
  3795. then
  3796.   case "$target" in
  3797.     *-linux*)
  3798.         # Demangle only for debug or trace-malloc builds
  3799.         if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"
  3800.         then
  3801.             MOZ_DEMANGLE_SYMBOLS=1
  3802.             AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
  3803.         fi
  3804.     ;;
  3805.     *-solaris*)
  3806.         # Demangle only for debug builds which are using the Gnu compiler.
  3807.         if test "$GNU_CC"
  3808.         then
  3809.             if test "$MOZ_DEBUG"
  3810.             then
  3811.                 MOZ_DEMANGLE_SYMBOLS=1
  3812.                 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
  3813.             fi
  3814.         fi
  3815.     ;;
  3816.   esac
  3817. fi
  3818.  
  3819. AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
  3820.  
  3821. dnl ========================================================
  3822. dnl =
  3823. dnl = End MOZ_DEMANGLE_SYMBOLS
  3824. dnl = 
  3825. dnl ========================================================
  3826.  
  3827.  
  3828.  
  3829. dnl ========================================================
  3830. dnl =
  3831. dnl = Misc. Options
  3832. dnl = 
  3833. dnl ========================================================
  3834. MOZ_ARG_HEADER(Misc. Options)
  3835.  
  3836. MOZ_ARG_ENABLE_STRING(homedir,
  3837. [  --enable-homedir=\$val   Set the homedir to \$val],
  3838. dnl [ Location of the mozilla user directory (default is ~/.mozilla).],
  3839.   [if echo "$enableval" | grep "\/" >/dev/null; then
  3840.     AC_MSG_ERROR("Homedir must be single relative path.")
  3841.   else 
  3842.     AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$enableval")
  3843.   fi], 
  3844.   AC_DEFINE(MOZ_USER_DIR,".mozilla") )
  3845.  
  3846. MOZ_ARG_ENABLE_BOOL(idltool,
  3847. [  --enable-idlc           Build idl tool ],
  3848.   BUILD_IDLC=1)
  3849.  
  3850. MOZ_ARG_ENABLE_BOOL(xterm-updates,
  3851. [  --enable-xterm-updates  Update XTERM titles with current command.],
  3852.   MOZ_UPDATE_XTERM=1)
  3853.  
  3854. dnl
  3855. dnl By default, we will now build with LDAP support, which you can
  3856. dnl turn off with the --disable-ldap option. We also added the
  3857. dnl ldap-experimental flag, which is for experimental LDAP code,
  3858. dnl not currently turned on in the default build.
  3859. dnl
  3860. MOZ_LDAP_XPCOM=1
  3861.  
  3862. dnl
  3863. dnl --disable-ldap
  3864. dnl
  3865. MOZ_ARG_DISABLE_BOOL(ldap,
  3866. [  --disable-ldap          Disable LDAP support],
  3867.   MOZ_LDAP_XPCOM=
  3868.     )
  3869.  
  3870. dnl --enable-ldap-experimental
  3871. dnl
  3872. MOZ_ARG_ENABLE_BOOL(ldap-experimental,
  3873. [  --enable-ldap-experimental
  3874.                           Enable LDAP experimental features],
  3875.   MOZ_LDAP_XPCOM_EXPERIMENTAL=1
  3876.     )
  3877.  
  3878. dnl --disable-xul
  3879. dnl
  3880. MOZ_XUL=1
  3881. MOZ_ARG_DISABLE_BOOL(xul,
  3882. [  --disable-xul           Disable XUL ],
  3883.   MOZ_XUL= )
  3884. if test "$MOZ_XUL"; then
  3885.   AC_DEFINE(MOZ_XUL)
  3886.   AC_DEFINE(INCLUDE_XUL)
  3887. fi
  3888. AC_SUBST(MOZ_XUL)
  3889. AC_SUBST(INCLUDE_XUL)
  3890.  
  3891. dnl --enable mathml
  3892. dnl TODO: handle include files here ?
  3893. dnl
  3894. MOZ_ARG_ENABLE_BOOL(mathml,
  3895. [  --enable-mathml         Enable MathML ],
  3896.   MOZ_MATHML=1
  3897.   AC_DEFINE(MOZ_MATHML))
  3898.  
  3899. dnl
  3900. dnl --enable svg
  3901. dnl TODO: handle include files here ?
  3902. dnl
  3903. MOZ_ARG_ENABLE_BOOL(svg,
  3904. [  --enable-svg            Enable SVG ],
  3905.   MOZ_SVG=1
  3906.   AC_DEFINE(MOZ_SVG))
  3907.  
  3908. dnl XSLT is now enabled by default.
  3909. MOZ_XSL=1
  3910. AC_DEFINE(MOZ_XSL)
  3911.  
  3912. dnl Need the contents of config-defs.h in the build logs
  3913. VERBOSE_CONFIG_DEFS=1
  3914. AC_ARG_ENABLE(verbose-config-defs,
  3915. [  --disable-verbose-config-defs
  3916.                           Do not output the contents of config-defs.h],
  3917.    [if test "$enableval" = "no"; then
  3918.     VERBOSE_CONFIG_DEFS=
  3919.     fi])
  3920.  
  3921. dnl New cache is now enabled by default.
  3922. MOZ_NEW_CACHE=1
  3923. dnl The new cache may be optionally disabled in favor of the old cache
  3924. dnl for performance testing.
  3925. MOZ_ARG_DISABLE_BOOL(new-cache,
  3926. [  --disable-new-cache     Disable new cache],
  3927.    MOZ_NEW_CACHE=0)
  3928. if test "$MOZ_NEW_CACHE" = "1"; then
  3929.   AC_DEFINE(MOZ_NEW_CACHE)
  3930. fi
  3931. AC_SUBST(MOZ_NEW_CACHE)
  3932.  
  3933. dnl libpr0n on by default
  3934. USE_IMG2=1
  3935. dnl Turn off the new image library.  Soon to go away.
  3936. MOZ_ARG_DISABLE_BOOL(libpr0n,
  3937. [  --disable-libpr0n       Disable new imagelib],
  3938.    USE_IMG2=)
  3939. if test "$USE_IMG2" = "1"; then
  3940.   AC_DEFINE(USE_IMG2)
  3941. fi
  3942. AC_SUBST(USE_IMG2)
  3943.  
  3944. dnl ========================================================
  3945. dnl =
  3946. dnl = --diable-dtd-debug
  3947. dnl =
  3948. dnl = Disable some DTD debugging code in the parser that 
  3949. dnl = breaks on some compilers because of evil and broken 
  3950. dnl = streams code in htmlparser/src/prstrm.cpp
  3951. dnl =
  3952. dnl ========================================================
  3953. MOZ_DISABLE_DTD_DEBUG=
  3954.  
  3955. MOZ_ARG_DISABLE_BOOL(dtd-debug,
  3956. [  --disable-dtd-debug     Disable some DTD debuggin code in the parser)],
  3957.   MOZ_DISABLE_DTD_DEBUG=1 
  3958.   AC_DEFINE(MOZ_DISABLE_DTD_DEBUG) )
  3959.  
  3960. dnl ========================================================
  3961. dnl =
  3962. dnl = OS/2 Build Options
  3963. dnl = 
  3964. dnl ========================================================
  3965. MOZ_ARG_HEADER(OS/2 Build Options)
  3966.  
  3967. MOZ_ARG_WITH_STRING(os2emx,
  3968. [  --with-os2emx=\$val      Build for OS/2 with emx+gcc, set to OMF or A.OUT],
  3969.     [ MOZ_OS2_TOOLS=EMX
  3970.       MOZ_OS2_EMX_OBJECTFORMAT="$withval"
  3971.       AC_DEFINE(XP_OS2_EMX) ])
  3972.  
  3973. MOZ_ARG_WITH_STRING(os2vacpp,
  3974. [  --with-os2vacpp         Build for OS/2 with VAC++],
  3975.     [ MOZ_OS2_TOOLS=VACPP
  3976.       AC_DEFINE(XP_OS2_VACPP) ])
  3977.  
  3978. dnl ========================================================
  3979. dnl =
  3980. dnl = End OS/2 Build Options
  3981. dnl =
  3982. dnl ========================================================
  3983.  
  3984. NO_STATIC_LIB=1
  3985.  
  3986. MOZ_ARG_ENABLE_BOOL(static,
  3987. [  --enable-static         Enable building of internal static libs (BROKEN)],
  3988.   NO_STATIC_LIB=)
  3989.  
  3990. dnl ========================================================
  3991.  
  3992. MOZ_ARG_ENABLE_STRING(static-components,
  3993. [  --enable-static-components
  3994.                           Build meta-component from specific components],
  3995.   [ MOZ_STATIC_COMPONENTS=`echo $enableval | sed 's/,/ /g'` ] )
  3996.  
  3997. dnl ========================================================
  3998.  
  3999. case "$target" in
  4000.     *-*-aix*)
  4001.     if test "${NO_STATIC_LIB}" = "1" -o -z "${NO_SHARED_LIB}"; then
  4002.         if test -f /usr/lpp/xlC/bin/makeC++SharedLib_r; then
  4003.         AIX_SHLIB_BIN='/usr/lpp/xlC/bin/makeC++SharedLib_r'
  4004.         elif test -f /usr/ibmcxx/bin/makeC++SharedLib_r; then
  4005.         AIX_SHLIB_BIN='/usr/ibmcxx/bin/makeC++SharedLib_r'
  4006.         fi
  4007.         AC_PATH_PROG(AIX_SHLIB_BIN, makeC++SharedLib_r, :)
  4008.         if test ! -n "$AIX_SHLIB_BIN"; then
  4009.         echo
  4010.         echo "*** Unable to locate makeC++SharedLib_r, needed for creation of shared"
  4011.         echo "*** libraries on AIX.  You will only be able to build static libraries."
  4012.         echo
  4013.         NO_STATIC_LIB=''
  4014.         NO_SHARED_LIB=1
  4015.         fi
  4016.     fi
  4017.     AC_SUBST(AIX_SHLIB_BIN)
  4018.     ;;
  4019. esac
  4020.  
  4021. dnl ========================================================
  4022. dnl =
  4023. dnl = Maintainer debug option (no --enable equivalent)
  4024. dnl =
  4025. dnl ========================================================
  4026. AC_SUBST(MOZ_TRACK_MODULE_DEPS)
  4027.  
  4028. AC_SUBST(AR)
  4029. AC_SUBST(AR_FLAGS)
  4030. AC_SUBST(AR_LIST)
  4031. AC_SUBST(AR_EXTRACT)
  4032. AC_SUBST(AR_DELETE)
  4033. AC_SUBST(AS)
  4034. AC_SUBST(ASFLAGS)
  4035. AC_SUBST(AS_DASH_C_FLAG)
  4036. AC_SUBST(LD)
  4037. AC_SUBST(DLLTOOL)
  4038. AC_SUBST(WINDRES)
  4039. AC_SUBST(USE_SHORT_LIBNAME)
  4040. AC_SUBST(IMPLIB)
  4041. AC_SUBST(FILTER)
  4042. AC_SUBST(BIN_FLAGS)
  4043. AC_SUBST(NS_USE_NATIVE)
  4044. AC_SUBST(MOZ_WIDGET_TOOLKIT)
  4045. AC_SUBST(MOZ_WIDGET_TOOLKIT_LDFLAGS)
  4046. AC_SUBST(WIDGET_DLL)
  4047. AC_SUBST(GFXWIN_DLL)
  4048. AC_SUBST(MOZ_GFX_TOOLKIT)
  4049. AC_SUBST(MOZ_GFX_TOOLKIT_LDFLAGS)
  4050. AC_SUBST(MOZ_UPDATE_XTERM)
  4051. AC_SUBST(MOZ_MATHML)
  4052. AC_SUBST(MOZ_SVG)
  4053. AC_SUBST(MOZ_XSL)
  4054. AC_SUBST(MOZ_MONOLITHIC_TOOLKIT)
  4055. AC_SUBST(MOZ_JS_LIBS)
  4056. AC_SUBST(MOZ_PSM)
  4057. AC_SUBST(BUILD_MODULES)
  4058. AC_SUBST(MOZ_DEBUG)
  4059. AC_SUBST(MOZ_DEBUG_MODULES)
  4060. AC_SUBST(MOZ_PROFILE_MODULES)
  4061. AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
  4062. AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
  4063. AC_SUBST(MOZ_DEBUG_FLAGS)
  4064. AC_SUBST(MOZ_DBGRINFO_MODULES)
  4065. AC_SUBST(MOZ_EXTENSIONS)
  4066. AC_SUBST(MOZ_JSDEBUGGER)
  4067. AC_SUBST(ENABLE_EAZEL_PROFILER)
  4068. AC_SUBST(EAZEL_PROFILER_CFLAGS)
  4069. AC_SUBST(EAZEL_PROFILER_LIBS)
  4070. AC_SUBST(MOZ_PERF_METRICS)
  4071. AC_SUBST(GC_LEAK_DETECTOR)
  4072. AC_SUBST(MOZ_LOG_REFCNT)
  4073. AC_SUBST(MOZ_LEAKY)
  4074. AC_SUBST(MOZ_JPROF)
  4075. AC_SUBST(MOZ_XPCTOOLS)
  4076. AC_SUBST(MOZ_INSURE)
  4077. AC_SUBST(MOZ_INSURE_DIRS)
  4078. AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
  4079. AC_SUBST(MOZ_INSURIFYING)
  4080. AC_SUBST(MOZ_BUILD_XPFE)
  4081. AC_SUBST(MOZ_LDAP_XPCOM)
  4082. AC_SUBST(MOZ_LDAP_XPCOM_EXPERIMENTAL)
  4083.  
  4084. AC_SUBST(XPCOM_USE_LEA)
  4085. AC_SUBST(UNIX_CRASH_ON_ASSERT)
  4086. AC_SUBST(NO_UNIX_ASYNC_DNS)
  4087. AC_SUBST(NO_SHARED_LIB)
  4088. AC_SUBST(NO_STATIC_LIB)
  4089. AC_SUBST(MOZ_STATIC_COMPONENTS)
  4090. AC_SUBST(ENABLE_TESTS)
  4091. AC_SUBST(IBMBIDI)
  4092. AC_SUBST(MOZ_USER_DIR)
  4093. AC_SUBST(FULL_STATIC_BUILD)
  4094. AC_SUBST(BUILD_IDLC)
  4095.  
  4096. AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
  4097. AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
  4098. AC_SUBST(MOZ_COMPONENT_XPCOM_LIBS)
  4099. AC_SUBST(XPCOM_LIBS)
  4100.  
  4101. AC_SUBST(MOZ_GLE)
  4102.  
  4103. AC_SUBST(MOZ_BUILD_ROOT)
  4104. AC_SUBST(MOZ_OS2_TOOLS)
  4105. AC_SUBST(MOZ_OS2_EMX_OBJECTFORMAT)
  4106.  
  4107. AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
  4108. AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
  4109.  
  4110. dnl system JPEG support
  4111. dnl ========================================================
  4112. AC_ARG_WITH(jpeg,
  4113. [  --with-jpeg[=\$dir]      Use system libjpeg [installed at prefix \$dir]],
  4114.     JPEG_DIR=$withval)
  4115.  
  4116. _SAVE_CFLAGS=$CFLAGS
  4117. _SAVE_LDFLAGS=$LDFLAGS
  4118. _SAVE_LIBS=$LIBS
  4119. CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
  4120. LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
  4121. if test "$JPEG_DIR" = no; then
  4122.     SYSTEM_JPEG=
  4123. else
  4124.     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
  4125. fi
  4126.  
  4127. if test "$SYSTEM_JPEG" = 1; then
  4128.     LIBS="$JPEG_LIBS $LIBS"
  4129.     AC_TRY_RUN( 
  4130.     #include <stdio.h>
  4131.     #include <sys/types.h>
  4132.     #include <jpeglib.h>
  4133.     int main () {
  4134.         #if JPEG_LIB_VERSION >= $MOZJPEG
  4135.         exit(0);
  4136.         #else
  4137.         exit(1);
  4138.         #endif
  4139.     }
  4140.     , SYSTEM_JPEG=1, [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=], SYSTEM_JPEG= ) 
  4141.     rm -f core
  4142. fi 
  4143. CFLAGS=$_SAVE_CFLAGS
  4144. LDFLAGS=$_SAVE_LDFLAGS
  4145. LIBS=$_SAVE_LIBS
  4146.  
  4147. if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
  4148.     JPEG_CFLAGS="-I${JPEG_DIR}/include"
  4149.     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
  4150. fi
  4151.  
  4152. dnl system ZLIB support
  4153. dnl ========================================================
  4154. AC_ARG_WITH(zlib,
  4155. [  --with-zlib[=\$dir]      Use system libz [installed at prefix \$dir]],
  4156.     ZLIB_DIR=$withval)
  4157.  
  4158. _SAVE_CFLAGS=$CFLAGS
  4159. _SAVE_LDFLAGS=$LDFLAGS
  4160. CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
  4161. LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
  4162. if test "$ZLIB_DIR" = no; then
  4163.     SYSTEM_ZLIB=
  4164. else
  4165.     AC_MSG_CHECKING("for zlib.h")
  4166.     AC_TRY_COMPILE([#include "zlib.h"], [], 
  4167.     [result="yes" SYSTEM_ZLIB=1],
  4168.     [result="no" SYSTEM_ZLIB=])
  4169.     AC_MSG_RESULT("$result")
  4170. fi
  4171. if test "$SYSTEM_ZLIB" = 1; then
  4172.     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
  4173.     [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
  4174. fi
  4175. CFLAGS=$_SAVE_CFLAGS
  4176. LDFLAGS=$_SAVE_LDFLAGS
  4177.  
  4178. if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
  4179.     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
  4180.     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
  4181. fi
  4182.  
  4183. dnl system PNG Support
  4184. dnl ========================================================
  4185. AC_ARG_WITH(png, 
  4186. [  --with-png[=\$dir]       Use system libpng [installed at prefix \$dir]],
  4187.         PNG_DIR=$withval)
  4188.  
  4189. _SAVE_CFLAGS=$CFLAGS
  4190. _SAVE_LDFLAGS=$LDFLAGS
  4191. _SAVE_LIBS=$LIBS
  4192. CFLAGS="-I${PNG_DIR}/include $ZLIB_CFLAGS $CFLAGS"
  4193. LDFLAGS="-L${PNG_DIR}/lib $ZLIB_LIBS -lz $LDFLAGS"
  4194. if test "$PNG_DIR" = no; then
  4195.     SYSTEM_PNG=
  4196. else
  4197.     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
  4198.                  SYSTEM_PNG=, $PNG_LIBS)
  4199. fi
  4200. if test "$SYSTEM_PNG" = 1; then
  4201.     LIBS="$PNG_LIBS $LIBS"
  4202.     AC_TRY_RUN(
  4203.     #include <stdio.h>
  4204.     #include <sys/types.h>
  4205.     #include <png.h>
  4206.     int main () {
  4207.         #if PNG_LIBPNG_VER >= $MOZPNG
  4208.         exit(0);
  4209.         #else
  4210.         exit(1);
  4211.         #endif
  4212.     }
  4213.     , SYSTEM_PNG=1, [SYSTEM_PNG= PNG_CFLAGS= PNG_LIBS=], SYSTEM_PNG= ) 
  4214.     rm -f core
  4215. fi
  4216. CFLAGS=$_SAVE_CFLAGS
  4217. LDFLAGS=$_SAVE_LDFLAGS
  4218. LIBS=$_SAVE_LIBS
  4219.  
  4220. if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
  4221.     PNG_CFLAGS="-I${PNG_DIR}/include"
  4222.     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
  4223. fi
  4224.  
  4225. dnl system MNG Support
  4226. dnl ========================================================
  4227. AC_ARG_WITH(mng, 
  4228. [  --with-mng[=\$dir]       Use system libmng [installed at prefix \$dir]],
  4229.         MNG_DIR=$withval)
  4230.  
  4231. _SAVE_CFLAGS=$CFLAGS
  4232. _SAVE_LDFLAGS=$LDFLAGS
  4233. _SAVE_LIBS=$LIBS
  4234. CFLAGS="-I${MNG_DIR}/include $ZLIB_CFLAGS $CFLAGS"
  4235. LDFLAGS="-L${MNG_DIR}/lib $ZLIB_LIBS -lz $LDFLAGS"
  4236. if test "$MNG_DIR" = no; then
  4237.     SYSTEM_MNG=
  4238. else
  4239.     AC_CHECK_LIB(mng, mng_initialize, [SYSTEM_MNG=1 MNG_LIBS="-lmng $MNG_LIBS"],
  4240.                  SYSTEM_MNG=, $MNG_LIBS)
  4241. fi
  4242. if test "$SYSTEM_MNG" = 1; then
  4243.     LIBS="$MNG_LIBS $LIBS"
  4244.     AC_TRY_RUN(
  4245.     #include <stdio.h>
  4246.     #include <sys/types.h>
  4247.     #include <libmng.h>
  4248.     int main () {
  4249.         #if (((MNG_VERSION_MAJOR)<<16)|((MNG_VERSION_MINOR)<<8)|(MNG_VERSION_RELEASE)) >= $MOZMNG
  4250.         exit(0);
  4251.         #else
  4252.         exit(1);
  4253.         #endif
  4254.     }
  4255.     , SYSTEM_MNG=1, [SYSTEM_MNG= MNG_CFLAGS= MNG_LIBS=], SYSTEM_MNG= ) 
  4256.     rm -f core
  4257. fi
  4258. CFLAGS=$_SAVE_CFLAGS
  4259. LDFLAGS=$_SAVE_LDFLAGS
  4260. LIBS=$_SAVE_LIBS
  4261.  
  4262. if test "${MNG_DIR}" -a -d "${MNG_DIR}" -a "$SYSTEM_MNG" = 1; then
  4263.     MNG_CFLAGS="-I${MNG_DIR}/include"
  4264.     MNG_LIBS="-L${MNG_DIR}/lib ${MNG_LIBS}"
  4265. fi
  4266.  
  4267. dnl Disable profile at startup, hack for tinderbox.
  4268. if test "$MOZ_BYPASS_PROFILE_AT_STARTUP"; then
  4269.   AC_DEFINE(MOZ_BYPASS_PROFILE_AT_STARTUP)
  4270. fi
  4271.  
  4272. dnl system FullCircle/Talkback support (Crash-reporting mechanism)
  4273. dnl ==============================================================
  4274.  
  4275. MOZ_FULLCIRCLE=
  4276. FULLCIRCLE_LIBS=
  4277. MOZ_ARG_ENABLE_BOOL(fullcircle,
  4278. [  --enable-fullcircle     Enable FullCircle/Talkback support],
  4279. [ MOZ_FULLCIRCLE=1 FULLCIRCLE_LIBS="-lfullsoft" ])
  4280.  
  4281. AC_ARG_WITH(fullcircle,
  4282. [  --with-fullcircle=\$dir  Location of FullCircle headers and libraries],
  4283.         FULLCIRCLE_DIR=$withval,
  4284.         FULLCIRCLE_DIR=no)
  4285.  
  4286. if test "$FULLCIRCLE_DIR" = no; then
  4287.     FULLCIRCLE_DIR=
  4288. else
  4289.  
  4290. _SAVE_CFLAGS=$CFLAGS
  4291. _SAVE_LDFLAGS=$LDFLAGS
  4292. _SAVE_LIBS=$LIBS
  4293. CFLAGS="$CFLAGS -I${FULLCIRCLE_DIR}"
  4294. LDFLAGS="$LDFLAGS -L${FULLCIRCLE_DIR}"
  4295. LIBS="-lfullsoft $LIBS"
  4296. AC_MSG_CHECKING("for FCInitialize in -lfullsoft");
  4297. AC_TRY_LINK([ #include <stdio.h>
  4298.           #include "fullsoft.h" ],
  4299.             [ FCInitialize(); exit(0); ],
  4300.             [FULLCIRCLE_LIBS="-I${FULLCIRCLE_DIR} -L${FULLCIRCLE_DIR} -lfullsoft" result="yes"],
  4301.             [MISSING_FULLCIRCLE=1 result="no"])
  4302. AC_MSG_RESULT("$result")
  4303. CFLAGS=$_SAVE_CFLAGS
  4304. LDFLAGS=$_SAVE_LDFLAGS
  4305. LIBS=$_SAVE_LIBS
  4306.  
  4307. if test "$MISSING_FULLCIRCLE"; then
  4308.     echo
  4309.     echo "Could not find FullCircle library -- ignoring it"
  4310.     echo
  4311.     MOZ_FULLCIRCLE=
  4312.     FULLCIRCLE_LIBS=
  4313. else
  4314.     AC_DEFINE(MOZ_FULLCIRCLE)
  4315.     CFLAGS="$CFLAGS -I${FULLCIRCLE_DIR}"
  4316.     CXXFLAGS="$CXXFLAGS -I${FULLCIRCLE_DIR}"
  4317. fi
  4318.  
  4319. fi
  4320.  
  4321. AC_SUBST(MOZ_FULLCIRCLE)
  4322. AC_SUBST(FULLCIRCLE_LIBS)
  4323.  
  4324. dnl Echo the CFLAGS to remove extra whitespace.
  4325. CFLAGS=`echo \
  4326.     $_WARNINGS_CFLAGS \
  4327.     $CFLAGS`
  4328.  
  4329. CXXFLAGS=`echo \
  4330.     $_MOZ_RTTI_FLAGS \
  4331.     $_MOZ_EXCEPTIONS_FLAGS \
  4332.     $_WARNINGS_CXXFLAGS \
  4333.     $CXXFLAGS`
  4334.  
  4335. COMPILE_CFLAGS=`echo \
  4336.     $_DEFINES_CFLAGS \
  4337.     $_DEPEND_CFLAGS \
  4338.     $COMPILE_CFLAGS`
  4339.  
  4340. COMPILE_CXXFLAGS=`echo \
  4341.     $_DEFINES_CXXFLAGS \
  4342.     $_DEPEND_CFLAGS \
  4343.     $COMPILE_CXXFLAGS`
  4344.  
  4345. dnl 
  4346. dnl It is perfectly legal to build with both -O and -g even though
  4347. dnl some compilers/platforms might not support this.
  4348. dnl 
  4349.  
  4350. dnl # Clean out '-O' flags if doing a debug build.
  4351. dnl if test "$MOZ_DEBUG"
  4352. dnl then
  4353. dnl   changequote(,)dnl
  4354. dnl   CFLAGS=`  echo $CFLAGS   | sed 's/ *-O[^ ]*//g;'`
  4355. dnl   CXXFLAGS=`echo $CXXFLAGS | sed 's/ *-O[^ ]*//g;'`
  4356. dnl   LDFLAGS=`echo  $LDFLAGS  | sed 's/ *-O[^ ]*//g;'`
  4357. dnl   changequote([,])dnl
  4358. dnl fi
  4359.  
  4360. AC_SUBST(SYSTEM_MAKEDEPEND)
  4361. AC_SUBST(SYSTEM_JPEG)
  4362. AC_SUBST(SYSTEM_PNG)
  4363. AC_SUBST(SYSTEM_MNG)
  4364. AC_SUBST(SYSTEM_ZLIB)
  4365.  
  4366. AC_SUBST(JPEG_CFLAGS)
  4367. AC_SUBST(JPEG_LIBS)
  4368. AC_SUBST(ZLIB_CFLAGS)
  4369. AC_SUBST(ZLIB_LIBS)
  4370. AC_SUBST(PNG_CFLAGS)
  4371. AC_SUBST(PNG_LIBS)
  4372. AC_SUBST(MNG_CFLAGS)
  4373. AC_SUBST(MNG_LIBS)
  4374.  
  4375. AC_SUBST(MOZ_JPEG_CFLAGS)
  4376. AC_SUBST(MOZ_JPEG_LIBS)
  4377. AC_SUBST(MOZ_ZLIB_CFLAGS)
  4378. AC_SUBST(MOZ_ZLIB_LIBS)
  4379. AC_SUBST(MOZ_PNG_CFLAGS)
  4380. AC_SUBST(MOZ_PNG_LIBS)
  4381. AC_SUBST(MOZ_MNG_CFLAGS)
  4382. AC_SUBST(MOZ_MNG_LIBS)
  4383.  
  4384. AC_SUBST(NSPR_CFLAGS)
  4385. AC_SUBST(NSPR_LIBS)
  4386. AC_SUBST(MOZ_NATIVE_NSPR)
  4387.  
  4388. AC_SUBST(CFLAGS)
  4389. AC_SUBST(CXXFLAGS)
  4390. AC_SUBST(CPPFLAGS)
  4391. AC_SUBST(COMPILE_CFLAGS)
  4392. AC_SUBST(COMPILE_CXXFLAGS)
  4393. AC_SUBST(LDFLAGS)
  4394. AC_SUBST(LIBS)
  4395. AC_SUBST(CROSS_COMPILE)
  4396.  
  4397. AC_SUBST(HOST_CC)
  4398. AC_SUBST(HOST_CXX)
  4399. AC_SUBST(HOST_CFLAGS)
  4400. AC_SUBST(HOST_CXXFLAGS)
  4401.  
  4402. AC_SUBST(HOST_AR)
  4403. AC_SUBST(HOST_RANLIB)
  4404. AC_SUBST(HOST_NSPR_MDCPUCFG)
  4405.  
  4406. AC_SUBST(HOST_LIBIDL_CONFIG)
  4407. AC_SUBST(HOST_LIBIDL_CFLAGS)
  4408. AC_SUBST(HOST_LIBIDL_LIBS)
  4409.  
  4410. AC_SUBST(TARGET_CPU)
  4411. AC_SUBST(TARGET_OS)
  4412. AC_SUBST(TARGET_NSPR_MDCPUCFG)
  4413. AC_SUBST(TARGET_MD_ARCH)
  4414. AC_SUBST(OS_TARGET)
  4415. AC_SUBST(OS_ARCH)
  4416. AC_SUBST(OS_RELEASE)
  4417. AC_SUBST(OS_TEST)
  4418.  
  4419. AC_SUBST(MOZ_DISABLE_DTD_DEBUG)
  4420. AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
  4421. AC_SUBST(MOZ_CHROME_FILE_FORMAT)
  4422.  
  4423. AC_SUBST(WRAP_MALLOC_CFLAGS)
  4424. AC_SUBST(WRAP_MALLOC_LIB)
  4425. AC_SUBST(MKSHLIB)
  4426. AC_SUBST(MKCSHLIB)
  4427. AC_SUBST(MKSHLIB_FORCE_ALL)
  4428. AC_SUBST(MKSHLIB_UNFORCE_ALL)
  4429. AC_SUBST(DSO_CFLAGS)
  4430. AC_SUBST(DSO_PIC_CFLAGS)
  4431. AC_SUBST(DSO_LDOPTS)
  4432. AC_SUBST(DLL_SUFFIX)
  4433. AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
  4434. AC_SUBST(LIB_SUFFIX)
  4435. AC_SUBST(OBJ_SUFFIX)
  4436. AC_SUBST(BIN_SUFFIX)
  4437. AC_SUBST(USE_N32)
  4438. AC_SUBST(MOZ_NSS_AUTOCONF)
  4439.  
  4440. if test "$USING_HCC"; then
  4441.    CC='${topsrcdir}/build/hcc'
  4442.    CC="$CC '$_OLDCC'"
  4443.    CXX='${topsrcdir}/build/hcpp'
  4444.    CXX="$CXX '$_OLDCXX'"
  4445.    AC_SUBST(CC)
  4446.    AC_SUBST(CXX)
  4447. fi
  4448.  
  4449. dnl Check for missing components
  4450. if test "$no_x" != "yes"; then
  4451. if test ! -z "$MISSING_X"; then
  4452.    AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
  4453. fi
  4454.  
  4455. if test ! -z "$MISSING_XPRINT"; then
  4456.    AC_MSG_ERROR([ Could not find the following XPRINT libraries: $MISSING_XPRINT ]);
  4457. fi
  4458.  
  4459. if test ! -z "$MISSING_MOTIF"; then
  4460.    AC_MSG_ERROR([ Could not find the following Motif libraries: $MISSING_MOTIF ]);
  4461. fi
  4462. fi # $no_x
  4463.  
  4464. dnl Set various defines and substitutions
  4465. dnl ========================================================
  4466.  
  4467. if test "$OS_TARGET" = "OS2"; then
  4468.   AC_DEFINE(XP_PC)
  4469.   AC_DEFINE(XP_OS2)
  4470.   AC_DEFINE(BSD_SELECT)
  4471.   AC_DEFINE(XP_OS2_FIX)
  4472.   case "$target" in
  4473.     *-*-os2_vacpp)
  4474.         LIBS='so32dll.lib tcp32dll.lib'
  4475.         ;;
  4476.   esac
  4477. elif test "$OS_TARGET" = "WINNT"; then
  4478.   AC_DEFINE(XP_PC)
  4479. elif test "$OS_TARGET" = "BeOS"; then
  4480.   AC_DEFINE(XP_BEOS)
  4481.   AC_DEFINE(HAVE_MOVEMAIL)
  4482.   HAVE_MOVEMAIL=1
  4483.   AC_SUBST(HAVE_MOVEMAIL)
  4484. elif test "$OS_TARGET" = "Mac OS"; then
  4485.   AC_DEFINE(XP_UNIX)
  4486.   AC_DEFINE(UNIX_EMBED)
  4487.   AC_DEFINE(UNIX_LDAP)
  4488.   AC_DEFINE(UNIX_ASYNC_DNS)
  4489. elif test "$OS_TARGET" = "POSIX_for_OpenVMS_AXP"; then
  4490.   AC_DEFINE(XP_UNIX)
  4491.   AC_DEFINE(UNIX_ASYNC_DNS)
  4492. else
  4493.   AC_DEFINE(XP_UNIX)
  4494.   AC_DEFINE(UNIX_ASYNC_DNS)
  4495.   AC_DEFINE(HAVE_MOVEMAIL)
  4496.   HAVE_MOVEMAIL=1
  4497.   AC_SUBST(HAVE_MOVEMAIL)
  4498. fi
  4499.  
  4500. AC_DEFINE(JS_THREADSAFE)
  4501.  
  4502.  
  4503. # Used for LD_LIBRARY_PATH of run_viewer target
  4504. LIBS_PATH=
  4505. for lib_arg in $NSPR_LIBS $TK_LIBS; do
  4506.   case $lib_arg in
  4507.     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
  4508.       * ) ;;
  4509.   esac
  4510. done
  4511. AC_SUBST(LIBS_PATH)
  4512.  
  4513. dnl Spit out some output
  4514. dnl ========================================================
  4515.  
  4516. # Save the defines header file before autoconf removes it.
  4517. # (Do not add AC_DEFINE calls after this line.)
  4518. if test "$_USE_CPP_INCLUDE_FLAG"; then
  4519.   _CONFIG_TMP=confdefs-tmp.h
  4520.   _CONFIG_DEFS_H=config-defs.h
  4521.  
  4522.   cat > $_CONFIG_TMP <<\EOF
  4523. /* List of defines generated by configure. Included with preprocessor flag,
  4524.  * -include, to avoid long list of -D defines on the compile command-line.
  4525.  * Do not edit.
  4526.  */
  4527. EOF
  4528.   sort confdefs.h >> $_CONFIG_TMP
  4529.  
  4530.   # Only write config-defs.h when something changes (or it doesn't exist)
  4531.   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
  4532.     rm $_CONFIG_TMP
  4533.   else
  4534.     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
  4535.     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
  4536.  
  4537.     if test "$VERBOSE_CONFIG_DEFS"; then
  4538.       echo ==== $_CONFIG_DEFS_H =================================
  4539.       cat $_CONFIG_DEFS_H
  4540.     fi
  4541.   fi
  4542. fi
  4543.  
  4544. AC_SUBST(MOZ_DEFINES)
  4545.  
  4546. dnl Load the list of Makefiles to generate.
  4547. dnl   To add new Makefiles, edit allmakefiles.sh.
  4548. dnl   allmakefiles.sh sets the variable, MAKEFILES.
  4549. . ${srcdir}/allmakefiles.sh
  4550. dnl 
  4551. dnl Run a perl script to quickly create the makefiles.
  4552. dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
  4553. dnl   for the files it cannot handle correctly. This way, config.status
  4554. dnl   will handle these files.
  4555. dnl If it fails, nothing is set and config.status will run as usual.
  4556. dnl
  4557. dnl This does not change the $MAKEFILES variable.
  4558. dnl
  4559. dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
  4560. dnl
  4561. echo $MAKEFILES | $PERL $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
  4562. . ./conftest.sh
  4563. rm conftest.sh
  4564.  
  4565. echo $MAKEFILES > unallmakefiles
  4566.  
  4567. AC_OUTPUT($MAKEFILES)
  4568.  
  4569. dnl ========================================================
  4570. dnl = Setup a nice relatively clean build environment for
  4571. dnl = sub-configures.
  4572. dnl ========================================================
  4573. CC="$_SUBDIR_CC" 
  4574. CXX="$_SUBDIR_CXX" 
  4575. CFLAGS="$_SUBDIR_CFLAGS" 
  4576. CPPFLAGS="$_SUBDIR_CPPFLAGS"
  4577. CXXFLAGS="$_SUBDIR_CXXFLAGS"
  4578. LDFLAGS="$_SUBDIR_LDFLAGS"
  4579. HOST_CC="$_SUBDIR_HOST_CC" 
  4580. HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
  4581. HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
  4582. WINDRES=
  4583. DLLTOOL=
  4584.  
  4585. unset MAKEFILES
  4586. unset CONFIG_FILES
  4587.  
  4588. if test -z "$MOZ_NATIVE_NSPR" || test "$MOZ_LDAP_XPCOM"; then
  4589.     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist"
  4590.     AC_OUTPUT_SUBDIRS(nsprpub)
  4591. fi
  4592.  
  4593. if test -z "$MOZ_NATIVE_NSPR"; then
  4594.     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
  4595.     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
  4596.     case "$target" in
  4597.     *-*-os2_vacpp)
  4598.         ;;
  4599.     *)
  4600.         NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$MOZ_BUILD_ROOT/dist --exec-prefix=$MOZ_BUILD_ROOT/dist --libs`
  4601.         $PERL -pi.bak -e "s {^NSPR_LIBS\s*=.*} {NSPR_LIBS = $NSPR_LIBS }" config/autoconf.mk
  4602.         ;;
  4603.     esac
  4604.     NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$MOZ_BUILD_ROOT/dist --exec-prefix=$MOZ_BUILD_ROOT/dist --cflags`
  4605.     $PERL -pi.bak -e "s {^NSPR_CFLAGS\s*=.*} {NSPR_CFLAGS = $NSPR_CFLAGS }" config/autoconf.mk
  4606.     rm -f config/autoconf.mk.bak
  4607. fi
  4608.  
  4609. # if we're building the LDAP XPCOM component, we need to build 
  4610. # the c-sdk first.  
  4611. #
  4612. if test "$MOZ_LDAP_XPCOM"; then
  4613.  
  4614.   # these subdirs may not yet have been created in the build tree.
  4615.   # don't use the "-p" switch to mkdir, since not all platforms have it
  4616.   #
  4617.   if test ! -d "directory/c-sdk"; then
  4618.     mkdir "directory/c-sdk"    
  4619.   fi
  4620.   if test ! -d "directory/c-sdk/ldap"; then
  4621.     mkdir "directory/c-sdk/ldap"    
  4622.   fi
  4623.  
  4624.   ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist"
  4625.   AC_OUTPUT_SUBDIRS(directory/c-sdk/ldap)
  4626. fi
  4627.  
  4628. if test "$MOZ_PSM" && test -n "$MOZ_NSS_AUTOCONF"; then
  4629.     if test ! -d security; then
  4630.         rm -rf security; mkdir security
  4631.     fi
  4632.     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla --disable-cmd"
  4633.     AC_OUTPUT_SUBDIRS(security/nss)
  4634. fi
  4635.