curl-compilers.m4 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at http://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. #***************************************************************************
  22. # File version for 'aclocal' use. Keep it a single number.
  23. # serial 63
  24. dnl CURL_CHECK_COMPILER
  25. dnl -------------------------------------------------
  26. dnl Verify if the C compiler being used is known.
  27. AC_DEFUN([CURL_CHECK_COMPILER], [
  28. #
  29. compiler_id="unknown"
  30. compiler_num="0"
  31. #
  32. flags_dbg_all="unknown"
  33. flags_dbg_yes="unknown"
  34. flags_dbg_off="unknown"
  35. flags_opt_all="unknown"
  36. flags_opt_yes="unknown"
  37. flags_opt_off="unknown"
  38. #
  39. flags_prefer_cppflags="no"
  40. #
  41. CURL_CHECK_COMPILER_DEC_C
  42. CURL_CHECK_COMPILER_HPUX_C
  43. CURL_CHECK_COMPILER_IBM_C
  44. CURL_CHECK_COMPILER_INTEL_C
  45. CURL_CHECK_COMPILER_CLANG
  46. CURL_CHECK_COMPILER_GNU_C
  47. CURL_CHECK_COMPILER_LCC
  48. CURL_CHECK_COMPILER_SGI_MIPSPRO_C
  49. CURL_CHECK_COMPILER_SGI_MIPS_C
  50. CURL_CHECK_COMPILER_SUNPRO_C
  51. CURL_CHECK_COMPILER_TINY_C
  52. CURL_CHECK_COMPILER_WATCOM_C
  53. #
  54. if test "$compiler_id" = "unknown"; then
  55. cat <<_EOF 1>&2
  56. ***
  57. *** Warning: This configure script does not have information about the
  58. *** compiler you are using, relative to the flags required to enable or
  59. *** disable generation of debug info, optimization options or warnings.
  60. ***
  61. *** Whatever settings are present in CFLAGS will be used for this run.
  62. ***
  63. *** If you wish to help the cURL project to better support your compiler
  64. *** you can report this and the required info on the libcurl development
  65. *** mailing list: http://cool.haxx.se/mailman/listinfo/curl-library/
  66. ***
  67. _EOF
  68. fi
  69. ])
  70. dnl CURL_CHECK_COMPILER_CLANG
  71. dnl -------------------------------------------------
  72. dnl Verify if compiler being used is clang.
  73. AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
  74. AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl
  75. AC_MSG_CHECKING([if compiler is clang])
  76. CURL_CHECK_DEF([__clang__], [], [silent])
  77. if test "$curl_cv_have_def___clang__" = "yes"; then
  78. AC_MSG_RESULT([yes])
  79. compiler_id="CLANG"
  80. clangver=`$CC -dumpversion`
  81. clangvhi=`echo $clangver | cut -d . -f1`
  82. clangvlo=`echo $clangver | cut -d . -f2`
  83. compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
  84. flags_dbg_all="-g -g0 -g1 -g2 -g3"
  85. flags_dbg_all="$flags_dbg_all -ggdb"
  86. flags_dbg_all="$flags_dbg_all -gstabs"
  87. flags_dbg_all="$flags_dbg_all -gstabs+"
  88. flags_dbg_all="$flags_dbg_all -gcoff"
  89. flags_dbg_all="$flags_dbg_all -gxcoff"
  90. flags_dbg_all="$flags_dbg_all -gdwarf-2"
  91. flags_dbg_all="$flags_dbg_all -gvms"
  92. flags_dbg_yes="-g"
  93. flags_dbg_off="-g0"
  94. flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
  95. flags_opt_yes="-Os"
  96. flags_opt_off="-O0"
  97. else
  98. AC_MSG_RESULT([no])
  99. fi
  100. ])
  101. dnl CURL_CHECK_COMPILER_DEC_C
  102. dnl -------------------------------------------------
  103. dnl Verify if compiler being used is DEC C.
  104. AC_DEFUN([CURL_CHECK_COMPILER_DEC_C], [
  105. AC_MSG_CHECKING([if compiler is DEC/Compaq/HP C])
  106. CURL_CHECK_DEF([__DECC], [], [silent])
  107. CURL_CHECK_DEF([__DECC_VER], [], [silent])
  108. if test "$curl_cv_have_def___DECC" = "yes" &&
  109. test "$curl_cv_have_def___DECC_VER" = "yes"; then
  110. AC_MSG_RESULT([yes])
  111. compiler_id="DEC_C"
  112. flags_dbg_all="-g -g0 -g1 -g2 -g3"
  113. flags_dbg_yes="-g2"
  114. flags_dbg_off="-g0"
  115. flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
  116. flags_opt_yes="-O1"
  117. flags_opt_off="-O0"
  118. else
  119. AC_MSG_RESULT([no])
  120. fi
  121. ])
  122. dnl CURL_CHECK_COMPILER_GNU_C
  123. dnl -------------------------------------------------
  124. dnl Verify if compiler being used is GNU C.
  125. AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
  126. AC_REQUIRE([CURL_CHECK_COMPILER_INTEL_C])dnl
  127. AC_REQUIRE([CURL_CHECK_COMPILER_CLANG])dnl
  128. AC_MSG_CHECKING([if compiler is GNU C])
  129. CURL_CHECK_DEF([__GNUC__], [], [silent])
  130. if test "$curl_cv_have_def___GNUC__" = "yes" &&
  131. test "$compiler_id" = "unknown"; then
  132. AC_MSG_RESULT([yes])
  133. compiler_id="GNU_C"
  134. gccver=`$CC -dumpversion`
  135. gccvhi=`echo $gccver | cut -d . -f1`
  136. gccvlo=`echo $gccver | cut -d . -f2`
  137. compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
  138. flags_dbg_all="-g -g0 -g1 -g2 -g3"
  139. flags_dbg_all="$flags_dbg_all -ggdb"
  140. flags_dbg_all="$flags_dbg_all -gstabs"
  141. flags_dbg_all="$flags_dbg_all -gstabs+"
  142. flags_dbg_all="$flags_dbg_all -gcoff"
  143. flags_dbg_all="$flags_dbg_all -gxcoff"
  144. flags_dbg_all="$flags_dbg_all -gdwarf-2"
  145. flags_dbg_all="$flags_dbg_all -gvms"
  146. flags_dbg_yes="-g"
  147. flags_dbg_off="-g0"
  148. flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
  149. flags_opt_yes="-O2"
  150. flags_opt_off="-O0"
  151. CURL_CHECK_DEF([_WIN32], [], [silent])
  152. else
  153. AC_MSG_RESULT([no])
  154. fi
  155. ])
  156. dnl CURL_CHECK_COMPILER_HPUX_C
  157. dnl -------------------------------------------------
  158. dnl Verify if compiler being used is HP-UX C.
  159. AC_DEFUN([CURL_CHECK_COMPILER_HPUX_C], [
  160. AC_MSG_CHECKING([if compiler is HP-UX C])
  161. CURL_CHECK_DEF([__HP_cc], [], [silent])
  162. if test "$curl_cv_have_def___HP_cc" = "yes"; then
  163. AC_MSG_RESULT([yes])
  164. compiler_id="HP_UX_C"
  165. flags_dbg_all="-g -s"
  166. flags_dbg_yes="-g"
  167. flags_dbg_off="-s"
  168. flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
  169. flags_opt_yes="+O2"
  170. flags_opt_off="+O0"
  171. else
  172. AC_MSG_RESULT([no])
  173. fi
  174. ])
  175. dnl CURL_CHECK_COMPILER_IBM_C
  176. dnl -------------------------------------------------
  177. dnl Verify if compiler being used is IBM C.
  178. AC_DEFUN([CURL_CHECK_COMPILER_IBM_C], [
  179. AC_MSG_CHECKING([if compiler is IBM C])
  180. CURL_CHECK_DEF([__IBMC__], [], [silent])
  181. if test "$curl_cv_have_def___IBMC__" = "yes"; then
  182. AC_MSG_RESULT([yes])
  183. compiler_id="IBM_C"
  184. flags_dbg_all="-g -g0 -g1 -g2 -g3"
  185. flags_dbg_yes="-g"
  186. flags_dbg_off=""
  187. flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
  188. flags_opt_all="$flags_opt_all -qnooptimize"
  189. flags_opt_all="$flags_opt_all -qoptimize=0"
  190. flags_opt_all="$flags_opt_all -qoptimize=1"
  191. flags_opt_all="$flags_opt_all -qoptimize=2"
  192. flags_opt_all="$flags_opt_all -qoptimize=3"
  193. flags_opt_all="$flags_opt_all -qoptimize=4"
  194. flags_opt_all="$flags_opt_all -qoptimize=5"
  195. flags_opt_yes="-O2"
  196. flags_opt_off="-qnooptimize"
  197. flags_prefer_cppflags="yes"
  198. else
  199. AC_MSG_RESULT([no])
  200. fi
  201. ])
  202. dnl CURL_CHECK_COMPILER_INTEL_C
  203. dnl -------------------------------------------------
  204. dnl Verify if compiler being used is Intel C.
  205. AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [
  206. AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl
  207. AC_MSG_CHECKING([if compiler is Intel C])
  208. CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
  209. if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
  210. AC_MSG_RESULT([yes])
  211. compiler_num="$curl_cv_def___INTEL_COMPILER"
  212. CURL_CHECK_DEF([__unix__], [], [silent])
  213. if test "$curl_cv_have_def___unix__" = "yes"; then
  214. compiler_id="INTEL_UNIX_C"
  215. flags_dbg_all="-g -g0"
  216. flags_dbg_yes="-g"
  217. flags_dbg_off="-g0"
  218. flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
  219. flags_opt_yes="-O2"
  220. flags_opt_off="-O0"
  221. else
  222. compiler_id="INTEL_WINDOWS_C"
  223. flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
  224. flags_dbg_all="$flags_dbg_all /debug"
  225. flags_dbg_all="$flags_dbg_all /debug:none"
  226. flags_dbg_all="$flags_dbg_all /debug:minimal"
  227. flags_dbg_all="$flags_dbg_all /debug:partial"
  228. flags_dbg_all="$flags_dbg_all /debug:full"
  229. flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
  230. flags_dbg_all="$flags_dbg_all /debug:extended"
  231. flags_dbg_yes="/Zi /Oy-"
  232. flags_dbg_off="/debug:none /Oy-"
  233. flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
  234. flags_opt_yes="/O2"
  235. flags_opt_off="/Od"
  236. fi
  237. else
  238. AC_MSG_RESULT([no])
  239. fi
  240. ])
  241. dnl CURL_CHECK_COMPILER_LCC
  242. dnl -------------------------------------------------
  243. dnl Verify if compiler being used is LCC.
  244. AC_DEFUN([CURL_CHECK_COMPILER_LCC], [
  245. AC_MSG_CHECKING([if compiler is LCC])
  246. CURL_CHECK_DEF([__LCC__], [], [silent])
  247. if test "$curl_cv_have_def___LCC__" = "yes"; then
  248. AC_MSG_RESULT([yes])
  249. compiler_id="LCC"
  250. flags_dbg_all="-g"
  251. flags_dbg_yes="-g"
  252. flags_dbg_off=""
  253. flags_opt_all=""
  254. flags_opt_yes=""
  255. flags_opt_off=""
  256. else
  257. AC_MSG_RESULT([no])
  258. fi
  259. ])
  260. dnl CURL_CHECK_COMPILER_SGI_MIPS_C
  261. dnl -------------------------------------------------
  262. dnl Verify if compiler being used is SGI MIPS C.
  263. AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPS_C], [
  264. AC_REQUIRE([CURL_CHECK_COMPILER_SGI_MIPSPRO_C])dnl
  265. AC_MSG_CHECKING([if compiler is SGI MIPS C])
  266. CURL_CHECK_DEF([__GNUC__], [], [silent])
  267. CURL_CHECK_DEF([__sgi], [], [silent])
  268. if test "$curl_cv_have_def___GNUC__" = "no" &&
  269. test "$curl_cv_have_def___sgi" = "yes" &&
  270. test "$compiler_id" = "unknown"; then
  271. AC_MSG_RESULT([yes])
  272. compiler_id="SGI_MIPS_C"
  273. flags_dbg_all="-g -g0 -g1 -g2 -g3"
  274. flags_dbg_yes="-g"
  275. flags_dbg_off="-g0"
  276. flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
  277. flags_opt_yes="-O2"
  278. flags_opt_off="-O0"
  279. else
  280. AC_MSG_RESULT([no])
  281. fi
  282. ])
  283. dnl CURL_CHECK_COMPILER_SGI_MIPSPRO_C
  284. dnl -------------------------------------------------
  285. dnl Verify if compiler being used is SGI MIPSpro C.
  286. AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPSPRO_C], [
  287. AC_BEFORE([$0],[CURL_CHECK_COMPILER_SGI_MIPS_C])dnl
  288. AC_MSG_CHECKING([if compiler is SGI MIPSpro C])
  289. CURL_CHECK_DEF([__GNUC__], [], [silent])
  290. CURL_CHECK_DEF([_COMPILER_VERSION], [], [silent])
  291. CURL_CHECK_DEF([_SGI_COMPILER_VERSION], [], [silent])
  292. if test "$curl_cv_have_def___GNUC__" = "no" &&
  293. (test "$curl_cv_have_def__SGI_COMPILER_VERSION" = "yes" ||
  294. test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then
  295. AC_MSG_RESULT([yes])
  296. compiler_id="SGI_MIPSPRO_C"
  297. flags_dbg_all="-g -g0 -g1 -g2 -g3"
  298. flags_dbg_yes="-g"
  299. flags_dbg_off="-g0"
  300. flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
  301. flags_opt_yes="-O2"
  302. flags_opt_off="-O0"
  303. else
  304. AC_MSG_RESULT([no])
  305. fi
  306. ])
  307. dnl CURL_CHECK_COMPILER_SUNPRO_C
  308. dnl -------------------------------------------------
  309. dnl Verify if compiler being used is SunPro C.
  310. AC_DEFUN([CURL_CHECK_COMPILER_SUNPRO_C], [
  311. AC_MSG_CHECKING([if compiler is SunPro C])
  312. CURL_CHECK_DEF([__SUNPRO_C], [], [silent])
  313. if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
  314. AC_MSG_RESULT([yes])
  315. compiler_id="SUNPRO_C"
  316. flags_dbg_all="-g -s"
  317. flags_dbg_yes="-g"
  318. flags_dbg_off="-s"
  319. flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5"
  320. flags_opt_yes="-xO2"
  321. flags_opt_off=""
  322. else
  323. AC_MSG_RESULT([no])
  324. fi
  325. ])
  326. dnl CURL_CHECK_COMPILER_TINY_C
  327. dnl -------------------------------------------------
  328. dnl Verify if compiler being used is Tiny C.
  329. AC_DEFUN([CURL_CHECK_COMPILER_TINY_C], [
  330. AC_MSG_CHECKING([if compiler is Tiny C])
  331. CURL_CHECK_DEF([__TINYC__], [], [silent])
  332. if test "$curl_cv_have_def___TINYC__" = "yes"; then
  333. AC_MSG_RESULT([yes])
  334. compiler_id="TINY_C"
  335. flags_dbg_all="-g -b"
  336. flags_dbg_yes="-g"
  337. flags_dbg_off=""
  338. flags_opt_all=""
  339. flags_opt_yes=""
  340. flags_opt_off=""
  341. else
  342. AC_MSG_RESULT([no])
  343. fi
  344. ])
  345. dnl CURL_CHECK_COMPILER_WATCOM_C
  346. dnl -------------------------------------------------
  347. dnl Verify if compiler being used is Watcom C.
  348. AC_DEFUN([CURL_CHECK_COMPILER_WATCOM_C], [
  349. AC_MSG_CHECKING([if compiler is Watcom C])
  350. CURL_CHECK_DEF([__WATCOMC__], [], [silent])
  351. if test "$curl_cv_have_def___WATCOMC__" = "yes"; then
  352. AC_MSG_RESULT([yes])
  353. CURL_CHECK_DEF([__UNIX__], [], [silent])
  354. if test "$curl_cv_have_def___UNIX__" = "yes"; then
  355. compiler_id="WATCOM_UNIX_C"
  356. flags_dbg_all="-g1 -g1+ -g2 -g3"
  357. flags_dbg_yes="-g2"
  358. flags_dbg_off=""
  359. flags_opt_all="-O0 -O1 -O2 -O3"
  360. flags_opt_yes="-O2"
  361. flags_opt_off="-O0"
  362. else
  363. compiler_id="WATCOM_WINDOWS_C"
  364. flags_dbg_all=""
  365. flags_dbg_yes=""
  366. flags_dbg_off=""
  367. flags_opt_all=""
  368. flags_opt_yes=""
  369. flags_opt_off=""
  370. fi
  371. else
  372. AC_MSG_RESULT([no])
  373. fi
  374. ])
  375. dnl CURL_CONVERT_INCLUDE_TO_ISYSTEM
  376. dnl -------------------------------------------------
  377. dnl Changes standard include paths present in CFLAGS
  378. dnl and CPPFLAGS into isystem include paths. This is
  379. dnl done to prevent GNUC from generating warnings on
  380. dnl headers from these locations, although on ancient
  381. dnl GNUC versions these warnings are not silenced.
  382. AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
  383. AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
  384. AC_REQUIRE([CURL_CHECK_COMPILER])dnl
  385. if test "$compiler_id" = "GNU_C" ||
  386. test "$compiler_id" = "CLANG"; then
  387. tmp_has_include="no"
  388. tmp_chg_FLAGS="$CFLAGS"
  389. for word1 in $tmp_chg_FLAGS; do
  390. case "$word1" in
  391. -I*)
  392. tmp_has_include="yes"
  393. ;;
  394. esac
  395. done
  396. if test "$tmp_has_include" = "yes"; then
  397. tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
  398. tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
  399. CFLAGS="$tmp_chg_FLAGS"
  400. squeeze CFLAGS
  401. fi
  402. tmp_has_include="no"
  403. tmp_chg_FLAGS="$CPPFLAGS"
  404. for word1 in $tmp_chg_FLAGS; do
  405. case "$word1" in
  406. -I*)
  407. tmp_has_include="yes"
  408. ;;
  409. esac
  410. done
  411. if test "$tmp_has_include" = "yes"; then
  412. tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/^-I/ -isystem /g'`
  413. tmp_chg_FLAGS=`echo "$tmp_chg_FLAGS" | "$SED" 's/ -I/ -isystem /g'`
  414. CPPFLAGS="$tmp_chg_FLAGS"
  415. squeeze CPPFLAGS
  416. fi
  417. fi
  418. ])
  419. dnl CURL_COMPILER_WORKS_IFELSE ([ACTION-IF-WORKS], [ACTION-IF-NOT-WORKS])
  420. dnl -------------------------------------------------
  421. dnl Verify if the C compiler seems to work with the
  422. dnl settings that are 'active' at the time the test
  423. dnl is performed.
  424. AC_DEFUN([CURL_COMPILER_WORKS_IFELSE], [
  425. dnl compilation capability verification
  426. tmp_compiler_works="unknown"
  427. AC_COMPILE_IFELSE([
  428. AC_LANG_PROGRAM([[
  429. ]],[[
  430. int i = 1;
  431. return i;
  432. ]])
  433. ],[
  434. tmp_compiler_works="yes"
  435. ],[
  436. tmp_compiler_works="no"
  437. echo " " >&6
  438. sed 's/^/cc-fail: /' conftest.err >&6
  439. echo " " >&6
  440. ])
  441. dnl linking capability verification
  442. if test "$tmp_compiler_works" = "yes"; then
  443. AC_LINK_IFELSE([
  444. AC_LANG_PROGRAM([[
  445. ]],[[
  446. int i = 1;
  447. return i;
  448. ]])
  449. ],[
  450. tmp_compiler_works="yes"
  451. ],[
  452. tmp_compiler_works="no"
  453. echo " " >&6
  454. sed 's/^/link-fail: /' conftest.err >&6
  455. echo " " >&6
  456. ])
  457. fi
  458. dnl only do runtime verification when not cross-compiling
  459. if test "x$cross_compiling" != "xyes" &&
  460. test "$tmp_compiler_works" = "yes"; then
  461. AC_RUN_IFELSE([
  462. AC_LANG_PROGRAM([[
  463. # ifdef __STDC__
  464. # include <stdlib.h>
  465. # endif
  466. ]],[[
  467. int i = 0;
  468. exit(i);
  469. ]])
  470. ],[
  471. tmp_compiler_works="yes"
  472. ],[
  473. tmp_compiler_works="no"
  474. echo " " >&6
  475. echo "run-fail: test program exited with status $ac_status" >&6
  476. echo " " >&6
  477. ])
  478. fi
  479. dnl branch upon test result
  480. if test "$tmp_compiler_works" = "yes"; then
  481. ifelse($1,,:,[$1])
  482. ifelse($2,,,[else
  483. $2])
  484. fi
  485. ])
  486. dnl CURL_SET_COMPILER_BASIC_OPTS
  487. dnl -------------------------------------------------
  488. dnl Sets compiler specific options/flags which do not
  489. dnl depend on configure's debug, optimize or warnings
  490. dnl options.
  491. AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
  492. AC_REQUIRE([CURL_CHECK_COMPILER])dnl
  493. AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
  494. #
  495. if test "$compiler_id" != "unknown"; then
  496. #
  497. if test "$compiler_id" = "GNU_C" ||
  498. test "$compiler_id" = "CLANG"; then
  499. CURL_CONVERT_INCLUDE_TO_ISYSTEM
  500. fi
  501. #
  502. tmp_save_CPPFLAGS="$CPPFLAGS"
  503. tmp_save_CFLAGS="$CFLAGS"
  504. tmp_CPPFLAGS=""
  505. tmp_CFLAGS=""
  506. #
  507. case "$compiler_id" in
  508. #
  509. CLANG)
  510. #
  511. dnl Disable warnings for unused arguments, otherwise clang will
  512. dnl warn about compile-time arguments used during link-time, like
  513. dnl -O and -g and -pedantic.
  514. tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments"
  515. ;;
  516. #
  517. DEC_C)
  518. #
  519. dnl Select strict ANSI C compiler mode
  520. tmp_CFLAGS="$tmp_CFLAGS -std1"
  521. dnl Turn off optimizer ANSI C aliasing rules
  522. tmp_CFLAGS="$tmp_CFLAGS -noansi_alias"
  523. dnl Generate warnings for missing function prototypes
  524. tmp_CFLAGS="$tmp_CFLAGS -warnprotos"
  525. dnl Change some warnings into fatal errors
  526. tmp_CFLAGS="$tmp_CFLAGS -msg_fatal toofewargs,toomanyargs"
  527. ;;
  528. #
  529. GNU_C)
  530. #
  531. dnl Placeholder
  532. tmp_CFLAGS="$tmp_CFLAGS"
  533. ;;
  534. #
  535. HP_UX_C)
  536. #
  537. dnl Disallow run-time dereferencing of null pointers
  538. tmp_CFLAGS="$tmp_CFLAGS -z"
  539. dnl Disable some remarks
  540. dnl #4227: padding struct with n bytes to align member
  541. dnl #4255: padding size of struct with n bytes to alignment boundary
  542. tmp_CFLAGS="$tmp_CFLAGS +W 4227,4255"
  543. ;;
  544. #
  545. IBM_C)
  546. #
  547. dnl Ensure that compiler optimizations are always thread-safe.
  548. tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded"
  549. dnl Disable type based strict aliasing optimizations, using worst
  550. dnl case aliasing assumptions when compiling. Type based aliasing
  551. dnl would restrict the lvalues that could be safely used to access
  552. dnl a data object.
  553. tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias"
  554. dnl Force compiler to stop after the compilation phase, without
  555. dnl generating an object code file when compilation has errors.
  556. tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e"
  557. ;;
  558. #
  559. INTEL_UNIX_C)
  560. #
  561. dnl On unix this compiler uses gcc's header files, so
  562. dnl we select ANSI C89 dialect plus GNU extensions.
  563. tmp_CFLAGS="$tmp_CFLAGS -std=gnu89"
  564. dnl Change some warnings into errors
  565. dnl #140: too many arguments in function call
  566. dnl #147: declaration is incompatible with 'previous one'
  567. dnl #165: too few arguments in function call
  568. dnl #266: function declared implicitly
  569. tmp_CPPFLAGS="$tmp_CPPFLAGS -we 140,147,165,266"
  570. dnl Disable some remarks
  571. dnl #279: controlling expression is constant
  572. dnl #981: operands are evaluated in unspecified order
  573. dnl #1469: "cc" clobber ignored
  574. tmp_CPPFLAGS="$tmp_CPPFLAGS -wd 279,981,1469"
  575. ;;
  576. #
  577. INTEL_WINDOWS_C)
  578. #
  579. dnl Placeholder
  580. tmp_CFLAGS="$tmp_CFLAGS"
  581. ;;
  582. #
  583. LCC)
  584. #
  585. dnl Disallow run-time dereferencing of null pointers
  586. tmp_CFLAGS="$tmp_CFLAGS -n"
  587. ;;
  588. #
  589. SGI_MIPS_C)
  590. #
  591. dnl Placeholder
  592. tmp_CFLAGS="$tmp_CFLAGS"
  593. ;;
  594. #
  595. SGI_MIPSPRO_C)
  596. #
  597. dnl Placeholder
  598. tmp_CFLAGS="$tmp_CFLAGS"
  599. ;;
  600. #
  601. SUNPRO_C)
  602. #
  603. dnl Placeholder
  604. tmp_CFLAGS="$tmp_CFLAGS"
  605. ;;
  606. #
  607. TINY_C)
  608. #
  609. dnl Placeholder
  610. tmp_CFLAGS="$tmp_CFLAGS"
  611. ;;
  612. #
  613. WATCOM_UNIX_C)
  614. #
  615. dnl Placeholder
  616. tmp_CFLAGS="$tmp_CFLAGS"
  617. ;;
  618. #
  619. WATCOM_WINDOWS_C)
  620. #
  621. dnl Placeholder
  622. tmp_CFLAGS="$tmp_CFLAGS"
  623. ;;
  624. #
  625. esac
  626. #
  627. squeeze tmp_CPPFLAGS
  628. squeeze tmp_CFLAGS
  629. #
  630. if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
  631. AC_MSG_CHECKING([if compiler accepts some basic options])
  632. CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
  633. CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
  634. squeeze CPPFLAGS
  635. squeeze CFLAGS
  636. CURL_COMPILER_WORKS_IFELSE([
  637. AC_MSG_RESULT([yes])
  638. AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
  639. ],[
  640. AC_MSG_RESULT([no])
  641. AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
  642. dnl restore initial settings
  643. CPPFLAGS="$tmp_save_CPPFLAGS"
  644. CFLAGS="$tmp_save_CFLAGS"
  645. ])
  646. fi
  647. #
  648. fi
  649. ])
  650. dnl CURL_SET_COMPILER_DEBUG_OPTS
  651. dnl -------------------------------------------------
  652. dnl Sets compiler specific options/flags which depend
  653. dnl on configure's debug option.
  654. AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
  655. AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
  656. AC_REQUIRE([CURL_CHECK_COMPILER])dnl
  657. AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
  658. #
  659. if test "$compiler_id" != "unknown"; then
  660. #
  661. tmp_save_CFLAGS="$CFLAGS"
  662. tmp_save_CPPFLAGS="$CPPFLAGS"
  663. #
  664. tmp_options=""
  665. tmp_CFLAGS="$CFLAGS"
  666. tmp_CPPFLAGS="$CPPFLAGS"
  667. CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
  668. CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
  669. #
  670. if test "$want_debug" = "yes"; then
  671. AC_MSG_CHECKING([if compiler accepts debug enabling options])
  672. tmp_options="$flags_dbg_yes"
  673. fi
  674. if test "$want_debug" = "no"; then
  675. AC_MSG_CHECKING([if compiler accepts debug disabling options])
  676. tmp_options="$flags_dbg_off"
  677. fi
  678. #
  679. if test "$flags_prefer_cppflags" = "yes"; then
  680. CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
  681. CFLAGS="$tmp_CFLAGS"
  682. else
  683. CPPFLAGS="$tmp_CPPFLAGS"
  684. CFLAGS="$tmp_CFLAGS $tmp_options"
  685. fi
  686. squeeze CPPFLAGS
  687. squeeze CFLAGS
  688. CURL_COMPILER_WORKS_IFELSE([
  689. AC_MSG_RESULT([yes])
  690. AC_MSG_NOTICE([compiler options added: $tmp_options])
  691. ],[
  692. AC_MSG_RESULT([no])
  693. AC_MSG_WARN([compiler options rejected: $tmp_options])
  694. dnl restore initial settings
  695. CPPFLAGS="$tmp_save_CPPFLAGS"
  696. CFLAGS="$tmp_save_CFLAGS"
  697. ])
  698. #
  699. fi
  700. ])
  701. dnl CURL_SET_COMPILER_OPTIMIZE_OPTS
  702. dnl -------------------------------------------------
  703. dnl Sets compiler specific options/flags which depend
  704. dnl on configure's optimize option.
  705. AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
  706. AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl
  707. AC_REQUIRE([CURL_CHECK_COMPILER])dnl
  708. AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
  709. #
  710. if test "$compiler_id" != "unknown"; then
  711. #
  712. tmp_save_CFLAGS="$CFLAGS"
  713. tmp_save_CPPFLAGS="$CPPFLAGS"
  714. #
  715. tmp_options=""
  716. tmp_CFLAGS="$CFLAGS"
  717. tmp_CPPFLAGS="$CPPFLAGS"
  718. honor_optimize_option="yes"
  719. #
  720. dnl If optimization request setting has not been explicitly specified,
  721. dnl it has been derived from the debug setting and initially assumed.
  722. dnl This initially assumed optimizer setting will finally be ignored
  723. dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
  724. dnl that an initially assumed optimizer setting might not be honored.
  725. #
  726. if test "$want_optimize" = "assume_no" ||
  727. test "$want_optimize" = "assume_yes"; then
  728. AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
  729. CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
  730. honor_optimize_option="no"
  731. ])
  732. CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
  733. honor_optimize_option="no"
  734. ])
  735. AC_MSG_RESULT([$honor_optimize_option])
  736. if test "$honor_optimize_option" = "yes"; then
  737. if test "$want_optimize" = "assume_yes"; then
  738. want_optimize="yes"
  739. fi
  740. if test "$want_optimize" = "assume_no"; then
  741. want_optimize="no"
  742. fi
  743. fi
  744. fi
  745. #
  746. if test "$honor_optimize_option" = "yes"; then
  747. CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
  748. CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
  749. if test "$want_optimize" = "yes"; then
  750. AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
  751. tmp_options="$flags_opt_yes"
  752. fi
  753. if test "$want_optimize" = "no"; then
  754. AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
  755. tmp_options="$flags_opt_off"
  756. fi
  757. if test "$flags_prefer_cppflags" = "yes"; then
  758. CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
  759. CFLAGS="$tmp_CFLAGS"
  760. else
  761. CPPFLAGS="$tmp_CPPFLAGS"
  762. CFLAGS="$tmp_CFLAGS $tmp_options"
  763. fi
  764. squeeze CPPFLAGS
  765. squeeze CFLAGS
  766. CURL_COMPILER_WORKS_IFELSE([
  767. AC_MSG_RESULT([yes])
  768. AC_MSG_NOTICE([compiler options added: $tmp_options])
  769. ],[
  770. AC_MSG_RESULT([no])
  771. AC_MSG_WARN([compiler options rejected: $tmp_options])
  772. dnl restore initial settings
  773. CPPFLAGS="$tmp_save_CPPFLAGS"
  774. CFLAGS="$tmp_save_CFLAGS"
  775. ])
  776. fi
  777. #
  778. fi
  779. ])
  780. dnl CURL_SET_COMPILER_WARNING_OPTS
  781. dnl -------------------------------------------------
  782. dnl Sets compiler options/flags which depend on
  783. dnl configure's warnings given option.
  784. AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
  785. AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
  786. AC_REQUIRE([CURL_CHECK_COMPILER])dnl
  787. AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
  788. #
  789. if test "$compiler_id" != "unknown"; then
  790. #
  791. tmp_save_CPPFLAGS="$CPPFLAGS"
  792. tmp_save_CFLAGS="$CFLAGS"
  793. tmp_CPPFLAGS=""
  794. tmp_CFLAGS=""
  795. #
  796. case "$compiler_id" in
  797. #
  798. CLANG)
  799. #
  800. if test "$want_warnings" = "yes"; then
  801. tmp_CFLAGS="$tmp_CFLAGS -pedantic"
  802. tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
  803. tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
  804. tmp_CFLAGS="$tmp_CFLAGS -Wshadow"
  805. tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
  806. tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
  807. tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
  808. tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
  809. tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
  810. tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
  811. tmp_CFLAGS="$tmp_CFLAGS -Wundef"
  812. tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
  813. tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
  814. tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
  815. tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
  816. tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
  817. tmp_CFLAGS="$tmp_CFLAGS -Wshorten-64-to-32"
  818. #
  819. dnl Only clang 1.1 or later
  820. if test "$compiler_num" -ge "101"; then
  821. tmp_CFLAGS="$tmp_CFLAGS -Wunused"
  822. fi
  823. fi
  824. ;;
  825. #
  826. DEC_C)
  827. #
  828. if test "$want_warnings" = "yes"; then
  829. dnl Select a higher warning level than default level2
  830. tmp_CFLAGS="$tmp_CFLAGS -msg_enable level3"
  831. fi
  832. ;;
  833. #
  834. GNU_C)
  835. #
  836. if test "$want_warnings" = "yes"; then
  837. #
  838. dnl Do not enable -pedantic when cross-compiling with a gcc older
  839. dnl than 3.0, to avoid warnings from third party system headers.
  840. if test "x$cross_compiling" != "xyes" ||
  841. test "$compiler_num" -ge "300"; then
  842. tmp_CFLAGS="$tmp_CFLAGS -pedantic"
  843. fi
  844. #
  845. dnl Set of options we believe *ALL* gcc versions support:
  846. tmp_CFLAGS="$tmp_CFLAGS -Wall -W"
  847. #
  848. dnl Only gcc 1.4 or later
  849. if test "$compiler_num" -ge "104"; then
  850. tmp_CFLAGS="$tmp_CFLAGS -Wpointer-arith -Wwrite-strings"
  851. dnl If not cross-compiling with a gcc older than 3.0
  852. if test "x$cross_compiling" != "xyes" ||
  853. test "$compiler_num" -ge "300"; then
  854. tmp_CFLAGS="$tmp_CFLAGS -Wunused -Wshadow"
  855. fi
  856. fi
  857. #
  858. dnl Only gcc 2.7 or later
  859. if test "$compiler_num" -ge "207"; then
  860. tmp_CFLAGS="$tmp_CFLAGS -Winline -Wnested-externs"
  861. dnl If not cross-compiling with a gcc older than 3.0
  862. if test "x$cross_compiling" != "xyes" ||
  863. test "$compiler_num" -ge "300"; then
  864. tmp_CFLAGS="$tmp_CFLAGS -Wmissing-declarations"
  865. tmp_CFLAGS="$tmp_CFLAGS -Wmissing-prototypes"
  866. fi
  867. fi
  868. #
  869. dnl Only gcc 2.95 or later
  870. if test "$compiler_num" -ge "295"; then
  871. tmp_CFLAGS="$tmp_CFLAGS -Wno-long-long"
  872. fi
  873. #
  874. dnl Only gcc 2.96 or later
  875. if test "$compiler_num" -ge "296"; then
  876. tmp_CFLAGS="$tmp_CFLAGS -Wfloat-equal"
  877. tmp_CFLAGS="$tmp_CFLAGS -Wno-multichar -Wsign-compare"
  878. dnl -Wundef used only if gcc is 2.96 or later since we get
  879. dnl lots of "`_POSIX_C_SOURCE' is not defined" in system
  880. dnl headers with gcc 2.95.4 on FreeBSD 4.9
  881. tmp_CFLAGS="$tmp_CFLAGS -Wundef"
  882. fi
  883. #
  884. dnl Only gcc 2.97 or later
  885. if test "$compiler_num" -ge "297"; then
  886. tmp_CFLAGS="$tmp_CFLAGS -Wno-format-nonliteral"
  887. fi
  888. #
  889. dnl Only gcc 3.0 or later
  890. if test "$compiler_num" -ge "300"; then
  891. dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
  892. dnl on i686-Linux as it gives us heaps with false positives.
  893. dnl Also, on gcc 4.0.X it is totally unbearable and complains all
  894. dnl over making it unusable for generic purposes. Let's not use it.
  895. tmp_CFLAGS="$tmp_CFLAGS"
  896. fi
  897. #
  898. dnl Only gcc 3.3 or later
  899. if test "$compiler_num" -ge "303"; then
  900. tmp_CFLAGS="$tmp_CFLAGS -Wendif-labels -Wstrict-prototypes"
  901. fi
  902. #
  903. dnl Only gcc 3.4 or later
  904. if test "$compiler_num" -ge "304"; then
  905. tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
  906. fi
  907. #
  908. dnl Only gcc 4.0 or later
  909. if test "$compiler_num" -ge "400"; then
  910. tmp_CFLAGS="$tmp_CFLAGS -Wstrict-aliasing=3"
  911. fi
  912. #
  913. dnl Only gcc 4.2 or later
  914. if test "$compiler_num" -ge "402"; then
  915. tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
  916. fi
  917. #
  918. dnl Only gcc 4.3 or later
  919. if test "$compiler_num" -ge "403"; then
  920. tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration"
  921. tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body"
  922. tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers"
  923. tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla"
  924. fi
  925. #
  926. dnl Only gcc 4.5 or later
  927. if test "$compiler_num" -ge "405"; then
  928. dnl Only windows targets
  929. if test "$curl_cv_have_def__WIN32" = "yes"; then
  930. tmp_CFLAGS="$tmp_CFLAGS -Wno-pedantic-ms-format"
  931. fi
  932. fi
  933. #
  934. fi
  935. #
  936. dnl Do not issue warnings for code in system include paths.
  937. if test "$compiler_num" -ge "300"; then
  938. tmp_CFLAGS="$tmp_CFLAGS -Wno-system-headers"
  939. else
  940. dnl When cross-compiling with a gcc older than 3.0, disable
  941. dnl some warnings triggered on third party system headers.
  942. if test "x$cross_compiling" = "xyes"; then
  943. if test "$compiler_num" -ge "104"; then
  944. dnl gcc 1.4 or later
  945. tmp_CFLAGS="$tmp_CFLAGS -Wno-unused -Wno-shadow"
  946. fi
  947. if test "$compiler_num" -ge "207"; then
  948. dnl gcc 2.7 or later
  949. tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-declarations"
  950. tmp_CFLAGS="$tmp_CFLAGS -Wno-missing-prototypes"
  951. fi
  952. fi
  953. fi
  954. ;;
  955. #
  956. HP_UX_C)
  957. #
  958. if test "$want_warnings" = "yes"; then
  959. dnl Issue all warnings
  960. tmp_CFLAGS="$tmp_CFLAGS +w1"
  961. fi
  962. ;;
  963. #
  964. IBM_C)
  965. #
  966. dnl Placeholder
  967. tmp_CFLAGS="$tmp_CFLAGS"
  968. ;;
  969. #
  970. INTEL_UNIX_C)
  971. #
  972. if test "$want_warnings" = "yes"; then
  973. if test "$compiler_num" -gt "600"; then
  974. dnl Show errors, warnings, and remarks
  975. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wall -w2"
  976. dnl Perform extra compile-time code checking
  977. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcheck"
  978. dnl Warn on nested comments
  979. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wcomment"
  980. dnl Show warnings relative to deprecated features
  981. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wdeprecated"
  982. dnl Enable warnings for missing prototypes
  983. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wmissing-prototypes"
  984. dnl Enable warnings for 64-bit portability issues
  985. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wp64"
  986. dnl Enable warnings for questionable pointer arithmetic
  987. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wpointer-arith"
  988. dnl Check for function return typw issues
  989. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wreturn-type"
  990. dnl Warn on variable declarations hiding a previous one
  991. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wshadow"
  992. dnl Warn when a variable is used before initialized
  993. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wuninitialized"
  994. dnl Warn if a declared function is not used
  995. tmp_CPPFLAGS="$tmp_CPPFLAGS -Wunused-function"
  996. fi
  997. fi
  998. dnl Disable using EBP register in optimizations
  999. tmp_CFLAGS="$tmp_CFLAGS -fno-omit-frame-pointer"
  1000. dnl Disable use of ANSI C aliasing rules in optimizations
  1001. tmp_CFLAGS="$tmp_CFLAGS -fno-strict-aliasing"
  1002. dnl Value-safe optimizations on floating-point data
  1003. tmp_CFLAGS="$tmp_CFLAGS -fp-model precise"
  1004. dnl Only icc 10.0 or later
  1005. if test "$compiler_num" -ge "1000"; then
  1006. dnl Disable vectorizer diagnostic information
  1007. tmp_CFLAGS="$tmp_CFLAGS -vec-report0"
  1008. fi
  1009. ;;
  1010. #
  1011. INTEL_WINDOWS_C)
  1012. #
  1013. dnl Placeholder
  1014. tmp_CFLAGS="$tmp_CFLAGS"
  1015. ;;
  1016. #
  1017. LCC)
  1018. #
  1019. if test "$want_warnings" = "yes"; then
  1020. dnl Highest warning level is double -A, next is single -A.
  1021. dnl Due to the big number of warnings these trigger on third
  1022. dnl party header files it is impractical for us to use any of
  1023. dnl them here. If you want them simply define it in CPPFLAGS.
  1024. tmp_CFLAGS="$tmp_CFLAGS"
  1025. fi
  1026. ;;
  1027. #
  1028. SGI_MIPS_C)
  1029. #
  1030. if test "$want_warnings" = "yes"; then
  1031. dnl Perform stricter semantic and lint-like checks
  1032. tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
  1033. fi
  1034. ;;
  1035. #
  1036. SGI_MIPSPRO_C)
  1037. #
  1038. if test "$want_warnings" = "yes"; then
  1039. dnl Perform stricter semantic and lint-like checks
  1040. tmp_CFLAGS="$tmp_CFLAGS -fullwarn"
  1041. dnl Disable some remarks
  1042. dnl #1209: controlling expression is constant
  1043. tmp_CFLAGS="$tmp_CFLAGS -woff 1209"
  1044. fi
  1045. ;;
  1046. #
  1047. SUNPRO_C)
  1048. #
  1049. if test "$want_warnings" = "yes"; then
  1050. dnl Perform stricter semantic and lint-like checks
  1051. tmp_CFLAGS="$tmp_CFLAGS -v"
  1052. fi
  1053. ;;
  1054. #
  1055. TINY_C)
  1056. #
  1057. if test "$want_warnings" = "yes"; then
  1058. dnl Activate all warnings
  1059. tmp_CFLAGS="$tmp_CFLAGS -Wall"
  1060. dnl Make string constants be of type const char *
  1061. tmp_CFLAGS="$tmp_CFLAGS -Wwrite-strings"
  1062. dnl Warn use of unsupported GCC features ignored by TCC
  1063. tmp_CFLAGS="$tmp_CFLAGS -Wunsupported"
  1064. fi
  1065. ;;
  1066. #
  1067. WATCOM_UNIX_C)
  1068. #
  1069. if test "$want_warnings" = "yes"; then
  1070. dnl Issue all warnings
  1071. tmp_CFLAGS="$tmp_CFLAGS -Wall -Wextra"
  1072. fi
  1073. ;;
  1074. #
  1075. WATCOM_WINDOWS_C)
  1076. #
  1077. dnl Placeholder
  1078. tmp_CFLAGS="$tmp_CFLAGS"
  1079. ;;
  1080. #
  1081. esac
  1082. #
  1083. squeeze tmp_CPPFLAGS
  1084. squeeze tmp_CFLAGS
  1085. #
  1086. if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
  1087. AC_MSG_CHECKING([if compiler accepts strict warning options])
  1088. CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
  1089. CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
  1090. squeeze CPPFLAGS
  1091. squeeze CFLAGS
  1092. CURL_COMPILER_WORKS_IFELSE([
  1093. AC_MSG_RESULT([yes])
  1094. AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
  1095. ],[
  1096. AC_MSG_RESULT([no])
  1097. AC_MSG_WARN([compiler options rejected: $tmp_CFLAGS $tmp_CPPFLAGS])
  1098. dnl restore initial settings
  1099. CPPFLAGS="$tmp_save_CPPFLAGS"
  1100. CFLAGS="$tmp_save_CFLAGS"
  1101. ])
  1102. fi
  1103. #
  1104. fi
  1105. ])
  1106. dnl CURL_SHFUNC_SQUEEZE
  1107. dnl -------------------------------------------------
  1108. dnl Declares a shell function squeeze() which removes
  1109. dnl redundant whitespace out of a shell variable.
  1110. AC_DEFUN([CURL_SHFUNC_SQUEEZE], [
  1111. squeeze() {
  1112. _sqz_result=""
  1113. eval _sqz_input=\[$][$]1
  1114. for _sqz_token in $_sqz_input; do
  1115. if test -z "$_sqz_result"; then
  1116. _sqz_result="$_sqz_token"
  1117. else
  1118. _sqz_result="$_sqz_result $_sqz_token"
  1119. fi
  1120. done
  1121. eval [$]1=\$_sqz_result
  1122. return 0
  1123. }
  1124. ])
  1125. dnl CURL_CHECK_CURLDEBUG
  1126. dnl -------------------------------------------------
  1127. dnl Settings which depend on configure's curldebug given
  1128. dnl option, and other additional configure pre-requisites.
  1129. dnl Actually the curl debug memory tracking feature can
  1130. dnl only be used/enabled when libcurl is built as a static
  1131. dnl library or as a shared one on those systems on which
  1132. dnl shared libraries support undefined symbols.
  1133. AC_DEFUN([CURL_CHECK_CURLDEBUG], [
  1134. AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
  1135. supports_curldebug="unknown"
  1136. if test "$want_curldebug" = "yes"; then
  1137. if test "x$enable_shared" != "xno" &&
  1138. test "x$enable_shared" != "xyes"; then
  1139. AC_MSG_WARN([unknown enable_shared setting.])
  1140. supports_curldebug="no"
  1141. fi
  1142. if test "x$enable_static" != "xno" &&
  1143. test "x$enable_static" != "xyes"; then
  1144. AC_MSG_WARN([unknown enable_static setting.])
  1145. supports_curldebug="no"
  1146. fi
  1147. if test "$supports_curldebug" != "no"; then
  1148. if test "$enable_shared" = "yes" &&
  1149. test "$need_no_undefined" = "yes"; then
  1150. supports_curldebug="no"
  1151. AC_MSG_WARN([shared library does not support undefined symbols.])
  1152. fi
  1153. fi
  1154. fi
  1155. #
  1156. if test "$want_curldebug" = "yes"; then
  1157. AC_MSG_CHECKING([if curl debug memory tracking can be enabled])
  1158. test "$supports_curldebug" = "no" || supports_curldebug="yes"
  1159. AC_MSG_RESULT([$supports_curldebug])
  1160. if test "$supports_curldebug" = "no"; then
  1161. AC_MSG_WARN([cannot enable curl debug memory tracking.])
  1162. want_curldebug="no"
  1163. fi
  1164. fi
  1165. #
  1166. if test "$want_curldebug" = "yes"; then
  1167. CPPFLAGS="-DCURLDEBUG $CPPFLAGS"
  1168. squeeze CPPFLAGS
  1169. fi
  1170. if test "$want_debug" = "yes"; then
  1171. CPPFLAGS="-DDEBUGBUILD $CPPFLAGS"
  1172. squeeze CPPFLAGS
  1173. fi
  1174. ])
  1175. dnl CURL_CHECK_NO_UNDEFINED
  1176. dnl -------------------------------------------------
  1177. dnl Checks if the -no-undefined flag must be used when
  1178. dnl building shared libraries. This is required on all
  1179. dnl systems on which shared libraries should not have
  1180. dnl references to undefined symbols. This check should
  1181. dnl not be done before AC-PROG-LIBTOOL.
  1182. AC_DEFUN([CURL_CHECK_NO_UNDEFINED], [
  1183. AC_BEFORE([$0],[CURL_CHECK_CURLDEBUG])dnl
  1184. AC_MSG_CHECKING([if shared libraries need -no-undefined])
  1185. need_no_undefined="no"
  1186. case $host in
  1187. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc* | *-*-aix*)
  1188. need_no_undefined="yes"
  1189. ;;
  1190. esac
  1191. if test "x$allow_undefined" = "xno"; then
  1192. need_no_undefined="yes"
  1193. elif test "x$allow_undefined_flag" = "xunsupported"; then
  1194. need_no_undefined="yes"
  1195. fi
  1196. AC_MSG_RESULT($need_no_undefined)
  1197. ])
  1198. dnl CURL_CHECK_PROG_CC
  1199. dnl -------------------------------------------------
  1200. dnl Check for compiler program, preventing CFLAGS and
  1201. dnl CPPFLAGS from being unexpectedly changed.
  1202. AC_DEFUN([CURL_CHECK_PROG_CC], [
  1203. ac_save_CFLAGS="$CFLAGS"
  1204. ac_save_CPPFLAGS="$CPPFLAGS"
  1205. AC_PROG_CC
  1206. CFLAGS="$ac_save_CFLAGS"
  1207. CPPFLAGS="$ac_save_CPPFLAGS"
  1208. ])
  1209. dnl CURL_CHECK_COMPILER_HALT_ON_ERROR
  1210. dnl -------------------------------------------------
  1211. dnl Verifies if the compiler actually halts after the
  1212. dnl compilation phase without generating any object
  1213. dnl code file, when the source compiles with errors.
  1214. AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [
  1215. AC_MSG_CHECKING([if compiler halts on compilation errors])
  1216. AC_COMPILE_IFELSE([
  1217. AC_LANG_PROGRAM([[
  1218. ]],[[
  1219. force compilation error
  1220. ]])
  1221. ],[
  1222. AC_MSG_RESULT([no])
  1223. AC_MSG_ERROR([compiler does not halt on compilation errors.])
  1224. ],[
  1225. AC_MSG_RESULT([yes])
  1226. ])
  1227. ])
  1228. dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
  1229. dnl -------------------------------------------------
  1230. dnl Verifies if the compiler actually halts after the
  1231. dnl compilation phase without generating any object
  1232. dnl code file, when the source code tries to define a
  1233. dnl type for a constant array with negative dimension.
  1234. AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [
  1235. AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl
  1236. AC_MSG_CHECKING([if compiler halts on negative sized arrays])
  1237. AC_COMPILE_IFELSE([
  1238. AC_LANG_PROGRAM([[
  1239. typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ];
  1240. ]],[[
  1241. bad_t dummy;
  1242. ]])
  1243. ],[
  1244. AC_MSG_RESULT([no])
  1245. AC_MSG_ERROR([compiler does not halt on negative sized arrays.])
  1246. ],[
  1247. AC_MSG_RESULT([yes])
  1248. ])
  1249. ])
  1250. dnl CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE
  1251. dnl -------------------------------------------------
  1252. dnl Verifies if the compiler is capable of handling the
  1253. dnl size of a struct member, struct which is a function
  1254. dnl result, as a compilation-time condition inside the
  1255. dnl type definition of a constant array.
  1256. AC_DEFUN([CURL_CHECK_COMPILER_STRUCT_MEMBER_SIZE], [
  1257. AC_REQUIRE([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE])dnl
  1258. AC_MSG_CHECKING([if compiler struct member size checking works])
  1259. tst_compiler_check_one_works="unknown"
  1260. AC_COMPILE_IFELSE([
  1261. AC_LANG_PROGRAM([[
  1262. struct mystruct {
  1263. int mi;
  1264. char mc;
  1265. struct mystruct *next;
  1266. };
  1267. struct mystruct myfunc();
  1268. typedef char good_t1[sizeof(myfunc().mi) == sizeof(int) ? 1 : -1 ];
  1269. typedef char good_t2[sizeof(myfunc().mc) == sizeof(char) ? 1 : -1 ];
  1270. ]],[[
  1271. good_t1 dummy1;
  1272. good_t2 dummy2;
  1273. ]])
  1274. ],[
  1275. tst_compiler_check_one_works="yes"
  1276. ],[
  1277. tst_compiler_check_one_works="no"
  1278. sed 's/^/cc-src: /' conftest.$ac_ext >&6
  1279. sed 's/^/cc-err: /' conftest.err >&6
  1280. ])
  1281. tst_compiler_check_two_works="unknown"
  1282. AC_COMPILE_IFELSE([
  1283. AC_LANG_PROGRAM([[
  1284. struct mystruct {
  1285. int mi;
  1286. char mc;
  1287. struct mystruct *next;
  1288. };
  1289. struct mystruct myfunc();
  1290. typedef char bad_t1[sizeof(myfunc().mi) != sizeof(int) ? 1 : -1 ];
  1291. typedef char bad_t2[sizeof(myfunc().mc) != sizeof(char) ? 1 : -1 ];
  1292. ]],[[
  1293. bad_t1 dummy1;
  1294. bad_t2 dummy2;
  1295. ]])
  1296. ],[
  1297. tst_compiler_check_two_works="no"
  1298. ],[
  1299. tst_compiler_check_two_works="yes"
  1300. ])
  1301. if test "$tst_compiler_check_one_works" = "yes" &&
  1302. test "$tst_compiler_check_two_works" = "yes"; then
  1303. AC_MSG_RESULT([yes])
  1304. else
  1305. AC_MSG_RESULT([no])
  1306. AC_MSG_ERROR([compiler fails struct member size checking.])
  1307. fi
  1308. ])
  1309. dnl CURL_CHECK_COMPILER_SYMBOL_HIDING
  1310. dnl -------------------------------------------------
  1311. dnl Verify if compiler supports hiding library internal symbols, setting
  1312. dnl shell variable supports_symbol_hiding value as appropriate, as well as
  1313. dnl variables symbol_hiding_CFLAGS and symbol_hiding_EXTERN when supported.
  1314. AC_DEFUN([CURL_CHECK_COMPILER_SYMBOL_HIDING], [
  1315. AC_REQUIRE([CURL_CHECK_COMPILER])dnl
  1316. AC_BEFORE([$0],[CURL_CONFIGURE_SYMBOL_HIDING])dnl
  1317. AC_MSG_CHECKING([if compiler supports hiding library internal symbols])
  1318. supports_symbol_hiding="no"
  1319. symbol_hiding_CFLAGS=""
  1320. symbol_hiding_EXTERN=""
  1321. tmp_CFLAGS=""
  1322. tmp_EXTERN=""
  1323. case "$compiler_id" in
  1324. CLANG)
  1325. dnl All versions of clang support -fvisibility=
  1326. tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
  1327. tmp_CFLAGS="-fvisibility=hidden"
  1328. supports_symbol_hiding="yes"
  1329. ;;
  1330. GNU_C)
  1331. dnl Only gcc 3.4 or later
  1332. if test "$compiler_num" -ge "304"; then
  1333. if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
  1334. tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
  1335. tmp_CFLAGS="-fvisibility=hidden"
  1336. supports_symbol_hiding="yes"
  1337. fi
  1338. fi
  1339. ;;
  1340. INTEL_UNIX_C)
  1341. dnl Only icc 9.0 or later
  1342. if test "$compiler_num" -ge "900"; then
  1343. if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
  1344. tmp_save_CFLAGS="$CFLAGS"
  1345. CFLAGS="$CFLAGS -fvisibility=hidden"
  1346. AC_LINK_IFELSE([
  1347. AC_LANG_PROGRAM([[
  1348. # include <stdio.h>
  1349. ]],[[
  1350. printf("icc fvisibility bug test");
  1351. ]])
  1352. ],[
  1353. tmp_EXTERN="__attribute__ ((__visibility__ (\"default\")))"
  1354. tmp_CFLAGS="-fvisibility=hidden"
  1355. supports_symbol_hiding="yes"
  1356. ])
  1357. CFLAGS="$tmp_save_CFLAGS"
  1358. fi
  1359. fi
  1360. ;;
  1361. SUNPRO_C)
  1362. if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
  1363. tmp_EXTERN="__global"
  1364. tmp_CFLAGS="-xldscope=hidden"
  1365. supports_symbol_hiding="yes"
  1366. fi
  1367. ;;
  1368. esac
  1369. if test "$supports_symbol_hiding" = "yes"; then
  1370. tmp_save_CFLAGS="$CFLAGS"
  1371. CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
  1372. squeeze CFLAGS
  1373. AC_COMPILE_IFELSE([
  1374. AC_LANG_PROGRAM([[
  1375. $tmp_EXTERN char *dummy(char *buff);
  1376. char *dummy(char *buff)
  1377. {
  1378. if(buff)
  1379. return ++buff;
  1380. else
  1381. return buff;
  1382. }
  1383. ]],[[
  1384. char b[16];
  1385. char *r = dummy(&b[0]);
  1386. if(r)
  1387. return (int)*r;
  1388. ]])
  1389. ],[
  1390. supports_symbol_hiding="yes"
  1391. if test -f conftest.err; then
  1392. grep 'visibility' conftest.err >/dev/null
  1393. if test "$?" -eq "0"; then
  1394. supports_symbol_hiding="no"
  1395. fi
  1396. fi
  1397. ],[
  1398. supports_symbol_hiding="no"
  1399. echo " " >&6
  1400. sed 's/^/cc-src: /' conftest.$ac_ext >&6
  1401. sed 's/^/cc-err: /' conftest.err >&6
  1402. echo " " >&6
  1403. ])
  1404. CFLAGS="$tmp_save_CFLAGS"
  1405. fi
  1406. if test "$supports_symbol_hiding" = "yes"; then
  1407. AC_MSG_RESULT([yes])
  1408. symbol_hiding_CFLAGS="$tmp_CFLAGS"
  1409. symbol_hiding_EXTERN="$tmp_EXTERN"
  1410. else
  1411. AC_MSG_RESULT([no])
  1412. fi
  1413. ])
  1414. dnl CURL_VAR_MATCH (VARNAME, VALUE)
  1415. dnl -------------------------------------------------
  1416. dnl Verifies if shell variable VARNAME contains VALUE.
  1417. dnl Contents of variable VARNAME and VALUE are handled
  1418. dnl as whitespace separated lists of words. If at least
  1419. dnl one word of VALUE is present in VARNAME the match
  1420. dnl is considered positive, otherwise false.
  1421. AC_DEFUN([CURL_VAR_MATCH], [
  1422. ac_var_match_word="no"
  1423. for word1 in $[$1]; do
  1424. for word2 in [$2]; do
  1425. if test "$word1" = "$word2"; then
  1426. ac_var_match_word="yes"
  1427. fi
  1428. done
  1429. done
  1430. ])
  1431. dnl CURL_VAR_MATCH_IFELSE (VARNAME, VALUE,
  1432. dnl [ACTION-IF-MATCH], [ACTION-IF-NOT-MATCH])
  1433. dnl -------------------------------------------------
  1434. dnl This performs a CURL_VAR_MATCH check and executes
  1435. dnl first branch if the match is positive, otherwise
  1436. dnl the second branch is executed.
  1437. AC_DEFUN([CURL_VAR_MATCH_IFELSE], [
  1438. CURL_VAR_MATCH([$1],[$2])
  1439. if test "$ac_var_match_word" = "yes"; then
  1440. ifelse($3,,:,[$3])
  1441. ifelse($4,,,[else
  1442. $4])
  1443. fi
  1444. ])
  1445. dnl CURL_VAR_STRIP (VARNAME, VALUE)
  1446. dnl -------------------------------------------------
  1447. dnl Contents of variable VARNAME and VALUE are handled
  1448. dnl as whitespace separated lists of words. Each word
  1449. dnl from VALUE is removed from VARNAME when present.
  1450. AC_DEFUN([CURL_VAR_STRIP], [
  1451. AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
  1452. ac_var_stripped=""
  1453. for word1 in $[$1]; do
  1454. ac_var_strip_word="no"
  1455. for word2 in [$2]; do
  1456. if test "$word1" = "$word2"; then
  1457. ac_var_strip_word="yes"
  1458. fi
  1459. done
  1460. if test "$ac_var_strip_word" = "no"; then
  1461. ac_var_stripped="$ac_var_stripped $word1"
  1462. fi
  1463. done
  1464. dnl squeeze whitespace out of result
  1465. [$1]="$ac_var_stripped"
  1466. squeeze [$1]
  1467. ])