curl-compilers.m4 51 KB

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