acinclude.m4 88 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at http://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. #***************************************************************************
  22. dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
  23. dnl -------------------------------------------------
  24. dnl Use the C preprocessor to find out if the given object-style symbol
  25. dnl is defined and get its expansion. This macro will not use default
  26. dnl includes even if no INCLUDES argument is given. This macro will run
  27. dnl silently when invoked with three arguments. If the expansion would
  28. dnl result in a set of double-quoted strings the returned expansion will
  29. dnl actually be a single double-quoted string concatenating all them.
  30. AC_DEFUN([CURL_CHECK_DEF], [
  31. AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
  32. AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
  33. if test -z "$SED"; then
  34. AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
  35. fi
  36. if test -z "$GREP"; then
  37. AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
  38. fi
  39. ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
  40. tmp_exp=""
  41. AC_PREPROC_IFELSE([
  42. AC_LANG_SOURCE(
  43. ifelse($2,,,[$2])[[
  44. #ifdef $1
  45. CURL_DEF_TOKEN $1
  46. #endif
  47. ]])
  48. ],[
  49. tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
  50. "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
  51. "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
  52. "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
  53. if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
  54. tmp_exp=""
  55. fi
  56. ])
  57. if test -z "$tmp_exp"; then
  58. AS_VAR_SET(ac_HaveDef, no)
  59. ifelse($3,,[AC_MSG_RESULT([no])])
  60. else
  61. AS_VAR_SET(ac_HaveDef, yes)
  62. AS_VAR_SET(ac_Def, $tmp_exp)
  63. ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
  64. fi
  65. AS_VAR_POPDEF([ac_Def])dnl
  66. AS_VAR_POPDEF([ac_HaveDef])dnl
  67. ])
  68. dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
  69. dnl -------------------------------------------------
  70. dnl Use the C compiler to find out only if the given symbol is defined
  71. dnl or not, this can not find out its expansion. This macro will not use
  72. dnl default includes even if no INCLUDES argument is given. This macro
  73. dnl will run silently when invoked with three arguments.
  74. AC_DEFUN([CURL_CHECK_DEF_CC], [
  75. AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
  76. ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
  77. AC_COMPILE_IFELSE([
  78. AC_LANG_SOURCE(
  79. ifelse($2,,,[$2])[[
  80. int main (void)
  81. {
  82. #ifdef $1
  83. return 0;
  84. #else
  85. force compilation error
  86. #endif
  87. }
  88. ]])
  89. ],[
  90. tst_symbol_defined="yes"
  91. ],[
  92. tst_symbol_defined="no"
  93. ])
  94. if test "$tst_symbol_defined" = "yes"; then
  95. AS_VAR_SET(ac_HaveDef, yes)
  96. ifelse($3,,[AC_MSG_RESULT([yes])])
  97. else
  98. AS_VAR_SET(ac_HaveDef, no)
  99. ifelse($3,,[AC_MSG_RESULT([no])])
  100. fi
  101. AS_VAR_POPDEF([ac_HaveDef])dnl
  102. ])
  103. dnl CURL_CHECK_LIB_XNET
  104. dnl -------------------------------------------------
  105. dnl Verify if X/Open network library is required.
  106. AC_DEFUN([CURL_CHECK_LIB_XNET], [
  107. AC_MSG_CHECKING([if X/Open network library is required])
  108. tst_lib_xnet_required="no"
  109. AC_COMPILE_IFELSE([
  110. AC_LANG_SOURCE([[
  111. int main (void)
  112. {
  113. #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
  114. return 0;
  115. #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
  116. return 0;
  117. #else
  118. force compilation error
  119. #endif
  120. }
  121. ]])
  122. ],[
  123. tst_lib_xnet_required="yes"
  124. LIBS="$LIBS -lxnet"
  125. ])
  126. AC_MSG_RESULT([$tst_lib_xnet_required])
  127. ])
  128. dnl CURL_CHECK_AIX_ALL_SOURCE
  129. dnl -------------------------------------------------
  130. dnl Provides a replacement of traditional AC_AIX with
  131. dnl an uniform behaviour across all autoconf versions,
  132. dnl and with our own placement rules.
  133. AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
  134. AH_VERBATIM([_ALL_SOURCE],
  135. [/* Define to 1 if OS is AIX. */
  136. #ifndef _ALL_SOURCE
  137. # undef _ALL_SOURCE
  138. #endif])
  139. AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
  140. AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
  141. AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
  142. AC_EGREP_CPP([yes_this_is_aix],[
  143. #ifdef _AIX
  144. yes_this_is_aix
  145. #endif
  146. ],[
  147. AC_MSG_RESULT([yes])
  148. AC_DEFINE(_ALL_SOURCE)
  149. ],[
  150. AC_MSG_RESULT([no])
  151. ])
  152. ])
  153. dnl CURL_CHECK_HEADER_WINDOWS
  154. dnl -------------------------------------------------
  155. dnl Check for compilable and valid windows.h header
  156. AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
  157. AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
  158. AC_COMPILE_IFELSE([
  159. AC_LANG_PROGRAM([[
  160. #undef inline
  161. #ifndef WIN32_LEAN_AND_MEAN
  162. #define WIN32_LEAN_AND_MEAN
  163. #endif
  164. #include <windows.h>
  165. ]],[[
  166. #if defined(__CYGWIN__) || defined(__CEGCC__)
  167. HAVE_WINDOWS_H shall not be defined.
  168. #else
  169. int dummy=2*WINVER;
  170. #endif
  171. ]])
  172. ],[
  173. ac_cv_header_windows_h="yes"
  174. ],[
  175. ac_cv_header_windows_h="no"
  176. ])
  177. ])
  178. case "$ac_cv_header_windows_h" in
  179. yes)
  180. AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
  181. [Define to 1 if you have the windows.h header file.])
  182. AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
  183. [Define to avoid automatic inclusion of winsock.h])
  184. ;;
  185. esac
  186. ])
  187. dnl CURL_CHECK_NATIVE_WINDOWS
  188. dnl -------------------------------------------------
  189. dnl Check if building a native Windows target
  190. AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
  191. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  192. AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
  193. if test "$ac_cv_header_windows_h" = "no"; then
  194. ac_cv_native_windows="no"
  195. else
  196. AC_COMPILE_IFELSE([
  197. AC_LANG_PROGRAM([[
  198. ]],[[
  199. #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
  200. (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
  201. int dummy=1;
  202. #else
  203. Not a native Windows build target.
  204. #endif
  205. ]])
  206. ],[
  207. ac_cv_native_windows="yes"
  208. ],[
  209. ac_cv_native_windows="no"
  210. ])
  211. fi
  212. ])
  213. AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$ac_cv_native_windows" = xyes)
  214. ])
  215. dnl CURL_CHECK_HEADER_WINSOCK
  216. dnl -------------------------------------------------
  217. dnl Check for compilable and valid winsock.h header
  218. AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
  219. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  220. AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
  221. AC_COMPILE_IFELSE([
  222. AC_LANG_PROGRAM([[
  223. #undef inline
  224. #ifndef WIN32_LEAN_AND_MEAN
  225. #define WIN32_LEAN_AND_MEAN
  226. #endif
  227. #include <windows.h>
  228. #include <winsock.h>
  229. ]],[[
  230. #if defined(__CYGWIN__) || defined(__CEGCC__)
  231. HAVE_WINSOCK_H shall not be defined.
  232. #else
  233. int dummy=WSACleanup();
  234. #endif
  235. ]])
  236. ],[
  237. ac_cv_header_winsock_h="yes"
  238. ],[
  239. ac_cv_header_winsock_h="no"
  240. ])
  241. ])
  242. case "$ac_cv_header_winsock_h" in
  243. yes)
  244. AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
  245. [Define to 1 if you have the winsock.h header file.])
  246. ;;
  247. esac
  248. ])
  249. dnl CURL_CHECK_HEADER_WINSOCK2
  250. dnl -------------------------------------------------
  251. dnl Check for compilable and valid winsock2.h header
  252. AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
  253. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  254. AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
  255. AC_COMPILE_IFELSE([
  256. AC_LANG_PROGRAM([[
  257. #undef inline
  258. #ifndef WIN32_LEAN_AND_MEAN
  259. #define WIN32_LEAN_AND_MEAN
  260. #endif
  261. #include <windows.h>
  262. #include <winsock2.h>
  263. ]],[[
  264. #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
  265. HAVE_WINSOCK2_H shall not be defined.
  266. #else
  267. int dummy=2*IPPROTO_ESP;
  268. #endif
  269. ]])
  270. ],[
  271. ac_cv_header_winsock2_h="yes"
  272. ],[
  273. ac_cv_header_winsock2_h="no"
  274. ])
  275. ])
  276. case "$ac_cv_header_winsock2_h" in
  277. yes)
  278. AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
  279. [Define to 1 if you have the winsock2.h header file.])
  280. ;;
  281. esac
  282. ])
  283. dnl CURL_CHECK_HEADER_WS2TCPIP
  284. dnl -------------------------------------------------
  285. dnl Check for compilable and valid ws2tcpip.h header
  286. AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
  287. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  288. AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
  289. AC_COMPILE_IFELSE([
  290. AC_LANG_PROGRAM([[
  291. #undef inline
  292. #ifndef WIN32_LEAN_AND_MEAN
  293. #define WIN32_LEAN_AND_MEAN
  294. #endif
  295. #include <windows.h>
  296. #include <winsock2.h>
  297. #include <ws2tcpip.h>
  298. ]],[[
  299. #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
  300. HAVE_WS2TCPIP_H shall not be defined.
  301. #else
  302. int dummy=2*IP_PKTINFO;
  303. #endif
  304. ]])
  305. ],[
  306. ac_cv_header_ws2tcpip_h="yes"
  307. ],[
  308. ac_cv_header_ws2tcpip_h="no"
  309. ])
  310. ])
  311. case "$ac_cv_header_ws2tcpip_h" in
  312. yes)
  313. AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
  314. [Define to 1 if you have the ws2tcpip.h header file.])
  315. ;;
  316. esac
  317. ])
  318. dnl CURL_CHECK_HEADER_WINLDAP
  319. dnl -------------------------------------------------
  320. dnl Check for compilable and valid winldap.h header
  321. AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
  322. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  323. AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [
  324. AC_COMPILE_IFELSE([
  325. AC_LANG_PROGRAM([[
  326. #undef inline
  327. #ifdef HAVE_WINDOWS_H
  328. #ifndef WIN32_LEAN_AND_MEAN
  329. #define WIN32_LEAN_AND_MEAN
  330. #endif
  331. #include <windows.h>
  332. #endif
  333. #include <winldap.h>
  334. ]],[[
  335. #if defined(__CYGWIN__) || defined(__CEGCC__)
  336. HAVE_WINLDAP_H shall not be defined.
  337. #else
  338. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  339. ULONG res = ldap_unbind(ldp);
  340. #endif
  341. ]])
  342. ],[
  343. ac_cv_header_winldap_h="yes"
  344. ],[
  345. ac_cv_header_winldap_h="no"
  346. ])
  347. ])
  348. case "$ac_cv_header_winldap_h" in
  349. yes)
  350. AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
  351. [Define to 1 if you have the winldap.h header file.])
  352. ;;
  353. esac
  354. ])
  355. dnl CURL_CHECK_HEADER_WINBER
  356. dnl -------------------------------------------------
  357. dnl Check for compilable and valid winber.h header
  358. AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
  359. AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
  360. AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [
  361. AC_COMPILE_IFELSE([
  362. AC_LANG_PROGRAM([[
  363. #undef inline
  364. #ifdef HAVE_WINDOWS_H
  365. #ifndef WIN32_LEAN_AND_MEAN
  366. #define WIN32_LEAN_AND_MEAN
  367. #endif
  368. #include <windows.h>
  369. #endif
  370. #include <winldap.h>
  371. #include <winber.h>
  372. ]],[[
  373. #if defined(__CYGWIN__) || defined(__CEGCC__)
  374. HAVE_WINBER_H shall not be defined.
  375. #else
  376. BERVAL *bvp = NULL;
  377. BerElement *bep = ber_init(bvp);
  378. ber_free(bep, 1);
  379. #endif
  380. ]])
  381. ],[
  382. ac_cv_header_winber_h="yes"
  383. ],[
  384. ac_cv_header_winber_h="no"
  385. ])
  386. ])
  387. case "$ac_cv_header_winber_h" in
  388. yes)
  389. AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
  390. [Define to 1 if you have the winber.h header file.])
  391. ;;
  392. esac
  393. ])
  394. dnl CURL_CHECK_HEADER_LBER
  395. dnl -------------------------------------------------
  396. dnl Check for compilable and valid lber.h header,
  397. dnl and check if it is needed even with ldap.h
  398. AC_DEFUN([CURL_CHECK_HEADER_LBER], [
  399. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  400. AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [
  401. AC_COMPILE_IFELSE([
  402. AC_LANG_PROGRAM([[
  403. #undef inline
  404. #ifdef HAVE_WINDOWS_H
  405. #ifndef WIN32_LEAN_AND_MEAN
  406. #define WIN32_LEAN_AND_MEAN
  407. #endif
  408. #include <windows.h>
  409. #else
  410. #ifdef HAVE_SYS_TYPES_H
  411. #include <sys/types.h>
  412. #endif
  413. #endif
  414. #ifndef NULL
  415. #define NULL (void *)0
  416. #endif
  417. #include <lber.h>
  418. ]],[[
  419. BerValue *bvp = NULL;
  420. BerElement *bep = ber_init(bvp);
  421. ber_free(bep, 1);
  422. ]])
  423. ],[
  424. ac_cv_header_lber_h="yes"
  425. ],[
  426. ac_cv_header_lber_h="no"
  427. ])
  428. ])
  429. if test "$ac_cv_header_lber_h" = "yes"; then
  430. AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
  431. [Define to 1 if you have the lber.h header file.])
  432. #
  433. AC_COMPILE_IFELSE([
  434. AC_LANG_PROGRAM([[
  435. #undef inline
  436. #ifdef HAVE_WINDOWS_H
  437. #ifndef WIN32_LEAN_AND_MEAN
  438. #define WIN32_LEAN_AND_MEAN
  439. #endif
  440. #include <windows.h>
  441. #else
  442. #ifdef HAVE_SYS_TYPES_H
  443. #include <sys/types.h>
  444. #endif
  445. #endif
  446. #ifndef NULL
  447. #define NULL (void *)0
  448. #endif
  449. #ifndef LDAP_DEPRECATED
  450. #define LDAP_DEPRECATED 1
  451. #endif
  452. #include <ldap.h>
  453. ]],[[
  454. BerValue *bvp = NULL;
  455. BerElement *bep = ber_init(bvp);
  456. ber_free(bep, 1);
  457. ]])
  458. ],[
  459. curl_cv_need_header_lber_h="no"
  460. ],[
  461. curl_cv_need_header_lber_h="yes"
  462. ])
  463. #
  464. case "$curl_cv_need_header_lber_h" in
  465. yes)
  466. AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
  467. [Define to 1 if you need the lber.h header file even with ldap.h])
  468. ;;
  469. esac
  470. fi
  471. ])
  472. dnl CURL_CHECK_HEADER_LDAP
  473. dnl -------------------------------------------------
  474. dnl Check for compilable and valid ldap.h header
  475. AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
  476. AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
  477. AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [
  478. AC_COMPILE_IFELSE([
  479. AC_LANG_PROGRAM([[
  480. #undef inline
  481. #ifdef HAVE_WINDOWS_H
  482. #ifndef WIN32_LEAN_AND_MEAN
  483. #define WIN32_LEAN_AND_MEAN
  484. #endif
  485. #include <windows.h>
  486. #else
  487. #ifdef HAVE_SYS_TYPES_H
  488. #include <sys/types.h>
  489. #endif
  490. #endif
  491. #ifndef LDAP_DEPRECATED
  492. #define LDAP_DEPRECATED 1
  493. #endif
  494. #ifdef NEED_LBER_H
  495. #include <lber.h>
  496. #endif
  497. #include <ldap.h>
  498. ]],[[
  499. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  500. int res = ldap_unbind(ldp);
  501. ]])
  502. ],[
  503. ac_cv_header_ldap_h="yes"
  504. ],[
  505. ac_cv_header_ldap_h="no"
  506. ])
  507. ])
  508. case "$ac_cv_header_ldap_h" in
  509. yes)
  510. AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
  511. [Define to 1 if you have the ldap.h header file.])
  512. ;;
  513. esac
  514. ])
  515. dnl CURL_CHECK_HEADER_LDAP_SSL
  516. dnl -------------------------------------------------
  517. dnl Check for compilable and valid ldap_ssl.h header
  518. AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
  519. AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
  520. AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [
  521. AC_COMPILE_IFELSE([
  522. AC_LANG_PROGRAM([[
  523. #undef inline
  524. #ifdef HAVE_WINDOWS_H
  525. #ifndef WIN32_LEAN_AND_MEAN
  526. #define WIN32_LEAN_AND_MEAN
  527. #endif
  528. #include <windows.h>
  529. #else
  530. #ifdef HAVE_SYS_TYPES_H
  531. #include <sys/types.h>
  532. #endif
  533. #endif
  534. #ifndef LDAP_DEPRECATED
  535. #define LDAP_DEPRECATED 1
  536. #endif
  537. #ifdef NEED_LBER_H
  538. #include <lber.h>
  539. #endif
  540. #ifdef HAVE_LDAP_H
  541. #include <ldap.h>
  542. #endif
  543. #include <ldap_ssl.h>
  544. ]],[[
  545. LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
  546. ]])
  547. ],[
  548. ac_cv_header_ldap_ssl_h="yes"
  549. ],[
  550. ac_cv_header_ldap_ssl_h="no"
  551. ])
  552. ])
  553. case "$ac_cv_header_ldap_ssl_h" in
  554. yes)
  555. AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
  556. [Define to 1 if you have the ldap_ssl.h header file.])
  557. ;;
  558. esac
  559. ])
  560. dnl CURL_CHECK_HEADER_LDAPSSL
  561. dnl -------------------------------------------------
  562. dnl Check for compilable and valid ldapssl.h header
  563. AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
  564. AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
  565. AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [
  566. AC_COMPILE_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. #else
  575. #ifdef HAVE_SYS_TYPES_H
  576. #include <sys/types.h>
  577. #endif
  578. #endif
  579. #ifndef NULL
  580. #define NULL (void *)0
  581. #endif
  582. #ifndef LDAP_DEPRECATED
  583. #define LDAP_DEPRECATED 1
  584. #endif
  585. #ifdef NEED_LBER_H
  586. #include <lber.h>
  587. #endif
  588. #ifdef HAVE_LDAP_H
  589. #include <ldap.h>
  590. #endif
  591. #include <ldapssl.h>
  592. ]],[[
  593. char *cert_label = NULL;
  594. LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
  595. ]])
  596. ],[
  597. ac_cv_header_ldapssl_h="yes"
  598. ],[
  599. ac_cv_header_ldapssl_h="no"
  600. ])
  601. ])
  602. case "$ac_cv_header_ldapssl_h" in
  603. yes)
  604. AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
  605. [Define to 1 if you have the ldapssl.h header file.])
  606. ;;
  607. esac
  608. ])
  609. dnl CURL_CHECK_LIBS_WINLDAP
  610. dnl -------------------------------------------------
  611. dnl Check for libraries needed for WINLDAP support,
  612. dnl and prepended to LIBS any needed libraries.
  613. dnl This macro can take an optional parameter with a
  614. dnl white space separated list of libraries to check
  615. dnl before the WINLDAP default ones.
  616. AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
  617. AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
  618. #
  619. AC_MSG_CHECKING([for WINLDAP libraries])
  620. #
  621. u_libs=""
  622. #
  623. ifelse($1,,,[
  624. for x_lib in $1; do
  625. case "$x_lib" in
  626. -l*)
  627. l_lib="$x_lib"
  628. ;;
  629. *)
  630. l_lib="-l$x_lib"
  631. ;;
  632. esac
  633. if test -z "$u_libs"; then
  634. u_libs="$l_lib"
  635. else
  636. u_libs="$u_libs $l_lib"
  637. fi
  638. done
  639. ])
  640. #
  641. curl_cv_save_LIBS="$LIBS"
  642. curl_cv_ldap_LIBS="unknown"
  643. #
  644. for x_nlibs in '' "$u_libs" \
  645. '-lwldap32' ; do
  646. if test "$curl_cv_ldap_LIBS" = "unknown"; then
  647. if test -z "$x_nlibs"; then
  648. LIBS="$curl_cv_save_LIBS"
  649. else
  650. LIBS="$x_nlibs $curl_cv_save_LIBS"
  651. fi
  652. AC_LINK_IFELSE([
  653. AC_LANG_PROGRAM([[
  654. #undef inline
  655. #ifdef HAVE_WINDOWS_H
  656. #ifndef WIN32_LEAN_AND_MEAN
  657. #define WIN32_LEAN_AND_MEAN
  658. #endif
  659. #include <windows.h>
  660. #ifdef HAVE_WINLDAP_H
  661. #include <winldap.h>
  662. #endif
  663. #ifdef HAVE_WINBER_H
  664. #include <winber.h>
  665. #endif
  666. #endif
  667. ]],[[
  668. BERVAL *bvp = NULL;
  669. BerElement *bep = ber_init(bvp);
  670. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  671. ULONG res = ldap_unbind(ldp);
  672. ber_free(bep, 1);
  673. ]])
  674. ],[
  675. curl_cv_ldap_LIBS="$x_nlibs"
  676. ])
  677. fi
  678. done
  679. #
  680. LIBS="$curl_cv_save_LIBS"
  681. #
  682. case X-"$curl_cv_ldap_LIBS" in
  683. X-unknown)
  684. AC_MSG_RESULT([cannot find WINLDAP libraries])
  685. ;;
  686. X-)
  687. AC_MSG_RESULT([no additional lib required])
  688. ;;
  689. *)
  690. if test -z "$curl_cv_save_LIBS"; then
  691. LIBS="$curl_cv_ldap_LIBS"
  692. else
  693. LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
  694. fi
  695. AC_MSG_RESULT([$curl_cv_ldap_LIBS])
  696. ;;
  697. esac
  698. #
  699. ])
  700. dnl CURL_CHECK_LIBS_LDAP
  701. dnl -------------------------------------------------
  702. dnl Check for libraries needed for LDAP support,
  703. dnl and prepended to LIBS any needed libraries.
  704. dnl This macro can take an optional parameter with a
  705. dnl white space separated list of libraries to check
  706. dnl before the default ones.
  707. AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
  708. AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
  709. #
  710. AC_MSG_CHECKING([for LDAP libraries])
  711. #
  712. u_libs=""
  713. #
  714. ifelse($1,,,[
  715. for x_lib in $1; do
  716. case "$x_lib" in
  717. -l*)
  718. l_lib="$x_lib"
  719. ;;
  720. *)
  721. l_lib="-l$x_lib"
  722. ;;
  723. esac
  724. if test -z "$u_libs"; then
  725. u_libs="$l_lib"
  726. else
  727. u_libs="$u_libs $l_lib"
  728. fi
  729. done
  730. ])
  731. #
  732. curl_cv_save_LIBS="$LIBS"
  733. curl_cv_ldap_LIBS="unknown"
  734. #
  735. for x_nlibs in '' "$u_libs" \
  736. '-lldap' \
  737. '-llber -lldap' \
  738. '-lldap -llber' \
  739. '-lldapssl -lldapx -lldapsdk' \
  740. '-lldapsdk -lldapx -lldapssl' ; do
  741. if test "$curl_cv_ldap_LIBS" = "unknown"; then
  742. if test -z "$x_nlibs"; then
  743. LIBS="$curl_cv_save_LIBS"
  744. else
  745. LIBS="$x_nlibs $curl_cv_save_LIBS"
  746. fi
  747. AC_LINK_IFELSE([
  748. AC_LANG_PROGRAM([[
  749. #undef inline
  750. #ifdef HAVE_WINDOWS_H
  751. #ifndef WIN32_LEAN_AND_MEAN
  752. #define WIN32_LEAN_AND_MEAN
  753. #endif
  754. #include <windows.h>
  755. #else
  756. #ifdef HAVE_SYS_TYPES_H
  757. #include <sys/types.h>
  758. #endif
  759. #endif
  760. #ifndef NULL
  761. #define NULL (void *)0
  762. #endif
  763. #ifndef LDAP_DEPRECATED
  764. #define LDAP_DEPRECATED 1
  765. #endif
  766. #ifdef NEED_LBER_H
  767. #include <lber.h>
  768. #endif
  769. #ifdef HAVE_LDAP_H
  770. #include <ldap.h>
  771. #endif
  772. ]],[[
  773. BerValue *bvp = NULL;
  774. BerElement *bep = ber_init(bvp);
  775. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  776. int res = ldap_unbind(ldp);
  777. ber_free(bep, 1);
  778. ]])
  779. ],[
  780. curl_cv_ldap_LIBS="$x_nlibs"
  781. ])
  782. fi
  783. done
  784. #
  785. LIBS="$curl_cv_save_LIBS"
  786. #
  787. case X-"$curl_cv_ldap_LIBS" in
  788. X-unknown)
  789. AC_MSG_RESULT([cannot find LDAP libraries])
  790. ;;
  791. X-)
  792. AC_MSG_RESULT([no additional lib required])
  793. ;;
  794. *)
  795. if test -z "$curl_cv_save_LIBS"; then
  796. LIBS="$curl_cv_ldap_LIBS"
  797. else
  798. LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
  799. fi
  800. AC_MSG_RESULT([$curl_cv_ldap_LIBS])
  801. ;;
  802. esac
  803. #
  804. ])
  805. dnl CURL_CHECK_HEADER_MALLOC
  806. dnl -------------------------------------------------
  807. dnl Check for compilable and valid malloc.h header,
  808. dnl and check if it is needed even with stdlib.h
  809. AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
  810. AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
  811. AC_COMPILE_IFELSE([
  812. AC_LANG_PROGRAM([[
  813. #include <malloc.h>
  814. ]],[[
  815. void *p = malloc(10);
  816. void *q = calloc(10,10);
  817. free(p);
  818. free(q);
  819. ]])
  820. ],[
  821. ac_cv_header_malloc_h="yes"
  822. ],[
  823. ac_cv_header_malloc_h="no"
  824. ])
  825. ])
  826. if test "$ac_cv_header_malloc_h" = "yes"; then
  827. AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
  828. [Define to 1 if you have the malloc.h header file.])
  829. #
  830. AC_COMPILE_IFELSE([
  831. AC_LANG_PROGRAM([[
  832. #include <stdlib.h>
  833. ]],[[
  834. void *p = malloc(10);
  835. void *q = calloc(10,10);
  836. free(p);
  837. free(q);
  838. ]])
  839. ],[
  840. curl_cv_need_header_malloc_h="no"
  841. ],[
  842. curl_cv_need_header_malloc_h="yes"
  843. ])
  844. #
  845. case "$curl_cv_need_header_malloc_h" in
  846. yes)
  847. AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
  848. [Define to 1 if you need the malloc.h header file even with stdlib.h])
  849. ;;
  850. esac
  851. fi
  852. ])
  853. dnl CURL_CHECK_HEADER_MEMORY
  854. dnl -------------------------------------------------
  855. dnl Check for compilable and valid memory.h header,
  856. dnl and check if it is needed even with stdlib.h for
  857. dnl memory related functions.
  858. AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
  859. AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [
  860. AC_COMPILE_IFELSE([
  861. AC_LANG_PROGRAM([[
  862. #include <memory.h>
  863. ]],[[
  864. void *p = malloc(10);
  865. void *q = calloc(10,10);
  866. free(p);
  867. free(q);
  868. ]])
  869. ],[
  870. ac_cv_header_memory_h="yes"
  871. ],[
  872. ac_cv_header_memory_h="no"
  873. ])
  874. ])
  875. if test "$ac_cv_header_memory_h" = "yes"; then
  876. AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
  877. [Define to 1 if you have the memory.h header file.])
  878. #
  879. AC_COMPILE_IFELSE([
  880. AC_LANG_PROGRAM([[
  881. #include <stdlib.h>
  882. ]],[[
  883. void *p = malloc(10);
  884. void *q = calloc(10,10);
  885. free(p);
  886. free(q);
  887. ]])
  888. ],[
  889. curl_cv_need_header_memory_h="no"
  890. ],[
  891. curl_cv_need_header_memory_h="yes"
  892. ])
  893. #
  894. case "$curl_cv_need_header_memory_h" in
  895. yes)
  896. AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
  897. [Define to 1 if you need the memory.h header file even with stdlib.h])
  898. ;;
  899. esac
  900. fi
  901. ])
  902. dnl CURL_CHECK_FUNC_GETNAMEINFO
  903. dnl -------------------------------------------------
  904. dnl Test if the getnameinfo function is available,
  905. dnl and check the types of five of its arguments.
  906. dnl If the function succeeds HAVE_GETNAMEINFO will be
  907. dnl defined, defining the types of the arguments in
  908. dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
  909. dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
  910. dnl and also defining the type qualifier of first
  911. dnl argument in GETNAMEINFO_QUAL_ARG1.
  912. AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
  913. AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
  914. AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
  915. #
  916. AC_MSG_CHECKING([for getnameinfo])
  917. AC_LINK_IFELSE([
  918. AC_LANG_FUNC_LINK_TRY([getnameinfo])
  919. ],[
  920. AC_MSG_RESULT([yes])
  921. curl_cv_getnameinfo="yes"
  922. ],[
  923. AC_MSG_RESULT([no])
  924. curl_cv_getnameinfo="no"
  925. ])
  926. #
  927. if test "$curl_cv_getnameinfo" != "yes"; then
  928. AC_MSG_CHECKING([deeper for getnameinfo])
  929. AC_LINK_IFELSE([
  930. AC_LANG_PROGRAM([[
  931. ]],[[
  932. getnameinfo();
  933. ]])
  934. ],[
  935. AC_MSG_RESULT([yes])
  936. curl_cv_getnameinfo="yes"
  937. ],[
  938. AC_MSG_RESULT([but still no])
  939. curl_cv_getnameinfo="no"
  940. ])
  941. fi
  942. #
  943. if test "$curl_cv_getnameinfo" != "yes"; then
  944. AC_MSG_CHECKING([deeper and deeper for getnameinfo])
  945. AC_LINK_IFELSE([
  946. AC_LANG_PROGRAM([[
  947. #undef inline
  948. #ifdef HAVE_WINDOWS_H
  949. #ifndef WIN32_LEAN_AND_MEAN
  950. #define WIN32_LEAN_AND_MEAN
  951. #endif
  952. #include <windows.h>
  953. #ifdef HAVE_WINSOCK2_H
  954. #include <winsock2.h>
  955. #ifdef HAVE_WS2TCPIP_H
  956. #include <ws2tcpip.h>
  957. #endif
  958. #endif
  959. #else
  960. #ifdef HAVE_SYS_TYPES_H
  961. #include <sys/types.h>
  962. #endif
  963. #ifdef HAVE_SYS_SOCKET_H
  964. #include <sys/socket.h>
  965. #endif
  966. #ifdef HAVE_NETDB_H
  967. #include <netdb.h>
  968. #endif
  969. #endif
  970. ]],[[
  971. getnameinfo(0, 0, 0, 0, 0, 0, 0);
  972. ]])
  973. ],[
  974. AC_MSG_RESULT([yes])
  975. curl_cv_getnameinfo="yes"
  976. ],[
  977. AC_MSG_RESULT([but still no])
  978. curl_cv_getnameinfo="no"
  979. ])
  980. fi
  981. #
  982. if test "$curl_cv_getnameinfo" = "yes"; then
  983. AC_CACHE_CHECK([types of arguments for getnameinfo],
  984. [curl_cv_func_getnameinfo_args], [
  985. curl_cv_func_getnameinfo_args="unknown"
  986. for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
  987. for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
  988. for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
  989. for gni_arg7 in 'int' 'unsigned int'; do
  990. if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
  991. AC_COMPILE_IFELSE([
  992. AC_LANG_PROGRAM([[
  993. #undef inline
  994. #ifdef HAVE_WINDOWS_H
  995. #ifndef WIN32_LEAN_AND_MEAN
  996. #define WIN32_LEAN_AND_MEAN
  997. #endif
  998. #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
  999. #undef _WIN32_WINNT
  1000. #define _WIN32_WINNT 0x0501
  1001. #endif
  1002. #include <windows.h>
  1003. #ifdef HAVE_WINSOCK2_H
  1004. #include <winsock2.h>
  1005. #ifdef HAVE_WS2TCPIP_H
  1006. #include <ws2tcpip.h>
  1007. #endif
  1008. #endif
  1009. #define GNICALLCONV WSAAPI
  1010. #else
  1011. #ifdef HAVE_SYS_TYPES_H
  1012. #include <sys/types.h>
  1013. #endif
  1014. #ifdef HAVE_SYS_SOCKET_H
  1015. #include <sys/socket.h>
  1016. #endif
  1017. #ifdef HAVE_NETDB_H
  1018. #include <netdb.h>
  1019. #endif
  1020. #define GNICALLCONV
  1021. #endif
  1022. extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
  1023. char *, $gni_arg46,
  1024. char *, $gni_arg46,
  1025. $gni_arg7);
  1026. ]],[[
  1027. $gni_arg2 salen=0;
  1028. $gni_arg46 hostlen=0;
  1029. $gni_arg46 servlen=0;
  1030. $gni_arg7 flags=0;
  1031. int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
  1032. ]])
  1033. ],[
  1034. curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
  1035. ])
  1036. fi
  1037. done
  1038. done
  1039. done
  1040. done
  1041. ]) # AC-CACHE-CHECK
  1042. if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
  1043. AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
  1044. AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
  1045. else
  1046. gni_prev_IFS=$IFS; IFS=','
  1047. set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
  1048. IFS=$gni_prev_IFS
  1049. shift
  1050. #
  1051. gni_qual_type_arg1=$[1]
  1052. #
  1053. AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
  1054. [Define to the type of arg 2 for getnameinfo.])
  1055. AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
  1056. [Define to the type of args 4 and 6 for getnameinfo.])
  1057. AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
  1058. [Define to the type of arg 7 for getnameinfo.])
  1059. #
  1060. prev_sh_opts=$-
  1061. #
  1062. case $prev_sh_opts in
  1063. *f*)
  1064. ;;
  1065. *)
  1066. set -f
  1067. ;;
  1068. esac
  1069. #
  1070. case "$gni_qual_type_arg1" in
  1071. const*)
  1072. gni_qual_arg1=const
  1073. gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
  1074. ;;
  1075. *)
  1076. gni_qual_arg1=
  1077. gni_type_arg1=$gni_qual_type_arg1
  1078. ;;
  1079. esac
  1080. #
  1081. AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
  1082. [Define to the type qualifier of arg 1 for getnameinfo.])
  1083. AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
  1084. [Define to the type of arg 1 for getnameinfo.])
  1085. #
  1086. case $prev_sh_opts in
  1087. *f*)
  1088. ;;
  1089. *)
  1090. set +f
  1091. ;;
  1092. esac
  1093. #
  1094. AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
  1095. [Define to 1 if you have the getnameinfo function.])
  1096. ac_cv_func_getnameinfo="yes"
  1097. fi
  1098. fi
  1099. ])
  1100. dnl TYPE_SOCKADDR_STORAGE
  1101. dnl -------------------------------------------------
  1102. dnl Check for struct sockaddr_storage. Most IPv6-enabled
  1103. dnl hosts have it, but AIX 4.3 is one known exception.
  1104. AC_DEFUN([TYPE_SOCKADDR_STORAGE],
  1105. [
  1106. AC_CHECK_TYPE([struct sockaddr_storage],
  1107. AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
  1108. [if struct sockaddr_storage is defined]), ,
  1109. [
  1110. #undef inline
  1111. #ifdef HAVE_WINDOWS_H
  1112. #ifndef WIN32_LEAN_AND_MEAN
  1113. #define WIN32_LEAN_AND_MEAN
  1114. #endif
  1115. #include <windows.h>
  1116. #ifdef HAVE_WINSOCK2_H
  1117. #include <winsock2.h>
  1118. #endif
  1119. #else
  1120. #ifdef HAVE_SYS_TYPES_H
  1121. #include <sys/types.h>
  1122. #endif
  1123. #ifdef HAVE_SYS_SOCKET_H
  1124. #include <sys/socket.h>
  1125. #endif
  1126. #ifdef HAVE_NETINET_IN_H
  1127. #include <netinet/in.h>
  1128. #endif
  1129. #ifdef HAVE_ARPA_INET_H
  1130. #include <arpa/inet.h>
  1131. #endif
  1132. #endif
  1133. ])
  1134. ])
  1135. dnl CURL_CHECK_NI_WITHSCOPEID
  1136. dnl -------------------------------------------------
  1137. dnl Check for working NI_WITHSCOPEID in getnameinfo()
  1138. AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
  1139. AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
  1140. AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
  1141. AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
  1142. netdb.h netinet/in.h arpa/inet.h)
  1143. #
  1144. AC_CACHE_CHECK([for working NI_WITHSCOPEID],
  1145. [ac_cv_working_ni_withscopeid], [
  1146. AC_RUN_IFELSE([
  1147. AC_LANG_PROGRAM([[
  1148. #ifdef HAVE_STDLIB_H
  1149. #include <stdlib.h>
  1150. #endif
  1151. #ifdef HAVE_STDIO_H
  1152. #include <stdio.h>
  1153. #endif
  1154. #ifdef HAVE_SYS_TYPES_H
  1155. #include <sys/types.h>
  1156. #endif
  1157. #ifdef HAVE_SYS_SOCKET_H
  1158. #include <sys/socket.h>
  1159. #endif
  1160. #ifdef HAVE_NETDB_H
  1161. #include <netdb.h>
  1162. #endif
  1163. #ifdef HAVE_NETINET_IN_H
  1164. #include <netinet/in.h>
  1165. #endif
  1166. #ifdef HAVE_ARPA_INET_H
  1167. #include <arpa/inet.h>
  1168. #endif
  1169. ]],[[
  1170. #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
  1171. #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
  1172. struct sockaddr_storage sa;
  1173. #else
  1174. unsigned char sa[256];
  1175. #endif
  1176. char hostbuf[NI_MAXHOST];
  1177. int rc;
  1178. GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
  1179. GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
  1180. GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
  1181. int fd = socket(AF_INET6, SOCK_STREAM, 0);
  1182. if(fd < 0) {
  1183. perror("socket()");
  1184. return 1; /* Error creating socket */
  1185. }
  1186. rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
  1187. if(rc) {
  1188. perror("getsockname()");
  1189. return 2; /* Error retrieving socket name */
  1190. }
  1191. rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
  1192. if(rc) {
  1193. printf("rc = %s\n", gai_strerror(rc));
  1194. return 3; /* Error translating socket address */
  1195. }
  1196. return 0; /* Ok, NI_WITHSCOPEID works */
  1197. #else
  1198. return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
  1199. #endif
  1200. ]]) # AC-LANG-PROGRAM
  1201. ],[
  1202. # Exit code == 0. Program worked.
  1203. ac_cv_working_ni_withscopeid="yes"
  1204. ],[
  1205. # Exit code != 0. Program failed.
  1206. ac_cv_working_ni_withscopeid="no"
  1207. ],[
  1208. # Program is not run when cross-compiling. So we assume
  1209. # NI_WITHSCOPEID will work if we are able to compile it.
  1210. AC_COMPILE_IFELSE([
  1211. AC_LANG_PROGRAM([[
  1212. #include <sys/types.h>
  1213. #include <sys/socket.h>
  1214. #include <netdb.h>
  1215. ]],[[
  1216. unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
  1217. ]])
  1218. ],[
  1219. ac_cv_working_ni_withscopeid="yes"
  1220. ],[
  1221. ac_cv_working_ni_withscopeid="no"
  1222. ]) # AC-COMPILE-IFELSE
  1223. ]) # AC-RUN-IFELSE
  1224. ]) # AC-CACHE-CHECK
  1225. case "$ac_cv_working_ni_withscopeid" in
  1226. yes)
  1227. AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
  1228. [Define to 1 if NI_WITHSCOPEID exists and works.])
  1229. ;;
  1230. esac
  1231. ])
  1232. dnl CURL_CHECK_FUNC_RECV
  1233. dnl -------------------------------------------------
  1234. dnl Test if the socket recv() function is available,
  1235. dnl and check its return type and the types of its
  1236. dnl arguments. If the function succeeds HAVE_RECV
  1237. dnl will be defined, defining the types of the arguments
  1238. dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
  1239. dnl and RECV_TYPE_ARG4, defining the type of the function
  1240. dnl return value in RECV_TYPE_RETV.
  1241. AC_DEFUN([CURL_CHECK_FUNC_RECV], [
  1242. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
  1243. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  1244. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  1245. #
  1246. AC_MSG_CHECKING([for recv])
  1247. AC_LINK_IFELSE([
  1248. AC_LANG_PROGRAM([[
  1249. #undef inline
  1250. #ifdef HAVE_WINDOWS_H
  1251. #ifndef WIN32_LEAN_AND_MEAN
  1252. #define WIN32_LEAN_AND_MEAN
  1253. #endif
  1254. #include <windows.h>
  1255. #ifdef HAVE_WINSOCK2_H
  1256. #include <winsock2.h>
  1257. #else
  1258. #ifdef HAVE_WINSOCK_H
  1259. #include <winsock.h>
  1260. #endif
  1261. #endif
  1262. #else
  1263. #ifdef HAVE_SYS_TYPES_H
  1264. #include <sys/types.h>
  1265. #endif
  1266. #ifdef HAVE_SYS_SOCKET_H
  1267. #include <sys/socket.h>
  1268. #endif
  1269. #endif
  1270. ]],[[
  1271. recv(0, 0, 0, 0);
  1272. ]])
  1273. ],[
  1274. AC_MSG_RESULT([yes])
  1275. curl_cv_recv="yes"
  1276. ],[
  1277. AC_MSG_RESULT([no])
  1278. curl_cv_recv="no"
  1279. ])
  1280. #
  1281. if test "$curl_cv_recv" = "yes"; then
  1282. AC_CACHE_CHECK([types of args and return type for recv],
  1283. [curl_cv_func_recv_args], [
  1284. curl_cv_func_recv_args="unknown"
  1285. for recv_retv in 'int' 'ssize_t'; do
  1286. for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
  1287. for recv_arg2 in 'char *' 'void *'; do
  1288. for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
  1289. for recv_arg4 in 'int' 'unsigned int'; do
  1290. if test "$curl_cv_func_recv_args" = "unknown"; then
  1291. AC_COMPILE_IFELSE([
  1292. AC_LANG_PROGRAM([[
  1293. #undef inline
  1294. #ifdef HAVE_WINDOWS_H
  1295. #ifndef WIN32_LEAN_AND_MEAN
  1296. #define WIN32_LEAN_AND_MEAN
  1297. #endif
  1298. #include <windows.h>
  1299. #ifdef HAVE_WINSOCK2_H
  1300. #include <winsock2.h>
  1301. #else
  1302. #ifdef HAVE_WINSOCK_H
  1303. #include <winsock.h>
  1304. #endif
  1305. #endif
  1306. #define RECVCALLCONV PASCAL
  1307. #else
  1308. #ifdef HAVE_SYS_TYPES_H
  1309. #include <sys/types.h>
  1310. #endif
  1311. #ifdef HAVE_SYS_SOCKET_H
  1312. #include <sys/socket.h>
  1313. #endif
  1314. #define RECVCALLCONV
  1315. #endif
  1316. extern $recv_retv RECVCALLCONV
  1317. recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
  1318. ]],[[
  1319. $recv_arg1 s=0;
  1320. $recv_arg2 buf=0;
  1321. $recv_arg3 len=0;
  1322. $recv_arg4 flags=0;
  1323. $recv_retv res = recv(s, buf, len, flags);
  1324. ]])
  1325. ],[
  1326. curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
  1327. ])
  1328. fi
  1329. done
  1330. done
  1331. done
  1332. done
  1333. done
  1334. ]) # AC-CACHE-CHECK
  1335. if test "$curl_cv_func_recv_args" = "unknown"; then
  1336. AC_MSG_ERROR([Cannot find proper types to use for recv args])
  1337. else
  1338. recv_prev_IFS=$IFS; IFS=','
  1339. set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
  1340. IFS=$recv_prev_IFS
  1341. shift
  1342. #
  1343. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
  1344. [Define to the type of arg 1 for recv.])
  1345. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
  1346. [Define to the type of arg 2 for recv.])
  1347. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
  1348. [Define to the type of arg 3 for recv.])
  1349. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
  1350. [Define to the type of arg 4 for recv.])
  1351. AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
  1352. [Define to the function return type for recv.])
  1353. #
  1354. AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
  1355. [Define to 1 if you have the recv function.])
  1356. ac_cv_func_recv="yes"
  1357. fi
  1358. else
  1359. AC_MSG_ERROR([Unable to link function recv])
  1360. fi
  1361. ])
  1362. dnl CURL_CHECK_FUNC_SEND
  1363. dnl -------------------------------------------------
  1364. dnl Test if the socket send() function is available,
  1365. dnl and check its return type and the types of its
  1366. dnl arguments. If the function succeeds HAVE_SEND
  1367. dnl will be defined, defining the types of the arguments
  1368. dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
  1369. dnl and SEND_TYPE_ARG4, defining the type of the function
  1370. dnl return value in SEND_TYPE_RETV, and also defining the
  1371. dnl type qualifier of second argument in SEND_QUAL_ARG2.
  1372. AC_DEFUN([CURL_CHECK_FUNC_SEND], [
  1373. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
  1374. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  1375. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  1376. #
  1377. AC_MSG_CHECKING([for send])
  1378. AC_LINK_IFELSE([
  1379. AC_LANG_PROGRAM([[
  1380. #undef inline
  1381. #ifdef HAVE_WINDOWS_H
  1382. #ifndef WIN32_LEAN_AND_MEAN
  1383. #define WIN32_LEAN_AND_MEAN
  1384. #endif
  1385. #include <windows.h>
  1386. #ifdef HAVE_WINSOCK2_H
  1387. #include <winsock2.h>
  1388. #else
  1389. #ifdef HAVE_WINSOCK_H
  1390. #include <winsock.h>
  1391. #endif
  1392. #endif
  1393. #else
  1394. #ifdef HAVE_SYS_TYPES_H
  1395. #include <sys/types.h>
  1396. #endif
  1397. #ifdef HAVE_SYS_SOCKET_H
  1398. #include <sys/socket.h>
  1399. #endif
  1400. #endif
  1401. ]],[[
  1402. send(0, 0, 0, 0);
  1403. ]])
  1404. ],[
  1405. AC_MSG_RESULT([yes])
  1406. curl_cv_send="yes"
  1407. ],[
  1408. AC_MSG_RESULT([no])
  1409. curl_cv_send="no"
  1410. ])
  1411. #
  1412. if test "$curl_cv_send" = "yes"; then
  1413. AC_CACHE_CHECK([types of args and return type for send],
  1414. [curl_cv_func_send_args], [
  1415. curl_cv_func_send_args="unknown"
  1416. for send_retv in 'int' 'ssize_t'; do
  1417. for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
  1418. for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
  1419. for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
  1420. for send_arg4 in 'int' 'unsigned int'; do
  1421. if test "$curl_cv_func_send_args" = "unknown"; then
  1422. AC_COMPILE_IFELSE([
  1423. AC_LANG_PROGRAM([[
  1424. #undef inline
  1425. #ifdef HAVE_WINDOWS_H
  1426. #ifndef WIN32_LEAN_AND_MEAN
  1427. #define WIN32_LEAN_AND_MEAN
  1428. #endif
  1429. #include <windows.h>
  1430. #ifdef HAVE_WINSOCK2_H
  1431. #include <winsock2.h>
  1432. #else
  1433. #ifdef HAVE_WINSOCK_H
  1434. #include <winsock.h>
  1435. #endif
  1436. #endif
  1437. #define SENDCALLCONV PASCAL
  1438. #else
  1439. #ifdef HAVE_SYS_TYPES_H
  1440. #include <sys/types.h>
  1441. #endif
  1442. #ifdef HAVE_SYS_SOCKET_H
  1443. #include <sys/socket.h>
  1444. #endif
  1445. #define SENDCALLCONV
  1446. #endif
  1447. extern $send_retv SENDCALLCONV
  1448. send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
  1449. ]],[[
  1450. $send_arg1 s=0;
  1451. $send_arg3 len=0;
  1452. $send_arg4 flags=0;
  1453. $send_retv res = send(s, 0, len, flags);
  1454. ]])
  1455. ],[
  1456. curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
  1457. ])
  1458. fi
  1459. done
  1460. done
  1461. done
  1462. done
  1463. done
  1464. ]) # AC-CACHE-CHECK
  1465. if test "$curl_cv_func_send_args" = "unknown"; then
  1466. AC_MSG_ERROR([Cannot find proper types to use for send args])
  1467. else
  1468. send_prev_IFS=$IFS; IFS=','
  1469. set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
  1470. IFS=$send_prev_IFS
  1471. shift
  1472. #
  1473. send_qual_type_arg2=$[2]
  1474. #
  1475. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
  1476. [Define to the type of arg 1 for send.])
  1477. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
  1478. [Define to the type of arg 3 for send.])
  1479. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
  1480. [Define to the type of arg 4 for send.])
  1481. AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
  1482. [Define to the function return type for send.])
  1483. #
  1484. prev_sh_opts=$-
  1485. #
  1486. case $prev_sh_opts in
  1487. *f*)
  1488. ;;
  1489. *)
  1490. set -f
  1491. ;;
  1492. esac
  1493. #
  1494. case "$send_qual_type_arg2" in
  1495. const*)
  1496. send_qual_arg2=const
  1497. send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
  1498. ;;
  1499. *)
  1500. send_qual_arg2=
  1501. send_type_arg2=$send_qual_type_arg2
  1502. ;;
  1503. esac
  1504. #
  1505. AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
  1506. [Define to the type qualifier of arg 2 for send.])
  1507. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
  1508. [Define to the type of arg 2 for send.])
  1509. #
  1510. case $prev_sh_opts in
  1511. *f*)
  1512. ;;
  1513. *)
  1514. set +f
  1515. ;;
  1516. esac
  1517. #
  1518. AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
  1519. [Define to 1 if you have the send function.])
  1520. ac_cv_func_send="yes"
  1521. fi
  1522. else
  1523. AC_MSG_ERROR([Unable to link function send])
  1524. fi
  1525. ])
  1526. dnl CURL_CHECK_FUNC_RECVFROM
  1527. dnl -------------------------------------------------
  1528. dnl Test if the socket recvfrom() function is available,
  1529. dnl and check its return type and the types of its
  1530. dnl arguments. If the function succeeds HAVE_RECVFROM
  1531. dnl will be defined, defining the types of the arguments
  1532. dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on
  1533. dnl to RECVFROM_TYPE_ARG6, defining also the type of the
  1534. dnl function return value in RECVFROM_TYPE_RETV.
  1535. dnl Notice that the types returned for pointer arguments
  1536. dnl will actually be the type pointed by the pointer.
  1537. AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [
  1538. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
  1539. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  1540. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  1541. #
  1542. AC_MSG_CHECKING([for recvfrom])
  1543. AC_LINK_IFELSE([
  1544. AC_LANG_PROGRAM([[
  1545. #undef inline
  1546. #ifdef HAVE_WINDOWS_H
  1547. #ifndef WIN32_LEAN_AND_MEAN
  1548. #define WIN32_LEAN_AND_MEAN
  1549. #endif
  1550. #include <windows.h>
  1551. #ifdef HAVE_WINSOCK2_H
  1552. #include <winsock2.h>
  1553. #else
  1554. #ifdef HAVE_WINSOCK_H
  1555. #include <winsock.h>
  1556. #endif
  1557. #endif
  1558. #else
  1559. #ifdef HAVE_SYS_TYPES_H
  1560. #include <sys/types.h>
  1561. #endif
  1562. #ifdef HAVE_SYS_SOCKET_H
  1563. #include <sys/socket.h>
  1564. #endif
  1565. #endif
  1566. ]],[[
  1567. recvfrom(0, 0, 0, 0, 0, 0);
  1568. ]])
  1569. ],[
  1570. AC_MSG_RESULT([yes])
  1571. curl_cv_recvfrom="yes"
  1572. ],[
  1573. AC_MSG_RESULT([no])
  1574. curl_cv_recvfrom="no"
  1575. ])
  1576. #
  1577. if test "$curl_cv_recvfrom" = "yes"; then
  1578. AC_CACHE_CHECK([types of args and return type for recvfrom],
  1579. [curl_cv_func_recvfrom_args], [
  1580. curl_cv_func_recvfrom_args="unknown"
  1581. for recvfrom_retv in 'int' 'ssize_t'; do
  1582. for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do
  1583. for recvfrom_arg2 in 'char *' 'void *'; do
  1584. for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
  1585. for recvfrom_arg4 in 'int' 'unsigned int'; do
  1586. for recvfrom_arg5 in 'struct sockaddr *' 'void *' 'const struct sockaddr *'; do
  1587. for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do
  1588. if test "$curl_cv_func_recvfrom_args" = "unknown"; then
  1589. AC_COMPILE_IFELSE([
  1590. AC_LANG_PROGRAM([[
  1591. #undef inline
  1592. #ifdef HAVE_WINDOWS_H
  1593. #ifndef WIN32_LEAN_AND_MEAN
  1594. #define WIN32_LEAN_AND_MEAN
  1595. #endif
  1596. #include <windows.h>
  1597. #ifdef HAVE_WINSOCK2_H
  1598. #include <winsock2.h>
  1599. #else
  1600. #ifdef HAVE_WINSOCK_H
  1601. #include <winsock.h>
  1602. #endif
  1603. #endif
  1604. #define RECVFROMCALLCONV PASCAL
  1605. #else
  1606. #ifdef HAVE_SYS_TYPES_H
  1607. #include <sys/types.h>
  1608. #endif
  1609. #ifdef HAVE_SYS_SOCKET_H
  1610. #include <sys/socket.h>
  1611. #endif
  1612. #define RECVFROMCALLCONV
  1613. #endif
  1614. extern $recvfrom_retv RECVFROMCALLCONV
  1615. recvfrom($recvfrom_arg1, $recvfrom_arg2,
  1616. $recvfrom_arg3, $recvfrom_arg4,
  1617. $recvfrom_arg5, $recvfrom_arg6);
  1618. ]],[[
  1619. $recvfrom_arg1 s=0;
  1620. $recvfrom_arg2 buf=0;
  1621. $recvfrom_arg3 len=0;
  1622. $recvfrom_arg4 flags=0;
  1623. $recvfrom_arg5 addr=0;
  1624. $recvfrom_arg6 addrlen=0;
  1625. $recvfrom_retv res=0;
  1626. res = recvfrom(s, buf, len, flags, addr, addrlen);
  1627. ]])
  1628. ],[
  1629. curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv"
  1630. ])
  1631. fi
  1632. done
  1633. done
  1634. done
  1635. done
  1636. done
  1637. done
  1638. done
  1639. ]) # AC-CACHE-CHECK
  1640. # Nearly last minute change for this release starts here
  1641. AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
  1642. [Define to 1 if you have the recvfrom function.])
  1643. ac_cv_func_recvfrom="yes"
  1644. # Nearly last minute change for this release ends here
  1645. if test "$curl_cv_func_recvfrom_args" = "unknown"; then
  1646. AC_MSG_WARN([Cannot find proper types to use for recvfrom args])
  1647. else
  1648. recvfrom_prev_IFS=$IFS; IFS=','
  1649. set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'`
  1650. IFS=$recvfrom_prev_IFS
  1651. shift
  1652. #
  1653. recvfrom_ptrt_arg2=$[2]
  1654. recvfrom_qual_ptrt_arg5=$[5]
  1655. recvfrom_ptrt_arg6=$[6]
  1656. #
  1657. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1],
  1658. [Define to the type of arg 1 for recvfrom.])
  1659. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3],
  1660. [Define to the type of arg 3 for recvfrom.])
  1661. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4],
  1662. [Define to the type of arg 4 for recvfrom.])
  1663. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7],
  1664. [Define to the function return type for recvfrom.])
  1665. #
  1666. prev_sh_opts=$-
  1667. #
  1668. case $prev_sh_opts in
  1669. *f*)
  1670. ;;
  1671. *)
  1672. set -f
  1673. ;;
  1674. esac
  1675. #
  1676. case "$recvfrom_qual_ptrt_arg5" in
  1677. const*)
  1678. recvfrom_qual_arg5=const
  1679. recvfrom_ptrt_arg5=`echo $recvfrom_qual_ptrt_arg5 | sed 's/^const //'`
  1680. ;;
  1681. *)
  1682. recvfrom_qual_arg5=
  1683. recvfrom_ptrt_arg5=$recvfrom_qual_ptrt_arg5
  1684. ;;
  1685. esac
  1686. #
  1687. recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'`
  1688. recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'`
  1689. recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'`
  1690. #
  1691. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2,
  1692. [Define to the type pointed by arg 2 for recvfrom.])
  1693. AC_DEFINE_UNQUOTED(RECVFROM_QUAL_ARG5, $recvfrom_qual_arg5,
  1694. [Define to the type qualifier pointed by arg 5 for recvfrom.])
  1695. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5,
  1696. [Define to the type pointed by arg 5 for recvfrom.])
  1697. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6,
  1698. [Define to the type pointed by arg 6 for recvfrom.])
  1699. #
  1700. if test "$recvfrom_type_arg2" = "void"; then
  1701. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1,
  1702. [Define to 1 if the type pointed by arg 2 for recvfrom is void.])
  1703. fi
  1704. if test "$recvfrom_type_arg5" = "void"; then
  1705. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1,
  1706. [Define to 1 if the type pointed by arg 5 for recvfrom is void.])
  1707. fi
  1708. if test "$recvfrom_type_arg6" = "void"; then
  1709. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1,
  1710. [Define to 1 if the type pointed by arg 6 for recvfrom is void.])
  1711. fi
  1712. #
  1713. case $prev_sh_opts in
  1714. *f*)
  1715. ;;
  1716. *)
  1717. set +f
  1718. ;;
  1719. esac
  1720. #
  1721. AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
  1722. [Define to 1 if you have the recvfrom function.])
  1723. ac_cv_func_recvfrom="yes"
  1724. fi
  1725. else
  1726. AC_MSG_WARN([Unable to link function recvfrom])
  1727. fi
  1728. ])
  1729. dnl CURL_CHECK_MSG_NOSIGNAL
  1730. dnl -------------------------------------------------
  1731. dnl Check for MSG_NOSIGNAL
  1732. AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
  1733. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  1734. AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
  1735. AC_COMPILE_IFELSE([
  1736. AC_LANG_PROGRAM([[
  1737. #undef inline
  1738. #ifdef HAVE_WINDOWS_H
  1739. #ifndef WIN32_LEAN_AND_MEAN
  1740. #define WIN32_LEAN_AND_MEAN
  1741. #endif
  1742. #include <windows.h>
  1743. #ifdef HAVE_WINSOCK2_H
  1744. #include <winsock2.h>
  1745. #else
  1746. #ifdef HAVE_WINSOCK_H
  1747. #include <winsock.h>
  1748. #endif
  1749. #endif
  1750. #else
  1751. #ifdef HAVE_SYS_TYPES_H
  1752. #include <sys/types.h>
  1753. #endif
  1754. #ifdef HAVE_SYS_SOCKET_H
  1755. #include <sys/socket.h>
  1756. #endif
  1757. #endif
  1758. ]],[[
  1759. int flag=MSG_NOSIGNAL;
  1760. ]])
  1761. ],[
  1762. ac_cv_msg_nosignal="yes"
  1763. ],[
  1764. ac_cv_msg_nosignal="no"
  1765. ])
  1766. ])
  1767. case "$ac_cv_msg_nosignal" in
  1768. yes)
  1769. AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
  1770. [Define to 1 if you have the MSG_NOSIGNAL flag.])
  1771. ;;
  1772. esac
  1773. ])
  1774. dnl CURL_CHECK_STRUCT_TIMEVAL
  1775. dnl -------------------------------------------------
  1776. dnl Check for timeval struct
  1777. AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
  1778. AC_REQUIRE([AC_HEADER_TIME])dnl
  1779. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
  1780. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  1781. AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h)
  1782. AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
  1783. AC_COMPILE_IFELSE([
  1784. AC_LANG_PROGRAM([[
  1785. #undef inline
  1786. #ifdef HAVE_WINDOWS_H
  1787. #ifndef WIN32_LEAN_AND_MEAN
  1788. #define WIN32_LEAN_AND_MEAN
  1789. #endif
  1790. #include <windows.h>
  1791. #ifdef HAVE_WINSOCK2_H
  1792. #include <winsock2.h>
  1793. #else
  1794. #ifdef HAVE_WINSOCK_H
  1795. #include <winsock.h>
  1796. #endif
  1797. #endif
  1798. #endif
  1799. #ifdef HAVE_SYS_TYPES_H
  1800. #include <sys/types.h>
  1801. #endif
  1802. #ifdef HAVE_SYS_TIME_H
  1803. #include <sys/time.h>
  1804. #ifdef TIME_WITH_SYS_TIME
  1805. #include <time.h>
  1806. #endif
  1807. #else
  1808. #ifdef HAVE_TIME_H
  1809. #include <time.h>
  1810. #endif
  1811. #endif
  1812. #ifdef HAVE_SYS_SOCKET_H
  1813. #include <sys/socket.h>
  1814. #endif
  1815. ]],[[
  1816. struct timeval ts;
  1817. ts.tv_sec = 0;
  1818. ts.tv_usec = 0;
  1819. ]])
  1820. ],[
  1821. ac_cv_struct_timeval="yes"
  1822. ],[
  1823. ac_cv_struct_timeval="no"
  1824. ])
  1825. ])
  1826. case "$ac_cv_struct_timeval" in
  1827. yes)
  1828. AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
  1829. [Define to 1 if you have the timeval struct.])
  1830. ;;
  1831. esac
  1832. ])
  1833. dnl TYPE_SIG_ATOMIC_T
  1834. dnl -------------------------------------------------
  1835. dnl Check if the sig_atomic_t type is available, and
  1836. dnl verify if it is already defined as volatile.
  1837. AC_DEFUN([TYPE_SIG_ATOMIC_T], [
  1838. AC_CHECK_HEADERS(signal.h)
  1839. AC_CHECK_TYPE([sig_atomic_t],[
  1840. AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
  1841. [Define to 1 if sig_atomic_t is an available typedef.])
  1842. ], ,[
  1843. #ifdef HAVE_SIGNAL_H
  1844. #include <signal.h>
  1845. #endif
  1846. ])
  1847. case "$ac_cv_type_sig_atomic_t" in
  1848. yes)
  1849. #
  1850. AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
  1851. AC_LINK_IFELSE([
  1852. AC_LANG_PROGRAM([[
  1853. #ifdef HAVE_SIGNAL_H
  1854. #include <signal.h>
  1855. #endif
  1856. ]],[[
  1857. static volatile sig_atomic_t dummy = 0;
  1858. ]])
  1859. ],[
  1860. AC_MSG_RESULT([no])
  1861. ac_cv_sig_atomic_t_volatile="no"
  1862. ],[
  1863. AC_MSG_RESULT([yes])
  1864. ac_cv_sig_atomic_t_volatile="yes"
  1865. ])
  1866. #
  1867. if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
  1868. AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
  1869. [Define to 1 if sig_atomic_t is already defined as volatile.])
  1870. fi
  1871. ;;
  1872. esac
  1873. ])
  1874. dnl TYPE_IN_ADDR_T
  1875. dnl -------------------------------------------------
  1876. dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
  1877. dnl and a few other things.
  1878. AC_DEFUN([TYPE_IN_ADDR_T], [
  1879. AC_CHECK_TYPE([in_addr_t], ,[
  1880. dnl in_addr_t not available
  1881. AC_CACHE_CHECK([for in_addr_t equivalent],
  1882. [curl_cv_in_addr_t_equiv], [
  1883. curl_cv_in_addr_t_equiv="unknown"
  1884. for t in "unsigned long" int size_t unsigned long; do
  1885. if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
  1886. AC_LINK_IFELSE([
  1887. AC_LANG_PROGRAM([[
  1888. #undef inline
  1889. #ifdef HAVE_WINDOWS_H
  1890. #ifndef WIN32_LEAN_AND_MEAN
  1891. #define WIN32_LEAN_AND_MEAN
  1892. #endif
  1893. #include <windows.h>
  1894. #ifdef HAVE_WINSOCK2_H
  1895. #include <winsock2.h>
  1896. #else
  1897. #ifdef HAVE_WINSOCK_H
  1898. #include <winsock.h>
  1899. #endif
  1900. #endif
  1901. #else
  1902. #ifdef HAVE_SYS_TYPES_H
  1903. #include <sys/types.h>
  1904. #endif
  1905. #ifdef HAVE_SYS_SOCKET_H
  1906. #include <sys/socket.h>
  1907. #endif
  1908. #ifdef HAVE_NETINET_IN_H
  1909. #include <netinet/in.h>
  1910. #endif
  1911. #ifdef HAVE_ARPA_INET_H
  1912. #include <arpa/inet.h>
  1913. #endif
  1914. #endif
  1915. ]],[[
  1916. $t data = inet_addr ("1.2.3.4");
  1917. ]])
  1918. ],[
  1919. curl_cv_in_addr_t_equiv="$t"
  1920. ])
  1921. fi
  1922. done
  1923. ])
  1924. case "$curl_cv_in_addr_t_equiv" in
  1925. unknown)
  1926. AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
  1927. ;;
  1928. *)
  1929. AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
  1930. [Type to use in place of in_addr_t when system does not provide it.])
  1931. ;;
  1932. esac
  1933. ],[
  1934. #undef inline
  1935. #ifdef HAVE_WINDOWS_H
  1936. #ifndef WIN32_LEAN_AND_MEAN
  1937. #define WIN32_LEAN_AND_MEAN
  1938. #endif
  1939. #include <windows.h>
  1940. #ifdef HAVE_WINSOCK2_H
  1941. #include <winsock2.h>
  1942. #else
  1943. #ifdef HAVE_WINSOCK_H
  1944. #include <winsock.h>
  1945. #endif
  1946. #endif
  1947. #else
  1948. #ifdef HAVE_SYS_TYPES_H
  1949. #include <sys/types.h>
  1950. #endif
  1951. #ifdef HAVE_SYS_SOCKET_H
  1952. #include <sys/socket.h>
  1953. #endif
  1954. #ifdef HAVE_NETINET_IN_H
  1955. #include <netinet/in.h>
  1956. #endif
  1957. #ifdef HAVE_ARPA_INET_H
  1958. #include <arpa/inet.h>
  1959. #endif
  1960. #endif
  1961. ])
  1962. ])
  1963. dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
  1964. dnl -------------------------------------------------
  1965. dnl Check if monotonic clock_gettime is available.
  1966. AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
  1967. AC_REQUIRE([AC_HEADER_TIME])dnl
  1968. AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
  1969. AC_MSG_CHECKING([for monotonic clock_gettime])
  1970. AC_COMPILE_IFELSE([
  1971. AC_LANG_PROGRAM([[
  1972. #ifdef HAVE_SYS_TYPES_H
  1973. #include <sys/types.h>
  1974. #endif
  1975. #ifdef HAVE_SYS_TIME_H
  1976. #include <sys/time.h>
  1977. #ifdef TIME_WITH_SYS_TIME
  1978. #include <time.h>
  1979. #endif
  1980. #else
  1981. #ifdef HAVE_TIME_H
  1982. #include <time.h>
  1983. #endif
  1984. #endif
  1985. ]],[[
  1986. struct timespec ts;
  1987. (void)clock_gettime(CLOCK_MONOTONIC, &ts);
  1988. ]])
  1989. ],[
  1990. AC_MSG_RESULT([yes])
  1991. ac_cv_func_clock_gettime="yes"
  1992. ],[
  1993. AC_MSG_RESULT([no])
  1994. ac_cv_func_clock_gettime="no"
  1995. ])
  1996. dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
  1997. dnl until library linking and run-time checks for clock_gettime succeed.
  1998. ])
  1999. dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
  2000. dnl -------------------------------------------------
  2001. dnl If monotonic clock_gettime is available then,
  2002. dnl check and prepended to LIBS any needed libraries.
  2003. AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
  2004. AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
  2005. #
  2006. if test "$ac_cv_func_clock_gettime" = "yes"; then
  2007. #
  2008. AC_MSG_CHECKING([for clock_gettime in libraries])
  2009. #
  2010. curl_cv_save_LIBS="$LIBS"
  2011. curl_cv_gclk_LIBS="unknown"
  2012. #
  2013. for x_xlibs in '' '-lrt' '-lposix4' ; do
  2014. if test "$curl_cv_gclk_LIBS" = "unknown"; then
  2015. if test -z "$x_xlibs"; then
  2016. LIBS="$curl_cv_save_LIBS"
  2017. else
  2018. LIBS="$x_xlibs $curl_cv_save_LIBS"
  2019. fi
  2020. AC_LINK_IFELSE([
  2021. AC_LANG_PROGRAM([[
  2022. #ifdef HAVE_SYS_TYPES_H
  2023. #include <sys/types.h>
  2024. #endif
  2025. #ifdef HAVE_SYS_TIME_H
  2026. #include <sys/time.h>
  2027. #ifdef TIME_WITH_SYS_TIME
  2028. #include <time.h>
  2029. #endif
  2030. #else
  2031. #ifdef HAVE_TIME_H
  2032. #include <time.h>
  2033. #endif
  2034. #endif
  2035. ]],[[
  2036. struct timespec ts;
  2037. (void)clock_gettime(CLOCK_MONOTONIC, &ts);
  2038. ]])
  2039. ],[
  2040. curl_cv_gclk_LIBS="$x_xlibs"
  2041. ])
  2042. fi
  2043. done
  2044. #
  2045. LIBS="$curl_cv_save_LIBS"
  2046. #
  2047. case X-"$curl_cv_gclk_LIBS" in
  2048. X-unknown)
  2049. AC_MSG_RESULT([cannot find clock_gettime])
  2050. AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
  2051. ac_cv_func_clock_gettime="no"
  2052. ;;
  2053. X-)
  2054. AC_MSG_RESULT([no additional lib required])
  2055. ac_cv_func_clock_gettime="yes"
  2056. ;;
  2057. *)
  2058. if test -z "$curl_cv_save_LIBS"; then
  2059. LIBS="$curl_cv_gclk_LIBS"
  2060. else
  2061. LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
  2062. fi
  2063. CURL_LIBS="$CURL_LIBS $curl_cv_gclk_LIBS"
  2064. AC_MSG_RESULT([$curl_cv_gclk_LIBS])
  2065. ac_cv_func_clock_gettime="yes"
  2066. ;;
  2067. esac
  2068. #
  2069. dnl only do runtime verification when not cross-compiling
  2070. if test "x$cross_compiling" != "xyes" &&
  2071. test "$ac_cv_func_clock_gettime" = "yes"; then
  2072. AC_MSG_CHECKING([if monotonic clock_gettime works])
  2073. AC_RUN_IFELSE([
  2074. AC_LANG_PROGRAM([[
  2075. #ifdef HAVE_STDLIB_H
  2076. #include <stdlib.h>
  2077. #endif
  2078. #ifdef HAVE_SYS_TYPES_H
  2079. #include <sys/types.h>
  2080. #endif
  2081. #ifdef HAVE_SYS_TIME_H
  2082. #include <sys/time.h>
  2083. #ifdef TIME_WITH_SYS_TIME
  2084. #include <time.h>
  2085. #endif
  2086. #else
  2087. #ifdef HAVE_TIME_H
  2088. #include <time.h>
  2089. #endif
  2090. #endif
  2091. ]],[[
  2092. struct timespec ts;
  2093. if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
  2094. exit(0);
  2095. else
  2096. exit(1);
  2097. ]])
  2098. ],[
  2099. AC_MSG_RESULT([yes])
  2100. ],[
  2101. AC_MSG_RESULT([no])
  2102. AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
  2103. ac_cv_func_clock_gettime="no"
  2104. LIBS="$curl_cv_save_LIBS"
  2105. ])
  2106. fi
  2107. #
  2108. case "$ac_cv_func_clock_gettime" in
  2109. yes)
  2110. AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
  2111. [Define to 1 if you have the clock_gettime function and monotonic timer.])
  2112. ;;
  2113. esac
  2114. #
  2115. fi
  2116. #
  2117. ])
  2118. dnl CURL_CHECK_LIBS_CONNECT
  2119. dnl -------------------------------------------------
  2120. dnl Verify if network connect function is already available
  2121. dnl using current libraries or if another one is required.
  2122. AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
  2123. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2124. AC_MSG_CHECKING([for connect in libraries])
  2125. tst_connect_save_LIBS="$LIBS"
  2126. tst_connect_need_LIBS="unknown"
  2127. for tst_lib in '' '-lsocket' ; do
  2128. if test "$tst_connect_need_LIBS" = "unknown"; then
  2129. LIBS="$tst_lib $tst_connect_save_LIBS"
  2130. AC_LINK_IFELSE([
  2131. AC_LANG_PROGRAM([[
  2132. $curl_includes_winsock2
  2133. #ifndef HAVE_WINDOWS_H
  2134. int connect(int, void*, int);
  2135. #endif
  2136. ]],[[
  2137. if(0 != connect(0, 0, 0))
  2138. return 1;
  2139. ]])
  2140. ],[
  2141. tst_connect_need_LIBS="$tst_lib"
  2142. ])
  2143. fi
  2144. done
  2145. LIBS="$tst_connect_save_LIBS"
  2146. #
  2147. case X-"$tst_connect_need_LIBS" in
  2148. X-unknown)
  2149. AC_MSG_RESULT([cannot find connect])
  2150. AC_MSG_ERROR([cannot find connect function in libraries.])
  2151. ;;
  2152. X-)
  2153. AC_MSG_RESULT([yes])
  2154. ;;
  2155. *)
  2156. AC_MSG_RESULT([$tst_connect_need_LIBS])
  2157. LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
  2158. ;;
  2159. esac
  2160. ])
  2161. dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
  2162. dnl -------------------------------------------------
  2163. dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
  2164. dnl symbol that can be further used in custom template configuration
  2165. dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
  2166. dnl argument for the description. Symbol definitions done with this
  2167. dnl macro are intended to be exclusively used in handcrafted *.h.in
  2168. dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
  2169. dnl prevents autoheader generation and insertion of symbol template
  2170. dnl stub and definition into the first configuration header file. Do
  2171. dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
  2172. dnl one serves different functional needs.
  2173. AC_DEFUN([CURL_DEFINE_UNQUOTED], [
  2174. cat >>confdefs.h <<_EOF
  2175. [@%:@define] $1 ifelse($#, 2, [$2], 1)
  2176. _EOF
  2177. ])
  2178. dnl CURL_CONFIGURE_LONG
  2179. dnl -------------------------------------------------
  2180. dnl Find out the size of long as reported by sizeof() and define
  2181. dnl CURL_SIZEOF_LONG as appropriate to be used in template file
  2182. dnl include/curl/curlbuild.h.in to properly configure the library.
  2183. dnl The size of long is a build time characteristic and as such
  2184. dnl must be recorded in curlbuild.h
  2185. AC_DEFUN([CURL_CONFIGURE_LONG], [
  2186. if test -z "$ac_cv_sizeof_long" ||
  2187. test "$ac_cv_sizeof_long" -eq "0"; then
  2188. AC_MSG_ERROR([cannot find out size of long.])
  2189. fi
  2190. CURL_DEFINE_UNQUOTED([CURL_SIZEOF_LONG], [$ac_cv_sizeof_long])
  2191. ])
  2192. dnl CURL_CONFIGURE_CURL_SOCKLEN_T
  2193. dnl -------------------------------------------------
  2194. dnl Find out suitable curl_socklen_t data type definition and size, making
  2195. dnl appropriate definitions for template file include/curl/curlbuild.h.in
  2196. dnl to properly configure and use the library.
  2197. dnl
  2198. dnl The need for the curl_socklen_t definition arises mainly to properly
  2199. dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t
  2200. dnl data type which is 32 or 64-Bit wide depending on the data model being
  2201. dnl used, and that on the other hand is only actually used when interfacing
  2202. dnl the X/Open sockets provided in the xnet library.
  2203. AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [
  2204. AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
  2205. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  2206. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  2207. #
  2208. AC_MSG_CHECKING([for curl_socklen_t data type])
  2209. curl_typeof_curl_socklen_t="unknown"
  2210. for arg1 in int SOCKET; do
  2211. for arg2 in 'struct sockaddr' void; do
  2212. for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do
  2213. if test "$curl_typeof_curl_socklen_t" = "unknown"; then
  2214. AC_COMPILE_IFELSE([
  2215. AC_LANG_PROGRAM([[
  2216. $curl_includes_ws2tcpip
  2217. $curl_includes_sys_socket
  2218. $curl_preprocess_callconv
  2219. extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *);
  2220. ]],[[
  2221. $t *lenptr = 0;
  2222. if(0 != getpeername(0, 0, lenptr))
  2223. return 1;
  2224. ]])
  2225. ],[
  2226. curl_typeof_curl_socklen_t="$t"
  2227. ])
  2228. fi
  2229. done
  2230. done
  2231. done
  2232. for t in socklen_t int; do
  2233. if test "$curl_typeof_curl_socklen_t" = "void"; then
  2234. AC_COMPILE_IFELSE([
  2235. AC_LANG_PROGRAM([[
  2236. $curl_includes_sys_socket
  2237. typedef $t curl_socklen_t;
  2238. ]],[[
  2239. curl_socklen_t dummy;
  2240. ]])
  2241. ],[
  2242. curl_typeof_curl_socklen_t="$t"
  2243. ])
  2244. fi
  2245. done
  2246. AC_MSG_RESULT([$curl_typeof_curl_socklen_t])
  2247. if test "$curl_typeof_curl_socklen_t" = "void" ||
  2248. test "$curl_typeof_curl_socklen_t" = "unknown"; then
  2249. AC_MSG_ERROR([cannot find data type for curl_socklen_t.])
  2250. fi
  2251. #
  2252. AC_MSG_CHECKING([size of curl_socklen_t])
  2253. curl_sizeof_curl_socklen_t="unknown"
  2254. curl_pull_headers_socklen_t="unknown"
  2255. if test "$ac_cv_header_ws2tcpip_h" = "yes"; then
  2256. tst_pull_header_checks='none ws2tcpip'
  2257. tst_size_checks='4'
  2258. else
  2259. tst_pull_header_checks='none systypes syssocket'
  2260. tst_size_checks='4 8 2'
  2261. fi
  2262. for tst_size in $tst_size_checks; do
  2263. for tst_pull_headers in $tst_pull_header_checks; do
  2264. if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
  2265. case $tst_pull_headers in
  2266. ws2tcpip)
  2267. tmp_includes="$curl_includes_ws2tcpip"
  2268. ;;
  2269. systypes)
  2270. tmp_includes="$curl_includes_sys_types"
  2271. ;;
  2272. syssocket)
  2273. tmp_includes="$curl_includes_sys_socket"
  2274. ;;
  2275. *)
  2276. tmp_includes=""
  2277. ;;
  2278. esac
  2279. AC_COMPILE_IFELSE([
  2280. AC_LANG_PROGRAM([[
  2281. $tmp_includes
  2282. typedef $curl_typeof_curl_socklen_t curl_socklen_t;
  2283. typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1];
  2284. ]],[[
  2285. curl_socklen_t dummy;
  2286. ]])
  2287. ],[
  2288. curl_sizeof_curl_socklen_t="$tst_size"
  2289. curl_pull_headers_socklen_t="$tst_pull_headers"
  2290. ])
  2291. fi
  2292. done
  2293. done
  2294. AC_MSG_RESULT([$curl_sizeof_curl_socklen_t])
  2295. if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
  2296. AC_MSG_ERROR([cannot find out size of curl_socklen_t.])
  2297. fi
  2298. #
  2299. case $curl_pull_headers_socklen_t in
  2300. ws2tcpip)
  2301. CURL_DEFINE_UNQUOTED([CURL_PULL_WS2TCPIP_H])
  2302. ;;
  2303. systypes)
  2304. CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
  2305. ;;
  2306. syssocket)
  2307. CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
  2308. CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_SOCKET_H])
  2309. ;;
  2310. esac
  2311. CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_SOCKLEN_T], [$curl_typeof_curl_socklen_t])
  2312. CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_SOCKLEN_T], [$curl_sizeof_curl_socklen_t])
  2313. ])
  2314. dnl CURL_CHECK_FUNC_SELECT
  2315. dnl -------------------------------------------------
  2316. dnl Test if the socket select() function is available,
  2317. dnl and check its return type and the types of its
  2318. dnl arguments. If the function succeeds HAVE_SELECT
  2319. dnl will be defined, defining the types of the
  2320. dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
  2321. dnl and SELECT_TYPE_ARG5, defining the type of the
  2322. dnl function return value in SELECT_TYPE_RETV, and
  2323. dnl also defining the type qualifier of fifth argument
  2324. dnl in SELECT_QUAL_ARG5.
  2325. AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
  2326. AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
  2327. AC_CHECK_HEADERS(sys/select.h sys/socket.h)
  2328. #
  2329. AC_MSG_CHECKING([for select])
  2330. AC_LINK_IFELSE([
  2331. AC_LANG_PROGRAM([[
  2332. #undef inline
  2333. #ifdef HAVE_WINDOWS_H
  2334. #ifndef WIN32_LEAN_AND_MEAN
  2335. #define WIN32_LEAN_AND_MEAN
  2336. #endif
  2337. #include <windows.h>
  2338. #ifdef HAVE_WINSOCK2_H
  2339. #include <winsock2.h>
  2340. #else
  2341. #ifdef HAVE_WINSOCK_H
  2342. #include <winsock.h>
  2343. #endif
  2344. #endif
  2345. #endif
  2346. #ifdef HAVE_SYS_TYPES_H
  2347. #include <sys/types.h>
  2348. #endif
  2349. #ifdef HAVE_SYS_TIME_H
  2350. #include <sys/time.h>
  2351. #ifdef TIME_WITH_SYS_TIME
  2352. #include <time.h>
  2353. #endif
  2354. #else
  2355. #ifdef HAVE_TIME_H
  2356. #include <time.h>
  2357. #endif
  2358. #endif
  2359. #ifndef HAVE_WINDOWS_H
  2360. #ifdef HAVE_SYS_SELECT_H
  2361. #include <sys/select.h>
  2362. #endif
  2363. #ifdef HAVE_SYS_SOCKET_H
  2364. #include <sys/socket.h>
  2365. #endif
  2366. #endif
  2367. ]],[[
  2368. select(0, 0, 0, 0, 0);
  2369. ]])
  2370. ],[
  2371. AC_MSG_RESULT([yes])
  2372. curl_cv_select="yes"
  2373. ],[
  2374. AC_MSG_RESULT([no])
  2375. curl_cv_select="no"
  2376. ])
  2377. #
  2378. if test "$curl_cv_select" = "yes"; then
  2379. AC_CACHE_CHECK([types of args and return type for select],
  2380. [curl_cv_func_select_args], [
  2381. curl_cv_func_select_args="unknown"
  2382. for sel_retv in 'int' 'ssize_t'; do
  2383. for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
  2384. for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
  2385. for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
  2386. if test "$curl_cv_func_select_args" = "unknown"; then
  2387. AC_COMPILE_IFELSE([
  2388. AC_LANG_PROGRAM([[
  2389. #undef inline
  2390. #ifdef HAVE_WINDOWS_H
  2391. #ifndef WIN32_LEAN_AND_MEAN
  2392. #define WIN32_LEAN_AND_MEAN
  2393. #endif
  2394. #include <windows.h>
  2395. #ifdef HAVE_WINSOCK2_H
  2396. #include <winsock2.h>
  2397. #else
  2398. #ifdef HAVE_WINSOCK_H
  2399. #include <winsock.h>
  2400. #endif
  2401. #endif
  2402. #define SELECTCALLCONV PASCAL
  2403. #endif
  2404. #ifdef HAVE_SYS_TYPES_H
  2405. #include <sys/types.h>
  2406. #endif
  2407. #ifdef HAVE_SYS_TIME_H
  2408. #include <sys/time.h>
  2409. #ifdef TIME_WITH_SYS_TIME
  2410. #include <time.h>
  2411. #endif
  2412. #else
  2413. #ifdef HAVE_TIME_H
  2414. #include <time.h>
  2415. #endif
  2416. #endif
  2417. #ifndef HAVE_WINDOWS_H
  2418. #ifdef HAVE_SYS_SELECT_H
  2419. #include <sys/select.h>
  2420. #endif
  2421. #ifdef HAVE_SYS_SOCKET_H
  2422. #include <sys/socket.h>
  2423. #endif
  2424. #define SELECTCALLCONV
  2425. #endif
  2426. #ifndef HAVE_STRUCT_TIMEVAL
  2427. struct timeval {
  2428. long tv_sec;
  2429. long tv_usec;
  2430. };
  2431. #endif
  2432. extern $sel_retv SELECTCALLCONV select($sel_arg1,
  2433. $sel_arg234,
  2434. $sel_arg234,
  2435. $sel_arg234,
  2436. $sel_arg5);
  2437. ]],[[
  2438. $sel_arg1 nfds=0;
  2439. $sel_arg234 rfds=0;
  2440. $sel_arg234 wfds=0;
  2441. $sel_arg234 efds=0;
  2442. $sel_retv res = select(nfds, rfds, wfds, efds, 0);
  2443. ]])
  2444. ],[
  2445. curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
  2446. ])
  2447. fi
  2448. done
  2449. done
  2450. done
  2451. done
  2452. ]) # AC-CACHE-CHECK
  2453. if test "$curl_cv_func_select_args" = "unknown"; then
  2454. AC_MSG_WARN([Cannot find proper types to use for select args])
  2455. AC_MSG_WARN([HAVE_SELECT will not be defined])
  2456. else
  2457. select_prev_IFS=$IFS; IFS=','
  2458. set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
  2459. IFS=$select_prev_IFS
  2460. shift
  2461. #
  2462. sel_qual_type_arg5=$[3]
  2463. #
  2464. AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
  2465. [Define to the type of arg 1 for select.])
  2466. AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
  2467. [Define to the type of args 2, 3 and 4 for select.])
  2468. AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
  2469. [Define to the function return type for select.])
  2470. #
  2471. prev_sh_opts=$-
  2472. #
  2473. case $prev_sh_opts in
  2474. *f*)
  2475. ;;
  2476. *)
  2477. set -f
  2478. ;;
  2479. esac
  2480. #
  2481. case "$sel_qual_type_arg5" in
  2482. const*)
  2483. sel_qual_arg5=const
  2484. sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
  2485. ;;
  2486. *)
  2487. sel_qual_arg5=
  2488. sel_type_arg5=$sel_qual_type_arg5
  2489. ;;
  2490. esac
  2491. #
  2492. AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
  2493. [Define to the type qualifier of arg 5 for select.])
  2494. AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
  2495. [Define to the type of arg 5 for select.])
  2496. #
  2497. case $prev_sh_opts in
  2498. *f*)
  2499. ;;
  2500. *)
  2501. set +f
  2502. ;;
  2503. esac
  2504. #
  2505. AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
  2506. [Define to 1 if you have the select function.])
  2507. ac_cv_func_select="yes"
  2508. fi
  2509. fi
  2510. ])
  2511. # This is only a temporary fix. This macro is here to replace the broken one
  2512. # delivered by the automake project (including the 1.9.6 release). As soon as
  2513. # they ship a working version we SHOULD remove this work-around.
  2514. AC_DEFUN([AM_MISSING_HAS_RUN],
  2515. [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
  2516. test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
  2517. # Use eval to expand $SHELL
  2518. if eval "$MISSING --run true"; then
  2519. am_missing_run="$MISSING --run "
  2520. else
  2521. am_missing_run=
  2522. AC_MSG_WARN([`missing' script is too old or missing])
  2523. fi
  2524. ])
  2525. dnl CURL_VERIFY_RUNTIMELIBS
  2526. dnl -------------------------------------------------
  2527. dnl Verify that the shared libs found so far can be used when running
  2528. dnl programs, since otherwise the situation will create odd configure errors
  2529. dnl that are misleading people.
  2530. dnl
  2531. dnl Make sure this test is run BEFORE the first test in the script that
  2532. dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
  2533. dnl macro. It must also run AFTER all lib-checking macros are complete.
  2534. AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
  2535. dnl this test is of course not sensible if we are cross-compiling!
  2536. if test "x$cross_compiling" != xyes; then
  2537. dnl just run a program to verify that the libs checked for previous to this
  2538. dnl point also is available run-time!
  2539. AC_MSG_CHECKING([run-time libs availability])
  2540. AC_TRY_RUN([
  2541. main()
  2542. {
  2543. return 0;
  2544. }
  2545. ],
  2546. AC_MSG_RESULT([fine]),
  2547. AC_MSG_RESULT([failed])
  2548. AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
  2549. )
  2550. dnl if this test fails, configure has already stopped
  2551. fi
  2552. ])
  2553. dnl CURL_CHECK_VARIADIC_MACROS
  2554. dnl -------------------------------------------------
  2555. dnl Check compiler support of variadic macros
  2556. AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
  2557. AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
  2558. [curl_cv_variadic_macros_c99], [
  2559. AC_COMPILE_IFELSE([
  2560. AC_LANG_PROGRAM([[
  2561. #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
  2562. #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
  2563. int fun3(int arg1, int arg2, int arg3);
  2564. int fun2(int arg1, int arg2);
  2565. int fun3(int arg1, int arg2, int arg3)
  2566. { return arg1 + arg2 + arg3; }
  2567. int fun2(int arg1, int arg2)
  2568. { return arg1 + arg2; }
  2569. ]],[[
  2570. int res3 = c99_vmacro3(1, 2, 3);
  2571. int res2 = c99_vmacro2(1, 2);
  2572. ]])
  2573. ],[
  2574. curl_cv_variadic_macros_c99="yes"
  2575. ],[
  2576. curl_cv_variadic_macros_c99="no"
  2577. ])
  2578. ])
  2579. case "$curl_cv_variadic_macros_c99" in
  2580. yes)
  2581. AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
  2582. [Define to 1 if compiler supports C99 variadic macro style.])
  2583. ;;
  2584. esac
  2585. AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
  2586. [curl_cv_variadic_macros_gcc], [
  2587. AC_COMPILE_IFELSE([
  2588. AC_LANG_PROGRAM([[
  2589. #define gcc_vmacro3(first, args...) fun3(first, args)
  2590. #define gcc_vmacro2(first, args...) fun2(first, args)
  2591. int fun3(int arg1, int arg2, int arg3);
  2592. int fun2(int arg1, int arg2);
  2593. int fun3(int arg1, int arg2, int arg3)
  2594. { return arg1 + arg2 + arg3; }
  2595. int fun2(int arg1, int arg2)
  2596. { return arg1 + arg2; }
  2597. ]],[[
  2598. int res3 = gcc_vmacro3(1, 2, 3);
  2599. int res2 = gcc_vmacro2(1, 2);
  2600. ]])
  2601. ],[
  2602. curl_cv_variadic_macros_gcc="yes"
  2603. ],[
  2604. curl_cv_variadic_macros_gcc="no"
  2605. ])
  2606. ])
  2607. case "$curl_cv_variadic_macros_gcc" in
  2608. yes)
  2609. AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
  2610. [Define to 1 if compiler supports old gcc variadic macro style.])
  2611. ;;
  2612. esac
  2613. ])
  2614. dnl CURL_CHECK_CA_BUNDLE
  2615. dnl -------------------------------------------------
  2616. dnl Check if a default ca-bundle should be used
  2617. dnl
  2618. dnl regarding the paths this will scan:
  2619. dnl /etc/ssl/certs/ca-certificates.crt Debian systems
  2620. dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
  2621. dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
  2622. dnl /usr/local/share/certs/ca-root.crt FreeBSD
  2623. dnl /etc/ssl/cert.pem OpenBSD
  2624. dnl /etc/ssl/certs/ (ca path) SUSE
  2625. AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
  2626. AC_MSG_CHECKING([default CA cert bundle/path])
  2627. AC_ARG_WITH(ca-bundle,
  2628. AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle])
  2629. AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
  2630. [
  2631. want_ca="$withval"
  2632. if test "x$want_ca" = "xyes"; then
  2633. AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
  2634. fi
  2635. ],
  2636. [ want_ca="unset" ])
  2637. AC_ARG_WITH(ca-path,
  2638. AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path])
  2639. AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
  2640. [
  2641. want_capath="$withval"
  2642. if test "x$want_capath" = "xyes"; then
  2643. AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
  2644. fi
  2645. ],
  2646. [ want_capath="unset"])
  2647. if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
  2648. "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
  2649. dnl both given
  2650. AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.])
  2651. elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
  2652. dnl --with-ca-bundle given
  2653. ca="$want_ca"
  2654. capath="no"
  2655. elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
  2656. dnl --with-ca-path given
  2657. if test "x$OPENSSL_ENABLED" != "x1"; then
  2658. AC_MSG_ERROR([--with-ca-path only works with openSSL])
  2659. fi
  2660. capath="$want_capath"
  2661. ca="no"
  2662. else
  2663. dnl neither of --with-ca-* given
  2664. dnl first try autodetecting a CA bundle , then a CA path
  2665. dnl both autodetections can be skipped by --without-ca-*
  2666. ca="no"
  2667. capath="no"
  2668. if test "x$want_ca" = "xunset"; then
  2669. dnl the path we previously would have installed the curl ca bundle
  2670. dnl to, and thus we now check for an already existing cert in that place
  2671. dnl in case we find no other
  2672. if test "x$prefix" != xNONE; then
  2673. cac="${prefix}/share/curl/curl-ca-bundle.crt"
  2674. else
  2675. cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
  2676. fi
  2677. for a in /etc/ssl/certs/ca-certificates.crt \
  2678. /etc/pki/tls/certs/ca-bundle.crt \
  2679. /usr/share/ssl/certs/ca-bundle.crt \
  2680. /usr/local/share/certs/ca-root.crt \
  2681. /etc/ssl/cert.pem \
  2682. "$cac"; do
  2683. if test -f "$a"; then
  2684. ca="$a"
  2685. break
  2686. fi
  2687. done
  2688. fi
  2689. if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
  2690. "x$OPENSSL_ENABLED" = "x1"; then
  2691. for a in /etc/ssl/certs/; do
  2692. 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
  2693. capath="$a"
  2694. break
  2695. fi
  2696. done
  2697. fi
  2698. fi
  2699. if test "x$ca" != "xno"; then
  2700. CURL_CA_BUNDLE='"'$ca'"'
  2701. AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
  2702. AC_SUBST(CURL_CA_BUNDLE)
  2703. AC_MSG_RESULT([$ca])
  2704. elif test "x$capath" != "xno"; then
  2705. CURL_CA_PATH="\"$capath\""
  2706. AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
  2707. AC_MSG_RESULT([$capath (capath)])
  2708. else
  2709. AC_MSG_RESULT([no])
  2710. fi
  2711. ])
  2712. dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE)
  2713. dnl -------------------------------------------------
  2714. dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
  2715. AC_DEFUN([DO_CURL_OFF_T_CHECK], [
  2716. AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
  2717. if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$1"; then
  2718. tmp_includes=""
  2719. tmp_source=""
  2720. tmp_fmt=""
  2721. case XC_SH_TR_SH([$1]) in
  2722. int64_t)
  2723. tmp_includes="$curl_includes_inttypes"
  2724. tmp_source="char f@<:@@:>@ = PRId64;"
  2725. tmp_fmt="PRId64"
  2726. ;;
  2727. int32_t)
  2728. tmp_includes="$curl_includes_inttypes"
  2729. tmp_source="char f@<:@@:>@ = PRId32;"
  2730. tmp_fmt="PRId32"
  2731. ;;
  2732. int16_t)
  2733. tmp_includes="$curl_includes_inttypes"
  2734. tmp_source="char f@<:@@:>@ = PRId16;"
  2735. tmp_fmt="PRId16"
  2736. ;;
  2737. esac
  2738. AC_COMPILE_IFELSE([
  2739. AC_LANG_PROGRAM([[
  2740. $tmp_includes
  2741. typedef $1 curl_off_t;
  2742. typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1];
  2743. ]],[[
  2744. $tmp_source
  2745. curl_off_t dummy;
  2746. ]])
  2747. ],[
  2748. if test -z "$tmp_fmt"; then
  2749. curl_typeof_curl_off_t="$1"
  2750. curl_sizeof_curl_off_t="$2"
  2751. else
  2752. CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent])
  2753. AS_VAR_PUSHDEF([tmp_HaveFmtDef], [curl_cv_have_def_$tmp_fmt])dnl
  2754. AS_VAR_PUSHDEF([tmp_FmtDef], [curl_cv_def_$tmp_fmt])dnl
  2755. if test AS_VAR_GET(tmp_HaveFmtDef) = "yes"; then
  2756. curl_format_curl_off_t=AS_VAR_GET(tmp_FmtDef)
  2757. curl_typeof_curl_off_t="$1"
  2758. curl_sizeof_curl_off_t="$2"
  2759. fi
  2760. AS_VAR_POPDEF([tmp_FmtDef])dnl
  2761. AS_VAR_POPDEF([tmp_HaveFmtDef])dnl
  2762. fi
  2763. ])
  2764. fi
  2765. ])
  2766. dnl DO_CURL_OFF_T_SUFFIX_CHECK (TYPE)
  2767. dnl -------------------------------------------------
  2768. dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
  2769. AC_DEFUN([DO_CURL_OFF_T_SUFFIX_CHECK], [
  2770. AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
  2771. AC_MSG_CHECKING([constant suffix string for curl_off_t])
  2772. #
  2773. curl_suffix_curl_off_t="unknown"
  2774. curl_suffix_curl_off_tu="unknown"
  2775. #
  2776. case XC_SH_TR_SH([$1]) in
  2777. long_long | __longlong | __longlong_t)
  2778. tst_suffixes="LL::"
  2779. ;;
  2780. long)
  2781. tst_suffixes="L::"
  2782. ;;
  2783. int)
  2784. tst_suffixes="::"
  2785. ;;
  2786. __int64 | int64_t)
  2787. tst_suffixes="LL:i64::"
  2788. ;;
  2789. __int32 | int32_t)
  2790. tst_suffixes="L:i32::"
  2791. ;;
  2792. __int16 | int16_t)
  2793. tst_suffixes="L:i16::"
  2794. ;;
  2795. *)
  2796. AC_MSG_ERROR([unexpected data type $1])
  2797. ;;
  2798. esac
  2799. #
  2800. old_IFS=$IFS; IFS=':'
  2801. for tmp_ssuf in $tst_suffixes ; do
  2802. IFS=$old_IFS
  2803. if test "x$curl_suffix_curl_off_t" = "xunknown"; then
  2804. case $tmp_ssuf in
  2805. i64 | i32 | i16)
  2806. tmp_usuf="u$tmp_ssuf"
  2807. ;;
  2808. LL | L)
  2809. tmp_usuf="U$tmp_ssuf"
  2810. ;;
  2811. *)
  2812. tmp_usuf=""
  2813. ;;
  2814. esac
  2815. AC_COMPILE_IFELSE([
  2816. AC_LANG_PROGRAM([[
  2817. $curl_includes_inttypes
  2818. typedef $1 new_t;
  2819. ]],[[
  2820. new_t s1;
  2821. new_t s2;
  2822. s1 = -10$tmp_ssuf ;
  2823. s2 = 20$tmp_ssuf ;
  2824. if(s1 > s2)
  2825. return 1;
  2826. ]])
  2827. ],[
  2828. curl_suffix_curl_off_t="$tmp_ssuf"
  2829. curl_suffix_curl_off_tu="$tmp_usuf"
  2830. ])
  2831. fi
  2832. done
  2833. IFS=$old_IFS
  2834. #
  2835. if test "x$curl_suffix_curl_off_t" = "xunknown"; then
  2836. AC_MSG_ERROR([cannot find constant suffix string for curl_off_t.])
  2837. else
  2838. AC_MSG_RESULT([$curl_suffix_curl_off_t])
  2839. AC_MSG_CHECKING([constant suffix string for unsigned curl_off_t])
  2840. AC_MSG_RESULT([$curl_suffix_curl_off_tu])
  2841. fi
  2842. #
  2843. ])
  2844. dnl CURL_CONFIGURE_CURL_OFF_T
  2845. dnl -------------------------------------------------
  2846. dnl Find out suitable curl_off_t data type definition and associated
  2847. dnl items, and make the appropriate definitions used in template file
  2848. dnl include/curl/curlbuild.h.in to properly configure the library.
  2849. AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [
  2850. AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
  2851. #
  2852. AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl
  2853. AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl
  2854. AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl
  2855. #
  2856. if test -z "$SED"; then
  2857. AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
  2858. fi
  2859. #
  2860. AC_CHECK_SIZEOF(long)
  2861. AC_CHECK_SIZEOF(void*)
  2862. #
  2863. if test -z "$ac_cv_sizeof_long" ||
  2864. test "$ac_cv_sizeof_long" -eq "0"; then
  2865. AC_MSG_ERROR([cannot find out size of long.])
  2866. fi
  2867. if test -z "$ac_cv_sizeof_voidp" ||
  2868. test "$ac_cv_sizeof_voidp" -eq "0"; then
  2869. AC_MSG_ERROR([cannot find out size of void*.])
  2870. fi
  2871. #
  2872. x_LP64_long=""
  2873. x_LP32_long=""
  2874. x_LP16_long=""
  2875. #
  2876. if test "$ac_cv_sizeof_long" -eq "8" &&
  2877. test "$ac_cv_sizeof_voidp" -ge "8"; then
  2878. x_LP64_long="long"
  2879. elif test "$ac_cv_sizeof_long" -eq "4" &&
  2880. test "$ac_cv_sizeof_voidp" -ge "4"; then
  2881. x_LP32_long="long"
  2882. elif test "$ac_cv_sizeof_long" -eq "2" &&
  2883. test "$ac_cv_sizeof_voidp" -ge "2"; then
  2884. x_LP16_long="long"
  2885. fi
  2886. #
  2887. dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars
  2888. #
  2889. curl_typeof_curl_off_t="unknown"
  2890. curl_sizeof_curl_off_t="unknown"
  2891. curl_format_curl_off_t="unknown"
  2892. curl_format_curl_off_tu="unknown"
  2893. #
  2894. if test "$curl_typeof_curl_off_t" = "unknown"; then
  2895. AC_MSG_CHECKING([for 64-bit curl_off_t data type])
  2896. for t8 in \
  2897. "$x_LP64_long" \
  2898. 'int64_t' \
  2899. '__int64' \
  2900. 'long long' \
  2901. '__longlong' \
  2902. '__longlong_t' ; do
  2903. DO_CURL_OFF_T_CHECK([$t8], [8])
  2904. done
  2905. AC_MSG_RESULT([$curl_typeof_curl_off_t])
  2906. fi
  2907. if test "$curl_typeof_curl_off_t" = "unknown"; then
  2908. AC_MSG_CHECKING([for 32-bit curl_off_t data type])
  2909. for t4 in \
  2910. "$x_LP32_long" \
  2911. 'int32_t' \
  2912. '__int32' \
  2913. 'int' ; do
  2914. DO_CURL_OFF_T_CHECK([$t4], [4])
  2915. done
  2916. AC_MSG_RESULT([$curl_typeof_curl_off_t])
  2917. fi
  2918. if test "$curl_typeof_curl_off_t" = "unknown"; then
  2919. AC_MSG_CHECKING([for 16-bit curl_off_t data type])
  2920. for t2 in \
  2921. "$x_LP16_long" \
  2922. 'int16_t' \
  2923. '__int16' \
  2924. 'int' ; do
  2925. DO_CURL_OFF_T_CHECK([$t2], [2])
  2926. done
  2927. AC_MSG_RESULT([$curl_typeof_curl_off_t])
  2928. fi
  2929. if test "$curl_typeof_curl_off_t" = "unknown"; then
  2930. AC_MSG_ERROR([cannot find data type for curl_off_t.])
  2931. fi
  2932. #
  2933. AC_MSG_CHECKING([size of curl_off_t])
  2934. AC_MSG_RESULT([$curl_sizeof_curl_off_t])
  2935. #
  2936. AC_MSG_CHECKING([formatting string directive for curl_off_t])
  2937. if test "$curl_format_curl_off_t" != "unknown"; then
  2938. x_pull_headers="yes"
  2939. curl_format_curl_off_t=`echo "$curl_format_curl_off_t" | "$SED" 's/[["]]//g'`
  2940. curl_format_curl_off_tu=`echo "$curl_format_curl_off_t" | "$SED" 's/i$/u/'`
  2941. curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/d$/u/'`
  2942. curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/D$/U/'`
  2943. else
  2944. x_pull_headers="no"
  2945. case XC_SH_TR_SH([$curl_typeof_curl_off_t]) in
  2946. long_long | __longlong | __longlong_t)
  2947. curl_format_curl_off_t="lld"
  2948. curl_format_curl_off_tu="llu"
  2949. ;;
  2950. long)
  2951. curl_format_curl_off_t="ld"
  2952. curl_format_curl_off_tu="lu"
  2953. ;;
  2954. int)
  2955. curl_format_curl_off_t="d"
  2956. curl_format_curl_off_tu="u"
  2957. ;;
  2958. __int64)
  2959. curl_format_curl_off_t="I64d"
  2960. curl_format_curl_off_tu="I64u"
  2961. ;;
  2962. __int32)
  2963. curl_format_curl_off_t="I32d"
  2964. curl_format_curl_off_tu="I32u"
  2965. ;;
  2966. __int16)
  2967. curl_format_curl_off_t="I16d"
  2968. curl_format_curl_off_tu="I16u"
  2969. ;;
  2970. *)
  2971. AC_MSG_ERROR([cannot find print format string for curl_off_t.])
  2972. ;;
  2973. esac
  2974. fi
  2975. AC_MSG_RESULT(["$curl_format_curl_off_t"])
  2976. #
  2977. AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t])
  2978. AC_MSG_RESULT(["$curl_format_curl_off_tu"])
  2979. #
  2980. DO_CURL_OFF_T_SUFFIX_CHECK([$curl_typeof_curl_off_t])
  2981. #
  2982. if test "$x_pull_headers" = "yes"; then
  2983. if test "x$ac_cv_header_sys_types_h" = "xyes"; then
  2984. CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
  2985. fi
  2986. if test "x$ac_cv_header_stdint_h" = "xyes"; then
  2987. CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H])
  2988. fi
  2989. if test "x$ac_cv_header_inttypes_h" = "xyes"; then
  2990. CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H])
  2991. fi
  2992. fi
  2993. #
  2994. CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_OFF_T], [$curl_typeof_curl_off_t])
  2995. CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_T], ["$curl_format_curl_off_t"])
  2996. CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_TU], ["$curl_format_curl_off_tu"])
  2997. CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$curl_format_curl_off_t"])
  2998. CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$curl_sizeof_curl_off_t])
  2999. CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_T], [$curl_suffix_curl_off_t])
  3000. CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_TU], [$curl_suffix_curl_off_tu])
  3001. #
  3002. ])
  3003. dnl CURL_CHECK_WIN32_LARGEFILE
  3004. dnl -------------------------------------------------
  3005. dnl Check if curl's WIN32 large file will be used
  3006. AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
  3007. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  3008. AC_MSG_CHECKING([whether build target supports WIN32 file API])
  3009. curl_win32_file_api="no"
  3010. if test "$ac_cv_header_windows_h" = "yes"; then
  3011. if test x"$enable_largefile" != "xno"; then
  3012. AC_COMPILE_IFELSE([
  3013. AC_LANG_PROGRAM([[
  3014. ]],[[
  3015. #if !defined(_WIN32_WCE) && \
  3016. (defined(__MINGW32__) || \
  3017. (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
  3018. int dummy=1;
  3019. #else
  3020. WIN32 large file API not supported.
  3021. #endif
  3022. ]])
  3023. ],[
  3024. curl_win32_file_api="win32_large_files"
  3025. ])
  3026. fi
  3027. if test "$curl_win32_file_api" = "no"; then
  3028. AC_COMPILE_IFELSE([
  3029. AC_LANG_PROGRAM([[
  3030. ]],[[
  3031. #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
  3032. int dummy=1;
  3033. #else
  3034. WIN32 small file API not supported.
  3035. #endif
  3036. ]])
  3037. ],[
  3038. curl_win32_file_api="win32_small_files"
  3039. ])
  3040. fi
  3041. fi
  3042. case "$curl_win32_file_api" in
  3043. win32_large_files)
  3044. AC_MSG_RESULT([yes (large file enabled)])
  3045. AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
  3046. [Define to 1 if you are building a Windows target with large file support.])
  3047. ;;
  3048. win32_small_files)
  3049. AC_MSG_RESULT([yes (large file disabled)])
  3050. AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
  3051. [Define to 1 if you are building a Windows target without large file support.])
  3052. ;;
  3053. *)
  3054. AC_MSG_RESULT([no])
  3055. ;;
  3056. esac
  3057. ])
  3058. dnl CURL_EXPORT_PCDIR ($pcdir)
  3059. dnl ------------------------
  3060. dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
  3061. dnl
  3062. dnl we need this macro since pkg-config distinguishes among empty and unset
  3063. dnl variable while checking PKG_CONFIG_LIBDIR
  3064. dnl
  3065. AC_DEFUN([CURL_EXPORT_PCDIR], [
  3066. if test -n "$1"; then
  3067. PKG_CONFIG_LIBDIR="$1"
  3068. export PKG_CONFIG_LIBDIR
  3069. fi
  3070. ])
  3071. dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
  3072. dnl ------------------------
  3073. dnl search for the pkg-config tool (if not cross-compiling). Set the PKGCONFIG
  3074. dnl variable to hold the path to it, or 'no' if not found/present.
  3075. dnl
  3076. dnl If pkg-config is present, check that it has info about the $module or
  3077. dnl return "no" anyway!
  3078. dnl
  3079. dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
  3080. dnl
  3081. AC_DEFUN([CURL_CHECK_PKGCONFIG], [
  3082. PKGCONFIG="no"
  3083. if test x$cross_compiling = xyes; then
  3084. dnl see if there's a pkg-specific for this host setup
  3085. AC_PATH_PROG( PKGCONFIG, ${host}-pkg-config, no,
  3086. $PATH:/usr/bin:/usr/local/bin)
  3087. fi
  3088. if test x$PKGCONFIG = xno; then
  3089. AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
  3090. fi
  3091. if test x$PKGCONFIG != xno; then
  3092. AC_MSG_CHECKING([for $1 options with pkg-config])
  3093. dnl ask pkg-config about $1
  3094. itexists=`CURL_EXPORT_PCDIR([$2]) dnl
  3095. $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
  3096. if test -z "$itexists"; then
  3097. dnl pkg-config does not have info about the given module! set the
  3098. dnl variable to 'no'
  3099. PKGCONFIG="no"
  3100. AC_MSG_RESULT([no])
  3101. else
  3102. AC_MSG_RESULT([found])
  3103. fi
  3104. fi
  3105. ])
  3106. dnl CURL_GENERATE_CONFIGUREHELP_PM
  3107. dnl -------------------------------------------------
  3108. dnl Generate test harness configurehelp.pm module, defining and
  3109. dnl initializing some perl variables with values which are known
  3110. dnl when the configure script runs. For portability reasons, test
  3111. dnl harness needs information on how to run the C preprocessor.
  3112. AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [
  3113. AC_REQUIRE([AC_PROG_CPP])dnl
  3114. tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
  3115. if test -z "$tmp_cpp"; then
  3116. tmp_cpp='cpp'
  3117. fi
  3118. cat >./tests/configurehelp.pm <<_EOF
  3119. [@%:@] This is a generated file. Do not edit.
  3120. package configurehelp;
  3121. use strict;
  3122. use warnings;
  3123. use Exporter;
  3124. use vars qw(
  3125. @ISA
  3126. @EXPORT_OK
  3127. \$Cpreprocessor
  3128. );
  3129. @ISA = qw(Exporter);
  3130. @EXPORT_OK = qw(
  3131. \$Cpreprocessor
  3132. );
  3133. \$Cpreprocessor = '$tmp_cpp';
  3134. 1;
  3135. _EOF
  3136. ])