acinclude.m4 88 KB

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