configure.in 82 KB

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