nsprpub/configure.in

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

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

mercurial