acinclude.m4 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2022, 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.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. # SPDX-License-Identifier: curl
  22. #
  23. #***************************************************************************
  24. dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
  25. dnl -------------------------------------------------
  26. dnl Use the C preprocessor to find out if the given object-style symbol
  27. dnl is defined and get its expansion. This macro will not use default
  28. dnl includes even if no INCLUDES argument is given. This macro will run
  29. dnl silently when invoked with three arguments. If the expansion would
  30. dnl result in a set of double-quoted strings the returned expansion will
  31. dnl actually be a single double-quoted string concatenating all them.
  32. AC_DEFUN([CURL_CHECK_DEF], [
  33. AC_REQUIRE([CURL_CPP_P])dnl
  34. OLDCPPFLAGS=$CPPFLAGS
  35. # CPPPFLAG comes from CURL_CPP_P
  36. CPPFLAGS="$CPPFLAGS $CPPPFLAG"
  37. AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
  38. AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
  39. if test -z "$SED"; then
  40. AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
  41. fi
  42. if test -z "$GREP"; then
  43. AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
  44. fi
  45. ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
  46. tmp_exp=""
  47. AC_PREPROC_IFELSE([
  48. AC_LANG_SOURCE(
  49. ifelse($2,,,[$2])[[
  50. #ifdef $1
  51. CURL_DEF_TOKEN $1
  52. #endif
  53. ]])
  54. ],[
  55. tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
  56. "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
  57. "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
  58. "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
  59. if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
  60. tmp_exp=""
  61. fi
  62. ])
  63. if test -z "$tmp_exp"; then
  64. AS_VAR_SET(ac_HaveDef, no)
  65. ifelse($3,,[AC_MSG_RESULT([no])])
  66. else
  67. AS_VAR_SET(ac_HaveDef, yes)
  68. AS_VAR_SET(ac_Def, $tmp_exp)
  69. ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
  70. fi
  71. AS_VAR_POPDEF([ac_Def])dnl
  72. AS_VAR_POPDEF([ac_HaveDef])dnl
  73. CPPFLAGS=$OLDCPPFLAGS
  74. ])
  75. dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
  76. dnl -------------------------------------------------
  77. dnl Use the C compiler to find out only if the given symbol is defined
  78. dnl or not, this can not find out its expansion. This macro will not use
  79. dnl default includes even if no INCLUDES argument is given. This macro
  80. dnl will run silently when invoked with three arguments.
  81. AC_DEFUN([CURL_CHECK_DEF_CC], [
  82. AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
  83. ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
  84. AC_COMPILE_IFELSE([
  85. AC_LANG_SOURCE(
  86. ifelse($2,,,[$2])[[
  87. int main (void)
  88. {
  89. #ifdef $1
  90. return 0;
  91. #else
  92. force compilation error
  93. #endif
  94. }
  95. ]])
  96. ],[
  97. tst_symbol_defined="yes"
  98. ],[
  99. tst_symbol_defined="no"
  100. ])
  101. if test "$tst_symbol_defined" = "yes"; then
  102. AS_VAR_SET(ac_HaveDef, yes)
  103. ifelse($3,,[AC_MSG_RESULT([yes])])
  104. else
  105. AS_VAR_SET(ac_HaveDef, no)
  106. ifelse($3,,[AC_MSG_RESULT([no])])
  107. fi
  108. AS_VAR_POPDEF([ac_HaveDef])dnl
  109. ])
  110. dnl CURL_CHECK_LIB_XNET
  111. dnl -------------------------------------------------
  112. dnl Verify if X/Open network library is required.
  113. AC_DEFUN([CURL_CHECK_LIB_XNET], [
  114. AC_MSG_CHECKING([if X/Open network library is required])
  115. tst_lib_xnet_required="no"
  116. AC_COMPILE_IFELSE([
  117. AC_LANG_SOURCE([[
  118. int main (void)
  119. {
  120. #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
  121. return 0;
  122. #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
  123. return 0;
  124. #else
  125. force compilation error
  126. #endif
  127. }
  128. ]])
  129. ],[
  130. tst_lib_xnet_required="yes"
  131. LIBS="-lxnet $LIBS"
  132. ])
  133. AC_MSG_RESULT([$tst_lib_xnet_required])
  134. ])
  135. dnl CURL_CHECK_AIX_ALL_SOURCE
  136. dnl -------------------------------------------------
  137. dnl Provides a replacement of traditional AC_AIX with
  138. dnl an uniform behavior across all autoconf versions,
  139. dnl and with our own placement rules.
  140. AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
  141. AH_VERBATIM([_ALL_SOURCE],
  142. [/* Define to 1 if OS is AIX. */
  143. #ifndef _ALL_SOURCE
  144. # undef _ALL_SOURCE
  145. #endif])
  146. AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
  147. AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
  148. AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl
  149. AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
  150. AC_EGREP_CPP([yes_this_is_aix],[
  151. #ifdef _AIX
  152. yes_this_is_aix
  153. #endif
  154. ],[
  155. AC_MSG_RESULT([yes])
  156. AC_DEFINE(_ALL_SOURCE)
  157. ],[
  158. AC_MSG_RESULT([no])
  159. ])
  160. ])
  161. dnl CURL_CHECK_HEADER_WINDOWS
  162. dnl -------------------------------------------------
  163. dnl Check for compilable and valid windows.h header
  164. AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
  165. AC_CACHE_CHECK([for windows.h], [curl_cv_header_windows_h], [
  166. AC_COMPILE_IFELSE([
  167. AC_LANG_PROGRAM([[
  168. #undef inline
  169. #ifndef WIN32_LEAN_AND_MEAN
  170. #define WIN32_LEAN_AND_MEAN
  171. #endif
  172. #include <windows.h>
  173. ]],[[
  174. #if defined(__CYGWIN__) || defined(__CEGCC__)
  175. HAVE_WINDOWS_H shall not be defined.
  176. #else
  177. int dummy=2*WINVER;
  178. #endif
  179. ]])
  180. ],[
  181. curl_cv_header_windows_h="yes"
  182. ],[
  183. curl_cv_header_windows_h="no"
  184. ])
  185. ])
  186. case "$curl_cv_header_windows_h" in
  187. yes)
  188. AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
  189. [Define to 1 if you have the windows.h header file.])
  190. ;;
  191. esac
  192. ])
  193. dnl CURL_CHECK_NATIVE_WINDOWS
  194. dnl -------------------------------------------------
  195. dnl Check if building a native Windows target
  196. AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
  197. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  198. AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [
  199. if test "$curl_cv_header_windows_h" = "no"; then
  200. curl_cv_native_windows="no"
  201. else
  202. AC_COMPILE_IFELSE([
  203. AC_LANG_PROGRAM([[
  204. ]],[[
  205. #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
  206. (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
  207. int dummy=1;
  208. #else
  209. Not a native Windows build target.
  210. #endif
  211. ]])
  212. ],[
  213. curl_cv_native_windows="yes"
  214. ],[
  215. curl_cv_native_windows="no"
  216. ])
  217. fi
  218. ])
  219. AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$curl_cv_native_windows" = xyes)
  220. ])
  221. dnl CURL_CHECK_HEADER_WINSOCK2
  222. dnl -------------------------------------------------
  223. dnl Check for compilable and valid winsock2.h header
  224. AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
  225. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  226. AC_CACHE_CHECK([for winsock2.h], [curl_cv_header_winsock2_h], [
  227. AC_COMPILE_IFELSE([
  228. AC_LANG_PROGRAM([[
  229. #undef inline
  230. #ifndef WIN32_LEAN_AND_MEAN
  231. #define WIN32_LEAN_AND_MEAN
  232. #endif
  233. #include <windows.h>
  234. #include <winsock2.h>
  235. ]],[[
  236. #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
  237. HAVE_WINSOCK2_H shall not be defined.
  238. #else
  239. int dummy=2*IPPROTO_ESP;
  240. #endif
  241. ]])
  242. ],[
  243. curl_cv_header_winsock2_h="yes"
  244. ],[
  245. curl_cv_header_winsock2_h="no"
  246. ])
  247. ])
  248. case "$curl_cv_header_winsock2_h" in
  249. yes)
  250. AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
  251. [Define to 1 if you have the winsock2.h header file.])
  252. ;;
  253. esac
  254. ])
  255. dnl CURL_CHECK_HEADER_WS2TCPIP
  256. dnl -------------------------------------------------
  257. dnl Check for compilable and valid ws2tcpip.h header
  258. AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
  259. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  260. AC_CACHE_CHECK([for ws2tcpip.h], [curl_cv_header_ws2tcpip_h], [
  261. AC_COMPILE_IFELSE([
  262. AC_LANG_PROGRAM([[
  263. #undef inline
  264. #ifndef WIN32_LEAN_AND_MEAN
  265. #define WIN32_LEAN_AND_MEAN
  266. #endif
  267. #include <windows.h>
  268. #include <winsock2.h>
  269. #include <ws2tcpip.h>
  270. ]],[[
  271. #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
  272. HAVE_WS2TCPIP_H shall not be defined.
  273. #else
  274. int dummy=2*IP_PKTINFO;
  275. #endif
  276. ]])
  277. ],[
  278. curl_cv_header_ws2tcpip_h="yes"
  279. ],[
  280. curl_cv_header_ws2tcpip_h="no"
  281. ])
  282. ])
  283. case "$curl_cv_header_ws2tcpip_h" in
  284. yes)
  285. AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
  286. [Define to 1 if you have the ws2tcpip.h header file.])
  287. ;;
  288. esac
  289. ])
  290. dnl CURL_CHECK_HEADER_WINCRYPT
  291. dnl -------------------------------------------------
  292. dnl Check for compilable and valid wincrypt.h header
  293. AC_DEFUN([CURL_CHECK_HEADER_WINCRYPT], [
  294. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  295. AC_CACHE_CHECK([for wincrypt.h], [curl_cv_header_wincrypt_h], [
  296. AC_COMPILE_IFELSE([
  297. AC_LANG_PROGRAM([[
  298. #undef inline
  299. #ifndef WIN32_LEAN_AND_MEAN
  300. #define WIN32_LEAN_AND_MEAN
  301. #endif
  302. #include <windows.h>
  303. #include <wincrypt.h>
  304. ]],[[
  305. int dummy=2*PROV_RSA_FULL;
  306. ]])
  307. ],[
  308. curl_cv_header_wincrypt_h="yes"
  309. ],[
  310. curl_cv_header_wincrypt_h="no"
  311. ])
  312. ])
  313. case "$curl_cv_header_wincrypt_h" in
  314. yes)
  315. AC_DEFINE_UNQUOTED(HAVE_WINCRYPT_H, 1,
  316. [Define to 1 if you have the wincrypt.h header file.])
  317. ;;
  318. esac
  319. ])
  320. dnl CURL_CHECK_HEADER_WINLDAP
  321. dnl -------------------------------------------------
  322. dnl Check for compilable and valid winldap.h header
  323. AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
  324. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  325. AC_CACHE_CHECK([for winldap.h], [curl_cv_header_winldap_h], [
  326. AC_COMPILE_IFELSE([
  327. AC_LANG_PROGRAM([[
  328. #undef inline
  329. #ifdef HAVE_WINDOWS_H
  330. #ifndef WIN32_LEAN_AND_MEAN
  331. #define WIN32_LEAN_AND_MEAN
  332. #endif
  333. #include <windows.h>
  334. #endif
  335. #include <winldap.h>
  336. ]],[[
  337. #if defined(__CYGWIN__) || defined(__CEGCC__)
  338. HAVE_WINLDAP_H shall not be defined.
  339. #else
  340. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  341. ULONG res = ldap_unbind(ldp);
  342. #endif
  343. ]])
  344. ],[
  345. curl_cv_header_winldap_h="yes"
  346. ],[
  347. curl_cv_header_winldap_h="no"
  348. ])
  349. ])
  350. case "$curl_cv_header_winldap_h" in
  351. yes)
  352. AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
  353. [Define to 1 if you have the winldap.h header file.])
  354. ;;
  355. esac
  356. ])
  357. dnl CURL_CHECK_HEADER_LBER
  358. dnl -------------------------------------------------
  359. dnl Check for compilable and valid lber.h header,
  360. dnl and check if it is needed even with ldap.h
  361. AC_DEFUN([CURL_CHECK_HEADER_LBER], [
  362. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  363. AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
  364. AC_COMPILE_IFELSE([
  365. AC_LANG_PROGRAM([[
  366. #undef inline
  367. #ifdef HAVE_WINDOWS_H
  368. #ifndef WIN32_LEAN_AND_MEAN
  369. #define WIN32_LEAN_AND_MEAN
  370. #endif
  371. #include <windows.h>
  372. #else
  373. #ifdef HAVE_SYS_TYPES_H
  374. #include <sys/types.h>
  375. #endif
  376. #endif
  377. #ifndef NULL
  378. #define NULL (void *)0
  379. #endif
  380. #include <lber.h>
  381. ]],[[
  382. BerValue *bvp = NULL;
  383. BerElement *bep = ber_init(bvp);
  384. ber_free(bep, 1);
  385. ]])
  386. ],[
  387. curl_cv_header_lber_h="yes"
  388. ],[
  389. curl_cv_header_lber_h="no"
  390. ])
  391. ])
  392. if test "$curl_cv_header_lber_h" = "yes"; then
  393. AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
  394. [Define to 1 if you have the lber.h header file.])
  395. #
  396. AC_COMPILE_IFELSE([
  397. AC_LANG_PROGRAM([[
  398. #undef inline
  399. #ifdef HAVE_WINDOWS_H
  400. #ifndef WIN32_LEAN_AND_MEAN
  401. #define WIN32_LEAN_AND_MEAN
  402. #endif
  403. #include <windows.h>
  404. #else
  405. #ifdef HAVE_SYS_TYPES_H
  406. #include <sys/types.h>
  407. #endif
  408. #endif
  409. #ifndef NULL
  410. #define NULL (void *)0
  411. #endif
  412. #ifndef LDAP_DEPRECATED
  413. #define LDAP_DEPRECATED 1
  414. #endif
  415. #include <ldap.h>
  416. ]],[[
  417. BerValue *bvp = NULL;
  418. BerElement *bep = ber_init(bvp);
  419. ber_free(bep, 1);
  420. ]])
  421. ],[
  422. curl_cv_need_header_lber_h="no"
  423. ],[
  424. curl_cv_need_header_lber_h="yes"
  425. ])
  426. #
  427. case "$curl_cv_need_header_lber_h" in
  428. yes)
  429. AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
  430. [Define to 1 if you need the lber.h header file even with ldap.h])
  431. ;;
  432. esac
  433. fi
  434. ])
  435. dnl CURL_CHECK_HEADER_LDAP
  436. dnl -------------------------------------------------
  437. dnl Check for compilable and valid ldap.h header
  438. AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
  439. AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
  440. AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [
  441. AC_COMPILE_IFELSE([
  442. AC_LANG_PROGRAM([[
  443. #undef inline
  444. #ifdef HAVE_WINDOWS_H
  445. #ifndef WIN32_LEAN_AND_MEAN
  446. #define WIN32_LEAN_AND_MEAN
  447. #endif
  448. #include <windows.h>
  449. #else
  450. #ifdef HAVE_SYS_TYPES_H
  451. #include <sys/types.h>
  452. #endif
  453. #endif
  454. #ifndef LDAP_DEPRECATED
  455. #define LDAP_DEPRECATED 1
  456. #endif
  457. #ifdef NEED_LBER_H
  458. #include <lber.h>
  459. #endif
  460. #include <ldap.h>
  461. ]],[[
  462. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  463. int res = ldap_unbind(ldp);
  464. ]])
  465. ],[
  466. curl_cv_header_ldap_h="yes"
  467. ],[
  468. curl_cv_header_ldap_h="no"
  469. ])
  470. ])
  471. case "$curl_cv_header_ldap_h" in
  472. yes)
  473. AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
  474. [Define to 1 if you have the ldap.h header file.])
  475. ;;
  476. esac
  477. ])
  478. dnl CURL_CHECK_HEADER_LDAP_SSL
  479. dnl -------------------------------------------------
  480. dnl Check for compilable and valid ldap_ssl.h header
  481. AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
  482. AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
  483. AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [
  484. AC_COMPILE_IFELSE([
  485. AC_LANG_PROGRAM([[
  486. #undef inline
  487. #ifdef HAVE_WINDOWS_H
  488. #ifndef WIN32_LEAN_AND_MEAN
  489. #define WIN32_LEAN_AND_MEAN
  490. #endif
  491. #include <windows.h>
  492. #else
  493. #ifdef HAVE_SYS_TYPES_H
  494. #include <sys/types.h>
  495. #endif
  496. #endif
  497. #ifndef LDAP_DEPRECATED
  498. #define LDAP_DEPRECATED 1
  499. #endif
  500. #ifdef NEED_LBER_H
  501. #include <lber.h>
  502. #endif
  503. #ifdef HAVE_LDAP_H
  504. #include <ldap.h>
  505. #endif
  506. #include <ldap_ssl.h>
  507. ]],[[
  508. LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
  509. ]])
  510. ],[
  511. curl_cv_header_ldap_ssl_h="yes"
  512. ],[
  513. curl_cv_header_ldap_ssl_h="no"
  514. ])
  515. ])
  516. case "$curl_cv_header_ldap_ssl_h" in
  517. yes)
  518. AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
  519. [Define to 1 if you have the ldap_ssl.h header file.])
  520. ;;
  521. esac
  522. ])
  523. dnl CURL_CHECK_LIBS_WINLDAP
  524. dnl -------------------------------------------------
  525. dnl Check for libraries needed for WINLDAP support,
  526. dnl and prepended to LIBS any needed libraries.
  527. dnl This macro can take an optional parameter with a
  528. dnl whitespace separated list of libraries to check
  529. dnl before the WINLDAP default ones.
  530. AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
  531. AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
  532. #
  533. AC_MSG_CHECKING([for WINLDAP libraries])
  534. #
  535. u_libs=""
  536. #
  537. ifelse($1,,,[
  538. for x_lib in $1; do
  539. case "$x_lib" in
  540. -l*)
  541. l_lib="$x_lib"
  542. ;;
  543. *)
  544. l_lib="-l$x_lib"
  545. ;;
  546. esac
  547. if test -z "$u_libs"; then
  548. u_libs="$l_lib"
  549. else
  550. u_libs="$u_libs $l_lib"
  551. fi
  552. done
  553. ])
  554. #
  555. curl_cv_save_LIBS="$LIBS"
  556. curl_cv_ldap_LIBS="unknown"
  557. #
  558. for x_nlibs in '' "$u_libs" \
  559. '-lwldap32' ; do
  560. if test "$curl_cv_ldap_LIBS" = "unknown"; then
  561. if test -z "$x_nlibs"; then
  562. LIBS="$curl_cv_save_LIBS"
  563. else
  564. LIBS="$x_nlibs $curl_cv_save_LIBS"
  565. fi
  566. AC_LINK_IFELSE([
  567. AC_LANG_PROGRAM([[
  568. #undef inline
  569. #ifdef HAVE_WINDOWS_H
  570. #ifndef WIN32_LEAN_AND_MEAN
  571. #define WIN32_LEAN_AND_MEAN
  572. #endif
  573. #include <windows.h>
  574. #ifdef HAVE_WINLDAP_H
  575. #include <winldap.h>
  576. #endif
  577. #ifdef HAVE_WINBER_H
  578. #include <winber.h>
  579. #endif
  580. #endif
  581. ]],[[
  582. BERVAL *bvp = NULL;
  583. BerElement *bep = ber_init(bvp);
  584. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  585. ULONG res = ldap_unbind(ldp);
  586. ber_free(bep, 1);
  587. ]])
  588. ],[
  589. curl_cv_ldap_LIBS="$x_nlibs"
  590. ])
  591. fi
  592. done
  593. #
  594. LIBS="$curl_cv_save_LIBS"
  595. #
  596. case X-"$curl_cv_ldap_LIBS" in
  597. X-unknown)
  598. AC_MSG_RESULT([cannot find WINLDAP libraries])
  599. ;;
  600. X-)
  601. AC_MSG_RESULT([no additional lib required])
  602. ;;
  603. *)
  604. if test -z "$curl_cv_save_LIBS"; then
  605. LIBS="$curl_cv_ldap_LIBS"
  606. else
  607. LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
  608. fi
  609. AC_MSG_RESULT([$curl_cv_ldap_LIBS])
  610. ;;
  611. esac
  612. #
  613. ])
  614. dnl CURL_CHECK_LIBS_LDAP
  615. dnl -------------------------------------------------
  616. dnl Check for libraries needed for LDAP support,
  617. dnl and prepended to LIBS any needed libraries.
  618. dnl This macro can take an optional parameter with a
  619. dnl whitespace separated list of libraries to check
  620. dnl before the default ones.
  621. AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
  622. AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
  623. #
  624. AC_MSG_CHECKING([for LDAP libraries])
  625. #
  626. u_libs=""
  627. #
  628. ifelse($1,,,[
  629. for x_lib in $1; do
  630. case "$x_lib" in
  631. -l*)
  632. l_lib="$x_lib"
  633. ;;
  634. *)
  635. l_lib="-l$x_lib"
  636. ;;
  637. esac
  638. if test -z "$u_libs"; then
  639. u_libs="$l_lib"
  640. else
  641. u_libs="$u_libs $l_lib"
  642. fi
  643. done
  644. ])
  645. #
  646. curl_cv_save_LIBS="$LIBS"
  647. curl_cv_ldap_LIBS="unknown"
  648. #
  649. for x_nlibs in '' "$u_libs" \
  650. '-lldap' \
  651. '-lldap -llber' \
  652. '-llber -lldap' \
  653. '-lldapssl -lldapx -lldapsdk' \
  654. '-lldapsdk -lldapx -lldapssl' \
  655. '-lldap -llber -lssl -lcrypto' ; do
  656. if test "$curl_cv_ldap_LIBS" = "unknown"; then
  657. if test -z "$x_nlibs"; then
  658. LIBS="$curl_cv_save_LIBS"
  659. else
  660. LIBS="$x_nlibs $curl_cv_save_LIBS"
  661. fi
  662. AC_LINK_IFELSE([
  663. AC_LANG_PROGRAM([[
  664. #undef inline
  665. #ifdef HAVE_WINDOWS_H
  666. #ifndef WIN32_LEAN_AND_MEAN
  667. #define WIN32_LEAN_AND_MEAN
  668. #endif
  669. #include <windows.h>
  670. #else
  671. #ifdef HAVE_SYS_TYPES_H
  672. #include <sys/types.h>
  673. #endif
  674. #endif
  675. #ifndef NULL
  676. #define NULL (void *)0
  677. #endif
  678. #ifndef LDAP_DEPRECATED
  679. #define LDAP_DEPRECATED 1
  680. #endif
  681. #ifdef NEED_LBER_H
  682. #include <lber.h>
  683. #endif
  684. #ifdef HAVE_LDAP_H
  685. #include <ldap.h>
  686. #endif
  687. ]],[[
  688. BerValue *bvp = NULL;
  689. BerElement *bep = ber_init(bvp);
  690. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  691. int res = ldap_unbind(ldp);
  692. ber_free(bep, 1);
  693. ]])
  694. ],[
  695. curl_cv_ldap_LIBS="$x_nlibs"
  696. ])
  697. fi
  698. done
  699. #
  700. LIBS="$curl_cv_save_LIBS"
  701. #
  702. case X-"$curl_cv_ldap_LIBS" in
  703. X-unknown)
  704. AC_MSG_RESULT([cannot find LDAP libraries])
  705. ;;
  706. X-)
  707. AC_MSG_RESULT([no additional lib required])
  708. ;;
  709. *)
  710. if test -z "$curl_cv_save_LIBS"; then
  711. LIBS="$curl_cv_ldap_LIBS"
  712. else
  713. LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
  714. fi
  715. AC_MSG_RESULT([$curl_cv_ldap_LIBS])
  716. ;;
  717. esac
  718. #
  719. ])
  720. dnl TYPE_SOCKADDR_STORAGE
  721. dnl -------------------------------------------------
  722. dnl Check for struct sockaddr_storage. Most IPv6-enabled
  723. dnl hosts have it, but AIX 4.3 is one known exception.
  724. AC_DEFUN([TYPE_SOCKADDR_STORAGE],
  725. [
  726. AC_CHECK_TYPE([struct sockaddr_storage],
  727. AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
  728. [if struct sockaddr_storage is defined]), ,
  729. [
  730. #undef inline
  731. #ifdef HAVE_WINDOWS_H
  732. #ifndef WIN32_LEAN_AND_MEAN
  733. #define WIN32_LEAN_AND_MEAN
  734. #endif
  735. #include <windows.h>
  736. #ifdef HAVE_WINSOCK2_H
  737. #include <winsock2.h>
  738. #endif
  739. #else
  740. #ifdef HAVE_SYS_TYPES_H
  741. #include <sys/types.h>
  742. #endif
  743. #ifdef HAVE_SYS_SOCKET_H
  744. #include <sys/socket.h>
  745. #endif
  746. #ifdef HAVE_NETINET_IN_H
  747. #include <netinet/in.h>
  748. #endif
  749. #ifdef HAVE_ARPA_INET_H
  750. #include <arpa/inet.h>
  751. #endif
  752. #endif
  753. ])
  754. ])
  755. dnl CURL_CHECK_FUNC_RECV
  756. dnl -------------------------------------------------
  757. dnl Test if the socket recv() function is available,
  758. dnl and check its return type and the types of its
  759. dnl arguments. If the function succeeds HAVE_RECV
  760. dnl will be defined, defining the types of the arguments
  761. dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
  762. dnl and RECV_TYPE_ARG4, defining the type of the function
  763. dnl return value in RECV_TYPE_RETV.
  764. AC_DEFUN([CURL_CHECK_FUNC_RECV], [
  765. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  766. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  767. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  768. #
  769. AC_MSG_CHECKING([for recv])
  770. AC_LINK_IFELSE([
  771. AC_LANG_PROGRAM([[
  772. #undef inline
  773. #ifdef HAVE_WINDOWS_H
  774. #ifndef WIN32_LEAN_AND_MEAN
  775. #define WIN32_LEAN_AND_MEAN
  776. #endif
  777. #include <windows.h>
  778. #ifdef HAVE_WINSOCK2_H
  779. #include <winsock2.h>
  780. #endif
  781. #else
  782. $curl_includes_bsdsocket
  783. #ifdef HAVE_SYS_TYPES_H
  784. #include <sys/types.h>
  785. #endif
  786. #ifdef HAVE_SYS_SOCKET_H
  787. #include <sys/socket.h>
  788. #endif
  789. #endif
  790. ]],[[
  791. recv(0, 0, 0, 0);
  792. ]])
  793. ],[
  794. AC_MSG_RESULT([yes])
  795. curl_cv_recv="yes"
  796. ],[
  797. AC_MSG_RESULT([no])
  798. curl_cv_recv="no"
  799. ])
  800. #
  801. if test "$curl_cv_recv" = "yes"; then
  802. AC_CACHE_CHECK([types of args and return type for recv],
  803. [curl_cv_func_recv_args], [
  804. curl_cv_func_recv_args="unknown"
  805. for recv_retv in 'int' 'ssize_t'; do
  806. for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
  807. for recv_arg2 in 'char *' 'void *'; do
  808. for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
  809. for recv_arg4 in 'int' 'unsigned int'; do
  810. if test "$curl_cv_func_recv_args" = "unknown"; then
  811. AC_COMPILE_IFELSE([
  812. AC_LANG_PROGRAM([[
  813. #undef inline
  814. #ifdef HAVE_WINDOWS_H
  815. #ifndef WIN32_LEAN_AND_MEAN
  816. #define WIN32_LEAN_AND_MEAN
  817. #endif
  818. #include <windows.h>
  819. #ifdef HAVE_WINSOCK2_H
  820. #include <winsock2.h>
  821. #endif
  822. #define RECVCALLCONV PASCAL
  823. #else
  824. $curl_includes_bsdsocket
  825. #ifdef HAVE_SYS_TYPES_H
  826. #include <sys/types.h>
  827. #endif
  828. #ifdef HAVE_SYS_SOCKET_H
  829. #include <sys/socket.h>
  830. #endif
  831. #define RECVCALLCONV
  832. #endif
  833. #ifndef HAVE_PROTO_BSDSOCKET_H
  834. extern $recv_retv RECVCALLCONV
  835. recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
  836. #endif
  837. ]],[[
  838. $recv_arg1 s=0;
  839. $recv_arg2 buf=0;
  840. $recv_arg3 len=0;
  841. $recv_arg4 flags=0;
  842. $recv_retv res = recv(s, buf, len, flags);
  843. ]])
  844. ],[
  845. curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
  846. ])
  847. fi
  848. done
  849. done
  850. done
  851. done
  852. done
  853. ]) # AC-CACHE-CHECK
  854. if test "$curl_cv_func_recv_args" = "unknown"; then
  855. AC_MSG_ERROR([Cannot find proper types to use for recv args])
  856. else
  857. recv_prev_IFS=$IFS; IFS=','
  858. set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
  859. IFS=$recv_prev_IFS
  860. shift
  861. #
  862. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
  863. [Define to the type of arg 1 for recv.])
  864. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
  865. [Define to the type of arg 2 for recv.])
  866. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
  867. [Define to the type of arg 3 for recv.])
  868. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
  869. [Define to the type of arg 4 for recv.])
  870. AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
  871. [Define to the function return type for recv.])
  872. #
  873. AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
  874. [Define to 1 if you have the recv function.])
  875. curl_cv_func_recv="yes"
  876. fi
  877. else
  878. AC_MSG_ERROR([Unable to link function recv])
  879. fi
  880. ])
  881. dnl CURL_CHECK_FUNC_SEND
  882. dnl -------------------------------------------------
  883. dnl Test if the socket send() function is available,
  884. dnl and check its return type and the types of its
  885. dnl arguments. If the function succeeds HAVE_SEND
  886. dnl will be defined, defining the types of the arguments
  887. dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
  888. dnl and SEND_TYPE_ARG4, defining the type of the function
  889. dnl return value in SEND_TYPE_RETV, and also defining the
  890. dnl type qualifier of second argument in SEND_QUAL_ARG2.
  891. AC_DEFUN([CURL_CHECK_FUNC_SEND], [
  892. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  893. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  894. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  895. #
  896. AC_MSG_CHECKING([for send])
  897. AC_LINK_IFELSE([
  898. AC_LANG_PROGRAM([[
  899. #undef inline
  900. #ifdef HAVE_WINDOWS_H
  901. #ifndef WIN32_LEAN_AND_MEAN
  902. #define WIN32_LEAN_AND_MEAN
  903. #endif
  904. #include <windows.h>
  905. #ifdef HAVE_WINSOCK2_H
  906. #include <winsock2.h>
  907. #endif
  908. #else
  909. $curl_includes_bsdsocket
  910. #ifdef HAVE_SYS_TYPES_H
  911. #include <sys/types.h>
  912. #endif
  913. #ifdef HAVE_SYS_SOCKET_H
  914. #include <sys/socket.h>
  915. #endif
  916. #endif
  917. ]],[[
  918. send(0, 0, 0, 0);
  919. ]])
  920. ],[
  921. AC_MSG_RESULT([yes])
  922. curl_cv_send="yes"
  923. ],[
  924. AC_MSG_RESULT([no])
  925. curl_cv_send="no"
  926. ])
  927. #
  928. if test "$curl_cv_send" = "yes"; then
  929. AC_CACHE_CHECK([types of args and return type for send],
  930. [curl_cv_func_send_args], [
  931. curl_cv_func_send_args="unknown"
  932. for send_retv in 'int' 'ssize_t'; do
  933. for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
  934. for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
  935. for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
  936. for send_arg4 in 'int' 'unsigned int'; do
  937. if test "$curl_cv_func_send_args" = "unknown"; then
  938. AC_COMPILE_IFELSE([
  939. AC_LANG_PROGRAM([[
  940. #undef inline
  941. #ifdef HAVE_WINDOWS_H
  942. #ifndef WIN32_LEAN_AND_MEAN
  943. #define WIN32_LEAN_AND_MEAN
  944. #endif
  945. #include <windows.h>
  946. #ifdef HAVE_WINSOCK2_H
  947. #include <winsock2.h>
  948. #endif
  949. #define SENDCALLCONV PASCAL
  950. #else
  951. $curl_includes_bsdsocket
  952. #ifdef HAVE_SYS_TYPES_H
  953. #include <sys/types.h>
  954. #endif
  955. #ifdef HAVE_SYS_SOCKET_H
  956. #include <sys/socket.h>
  957. #endif
  958. #define SENDCALLCONV
  959. #endif
  960. #ifndef HAVE_PROTO_BSDSOCKET_H
  961. extern $send_retv SENDCALLCONV
  962. send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
  963. #endif
  964. ]],[[
  965. $send_arg1 s=0;
  966. $send_arg3 len=0;
  967. $send_arg4 flags=0;
  968. $send_retv res = send(s, 0, len, flags);
  969. ]])
  970. ],[
  971. curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
  972. ])
  973. fi
  974. done
  975. done
  976. done
  977. done
  978. done
  979. ]) # AC-CACHE-CHECK
  980. if test "$curl_cv_func_send_args" = "unknown"; then
  981. AC_MSG_ERROR([Cannot find proper types to use for send args])
  982. else
  983. send_prev_IFS=$IFS; IFS=','
  984. set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
  985. IFS=$send_prev_IFS
  986. shift
  987. #
  988. send_qual_type_arg2=$[2]
  989. #
  990. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
  991. [Define to the type of arg 1 for send.])
  992. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
  993. [Define to the type of arg 3 for send.])
  994. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
  995. [Define to the type of arg 4 for send.])
  996. AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
  997. [Define to the function return type for send.])
  998. #
  999. prev_sh_opts=$-
  1000. #
  1001. case $prev_sh_opts in
  1002. *f*)
  1003. ;;
  1004. *)
  1005. set -f
  1006. ;;
  1007. esac
  1008. #
  1009. case "$send_qual_type_arg2" in
  1010. const*)
  1011. send_qual_arg2=const
  1012. send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
  1013. ;;
  1014. *)
  1015. send_qual_arg2=
  1016. send_type_arg2=$send_qual_type_arg2
  1017. ;;
  1018. esac
  1019. #
  1020. AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
  1021. [Define to the type qualifier of arg 2 for send.])
  1022. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
  1023. [Define to the type of arg 2 for send.])
  1024. #
  1025. case $prev_sh_opts in
  1026. *f*)
  1027. ;;
  1028. *)
  1029. set +f
  1030. ;;
  1031. esac
  1032. #
  1033. AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
  1034. [Define to 1 if you have the send function.])
  1035. curl_cv_func_send="yes"
  1036. fi
  1037. else
  1038. AC_MSG_ERROR([Unable to link function send])
  1039. fi
  1040. ])
  1041. dnl CURL_CHECK_MSG_NOSIGNAL
  1042. dnl -------------------------------------------------
  1043. dnl Check for MSG_NOSIGNAL
  1044. AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
  1045. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  1046. AC_CACHE_CHECK([for MSG_NOSIGNAL], [curl_cv_msg_nosignal], [
  1047. AC_COMPILE_IFELSE([
  1048. AC_LANG_PROGRAM([[
  1049. #undef inline
  1050. #ifdef HAVE_WINDOWS_H
  1051. #ifndef WIN32_LEAN_AND_MEAN
  1052. #define WIN32_LEAN_AND_MEAN
  1053. #endif
  1054. #include <windows.h>
  1055. #ifdef HAVE_WINSOCK2_H
  1056. #include <winsock2.h>
  1057. #endif
  1058. #else
  1059. #ifdef HAVE_SYS_TYPES_H
  1060. #include <sys/types.h>
  1061. #endif
  1062. #ifdef HAVE_SYS_SOCKET_H
  1063. #include <sys/socket.h>
  1064. #endif
  1065. #endif
  1066. ]],[[
  1067. int flag=MSG_NOSIGNAL;
  1068. ]])
  1069. ],[
  1070. curl_cv_msg_nosignal="yes"
  1071. ],[
  1072. curl_cv_msg_nosignal="no"
  1073. ])
  1074. ])
  1075. case "$curl_cv_msg_nosignal" in
  1076. yes)
  1077. AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
  1078. [Define to 1 if you have the MSG_NOSIGNAL flag.])
  1079. ;;
  1080. esac
  1081. ])
  1082. dnl CURL_CHECK_STRUCT_TIMEVAL
  1083. dnl -------------------------------------------------
  1084. dnl Check for timeval struct
  1085. AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
  1086. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  1087. AC_CHECK_HEADERS(sys/types.h sys/time.h sys/socket.h)
  1088. AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
  1089. AC_COMPILE_IFELSE([
  1090. AC_LANG_PROGRAM([[
  1091. #undef inline
  1092. #ifdef HAVE_WINDOWS_H
  1093. #ifndef WIN32_LEAN_AND_MEAN
  1094. #define WIN32_LEAN_AND_MEAN
  1095. #endif
  1096. #include <windows.h>
  1097. #ifdef HAVE_WINSOCK2_H
  1098. #include <winsock2.h>
  1099. #endif
  1100. #endif
  1101. #ifdef HAVE_SYS_TYPES_H
  1102. #include <sys/types.h>
  1103. #endif
  1104. #ifdef HAVE_SYS_TIME_H
  1105. #include <sys/time.h>
  1106. #endif
  1107. #include <time.h>
  1108. #ifdef HAVE_SYS_SOCKET_H
  1109. #include <sys/socket.h>
  1110. #endif
  1111. ]],[[
  1112. struct timeval ts;
  1113. ts.tv_sec = 0;
  1114. ts.tv_usec = 0;
  1115. ]])
  1116. ],[
  1117. curl_cv_struct_timeval="yes"
  1118. ],[
  1119. curl_cv_struct_timeval="no"
  1120. ])
  1121. ])
  1122. case "$curl_cv_struct_timeval" in
  1123. yes)
  1124. AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
  1125. [Define to 1 if you have the timeval struct.])
  1126. ;;
  1127. esac
  1128. ])
  1129. dnl TYPE_IN_ADDR_T
  1130. dnl -------------------------------------------------
  1131. dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
  1132. dnl and a few other things.
  1133. AC_DEFUN([TYPE_IN_ADDR_T], [
  1134. AC_CHECK_TYPE([in_addr_t], ,[
  1135. dnl in_addr_t not available
  1136. AC_CACHE_CHECK([for in_addr_t equivalent],
  1137. [curl_cv_in_addr_t_equiv], [
  1138. curl_cv_in_addr_t_equiv="unknown"
  1139. for t in "unsigned long" int size_t unsigned long; do
  1140. if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
  1141. AC_LINK_IFELSE([
  1142. AC_LANG_PROGRAM([[
  1143. #undef inline
  1144. #ifdef HAVE_WINDOWS_H
  1145. #ifndef WIN32_LEAN_AND_MEAN
  1146. #define WIN32_LEAN_AND_MEAN
  1147. #endif
  1148. #include <windows.h>
  1149. #ifdef HAVE_WINSOCK2_H
  1150. #include <winsock2.h>
  1151. #endif
  1152. #else
  1153. #ifdef HAVE_SYS_TYPES_H
  1154. #include <sys/types.h>
  1155. #endif
  1156. #ifdef HAVE_SYS_SOCKET_H
  1157. #include <sys/socket.h>
  1158. #endif
  1159. #ifdef HAVE_NETINET_IN_H
  1160. #include <netinet/in.h>
  1161. #endif
  1162. #ifdef HAVE_ARPA_INET_H
  1163. #include <arpa/inet.h>
  1164. #endif
  1165. #endif
  1166. ]],[[
  1167. $t data = inet_addr ("1.2.3.4");
  1168. ]])
  1169. ],[
  1170. curl_cv_in_addr_t_equiv="$t"
  1171. ])
  1172. fi
  1173. done
  1174. ])
  1175. case "$curl_cv_in_addr_t_equiv" in
  1176. unknown)
  1177. AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
  1178. ;;
  1179. *)
  1180. AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
  1181. [Type to use in place of in_addr_t when system does not provide it.])
  1182. ;;
  1183. esac
  1184. ],[
  1185. #undef inline
  1186. #ifdef HAVE_WINDOWS_H
  1187. #ifndef WIN32_LEAN_AND_MEAN
  1188. #define WIN32_LEAN_AND_MEAN
  1189. #endif
  1190. #include <windows.h>
  1191. #ifdef HAVE_WINSOCK2_H
  1192. #include <winsock2.h>
  1193. #endif
  1194. #else
  1195. #ifdef HAVE_SYS_TYPES_H
  1196. #include <sys/types.h>
  1197. #endif
  1198. #ifdef HAVE_SYS_SOCKET_H
  1199. #include <sys/socket.h>
  1200. #endif
  1201. #ifdef HAVE_NETINET_IN_H
  1202. #include <netinet/in.h>
  1203. #endif
  1204. #ifdef HAVE_ARPA_INET_H
  1205. #include <arpa/inet.h>
  1206. #endif
  1207. #endif
  1208. ])
  1209. ])
  1210. dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
  1211. dnl -------------------------------------------------
  1212. dnl Check if monotonic clock_gettime is available.
  1213. AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
  1214. AC_CHECK_HEADERS(sys/types.h sys/time.h)
  1215. AC_MSG_CHECKING([for monotonic clock_gettime])
  1216. #
  1217. if test "x$dontwant_rt" = "xno" ; then
  1218. AC_COMPILE_IFELSE([
  1219. AC_LANG_PROGRAM([[
  1220. #ifdef HAVE_SYS_TYPES_H
  1221. #include <sys/types.h>
  1222. #endif
  1223. #ifdef HAVE_SYS_TIME_H
  1224. #include <sys/time.h>
  1225. #endif
  1226. #include <time.h>
  1227. ]],[[
  1228. struct timespec ts;
  1229. (void)clock_gettime(CLOCK_MONOTONIC, &ts);
  1230. ]])
  1231. ],[
  1232. AC_MSG_RESULT([yes])
  1233. curl_func_clock_gettime="yes"
  1234. ],[
  1235. AC_MSG_RESULT([no])
  1236. curl_func_clock_gettime="no"
  1237. ])
  1238. fi
  1239. dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
  1240. dnl until library linking and run-time checks for clock_gettime succeed.
  1241. ])
  1242. dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
  1243. dnl -------------------------------------------------
  1244. dnl If monotonic clock_gettime is available then,
  1245. dnl check and prepended to LIBS any needed libraries.
  1246. AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
  1247. AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
  1248. #
  1249. if test "$curl_func_clock_gettime" = "yes"; then
  1250. #
  1251. AC_MSG_CHECKING([for clock_gettime in libraries])
  1252. #
  1253. curl_cv_save_LIBS="$LIBS"
  1254. curl_cv_gclk_LIBS="unknown"
  1255. #
  1256. for x_xlibs in '' '-lrt' '-lposix4' ; do
  1257. if test "$curl_cv_gclk_LIBS" = "unknown"; then
  1258. if test -z "$x_xlibs"; then
  1259. LIBS="$curl_cv_save_LIBS"
  1260. else
  1261. LIBS="$x_xlibs $curl_cv_save_LIBS"
  1262. fi
  1263. AC_LINK_IFELSE([
  1264. AC_LANG_PROGRAM([[
  1265. #ifdef HAVE_SYS_TYPES_H
  1266. #include <sys/types.h>
  1267. #endif
  1268. #ifdef HAVE_SYS_TIME_H
  1269. #include <sys/time.h>
  1270. #endif
  1271. #include <time.h>
  1272. ]],[[
  1273. struct timespec ts;
  1274. (void)clock_gettime(CLOCK_MONOTONIC, &ts);
  1275. ]])
  1276. ],[
  1277. curl_cv_gclk_LIBS="$x_xlibs"
  1278. ])
  1279. fi
  1280. done
  1281. #
  1282. LIBS="$curl_cv_save_LIBS"
  1283. #
  1284. case X-"$curl_cv_gclk_LIBS" in
  1285. X-unknown)
  1286. AC_MSG_RESULT([cannot find clock_gettime])
  1287. AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
  1288. curl_func_clock_gettime="no"
  1289. ;;
  1290. X-)
  1291. AC_MSG_RESULT([no additional lib required])
  1292. curl_func_clock_gettime="yes"
  1293. ;;
  1294. *)
  1295. if test -z "$curl_cv_save_LIBS"; then
  1296. LIBS="$curl_cv_gclk_LIBS"
  1297. else
  1298. LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
  1299. fi
  1300. AC_MSG_RESULT([$curl_cv_gclk_LIBS])
  1301. curl_func_clock_gettime="yes"
  1302. ;;
  1303. esac
  1304. #
  1305. dnl only do runtime verification when not cross-compiling
  1306. if test "x$cross_compiling" != "xyes" &&
  1307. test "$curl_func_clock_gettime" = "yes"; then
  1308. AC_MSG_CHECKING([if monotonic clock_gettime works])
  1309. CURL_RUN_IFELSE([
  1310. AC_LANG_PROGRAM([[
  1311. #ifdef HAVE_STDLIB_H
  1312. #include <stdlib.h>
  1313. #endif
  1314. #ifdef HAVE_SYS_TYPES_H
  1315. #include <sys/types.h>
  1316. #endif
  1317. #ifdef HAVE_SYS_TIME_H
  1318. #include <sys/time.h>
  1319. #endif
  1320. #include <time.h>
  1321. ]],[[
  1322. struct timespec ts;
  1323. if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
  1324. exit(0);
  1325. else
  1326. exit(1);
  1327. ]])
  1328. ],[
  1329. AC_MSG_RESULT([yes])
  1330. ],[
  1331. AC_MSG_RESULT([no])
  1332. AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
  1333. curl_func_clock_gettime="no"
  1334. LIBS="$curl_cv_save_LIBS"
  1335. ])
  1336. fi
  1337. #
  1338. case "$curl_func_clock_gettime" in
  1339. yes)
  1340. AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
  1341. [Define to 1 if you have the clock_gettime function and monotonic timer.])
  1342. ;;
  1343. esac
  1344. #
  1345. fi
  1346. #
  1347. ])
  1348. dnl CURL_CHECK_LIBS_CONNECT
  1349. dnl -------------------------------------------------
  1350. dnl Verify if network connect function is already available
  1351. dnl using current libraries or if another one is required.
  1352. AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
  1353. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1354. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1355. AC_MSG_CHECKING([for connect in libraries])
  1356. tst_connect_save_LIBS="$LIBS"
  1357. tst_connect_need_LIBS="unknown"
  1358. for tst_lib in '' '-lsocket' ; do
  1359. if test "$tst_connect_need_LIBS" = "unknown"; then
  1360. LIBS="$tst_lib $tst_connect_save_LIBS"
  1361. AC_LINK_IFELSE([
  1362. AC_LANG_PROGRAM([[
  1363. $curl_includes_winsock2
  1364. $curl_includes_bsdsocket
  1365. #if !defined(HAVE_WINDOWS_H) && !defined(HAVE_PROTO_BSDSOCKET_H)
  1366. int connect(int, void*, int);
  1367. #endif
  1368. ]],[[
  1369. if(0 != connect(0, 0, 0))
  1370. return 1;
  1371. ]])
  1372. ],[
  1373. tst_connect_need_LIBS="$tst_lib"
  1374. ])
  1375. fi
  1376. done
  1377. LIBS="$tst_connect_save_LIBS"
  1378. #
  1379. case X-"$tst_connect_need_LIBS" in
  1380. X-unknown)
  1381. AC_MSG_RESULT([cannot find connect])
  1382. AC_MSG_ERROR([cannot find connect function in libraries.])
  1383. ;;
  1384. X-)
  1385. AC_MSG_RESULT([yes])
  1386. ;;
  1387. *)
  1388. AC_MSG_RESULT([$tst_connect_need_LIBS])
  1389. LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
  1390. ;;
  1391. esac
  1392. ])
  1393. dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
  1394. dnl -------------------------------------------------
  1395. dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
  1396. dnl symbol that can be further used in custom template configuration
  1397. dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
  1398. dnl argument for the description. Symbol definitions done with this
  1399. dnl macro are intended to be exclusively used in handcrafted *.h.in
  1400. dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
  1401. dnl prevents autoheader generation and insertion of symbol template
  1402. dnl stub and definition into the first configuration header file. Do
  1403. dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
  1404. dnl one serves different functional needs.
  1405. AC_DEFUN([CURL_DEFINE_UNQUOTED], [
  1406. cat >>confdefs.h <<_EOF
  1407. [@%:@define] $1 ifelse($#, 2, [$2], 1)
  1408. _EOF
  1409. ])
  1410. dnl CURL_CONFIGURE_PULL_SYS_POLL
  1411. dnl -------------------------------------------------
  1412. dnl The need for the sys/poll.h inclusion arises mainly to properly
  1413. dnl interface AIX systems which define macros 'events' and 'revents'.
  1414. AC_DEFUN([CURL_CONFIGURE_PULL_SYS_POLL], [
  1415. AC_REQUIRE([CURL_INCLUDES_POLL])dnl
  1416. #
  1417. tst_poll_events_macro_defined="unknown"
  1418. #
  1419. AC_COMPILE_IFELSE([
  1420. AC_LANG_PROGRAM([[
  1421. $curl_includes_poll
  1422. ]],[[
  1423. #if defined(events) || defined(revents)
  1424. return 0;
  1425. #else
  1426. force compilation error
  1427. #endif
  1428. ]])
  1429. ],[
  1430. tst_poll_events_macro_defined="yes"
  1431. ],[
  1432. tst_poll_events_macro_defined="no"
  1433. ])
  1434. #
  1435. if test "$tst_poll_events_macro_defined" = "yes"; then
  1436. if test "x$ac_cv_header_sys_poll_h" = "xyes"; then
  1437. CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_POLL_H])
  1438. fi
  1439. fi
  1440. #
  1441. ])
  1442. dnl CURL_CHECK_FUNC_SELECT
  1443. dnl -------------------------------------------------
  1444. dnl Test if the socket select() function is available,
  1445. dnl and check its return type and the types of its
  1446. dnl arguments. If the function succeeds HAVE_SELECT
  1447. dnl will be defined, defining the types of the
  1448. dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
  1449. dnl and SELECT_TYPE_ARG5, defining the type of the
  1450. dnl function return value in SELECT_TYPE_RETV, and
  1451. dnl also defining the type qualifier of fifth argument
  1452. dnl in SELECT_QUAL_ARG5.
  1453. AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
  1454. AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
  1455. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1456. AC_CHECK_HEADERS(sys/select.h sys/socket.h)
  1457. #
  1458. AC_MSG_CHECKING([for select])
  1459. AC_LINK_IFELSE([
  1460. AC_LANG_PROGRAM([[
  1461. #undef inline
  1462. #ifdef HAVE_WINDOWS_H
  1463. #ifndef WIN32_LEAN_AND_MEAN
  1464. #define WIN32_LEAN_AND_MEAN
  1465. #endif
  1466. #include <windows.h>
  1467. #ifdef HAVE_WINSOCK2_H
  1468. #include <winsock2.h>
  1469. #endif
  1470. #endif
  1471. #ifdef HAVE_SYS_TYPES_H
  1472. #include <sys/types.h>
  1473. #endif
  1474. #ifdef HAVE_SYS_TIME_H
  1475. #include <sys/time.h>
  1476. #endif
  1477. #include <time.h>
  1478. #ifndef HAVE_WINDOWS_H
  1479. #ifdef HAVE_SYS_SELECT_H
  1480. #include <sys/select.h>
  1481. #elif defined(HAVE_UNISTD_H)
  1482. #include <unistd.h>
  1483. #endif
  1484. #ifdef HAVE_SYS_SOCKET_H
  1485. #include <sys/socket.h>
  1486. #endif
  1487. $curl_includes_bsdsocket
  1488. #endif
  1489. ]],[[
  1490. select(0, 0, 0, 0, 0);
  1491. ]])
  1492. ],[
  1493. AC_MSG_RESULT([yes])
  1494. curl_cv_select="yes"
  1495. ],[
  1496. AC_MSG_RESULT([no])
  1497. curl_cv_select="no"
  1498. ])
  1499. #
  1500. if test "$curl_cv_select" = "yes"; then
  1501. AC_CACHE_CHECK([types of args and return type for select],
  1502. [curl_cv_func_select_args], [
  1503. curl_cv_func_select_args="unknown"
  1504. for sel_retv in 'int' 'ssize_t'; do
  1505. for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
  1506. for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
  1507. for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
  1508. if test "$curl_cv_func_select_args" = "unknown"; then
  1509. AC_COMPILE_IFELSE([
  1510. AC_LANG_PROGRAM([[
  1511. #undef inline
  1512. #ifdef HAVE_WINDOWS_H
  1513. #ifndef WIN32_LEAN_AND_MEAN
  1514. #define WIN32_LEAN_AND_MEAN
  1515. #endif
  1516. #include <windows.h>
  1517. #ifdef HAVE_WINSOCK2_H
  1518. #include <winsock2.h>
  1519. #endif
  1520. #define SELECTCALLCONV PASCAL
  1521. #endif
  1522. #ifdef HAVE_SYS_TYPES_H
  1523. #include <sys/types.h>
  1524. #endif
  1525. #ifdef HAVE_SYS_TIME_H
  1526. #include <sys/time.h>
  1527. #endif
  1528. #include <time.h>
  1529. #ifndef HAVE_WINDOWS_H
  1530. #ifdef HAVE_SYS_SELECT_H
  1531. #include <sys/select.h>
  1532. #elif defined(HAVE_UNISTD_H)
  1533. #include <unistd.h>
  1534. #endif
  1535. #ifdef HAVE_SYS_SOCKET_H
  1536. #include <sys/socket.h>
  1537. #endif
  1538. $curl_includes_bsdsocket
  1539. #define SELECTCALLCONV
  1540. #endif
  1541. #ifndef HAVE_STRUCT_TIMEVAL
  1542. struct timeval {
  1543. long tv_sec;
  1544. long tv_usec;
  1545. };
  1546. #endif
  1547. #ifndef HAVE_PROTO_BSDSOCKET_H
  1548. extern $sel_retv SELECTCALLCONV
  1549. select($sel_arg1,
  1550. $sel_arg234,
  1551. $sel_arg234,
  1552. $sel_arg234,
  1553. $sel_arg5);
  1554. #endif
  1555. ]],[[
  1556. $sel_arg1 nfds=0;
  1557. $sel_arg234 rfds=0;
  1558. $sel_arg234 wfds=0;
  1559. $sel_arg234 efds=0;
  1560. $sel_retv res = select(nfds, rfds, wfds, efds, 0);
  1561. ]])
  1562. ],[
  1563. curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
  1564. ])
  1565. fi
  1566. done
  1567. done
  1568. done
  1569. done
  1570. ]) # AC-CACHE-CHECK
  1571. if test "$curl_cv_func_select_args" = "unknown"; then
  1572. AC_MSG_WARN([Cannot find proper types to use for select args])
  1573. AC_MSG_WARN([HAVE_SELECT will not be defined])
  1574. else
  1575. select_prev_IFS=$IFS; IFS=','
  1576. set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
  1577. IFS=$select_prev_IFS
  1578. shift
  1579. #
  1580. sel_qual_type_arg5=$[3]
  1581. #
  1582. AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
  1583. [Define to the type of arg 1 for select.])
  1584. AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
  1585. [Define to the type of args 2, 3 and 4 for select.])
  1586. AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
  1587. [Define to the function return type for select.])
  1588. #
  1589. prev_sh_opts=$-
  1590. #
  1591. case $prev_sh_opts in
  1592. *f*)
  1593. ;;
  1594. *)
  1595. set -f
  1596. ;;
  1597. esac
  1598. #
  1599. case "$sel_qual_type_arg5" in
  1600. const*)
  1601. sel_qual_arg5=const
  1602. sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
  1603. ;;
  1604. *)
  1605. sel_qual_arg5=
  1606. sel_type_arg5=$sel_qual_type_arg5
  1607. ;;
  1608. esac
  1609. #
  1610. AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
  1611. [Define to the type qualifier of arg 5 for select.])
  1612. AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
  1613. [Define to the type of arg 5 for select.])
  1614. #
  1615. case $prev_sh_opts in
  1616. *f*)
  1617. ;;
  1618. *)
  1619. set +f
  1620. ;;
  1621. esac
  1622. #
  1623. AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
  1624. [Define to 1 if you have the select function.])
  1625. curl_cv_func_select="yes"
  1626. fi
  1627. fi
  1628. ])
  1629. dnl CURL_VERIFY_RUNTIMELIBS
  1630. dnl -------------------------------------------------
  1631. dnl Verify that the shared libs found so far can be used when running
  1632. dnl programs, since otherwise the situation will create odd configure errors
  1633. dnl that are misleading people.
  1634. dnl
  1635. dnl Make sure this test is run BEFORE the first test in the script that
  1636. dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
  1637. dnl macro. It must also run AFTER all lib-checking macros are complete.
  1638. AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
  1639. dnl this test is of course not sensible if we are cross-compiling!
  1640. if test "x$cross_compiling" != xyes; then
  1641. dnl just run a program to verify that the libs checked for previous to this
  1642. dnl point also is available run-time!
  1643. AC_MSG_CHECKING([run-time libs availability])
  1644. CURL_RUN_IFELSE([
  1645. int main()
  1646. {
  1647. return 0;
  1648. }
  1649. ],
  1650. AC_MSG_RESULT([fine]),
  1651. AC_MSG_RESULT([failed])
  1652. AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
  1653. )
  1654. dnl if this test fails, configure has already stopped
  1655. fi
  1656. ])
  1657. dnl CURL_CHECK_VARIADIC_MACROS
  1658. dnl -------------------------------------------------
  1659. dnl Check compiler support of variadic macros
  1660. AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
  1661. AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
  1662. [curl_cv_variadic_macros_c99], [
  1663. AC_COMPILE_IFELSE([
  1664. AC_LANG_PROGRAM([[
  1665. #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
  1666. #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
  1667. int fun3(int arg1, int arg2, int arg3);
  1668. int fun2(int arg1, int arg2);
  1669. int fun3(int arg1, int arg2, int arg3)
  1670. { return arg1 + arg2 + arg3; }
  1671. int fun2(int arg1, int arg2)
  1672. { return arg1 + arg2; }
  1673. ]],[[
  1674. int res3 = c99_vmacro3(1, 2, 3);
  1675. int res2 = c99_vmacro2(1, 2);
  1676. ]])
  1677. ],[
  1678. curl_cv_variadic_macros_c99="yes"
  1679. ],[
  1680. curl_cv_variadic_macros_c99="no"
  1681. ])
  1682. ])
  1683. case "$curl_cv_variadic_macros_c99" in
  1684. yes)
  1685. AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
  1686. [Define to 1 if compiler supports C99 variadic macro style.])
  1687. ;;
  1688. esac
  1689. AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
  1690. [curl_cv_variadic_macros_gcc], [
  1691. AC_COMPILE_IFELSE([
  1692. AC_LANG_PROGRAM([[
  1693. #define gcc_vmacro3(first, args...) fun3(first, args)
  1694. #define gcc_vmacro2(first, args...) fun2(first, args)
  1695. int fun3(int arg1, int arg2, int arg3);
  1696. int fun2(int arg1, int arg2);
  1697. int fun3(int arg1, int arg2, int arg3)
  1698. { return arg1 + arg2 + arg3; }
  1699. int fun2(int arg1, int arg2)
  1700. { return arg1 + arg2; }
  1701. ]],[[
  1702. int res3 = gcc_vmacro3(1, 2, 3);
  1703. int res2 = gcc_vmacro2(1, 2);
  1704. ]])
  1705. ],[
  1706. curl_cv_variadic_macros_gcc="yes"
  1707. ],[
  1708. curl_cv_variadic_macros_gcc="no"
  1709. ])
  1710. ])
  1711. case "$curl_cv_variadic_macros_gcc" in
  1712. yes)
  1713. AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
  1714. [Define to 1 if compiler supports old gcc variadic macro style.])
  1715. ;;
  1716. esac
  1717. ])
  1718. dnl CURL_CHECK_CA_BUNDLE
  1719. dnl -------------------------------------------------
  1720. dnl Check if a default ca-bundle should be used
  1721. dnl
  1722. dnl regarding the paths this will scan:
  1723. dnl /etc/ssl/certs/ca-certificates.crt Debian systems
  1724. dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
  1725. dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
  1726. dnl /usr/local/share/certs/ca-root-nss.crt FreeBSD, MidnightBSD
  1727. dnl /etc/ssl/cert.pem OpenBSD, FreeBSD, MidnightBSD (symlink)
  1728. dnl /etc/ssl/certs/ (ca path) SUSE
  1729. AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
  1730. AC_MSG_CHECKING([default CA cert bundle/path])
  1731. AC_ARG_WITH(ca-bundle,
  1732. AS_HELP_STRING([--with-ca-bundle=FILE],
  1733. [Path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
  1734. AS_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
  1735. [
  1736. want_ca="$withval"
  1737. if test "x$want_ca" = "xyes"; then
  1738. AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
  1739. fi
  1740. ],
  1741. [ want_ca="unset" ])
  1742. AC_ARG_WITH(ca-path,
  1743. AS_HELP_STRING([--with-ca-path=DIRECTORY],
  1744. [Path to a directory containing CA certificates stored individually, with \
  1745. their filenames in a hash format. This option can be used with the OpenSSL, \
  1746. GnuTLS and mbedTLS backends. Refer to OpenSSL c_rehash for details. \
  1747. (example: /etc/certificates)])
  1748. AS_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
  1749. [
  1750. want_capath="$withval"
  1751. if test "x$want_capath" = "xyes"; then
  1752. AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
  1753. fi
  1754. ],
  1755. [ want_capath="unset"])
  1756. ca_warning=" (warning: certs not found)"
  1757. capath_warning=" (warning: certs not found)"
  1758. check_capath=""
  1759. if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
  1760. "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
  1761. dnl both given
  1762. ca="$want_ca"
  1763. capath="$want_capath"
  1764. elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
  1765. dnl --with-ca-bundle given
  1766. ca="$want_ca"
  1767. capath="no"
  1768. elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
  1769. dnl --with-ca-path given
  1770. if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1" -a "x$MBEDTLS_ENABLED" != "x1"; then
  1771. AC_MSG_ERROR([--with-ca-path only works with OpenSSL, GnuTLS or mbedTLS])
  1772. fi
  1773. capath="$want_capath"
  1774. ca="no"
  1775. else
  1776. dnl first try autodetecting a CA bundle , then a CA path
  1777. dnl both autodetections can be skipped by --without-ca-*
  1778. ca="no"
  1779. capath="no"
  1780. if test "x$cross_compiling" != "xyes"; then
  1781. dnl NOT cross-compiling and...
  1782. dnl neither of the --with-ca-* options are provided
  1783. if test "x$want_ca" = "xunset"; then
  1784. dnl the path we previously would have installed the curl ca bundle
  1785. dnl to, and thus we now check for an already existing cert in that
  1786. dnl place in case we find no other
  1787. if test "x$prefix" != xNONE; then
  1788. cac="${prefix}/share/curl/curl-ca-bundle.crt"
  1789. else
  1790. cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
  1791. fi
  1792. for a in /etc/ssl/certs/ca-certificates.crt \
  1793. /etc/pki/tls/certs/ca-bundle.crt \
  1794. /usr/share/ssl/certs/ca-bundle.crt \
  1795. /usr/local/share/certs/ca-root-nss.crt \
  1796. /etc/ssl/cert.pem \
  1797. "$cac"; do
  1798. if test -f "$a"; then
  1799. ca="$a"
  1800. break
  1801. fi
  1802. done
  1803. fi
  1804. if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
  1805. "x$OPENSSL_ENABLED" = "x1"; then
  1806. check_capath="/etc/ssl/certs/"
  1807. fi
  1808. else
  1809. dnl no option given and cross-compiling
  1810. AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
  1811. fi
  1812. fi
  1813. if test "x$ca" = "xno" || test -f "$ca"; then
  1814. ca_warning=""
  1815. fi
  1816. if test "x$capath" != "xno"; then
  1817. check_capath="$capath"
  1818. fi
  1819. if test ! -z "$check_capath"; then
  1820. for a in "$check_capath"; do
  1821. if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then
  1822. if test "x$capath" = "xno"; then
  1823. capath="$a"
  1824. fi
  1825. capath_warning=""
  1826. break
  1827. fi
  1828. done
  1829. fi
  1830. if test "x$capath" = "xno"; then
  1831. capath_warning=""
  1832. fi
  1833. if test "x$ca" != "xno"; then
  1834. CURL_CA_BUNDLE='"'$ca'"'
  1835. AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
  1836. AC_SUBST(CURL_CA_BUNDLE)
  1837. AC_MSG_RESULT([$ca])
  1838. fi
  1839. if test "x$capath" != "xno"; then
  1840. CURL_CA_PATH="\"$capath\""
  1841. AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
  1842. AC_MSG_RESULT([$capath (capath)])
  1843. fi
  1844. if test "x$ca" = "xno" && test "x$capath" = "xno"; then
  1845. AC_MSG_RESULT([no])
  1846. fi
  1847. AC_MSG_CHECKING([whether to use builtin CA store of SSL library])
  1848. AC_ARG_WITH(ca-fallback,
  1849. AS_HELP_STRING([--with-ca-fallback], [Use the built in CA store of the SSL library])
  1850. AS_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the SSL library]),
  1851. [
  1852. if test "x$with_ca_fallback" != "xyes" -a "x$with_ca_fallback" != "xno"; then
  1853. AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter])
  1854. fi
  1855. ],
  1856. [ with_ca_fallback="no"])
  1857. AC_MSG_RESULT([$with_ca_fallback])
  1858. if test "x$with_ca_fallback" = "xyes"; then
  1859. if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1"; then
  1860. AC_MSG_ERROR([--with-ca-fallback only works with OpenSSL or GnuTLS])
  1861. fi
  1862. AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use built in CA store of SSL library ])
  1863. fi
  1864. ])
  1865. dnl CURL_CHECK_WIN32_LARGEFILE
  1866. dnl -------------------------------------------------
  1867. dnl Check if curl's WIN32 large file will be used
  1868. AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
  1869. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  1870. AC_MSG_CHECKING([whether build target supports WIN32 file API])
  1871. curl_win32_file_api="no"
  1872. if test "$curl_cv_header_windows_h" = "yes"; then
  1873. if test x"$enable_largefile" != "xno"; then
  1874. AC_COMPILE_IFELSE([
  1875. AC_LANG_PROGRAM([[
  1876. ]],[[
  1877. #if !defined(_WIN32_WCE) && \
  1878. (defined(__MINGW32__) || \
  1879. (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
  1880. int dummy=1;
  1881. #else
  1882. WIN32 large file API not supported.
  1883. #endif
  1884. ]])
  1885. ],[
  1886. curl_win32_file_api="win32_large_files"
  1887. ])
  1888. fi
  1889. if test "$curl_win32_file_api" = "no"; then
  1890. AC_COMPILE_IFELSE([
  1891. AC_LANG_PROGRAM([[
  1892. ]],[[
  1893. #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
  1894. int dummy=1;
  1895. #else
  1896. WIN32 small file API not supported.
  1897. #endif
  1898. ]])
  1899. ],[
  1900. curl_win32_file_api="win32_small_files"
  1901. ])
  1902. fi
  1903. fi
  1904. case "$curl_win32_file_api" in
  1905. win32_large_files)
  1906. AC_MSG_RESULT([yes (large file enabled)])
  1907. AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
  1908. [Define to 1 if you are building a Windows target with large file support.])
  1909. AC_SUBST(USE_WIN32_LARGE_FILES, [1])
  1910. ;;
  1911. win32_small_files)
  1912. AC_MSG_RESULT([yes (large file disabled)])
  1913. AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
  1914. [Define to 1 if you are building a Windows target without large file support.])
  1915. AC_SUBST(USE_WIN32_SMALL_FILES, [1])
  1916. ;;
  1917. *)
  1918. AC_MSG_RESULT([no])
  1919. ;;
  1920. esac
  1921. ])
  1922. dnl CURL_CHECK_WIN32_CRYPTO
  1923. dnl -------------------------------------------------
  1924. dnl Check if curl's WIN32 crypto lib can be used
  1925. AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [
  1926. AC_REQUIRE([CURL_CHECK_HEADER_WINCRYPT])dnl
  1927. AC_MSG_CHECKING([whether build target supports WIN32 crypto API])
  1928. curl_win32_crypto_api="no"
  1929. if test "$curl_cv_header_wincrypt_h" = "yes"; then
  1930. AC_COMPILE_IFELSE([
  1931. AC_LANG_PROGRAM([[
  1932. #undef inline
  1933. #ifndef WIN32_LEAN_AND_MEAN
  1934. #define WIN32_LEAN_AND_MEAN
  1935. #endif
  1936. #include <windows.h>
  1937. #include <wincrypt.h>
  1938. ]],[[
  1939. HCRYPTPROV hCryptProv;
  1940. if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
  1941. CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
  1942. CryptReleaseContext(hCryptProv, 0);
  1943. }
  1944. ]])
  1945. ],[
  1946. curl_win32_crypto_api="yes"
  1947. ])
  1948. fi
  1949. case "$curl_win32_crypto_api" in
  1950. yes)
  1951. AC_MSG_RESULT([yes])
  1952. AC_DEFINE_UNQUOTED(USE_WIN32_CRYPTO, 1,
  1953. [Define to 1 if you are building a Windows target with crypto API support.])
  1954. AC_SUBST(USE_WIN32_CRYPTO, [1])
  1955. ;;
  1956. *)
  1957. AC_MSG_RESULT([no])
  1958. ;;
  1959. esac
  1960. ])
  1961. dnl CURL_EXPORT_PCDIR ($pcdir)
  1962. dnl ------------------------
  1963. dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
  1964. dnl
  1965. dnl we need this macro since pkg-config distinguishes among empty and unset
  1966. dnl variable while checking PKG_CONFIG_LIBDIR
  1967. dnl
  1968. AC_DEFUN([CURL_EXPORT_PCDIR], [
  1969. if test -n "$1"; then
  1970. PKG_CONFIG_LIBDIR="$1"
  1971. export PKG_CONFIG_LIBDIR
  1972. fi
  1973. ])
  1974. dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
  1975. dnl ------------------------
  1976. dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the
  1977. dnl path to it, or 'no' if not found/present.
  1978. dnl
  1979. dnl If pkg-config is present, check that it has info about the $module or
  1980. dnl return "no" anyway!
  1981. dnl
  1982. dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
  1983. dnl
  1984. AC_DEFUN([CURL_CHECK_PKGCONFIG], [
  1985. if test -n "$PKG_CONFIG"; then
  1986. PKGCONFIG="$PKG_CONFIG"
  1987. else
  1988. AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no],
  1989. [$PATH:/usr/bin:/usr/local/bin])
  1990. fi
  1991. if test "x$PKGCONFIG" != "xno"; then
  1992. AC_MSG_CHECKING([for $1 options with pkg-config])
  1993. dnl ask pkg-config about $1
  1994. itexists=`CURL_EXPORT_PCDIR([$2]) dnl
  1995. $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
  1996. if test -z "$itexists"; then
  1997. dnl pkg-config does not have info about the given module! set the
  1998. dnl variable to 'no'
  1999. PKGCONFIG="no"
  2000. AC_MSG_RESULT([no])
  2001. else
  2002. AC_MSG_RESULT([found])
  2003. fi
  2004. fi
  2005. ])
  2006. dnl CURL_GENERATE_CONFIGUREHELP_PM
  2007. dnl -------------------------------------------------
  2008. dnl Generate test harness configurehelp.pm module, defining and
  2009. dnl initializing some perl variables with values which are known
  2010. dnl when the configure script runs. For portability reasons, test
  2011. dnl harness needs information on how to run the C preprocessor.
  2012. AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [
  2013. AC_REQUIRE([AC_PROG_CPP])dnl
  2014. tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
  2015. if test -z "$tmp_cpp"; then
  2016. tmp_cpp='cpp'
  2017. fi
  2018. cat >./tests/configurehelp.pm <<_EOF
  2019. [@%:@] This is a generated file. Do not edit.
  2020. package configurehelp;
  2021. use strict;
  2022. use warnings;
  2023. use Exporter;
  2024. use vars qw(
  2025. @ISA
  2026. @EXPORT_OK
  2027. \$Cpreprocessor
  2028. );
  2029. @ISA = qw(Exporter);
  2030. @EXPORT_OK = qw(
  2031. \$Cpreprocessor
  2032. );
  2033. \$Cpreprocessor = '$tmp_cpp';
  2034. 1;
  2035. _EOF
  2036. ])
  2037. dnl CURL_CPP_P
  2038. dnl
  2039. dnl Check if $cpp -P should be used for extract define values due to gcc 5
  2040. dnl splitting up strings and defines between line outputs. gcc by default
  2041. dnl (without -P) will show TEST EINVAL TEST as
  2042. dnl
  2043. dnl # 13 "conftest.c"
  2044. dnl TEST
  2045. dnl # 13 "conftest.c" 3 4
  2046. dnl 22
  2047. dnl # 13 "conftest.c"
  2048. dnl TEST
  2049. AC_DEFUN([CURL_CPP_P], [
  2050. AC_MSG_CHECKING([if cpp -P is needed])
  2051. AC_EGREP_CPP([TEST.*TEST], [
  2052. #include <errno.h>
  2053. TEST EINVAL TEST
  2054. ], [cpp=no], [cpp=yes])
  2055. AC_MSG_RESULT([$cpp])
  2056. dnl we need cpp -P so check if it works then
  2057. if test "x$cpp" = "xyes"; then
  2058. AC_MSG_CHECKING([if cpp -P works])
  2059. OLDCPPFLAGS=$CPPFLAGS
  2060. CPPFLAGS="$CPPFLAGS -P"
  2061. AC_EGREP_CPP([TEST.*TEST], [
  2062. #include <errno.h>
  2063. TEST EINVAL TEST
  2064. ], [cpp_p=yes], [cpp_p=no])
  2065. AC_MSG_RESULT([$cpp_p])
  2066. if test "x$cpp_p" = "xno"; then
  2067. AC_MSG_WARN([failed to figure out cpp -P alternative])
  2068. # without -P
  2069. CPPPFLAG=""
  2070. else
  2071. # with -P
  2072. CPPPFLAG="-P"
  2073. fi
  2074. dnl restore CPPFLAGS
  2075. CPPFLAGS=$OLDCPPFLAGS
  2076. else
  2077. # without -P
  2078. CPPPFLAG=""
  2079. fi
  2080. ])
  2081. dnl CURL_DARWIN_CFLAGS
  2082. dnl
  2083. dnl Set -Werror=partial-availability to detect possible breaking code
  2084. dnl with very low deployment targets.
  2085. dnl
  2086. AC_DEFUN([CURL_DARWIN_CFLAGS], [
  2087. tst_cflags="no"
  2088. case $host_os in
  2089. darwin*)
  2090. tst_cflags="yes"
  2091. ;;
  2092. esac
  2093. AC_MSG_CHECKING([for good-to-use Darwin CFLAGS])
  2094. AC_MSG_RESULT([$tst_cflags]);
  2095. if test "$tst_cflags" = "yes"; then
  2096. old_CFLAGS=$CFLAGS
  2097. CFLAGS="$CFLAGS -Werror=partial-availability"
  2098. AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
  2099. AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  2100. [AC_MSG_RESULT([yes])],
  2101. [AC_MSG_RESULT([no])
  2102. CFLAGS=$old_CFLAGS])
  2103. fi
  2104. ])
  2105. dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
  2106. dnl
  2107. dnl Check to see if the compiler supports __builtin_available. This built-in
  2108. dnl compiler function first appeared in Apple LLVM 9.0.0. It's so new that, at
  2109. dnl the time this macro was written, the function was not yet documented. Its
  2110. dnl purpose is to return true if the code is running under a certain OS version
  2111. dnl or later.
  2112. AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [
  2113. AC_MSG_CHECKING([to see if the compiler supports __builtin_available()])
  2114. AC_COMPILE_IFELSE([
  2115. AC_LANG_PROGRAM([[
  2116. #include <stdlib.h>
  2117. ]],[[
  2118. if (__builtin_available(macOS 10.8, iOS 5.0, *)) {}
  2119. ]])
  2120. ],[
  2121. AC_MSG_RESULT([yes])
  2122. AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
  2123. [Define to 1 if you have the __builtin_available function.])
  2124. ],[
  2125. AC_MSG_RESULT([no])
  2126. ])
  2127. ])