/js/src/configure.in

http://github.com/zpao/v8monkey · Autoconf · 5430 lines · 4042 code · 569 blank · 819 comment · 503 complexity · 6dc810d30993e3187ef7be0a50c2697c MD5 · raw file

Large files are truncated click here to view the full file

  1. dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
  2. dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
  3. dnl ***** BEGIN LICENSE BLOCK *****
  4. dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5. dnl
  6. dnl The contents of this file are subject to the Mozilla Public License Version
  7. dnl 1.1 (the "License"); you may not use this file except in compliance with
  8. dnl the License. You may obtain a copy of the License at
  9. dnl http://www.mozilla.org/MPL/
  10. dnl
  11. dnl Software distributed under the License is distributed on an "AS IS" basis,
  12. dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. dnl for the specific language governing rights and limitations under the
  14. dnl License.
  15. dnl
  16. dnl The Original Code is this file as it was released upon August 6, 1998.
  17. dnl
  18. dnl The Initial Developer of the Original Code is
  19. dnl Christopher Seawood.
  20. dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
  21. dnl the Initial Developer. All Rights Reserved.
  22. dnl
  23. dnl Contributor(s):
  24. dnl Jamie Zawinski <jwz@jwz.org>
  25. dnl gettimeofday args check
  26. dnl Christopher Blizzard <blizzard@appliedtheory.com>
  27. dnl gnomefe update & enable-pthreads
  28. dnl Ramiro Estrugo <ramiro@netscape.com>
  29. dnl X11 makedepend support
  30. dnl Insure support.
  31. dnl Henry Sobotka <sobotka@axess.com>
  32. dnl OS/2 support
  33. dnl Dan Mosedale <dmose@mozilla.org>
  34. dnl LDAP support
  35. dnl Seth Spitzer <sspitzer@netscape.com>
  36. dnl xpctools support
  37. dnl Benjamin Smedberg <benjamin@smedbergs.us>
  38. dnl Howard Chu <hyc@symas.com>
  39. dnl MSYS support
  40. dnl Mark Mentovai <mark@moxienet.com>:
  41. dnl Mac OS X 10.4 support
  42. dnl Giorgio Maone <g.maone@informaction.com>
  43. dnl MSVC l10n compatible version check
  44. dnl Ben Turner <mozilla@songbirdnest.com>
  45. dnl Windows x64 support
  46. dnl Makoto Kato <m_kato@ga2.so-net.ne.jp>
  47. dnl
  48. dnl Alternatively, the contents of this file may be used under the terms of
  49. dnl either the GNU General Public License Version 2 or later (the "GPL"), or
  50. dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  51. dnl in which case the provisions of the GPL or the LGPL are applicable instead
  52. dnl of those above. If you wish to allow use of your version of this file only
  53. dnl under the terms of either the GPL or the LGPL, and not to allow others to
  54. dnl use your version of this file under the terms of the MPL, indicate your
  55. dnl decision by deleting the provisions above and replace them with the notice
  56. dnl and other provisions required by the GPL or the LGPL. If you do not delete
  57. dnl the provisions above, a recipient may use your version of this file under
  58. dnl the terms of any one of the MPL, the GPL or the LGPL.
  59. dnl
  60. dnl ***** END LICENSE BLOCK *****
  61. dnl Process this file with autoconf to produce a configure script.
  62. dnl ========================================================
  63. AC_PREREQ(2.13)
  64. AC_INIT(jsapi.h)
  65. AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
  66. AC_CONFIG_HEADER(js-config.h)
  67. AC_CANONICAL_SYSTEM
  68. TARGET_CPU="${target_cpu}"
  69. TARGET_VENDOR="${target_vendor}"
  70. TARGET_OS="${target_os}"
  71. dnl ========================================================
  72. dnl =
  73. dnl = Don't change the following two lines. Doing so breaks:
  74. dnl =
  75. dnl = CFLAGS="-foo" ./configure
  76. dnl =
  77. dnl ========================================================
  78. CFLAGS="${CFLAGS=}"
  79. CPPFLAGS="${CPPFLAGS=}"
  80. CXXFLAGS="${CXXFLAGS=}"
  81. LDFLAGS="${LDFLAGS=}"
  82. HOST_CFLAGS="${HOST_CFLAGS=}"
  83. HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
  84. HOST_LDFLAGS="${HOST_LDFLAGS=}"
  85. dnl ========================================================
  86. dnl = Preserve certain environment flags passed to configure
  87. dnl = We want sub projects to receive the same flags
  88. dnl = untainted by this configure script
  89. dnl ========================================================
  90. _SUBDIR_CC="$CC"
  91. _SUBDIR_CXX="$CXX"
  92. _SUBDIR_CFLAGS="$CFLAGS"
  93. _SUBDIR_CPPFLAGS="$CPPFLAGS"
  94. _SUBDIR_CXXFLAGS="$CXXFLAGS"
  95. _SUBDIR_LDFLAGS="$LDFLAGS"
  96. _SUBDIR_HOST_CC="$HOST_CC"
  97. _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
  98. _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
  99. _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
  100. _SUBDIR_CONFIG_ARGS="$ac_configure_args"
  101. dnl Set the version number of the libs included with mozilla
  102. dnl ========================================================
  103. NSPR_VERSION=4
  104. dnl Set the minimum version of toolkit libs used by mozilla
  105. dnl ========================================================
  106. PERL_VERSION=5.006
  107. PYTHON_VERSION=2.5
  108. WINDRES_VERSION=2.14.90
  109. W32API_VERSION=3.14
  110. MSMANIFEST_TOOL=
  111. dnl Set various checks
  112. dnl ========================================================
  113. MISSING_X=
  114. AC_PROG_AWK
  115. dnl Initialize the Pthread test variables early so they can be
  116. dnl overridden by each platform.
  117. dnl ========================================================
  118. USE_PTHREADS=
  119. _PTHREAD_LDFLAGS=""
  120. dnl Do not allow a separate objdir build if a srcdir build exists.
  121. dnl ==============================================================
  122. _topsrcdir=`cd \`dirname $0\`; pwd`
  123. _objdir=`pwd`
  124. if test "$_topsrcdir" != "$_objdir"
  125. then
  126. # Check for a couple representative files in the source tree
  127. _conflict_files=
  128. for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
  129. if test -f $file; then
  130. _conflict_files="$_conflict_files $file"
  131. fi
  132. done
  133. if test "$_conflict_files"; then
  134. echo "***"
  135. echo "* Your source tree contains these files:"
  136. for file in $_conflict_files; do
  137. echo "* $file"
  138. done
  139. cat 1>&2 <<-EOF
  140. * This indicates that you previously built in the source tree.
  141. * A source tree build can confuse the separate objdir build.
  142. *
  143. * To clean up the source tree:
  144. * 1. cd $_topsrcdir
  145. * 2. gmake distclean
  146. ***
  147. EOF
  148. exit 1
  149. break
  150. fi
  151. fi
  152. MOZ_BUILD_ROOT=`pwd`
  153. dnl Choose where to put the 'dist' directory.
  154. dnl ==============================================================
  155. MOZ_ARG_WITH_STRING(dist-dir,
  156. [ --with-dist-dir=DIR Use DIR as 'dist' staging area. DIR may be
  157. relative to the top of SpiderMonkey build tree,
  158. or absolute.],
  159. TOP_DIST=$withval,
  160. TOP_DIST=dist)
  161. AC_SUBST(TOP_DIST)
  162. dnl Default to MSVC for win32
  163. dnl ==============================================================
  164. if test -z "$CROSS_COMPILE"; then
  165. case "$target" in
  166. *-mingw*)
  167. if test -z "$CC"; then CC=cl; fi
  168. if test -z "$CXX"; then CXX=cl; fi
  169. if test -z "$CPP"; then CPP="cl -E -nologo"; fi
  170. if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
  171. if test -z "$LD"; then LD=link; fi
  172. if test -z "$AS"; then
  173. case "${target_cpu}" in
  174. i*86)
  175. AS=ml;
  176. ;;
  177. x86_64)
  178. AS=ml64;
  179. ;;
  180. esac
  181. fi
  182. if test -z "$MIDL"; then MIDL=midl; fi
  183. ;;
  184. *-darwin*)
  185. # prefer gcc-4.2 to default cc on older xcode
  186. MOZ_PATH_PROGS(CC, $CC gcc-4.2 gcc)
  187. MOZ_PATH_PROGS(CXX, $CXX g++-4.2 g++)
  188. ;;
  189. esac
  190. fi
  191. COMPILE_ENVIRONMENT=1
  192. MOZ_ARG_DISABLE_BOOL(compile-environment,
  193. [ --disable-compile-environment
  194. Disable compiler/library checks.],
  195. COMPILE_ENVIRONMENT= )
  196. AC_SUBST(COMPILE_ENVIRONMENT)
  197. dnl Check for Perl first -- needed for win32 SDK checks
  198. MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
  199. if test -z "$PERL" -o "$PERL" = ":"; then
  200. AC_MSG_ERROR([perl not found in \$PATH])
  201. fi
  202. MOZ_ARG_ENABLE_BOOL(shared-js,
  203. [ --disable-shared-js
  204. Do not create a shared library.],
  205. DISABLE_SHARED_JS=0,
  206. DISABLE_SHARED_JS=1)
  207. if test "$DISABLE_SHARED_JS" = "1" ; then
  208. AC_DEFINE(STATIC_EXPORTABLE_JS_API)
  209. else
  210. JS_SHARED_LIBRARY=1
  211. fi
  212. AC_SUBST(JS_SHARED_LIBRARY)
  213. dnl ========================================================
  214. dnl = Android uses a very custom (hacky) toolchain; we need to do this
  215. dnl = here, so that the compiler checks can succeed
  216. dnl ========================================================
  217. MOZ_ARG_WITH_STRING(android-ndk,
  218. [ --with-android-ndk=DIR
  219. location where the Android NDK can be found],
  220. android_ndk=$withval)
  221. MOZ_ARG_WITH_STRING(android-toolchain,
  222. [ --with-android-toolchain=DIR
  223. location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
  224. android_toolchain=$withval)
  225. MOZ_ARG_WITH_STRING(android-version,
  226. [ --with-android-version=VER
  227. android platform version, default 5],
  228. android_version=$withval,
  229. android_version=5)
  230. MOZ_ARG_WITH_STRING(android-sdk,
  231. [ --with-android-sdk=DIR
  232. location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
  233. android_sdk=$withval)
  234. MOZ_ARG_WITH_STRING(android-platform,
  235. [ --with-android-platform=DIR
  236. location of platform dir, default NDK/build/platforms/android-5/arch-arm],
  237. android_platform=$withval)
  238. MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
  239. [ --enable-android-libstdcxx
  240. use GNU libstdc++ instead of STLPort for NDK >= 5],
  241. MOZ_ANDROID_LIBSTDCXX=1,
  242. MOZ_ANDROID_LIBSTDCXX= )
  243. case "$target" in
  244. arm-linux*-android*|*-linuxandroid*)
  245. android_tool_prefix="arm-linux-androideabi"
  246. ;;
  247. arm-android-eabi)
  248. android_tool_prefix="arm-eabi"
  249. ;;
  250. i?86-*android*)
  251. android_tool_prefix="i686-android-linux"
  252. ;;
  253. *)
  254. android_tool_prefix="$target_os"
  255. ;;
  256. esac
  257. MOZ_ARG_WITH_STRING(gonk,
  258. [ --with-gonk=DIR
  259. location of gonk dir],
  260. gonkdir=$withval)
  261. if test -n "$gonkdir" ; then
  262. kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
  263. gonk_toolchain="$gonkdir"/prebuilt/$kernel_name-x86/toolchain/arm-eabi-4.4.3
  264. dnl set up compilers
  265. AS="$gonk_toolchain"/bin/"$android_tool_prefix"-as
  266. CC="$gonk_toolchain"/bin/"$android_tool_prefix"-gcc
  267. CXX="$gonk_toolchain"/bin/"$android_tool_prefix"-g++
  268. CPP="$gonk_toolchain"/bin/"$android_tool_prefix"-cpp
  269. LD="$gonk_toolchain"/bin/"$android_tool_prefix"-ld
  270. AR="$gonk_toolchain"/bin/"$android_tool_prefix"-ar
  271. RANLIB="$gonk_toolchain"/bin/"$android_tool_prefix"-ranlib
  272. STRIP="$gonk_toolchain"/bin/"$android_tool_prefix"-strip
  273. STLPORT_CPPFLAGS="-I$gonkdir/external/stlport/stlport"
  274. STLPORT_LIBS="-lstlport"
  275. CPPFLAGS="-DANDROID -I$gonkdir/bionic/libc/include/ -I$gonkdir/bionic/libc/kernel/common -I$gonkdir/bionic/libc/arch-arm/include -I$gonkdir/bionic/libc/kernel/arch-arm -I$gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/system/core/include -I$gonkdir/bionic $STLPORT_CPPFLAGS $CPPFLAGS"
  276. CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
  277. CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
  278. LIBS="$LIBS $STLPORT_LIBS"
  279. dnl Add -llog by default, since we use it all over the place.
  280. LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ -llog $LDFLAGS"
  281. dnl prevent cross compile section from using these flags as host flags
  282. if test -z "$HOST_CPPFLAGS" ; then
  283. HOST_CPPFLAGS=" "
  284. fi
  285. if test -z "$HOST_CFLAGS" ; then
  286. HOST_CFLAGS=" "
  287. fi
  288. if test -z "$HOST_CXXFLAGS" ; then
  289. HOST_CXXFLAGS=" "
  290. fi
  291. if test -z "$HOST_LDFLAGS" ; then
  292. HOST_LDFLAGS=" "
  293. fi
  294. # save these for libffi's subconfigure,
  295. # which doesn't know how to figure this stuff out on its own
  296. ANDROID_CFLAGS="$CFLAGS"
  297. ANDROID_CPPFLAGS="$CPPFLAGS"
  298. ANDROID_LDFLAGS="$LDFLAGS"
  299. AC_DEFINE(ANDROID)
  300. AC_DEFINE(GONK)
  301. CROSS_COMPILE=1
  302. else
  303. case "$target" in
  304. *-android*|*-linuxandroid*)
  305. if test -z "$android_ndk" ; then
  306. AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
  307. fi
  308. if test -z "$android_sdk" ; then
  309. AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
  310. fi
  311. android_platform_tools="$android_sdk"/../../platform-tools
  312. if test ! -d "$android_platform_tools" ; then
  313. android_platform_tools="$android_sdk"/tools # SDK Tools < r8
  314. else
  315. if ! test -e "$android_sdk"/source.properties ; then
  316. AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
  317. fi
  318. # Minimum Android SDK API Level we require.
  319. android_min_api_level=13
  320. # Get the api level from "$android_sdk"/source.properties.
  321. android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties`
  322. if test -z "$android_api_level" ; then
  323. AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
  324. fi
  325. if ! test "$android_api_level" -eq "$android_api_level" ; then
  326. AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
  327. fi
  328. if test $android_api_level -lt $android_min_api_level ; then
  329. AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).])
  330. fi
  331. fi
  332. if test -z "$android_toolchain" ; then
  333. AC_MSG_CHECKING([for android toolchain directory])
  334. kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
  335. android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
  336. # With newer NDK, the toolchain path has changed.
  337. if ! test -d "$android_toolchain" ; then
  338. android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
  339. fi
  340. if test -d "$android_toolchain" ; then
  341. AC_MSG_RESULT([$android_toolchain])
  342. else
  343. AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
  344. fi
  345. fi
  346. if test -z "$android_platform" ; then
  347. AC_MSG_CHECKING([for android platform directory])
  348. android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
  349. # With newer NDK, the platform path has changed.
  350. if ! test -d "$android_platform" ; then
  351. android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
  352. fi
  353. if test -d "$android_platform" ; then
  354. AC_MSG_RESULT([$android_platform])
  355. else
  356. AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
  357. fi
  358. fi
  359. dnl set up compilers
  360. AS="$android_toolchain"/bin/"$android_tool_prefix"-as
  361. CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
  362. CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
  363. CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
  364. LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
  365. AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
  366. RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
  367. STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
  368. CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
  369. CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
  370. CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
  371. dnl Add -llog by default, since we use it all over the place.
  372. dnl Add --allow-shlib-undefined, because libGLESv2 links to an
  373. dnl undefined symbol (present on the hardware, just not in the
  374. dnl NDK.)
  375. LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
  376. dnl prevent cross compile section from using these flags as host flags
  377. if test -z "$HOST_CPPFLAGS" ; then
  378. HOST_CPPFLAGS=" "
  379. fi
  380. if test -z "$HOST_CFLAGS" ; then
  381. HOST_CFLAGS=" "
  382. fi
  383. if test -z "$HOST_CXXFLAGS" ; then
  384. HOST_CXXFLAGS=" "
  385. fi
  386. if test -z "$HOST_LDFLAGS" ; then
  387. HOST_LDFLAGS=" "
  388. fi
  389. ANDROID_NDK="${android_ndk}"
  390. ANDROID_TOOLCHAIN="${android_toolchain}"
  391. ANDROID_PLATFORM="${android_platform}"
  392. ANDROID_SDK="${android_sdk}"
  393. ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
  394. ANDROID_VERSION="${android_version}"
  395. AC_DEFINE(ANDROID)
  396. AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
  397. AC_SUBST(ANDROID_VERSION)
  398. CROSS_COMPILE=1
  399. MOZ_CHROME_FILE_FORMAT=omni
  400. ;;
  401. esac
  402. fi
  403. AC_SUBST(ANDROID_NDK)
  404. AC_SUBST(ANDROID_TOOLCHAIN)
  405. AC_SUBST(ANDROID_PLATFORM)
  406. AC_SUBST(ANDROID_SDK)
  407. AC_SUBST(ANDROID_PLATFORM_TOOLS)
  408. dnl ========================================================
  409. dnl Checks for compilers.
  410. dnl ========================================================
  411. dnl Set CROSS_COMPILE in the environment when running configure
  412. dnl to use the cross-compile setup for now
  413. dnl ========================================================
  414. dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
  415. AR_FLAGS='cr $@'
  416. if test "$COMPILE_ENVIRONMENT"; then
  417. # Note:
  418. # In Mozilla, we use the names $target, $host and $build incorrectly, but are
  419. # too far gone to back out now. See Bug 475488:
  420. # - When we say $target, we mean $host, that is, the system on which
  421. # Mozilla will be run.
  422. # - When we say $host, we mean $build, that is, the system on which Mozilla
  423. # is built.
  424. # - $target (in its correct usage) is for compilers who generate code for a
  425. # different platform than $host, so it would not be used by Mozilla.
  426. if test "$target" != "$host"; then
  427. echo "cross compiling from $host to $target"
  428. _SAVE_CC="$CC"
  429. _SAVE_CFLAGS="$CFLAGS"
  430. _SAVE_LDFLAGS="$LDFLAGS"
  431. AC_MSG_CHECKING([for host c compiler])
  432. AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
  433. if test -z "$HOST_CC"; then
  434. AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
  435. fi
  436. AC_MSG_RESULT([$HOST_CC])
  437. AC_MSG_CHECKING([for host c++ compiler])
  438. AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
  439. if test -z "$HOST_CXX"; then
  440. AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
  441. fi
  442. AC_MSG_RESULT([$HOST_CXX])
  443. if test -z "$HOST_CFLAGS"; then
  444. HOST_CFLAGS="$CFLAGS"
  445. fi
  446. if test -z "$HOST_CXXFLAGS"; then
  447. HOST_CXXFLAGS="$CXXFLAGS"
  448. fi
  449. if test -z "$HOST_LDFLAGS"; then
  450. HOST_LDFLAGS="$LDFLAGS"
  451. fi
  452. if test -z "$HOST_AR_FLAGS"; then
  453. HOST_AR_FLAGS="$AR_FLAGS"
  454. fi
  455. AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
  456. AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
  457. CC="$HOST_CC"
  458. CFLAGS="$HOST_CFLAGS"
  459. LDFLAGS="$HOST_LDFLAGS"
  460. AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
  461. AC_TRY_COMPILE([], [return(0);],
  462. [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
  463. AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
  464. CC="$HOST_CXX"
  465. CFLAGS="$HOST_CXXFLAGS"
  466. AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
  467. AC_TRY_COMPILE([], [return(0);],
  468. [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
  469. AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
  470. CC=$_SAVE_CC
  471. CFLAGS=$_SAVE_CFLAGS
  472. LDFLAGS=$_SAVE_LDFLAGS
  473. AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
  474. unset ac_cv_prog_CC
  475. AC_PROG_CC
  476. AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
  477. unset ac_cv_prog_CXX
  478. AC_PROG_CXX
  479. AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
  480. AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
  481. MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
  482. AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
  483. AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
  484. AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
  485. AC_DEFINE(CROSS_COMPILE)
  486. dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
  487. dnl have erroneously been set to "no", because the x86 build host is
  488. dnl able to run ppc code in a translated environment, making a cross
  489. dnl compiler appear native. So we override that here.
  490. cross_compiling=yes
  491. else
  492. AC_PROG_CC
  493. AC_PROG_CXX
  494. AC_PROG_RANLIB
  495. MOZ_PATH_PROGS(AS, $AS as, $CC)
  496. AC_CHECK_PROGS(AR, ar, :)
  497. AC_CHECK_PROGS(LD, ld, :)
  498. AC_CHECK_PROGS(STRIP, strip, :)
  499. AC_CHECK_PROGS(WINDRES, windres, :)
  500. if test -z "$HOST_CC"; then
  501. HOST_CC='$(CC)'
  502. fi
  503. if test -z "$HOST_CFLAGS"; then
  504. HOST_CFLAGS='$(CFLAGS)'
  505. fi
  506. if test -z "$HOST_CXX"; then
  507. HOST_CXX='$(CXX)'
  508. fi
  509. if test -z "$HOST_CXXFLAGS"; then
  510. HOST_CXXFLAGS='$(CXXFLAGS)'
  511. fi
  512. if test -z "$HOST_LDFLAGS"; then
  513. HOST_LDFLAGS='$(LDFLAGS)'
  514. fi
  515. if test -z "$HOST_RANLIB"; then
  516. HOST_RANLIB='$(RANLIB)'
  517. fi
  518. if test -z "$HOST_AR"; then
  519. HOST_AR='$(AR)'
  520. fi
  521. if test -z "$HOST_AR_FLAGS"; then
  522. HOST_AR_FLAGS='$(AR_FLAGS)'
  523. fi
  524. fi
  525. GNU_AS=
  526. GNU_LD=
  527. GNU_CC=
  528. GNU_CXX=
  529. CC_VERSION='N/A'
  530. CXX_VERSION='N/A'
  531. if test "$GCC" = "yes"; then
  532. GNU_CC=1
  533. CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
  534. fi
  535. if test "$GXX" = "yes"; then
  536. GNU_CXX=1
  537. CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
  538. fi
  539. if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
  540. GNU_AS=1
  541. fi
  542. if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
  543. GNU_LD=1
  544. fi
  545. if test "$GNU_CC"; then
  546. if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
  547. GCC_USE_GNU_LD=1
  548. fi
  549. fi
  550. INTEL_CC=
  551. INTEL_CXX=
  552. if test "$GCC" = yes; then
  553. if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
  554. INTEL_CC=1
  555. fi
  556. fi
  557. if test "$GXX" = yes; then
  558. if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
  559. INTEL_CXX=1
  560. fi
  561. fi
  562. CLANG_CC=
  563. CLANG_CXX=
  564. if test "$GCC" = yes; then
  565. if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
  566. CLANG_CC=1
  567. fi
  568. fi
  569. if test "$GXX" = yes; then
  570. if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
  571. CLANG_CXX=1
  572. fi
  573. fi
  574. dnl Special win32 checks
  575. dnl ========================================================
  576. WINVER=502
  577. dnl Target the Windows 7 SDK by default
  578. WINSDK_TARGETVER=601
  579. MOZ_ARG_WITH_STRING(windows-version,
  580. [ --with-windows-version=WINSDK_TARGETVER
  581. Highest Windows version to target using this SDK
  582. 601: Windows 7],
  583. WINSDK_TARGETVER=$withval)
  584. case "$WINSDK_TARGETVER" in
  585. 601)
  586. MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
  587. ;;
  588. *)
  589. AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 601]);
  590. ;;
  591. esac
  592. case "$target" in
  593. *-mingw*)
  594. if test "$GCC" != "yes"; then
  595. # Check to see if we are really running in a msvc environemnt
  596. _WIN32_MSVC=1
  597. # Make sure compilers are valid
  598. CFLAGS="$CFLAGS -TC -nologo"
  599. CXXFLAGS="$CXXFLAGS -TP -nologo"
  600. # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
  601. # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
  602. # secure CRT functions.
  603. CXXFLAGS="$CXXFLAGS -wd4345 -D_CRT_SECURE_NO_WARNINGS"
  604. AC_LANG_SAVE
  605. AC_LANG_C
  606. AC_TRY_COMPILE([#include <stdio.h>],
  607. [ printf("Hello World\n"); ],,
  608. AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
  609. AC_LANG_CPLUSPLUS
  610. AC_TRY_COMPILE([#include <new.h>],
  611. [ unsigned *test = new unsigned(42); ],,
  612. AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
  613. AC_LANG_RESTORE
  614. changequote(,)
  615. _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
  616. changequote([,])
  617. # Determine compiler version
  618. CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
  619. _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
  620. _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
  621. _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
  622. _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
  623. _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
  624. CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
  625. _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
  626. if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
  627. AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
  628. fi
  629. if test "$_CC_MAJOR_VERSION" = "14"; then
  630. dnl Require VC8SP1 or newer.
  631. dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
  632. if test "$_CC_RELEASE" -lt 50727 -o \
  633. \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
  634. AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
  635. fi
  636. _CC_SUITE=8
  637. AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
  638. AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
  639. elif test "$_CC_MAJOR_VERSION" = "15"; then
  640. _CC_SUITE=9
  641. AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
  642. AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
  643. elif test "$_CC_MAJOR_VERSION" = "16"; then
  644. _CC_SUITE=10
  645. AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
  646. AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
  647. elif test "$_CC_MAJOR_VERSION" = "17"; then
  648. _CC_SUITE=11
  649. AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
  650. AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
  651. else
  652. AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
  653. fi
  654. _MOZ_RTTI_FLAGS_ON='-GR'
  655. _MOZ_RTTI_FLAGS_OFF='-GR-'
  656. dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
  657. dnl not something else like "magnetic tape manipulation utility".
  658. MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
  659. if test -z "$MSMT_TOOL"; then
  660. AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
  661. fi
  662. changequote(,)
  663. _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
  664. changequote([,])
  665. MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
  666. if test -z "$MSMANIFEST_TOOL_VERSION"; then
  667. AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
  668. fi
  669. MSMANIFEST_TOOL=1
  670. unset MSMT_TOOL
  671. # Check linker version
  672. _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
  673. _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
  674. if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
  675. AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
  676. fi
  677. INCREMENTAL_LINKER=1
  678. # Identify which version of the SDK we're building with
  679. # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
  680. # from there
  681. MOZ_CHECK_HEADERS([winsdkver.h])
  682. if test "$ac_cv_header_winsdkver_h" = "yes"; then
  683. # Get the highest _WIN32_WINNT and NTDDI versions supported
  684. # Take the higher of the two
  685. # This is done because the Windows 7 beta SDK reports its
  686. # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
  687. AC_CACHE_CHECK(for highest Windows version supported by this SDK,
  688. ac_cv_winsdk_maxver,
  689. [cat > conftest.h <<EOF
  690. #include <winsdkver.h>
  691. #include <sdkddkver.h>
  692. #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
  693. #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
  694. #else
  695. #define WINSDK_MAXVER NTDDI_MAXVER
  696. #endif
  697. WINSDK_MAXVER
  698. EOF
  699. ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
  700. rm -f conftest.h
  701. ])
  702. MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
  703. else
  704. # Any SDK which doesn't have WinSDKVer.h is too old.
  705. AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
  706. fi
  707. unset _MSVC_VER_FILTER
  708. AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
  709. [
  710. AC_LANG_SAVE
  711. AC_LANG_CPLUSPLUS
  712. _SAVE_CXXFLAGS="$CXXFLAGS"
  713. CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
  714. AC_TRY_COMPILE([#include <exception>],
  715. [std::_Throw(std::exception()); return 0;],
  716. ac_cv_have_std__Throw="yes",
  717. ac_cv_have_std__Throw="no")
  718. CXXFLAGS="$_SAVE_CXXFLAGS"
  719. AC_LANG_RESTORE
  720. ])
  721. if test "$ac_cv_have_std__Throw" == "yes"; then
  722. AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
  723. ac_cv_have_dllimport_exception_bug,
  724. [
  725. AC_LANG_SAVE
  726. AC_LANG_CPLUSPLUS
  727. _SAVE_CXXFLAGS="$CXXFLAGS"
  728. CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
  729. AC_TRY_LINK([#include <vector>],
  730. [std::vector<int> v; return v.at(1);],
  731. ac_cv_have_dllimport_exception_bug="no",
  732. ac_cv_have_dllimport_exception_bug="yes")
  733. CXXFLAGS="$_SAVE_CXXFLAGS"
  734. AC_LANG_RESTORE
  735. ])
  736. if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
  737. WRAP_STL_INCLUDES=1
  738. MOZ_MSVC_STL_WRAP__Throw=1
  739. AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
  740. fi
  741. else
  742. AC_CACHE_CHECK(for overridable _RAISE,
  743. ac_cv_have__RAISE,
  744. [
  745. AC_LANG_SAVE
  746. AC_LANG_CPLUSPLUS
  747. _SAVE_CXXFLAGS="$CXXFLAGS"
  748. CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
  749. AC_TRY_COMPILE([#include <xstddef>
  750. #undef _RAISE
  751. #define _RAISE(x) externallyDefinedFunction((x).what())
  752. #include <vector>
  753. ],
  754. [std::vector<int> v; return v.at(1);],
  755. ac_cv_have__RAISE="no",
  756. ac_cv_have__RAISE="yes")
  757. CXXFLAGS="$_SAVE_CXXFLAGS"
  758. AC_LANG_RESTORE
  759. ])
  760. if test "$ac_cv_have__RAISE" = "yes"; then
  761. WRAP_STL_INCLUDES=1
  762. MOZ_MSVC_STL_WRAP__RAISE=1
  763. AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
  764. else
  765. AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
  766. fi
  767. fi
  768. if test "$WRAP_STL_INCLUDES" = "1"; then
  769. STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
  770. fi
  771. else
  772. # Check w32api version
  773. _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
  774. _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
  775. AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
  776. AC_TRY_COMPILE([#include <w32api.h>],
  777. #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
  778. (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
  779. __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
  780. #error "test failed."
  781. #endif
  782. , [ res=yes ], [ res=no ])
  783. AC_MSG_RESULT([$res])
  784. if test "$res" != "yes"; then
  785. AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
  786. fi
  787. # Check windres version
  788. AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
  789. _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
  790. AC_MSG_RESULT([$_WINDRES_VERSION])
  791. _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
  792. _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
  793. _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
  794. WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
  795. WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
  796. WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
  797. if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
  798. "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
  799. "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
  800. "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
  801. "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
  802. "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
  803. then
  804. AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
  805. fi
  806. MOZ_WINSDK_MAXVER=0x06010000
  807. fi # !GNU_CC
  808. AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
  809. AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
  810. # Require OS features provided by IE 5.0
  811. AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
  812. # If the maximum version supported by this SDK is lower than the target
  813. # version, error out
  814. AC_MSG_CHECKING([for Windows SDK being recent enough])
  815. if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
  816. AC_MSG_RESULT("yes")
  817. else
  818. AC_MSG_RESULT("no")
  819. AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
  820. fi
  821. AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
  822. # Definitions matching sdkddkver.h
  823. AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
  824. AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
  825. AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
  826. ;;
  827. esac
  828. AC_PROG_CPP
  829. AC_PROG_CXXCPP
  830. if test -n "$_WIN32_MSVC"; then
  831. SKIP_PATH_CHECKS=1
  832. SKIP_COMPILER_CHECKS=1
  833. SKIP_LIBRARY_CHECKS=1
  834. # Since we're skipping compiler and library checks, hard-code
  835. # some facts here.
  836. # Common to all MSVC environments:
  837. # Windows lacks <stdint.h>, but has __int8, and so on.
  838. AC_DEFINE(JS_HAVE___INTN)
  839. AC_DEFINE(HAVE_LOCALECONV)
  840. AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
  841. AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
  842. # Windows <stddef.h> defines intptr_t and uintptr_t.
  843. # VS2005: http://msdn.microsoft.com/en-us/library/323b6b3k(VS.80).aspx
  844. # VS2008: http://msdn.microsoft.com/en-us/library/323b6b3k.aspx
  845. AC_DEFINE(JS_STDDEF_H_HAS_INTPTR_T)
  846. fi
  847. fi # COMPILE_ENVIRONMENT
  848. if test "$cross_compiling" = "yes"; then
  849. CROSS_COMPILE=1
  850. else
  851. CROSS_COMPILE=
  852. fi
  853. # Check to see if we are running in a broken QEMU scratchbox.
  854. # We know that anything below 1.0.16 is broken.
  855. AC_CHECK_PROGS(SBCONF, sb-conf ve, "")
  856. if test -n "$SBCONF"; then
  857. _sb_version=`$SBCONF ve`
  858. _sb_version_major=`echo $_sb_version | cut -f1 -d.`
  859. _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
  860. _sb_version_point=`echo $_sb_version | cut -f3 -d.`
  861. if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
  862. QEMU_CANT_RUN_JS_SHELL=1
  863. fi
  864. fi
  865. AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
  866. AC_SUBST(_MSC_VER)
  867. AC_SUBST(GNU_AS)
  868. AC_SUBST(GNU_LD)
  869. AC_SUBST(GNU_CC)
  870. AC_SUBST(GNU_CXX)
  871. AC_SUBST(INTEL_CC)
  872. AC_SUBST(INTEL_CXX)
  873. AC_SUBST(STL_FLAGS)
  874. AC_SUBST(WRAP_STL_INCLUDES)
  875. AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
  876. AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
  877. dnl ========================================================
  878. dnl Checks for programs.
  879. dnl ========================================================
  880. AC_PROG_INSTALL
  881. AC_PROG_LN_S
  882. if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
  883. AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
  884. _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
  885. _perl_res=$?
  886. AC_MSG_RESULT([$_perl_version])
  887. if test "$_perl_res" != 0; then
  888. AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
  889. fi
  890. fi
  891. AC_MSG_CHECKING([for full perl installation])
  892. _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
  893. _perl_res=$?
  894. if test "$_perl_res" != 0; then
  895. AC_MSG_RESULT([no])
  896. AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
  897. else
  898. AC_MSG_RESULT([yes])
  899. fi
  900. MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
  901. if test -z "$PYTHON"; then
  902. AC_MSG_ERROR([python was not found in \$PATH])
  903. fi
  904. if test -z "$COMPILE_ENVIRONMENT"; then
  905. NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
  906. fi
  907. AC_SUBST(NSINSTALL_BIN)
  908. MOZ_PATH_PROG(DOXYGEN, doxygen, :)
  909. MOZ_PATH_PROG(AUTOCONF, autoconf, :)
  910. MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
  911. MOZ_PATH_PROG(XARGS, xargs)
  912. if test -z "$XARGS" -o "$XARGS" = ":"; then
  913. AC_MSG_ERROR([xargs not found in \$PATH .])
  914. fi
  915. if test "$COMPILE_ENVIRONMENT"; then
  916. dnl ========================================================
  917. dnl = Mac OS X toolchain support
  918. dnl ========================================================
  919. case "$target_os" in
  920. darwin*)
  921. dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
  922. dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
  923. dnl the environment and includedir purposes (when using an SDK, below),
  924. dnl but remember the full version number for the libdir (SDK).
  925. changequote(,)
  926. GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
  927. GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
  928. changequote([,])
  929. if test "$GCC_VERSION_FULL" = "4.0.0" ; then
  930. dnl Bug 280479, but this keeps popping up in bug 292530 too because
  931. dnl 4.0.0/4061 is the default compiler in Tiger.
  932. changequote(,)
  933. GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
  934. changequote([,])
  935. if test "$GCC_BUILD" = "4061" ; then
  936. AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
  937. This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
  938. from building Mozilla. Upgrade to Xcode 2.1 or later.])
  939. fi
  940. fi
  941. dnl xcodebuild needs GCC_VERSION defined in the environment, since it
  942. dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
  943. dnl /usr/bin/g(cc|++)-$GCC_VERSION.
  944. MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
  945. dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
  946. dnl it has moved into /usr/bin.
  947. MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
  948. ;;
  949. esac
  950. AC_SUBST(GCC_VERSION)
  951. dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
  952. dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
  953. dnl when we can run target binaries.
  954. AC_SUBST(UNIVERSAL_BINARY)
  955. AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
  956. dnl ========================================================
  957. dnl Check for MacOS deployment target version
  958. dnl ========================================================
  959. MOZ_ARG_ENABLE_STRING(macos-target,
  960. [ --enable-macos-target=VER (default=10.5)
  961. Set the minimum MacOS version needed at runtime],
  962. [_MACOSX_DEPLOYMENT_TARGET=$enableval])
  963. if test "$target_cpu" != "arm"; then
  964. case "$target" in
  965. *-darwin*)
  966. if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
  967. dnl Use the specified value
  968. export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
  969. else
  970. dnl No value specified on the command line or in the environment,
  971. dnl use architecture minimum.
  972. case "${target_cpu}" in
  973. i*86)
  974. export MACOSX_DEPLOYMENT_TARGET=10.5
  975. ;;
  976. x86_64)
  977. export MACOSX_DEPLOYMENT_TARGET=10.6
  978. ;;
  979. esac
  980. fi
  981. ;;
  982. esac
  983. fi
  984. AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
  985. dnl ========================================================
  986. dnl = Mac OS X SDK support
  987. dnl ========================================================
  988. MACOS_SDK_DIR=
  989. NEXT_ROOT=
  990. MOZ_ARG_WITH_STRING(macos-sdk,
  991. [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
  992. MACOS_SDK_DIR=$withval)
  993. dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
  994. dnl NEXT_ROOT will be set and exported only if it's needed.
  995. AC_SUBST(MACOS_SDK_DIR)
  996. AC_SUBST(NEXT_ROOT)
  997. if test "$MACOS_SDK_DIR"; then
  998. dnl Sync this section with the ones in NSPR and NSS.
  999. dnl Changes to the cross environment here need to be accounted for in
  1000. dnl the libIDL checks (below) and xpidl build.
  1001. if test ! -d "$MACOS_SDK_DIR"; then
  1002. AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
  1003. specify a valid SDK. SDKs are installed when the optional cross-development
  1004. tools are selected during the Xcode/Developer Tools installation.])
  1005. fi
  1006. GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
  1007. if test "$GCC_VERSION_MAJOR" -lt "4" ; then
  1008. AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
  1009. else
  1010. CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
  1011. CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
  1012. dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
  1013. CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
  1014. CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
  1015. if test "$GCC_VERSION_FULL" = "4.0.0" ; then
  1016. dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
  1017. dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
  1018. dnl be ignored and cause warnings when -syslibroot is specified.
  1019. dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
  1020. dnl the -isysroot it receives, so this is only needed with 4.0.0.
  1021. LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
  1022. fi
  1023. fi
  1024. AC_LANG_SAVE
  1025. AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
  1026. AC_LANG_CPLUSPLUS
  1027. AC_TRY_COMPILE([#include <new>
  1028. int main() { return 0; }],
  1029. result=yes,
  1030. result=no)
  1031. AC_LANG_RESTORE
  1032. AC_MSG_RESULT($result)
  1033. if test "$result" = "no" ; then
  1034. AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
  1035. fi
  1036. fi
  1037. fi # COMPILE_ENVIRONMENT
  1038. if test -n "$MAKE"; then
  1039. if test `echo $MAKE | grep -c make.py` != 1; then
  1040. NOT_PYMAKE=$MAKE
  1041. fi
  1042. fi
  1043. case "$host_os" in
  1044. mingw*)
  1045. MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
  1046. ;;
  1047. *)
  1048. MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
  1049. ;;
  1050. esac
  1051. if test "$GMAKE" = ":"; then
  1052. AC_MSG_ERROR([GNU make not found])
  1053. fi
  1054. AC_SUBST(GMAKE)
  1055. # MAKE will be set by client.mk, but still need this for standalone js builds
  1056. if test -z "$MAKE"; then
  1057. MAKE=$GMAKE
  1058. fi
  1059. if test "$COMPILE_ENVIRONMENT"; then
  1060. AC_PATH_XTRA
  1061. XCFLAGS="$X_CFLAGS"
  1062. fi # COMPILE_ENVIRONMENT
  1063. dnl ========================================================
  1064. dnl set the defaults first
  1065. dnl ========================================================
  1066. AS_BIN=$AS
  1067. AR_LIST='$(AR) t'
  1068. AR_EXTRACT='$(AR) x'
  1069. AR_DELETE='$(AR) d'
  1070. AS='$(CC)'
  1071. AS_DASH_C_FLAG='-c'
  1072. DLL_PREFIX=lib
  1073. LIB_PREFIX=lib
  1074. DLL_SUFFIX=.so
  1075. OBJ_SUFFIX=o
  1076. LIB_SUFFIX=a
  1077. ASM_SUFFIX=s
  1078. IMPORT_LIB_SUFFIX=
  1079. TARGET_MD_ARCH=unix
  1080. DIRENT_INO=d_ino
  1081. WIN_TOP_SRC=
  1082. MOZ_USER_DIR=".mozilla"
  1083. MOZ_JS_LIBS='-L$(libdir) -lmozjs'
  1084. MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
  1085. MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
  1086. USE_DEPENDENT_LIBS=1
  1087. _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
  1088. if test -n "$CROSS_COMPILE"; then
  1089. OS_TARGET="${target_os}"
  1090. OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
  1091. OS_RELEASE=
  1092. case "${target_os}" in
  1093. linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
  1094. kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
  1095. gnu*) OS_ARCH=GNU ;;
  1096. solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
  1097. mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
  1098. darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
  1099. esac
  1100. case "${target}" in
  1101. *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
  1102. esac
  1103. else
  1104. OS_TARGET=`uname -s`
  1105. OS_ARCH=`uname -s | sed -e 's|/|_|g'`
  1106. OS_RELEASE=`uname -r`
  1107. fi
  1108. # Before this used `uname -m` when not cross compiling
  1109. # but that breaks when you have a 64 bit kernel with a 32 bit userland.
  1110. OS_TEST="${target_cpu}"
  1111. HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
  1112. #######################################################################
  1113. # Master "Core Components" macros for getting the OS target #
  1114. #######################################################################
  1115. #
  1116. # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
  1117. # cross-compilation.
  1118. #
  1119. #
  1120. # Define and override various archtecture-specific variables, including
  1121. # HOST_OS_ARCH
  1122. # OS_ARCH
  1123. # OS_TEST
  1124. # OS_TARGET
  1125. # OS_RELEASE
  1126. # OS_MINOR_RELEASE
  1127. #
  1128. case "$HOST_OS_ARCH" in
  1129. mingw*)
  1130. HOST_OS_ARCH=WINNT
  1131. ;;
  1132. darwin*)
  1133. HOST_OS_ARCH=Darwin
  1134. ;;
  1135. linux*)
  1136. HOST_OS_ARCH=Linux
  1137. ;;
  1138. solaris*)
  1139. HOST_OS_ARCH=SunOS
  1140. SOLARIS_SUNPRO_CC=
  1141. SOLARIS_SUNPRO_CXX=
  1142. if test -z "$GNU_CC"; then
  1143. if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
  1144. SOLARIS_SUNPRO_CC=1
  1145. fi
  1146. fi
  1147. if test -z "$GNU_CXX"; then
  1148. if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
  1149. SOLARIS_SUNPRO_CXX=1
  1150. fi
  1151. fi
  1152. AC_SUBST(SOLARIS_SUNPRO_CC)
  1153. AC_SUBST(SOLARIS_SUNPRO_CXX)
  1154. ;;
  1155. BSD_386)
  1156. HOST_OS_ARCH=BSD
  1157. ;;
  1158. OS_2)
  1159. HOST_OS_ARCH=OS2
  1160. ;;
  1161. esac
  1162. case "$OS_ARCH" in
  1163. WINNT)
  1164. if test -z "$CROSS_COMPILE" ; then
  1165. OS_TEST=`uname -p`
  1166. fi
  1167. ;;
  1168. Windows_NT)
  1169. #
  1170. # If uname -s returns "Windows_NT", we assume that we are using
  1171. # the uname.exe in MKS toolkit.
  1172. #
  1173. # The -r option of MKS uname only returns the major version number.
  1174. # So we need to use its -v option to get the minor version number.
  1175. # Moreover, it doesn't have the -p option, so we need to use uname -m.
  1176. #
  1177. OS_ARCH=WINNT
  1178. OS_TARGET=WINNT
  1179. OS_MINOR_RELEASE=`uname -v`
  1180. if test "$OS_MINOR_RELEASE" = "00"; then
  1181. OS_MINOR_RELEASE=0
  1182. fi
  1183. OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
  1184. ;;
  1185. MINGW*_NT*)
  1186. #
  1187. # If uname -s returns MINGW32_NT-5.1, we assume that we are using
  1188. # the uname.exe in the MSYS tools.
  1189. #
  1190. OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
  1191. OS_ARCH=WINNT
  1192. OS_TARGET=WINNT
  1193. ;;
  1194. AIX)
  1195. OS_RELEASE=`uname -v`.`uname -r`
  1196. OS_TEST=${target_cpu}
  1197. if test -z "$GNU_CC"; then
  1198. if test "`$CC -qversion 2>&1 | egrep -c 'IBM XL'`" != "0"; then
  1199. AIX_IBM_XLC=1
  1200. fi
  1201. fi
  1202. ;;
  1203. BSD_386)
  1204. OS_ARCH=BSD
  1205. ;;
  1206. OS_2)
  1207. OS_ARCH=OS2
  1208. OS_TARGET=OS2
  1209. OS_RELEASE=`uname -v`
  1210. ;;
  1211. Darwin)
  1212. case "${target_cpu}" in
  1213. powerpc*)
  1214. OS_TEST=ppc
  1215. ;;
  1216. i*86*)
  1217. OS_TEST=i386
  1218. ;;
  1219. x86_64)
  1220. OS_TEST=x86_64
  1221. ;;
  1222. *)
  1223. if test -z "$CROSS_COMPILE" ; then
  1224. OS_TEST=`uname -p`
  1225. fi
  1226. ;;
  1227. esac
  1228. ;;
  1229. esac
  1230. # Only set CPU_ARCH if we recognize the value of OS_TEST
  1231. case "$OS_TEST" in
  1232. *86 | i86pc)
  1233. CPU_ARCH=x86
  1234. ;;
  1235. powerpc64 | ppc64)
  1236. CPU_ARCH=ppc64
  1237. ;;
  1238. powerpc | ppc | rs6000)
  1239. CPU_ARCH=ppc
  1240. ;;
  1241. Alpha | alpha | ALPHA)
  1242. CPU_ARCH=Alpha
  1243. ;;
  1244. s390)
  1245. CPU_ARCH=s390
  1246. ;;
  1247. s390x)
  1248. CPU_ARCH=s390x
  1249. ;;
  1250. hppa* | parisc)
  1251. CPU_ARCH=hppa
  1252. ;;
  1253. sun4u | sparc*)
  1254. CPU_ARCH=sparc
  1255. ;;
  1256. x86_64 | ia64)
  1257. CPU_ARCH="$OS_TEST"
  1258. ;;
  1259. arm*)
  1260. CPU_ARCH=arm
  1261. ;;
  1262. mips|mipsel)
  1263. CPU_ARCH="mips"
  1264. ;;
  1265. esac
  1266. if test -z "$OS_TARGET"; then
  1267. OS_TARGET=$OS_ARCH
  1268. fi
  1269. OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
  1270. dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
  1271. dnl ===============================================================
  1272. INTEL_ARCHITECTURE=
  1273. case "$OS_TEST" in
  1274. x86_64|i?86)
  1275. INTEL_ARCHITECTURE=1
  1276. esac
  1277. dnl ========================================================
  1278. dnl = ARM toolchain tweaks
  1279. dnl ========================================================
  1280. dnl Defaults
  1281. case "${CPU_ARCH}-${OS_TARGET}" in
  1282. arm-Android)
  1283. MOZ_THUMB=yes
  1284. MOZ_ARCH=armv7-a
  1285. MOZ_FPU=vfp
  1286. MOZ_FLOAT_ABI=softfp
  1287. ;;
  1288. arm-Darwin)
  1289. MOZ_THUMB=yes
  1290. ;;
  1291. arm-*)
  1292. if test -n "$MOZ_PLATFORM_MAEMO"; then
  1293. MOZ_THUMB=no
  1294. MOZ_ARCH=armv7-a
  1295. MOZ_FLOAT_ABI=softfp
  1296. fi
  1297. if test "$MOZ_PLATFORM_MAEMO" = 6; then
  1298. MOZ_THUMB=yes
  1299. fi
  1300. ;;
  1301. esac
  1302. dnl Kept for compatibility with some buildbot mozconfig
  1303. MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
  1304. MOZ_ARG_WITH_STRING(thumb,
  1305. [ --with-thumb[[=yes|no|toolchain-default]]]
  1306. [ Use Thumb instruction set (-mthumb)